/* 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");
	
	

/* ---------------------------------------------- */
/* --( 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();
		// 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");
});
		
});