//navigation fix for windows/safari and Mac OS.
if(jQuery.client.os == "Windows" && jQuery.client.browser == "Safari" || jQuery.client.os == "Mac") { jQuery( function() {
 	jQuery('#main-navigation ul li a').css( 'padding', '4px 29px 0px 29px' );
    jQuery('#main-navigation ul li a.last').css( 'padding', '4px 30px 0px 31px' );
	}
); }

jQuery(document).ready(function(){

	//Hide Collapse the toggle containers on load
	jQuery(".toggle_container").hide();

	//Slide up and down on click
	jQuery("a.trigger-closed").click(function(){
		jQuery(this).next(".toggle_container").slideToggle("medium");
		jQuery(this).toggleClass("trigger-open");

		//find h2 two tag
		jQuery(this).find("span").each(function(i) {
		jQuery(this).toggleClass("gray");jQuery("h2").removeClass("blue");
		});

	});

	// login: hiding the background pictures (labels)
	jQuery("#login-form input.text-field").keyup(function(){
		fieldBackground(this);
	});

	//Log in show hide
	jQuery("#login-max").hide();
	jQuery("#login-btn").click(function(){
		jQuery("#login-min").hide();
		fieldBackground(jQuery("#login-form input.text-field"));
		jQuery("#login-max").show();
		jQuery("#login-form :input:first:enabled").focus();
	});

});

function fieldBackground(element) {
	if (jQuery(element).val().length > 0) {
		jQuery(element).addClass("text-back");
	} else {
		jQuery(element).removeClass("text-back");
	}
}

//Open pop up windows
function openWindow(myPage) {
	myPage = myPage+".php";
	window.open( myPage, "PlanetHome Window", "width = 675, height = 500, resizable = 0, scrollbars = yes" );
}
