﻿// JScript File

function searchIndex()
{

 var keyword;
    keyword=document.getElementById("ucSearch_txtSearch").value;
      if(keyword.length>0)
    {
   
        window.location="products.aspx?k="+ keyword ;
        return true;
    }
    else
    {
    alert("Please Enter Seacrh Criteria");
        return false;
    }
    return;
}
function SetSearchRuleStatusIndex()
{
    document.getElementById("hdnRules").value="S";
}

function SetSearchButtonClickIndex(e)
{
 
    var unicode=e.keyCode? e.keyCode : e.charCode ? e.charCode : e.which
    if(unicode=='13')
    {
	    if(document.getElementById("hdnRules").value=='S')
	    {					
		    document.getElementById("ucSearch_imbSearch").click();
		    e.returnValue=false;
		    return false;
	    }
    }
}
function OnSearchTextboxFocusIndex()
{
    document.getElementById("hdnRules").value="S";
}
 
function search()
{
 
 var keyword;
    keyword=document.getElementById("ctl00_header_uc1_txtSearch").value;
      if(keyword.length>0)
    {
    
        window.location="products.aspx?k="+ keyword;
        return true;
    }
    else
    {
    alert("Please Enter Seacrh Criteria");
    document.getElementById("ctl00_header_uc1_txtSearch").focus();
        return false;
    }
    return;
}
function SetSearchRuleStatus()
{
    document.getElementById("hdnRules").value="S";
}

function SetSearchButtonClick(e)
{
    var unicode=e.keyCode? e.keyCode : e.charCode ? e.charCode : e.which
    if(unicode=='13')
    {
	    if(document.getElementById("hdnRules").value=='S')
	    {					
		    document.getElementById("ctl00_header_uc1_imbSearch").click();
		    e.returnValue=false;
		    return false;
	    }
    }
}
function OnSearchTextboxFocus()
{
    document.getElementById("hdnRules").value="S";
}
function keypress(e)
{
    if ([e.keyCode||e.which]==8) //this is to allow backspace
    return true;
    if ([e.keyCode||e.which]==9) //this is to allow tab
    return true;
   // if ([e.keyCode||e.which]==46) //this is to allow period
   // return true;
    if ([e.keyCode||e.which] < 48 || [e.keyCode||e.which] > 57)
    e.preventDefault? e.preventDefault() : e.returnValue = false;
}

 function validateAddToCart()
    {
    var rules = new Array();
     rules[0]='validatePrice()|custom';
     rules[1]='ctl00_ContentPlaceHolder1_txtQuantity|required|Please enter Quantity';
     rules[2]='ctl00_ContentPlaceHolder1_txtQuantity|integer|Please enter Quantity';
     if(rules.length>0)
        {
            return performCheck('aspnetForm', rules, 'classic');
        }
    }


 function validatePrice()
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlPrice").value == "")
        {
            return 'Please Select Price';
        }
        return null;
    }   
 
   function ShowZoomImage(ImgName)
    {
        window.open("popupimage.aspx?ImgName="+ImgName,"PopUp","top=100,left=200,scrollbars=yes,height=490,width=570");
    }
    
 function killEnter(e)
{

var unicode=e.keyCode? e.keyCode : e.charCode ? e.charCode : e.which
if(unicode == 13)
{
return false;
}
return true;
}