/* InMotion Hosting Website v3.0 - JQuery DOM Manipulations & Effects */
/* Developed by: Adam Duro */

$(document).ready(function() {

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

	// Main Navigation Dotted Seperators
	$("#main_nav ul li.sep a").after('<span class="sep"></span>');

	// Order Box Header
	$("#order_box").prepend("<div></div>");
	
	// Zebra Stripe Tables
	$("#main_content tbody tr:even").addClass("odd");
	
	// Cusomer Quotes Mods
	$("#customer_quotes dl:even").addClass("odd");
	$("#customer_quotes dl:last").addClass("last");

	

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

	// Spec Table Expander Icon
		$("#package_specs table tbody tr td:first-child").prepend("<span></span>");
		$("#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"); }

	// Feature Expander Code

		// Initial State
		//$("#main_content .expander .hidden_content").hide();
		$("#main_content .expander_vps .hidden_content").hide(); //Keeps expander working on VPS page

		// Slide Action
		/*$("#main_content .expander")
			.hover(function(){
				$(this).addClass("expander-hover");
			},function(){
				$(this).removeClass("expander-hover");
			})

			.click(function(){
				$(this)
					.children(".intro").toggleClass("open") // Trigger plus-minus icon swap
					.siblings(".hidden_content").slideToggle("slow");
		});*/
		$("#main_content .expander_vps")
			.hover(function(){
				$(this).addClass("expander-hover");
			},function(){
				$(this).removeClass("expander-hover");
			})

			.click(function(){
				$(this)
					.children(".intro").toggleClass("open") // Trigger plus-minus icon swap
					.siblings(".hidden_content").slideToggle("slow");
		});
			
	// Table Expander Code
		// Initial State
		$("#package_specs table tbody tr td.expand .def").hide();
		// 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");
		});
		
/* ---------------------------------------------- */
/* --( 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(){
		});
	}
	
/* ---------------------------------------------- */
/* --( 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");
});
		
});