function menuhover(menuid,mainid){
	 if(menuid > 0){
	  	document.getElementById('m_'+menuid).className = 'selected';
	 }
}
function menu_out(menuid,mainid){
	 if(menuid > 0){
	 	var i;
		if(menuid==mainid){
			document.getElementById('m_'+menuid).className = 'selected';
		}else{
			document.getElementById('m_'+menuid).className = '';
		}
	 	/*for (var i=1;i<=30;i++){
			if(menuid!=i){
				document.getElementById('m_'+menuid).className = '';	
			}else{
				document.getElementById('m_'+menuid).className = 'selected';
				
			}
		}*/
	 }
}
function menu_click(url){
	if(url !=""){
		document.form1.action = url;
		document.form1.submit();
	}
}
function searchstring(){
	var txtsearch = document.getElementById("txtsearch").value;
	if(txtsearch != ""){
		document.form1.action = "product_list.php?option=product&search="+txtsearch;
		document.form1.submit();
	}
}
function submenuhover1(menulevel1){
	
	if(menulevel1 !=""){
		document.getElementById('itemlevel_'+menulevel1).style.backgroundColor = "#DEDEDE"; 
	 }
}
function submenumouseout1(menulevel1,$submid){
	if(menulevel1 == $submid){
		document.getElementById('itemlevel_'+menulevel1).style.backgroundColor = "#DEDEDE"; 	
	}else{
		document.getElementById('itemlevel_'+menulevel1).style.backgroundColor = "#FFF"; 	
	}
}
function checkEnter(e){ //e is event object passed from function invocation
		var characterCode //literal character code will be stored in this variable
		if(e && e.which){ //if which property of event object is supported (NN4)
			e = e
			characterCode = e.which //character code is contained in NN4's which property
		}else{
			e = event
			characterCode = e.keyCode //character code is contained in IE's keyCode property
		}		
		if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			//document.forms[0].submit() //submit the form
			 searchstring();
			//return false
		}else{
			return true
		}
}
function toogle_pro(preid){
		if(preid !=""){
			document.getElementById('pro_'+preid).style.backgroundColor = "#EFEFEF"; 	
		}
}
function toogle_hide(preid){
		/*var itemsum = totalid.slice(0, -1)
		var totalitems = itemsum;
		totalitems = totalitems.split(',');
		for (var i = 0; i < totalitems.length; i++)
		{
			//alert(totalitems[i]);
			if(preid==totalid[i]){
				 document.getElementById('pro_'+preid).style.backgroundColor = "#DEDEDE"; 	
			}else{
				document.getElementById('pro_'+preid).style.backgroundColor = "#FFF"; 
			}
		}*/
		if(preid !=""){
			document.getElementById('pro_'+preid).style.backgroundColor = "#FFF"; 	
		}
}	
function update_tempcate(page,mainid){
		var url = "checkout.php?option="+page+"&id="+mainid;
		document.frm.action = url;
		document.frm.submit();
}
function validate() {
	var fullname = document.getElementById("txtfullname");
	var email = document.getElementById("txtemail");
	var phone = document.getElementById("txtphone");
	
	var visitor_value = fullname.value;
	var email_value   = email.value;
	var phone_value   = phone.value;
	var result = new Array();
			
	if (visitor_value =="") {
		fullname.style.backgroundColor="#E2E2E2";
		result [0] =false;
	}else{
		fullname.style.backgroundColor="#fff";
		result[0]= true;
	}
	
	if (email_value =="") {
		email.style.backgroundColor="#E2E2E2";
		result[1]= false;
	}else{
		email.style.backgroundColor="#fff";
		result[1]= true;
	}
	if (phone_value =="") {
		phone.style.backgroundColor="#E2E2E2";
		result[2]= false;
	}else{
		phone.style.backgroundColor="#fff";
		result[2]= true;
	}
	var result_length = result.length;
	var countFalse = 0;
	for( var i=0; i<result_length; i++){
		if(result[i]==false){
			countFalse +=1;
		}
	}
	if(countFalse == 0){
		return true;
	}else{
		return false;
	}
}
				
/*function passwordcheck(confirmpass){
	var password = document.getElementById('txtpassword');
	var password_val = password.value;
	if(confirmpass != password_val){
		alert('Your passwords are not marched, Please retype');
		document.getElementById("txtconfirmpass").value="";
		document.getElementById("txtconfirmpass").focus();
	}
}*/
