
function autoFocus(e)
{
    if(e.keyCode==13)
    {
    document.getElementById('btnGo').focus();
    
    }  
}
function sndUserCheckforcolor(theOpt)
{
  http.open("get", "Ajax.aspx?proid=" + theOpt.value + "&ajmode=color");
  http.onreadystatechange = handleResponse;
  http.send(null);
}

function sndUserCheckforsize(theOpt)
{  
  http.open("get", "Ajax.aspx?proid=" + theOpt.value + "&ajmode=size");
  http.onreadystatechange = handleResponse;
  http.send(null);
}

function SelectedItem(theOpt,theTxt) 
{
    window.location.href= "category.aspx?cat=" + theOpt.value + "&searchterm=" + theTxt.value;  
}

function setDivPrice(theDiv, theOpt, theFlag) 
{   
    if(theDiv!=null && theOpt!=null)
    {
        var xmlHttpReq = false;
        var self = this;
        if (window.XMLHttpRequest) 
        {
            self.xmlHttpReq = new XMLHttpRequest();        
        }
        else if (window.ActiveXObject) 
        {
            self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");         
        }
        self.xmlHttpReq.open('POST', "ajaxCommonFunction.aspx", true);             
        self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        self.xmlHttpReq.onreadystatechange = function() 
        {
            if (self.xmlHttpReq.readyState == 4) 
            {
                var GetValue=new Array();
                theOpt.disabled=false;
                if(self.xmlHttpReq.responseText.indexOf('~' != -1))
                {
                    GetValue=self.xmlHttpReq.responseText.split("~");
                }
                if(GetValue[0].toString()!="")
                {
                    if(GetValue[0].toString()=="0")
                    {
                        alert("Error : " + GetValue[1].toString());
                    }
                    else
                    {
                        // Return brings Currency symbol in array 1 and Currency Value
                        var collDivs = document.getElementsByTagName('DIV');
                        if (collDivs != null) 
                        {
                            theFlag.innerHTML="<img src=\"http://www.giftstoindia24x7.com/Pictures/" + theOpt.options[theOpt.selectedIndex].text +".jpg\" width=\"29\" height=\"15\">" ;
                            //alert("Symbol: " + GetValue[1].toString() + " Value: " + GetValue[2].toString());
                            for(i=0;i<collDivs.length;i++)  
                            {          
                                if (theDiv.id == collDivs[i].id)
                                {
                                    collDivs[i].innerHTML= "Rs. " + collDivs[i].title + " / " + GetValue[1].toString() + " " +  (collDivs[i].title/GetValue[2]).toFixed(2);                    
                                }          
                            }
                        }
                    }
                }
                else
                {
                    alert("Sorry! Due to some error currency cannot be changed. Please try later");
                }
            }
            else
            {
                theOpt.disabled=true;
                theFlag.innerHTML="<img src=\"http://usa.rakhi24x7.com/images/AddToCartLoad.gif\" width=\"20\" height=\"20\">" ;
            }
        }
        self.xmlHttpReq.send("mode=1&currId="+theOpt.value); 
    }
    else
    {
        alert("Sorry! No price found to change. Cannot Change currency.");
    }
}
function AjaxObject()
{
    var object;
    var browser=navigator.appName;
    if(browser=="Microsoft Internet Explorer")
    {
        object=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else
    {
        object=new XMLHttpRequest()
    }
    return object;    
}
function valid()
{
        var newObject=AjaxObject();
        var search=document.getElementById("txtSearch").value;
        var srchCat=document.getElementById("UcHeader1_UcSearch1_cmbCategory").value;
//       alert(search);
//       alert(srchCat);
  // newObject.open("GET","frmAjaxCart.aspx?proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&randN="+Math.random());
    newObject.open("GET","ajaxforStatictPage.aspx?srchProd="+ search +"&srchCat=All"+"&randN="+Math.random());
   newObject.onreadystatechange = function() 
    {
        if (newObject.readyState == 4) 
        {    
            var ret= newObject.responseText;
            //alert(ret);
            if(ret.toString()=="1")
            {
               
               
                if(search=="")
                {
                alert('Please enter your text to search');
                 document.getElementById("UcHeader1_UcSearch1_cmbCategory").focus();
                return false;

                }
        
        
                else if(srchCat=="0")
                {
                   
                    //window.location="http://localhost:6413/RakhitoUSA/SearchFound.html?srchProd="+search+"&srchCat=All";
                      window.location="http://usa.rakhi24x7.com/SearchFound.html?srchProd="+search+"&srchCat=All";
                }
                else
                {
                   //window.location="http://localhost:6413/RakhitoUSA/SearchFound.html?srchProd="+search+"&srchCat="+srchCat;
                     window.location="http://usa.rakhi24x7.com/SearchFound.html?srchProd="+search+"&srchCat="+srchCat;
       
                }
               
               
            }
            else
            {
                alert("Some problem ");
            }
        }
        if (newObject.readyState < 4) 
        {     
             
        }
    }
    
    newObject.send(null);
    flag=true;

}
