// JavaScript Document
var getdm = "http://"+document.domain; 
var fpath = "/";
var dm = getdm+fpath;

 $(document).ready(function(){  
    $("#home").hover(function() {  
         $(this).attr("src",dm+"auxil/img/navi_home_sel.gif");  
             }, function() {  
         $(this).attr("src",dm+"auxil/img/navi_home.gif");  
     }); 
	 $("#profile").hover(function() {  
         $(this).attr("src",dm+"auxil/img/navi_profile_sel.gif");  
             }, function() {  
         $(this).attr("src",dm+"auxil/img/navi_profile.gif");  
     }); 
	 $("#rods").hover(function() {  
         $(this).attr("src",dm+"auxil/img/navi_rods_sel.gif");  
             }, function() {  
         $(this).attr("src",dm+"auxil/img/navi_rods.gif");  
     });
	 $("#lines").hover(function() {  
         $(this).attr("src",dm+"auxil/img/navi_lines_sel.gif");  
             }, function() {  
         $(this).attr("src",dm+"auxil/img/navi_lines.gif");  
     });
	 $("#service").hover(function() {  
         $(this).attr("src",dm+"auxil/img/navi_service_sel.gif");  
             }, function() {  
         $(this).attr("src",dm+"auxil/img/navi_service.gif");  
     });
	 $("#contact").hover(function() {  
         $(this).attr("src",dm+"auxil/img/navi_contact_sel.gif");  
             }, function() {  
         $(this).attr("src",dm+"auxil/img/navi_contact.gif");  
     });
	 //left navigation on product page
	 
	 for($i=1;$i<25;$i++){
		 
		 var lid = "left"+$i;
		  if(document.getElementById(lid) != null && document.getElementById(lid).innerHTML != ""){
			$("#"+lid).hover(function() { $(this).attr("class","left_navi_sel");  }, 
			         function() { 
								$(this).attr("class","left_navi_norm");  
			 		});
		  }
	 }
	 //product categories navi bar
	 $("div .page_navi_sec").hover(function() {  
	     $(this).attr("class","page_navi_sec_sel");  
		 }, function() {  
		 $(this).attr("class","page_navi_sec");  
	 });
	/*for($i=0;$i<7;$i++){
	  //$("#d"+$i).mouseover(function(){$("#d"+$i).attr("class","page_navi_sec_sel");}).mouseout(function(){$("#d"+$i).attr("class","page_navi_sec");});
	   $("#d"+$i).hover(function() {  
	     $("#d"+$i).attr("class","page_navi_sec_sel");  
		 }, function() {  
		 $("#d"+$i).attr("class","page_navi_sec");  
	 });
	}*/
	 
 }); 

function checkSubmit(){
var check = document.getElementById('contactform');
	if (check.name.value.length == 0) 
	{	
		alert("Please enter your name!");
		check.name.focus();
		return false;
	}	 
	if (check.email.value.length == 0) 
	{	
		alert("Please enter your email!");
		check.email.focus();
		return false;
	}	
	if (echeck(check.email.value)==false){
		check.email.focus();
		return false;
	}
    $('#contactform').submit();

}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid email address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid email address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid email address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid email address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid email address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid email address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid email address")
		    return false
		 }

 		 return true					
	}

