﻿function addtocartOther(pid, pval, qty, cid) {
    var d = new Date()
    $.ajax({
        type: "get",
        url: "getCart.ashx?mode=a&pid=" + pid + '&pval=' + pval + '&qty=' + qty + '&nc=' + Math.floor(Math.random() * 200) + "&dt=" + d.getTime(),
        success: function(response) {
            //reloadCart();
            reloadCartOther('popuup_div', 'cart', $(cid).position().top - 80);
            cartItemCountOther();
        },
        error: function(response) {

        }
    });
}

function reloadCartOther(elmid, action, top) {
    var height = $('#' + elmid).height();
    var width = $('#' + elmid).width();
    leftVal = 780 + "px";
    topVal = top + "px";
    $('#' + elmid).css({ left: leftVal, top: topVal }).show().fadeOut(2500);
}



function cartItemCountOther() {
    var d = new Date()
    $.ajax({
        type: "get",
        url: "getcartitem.ashx?nc=" + Math.floor(Math.random() * 200) + "&dt=" + d.getTime(),
        success: function(response) {
            iframeshoppingBasket(response);
        },
        error: function(response) {
            iframeshoppingBasket(response);
        }
    });
}

function gotocart() {
    self.parent.window.location.href = "shoppingcart.aspx";
}

function reloadCart(elmid, action, top) {
    var height = $('#' + elmid).height();
    var width = $('#' + elmid).width();
    leftVal = 600 + "px";
    topVal = top + "px";
    $('#' + elmid).css({ left: leftVal, top: topVal }).show().fadeOut(2500);
}


function getCart() {
    var d = new Date();
    try {
        $('#cartDiv').html("<img src='images/ajax-loader.gif' />");
    }
    catch (ex)
    { }
    $.ajax({
        type: "get",
        url: "getCart.ashx?nc=" + Math.floor(Math.random() * 200) + "&dt=" + d.getTime(),
        success: function(response) {
            $('#cartDiv').html(response);
            cartItemCount();
        },
        error: function(response) {
            $('#cartDiv').html(response);
        }
    });
}



function CreateBookmarkLink() {
    var title = "World Kitchen";
    var url = self.location.href;
    if (window.sidebar) { window.sidebar.addPanel(title, url, ""); } // Mozilla Firefox Bookmark
    else if (window.external) { window.external.AddFavorite(url, title); } // IE Favorite
    else if (window.opera && window.print) { return true; } // Opera Hotlist
}

function openwindow(pagename) {
    var win;
    if (pagename == "delivery") { win = window.open('/' + pagename + '.aspx', null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=570,height=300,top=10,left=10', 'true'); }
    else { win = window.open('/' + pagename + '.aspx', null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=550,height=253,top=10,left=10', 'true'); }
    win.focus();
    return false;
}

function check_field() {
    if (emptyField(document.getElementById("ctl00_txtemail"))) {
        alert('Please Enter Email id');
        document.getElementById("ctl00_txtemail").focus();
        return false;
    }
    if (!validEmailId(document.getElementById("ctl00_txtemail").value)) {
        alert('Please Enter Valid Email id .');
        document.getElementById("ctl00_txtemail").focus();
        return false;
    }
}

function checkKey(b1, e) {
    if (e.keyCode == 13) {
        document.getElementById(b1).click();
        return false;
    }
}



//*******************************************************
function del() {
    var aa;
    aa = confirm("Are you sure you want to delete this record");
    if (aa) {
        return true;
    }
    else {
        return false;
    }
}

//*******************************************************
function emptyField(textobj) {
    if (textobj.value.length == 0) {
        textobj.focus();
        return true;
    }
    for (var i = 0; i < textobj.value.length; ++i) {
        var ch = textobj.value.charAt(i);
        if (ch != ' ' && ch != '\t')
            return false;
    }
    textobj.focus();
    return true;
}

//*******************************************************

function empty_Field(textobj) {
    if (textobj.value.length == 0) {
        //textobj.focus();
        return true;
    }
    for (var i = 0; i < textobj.value.length; ++i) {
        var ch = textobj.value.charAt(i);
        if (ch != ' ' && ch != '\t')
            return false;
    }
    //textobj.focus();
    return true;
}

//*******************************************************
function isblank(blafield) {
    if (blafield.indexOf(' ') == 1) {
        return false;
    }
    else {
        return true;
    }
}
//*******************************************************

function isPercentage(argvalue) {
    argvalue = argvalue.toString();

    if (argvalue.length == 0) {
        return true;
    }

    if (argvalue.length > 3) {
        return false;
    }

    if (argvalue.length < 3) {
        for (var n = 0; n < argvalue.length; n++) {

            if (argvalue.substring(n, n + 1) == "0")
                continue;

            else if (argvalue.substring(n, n + 1) == "1")
                continue;

            else if (argvalue.substring(n, n + 1) == "2")
                continue;

            else if (argvalue.substring(n, n + 1) == "3")
                continue;

            else if (argvalue.substring(n, n + 1) == "4")
                continue;

            else if (argvalue.substring(n, n + 1) == "5")
                continue;

            else if (argvalue.substring(n, n + 1) == "6")
                continue;

            else if (argvalue.substring(n, n + 1) == "7")
                continue;

            else if (argvalue.substring(n, n + 1) == "8")
                continue;

            else if (argvalue.substring(n, n + 1) == "9")
                continue;

            else if (argvalue.substring(n, n + 1) == " ")
                continue;

            else
                return false;
        }
    }
    else {
        if (!(argvalue.substring(0, 1) == "1"))
            return false;

        for (var n = 1; n < 3; n++) {
            if (argvalue.substring(n, n + 1) == "0")
                continue;

            else
                return false;
        }
    }
    return true;
}

//*******************************************************
function isNum(argvalue) {
    argvalue = argvalue.toString();

    if (argvalue.length == 0) {
        return true;
    }

    for (var n = 0; n < argvalue.length; n++) {

        if (argvalue.substring(n, n + 1) == "0")
            continue;

        else if (argvalue.substring(n, n + 1) == "1")
            continue;

        else if (argvalue.substring(n, n + 1) == "2")
            continue;

        else if (argvalue.substring(n, n + 1) == "3")
            continue;

        else if (argvalue.substring(n, n + 1) == "4")
            continue;

        else if (argvalue.substring(n, n + 1) == "5")
            continue;

        else if (argvalue.substring(n, n + 1) == "6")
            continue;

        else if (argvalue.substring(n, n + 1) == "7")
            continue;

        else if (argvalue.substring(n, n + 1) == "8")
            continue;

        else if (argvalue.substring(n, n + 1) == "9")
            continue;

        else if (argvalue.substring(n, n + 1) == " ")
            continue;

        else if (argvalue.substring(n, n + 1) == ".")
            continue;

        else
            return false;

    }
    return true;
}


//*******************************************************

function isInt(argvalue) {
    argvalue = argvalue.toString();

    if (argvalue.length == 0) {
        return true;
    }

    for (var n = 0; n < argvalue.length; n++) {

        if (argvalue.substring(n, n + 1) == "0")
            continue;

        else if (argvalue.substring(n, n + 1) == "1")
            continue;

        else if (argvalue.substring(n, n + 1) == "2")
            continue;

        else if (argvalue.substring(n, n + 1) == "3")
            continue;

        else if (argvalue.substring(n, n + 1) == "4")
            continue;

        else if (argvalue.substring(n, n + 1) == "5")
            continue;

        else if (argvalue.substring(n, n + 1) == "6")
            continue;

        else if (argvalue.substring(n, n + 1) == "7")
            continue;

        else if (argvalue.substring(n, n + 1) == "8")
            continue;

        else if (argvalue.substring(n, n + 1) == "9")
            continue;

        /*else if(argvalue.substring(n, n+1) == " ")
        continue;*/

        else
            return false;

    }
    return true;
}


//*******************************************************
function isDate(sdate) {
    var s, ss, leapyear;
    s = sdate.value;
    ss = s.split("/");
    var today = new Date();
    today = today.getYear();
    today = '20' + today;

    if ((s.substr(1, 1) != "/" && s.substr(2, 1) != "/") || (s.substr(3, 1) != "/" && s.substr(4, 1) != "/" && s.substr(5, 1) != "/")) {

        alert("Enter date in correct form (dd/mm/yyyy)");
        return val_focus(sdate);

    }

    else if ((ss[0].length > 2) || (ss[0].length < 1) || (ss[1].length > 2) || ss[1].length < 1 || (ss[2].length != 4) || (!isNum(ss[0])) || (!isNum(ss[1])) || (!isNum(ss[2]))) {
        alert("Enter date in Correct format (dd/mm/yyyy)");
        return val_focus(sdate);
    }
    else if (ss[2] < 1900 || ss[2] > today) {
        alert("Enter Valid Year [Between 1900-To current Year]");
        return val_focus(sdate);
    }

    else if (ss[1] < 1 || ss[1] > 12) {
        alert("Enter Valid Month [Between 1-12]");
        return val_focus(sdate);
    }

    else if (ss[0] < 1 || ss[0] > 31) {
        alert("Enter Valid day [Between 1-31]");
        return val_focus(sdate);
    }

    else if (ss[1] == 4 || ss[1] == 6 || ss[1] == 9 || ss[1] == 11) {
        if (ss[0] > 30) {
            alert("For this month day should be less than 30");
            return val_focus(sdate);
        }
    }

    else if (ss[1] == 2) {
        if ((ss[2] % 4) == 0) {
            if ((ss[2] % 100) == 0) {
                if ((ss[2] % 400) == 0)
                    leapyear = true;
                else
                    leapyear = false;
            }
            else
                leapyear = true;
        }
        else
            leapyear = false;

        if ((leapyear) && (ss[0] > 29)) {
            alert("This is leap year so date can't greater than 29");
            return val_focus(sdate);
        }

        else if (!(leapyear) && ss[0] > 28) {
            alert("This is not leap year so date can't greater than 28");
            return val_focus(sdate);
        }

    }
    else
        return false;
}

//*******************************************************
function val_focus(formobj) {
    formobj.select();
    formobj.focus();
    return true;

}


//*******************************************************
//author@GBS
function chkExtension(txtfield) {
    var filename, filenamelen
    var fileext, fileextlen
    var allowedtypes = [".jpg", ".JPG", ".jpeg", ".JPEG", ".gif", ".GIF"]
    var dotpos
    filename = txtfield.value
    filenamelen = filename.length
    dotpos = filename.lastIndexOf(".")
    fileextlen = (filenamelen - dotpos - 1)

    if (fileextlen >= 3 && fileextlen <= 4) //this allows files with a min of 3 and max of 4 chars in their extension
    {
        fileext = filename.substring(dotpos, filenamelen)
        //alert (fileext)
        for (var ctr = 0; ctr < allowedtypes.length; ctr++) {

            if (allowedtypes[ctr] == fileext) {
                return true
            }
        }
        //alert("Only JPG/JPEG/GIF type picture files are allowed.\n Please select a valid file type.")	

    }
    else
    //alert("The file you have selected is not a valid picture file.\nPlease select a different file.")

        return false


}


//*******************************************************
function checkBal(txtTargObj, txtDispObj, maxLength) {


    var currLen = txtTargObj.value.length

    if (currLen > maxLength) {
        txtTargObj.value = txtTargObj.value.substring(0, maxLength)
        currLen = txtTargObj.value.length
        txtDispObj.value = maxLength - currLen
    }
    else
        txtDispObj.value = maxLength - currLen

}

//*************** Add Broker ***************

function isChar(argvalue) {
    argvalue = argvalue.toString();

    if (argvalue.length < 1) {
        return false;
    }

    //if (argvalue.length > 0 )
    //{
    //	alert(argvalue.length);
    //}

    for (var n = 0; n < argvalue.length; n++) {

        if (argvalue.substring(n, n + 1) == "A" || argvalue.substring(n, n + 1) == "a")
            continue;

        else if (argvalue.substring(n, n + 1) == "B" || argvalue.substring(n, n + 1) == "b")
            continue;

        else if (argvalue.substring(n, n + 1) == "C" || argvalue.substring(n, n + 1) == "c")
            continue;

        else if (argvalue.substring(n, n + 1) == "D" || argvalue.substring(n, n + 1) == "d")
            continue;

        else if (argvalue.substring(n, n + 1) == "E" || argvalue.substring(n, n + 1) == "e")
            continue;

        else if (argvalue.substring(n, n + 1) == "F" || argvalue.substring(n, n + 1) == "f")
            continue;

        else if (argvalue.substring(n, n + 1) == "G" || argvalue.substring(n, n + 1) == "g")
            continue;

        else if (argvalue.substring(n, n + 1) == "H" || argvalue.substring(n, n + 1) == "h")
            continue;

        else if (argvalue.substring(n, n + 1) == "I" || argvalue.substring(n, n + 1) == "i")
            continue;

        else if (argvalue.substring(n, n + 1) == "J" || argvalue.substring(n, n + 1) == "j")
            continue;

        else if (argvalue.substring(n, n + 1) == "K" || argvalue.substring(n, n + 1) == "k")
            continue;

        else if (argvalue.substring(n, n + 1) == "L" || argvalue.substring(n, n + 1) == "l")
            continue;

        else if (argvalue.substring(n, n + 1) == "M" || argvalue.substring(n, n + 1) == "m")
            continue;

        else if (argvalue.substring(n, n + 1) == "N" || argvalue.substring(n, n + 1) == "n")
            continue;

        else if (argvalue.substring(n, n + 1) == "O" || argvalue.substring(n, n + 1) == "o")
            continue;

        else if (argvalue.substring(n, n + 1) == "P" || argvalue.substring(n, n + 1) == "p")
            continue;

        else if (argvalue.substring(n, n + 1) == "Q" || argvalue.substring(n, n + 1) == "q")
            continue;

        else if (argvalue.substring(n, n + 1) == "R" || argvalue.substring(n, n + 1) == "r")
            continue;

        else if (argvalue.substring(n, n + 1) == "S" || argvalue.substring(n, n + 1) == "s")
            continue;

        else if (argvalue.substring(n, n + 1) == "T" || argvalue.substring(n, n + 1) == "t")
            continue;

        else if (argvalue.substring(n, n + 1) == "U" || argvalue.substring(n, n + 1) == "u")
            continue;

        else if (argvalue.substring(n, n + 1) == "V" || argvalue.substring(n, n + 1) == "v")
            continue;

        else if (argvalue.substring(n, n + 1) == "W" || argvalue.substring(n, n + 1) == "w")
            continue;

        else if (argvalue.substring(n, n + 1) == "X" || argvalue.substring(n, n + 1) == "x")
            continue;

        else if (argvalue.substring(n, n + 1) == "Y" || argvalue.substring(n, n + 1) == "y")
            continue;

        else if (argvalue.substring(n, n + 1) == "Z" || argvalue.substring(n, n + 1) == "z")
            continue;

        else if (argvalue.substring(n, n + 1) == " ")
            continue;

        else
            return false;

    }
    return true;
}


//******************** Search Real Estate **************************

/*function Search_estate()
{
if (!isNum(document.getElementById("tbFPrice").value))
{
alert('Please enter numeric value in Minimum Price');
//document.getElementById("tbFPrice").focus;
val_focus(document.getElementById("tbFPrice"));
return false;
}

if (!isNum(document.getElementById("tbLPrice").value))
{
alert('Please enter numeric value in Maximum Price');
val_focus(document.getElementById("tbLPrice"));
return false;
}
		
if (!isInt(document.getElementById("tbBeds").value))
{
alert('Please enter integer value in Beds');
val_focus(document.getElementById("tbBeds"));
return false;
}
	
if (!isInt(document.getElementById("tbBath").value))
{
alert('Please enter integer value in Baths');
val_focus(document.getElementById("tbBath"));
return false;
}
	
if (!isNum(document.getElementById("tbSquareFeet").value))
{
alert('Please enter numeric value in Minimum Square Feet');
//	document.getElementById("tbSquareFeet").focus;
return false;
}
	
if (!isInt(document.getElementById("tbFloor").value))
{
alert('Please enter integer value in No of Floor');
//	document.getElementById("tbFloor").focus;
return false;
}
	
if (!isInt(document.getElementById("tbParking").value))
{
alert('Please enter integer value in Parking/Garage');
//	document.getElementById("tbParking").focus;
return false;
}
	
if (!isNum(document.getElementById("tbLotSize").value))
{
alert('Please enter numeric value in Lot Size');
document.getElementById("tbLotSize").focus;
return false;
}
	
return true;
}*/

function validEmailId(CheckEmptyEmail) {
    var inem1, inem2, lenem1, l, l1, lenem2, lensp, lechar;
    inem1 = CheckEmptyEmail.length;
    l = CheckEmptyEmail;
    l1 = l.lastIndexOf('.');
    lenem1 = l.lastIndexOf('@');
    lenem2 = l.indexOf('@');
    lensp = l.indexOf(' ');
    lechar = l.charAt(lenem1 + 1);

    if (lechar == '.') {
        return false;
    }

    if ((lenem1 + 1) == l1 || (l1 + 1) == inem1 || lenem1 > l1 || lenem2 != lenem1 || lensp != -1 || lenem1 == 0) {
        return false;
    }

    if (CheckEmptyEmail.indexOf('@') == -1 || CheckEmptyEmail.indexOf('.') == -1) {
        return false;
    }

    if (l.indexOf(',') != -1 || l.indexOf('/') != -1 || l.indexOf('(') != -1 || l.indexOf(')') != -1 || l.indexOf('*') != -1 || l.indexOf('&') != -1 || l.indexOf('^') != -1 || l.indexOf('%') != -1 || l.indexOf('$') != -1 || l.indexOf('&') != -1 || l.indexOf('#') != -1 || l.indexOf('!') != -1) {
        return false;
    }

    return true;
}


function winopen1(proid) {
    window.open("ViewProductImg.aspx?proid=" + proid, "mywindow", "toolbar=0,directories=0,location=0,scrollbars=1,resizable=1,width=550,height=550");
}

function opnParamValue(flag, Productid) {
    window.open("ImageView.aspx?flag=" + flag + "&Productid=" + Productid, "mywindow", "toolbar=0,directories=0,location=0,resizable=1,width=350,height=250");
}

function winopen(imgname) {
    window.open("ViewImg.aspx?imgname=" + imgname, "mywindow", "toolbar=0,directories=0,location=0,resizable=1,width=350,height=350");
}


function subscribe() {
    if (emptyField(document.getElementById("ctl00_txtemail"))) {
        alert('Please Enter Email id');
        document.getElementById("ctl00_txtemail").focus();
        return false;
    }
    if (!validEmailId(document.getElementById("ctl00_txtemail").value)) {
        alert('Please Enter Valid Email id .');
        document.getElementById("ctl00_txtemail").focus();
        return false;
    }
    var txtemail = document.getElementById('ctl00_txtemail').value;
    var url1 = "subscribe.ashx?mode=d&email=" + txtemail;

    $.ajax({
        type: "get",
        url: url1,
        success: function(response) {
            document.getElementById('ctl00_lblmsg').innerHTML = response;
            document.getElementById('ctl00_txtemail').value = "";
        },
        error: function(response) {
            document.getElementById('ctl00_lblmsg').innerHTML = response;
        }
    });
}


function chkSearch() {
    if (emptyField(document.getElementById("ctl00_txtsearch"))) {
        alert('Please Enter Search text.');
        document.getElementById("ctl00_txtsearch").focus();
        return false;
    }
    if (document.getElementById("ctl00_txtsearch").value == 'Search') {
        alert('Please Enter Search text.');
        document.getElementById("ctl00_txtsearch").focus();
        return false;
    }
}

function ViewProductdetail(CatId,PId) {
    parent.location.href = "CategoryProduct.aspx?catid=" + CatId + "&pid=" + PId;
}

function OutofStock1(PId) {
    var win = window.open('OutOfStock.aspx?chk=chk&PID=' + PId, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=220,top=10,left=10', 'true');
    win.focus();
    return false
}

function OutofStock(PId) {
    var win = window.open('OutOfStock.aspx?PID=' + PId, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=220,top=10,left=10', 'true');
    win.focus();
}

function openlifestyle(id) {
    var win = window.open('lifestyleimage.aspx?id=' + id, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=620,height=495,top=10,left=10', 'true');
    win.focus();
    return false
}

function ViewCart(PId, ddlval, qty, cid, strstock) {
    var count = 0;

    if (emptyField(cid)) {
        alert('Please Enter Quantity');
        cid.focus();
        return false;
    }

    if (cid.value < 1) {
        alert('Quantity Must Be Greater Then Zero.');
        cid.focus();
        return false;
    }

    if (!isInt(cid.value)) {
        alert('Please enter Integer value.');
        cid.focus();
        return false;
    }

    if (cid.value > strstock) {
        alert('Only ' + strstock + ' of this product in stock');
        return false;
    }
}

function ValidatedQty(elm, strstock) {
    var count = 0;
    var cid = document.getElementById(elm);
    if (emptyField(cid)) {
        alert('Please Enter Quantity');
        cid.focus();
        return false;
    }
    if (cid.value < 1) {
        alert('Quantity Must Be Greater Then Zero.');
        cid.focus();
        return false;
    }
    if (!isInt(cid.value)) {
        alert('Please enter Integer value.');
        cid.focus();
        return false;
    }
    if (cid.value > strstock) {
        alert('Only ' + strstock + ' of this product in stock');
        return false;
    }
}

function deleteCart(id, action) {
    var height = $('#' + id).height();
    var width = $('#' + id).width();
    leftVal = 0 + "px";
    topVal = 0 + "px";
    $('#' + id).css({ left: leftVal, top: topVal }).show().fadeOut(2500);
    if (action = 'cart') { parent.CartList.location.replace("cartcontrol.aspx?" + Math.floor(Math.random() * 200)); }
}

function refreshCart(id, action) {
    var height = $('#' + id).height();
    var width = $('#' + id).width();
    leftVal = 600 + "px";
    topVal = 0 + "px";
    $('#' + id).css({ left: leftVal, top: topVal }).show().fadeOut(2500);
    if (action = 'cart') { CartList.location.replace("cartcontrol.aspx?" + Math.floor(Math.random() * 200)); }
}

function UpdateCart(id, action) {
    var height = $('#' + id).height();
    var width = $('#' + id).width();
    leftVal = 0 + "px";
    topVal = 0 + "px";
    $('#' + id).css({ left: leftVal, top: topVal }).show().fadeOut(2500);
    if (action = 'cart') { parent.CartList.location.replace("cartcontrol.aspx?" + Math.floor(Math.random() * 200)); }
}

function ShowCart(id, action) {
    var height = $('#' + id).height();
    var width = $('#' + id).width();
    leftVal = 560 + "px";
    topVal = 210 + "px";
    $('#' + id).css({ left: leftVal, top: topVal }).show().fadeOut(2500);
    if (action = 'cart') { parent.CartList.location.replace("cartcontrol.aspx?" + Math.floor(Math.random() * 200)); }
}

function showproductdescription(cartid, productid) {
    parent.location.href = "categoryproduct.aspx?catid=" + cartid + "&pid=" + productid;
    return false;
}

function emailtofriend(PID) {
    var win = window.open('Mailafriend.aspx?PID=' + PID, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=yes,width=600,height=450,top=10,left=10', 'true');
    win.focus();
    return false;
}

function showrealdedproduct(productid) {
    parent.location.href = "product.aspx?pid=" + productid;
    return false;
}


//-----for custom ur pages---------------------------------------------

function updateusercart(target, productid, parameter, mode) {
    $.ajax({
        type: "POST",
        url: "inserttocart.aspx",
        data: "PID=" + productid + "&ddlval=" + parameter + "&mode=" + mode,
        success: function(msg) {
            if (msg == 'cart') { ShowCart(target, 'cart'); }
            else if (msg == 'wishlist') { ShowCart('popuup_div1', ''); }
            else if (msg == 'wishexist') { ShowCart('popuup_div2', ''); }
            else { if (msg != "") { location.href = msg; } }
        }
    });
}

function emailtofriendcustom(PID) {
    var win = window.open('mailafriend.aspx?PID=' + PID, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=yes,width=600,height=450,top=10,left=10', 'true');
    win.focus();
    return false;
}

function ViewProductcustom(PId) {
    var win = window.open('productdetail.aspx?PID=' + PId, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=550,height=400,top=10,left=10', 'true');
    win.focus();
    return false;
}

function outof_stock_custom(PId) {
    var win = window.open('outofstock.aspx?PID=' + PId, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=220,top=10,left=10', 'true');
    win.focus();
}

function view_disc_custom(Subpageid) {
    var win = window.open('viewdiscription.aspx?subpageid=' + Subpageid, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=550,height=400,top=10,left=10', 'true');
    win.focus();
    return false;
}

function shoppingBasket(basket) {
    try {
        document.getElementById("ltrshoppingbasket").innerHTML = basket;
    }
    catch (e) {
        try {
            parent.document.getElementById("ltrshoppingbasket").innerHTML = basket;
        }
        catch (e) {
            try {
                parent.parent.document.getElementById("ltrshoppingbasket").innerHTML = basket;
            }
            catch (exs) { }
        }
    }
}

function iframeshoppingBasket(basket) {
    //parent.document.getElementById("innerHeader1_ltrshoppingbasket").innerHTML = basket;
    if (parent.document.getElementById("ltrshoppingbasket") != null) {
        parent.document.getElementById("ltrshoppingbasket").innerHTML = basket;
    }
    else {
        parent.parent.document.getElementById("ltrshoppingbasket").innerHTML = basket;
    }
}

function subiframeshoppingBasket(basket) {
    //parent.parent.document.getElementById("innerHeader1_ltrshoppingbasket").innerHTML = basket;
    if (parent.parent.document.getElementById("ltrshoppingbasket") != null) {
        parent.parent.document.getElementById("ltrshoppingbasket").innerHTML = basket;
    }
    else {
        parent.document.getElementById("ltrshoppingbasket").innerHTML = basket;
    }
}

//------------------whats New---------------------------------------
function checkbasket(id) {
    var trigger = $('.trigger', this);
    var height = $('#' + id).height();
    var width = $('#' + id).width();
    leftVal = 890 - (width / 2) + "px";
    topVal = 230 - (height / 2) + "px";
    $('#' + id).css({ left: leftVal, top: topVal }).show().fadeOut(2500);
}
//------------------------------------------------------------------



function delCart(id) {
    var d = new Date()
    $('#cartDiv').html("<img src='images/ajax-loader.gif' />");
    $.ajax({
        type: "get",
        url: "getCart.ashx?mode=d&id=" + id + '&nc=' + Math.floor(Math.random() * 200) + "&dt=" + d.getTime(),
        success: function(response) {
            $('#cartDiv').html(response);
            cartItemCount();
        },
        error: function(response) {
            $('#cartDiv').html(response);
        }
    });
}

function addtocart(pid, pval, qty, cid) {
    var d = new Date()
    //$('#hdncart').val(d.getTime());
    $('#cartDiv').html("<img src='images/ajax-loader.gif' />");
    $.ajax({
        type: "get",
        url: "getCart.ashx?mode=a&pid=" + pid + '&pval=' + pval + '&qty=' + qty + '&nc=' + Math.floor(Math.random() * 200) + "&dt=" + d.getTime(),
        success: function(response) {
            reloadCart('popuup_div3', 'cart', $(cid).position().top - 80);
            cartItemCount();
            $('#cartDiv').html(response);
        },
        error: function(response) {
            $('#cartDiv').html(response);
        }
    });
}

function addEvent(obj, evType, fn) {
    if (obj.addEventListener) {
        obj.addEventListener(evType, fn, false);
        return true;
    } else if (obj.attachEvent) {
        var r = obj.attachEvent("on" + evType, fn);
        return r;
    } else {
        return false;
    }
}

if (document.getElementById && document.createTextNode) {
    addEvent(window, 'load', getCart);
}


function checkCart(PId, ddlval, qty, cid, strstock) {
    var count = 0;
    if (emptyField(document.getElementById(cid))) {
        alert('Please Enter Quantity');
        document.getElementById(cid).focus();
        return false;
    }

    if (document.getElementById(cid).value < 1) {
        alert('Quantity Must Be Greater Then Zero.');
        document.getElementById(cid).focus();
        return false;
    }

    if (!isInt(document.getElementById(cid).value)) {
        alert('Please enter Integer value.');
        document.getElementById(cid).focus();
        return false;
    }

    if (document.getElementById(cid).value > strstock) {
        alert('Only ' + strstock + ' of this product in stock');
        return false;
    }
    addtocart(PId, ddlval, document.getElementById(cid).value, document.getElementById(cid));
}

function getCartForDescription() {
    var d = new Date()
    $('#cartDiv').html("<img src='images/ajax-loader.gif' />");
    $.ajax({
        type: "get",
        url: "getCart.ashx?nc=" + Math.floor(Math.random() * 200) + "&dt=" + d.getTime(),
        success: function(response) {
            $('#cartDiv').html(response);
        },
        error: function(response) {
            $('#cartDiv').html(response);
        }
    });
}

function ViewPdf(ref) {
    var win = window.open('Pdf.aspx?ref=' + ref, null, 'toolbar=1,location=1,directories=1,status=0,menubar=0,scrollbars=yes,resizable=yes,top=10,left=10', 'true');
    win.focus();
    return false;
}

//categoryproduct.js
function loadVisitedProducts() {
    $('#visitedDiv').html("<img src='images/ajax-loader.gif' />");
    $.ajax({
        type: "POST",
        url: "visited-products.ashx",
        success: function(response) {
            $('#visitedDiv').html(response);
        },
        error: function(response) {
            $('#visitedDiv').html(response);
        }
    });
}

//loader.js


var t_id = setInterval(animate, 20);
var pos = 0;
var dir = 2;
var len = 0;

function animate() {
    var elem = document.getElementById('progress');
    if (elem != null) {
        if (pos == 0) len += dir;
        if (len > 32 || pos > 79) pos += dir;
        if (pos > 79) len -= dir;
        if (pos > 79 && len == 0) pos = 0;
        elem.style.left = pos;
        elem.style.width = len;
    }
}

function remove_loading() {
    this.clearInterval(t_id);
    var targelem = document.getElementById('loader_container');
    targelem.style.display = 'none';
    targelem.style.visibility = 'hidden';
    var t_id = setInterval(animate, 60);
}



//innerCategoryProduct.js


function ViewDisc(Subpageid) {
    var win = window.open('ViewDiscription.aspx?Subpageid=' + Subpageid, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=550,height=400,top=10,left=10', 'true');
    win.focus();
    return false;
}
// Firefox worked fine. Internet Explorer shows scrollbar because of frameborder
function resizeFrame(f) {
    alert(f);
    f = document.getElementById(f);
    f.style.height = "0px";
    alert(f.style.height);
}
function chkHeightincat1() {
    return document.getElementById("Form11").offsetHeight;
}


//Validation_function.js



function check_integer(argvalue) {
    for (var n = 0; n < argvalue.length; n++) {

        if (argvalue.substring(n, n + 1) == "0")
            continue;
        else if (argvalue.substring(n, n + 1) == "1")
            continue;
        else if (argvalue.substring(n, n + 1) == "2")
            continue;
        else if (argvalue.substring(n, n + 1) == "3")
            continue;
        else if (argvalue.substring(n, n + 1) == "4")
            continue;
        else if (argvalue.substring(n, n + 1) == "5")
            continue;
        else if (argvalue.substring(n, n + 1) == "6")
            continue;
        else if (argvalue.substring(n, n + 1) == "7")
            continue;
        else if (argvalue.substring(n, n + 1) == "8")
            continue;
        else if (argvalue.substring(n, n + 1) == "9")
            continue;
        //else if(argvalue.substring(n, n+1) == ".")
        //continue;
        //else if(argvalue.substring(n, n+1) == " ")
        //continue;
        else
            return false;

    }
    return true;
}

function check_numeric(argvalue) {
    for (var n = 0; n < argvalue.length; n++) {

        if (argvalue.substring(n, n + 1) == "0")
            continue;
        else if (argvalue.substring(n, n + 1) == "1")
            continue;
        else if (argvalue.substring(n, n + 1) == "2")
            continue;
        else if (argvalue.substring(n, n + 1) == "3")
            continue;
        else if (argvalue.substring(n, n + 1) == "4")
            continue;
        else if (argvalue.substring(n, n + 1) == "5")
            continue;
        else if (argvalue.substring(n, n + 1) == "6")
            continue;
        else if (argvalue.substring(n, n + 1) == "7")
            continue;
        else if (argvalue.substring(n, n + 1) == "8")
            continue;
        else if (argvalue.substring(n, n + 1) == "9")
            continue;
        else if (argvalue.substring(n, n + 1) == ".")
            continue;

        else
            return 0;

    }
    return 1;
}

function check_email(CheckEmptyEmail) {
    var inem1, inem2, lenem1, l, l1, lenem2, lensp, lechar;
    inem1 = CheckEmptyEmail.length;
    l = CheckEmptyEmail;
    l1 = l.lastIndexOf('.');
    lenem1 = l.lastIndexOf('@');
    lenem2 = l.indexOf('@');
    lensp = l.indexOf(' ');
    lechar = l.charAt(lenem1 + 1);

    if (lechar == '.') {
        return 0;
    }

    if ((lenem1 + 1) == l1 || (l1 + 1) == inem1 || lenem1 > l1 || lenem2 != lenem1 || lensp != -1 || lenem1 == 0) {
        return 0;
    }

    if (CheckEmptyEmail.indexOf('@') == -1 || CheckEmptyEmail.indexOf('.') == -1) {
        return 0;
    }

    return 1;
}

function check_contact_zip(argvalue) {
    for (var n = 0; n < argvalue.length; n++) {
        if (argvalue.substring(n, n + 1) == "0")
            continue;
        else if (argvalue.substring(n, n + 1) == "1")
            continue;
        else if (argvalue.substring(n, n + 1) == "2")
            continue;
        else if (argvalue.substring(n, n + 1) == "3")
            continue;
        else if (argvalue.substring(n, n + 1) == "4")
            continue;
        else if (argvalue.substring(n, n + 1) == "5")
            continue;
        else if (argvalue.substring(n, n + 1) == "6")
            continue;
        else if (argvalue.substring(n, n + 1) == "7")
            continue;
        else if (argvalue.substring(n, n + 1) == "8")
            continue;
        else if (argvalue.substring(n, n + 1) == "9")
            continue;
        else if (argvalue.substring(n, n + 1) == "-")
            continue;
        else if (argvalue.substring(n, n + 1) == "+")
            continue;
        else if (argvalue.substring(n, n + 1) == "(")
            continue;
        else if (argvalue.substring(n, n + 1) == ")")
            continue;
        else if (argvalue.substring(n, n + 1) == " ")
            continue;

        else
            return 0;
    }
    return 1;
}

function check_password(argvalue, argvalue1) {
    if (argvalue.length != argvalue1.length)
        return 0;

    for (var n = 0; n < argvalue.length; n++) {
        if (argvalue.substring(n, n + 1) == argvalue1.substring(n, n + 1))
            continue;

        else
            return 1;

    }
    return 2;
}

function chkExtension(txtfield) {
    var filename, filenamelen
    var fileext, fileextlen
    var allowedtypes = [".jpg", ".JPG", ".jpeg", ".JPEG", ".gif", ".GIF"]
    var dotpos
    filename = txtfield.value
    filenamelen = filename.length
    dotpos = filename.lastIndexOf(".")
    fileextlen = (filenamelen - dotpos - 1)

    if (fileextlen >= 3 && fileextlen <= 4) //this allows files with a min of 3 and max of 4 chars in their extension
    {
        fileext = filename.substring(dotpos, filenamelen)
        //alert (fileext)
        for (var ctr = 0; ctr < allowedtypes.length; ctr++) {
            if (allowedtypes[ctr] == fileext) {
                return true;
            }
        }
        //alert("Only JPG/JPEG/GIF type picture files are allowed.\n Please select a valid file type.")	
    }
    else
    //alert("The file you have selected is not a valid picture file.\nPlease select a different file.")
        return false;
}


//UserLogin.js



function check_fields() {

    if (emptyField(document.getElementById("txtUser"))) {
        alert("Enter your Email Address");
        document.getElementById("txtUser").focus();
        return false;
    }

    arg = document.getElementById("txtUser").value;
    flag = check_email(arg);
    if (flag == 0) {
        alert('Enter valid e-mail address.');
        document.getElementById("txtUser").focus();
        return false;
    }
    if (emptyField(document.getElementById("txtPassword"))) {
        alert("Enter Password");
        document.getElementById("txtPassword").focus();
        return false;
    }
}
function login_fields() {
    var flag;
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail"))) {
        alert("Enter your Email Address.");
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }
    arg = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value;
    flag = check_email(arg);
    if (flag == 0) {
        alert('Enter valid e-mail address.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtPwd"))) {
        alert("Enter your Password.");
        document.getElementById("ctl00_ContentPlaceHolder1_txtPwd").focus();
        return false;
    }
}


//default.js.....


function check_fields() {
    var flag;
    if (emptyField(document.getElementById("Login_User1_txtUser"))) {
        alert("Enter your Email Address");
        document.getElementById("Login_User1_txtUser").focus();
        return false;
    }

    arg = document.getElementById("Login_User1_txtUser").value;
    flag = check_email(arg);
    if (flag == 0) {
        alert('Enter valid e-mail address.');
        document.getElementById("Login_User1_txtUser").focus();
        return false;
    }
    if (emptyField(document.getElementById("Login_User1_txtPassword"))) {
        alert("Enter Password");
        document.getElementById("Login_User1_txtPassword").focus();
        return false;
    }
}

function Signup_fields() {
    var arg;
    var flag;

    if (emptyField(document.getElementById("Signup1_txtEmail"))) {
        alert("Enter your Email Address");
        document.getElementById("Signup1_txtEmail").focus();
        return false;
    }

    arg = document.getElementById("Signup1_txtEmail").value;
    flag = check_email(arg);
    if (flag == 0) {
        alert('Enter valid e-mail address.');
        document.getElementById("Signup1_txtEmail").focus();
        return false;
    }



    if (emptyField(document.getElementById("Signup1_txtPass"))) {
        alert('Enter Password..');
        document.getElementById("Signup1_txtPass").focus();
        return false;
    }

    if (emptyField(document.getElementById("Signup1_txtPassAgain"))) {
        alert('Enter Confirm Password..');
        document.getElementById("Signup1_txtPassAgain").focus();
        return false;
    }

    var pass1 = document.getElementById("Signup1_txtPass").value;
    var pass2 = document.getElementById("Signup1_txtPassAgain").value;
    flag = check_password(pass1, pass2)
    if (flag == 0 || flag == 1) {
        alert('Password and confirm password must be same.');
        document.getElementById("Signup1_txtPass").focus();
        return false;
    }

    if (emptyField(document.getElementById("Signup1_txtFname"))) {
        alert('Enter Your First Name.');
        document.getElementById("Signup1_txtFname").focus();
        return false;
    }
    if (emptyField(document.getElementById("Signup1_txtLname"))) {
        alert('Enter Your Last Name.');
        document.getElementById("Signup1_txtLname").focus();
        return false;
    }

    if (document.getElementById("Signup1_ddlDate").value == "0") {
        alert('Select Day.');
        document.getElementById("Signup1_ddlDate").focus();
        return false;
    }
    if (document.getElementById("Signup1_ddlMonth").value == "0") {
        alert('Select Month.');
        document.getElementById("Signup1_ddlMonth").focus();
        return false;
    }
    if (document.getElementById("Signup1_ddlYear").value == "0") {
        alert('Select Year.');
        document.getElementById("Signup1_ddlYear").focus();
        return false;
    }
}

/*function check_product(i)
{
if(i.value==0)
{
alert('Select product');
return false;
}
}*/
function check_product(i, pid) {
    //pvalueid
    //pid

    document.getElementById("SearchProductsNew1_pvalueid").value = i.value;
    document.getElementById("SearchProductsNew1_pid").value = pid;

    //alert('pvalueid ' + document.getElementById("SearchProducts1_pvalueid").value);
    //alert('pid ' + document.getElementById("SearchProducts1_pid").value);

    //return false;
    /*if(i.value==0)
    {
    alert('Select product');
    return false;
    }*/
}

function check_product1(i, pid) {
    //pvalueid
    //pid

    document.getElementById("View_productsnew1_pvalueid").value = i.value;
    document.getElementById("View_productsnew1_pid").value = pid;
    //alert('pvalueid ' + document.getElementById("View_products1_pvalueid").value);
    //alert('pid ' + document.getElementById("View_products1_pid").value);
}

function check_qty(txtqty) {
    var test = 0;
    var con = 2;
    var con1 = 0;
    for (var i = 0; i < document.aspnetForm.length; i++) {
        if (document.aspnetForm.elements[i].id.indexOf("txtqty") != -1) {
            if (con < 10) {
                con1 = "0" + con;
            }
            else {
                con1 = con;
            }
            if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_dgCart_ctl" + con1 + "_txtqty"))) {
                alert('Please enter Quantity');
                document.getElementById("ctl00_ContentPlaceHolder1_dgCart_ctl" + con1 + "_txtqty").focus();
                return false;
            }

            if (document.getElementById("ctl00_ContentPlaceHolder1_dgCart_ctl" + con1 + "_txtqty").value < 1) {
                alert('Quantity must be Greater then Zero.');
                document.getElementById("ctl00_ContentPlaceHolder1_dgCart_ctl" + con1 + "_txtqty").focus();
                return false;
            }

            if (!isInt(document.getElementById("ctl00_ContentPlaceHolder1_dgCart_ctl" + con1 + "_txtqty").value)) {
                alert('Please enter Integer value.');
                document.getElementById("ctl00_ContentPlaceHolder1_dgCart_ctl" + con1 + "_txtqty").focus();
                return false;
            }

            if (parseFloat(document.getElementById("ctl00_ContentPlaceHolder1_dgCart_ctl" + con1 + "_txtqty").value) > parseFloat(document.getElementById("ctl00_ContentPlaceHolder1_dgCart_ctl" + con1 + "_lblstock").value)) {
                alert('Only ' + document.getElementById("ctl00_ContentPlaceHolder1_dgCart_ctl" + con1 + "_lblstock").value + ' of this product in stock');
                return false;
            }
            con = con + 1;
        }
    }
}

function set_shippingInfo() {
    if (document.getElementById("ctl00_ContentPlaceHolder1_chkShip").checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipCompanyName").value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillCompanyName").value;
        //document.Form1.txtShipLname.value = document.getElementById("txtBillLname").value;
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipAddr1").value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillAddr1").value;
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipAddr2").value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillAddr2").value;
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipCity").value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillCity").value;
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipState").value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillState").value;
        document.getElementById("ctl00_ContentPlaceHolder1_ddlShipCountry").value = document.getElementById("ctl00_ContentPlaceHolder1_ddlBillCountry").value;
        document.getElementById("ctl00_ContentPlaceHolder1_ddlshipstate").value = document.getElementById("ctl00_ContentPlaceHolder1_ddlbillstate").value;
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipPost").value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillPost").value;
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipPhone").value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillPhone").value;
        if (document.getElementById("dctl00_ContentPlaceHolder1_dlBillCountry").value == document.getElementById("ctl00_ContentPlaceHolder1_hdstateid").value) {
            document.getElementById("ctl00_ContentPlaceHolder1_trbillstate").style.display = "";
            document.getElementById("ctl00_ContentPlaceHolder1_trshipstate").style.display = "";
        }
        else {
            document.getElementById("ctl00_ContentPlaceHolder1_trbillstate").style.display = "none";
            document.getElementById("ctl00_ContentPlaceHolder1_trshipstate").style.display = "none";
        }

    }
    else if (document.getElementById("ctl00_ContentPlaceHolder1_chkShip").checked == false) {
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipCompanyName").value = "";
        //document.Form1.txtShipLname.value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipAddr1").value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipAddr2").value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipCity").value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipState").value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_ddlShipCountry").value = "0";
        document.getElementById("ctl00_ContentPlaceHolder1_ddlshipstate").value = "0";
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipPost").value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipPhone").value = "";
        if (document.getElementById("ctl00_ContentPlaceHolder1_ddlBillCountry").value == document.getElementById("ctl00_ContentPlaceHolder1_hdstateid").value) {
            document.getElementById("ctl00_ContentPlaceHolder1_trbillstate").style.display = "";
            document.getElementById("ctl00_ContentPlaceHolder1_trshipstate").style.display = "none";
        }
        else {
            document.getElementById("ctl00_ContentPlaceHolder1_trbillstate").style.display = "none";
            document.getElementById("ctl00_ContentPlaceHolder1_trshipstate").style.display = "none";
        }
    }
}

function statetropen() {
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlBillCountry").value == document.getElementById("ctl00_ContentPlaceHolder1_hdstateid").value) { document.getElementById("ctl00_ContentPlaceHolder1_trbillstate").style.display = ""; }
    else { document.getElementById("ctl00_ContentPlaceHolder1_trbillstate").style.display = "none"; }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlShipCountry").value == document.getElementById("ctl00_ContentPlaceHolder1_hdstateid").value) { document.getElementById("ctl00_ContentPlaceHolder1_trshipstate").style.display = ""; }
    else { document.getElementById("ctl00_ContentPlaceHolder1_trshipstate").style.display = "none"; }
}

function check_billingInfo() {
    var arg;
    var flag;
    // check billing info fields
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillCompanyName"))) {
        alert("Enter your Name");
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillCompanyName").focus();
        return false;
    }
    //if (emptyField(document.getElementById("txtBillLname")))
    //{
    //alert("Enter your Last Name");
    //document.getElementById("txtBillLname").focus();
    //return false;
    //}
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillAddr1"))) {
        alert("Enter your Frist Address");
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillAddr1").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillCity"))) {
        alert("Enter your City");
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillCity").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillState"))) {
        alert("Enter your County");
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillState").focus();
        return false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlBillCountry").value == "0") {
        alert('Select Your Country.');
        document.getElementById("ctl00_ContentPlaceHolder1_ddlBillCountry").focus();
        return false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlBillCountry").value == document.getElementById("ctl00_ContentPlaceHolder1_hdstateid").value) {
        if (document.getElementById("ctl00_ContentPlaceHolder1_ddlbillstate").value == "0") {
            alert('Select Your State.');
            document.getElementById("ctl00_ContentPlaceHolder1_ddlbillstate").focus();
            return false;
        }
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillPost"))) {
        alert('Enter PostCode');
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillPost").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillPhone"))) {
        alert('Enter Phone No.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillPhone").focus();
        return false;
    }
    //if (!isInt(document.getElementById("txtBillPhone").value))
    //{
    //	alert('Please enter only digits.');
    //	document.getElementById("txtBillPhone").focus();
    //		return false;
    //	}

    // check shipping info fields
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipCompanyName"))) {
        alert("Enter your Name");
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipCompanyName").focus();
        return false;
    }
    //if (emptyField(document.getElementById("txtShipLname")))
    //{
    //alert("Enter your Last Name");
    //document.getElementById("txtShipLname").focus();
    //return false;
    //}
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipAddr1"))) {
        alert("Enter your Frist Address");
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipAddr1").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipCity"))) {
        alert("Enter your City");
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipCity").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipState"))) {
        alert("Enter your County");
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipState").focus();
        return false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlShipCountry").value == "0") {
        alert('Select Your Country.');
        document.getElementById("ctl00_ContentPlaceHolder1_ddlShipCountry").focus();
        return false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlShipCountry").value == document.getElementById("ctl00_ContentPlaceHolder1_hdstateid").value) {
        if (document.getElementById("ctl00_ContentPlaceHolder1_ddlshipstate").value == "0") {
            alert('Select Your State.');
            document.getElementById("ctl00_ContentPlaceHolder1_ddlshipstate").focus();
            return false;
        }
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipPost"))) {
        alert('Enter PostCode');
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipPost").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipPhone"))) {
        alert('Enter Phone No.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipPhone").focus();
        return false;
    }
    //if (!isInt(document.getElementById("txtShipPhone").value))
    //{
    //	alert('Please enter only digits.');
    //	document.getElementById("txtShipPhone").focus();
    //	return false;
    //	}
}


function getObjectByID(Objid) {
    var ns4 = document.layers;
    var ns6 = document.getElementById && !document.all;
    var ie4 = document.all;
    if (ns4) {
        return eval('document.' + Objid)
    }
    if (ns6) {
        return document.getElementById(Objid);
    }
    if (ie4) {
        return document.all(Objid);
    }
    return null
}


function SetText(objid, msg, fg, bg) {
    var ns4 = document.layers;
    var ns6 = document.getElementById && !document.all;
    var ie4 = document.all;
    if (!fg) fg = "#ff0000";
    if (!bg) bg = "#FFFFFF";

    var content = msg;
    if (ns4) {
        objItm = eval('document.' + objid)
        objItm.document.write(content);
        objItm.document.close();
        objItm.visibility = "visible";
    }
    if (ns6) {
        document.getElementById(objid).innerHTML = content;
    }
    if (ie4) {
        document.all(objid).innerHTML = content;
    }
}


function check_radiobutton() {
    var i;
    var tot;
    for (i = 0; i < document.Form1.length; i++) {
        if (document.Form1.elements[i].type == "radio") {
            if (document.Form1.elements[i].checked == true) {
                document.getElementById("NetPrc").value = parseFloat(document.getElementById("subtot").value) + parseFloat(document.Form1.elements[i].value);
            }
        }

    }

    if (document.getElementById("dis").value != "") {
        document.getElementById("NetPrc").value = parseFloat(document.getElementById("NetPrc").value) - parseFloat(document.getElementById("dis").value);
    }

    document.getElementById("NetPrc").value = parseFloat(document.getElementById("NetPrc").value) - parseFloat(document.getElementById("spdis").value);

    tot = (parseFloat(document.getElementById("NetPrc").value)).toFixed(2);

    SetText("Contenttot", tot);
}



function check_Product() {
    var test = 0;
    var con = 1;
    for (var i = 0; i < 5; i++) {


        if (i == 0) {
            if (emptyField(document.getElementById("QuickBy1_txtname" + con))) {
                alert('Please enter Product Code');
                document.getElementById("QuickBy1_txtname" + con).focus();
                return false;
            }
            if (emptyField(document.getElementById("QuickBy1_txtqty" + con))) {
                alert('Please enter Quantity');
                document.getElementById("QuickBy1_txtqty" + con).focus();
                return false;
            }
        }

        if (!emptyField(document.getElementById("QuickBy1_txtname" + con))) {
            if (emptyField(document.getElementById("QuickBy1_txtqty" + con))) {
                alert('Please enter Quantity');
                document.getElementById("QuickBy1_txtqty" + con).focus();
                return false;
            }
        }


        if (!emptyField(document.getElementById("QuickBy1_txtqty" + con))) {
            if (document.getElementById("QuickBy1_txtqty" + con).value < 1) {
                alert('Quantity must be Greater then Zero.');
                document.getElementById("QuickBy1_txtqty" + con).focus();
                return false;
            }

            if (!isInt(document.getElementById("QuickBy1_txtqty" + con).value)) {
                alert('Please enter Integer value.');
                document.getElementById("QuickBy1_txtqty" + con).focus();
                return false;
            }
        }



        con = con + 1;
    }
}

function checkcreditcard() {

    if (document.getElementsByName("CardType").value = "") {
        alert('Please select Card type.');
        document.getElementsByName("CardType").focus();
        return false;
    }

    if (emptyField(document.getElementById("CardNumber"))) {
        alert('Please enter card number.');
        document.getElementById("CardNumber").focus();
        return false;
    }

    if (emptyField(document.getElementById("CardHolder"))) {
        alert('Please enter card holder name.');
        document.getElementById("CardHolder").focus();
        return false;
    }

    if (emptyField(document.getElementById("CV2"))) {
        alert('Please enter credit card verification number.');
        document.getElementById("CV2").focus();
        return false;
    }

}


//on change password page


function valid_pass() {
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtoldpwd"))) {
        alert("Please Enter Old Password");
        document.getElementById("ctl00_ContentPlaceHolder1_txtoldpwd").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtnewpwd"))) {
        alert("Please Enter New Password");
        document.getElementById("ctl00_ContentPlaceHolder1_txtnewpwd").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtconfirmpwd"))) {
        alert("Please Enter Confirm Password");
        document.getElementById("ctl00_ContentPlaceHolder1_txtconfirmpwd").focus();
        return false;
    }

    if (document.getElementById("ctl00_ContentPlaceHolder1_txtnewpwd").value != document.getElementById("ctl00_ContentPlaceHolder1_txtconfirmpwd").value) {
        alert("New Password And Confirm Password Must Be Same");
        document.getElementById("ctl00_ContentPlaceHolder1_txtnewpwd").focus();
        return false;
    }
}



//checkout.js


/*

function set_shippingInfo() {
    if (document.getElementById("chkShip").checked == true) {

        document.Form1.txtShipCompanyName.value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillCompanyName").value;
        document.Form1.txtShipAddr1.value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillAddr1").value;
        document.Form1.txtShipAddr2.value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillAddr2").value;
        document.Form1.txtShipCity.value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillCity").value;
        document.Form1.txtShipState.value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillState").value;
        document.Form1.ddlShipCountry.value = document.getElementById("ctl00_ContentPlaceHolder1_ddlBillCountry").value;
        document.Form1.txtShipPost.value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillPost").value;
        document.Form1.txtShipPhone.value = document.getElementById("ctl00_ContentPlaceHolder1_txtBillPhone").value;


    }
    else if (document.getElementById("ctl00_ContentPlaceHolder1_chkShip").checked == false) {

        document.Form1.txtShipCompanyName.value = "";
        document.Form1.txtShipAddr1.value = "";
        document.Form1.txtShipAddr2.value = "";
        document.Form1.txtShipCity.value = "";
        document.Form1.txtShipState.value = "";
        document.Form1.ddlShipCountry.value = "0";
        document.Form1.txtShipPost.value = "";
        document.Form1.txtShipPhone.value = "";
    }
}

function check_billingInfo() {
    var arg;
    var flag;
    // check billing info fields
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillCompanyName"))) {
        alert("Enter company Name");
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillCompanyName").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillAddr1"))) {
        alert("Enter your Frist Address");
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillAddr1").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillCity"))) {
        alert("Enter your City");
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillCity").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillState"))) {
        alert("Enter your County");
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillState").focus();
        return false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlBillCountry").value == "0") {
        alert('Select Your Country.');
        document.getElementById("ctl00_ContentPlaceHolder1_ddlBillCountry").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillPost"))) {
        alert('Enter PostCode');
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillPost").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtBillPhone"))) {
        alert('Enter Phone No.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtBillPhone").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipCompanyName"))) {
        alert("Enter your First Name");
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipCompanyName").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipAddr1"))) {
        alert("Enter your Frist Address");
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipAddr1").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipCity"))) {
        alert("Enter your City");
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipCity").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipState"))) {
        alert("Enter your County");
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipState").focus();
        return false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlShipCountry").value == "0") {
        alert('Select Your Country.');
        document.getElementById("ctl00_ContentPlaceHolder1_ddlShipCountry").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipPost"))) {
        alert('Enter PostCode');
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipPost").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtShipPhone"))) {
        alert('Enter Phone No.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtShipPhone").focus();
        return false;
    }
}
*/

//contact us page....

function validContact() {
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtname"))) {
        alert('Please enter Name');
        document.getElementById("ctl00_ContentPlaceHolder1_txtname").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtcompany"))) {
        alert('Please enter Company Name');
        document.getElementById("ctl00_ContentPlaceHolder1_txtcompany").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txttel"))) {
        alert('Please enter Telephone No.');
        document.getElementById("ctl00_ContentPlaceHolder1_txttel").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtemail"))) {
        alert('Please enter Email');
        document.getElementById("ctl00_ContentPlaceHolder1_txtemail").focus();
        return false;
    }

    if (!validEmailId(document.getElementById("ctl00_ContentPlaceHolder1_txtemail").value)) {
        alert('Please enter Valid EmailId.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtemail").focus();
        return false;
    }
}


//creditcard.js


function cardTypeChanged(selectObject) {
    if (selectObject.value == 'PAYPAL') {
        var sDisabledBGColour = "#DDDDDD";
        document.storeform.CardHolder.value = '';
        document.storeform.CardHolder.style.background = sDisabledBGColour;
        document.storeform.CardHolder.disabled = true;
        document.storeform.CardNumber.value = '';
        document.storeform.CardNumber.style.background = sDisabledBGColour;
        document.storeform.CardNumber.disabled = true;
        document.storeform.StartDate.value = '';
        document.storeform.StartDate.style.background = sDisabledBGColour;
        document.storeform.StartDate.disabled = true;
        document.storeform.ExpiryDate.value = '';
        document.storeform.ExpiryDate.style.background = sDisabledBGColour;
        document.storeform.ExpiryDate.disabled = true;
        document.storeform.IssueNumber.value = '';
        document.storeform.IssueNumber.style.background = sDisabledBGColour;
        document.storeform.IssueNumber.disabled = true;
        document.storeform.CV2.value = '';
        document.storeform.CV2.style.background = sDisabledBGColour;
        document.storeform.CV2.disabled = true;
        alert('You just selected a payment method of PayPal so card details will not be required here.\n\nAfter clicking \'Proceed\' you will be securely redirected to the PayPal website to authorise your details.');
    } else {
        document.storeform.CardHolder.disabled = false;
        document.storeform.CardHolder.style.background = "";
        document.storeform.CardNumber.disabled = false;
        document.storeform.CardNumber.style.background = "";
        document.storeform.StartDate.disabled = false;
        document.storeform.StartDate.style.background = "";
        document.storeform.ExpiryDate.disabled = false;
        document.storeform.ExpiryDate.style.background = "";
        document.storeform.IssueNumber.disabled = false;
        document.storeform.IssueNumber.style.background = "";
        document.storeform.CV2.disabled = false;
        document.storeform.CV2.style.background = "";
    }
}

function checkcreditcard() {
    if (document.getElementsByName("CardType").value = "") {
        alert('Please select Card type.');
        document.getElementsByName("CardType").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_CardNumber"))) {
        alert('Please enter card number.');
        document.getElementById("ctl00_ContentPlaceHolder1_CardNumber").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_CardHolder"))) {
        alert('Please enter card holder name.');
        document.getElementById("ctl00_ContentPlaceHolder1_CardHolder").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_CV2"))) {
        alert('Please enter credit card verification number.');
        document.getElementById("ctl00_ContentPlaceHolder1_CV2").focus();
        return false;
    }
}


//feedback.aspx



function validContactfdbk() {

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtname"))) {
        alert('Please enter Name');
        document.getElementById("ctl00_ContentPlaceHolder1_txtname").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txttel"))) {
        alert('Please enter Telephone No.');
        document.getElementById("ctl00_ContentPlaceHolder1_txttel").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail"))) {
        alert('Please enter Email');
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }
    if (!validEmailId(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value)) {
        alert('Please enter Valid EmailId.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }
}

//forgot password.aspx


function valid_Email() {
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail"))) {
        alert('Please Enter Email Id');
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }

    if (!validEmailId(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value)) {
        alert('Please Enter Valid EmailId.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }
}


//forsale.aspx
//Preview_temp2.js


/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var offsetfrommouse = [15, 15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration = 0; //duration in seconds image should remain visible. 0 for always.

var defaultimageheight = 40; // maximum image size.
var defaultimagewidth = 40; // maximum image size. 

var timer;

function gettrailobj() {
    //alert(document.getElementById("preview_div").innerHTML);
    if (document.getElementById)
        return document.getElementById("preview_div").style
}

function gettrailobjnostyle() {
    if (document.getElementById)
        return document.getElementById("preview_div")
}


function truebody() {
    return (!window.opera && document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
}


function hidetrail() {
    gettrailobj().display = "none";
    document.onmousemove = "";
    gettrailobj().left = "-500px";
    clearTimeout(timer);
}

function showtrail(imagename, title, width, height) {

    var imgsrc;
    if (imagename == "") {
        imgsrc = 'images/no_image.gif';
    }
    else {
        imgsrc = 'PopatStore_Images/Extraimages/' + imagename;
    }

    i = imgsrc;

    //t = title;
    //t = 'worldkitchen';
    //alert(i);
    w = width;
    h = height;

    timer = setTimeout("show('" + i + "',w,h);", 200);

}

function show(imagename, width, height) {

    var titleremoved = '';
    var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0]
    var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

    if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1))) {
        (width == 0) ? width = defaultimagewidth : '';
        (height == 0) ? height = defaultimageheight : '';

        if (width < 140) {
            width = 140;
        }
        width += 30;
        height += 28;

        defaultimageheight = height;
        defaultimagewidth = width;

        document.onmousemove = followmouse;

        newHTML = '<div align="center" class="border_preview" style="width:' + width + 'px;height:' + height + 'px;"><div  align="center" id="loader_container"><div id="loader" align="center"><div align="center">Loading Image preview...</div><div id="loader_bg"><div id="progress"> </div></div></div></div>';
        //newHTML = newHTML + '<h2 class="pagetitle">' + ' '+ title + '</h2>'
        newHTML = newHTML + '<div align="center" class="preview_temp_load"><img onload="javascript:remove_loading();" src="' + imagename + '" border="0"></div>';
        newHTML = newHTML + '</div>';

        if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Opera") == -1) {
            newHTML = newHTML + '<iframe src="about:blank" scrolling="no" frameborder="0" width="' + width + '" height="' + height + '"></iframe>';
        }

        gettrailobjnostyle().innerHTML = newHTML;

        gettrailobj().display = "block";
    }
}

function followmouse(e) {
    var xcoord = offsetfrommouse[0]
    var ycoord = offsetfrommouse[1]
    var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - 15
    var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

    if (typeof e != "undefined") {
        if (docwidth - e.pageX < defaultimagewidth + 2 * offsetfrommouse[0]) {
            xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
        } else {
            xcoord += e.pageX;
        }
        if (docheight - e.pageY < defaultimageheight + 2 * offsetfrommouse[1]) {
            ycoord += e.pageY - Math.max(0, (2 * offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
        } else {
            ycoord += e.pageY;
        }

    } else if (typeof window.event != "undefined") {
        if (docwidth - event.clientX < defaultimagewidth + 2 * offsetfrommouse[0]) {
            xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
        } else {
            xcoord += truebody().scrollLeft + event.clientX
        }
        if (docheight - event.clientY < (defaultimageheight + 2 * offsetfrommouse[1])) {
            ycoord += event.clientY + truebody().scrollTop - Math.max(0, (2 * offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
        } else {
            ycoord += truebody().scrollTop + event.clientY;
        }
    }

    gettrailobj().left = xcoord + "px"
    gettrailobj().top = ycoord + "px"
}


//searchpage.js
function OutofStock1(PId) {
    var win = window.open('OutOfStock.aspx?chk=chk&PID=' + PId, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=220,top=10,left=10', 'true');
    win.focus();
    return false
}

function ViewCartOther(PId, ddlval, qty, cid, strstock) {
    var count = 0;
    if (emptyField(document.getElementById(cid))) {
        alert('Please Enter Quantity');
        cid.focus();
        return false;
    }

    if (document.getElementById(cid).value < 1) {
        alert('Quantity Must Be Greater Then Zero.');
        cid.focus();
        return false;
    }

    if (!isInt(document.getElementById(cid).value)) {
        alert('Please enter Integer value.');
        cid.focus();
        return false;
    }

    if (document.getElementById(cid).value > strstock) {
        alert('Only ' + strstock + ' of this product in stock');
        return false;
    }
    addtocartOther(PId, ddlval, document.getElementById(cid).value, document.getElementById(cid));
    return false;
}



//function reloadCart() {
//    var trigger = $('.trigger', this);
//    var height = $('#popuup_div').height();
//    var width = $('#popuup_div').width();
//    leftVal = 890 - (width / 2) + "px";
//    topVal = 230 - (height / 2) + "px";
//    $('#popuup_div').css({ left: leftVal, top: topVal }).show().fadeOut(5000);
//}
function reloadCart(elmid, action, top) {
    var height = $('#' + elmid).height();
    var width = $('#' + elmid).width();
    leftVal = 600 + "px";
    topVal = top + "px";
    $('#' + elmid).css({ left: leftVal, top: topVal }).show().fadeOut(2500);
}


function cartItemCount() {
    var d = new Date()
    $.ajax({
        type: "get",
        url: "getcartitem.ashx?nc=" + Math.floor(Math.random() * 200) + "&dt=" + d.getTime(),
        success: function(response) {
            shoppingBasket(response);
        },
        error: function(response) {
            shoppingBasket(response);
        }
    });
}

//leftcategories.aspx
//tree.js


var CatArray = new Array();
var temp = new Array();
var flag = "false";

function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}

function setCookie(value) {
    expiredays = 1
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = "ref" + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}

function checkCookie() {

}
//*************************************************
var str = "";
var common = "";
function Toggle(item) {
    obj = document.getElementById(item);
    visible = (obj.style.display != "none")
    key = document.getElementById("x" + item);
    Collapse();
    if (visible) {
        obj.style.display = "none";
    } else {
        obj.style.display = "block";
    }
}

function Expand() {
    divs = document.getElementsByTagName("DIV");
    for (i = 0; i < divs.length; i++) {
        if (divs[i].className == "toggleclass") {
            divs[i].style.display = "block";
        }
    }
}

function Collapse() {
    divs = document.getElementsByTagName("DIV");
    for (i = 0; i < divs.length; i++) {
        if (divs[i].className == "toggleclass") {
            divs[i].style.display = "none";
        }
    }
}

function getValue(varname) {
    var url = window.location.href;

    var qparts = url.split("?");

    if (qparts.length == 0) {
        return "";
    }

    var query = qparts[1];
    var vars = query.split("&");
    var value = "";
    for (i = 0; i < vars.length; i++) {
        var parts = vars[i].split("=");
        if (parts[0] == varname) {
            value = parts[1];
            break;
        }
    }

    value = unescape(value);
    value.replace(/\+/g, " ");
    return parts[1];
}

////leftcategories.aspx on page

function Openvideo() {
    var win = window.open('SimplyliteVideo.aspx', null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=480,height=395,top=10,left=10', 'true');
    //win.focus();
    return false
}
//lifestyleimage.aspx on page

//---To resize window automatically 
function resizeMe(imgObj) {
    hbuff = 90
    wbuff = 30
    if (typeof (imgObj) != "undefined") {
        nheight = imgObj.height
        nwidth = imgObj.width
        if (nheight > 0 && nwidth > 0) {
            maxhth = screen.availHeight
            maxwdh = screen.availWidth
            //status = maxhth + " , " + maxwdh
            if (nwidth >= maxwdh - wbuff) {
                nwidth = maxwdh - (wbuff + 10)
            }
            if (nheight >= maxhth - hbuff) {
                nheight = maxhth - (hbuff + 10)
            }
            resizeTo(nwidth + wbuff, nheight + hbuff)
            midx = (maxwdh / 2) - ((nwidth + wbuff) / 2)
            moveTo(midx, 0)
            focus()
        }
    }
}


//mailafriend.aspx onpage.. on page...

function check_field1() {
    if (emptyField(document.getElementById("txtEmailId"))) {
        alert('Please Enter Email id of Recipient');
        document.getElementById("txtEmailId").focus();
        return false;
    }
    if (!validEmailId(document.getElementById("txtEmailId").value)) {
        alert('Please Enter Valid Email id of Recipient.');
        document.getElementById("txtEmailId").focus();
        return false;
    }

    if (emptyField(document.getElementById("txtyouremail"))) {
        alert('Please Enter Your Email id');
        document.getElementById("txtyouremail").focus();
        return false;
    }
    if (!validEmailId(document.getElementById("txtyouremail").value)) {
        alert('Please Enter Valid Your Email id.');
        document.getElementById("txtyouremail").focus();
        return false;
    }
    if (emptyField(document.getElementById("txtmessage"))) {
        alert('Please Enter Your Message');
        document.getElementById("txtmessage").focus();
        return false;
    }

}


//orderdetail.aspx on page...

function print_page() {
    document.getElementById("trbutton").style.visibility = "hidden";
    var win = window.print();
    setTimeout(get_visibility, 1000);
    return false;
}
function get_visibility() {
    document.getElementById("trbutton").style.visibility = "";
}
function close_win() {
    var win = window.close('Print_Resi_Info.aspx');
    return false;
}


//orderhistory.aspx on page.


function win_open(OrderId, gid) {
    window.open("PrintInvoice.aspx?OrderId=" + OrderId + "&gid=" + gid, "mywindow", "scrollbars=1,toolbar=0,directories=0,location=0,resizable=1,width=700,height=600");
    return;
}

function go_back() {
    window.location = "MyAccount.aspx";
}

//outofstock.aspx on page...


function Validuser() {

    if (emptyField(document.getElementById("txtName"))) {
        alert("Enter your Name");
        document.getElementById("txtName").focus();
        return false;
    }

    if (emptyField(document.getElementById("txtEmail"))) {
        alert("Enter your Email Address");
        document.getElementById("txtEmail").focus();
        return false;
    }

    arg = document.getElementById("txtEmail").value;
    flag = check_email(arg);
    if (flag == 0) {
        alert('Enter valid e-mail address.');
        document.getElementById("txtEmail").focus();
        return false;
    }
}

function Validuser1() {

    if (emptyField(document.getElementById("txtName"))) {
        alert("Enter your Name");
        document.getElementById("txtName").focus();
        return false;
    }

    if (emptyField(document.getElementById("txtEmail"))) {
        alert("Enter your Email Address");
        document.getElementById("txtEmail").focus();
        return false;
    }

    arg = document.getElementById("txtEmail").value;
    flag = check_email(arg);
    if (flag == 0) {
        alert('Enter valid e-mail address.');
        document.getElementById("txtEmail").focus();
        return false;
    }

    if (document.getElementById("CheckBox1").checked == false) {
        alert('Please Select the box')
        return false;
    }
}


//press.aspx on page


//--open video
function openvideo(id) {
    var win = window.open('lifestyleimage.aspx?msg=video&id=' + id, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=417,top=10,left=10', 'true');
    win.focus();
    return false
}


//printInvoice.aspx on page...

function print_page() {
    document.getElementById("trbutton").style.visibility = "hidden";
    var win = window.print();
    setTimeout(get_visibility, 1000);
    return false;
}
function get_visibility() {
    document.getElementById("trbutton").style.visibility = "";
}
function close_win() {
    var win = window.close('Print_Resi_Info.aspx');
    document.getElementById("trbutton").style.display = "block";
    return false;
}


//registration.aspx
//register.js


function valid_admin() {


    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtFname"))) {
        alert('Please Enter Name');
        document.getElementById("ctl00_ContentPlaceHolder1_txtFname").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtAddr1"))) {
        alert('Please enter Address');
        document.getElementById("ctl00_ContentPlaceHolder1_txtAddr1").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtCity"))) {
        alert('Please enter City');
        document.getElementById("ctl00_ContentPlaceHolder1_txtCity").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtState"))) {
        alert('Please enter State');
        document.getElementById("ctl00_ContentPlaceHolder1_txtState").focus();
        return false;
    }

    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry").value == 0) {
        alert('Please Select Country.');
        document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtPost"))) {
        alert('Please enter PostCode');
        document.getElementById("ctl00_ContentPlaceHolder1_txtPost").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtPhone"))) {
        alert('Please enter PhoneNo');
        document.getElementById("ctl00_ContentPlaceHolder1_txtPhone").focus();
        return false;
    }


    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail"))) {
        alert('Please enter Email');
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }

    if (!validEmailId(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value)) {
        alert('Please enter Valid EmailId.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtpass"))) {
        alert('Please Enter Password');
        document.getElementById("ctl00_ContentPlaceHolder1_txtpass").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtCpass"))) {
        alert('Please Enter Confirm Password.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtCpass").focus();
        return false;
    }

    if (document.getElementById("ctl00_ContentPlaceHolder1_txtpass").value != document.getElementById("ctl00_ContentPlaceHolder1_txtCpass").value) {
        alert("Password and Confirm Password Must Be Same");
        document.getElementById("ctl00_ContentPlaceHolder1_txtpass").focus();
        return false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlhear").value == 0) {
        alert('Please Select from list where did you hear about us.');
        document.getElementById("ctl00_ContentPlaceHolder1_ddlhear").focus();
        return false;
    }

    if (document.getElementById("ctl00_ContentPlaceHolder1_chkterms").checked == false) {
        alert('Please accept terms & conditions.');
        document.getElementById("ctl00_ContentPlaceHolder1_chkterms").focus();
        return false;
    }
}

function ShowddlOthertext() {
    if (document.getElementById("ddlhear").value == 8) { document.getElementById("txthear").style.display = "block"; }
    else { document.getElementById("txthear").style.display = "none"; document.getElementById("txthear").value = ""; }
}
function oprntrems() {
    var win = window.open('Termsnconditions.aspx', null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=650,height=400,top=10,left=10', 'true');
    win.focus();
    return false;
}


//subcateogry.aspx on page

function drptoggle() {
    Toggle(document.getElementById("ddlsubcat").value)
}


//thanks.aspx on page.

function win_open(OrderId) {
    window.open("PrintInvoice.aspx?OrderId=" + OrderId, "mywindow", "scrollbars=1,toolbar=0,directories=0,location=0,resizable=1,width=700,height=600");
}

//tradeinquiries.aspx

function valid_Inquiry() {
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtCompany"))) {
        alert('Please enter Company Name');
        document.getElementById("ctl00_ContentPlaceHolder1_txtCompany").focus();

        return false;
    }

    if (document.getElementById("ctl00_ContentPlaceHolder1_txtCompany").value.length < 4) {
        alert('Please enter minimum 4 Character in Company Name');
        document.getElementById("ctl00_ContentPlaceHolder1_txtCompany").focus();

        return false;
    }


    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtAddr1"))) {
        alert('Please enter Address');
        document.getElementById("ctl00_ContentPlaceHolder1_txtAddr1").focus();
        return false;
    }


    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry").value == 0) {
        alert('Please Select Country.');
        document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtState"))) {
        alert('Please enter State');
        document.getElementById("ctl00_ContentPlaceHolder1_txtState").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtCity"))) {
        alert('Please enter City');
        document.getElementById("ctl00_ContentPlaceHolder1_txtCity").focus();
        return false;
    }

    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtPost"))) {
        alert('Please enter PostCode');
        document.getElementById("ctl00_ContentPlaceHolder1_txtPost").focus();
        return false;
    }
    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtPhone"))) {
        alert('Please enter PhoneNo');
        document.getElementById("ctl00_ContentPlaceHolder1_txtPhone").focus();
        return false;
    }


    if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail"))) {
        alert('Please enter Email');
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }
    if (!validEmailId(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value)) {
        alert('Please enter Valid EmailId.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
        return false;
    }
}


//visitedproducts.aspx
function OutofStock1(PId) {
    var win = window.open('OutOfStock.aspx?chk=chk&PID=' + PId, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=220,top=10,left=10', 'true');
    win.focus();
    return false
}

function ViewCart(PId, ddlval, qty, cid, strstock) {
    var count = 0;
    if (emptyField(cid)) {
        alert('Please Enter Quantity');
        cid.focus();
        return false;
    }

    if (cid.value < 1) {
        alert('Quantity Must Be Greater Then Zero.');
        cid.focus();
        return false;
    }

    if (!isInt(cid.value)) {
        alert('Please enter Integer value.');
        cid.focus();
        return false;
    }

    if (cid.value > strstock) {
        alert('Only ' + strstock + ' products in stock');
        return false;
    }
}

function StockAlert(stockcount) {
    alert('Only ' + stockcount + ' products in stock');
    return false;
}

function chkHeight() {
    return document.getElementById("form1").offsetHeight;
}
function chkHeight1() {
    return document.getElementById("Form11").offsetHeight;
}
function getTop() {
    var win = self.top;
    win.scrollTo(0, 0);
}
function callpage(refurl) {
    getTop();
    window.location = refurl;
}

function openwindow1(pagename) {
    var win;
    win = window.open(pagename + '.aspx', null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=500,height=190,top=10,left=10', 'true'); 
    win.focus();
    return false;
}
