
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=\"images/loading.gif\" width=\"20\" height=\"20\">" ;
            }
        }
        self.xmlHttpReq.send("mode=1&currId="+theOpt.value); 
    }
    else
    {
        alert("Sorry! No price found to change. Cannot Change currency.");
    }
}

