﻿



function validSendmail(chkaccept)
{
if (chkaccept.checked == false) {
    alert('Please select Checkbox to accept terms and conditions');
    return false;
    }
}
function validSugg(txtcomm) {
    if (emptyField(txtcomm)) {
        alert('Please enter your Suggestion/Opinion');
        txtcomm.focus();
        return false;
    }
}


function validReduction(txtredamt, txtreason) {
    if (emptyField(txtredamt)) {
        alert('Please enter reduction amount');
        txtredamt.focus();
        return false;
    }
    if (!isNum(txtredamt.value)) {
        alert('Please enter numeric reduction amount');
        txtredamt.focus();
        return false;
    }
    if (emptyField(txtreason)) {
        alert('Please enter your reason for reduction');
        txtreason.focus();
        return false;
    }
}




function validProseller(futradereg) {
    if (futradereg.value == '') {
        alert('Please Upload Trade Register');
        futradereg.focus();
        return false;
    }
}


 function validfpResp(txtresp) {
     if (emptyField(txtresp)) {
         alert('Please Enter your response');
         txtresp.focus();
         return false;
     }
 }

function validComm(txtquestion) {
    if (emptyField(txtquestion)) {
        alert('Please Enter your question');
        txtquestion.focus();
        return false;
    }
}

function validReason(validReason) {
    if (emptyField(validReason)) {
        alert('Please Enter your Reason');
        validReason.focus();
        return false;
    }
}
function validSendOfNum(txtnumsend) {
    if (!emptyField(txtnumsend)) {
        if (!isInt(txtnumsend.value)) {
            alert('Please enter numeric number of send');
            txtnumsend.focus();
            return false;
        }
        if (txtnumsend.value <= 0) {
            alert('Please enter valid number of send');
            txtnumsend.focus();
            return false;
        }
    }
    else {
        confirm("Are you sure, you want to set numer of send as generated automatically?");
    }
}

function BookMarks() {
    // alert(location.href);
    if (document.all) window.external.AddFavorite(location.href, location.href);
    else if (window.sidebar) window.sidebar.addPanel(location.href, location.href, '');
}

function print_reports() {
    var win = window.print();
    return false;
}

function validEmail(txtto, txtfrom) {
    if (emptyField(txtto)) {
        alert('Please enter To (E-mail ID)');
        txtto.focus();
        return false;
    }
    if (!validEmailId(txtto.value)) {
        alert('Please enter valid To (E-mail ID)');
        txtto.focus();
        return false;
    }
    if (emptyField(txtfrom)) {
        alert('Please enter From (E-mail ID)');
        txtfrom.focus();
        return false;
    }
    if (!validEmailId(txtfrom.value)) {
        alert('Please enter valid From (E-mail ID)s');
        txtfrom.focus();
        return false;
    }
}

function validFaq(txtfaq, txtemail) {
    if (emptyField(txtfaq)) {
        alert('Please enter Your Question');
        txtfaq.focus();
        return false;
    }
    if (emptyField(txtemail)) {
        alert('Please enter To E-mail ID');
        txtemail.focus();
        return false;
    }
    if (!validEmailId(txtemail.value)) {
        alert('Please enter valid To E-mail ID');
        txtemail.focus();
        return false;
    }
}


function winopenLegalGeneralCond() {
    window.open("legalgeneralcondition.aspx", "mywindow", "toolbar=0,directories=0,location=0,resizable=1,width=500,height=450,scrollbars=yes");
}

function winopenPrdimg(photo) {
    window.open("viewphoto.aspx?photo=" + photo, "mywindow", "toolbar=0,directories=0,location=0,resizable=1,width=350,height=250");
}

function winopenPrdimg1(photo) {
    window.open("viewphoto.aspx?vprdid=" + photo, "mywindow", "toolbar=0,directories=0,location=0,resizable=1,width=350,height=250");
}
function winclose() {
    window.close();
}

function winopenMainimg(prdid) {
    window.open("ImageView.aspx?prdid=" + prdid, "mywindow", "toolbar=0,directories=0,location=0,resizable=1,width=350,height=250");
}

function windopenPrddesc(proid) {
    window.open("productdescription.aspx?proid=" + proid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=500");
}


function winOpnBuyerDetail(bid) {
    window.open("buyerdtls.aspx?bid=" + bid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=700,height=500");
}


function winopenCmplogo(photo) {
    window.open("viewcmplogo.aspx?photo=" + photo, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=350,height=250");
}

function winopenPrdreview(pid) {
    window.open("giveprdreview.aspx?proid=" + pid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=275");
}

function winopenPrdreadreview(pid) {
    window.open("readprdreview.aspx?proid=" + pid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=600");
}


function winopenCmpreadreview(cmp) {
    window.open("readcmpreview.aspx?cmp=" + cmp, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=600");
}


function winopenCmpreview(comp, vprdid) {
    window.open("givecmpreview.aspx?vprdid=" + vprdid + "&comp=" + comp, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=275");
}



function winopenCmpreview1(comp, vprdid, subcid) {
    window.open("givecmpreview.aspx?flg=oprbm&subcid=" + subcid + "&vprdid=" + vprdid + "&comp=" + comp, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=275");
}


function winopenvndReply(subcid) {
    window.open("viewreply.aspx?flg=vnd&subcid=" + subcid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=275");
}



function winopenbyrReply(subcid) {
    window.open("viewreply.aspx?flg=byr&subcid=" + subcid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=275");
}


function winopenReplyone(subcid,flg) {
    window.open("viewvenderreply.aspx?flg=" + flg + "&subcid=" + subcid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=275");
}



function winopenbuyerReply(subcid, sessionid, flg) {
    window.open("viewbuyerreply.aspx?KeyID=" + sessionid + "&flg=" + flg + "&subcid=" + subcid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=275");
}

function winopnVendercomm(scid) {
    window.open("viewVenderComment.aspx?scid=" + scid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=275");
}



function windopenPrdrep(proid) {
    window.open("reportabtprd.aspx?proid=" + proid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=400");
}

//windopenScoretable
function windopenScoretable() {
    window.open("scoretable.aspx", "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=400,height=275");
}

function windopenBlockUserREply() {
    window.open("blacklistreply.aspx", "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=400,height=275");
}

function winopenAddress(comp) {
    window.open("buyeradd.aspx?comp=" + comp, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=600,height=400");
}

function winopenCollimg(collid) {
    window.open("viewphoto.aspx?collid=" + collid, "mywindow", "toolbar=0,directories=0,location=0,resizable=1,width=350,height=250");
}

function winOpenpost() {
    window.open("postingdtls.aspx", "mywindow", "toolbar=0,directories=0,location=0,resizable=1,width=750,height=200");
}

function winOpenreceived() {
    window.open("recieveddtls.aspx", "mywindow", "toolbar=0,directories=0,location=0,resizable=1,width=675,height=550");
}


function openAddinfo(traddinfo,AddInfo) {

    var strdispl
    strdispl = (document.getElementById(traddinfo).display == '' || document.getElementById(traddinfo).display == 'block') ? 'none' : 'block';
    document.getElementById(traddinfo).style.display = (document.getElementById(traddinfo).style.display == '' || document.getElementById(traddinfo).style.display == 'block') ? 'none' : 'block';
    if (document.getElementById) {
        document.getElementById(AddInfo).firstChild.nodeValue = (document.getElementById(AddInfo).firstChild.nodeValue == 'Additional Info') ? 'Click for Additional Info' : 'Additional Info';
    }
    else
    {
        var str;
        str = (document.getElementById(AddInfo).innerText == 'Click for Additional Info') ? 'Click for Additional Info' : 'Additional Info';
        document.getElementById(AddInfo).innerText = str;  //(document.getElementById(AddInfo).innerText == 'Click for Additional Info') ? 'Click for Additional Info' : 'Additional Info';
    }    
       
}

function checkallpage() {
    if (document.getElementById("ctl00_ContentPlaceHolder1_chkHeader").checked == true) {
        for (var i = 0; i < document.aspnetForm.length; i++) {
            if (document.aspnetForm.elements[i].type == "checkbox") {
                document.aspnetForm.elements[i].checked = true;
            }
        }
    }
    else {
        for (var i = 0; i < document.aspnetForm.length; i++) {
            if (document.aspnetForm.elements[i].type == "checkbox") {
                document.aspnetForm.elements[i].checked = false;
            }
        }
    }
}

function check() {
    var con = 0;
    for (var i = 0; i < document.aspnetForm.length; i++) {
        if (document.aspnetForm.elements[i].type == "checkbox") {
            if (document.aspnetForm.elements[i].checked == true) {
                con++;
            }
        }
    }
    if (con == 0) 
    {
        alert('Please select atleast one record');
        return false;
    }
}

function checkallpage1() {
    if (document.getElementById("ctl00_ContentPlaceHolder1_chkHeader1").checked == true) {
        for (var i = 0; i < document.aspnetForm.length; i++) {
            if (document.aspnetForm.elements[i].type == "checkbox") {
                document.aspnetForm.elements[i].checked = true;
            }
        }
    }
    else {
        for (var i = 0; i < document.aspnetForm.length; i++) {
            if (document.aspnetForm.elements[i].type == "checkbox") {
                document.aspnetForm.elements[i].checked = false;
            }
        }
    }
}

function validReview(ddlnotes, txtCom) {
    if (ddlnotes.value == 0) {
        alert('please select Note');
        ddlnotes.focus();
        return false;
    }
    if (emptyField(txtCom)) {
        alert('Please enter Comments');
        txtCom.focus();
        return false;
    }
}

function validReport(txtCom) {
    if (emptyField(txtCom)) {
        alert('Please enter Comments');
        txtCom.focus();
        return false;
    }
}




function validCat(ddlCat) 
{
    if (ddlCat.value == 0) {
        alert('Please Select Category');
        ddlCat.focus();
        return false;
    }
}

function validColl(txtname, txtDis) {
    var str;
    str = document.getElementById("hdsmids").value;
    var val = '';
    var price = '';
    var arrstr = str.split(",");
    var con = 0;
    for (i = 0; i < arrstr.length; i++) {
        var txtids = 'txtsm' + arrstr[i];
               // alert(txtids);
       
        var chkids = 'chksm' + arrstr[i];
        if (document.getElementById(chkids).checked == true) {
            if (emptyField(document.getElementById(txtids))) {
                alert('Please enter Posting Mode Value');
                document.getElementById(txtids).focus();
                return false;
            }
            if (!isInt1(document.getElementById(txtids).value)) {
                alert('Please enter numeric Posting Mode Value');
                document.getElementById(txtids).focus();
                return false;
            }
            if (document.getElementById(txtids).value < 0) {
                alert('Please enter numeric Posting Mode Value greater than zero');
                document.getElementById(txtids).focus();
                return false;
            }
            con = 1;
            val += arrstr[i] + ",";
            price += document.getElementById(txtids).value + ",";
        }
    }
    if (con == 0) {
        alert('Please Select Atlease on posting mode');
        return false;
    }
////    alert(price);
////    alert(val);
    document.getElementById("ctl00_ContentPlaceHolder1_hdsmprice").value = price;
    document.getElementById("ctl00_ContentPlaceHolder1_hdsmidsv").value = val;
    
    if (emptyField(txtname)) {
        alert('Please Enter Collection Name');
        txtname.focus();
        return false;
    }
    if (emptyField(txtDis)) {
        alert('Please Enter Discount Amount');
        txtDis.focus();
        return false;
    }
    if (!isInt1(txtDis.value)) {
        alert('Please Enter Valid Discount Amount');
        txtDis.focus();
        return false;
    }
    if (txtDis.value <= 0) {
        alert('Please enter Discount Amount Value greater than zero');
        document.getElementById(txtids).focus();
        return false;
    }
////    if (!emptyField(fcimg)) {
////        if (!chkExtension(fcimg)) {
////            alert("Only JPG/JPEG/GIF type logo files are allowed.\n Please select a valid file type.")
////            fcimg.focus();
////            fcimg.select();
////            return false;
////        }
////    }
}

function validLowprice(txtnewprice) {

    if (emptyField(txtnewprice)) {
        alert('please enter product price');
        txtnewprice.focus();
        return false;
    }
    if (!isNum(txtnewprice.value)) {
        alert('please enter Numeric product price');
        txtnewprice.focus();
        return false;
    }
}


function validQuestion(txtquestion) {

    if (emptyField(txtquestion)) {
        alert('Please enter your question');
        txtquestion.focus();
        return false;
    }
}

function chngOpt(rbtopt) {
    var con;
    con = 0;
    for (var i = 0; i < document.aspnetForm.length; i++) {
        if (document.aspnetForm.elements[i].type == "radio") {
            if (document.aspnetForm.elements[i].checked == true) {
                con = 1;
                if (document.aspnetForm.elements[i].value == "1") {
                    document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "None";
                    document.getElementById("ctl00_ContentPlaceHolder1_trsend").style.display = "None"; 
                }
                else {
                    if (document.aspnetForm.elements[i].value == "2") {
                        document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "Block";
                        if (document.getElementById("ctl00_ContentPlaceHolder1_hdselectopt").value == "1") {
                            document.getElementById("ctl00_ContentPlaceHolder1_trsend").style.display = "Block";
                        }
                        else {
                            document.getElementById("ctl00_ContentPlaceHolder1_trsend").style.display = "None";
                        }
                    } 
                }
            }
        }
    }
}


function chngOpt1(rbtopt) {
    var con;
    con = 0;
    for (var i = 0; i < document.aspnetForm.length; i++) {
        if (document.aspnetForm.elements[i].type == "radio") {
            if (document.aspnetForm.elements[i].checked == true) {
                con = 1;
                if (document.aspnetForm.elements[i].value == "1") {
                    document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "None";
                }
                else {
                    if (document.aspnetForm.elements[i].value == "2") {
                        document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "Block";
                    }
                }
            }
        }
    }
}

function validRefred1(rbtopt, txtcom, txtredprice) {
    var con = 0;
    var sel = 0;
    for (var i = 0; i < document.aspnetForm.length; i++) {
        if (document.aspnetForm.elements[i].type == "radio") {
            if (document.aspnetForm.elements[i].checked == true) {
                con = 1;
                if (document.aspnetForm.elements[i].value == "1") {
                    document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "None";
                    sel = 1;
                }
                else {
                    if (document.aspnetForm.elements[i].value == "2") {
                        document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "Block";
                        sel = 2;
                    }
                }
            }
        }
    }
    if (con == 0) {
        alert("Please select Refund/Reduction ");
    }
    if (emptyField(txtcom)) {
        alert('Please enter your comments');
        txtcom.focus();
        return false;
    }
    if (sel == 2) {
        if (emptyField(txtredprice)) {
            alert('Please enter reduction amount');
            txtredprice.focus();
            return false;
        }
        if (!isNum(txtredprice.value)) {
            alert('Please enter Numeric reduction amount');
            txtredprice.focus();
            return false;
        }
    }
}


function validvenderReplyone(txtdate, txtcom, txtnumsend) {
    if (document.getElementById("ctl00_ContentPlaceHolder1_hdselectopt").value != "3") {
         if (emptyField(txtdate)) {
            alert('Please Enter date');
            txtdate.focus();
            return false;
        }
        if (isDate1(txtdate, "dd/mm/yyyy")) {
           // alert('Please enter valid date');
            //txtDOB.focus();
            return false;
        }
    }
    
        if (document.getElementById("ctl00_ContentPlaceHolder1_hdselectopt").value == "1") {
            if (emptyField(txtnumsend)) {
                alert('Please Enter number of send');
                txtnumsend.focus();
                return false;
            }
            if (!isInt(txtnumsend.value)) {
                alert('Please enter numeric number of send');
                txtnumsend.focus();
                return false;
            }
            if (txtnumsend.value <= 0) {
                alert('Please enter valid number of send');
                txtnumsend.focus();
                return false;
            }
        }
	if (emptyField(txtcom)) {
	    alert('Please Enter your comments');
	    txtcom.focus();
	    return false;
	}
}

function validRefred(rbtopt, txtcom, txtredprice) {
    var con = 0;
    var sel = 0;
    for (var i = 0; i < document.aspnetForm.length; i++) {
        if (document.aspnetForm.elements[i].type == "radio") {
            if (document.aspnetForm.elements[i].checked == true) {
                con = 1;
                if (document.aspnetForm.elements[i].value == "1") {
                    document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "None";
                    sel = 1;
                }
                else {
                    if (document.aspnetForm.elements[i].value == "2") {
                        document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "Block";
                        sel = 2;
                    }
                }
            }
        }
    }
    if (con == 0) {
        alert("Please select Refund/Reduction ");
    }
    if (emptyField(txtcom)) {
        alert('Please enter your comments');
        txtcom.focus();
        return false;
    }
    if (sel == 2) {
        if (emptyField(txtredprice)) {
            alert('Please enter reduction amount');
            txtredprice.focus();
            return false;
        }
        if (!isNum(txtredprice.value)) {
            alert('Please enter Numeric reduction amount');
            txtredprice.focus();
            return false;
        }
    }
}


function validAns(txtans) {
    if (emptyField(txtans)) {
        alert('Please enter your answer');
        txtans.focus();
        return false;
    }
}

function validvenderReply(txtreply) {
    if (emptyField(txtreply)) {
        alert('Please enter your reply (answer)');
        txtreply.focus();
        return false;
    }
}


function validSearchkey(txtpg) 
{
    if (emptyField(txtpg)) {
        alert('Please enter page number');
        txtpg.focus();
        return false;
    }
    if (!isInt(txtpg.value)) {
        alert('Please enter Numeric page number');
        txtpg.focus();
        return false;
    }
    if (txtpg.value <= 0){
        alert('Please enter valid page number');
        txtpg.focus();
        return false;
    }
    var hd = Number(document.getElementById("hdtotalpg").value);
    var pg = Number(txtpg.value);
//    alert(hdtotalpg);
//    alert(txtpg);
//    return false;
    
    if (hd < pg) {
        alert('Please enter valid page number');
        txtpg.focus();
        return false;
    }
}

function validAdvSearchkey(txtpg) {
    //alert(document.getElementById("ctl00_ContentPlaceHolder1_hdtotalpg").value);
    if (emptyField(txtpg)) {
        alert('Please enter page number');
        txtpg.focus();
        return false;
    }
    if (!isInt(txtpg.value)) {
        alert('Please enter Numeric page number');
        txtpg.focus();
        return false;
    }

    var pg = txtpg.value;
    //alert(pg);
    if (pg == 0) {
        alert('Please enter valid page number for 0');
        txtpg.focus();
        return false;
    }
    //alert(document.getElementById("ctl00_ContentPlaceHolder1_hdtotalpg").value);
    if (document.getElementById("ctl00_ContentPlaceHolder1_hdtotalpg").value < pg) {
        alert('Please enter valid page number');
        txtpg.focus();
        return false;
    }
}

function ajaxFunction(txtPrice, hdprdcat, hdprdsubcat, hdprdssubcat, hdprdadminprc, proid, vprdid, Flag, hdsmprice) {
    document.getElementById("tdbtn").display = 'none';
    var xmlHttp;
    try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {
        // Internet Explorer
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            document.getElementById("divprice").innerHTML = xmlHttp.responseText;
            document.getElementById("divsellprice").innerHTML = document.getElementById("hdsellprice").value;
            document.getElementById("divport").innerHTML = " + " + document.getElementById("hdminval").value;
            document.getElementById("divcom").innerHTML = " - " + document.getElementById("hdtotalComm").value;
            document.getElementById("divnet").innerHTML = document.getElementById("hdnetprice").value;
            document.getElementById("tdbtn").display = 'block';
            //////            var s, ss;
            //////            var s = xmlHttp.responseText;
            //////            var ss = s.split('#');
            //////            document.getElementById("divprice").innerHTML = ss[0];
            //////            document.getElementById("lblprice").innerHTML = ss[1];
            //////            document.getElementById("lblpost").innerHTML = ss[2];
            //////            document.getElementById("lblcomm").innerHTML = ss[3];
            //////            document.getElementById("lblnet").innerHTML = ss[4];
            ////            changValue();
        }
    }
    xmlHttp.open("GET", "getsmode.aspx?txtPrice=" + txtPrice + "&hdprdcat=" + hdprdcat + "&hdprdsubcat=" + hdprdsubcat + "&hdprdssubcat=" + hdprdssubcat + "&hdprdadminprc=" + hdprdadminprc + "&Flag=" + Flag + "&vprdid=" + vprdid + "&proid=" + proid + "&hdsmprice=" + hdsmprice, true);
    xmlHttp.send(null);
}


function changValue() {
    alert('outer');
    var str;
    str = document.getElementById("hdsmids").value;
    var val = '';
    var price = '';
    var arrstr = str.split(",");
    var con = 0;
    for (i = 0; i < arrstr.length; i++) {
        alert('in');
        var txtids = 'txtsm' + arrstr[i];
        //        alert(txtids);
        if (emptyField(document.getElementById(txtids))) {
            alert('Please enter Posting Mode Value');
            document.getElementById(txtids).focus();
            return false;
        }
        if (!isInt1(document.getElementById(txtids).value)) {
            alert('Please enter numeric Posting Mode Value');
            document.getElementById(txtids).focus();
            return false;
        }
        if (document.getElementById(txtids).value < 0) {
            alert('Please enter numeric Posting Mode Value greater than zero');
            document.getElementById(txtids).focus();
            return false;
        }
        if (document.getElementById(txtids).value > 350) {
            alert('Please enter numeric Posting Mode Value greater than zero');
            document.getElementById(txtids).focus();
            return false;
        }
        var chkids = 'chksm' + arrstr[i];
        if (document.getElementById(chkids).checked == true) {
            con = 1;
            val += arrstr[i] + ",";
            price += document.getElementById(txtids).value + ",";
        }
    }
    alert(price);
    document.getElementById("hdsmprice").value = price;
}


function chkprice(txtprice) {
    if (emptyField(txtprice)) {
        alert('please enter posting mode price');
        txtprice.focus();
        return false;
    }
    if (!isNum(txtprice.value)) {
        alert('please enter Numeric posting mode price');
        txtprice.focus();
        return false;
    }
}


function ajaxFunctionSmBuyer(lblvaddinfoid, rbtsmode, totalrec, lblsubcartid, lblvid) {
////    alert(lblvaddinfoid);
////    alert(rbtsmode);
////    alert(totalrec);
    var con = 0;
    for (var i = 0; i < totalrec; i++) {
        var rbtid = rbtsmode + "_" + i;
        if (document.getElementById(rbtid).checked == true) {
            document.getElementById("hdsmode").value = document.getElementById(rbtid).value;
            con = 1;
        }
    }
    if (con == 1){
        var xmlHttp;
        try {
            // Firefox, Opera 8.0+, Safari
            xmlHttp = new XMLHttpRequest();
        }
        catch (e) {
            // Internet Explorer
            try {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e) {
                    alert("Your browser does not support AJAX!");
                    return false;
                }
            }
        }
        xmlHttp.onreadystatechange = function() {
            if (xmlHttp.readyState == 4) {
                var s, ss;
                var s = xmlHttp.responseText;
                var ss = s.split('#');
                ////alert(ss[0]);
                ////alert(ss[1]);
                var totalrec = document.getElementById("hdtotrec").value;
                var smids = 'dtgridCart_ctl0' + totalrec + '_divsmtotal';
                ////                alert(smids);
                document.getElementById(smids).innerHTML = ss[0] + ' ' + ss[2];
                document.getElementById("divfinal").innerHTML = ss[0] + ' ' + ss[1];
                document.getElementById("hdtotalsmode").value = ss[2];
                document.getElementById("hdgtotal").value = ss[1];
            }
        }
        xmlHttp.open("GET", "getbuyersmode.aspx?lblvaddinfoid=" + lblvaddinfoid + "&vprdsmodeid=" + document.getElementById("hdsmode").value + "&hdsubtotal=" + document.getElementById("hdgtotal").value + "&hdtotalsmode=" + document.getElementById("hdtotalsmode").value + "&lblsubcartid=" + lblsubcartid + "&lblvid=" + lblvid, true);
        xmlHttp.send(null);
    }
    else{
        alert("select atleast one post mode");
        return false;
    }

}


function ajaxFunctionCollextionlist(txtDis, hdprdadminprc, Flag) {
    var xmlHttp;
    try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {
        // Internet Explorer
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            //document.getElementById("ctl00_ContentPlaceHolder1_divprice").innerHTML = xmlHttp.responseText;
            var s, ss;
            var s = xmlHttp.responseText;
            var ss = s.split('#');
////            alert(ss[0]);
////            alert(ss[1]);
            document.getElementById("ctl00_ContentPlaceHolder1_divprice").innerHTML = ss[0];
            document.getElementById("ctl00_ContentPlaceHolder1_div1").innerHTML = ss[1];
        }
    }
    xmlHttp.open("GET", "getsmodecoll.aspx?txtDis=" + txtDis + "&hdprdadminprc=" + hdprdadminprc + "&Flag=" + Flag, true);
    xmlHttp.send(null);
}




function ajaxFunctionSmBuyerColl(collectionid, rbtsmode, totalrec, lblcurrsmode) {
    ////    alert(lblvaddinfoid);
    ////    alert(rbtsmode);
    ////    alert(totalrec);
    var con = 0;
    for (var i = 0; i < totalrec; i++) {
        var rbtid = rbtsmode + "_" + i;
        if (document.getElementById(rbtid).checked == true) {
            document.getElementById("hdsmodecoll").value = document.getElementById(rbtid).value;
            con = 1;
        }
    }
    if (con == 1) {
        var xmlHttp;
        try {
            // Firefox, Opera 8.0+, Safari
            xmlHttp = new XMLHttpRequest();
        }
        catch (e) {
            // Internet Explorer
            try {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e) {
                    alert("Your browser does not support AJAX!");
                    return false;
                }
            }
        }
        xmlHttp.onreadystatechange = function() {
            if (xmlHttp.readyState == 4) {
                var s, ss;
                var s = xmlHttp.responseText;
                var ss = s.split('#');
                ////alert(ss[0]);
                ////alert(ss[1]);
                //var totalrec = document.getElementById("hdtotrec").value;
                var smids = 'dtgridColle_ctl0' + totalrec + '_divsmtotal';
                             alert(smids);
                document.getElementById(smids).innerHTML = ss[0] + ' ' + ss[2];
                document.getElementById("divfinal").innerHTML = ss[0] + ' ' + ss[1];
                document.getElementById("hdtotalsmodeColl").value = ss[2];
                document.getElementById("hdgtotal").value = ss[1];
            }
        }
        xmlHttp.open("GET", "getbuyersmodecoll.aspx?collectionid=" + collectionid + "&vprdsmodecollid=" + document.getElementById("hdsmodecoll").value + "&hdsubtotal=" + document.getElementById("hdsubtotalColl").value + "&hdtotalsmode=" + document.getElementById("hdgtotal").value, true);
        xmlHttp.send(null);
    }
    else {
        alert("select atleast one post mode");
        return false;
    }

}


function selectOpt1() {
    document.getElementById("ctl00_ContentPlaceHolder1_tropt").style.display = "None";
    document.getElementById("ctl00_ContentPlaceHolder1_trcomm").style.display = "Block";
    document.getElementById("ctl00_ContentPlaceHolder1_trbtn").style.display = "Block";
    document.getElementById("ctl00_ContentPlaceHolder1_hdselectopt").value = "1"
    document.getElementById("ctl00_ContentPlaceHolder1_trsend").style.display = "Block";
    document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "Block";
}

function selectOpt2() {
    document.getElementById("ctl00_ContentPlaceHolder1_tropt").style.display = "None";
    document.getElementById("ctl00_ContentPlaceHolder1_trcomm").style.display = "Block";
    document.getElementById("ctl00_ContentPlaceHolder1_trbtn").style.display = "Block";
    document.getElementById("ctl00_ContentPlaceHolder1_hdselectopt").value = "2"
    document.getElementById("ctl00_ContentPlaceHolder1_trsend").style.display = "None";
    document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "Block";
}

function selectOpt3() {
    document.getElementById("ctl00_ContentPlaceHolder1_tropt").style.display = "None";
    document.getElementById("ctl00_ContentPlaceHolder1_trcomm").style.display = "Block";
    document.getElementById("ctl00_ContentPlaceHolder1_trbtn").style.display = "Block";
    document.getElementById("ctl00_ContentPlaceHolder1_hdselectopt").value = "3"
    document.getElementById("ctl00_ContentPlaceHolder1_trsend").style.display = "None";
    document.getElementById("ctl00_ContentPlaceHolder1_tramt").style.display = "None";
}




function ajaxFunforchngsval(txtPrice, totalComm, txtsm) {
    if (emptyField(txtsm)) {
        alert('Please enter Posting Mode Value');
        txtsm.focus();
        return false;
    }
    if (!isInt1(txtsm.value)) {
        alert('Please enter numeric Posting Mode Value');
        txtsm.focus();
        return false;
    }
    if (txtsm.value < 0) {
        alert('Please enter numeric Posting Mode Value greater than zero');
        txtsm.focus();
        return false;
    }
    if (txtsm.value > 350) {
        alert('Please enter Posting Mode Value less than or equal to 350 euros');
        txtsm.focus();
        return false;
    }
    document.getElementById("tdbtn").display = 'none';
    var xmlHttp;
    try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {
        // Internet Explorer
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
        xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            var s, ss;
            var s = xmlHttp.responseText;
            var ss = s.split('#');
            ////alert(ss[0]);
            ////alert(ss[1]);
//            document.getElementById(smids).innerHTML = ss[0] + ' ' + ss[2];
//            document.getElementById("divfinal").innerHTML = ss[0] + ' ' + ss[1];
//            document.getElementById("hdtotalsmode").value = ss[2];
//            document.getElementById("hdgtotal").value = ss[1];

            document.getElementById("divsellprice").innerHTML = ss[0];
            document.getElementById("divport").innerHTML = " + " + ss[1];
            document.getElementById("divcom").innerHTML = " - " + ss[2];
            document.getElementById("divnet").innerHTML = ss[3];
            document.getElementById("tdbtn").display = 'block';
        }
    }
    xmlHttp.open("GET", "getsmodenewval.aspx?txtPrice=" + txtPrice + "&totalComm=" + totalComm + "&txtsm=" + txtsm.value, true);
    xmlHttp.send(null);
}


