﻿/****************************************/
/* Main javascript                      */
/****************************************/
/** VMO                                 */
/** Author: O.B. | BrightDigital.com    */
/*****************************************
[*]  Requires jquery.1.3.2
*****************************************/

$(document).ready(function(){
	//function for contact form dropdown
    var speed = 300;
	function contact() {
		if ($("#contactForm").is(":hidden")){
			$("#contactForm").slideDown(speed);
			var windowWidth = $(document).width();
			var formLeft = (windowWidth - 780)/2;
			$("#contactForm").css("left", formLeft);
			$("#bgPopup").css({"opacity": "0.3"});
			//$("#cfContent").fadeIn(speed*3); 
			$("#bgPopup").fadeIn(speed); 
			$(".lnkContact").fadeIn(speed);
			$(".lnkContact").fadeIn(speed);
			$(".lnkContact").click(function(){contact(); return false;});			
		}
		else{
			//$("#cfContent").fadeOut(speed-200);
			$("#contactForm").slideUp(speed);
			$("#bgPopup").fadeOut(speed);
			$(".lnkContact").fadeOut(speed);			
		    return false;
		}
	}
	 
	$(".contact").click(function(){contact()});
	
	//Clear form text fields on focus for Contact panel
	$("input", "#cfContent").focus(function(){
	    var hisValue = $(this).val();
	    $(this).val("");
	    $(this).blur(function(){
	        if($(this).val() =="Name" || $(this).val() =="Email" || $(this).val() =="Email" || $(this).val() =="Company" || $(this).val() =="Phone" || $(this).val() =="" ){$(this).val(hisValue);}
	        else {hisValue = "";}
	    });
	});
	
	//Clear form text fields on focus for Request A brochure
	$("input", "#ctl00_cphMain_RequestBrochureForm1_formRequest").focus(function(){
	    var hisValue = $(this).val();
	    $(this).val("");
	    $(this).blur(function(){
	        if($(this).val() =="Name" || $(this).val() =="Email" || $(this).val() =="Email" || $(this).val() =="Company" || $(this).val() =="Phone" || $(this).val() =="" ){$(this).val(hisValue);}
	        else {hisValue = "";}
	    });
	});
	
	// IE fix
	$(document).pngFix(); 
	$("#bgPopup").css({  
		"height": document.documentElement.clientHeight 
	}); 
});

