/* InMotion Hosting Website v3.0 - JQuery DOM Manipulations & Effects */

/* Developed by: Adam Duro */



$(document).ready(function() {



/* ---------------------------------------------- */

/* --( Global DOM Manipulations )-- */

/* ---------------------------------------------- */



	// Zebra Stripe Tables for domains.php

	$("#domain #main_content tbody tr:even").addClass("odd");

	$("#domain #package_specs table tbody tr td:first-child").prepend("<span></span>");



	// Cusomer Quotes Mods

	$("#customer_quotes dl:even").addClass("odd");

	$("#customer_quotes dl:last").addClass("last");

	

	

/* ---------------------------------------------- */

/* --( GA Click Tracking - Main Navigation )-- */

/* ---------------------------------------------- */

		$("#main_nav ul li a").each(function() {

				var linkTitle = $(this).attr("href"); // Grab the href attribute from the anchor element

				var linkDirectory = $("body").attr("id"); //Grab page_id for use in urchinTracker

				var linkName = '/' + linkDirectory + '/features' + linkTitle; // Sets up what page urchinTracker will display as viewed

				$(this).click(function() {

					urchinTracker(linkName);

				});

		});

	

/* ---------------------------------------------- */

/* --( Page Slider Effects )-- */

/* ---------------------------------------------- */



	// Spec Table Expander Icon

		$("#package_specs table tbody tr td div.def").parent().addClass("expand");

		$("#package_specs table tbody tr td.expand span").addClass("closed");

		if ($.browser.mozilla) { $("span.closed").css("padding-left", "22px"); }

		

	// Table Expander Code

		// Initial State

		$("#package_specs table tbody tr td.expand .def").hide();

		// Assign Unique ID for Google Analytics

		/*$('td.expand').each(function() {

				var $feature = $(this);

				var featureName = $(this).html();

				$(this).split("<");

				var featureDirectory = $("body").attr("id");

				var featureLink = '/' + featureDirectory + '/features/' + featureName + '.html';

		});*/

		// Slide Action

		$("#package_specs table tbody tr td.expand").bind("click", function(){

			$(this).children("span")

					.toggleClass("open"); // Trigger plus-minus icon swap

			$(this).children(".def").slideToggle("fast");

		

			// Google Analytics Tracking 

			var featureName = $(this).attr("abbr"); // Grabs abbr text for use in Google Analytics Urchin Tracking

			var featureDirectory = $("body").attr("id"); // Grabs page_id for use in urchinTracker

			var featureLink = '/' + featureDirectory + '/features/' + featureName + '.html'; // Sets up GA will display pageview

			urchinTracker(featureLink);

		});

		

		

/* ---------------------------------------------- */

/* --( Home Page Mods )-- */

/* ---------------------------------------------- */



	if ( $("body").attr("id") == "home" ) {

		// Home Page Feature Backgrounds

		$("#home #home_features .feature")

		.wrap('<div class="fh">'+'<div class="fb">'+'</div>'+'</div>');

		

		// Feature Box Content Expander

		

		$("#home #home_features .fh .fb .feature .copy").hide(); //Does inital hide on text

		

		var last = ""; // Sets up variable for sotoring the last feature opened

		

		$("#home #home_features .fh .fb .feature").hover(function(){ // Sets a hover event on all feature boxes

				current = ($(this).attr("class")).substr(8); // Grabs the name of the class name from attribute

				if (current !== last) { // Checks to see if the the last one visted was not the one hovered over

					$("#home #home_features .fh .fb .feature .copy:visible").slideUp("slow"); // Closes any existingly visable text areas

					//$(this).children(".copy").slideDown("slow");	// Slides down the hovered over feature text	

				}

				last = current; // Sets the last variable to the feature that was just moused over

				$(this).click(function(){

					url = $(this).children("h3").children("a").attr("href");

					document.location = url;

				});

		},function(){

		});

	}

		// Slider Thumbnail Hide For non-JavaScript Browsers
	
		$("#slider3 #paginate-slider3").addClass("zIndex");
	

/* ---------------------------------------------- */


/* --( Web Design Form Submit )-- */

/* ---------------------------------------------- */



		//msg = $("input[@name=thankyou]").val();

		//$('form.ajax').ajaxForm(function() { 

			 //$('form.ajax').before('<p class="form_thanks">' + msg + '</p>');

			 $(".form_thanks").hide().slideDown("slow");

			 //$('form.ajax #submit').attr("disabled","disabled");

		//});

	

/* ---------------------------------------------- */

/* --( Domain Effects )-- */

/* ---------------------------------------------- */



$("#domain_suggest").hide();

$("#register_domain .no_domain").fadeIn(1500,function(){

	$("#domain_suggest").slideDown("slow");

});

$("#register_domain .yes_domain").fadeIn(1500,function(){

	$("#domain_suggest").slideDown("slow");

});

		

});