/* <![CDATA[ */
/*highlight text */			
 function SelectAll(id)
{
	var val = document.getElementById(id).value;
	
	if(val == "Name:" || val == "Email:" || val == "Phone:"){
	document.getElementById(id).value="";
	}else{
	document.getElementById(id).focus();
    document.getElementById(id).select();
	}
}

function resetForm(id){
	var val = document.getElementById(id).value;
	
if(val == ""  ){
	switch(id){
		case "name":
			document.getElementById(id).value = "Name:";
		break;
		
		case "email":
			document.getElementById(id).value = "Email:";
		break;
		
		case "phone":
			document.getElementById(id).value = "Phone:";
		break;
		
	}
}
}

function validate(id){
	switch(id){
		case "name":
			if(document.getElementById(id).value == ""){
				$('name').after('<span>Enter name</span>');
				
			}
		break;
		
		case "email":
			$(".error1").remove();
			var hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
	 
			var emailaddressVal = $("#email").val();
			if(emailaddressVal == '') {
				$("#email").after('<span class="error1">* Please enter your email address.</span>');
				hasError = true;
			}
	 
			else if(!emailReg.test(emailaddressVal)) {
				$("#email").after('<span class="error1">* Enter a valid email address.</span>');
				hasError = true;
			}
	 
			if(hasError == true) { return false; }
 

		break;
		
		case "phone":
			
			break;
			
		case "product":
		$(".error2").remove();
		if(document.getElementById(id).value == "000"){
			$(".qsubmit").after('<span class="error2">*Please Select a product.</span>');
		} else{
			$(".error2").remove();
		}
		break;
		
	}
}
$(document).ready(function (){
/*preloader*/							
(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)
var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

if(sPath=="electric-heaters.html"){
var i= 1;	
	while(i<=12){
	jQuery.preLoadImages("images/content/electric-heaters/Heat-"+ i +"a.png");
	i++;
	}
}
if(sPath=="industries.html"){
		jQuery.preLoadImages("images/content/industries/indus-plastics.jpg");
		jQuery.preLoadImages("images/content/industries/industry-oilgas.jpg");
		jQuery.preLoadImages("images/content/industries/industry-research.jpg");
		jQuery.preLoadImages("images/content/industries/industry-indprocess.jpg");
		jQuery.preLoadImages("images/content/industries/industry-wastewater.jpg");
		jQuery.preLoadImages("images/content/industries/industry-aerospace.jpg");
		jQuery.preLoadImages("images/content/industries/industry-laboratory.jpg");
		jQuery.preLoadImages("images/content/industries/industry-foundry.jpg");
		jQuery.preLoadImages("images/content/industries/industry-powergen.jpg");
		jQuery.preLoadImages("images/content/industries/industry-fieldservice.jpg");
		jQuery.preLoadImages("images/content/industries/industry-university.jpg");
		jQuery.preLoadImages("images/content/industries/industry-plating.jpg");
		jQuery.preLoadImages("images/content/industries/industry-medical.jpg");
		jQuery.preLoadImages("images/content/industries/industry-pulppaper.jpg");
		jQuery.preLoadImages("images/content/industries/industry-genmfg.jpg");
		}
/*end of preloader*/
			$(".qsubmit").click(function(){
					if(document.getElementById("name").value != "Name:" || document.getElementById("name").value != "Email:" || document.getElementById("phone").value != "Phone:" ){
						if($('.error2').length > 0 || $('.error1').length > 0   ){
						return false
						}else{
						return true
						}		
					}else{
						return false
					}
});
							
					$('#sitemap a').hover(function(){
											$('#sitemap span').remove();	   
							$(this).after('<span>&lArr;</span>');						   
												   });
						
							
	$('#industryLink a').hover(function(){
						var getvalue = $(this).attr('title');
						$('#industryPic').fadeOut('fast',function(){
										$('#industryPic').attr("src",getvalue);
										$('#industryPic').ready(function(){
													$('#industryPic').fadeIn('fast');					 
																		 });
										
										
										
																  });
$(this).animate({ backgroundColor: "#A7D3E9" }, 500);
},function() {
 $(this).animate({ backgroundColor: "#3399CC" }, 500);
	});
	
	$('#industryLink a').hover(function(){
						var getvalue = $(this).attr('title');
						$('#industryPic').fadeOut('fast',function(){
										$('#industryPic').attr("src",getvalue);
										$('#industryPic').ready(function(){
													$('#industryPic').fadeIn('fast');					 
																		 });
										
										
										
																  });
$(this).animate({ backgroundColor: "#A7D3E9" }, 500);
},function() {
 $(this).animate({ backgroundColor: "#3399CC" }, 500);
	});
	var getvalue="";
	$('#bannerNav a').hover(function(){
						getvalue = $(this).attr('title');
						$('#bannerpic').fadeOut('fast',function(){
										$('#bannerpic').attr("src",getvalue);
										$('#bannerpic').ready(function(){
													$('#bannerpic').fadeIn('fast');					 
																		 });
	
						});

	});
	/*var trg = 1;		
	$('#bannerNav a').hover(function() {
			$('#bannerNav a').removeClass('lactive');							 
		var getvalue = $(this).attr('title');
		$(this).addClass('lactive');						
			if(trg==1){
				trg = 0;
				 $('#bannerpic').hide("puff", {}, 100,
							  function(){
								$('#bannerpic').fadeOut('slow', function(){
									$('#bannerpic').attr("src",getvalue);
									$('#bannerpic').show("explode",{ pieces: 30 }, 500,function(){
																					trg = 1;			
																								});
									
								});
					});
	}
	
	});*/
							
	/*jquery rounded corners*/						
	if($.browser.msie == false){
		$('#header #banner #bannerNav ul li a').corner("5px");
		$('ul.dropdown').corner("bottom 5px");
		$('ul.tabs .top .top1').corner("top 5px");
	}
	$('#Contact_Box').corner("5px");
	$('#Form_Container').corner("5px");
	$('#calc').corner("5px");
	$('#incon').corner("5px");
	$('#ctop').corner("tr 5px");
	$('#ctop').corner("tl 5px");
	$('#image-con').corner("15px");
	$('#sidecon2 #list').corner("5px");
	$('#header #banner').corner("5px");
	$('#sidebar #quickForm').corner("5px");
	$('#sideContent').corner("5px");
	/*body Fade*/
	$("body").ready(function(){
	
				$("body").animate({opacity:"0.2",speed:"fast"});
				$("body").animate({opacity:"1",speed:"fast"});
	});
	
		var sPath = window.location.pathname;
		//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		//alert(sPage);
		/*if(sPage != "industries.html"){
		gen Validator
		var frmvalidator = new Validator("quickForm");
		frmvalidator.addValidation("Nametxt","req","Please enter your name");
		frmvalidator.addValidation("Emailtxt","req","Please enter your email address.");
		frmvalidator.addValidation("Emailtxt","email","Please enter a valid email.");
		frmvalidator.addValidation("Phonetxt","maxlen=50","The maximum number of characters allowed is 50.");
		frmvalidator.addValidation("producttxt","dontselect=000","Please select a product from the list");
		}*/
});
	  
	 


/* ]]> */
