﻿// JScript File

var strDomain = "http://localhost:51497/sendflowerstoindia/";
//var strDomain="http://www.giftsflowerstoindia.com/";
var top = 0;
var button = 3;
var searchanchor;
var tempload;
var tophttpRequest1 = false;

function topmakeObjecttop() {
    var tophttpRequest;
    if (window.XMLHttpRequest) {
        tophttpRequest = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        try {
            tophttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            tophttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }

    return tophttpRequest;
}
tophttpRequest1 = topmakeObjecttop();
function Top_processRequest_load_Removeitem() 
{
    if (tophttpRequest1 == null) 
    {
        tophttpRequest1 = topmakeObjecttop();
    }
   if (tophttpRequest1.readyState < 4) {
      // document.getElementById('span_'+prodid).style.display = "block";
        //           document.getElementById("tdloader").innerHTML="<img src=\"images/loadinfo.net.gif\"  alt=\"loading\" />"

    }
    if (tophttpRequest1.readyState == 4) 
    {
        if (tophttpRequest1.status == 200) 
        {
            var response1 = tophttpRequest1.responseText;
            var arrres1=new Array();
            if(response1.indexOf("|@#$")!=-1)
            {
                arrres1 = response1.split("|@#$");
            }
            document.getElementById("category").innerHTML = arrres1[0];
            if(arrres1[1]=="")
            {
                document.getElementById("ucheader_dvshopping").style.display = "none";
            }
            else if(arrres1[1]!="")
            {
                document.getElementById("ucheader_dvshopping").innerHTML = arrres1[1];
            }
            //document.getElementById("divshow").innerHTML = response;          
        }
    }
}
function Top_processRequest_load_discount() 
{
    if (tophttpRequest1 == null) {
        tophttpRequest1 = topmakeObjecttop();
    }
//    if (tophttpRequest1.readyState < 4) {
        //           document.getElementById("tdloader").style.display="block";
        //           document.getElementById("tdloader").innerHTML="<img src=\"images/loadinfo.net.gif\"  alt=\"loading\" />"

//    }
    if (tophttpRequest1.readyState == 4) {

        if (tophttpRequest1.status == 200) {
            var response2 = tophttpRequest1.responseText;
            var arrres2=new Array();
            if(response2.indexOf("|")!=-1)
            {
                arrres2=response2.split("|");
            }
            document.getElementById("category").innerHTML = arrres2[0];
            document.getElementById("ucheader_dvshopping").innerHTML = arrres2[1];
            //document.getElementById("divshow").innerHTML = response2;
        }
    }
}
function Top_processRequest_load_edititem() 
{
    if (tophttpRequest1 == null) {
        tophttpRequest1 = topmakeObjecttop();
    }
//    if (tophttpRequest1.readyState < 4) {
        //           document.getElementById("tdloader").style.display="block";
        //           document.getElementById("tdloader").innerHTML="<img src=\"images/loadinfo.net.gif\"  alt=\"loading\" />"

//    }
    if (tophttpRequest1.readyState == 4) 
    {
        if (tophttpRequest1.status == 200) {
            var response = tophttpRequest1.responseText;
            var arrres=new Array();
            if(response.indexOf("|")!=-1)
            {
                arrres=response.split("|");
            }
            document.getElementById("category").innerHTML = arrres[0];
            document.getElementById("ucheader_dvshopping").innerHTML = arrres[1];
            //document.getElementById("divshow").innerHTML = response;
        }
    }
}


function Top_processRequest_removeallitem() {
    if (tophttpRequest1 == null) {
        tophttpRequest1 = topmakeObjecttop();
    }
    if (tophttpRequest1.readyState < 4) {
        // document.getElementById('span_'+prodid).style.display = "block";
        //           document.getElementById("tdloader").innerHTML="<img src=\"images/loadinfo.net.gif\"  alt=\"loading\" />"

    }
    if (tophttpRequest1.readyState == 4) {
        if (tophttpRequest1.status == 200) {
            var response1 = tophttpRequest1.responseText;
            var arrres1 = new Array();
            if (response1.indexOf("|") != -1) {
                arrres1 = response1.split("|");
            }
            document.getElementById("category").innerHTML = arrres1[0];
            if (arrres1[1] == "") {
                document.getElementById("ucheader_dvshopping").style.display = "none";
            }
            else if (arrres1[1] != "") {
                document.getElementById("ucheader_dvshopping").innerHTML = arrres1[1];
            }
            //document.getElementById("divshow").innerHTML = response;          
        }
    }
}





function deleteItem(Obj) 
{
    deleteid = encodeURIComponent(Obj);
    tophttpRequest1.open("POST", "AjaxRemoveItem.aspx", true);
    tophttpRequest1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    tophttpRequest1.onreadystatechange = Top_processRequest_load_Removeitem;
    tophttpRequest1.send("deleteid=" + deleteid + "&mode=60");
}

function EditItem(Obj, qty) {
    editid = encodeURIComponent(Obj);
    qtytotal = encodeURIComponent(qty);
    tophttpRequest1.open("POST", "AjaxRemoveItem.aspx", true);
    tophttpRequest1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    tophttpRequest1.onreadystatechange = Top_processRequest_load_edititem;
    tophttpRequest1.send("editid=" + editid + "&qtytotal=" + qtytotal + "&mode=61");
}
function discountcalculation(discountcode1) {
    if (document.getElementById('textfield2').value == '') {
        document.getElementById('textfield2').focus();
           }
    else {
        discountcode = encodeURIComponent(discountcode1);
        tophttpRequest1.open("POST", "AjaxRemoveItem.aspx", true);
        tophttpRequest1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        tophttpRequest1.onreadystatechange = Top_processRequest_load_discount;
       
        tophttpRequest1.send("discountcode=" + discountcode + "&mode=statusdiscount");
    }
}
function returnshoppingid(catagoryid,prodid)
{
    var Quantity = document.getElementById('textfield2').options[document.getElementById('textfield2').selectedIndex].text;
    catagoryid = encodeURIComponent(catagoryid);
    prodid = encodeURIComponent(prodid);
    Quantity = encodeURIComponent(Quantity);
    //window.location.href = "" + strDomain + "AddtoCart.aspx?prodid=" + prodid + "&Quantity=" + Quantity + "&catagoryid=" + catagoryid;
    window.location.href ="AddtoCart.aspx?prodid=" + prodid + "&Quantity=" + Quantity + "&catagoryid=" + catagoryid;
    
    
    
    
    //window.location.href = ""+strDomain+"shoppingcrt.aspx?prodid=" + prodid + "&Quantity=" + Quantity + "&catagoryid=" + catagoryid;
    //window.location.href = ""+strDomain+"shoppingcrt.aspx";
}
function checknullvalue() 
{
    if (document.getElementById("textfield2").value == "0" || document.getElementById("textfield2").value == "") 
    {
        document.getElementById("textfield2").value = "1"
    }
}
function checknullvalue1(Obj) 
{
    if (document.getElementById(Obj.id).value == "0" || document.getElementById(Obj.id).value == "") 
    {
        document.getElementById(Obj.id).value = "1"
    }

}


function buyproduct(catid, prodid) {
    var categoryid = encodeURIComponent(catid);
    var productid = encodeURIComponent(prodid);
    var quantity = 1;
    window.location = "AddtoCart.aspx?prodid=" + productid + "&Quantity=" + quantity + "&catagoryid=" + categoryid;
}

function returnshoppingidcatfront(catagoryid, prodid) {
    var Quantity = 1;
    catagoryid = encodeURIComponent(catagoryid);
    prodid = encodeURIComponent(prodid);
    Quantity = encodeURIComponent(Quantity);
    document.getElementById('a_'+ prodid).style.display = "none";
    document.getElementById(prodid).style.display = "block";
    //window.location.href = "" + strDomain + "AddtoCart.aspx?prodid=" + prodid + "&Quantity=" + Quantity + "&catagoryid=" + catagoryid;
    window.location.href = "AddtoCart.aspx?prodid=" + prodid + "&Quantity=" + Quantity + "&catagoryid=" + catagoryid;




    //window.location.href = ""+strDomain+"shoppingcrt.aspx?prodid=" + prodid + "&Quantity=" + Quantity + "&catagoryid=" + catagoryid;
    //window.location.href = ""+strDomain+"shoppingcrt.aspx";
}



function returnshoppingidcat(catagoryid, prodid) {
    var Quantity = 1;
    //alert(catagoryid);
    catagoryid = encodeURIComponent(catagoryid);
    prodid = encodeURIComponent(prodid);
    Quantity = encodeURIComponent(Quantity);
   
    //window.location.href = "" + strDomain + "AddtoCart.aspx?prodid=" + prodid + "&Quantity=" + Quantity + "&catagoryid=" + catagoryid;
    window.location.href = "AddtoCart.aspx?prodid=" + prodid + "&Quantity=" + Quantity + "&catagoryid=" + catagoryid;




    //window.location.href = ""+strDomain+"shoppingcrt.aspx?prodid=" + prodid + "&Quantity=" + Quantity + "&catagoryid=" + catagoryid;
    //window.location.href = ""+strDomain+"shoppingcrt.aspx";
}


function SelectTxtid(prodid, qty) {
    document.getElementById("hdsetprodid").value = prodid;
    document.getElementById("hdsetqty").value = qty;
}


function Removeallproduct() {
    tophttpRequest1.open("POST", "AjaxRemoveItem.aspx", true);
    tophttpRequest1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    tophttpRequest1.onreadystatechange = Top_processRequest_removeallitem;
    tophttpRequest1.send("mode=statusremoveallitem");

}


function checkemptyfield() {
 
    var rtn = '';
    if (document.getElementById("uchead_Uc_search_txtSearch").value == "") {
        document.getElementById("uchead_Uc_search_txtSearch").style.backgroundColor = "#ff00ff";
        document.getElementById("uchead_Uc_search_txtSearch").focus();
        rtn = false;
    }
    else {
        rtn = true;
    }
    return rtn;

}



