﻿var XmlHttpC;
function OnVariationComboChangeone(obj, itemgui) {
    SelectVariationone(obj.value, itemgui);
}
function SelectVariationone(chldItemGuid, ItemGuid) {
    try {
        PopulateItemDetailsone(chldItemGuid, ItemGuid);      
    }
    catch (e) {
    }
}
function PopulateItemDetailsone(chldval,ItemGuid)  {
    CreateXmlHttpone();
    if (XmlHttpC) {
        if (chldval == "0") // this used to check -select- statement in dropdownlist	    
        {
            //document.getElementById("ctl00_cphcart_pnlallchild").style.display = 'none';
        }
        else {
            var url = "AjaxClass/Country.aspx";
            url = url + "?CID=" + chldval;            
           
            XmlHttpC.onreadystatechange = HandleResponseone;
            XmlHttpC.open("GET", url, true);
            XmlHttpC.send(null);
        }
    }
}
function CreateXmlHttpone() {
    try {
        XmlHttpC = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
        try {
            XmlHttpC = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (oc) {
            XmlHttpC = null;
        }
    }
    if (!XmlHttpC && typeof window.XMLHttpRequest != "undefined") {
        XmlHttpC = new XMLHttpRequest();
    }
}
function HandleResponseone() {
    if (XmlHttpC.readyState == 4) {
        if (XmlHttpC.status == 200) {
            var xmlDoc = XmlHttpC.responseXML.documentElement;                      
            Statebind(xmlDoc.getElementsByTagName("StateText")[0].childNodes[0].nodeValue, xmlDoc.getElementsByTagName("StateValue")[0].childNodes[0].nodeValue); // qty                        
        }
    }
}
function Statebind(SizeText, SizeValue) {
    var resval = SizeText.split(",")
    var resval1 = SizeValue.split(",")
    if (resval.length > 0) {
        var drpqty = document.getElementById("ddlN_State").options;
        if (!drpqty) return;
        document.getElementById('ddlN_State').innerHTML = '';
        for (var i = 0; i < resval.length; i++) {
            var speciesOptions = document.getElementById('ddlN_State').options;
            //alert(resval[i]+resval1[i]);
            speciesOptions[i] = new Option(resval[i], resval1[i]);
        }
    }
}
