// JavaScript Document

/********* HOME PAGE ON LOAD  ****/
function Menu(){ 
 if(navigator.appVersion.indexOf("MSIE")==-1){return;}
 var i,k,g,lg,r=/\s*p7hvr/,nn='',c,cs='p7hvr',bv='p7menubar';
 for(i=0;i<10;i++){g=document.getElementById(bv+nn);if(g){
 lg=g.getElementsByTagName("li");if(lg){for(k=0;k<lg.length;k++){
 lg[k].onmouseover=function(){c=this.className;cl=(c)?c+' '+cs:cs;
 this.className=cl;};lg[k].onmouseout=function(){c=this.className;
 this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;}
}

/*********************** HOME PAGE SEARCH BAR  *****************/
	var otherChr = false;
	function checkSearchString(e)
	{
		var oEvent = window.event ? window.event : e;
		
		
	
		if ( (oEvent.keyCode == 32) && (!otherChr) )
		{
			document.getElementById('searchproducts').value = '';
			document.getElementById('srch').style.visibility='hidden';
			return false;
		}
		else
		{
			otherChr = true;
			if (document.getElementById('searchproducts').value.length >= 2)
			{
				showTextinObj('srch',genUrl());
				return true;
			}
			else
				return false;
		}

	}
	function genUrl()
	{
		url = "user_predictive_search.php?tbl=products&default_field=ProductName&frm=srchprdfrm&obj=searchproducts&fld=ProductName";

		url += "&val=";
		url += document.getElementById('searchproducts').value;
		//url += "&catid=";
		//url += document.getElementById('ddCatSearch').value;
		return url;
	}
function KeyPress(e, field)
{
var oEvent = window.event ? window.event : e;
if (oEvent.keyCode == 32)
field.value = '';
}

function searchboxempty()
{
if(document.srchprdfrm.searchproducts.value=="")
{

document.srchprdfrm.searchproducts.value="Please enter your search here";
return false;
}
}
function onclickfunction()
{
if(document.srchprdfrm.searchproducts.value!='')
{  

   if(document.srchprdfrm.searchproducts.value=='Please enter your search here')
   {
   document.srchprdfrm.searchproducts.value='';
   }
}else
{
document.srchprdfrm.searchproducts.value='';
}
}

//************  HOME PAGE RIGHT PANEL   *******************/

function deleteitem(){
	return confirm('Do you really want to delete the item?');	
}

function delMiniCartItem(id,url,pid,catid){
	var a = deleteitem();
	if(a==true){
		window.location='shoppingcart.php?cmd=deleteCartItem&productid='+id+'&redirecturl='+url+'&pid='+pid+'&cid='+catid;
		return true;
	}
	else{
		return false;
	}
}

function goToProductDetail(prod, catid){
	document.catform.action =prod;
	document.catform.submit();
}

