
var moz = (typeof document.implementation != 'undefined') && (typeof 
document.implementation.createDocument != 'undefined');

var ie = (typeof window.ActiveXObject != 'undefined');
var ItemDetailUrl = "/popups/viewdetail.aspx?StockCode=";


var groupauctioncode = '';
var groupauctionsku = '';
var tempcounter = 1;

//Added by Paramveer Singh on 27 Feb 2011 to redirect login page

//var BidItemUrl = "/confirmbid.aspx?AuctionCode=";

var LiveTVBidItemUrl = "/ConfirmLiveTvBid.aspx?AuctionCode=";

var stockcode;
var AuctionsRequest;
//Added by ashish bansal on 26-october to redirect login page
var loginUrl = '/TJC_NewLogin.aspx?popup=3';
var AmmoliteloginUrl = '/TJC_NewLogin.aspx?popup=5';


function setAuctionsRequest() {

    /*Avinash Sharma load last selected value of group auction when user click on login to bid button */
    var url = document.referrer;
    var startIndexOf = url.lastIndexOf('/');
    var lastIndexOf = url.indexOf('?');

    if ((url.substring(startIndexOf + 1, lastIndexOf) == "TJC_NewLogin.aspx" || url.substring(startIndexOf + 1, lastIndexOf) == "RegisterNewCustomer.aspx") && tempcounter == 1) {

        
        if (getCookie("GroupAuctionCode") != null && getCookie("GroupAuctionCode") != '') {
            groupauctioncode = getCookie("GroupAuctionCode").split(',');
        }
    }

    try {

        AuctionsRequest = new createRequest();
        if (AuctionsRequest) {

            if (groupauctioncode == '') {
                var url = "/codehouse_auctionhandler.ashx?command=1&timestamp=" + new Date().getTime();
                AuctionsRequest.open("GET", url, true);
                AuctionsRequest.onreadystatechange = function() { manageAuctionstatechange(AuctionsRequest); };
                AuctionsRequest.send("");


            }
            else {
                var url = "/codehouse_auctionhandler.ashx?auctioncode=" + groupauctioncode + "&command=1&timestamp=" + new Date().getTime();
                AuctionsRequest.open("GET", url, true);
                AuctionsRequest.onreadystatechange = function() { manageAuctionstatechange(AuctionsRequest); };
                AuctionsRequest.send("");
            }
        }
    }
    catch (ie6fail) {


        AuctionsRequest = new ActiveXObject("Microsoft.XMLHTTP");
        if (AuctionsRequest) {

            if (groupauctioncode == '') {
                var url = "/codehouse_auctionhandler.ashx?command=1&timestamp=" + new Date().getTime();
                AuctionsRequest.open("GET", url, true);
                AuctionsRequest.onreadystatechange = function() { manageAuctionstatechange(AuctionsRequest); };
                AuctionsRequest.send("");
            }
            else {
                var url = "/codehouse_auctionhandler.ashx?auctioncode=" + groupauctioncode + "&command=1&timestamp=" + new Date().getTime();
                AuctionsRequest.open("GET", url, true);
                AuctionsRequest.onreadystatechange = function() { manageAuctionstatechange(AuctionsRequest); };
                AuctionsRequest.send("");
            }

        }
    }
}

function manageAuctionstatechange() {
    try {
        switch (AuctionsRequest.readyState) {
            case 4:
                if (AuctionsRequest.responseXML) {
                    setLiveAuction(AuctionsRequest.responseXML);
                    break;
                }
        }
    }
    catch (e) {
        //alert(e);  
    }
}

function setLiveAuction(response) {

    var auction
    if (response && response.documentElement) {
        document.getElementById("lblNoAuction").style.display = 'none';
        try {

            auction = new LiveAuction(response.documentElement);
        }
        catch (e) {


            noAuction();
        }
        if (auction) {

            // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

            //if (document.getElementById("liveAuctionDescription") && document.getElementById("price") && document.getElementById("qty") && document.getElementById("image") && document.getElementById("startprice")) {
            //
            if (document.getElementById("liveAuctionDescription") && document.getElementById("price") && document.getElementById("image")) {


                document.getElementById("liveAuctionDescription").innerHTML = auction.description;
                document.getElementById("price").innerHTML = auction.currentPrice;
                //document.getElementById("qty").innerHTML = auction.stockRemaining;
                //document.getElementById("hdnStockCode").innerHTML = "ItemCode: " + auction.stockCode;
                document.getElementById("hdnStockCode").innerHTML = auction.stockCode;
                document.getElementById("hdnStockCode").style.visibility = 'visible';
                document.getElementById("image").src = auction.imageName;
                document.getElementById("image").alt = auction.description;
                document.getElementById("image").style.visibility = 'visible';
                document.getElementById("viewDetailButton").style.visibility = 'visible';

                // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

                //document.getElementById("startprice").innerHTML = auction.startPrice;
                //document.getElementById("lblStartPrice").style.visibility = 'visible';
                //document.getElementById("lblStartPriceCurrency").style.visibility = 'visible';

                document.getElementById("lblCurrentPrice").style.visibility = 'visible';
                document.getElementById("live_current_Price").style.display = 'block';

                document.getElementById("lblCurrentPriceCurrency").style.visibility = 'visible';
                document.getElementById("lblQuantity").style.visibility = 'visible';
                document.getElementById("image").style.visibility = 'visible';
                document.getElementById("lblNoAuction").style.visibility = 'hidden';

                //document.getElementById("viewDetail").href = ItemDetailUrl + auction.stockCode;

                document.getElementById("imageLink").href = ItemDetailUrl + auction.stockCode;
                /*************************************Group Auction******************************************
                'Module Name  :  Group Auction  
                'Purpose	   :                               
                'ITS Issue No :
                'Created By   : Avinash Sharma
                'Created On   : 31-March-2011
                *********************************************************************************************/
                document.getElementById("divgroupauction").style.display = 'none';

                var previousvalue = document.getElementById("ddlsize").value;



                var url = document.referrer;
                var startIndexOf = url.lastIndexOf('/');
                var lastIndexOf = url.indexOf('?');

                if ((url.substring(startIndexOf + 1, lastIndexOf) == "TJC_NewLogin.aspx" || url.substring(startIndexOf + 1, lastIndexOf) == "RegisterNewCustomer.aspx") && tempcounter == 1) {


                    previousvalue = groupauctioncode = getCookie("GroupAuctionCode").split(',');
                    tempcounter = 0;


                }


                if (groupauctioncode == '') {

                    previousvalue = '';

                }

                RemoveDrpItem();

                //                if (auction.IsGroupAuction == 'false') {
                //                    $('#LiveTVbidItem').attr({
                var sPath = window.location.pathname;
                var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

                if (auction.IsGroupAuction == 'false' && sPage == "LiveTVPopup.aspx") {
                    $('#LiveTVbidItem').attr({

                        onclick: 'return targetopener(this)',
                        target: 'mainWindow'

                    });
                }

                if (auction.IsGroupAuction == 'false') {
                    document.getElementById("viewDetail").href = ItemDetailUrl + auction.stockCode;
                    document.getElementById("gaavailableoption").style.display = 'none';/*In case group auction is not available */
                }


                if (auction.IsGroupAuction == 'true') {



                    document.getElementById("divgroupauction").style.display = 'block';
                    document.getElementById("gaavailableoption").style.display = 'block'; /*In case group auction is available then display available options div */


                    document.getElementById("lblAvailableGAType").innerHTML = 'Available Options'; //auction.GACategoryName;



                    //                    var opt1 = document.createElement("option");
                    //                    //document.getElementById("ctl17_ctl01_ddlsize").options.add(opt1);        // Assign text and value to Option object
                    //                    document.getElementById("ddlsize").options.add(opt1);        // Assign text and value to Option object                

                    //                    opt1.text = "Size's";
                    //                    opt1.value = "0";

                    for (var i = 0; i < auction.groupsizearray.length; ++i) {

                        var opt = document.createElement("option");
                        //document.getElementById("ctl17_ctl01_ddlsize").options.add(opt);        // Assign text and value to Option object
                        document.getElementById("ddlsize").options.add(opt);        // Assign text and value to Option object

                        opt.innerHTML = auction.groupsizearray[i].split('~@')[0] + "&nbsp;&nbsp;(" + auction.groupsizearray[i].split('~@')[3] + ")  ";
                        // opt.innerHTML = auction.groupsizearray[i].split('~@')[0];
                        opt.value = auction.groupsizearray[i].split('~@')[2];

                        document.getElementById('ddlsize').options[i].title = auction.groupsizearray[i].split('~@')[0] + "(" + auction.groupsizearray[i].split('~@')[3] + ")  ";

                    }


                    if (previousvalue != "" && previousvalue != "0") {

                        document.getElementById("ddlsize").value = previousvalue;
                        var ddlid = document.getElementById("ddlsize");
                        var selectedtext = ddlid.options[ddlid.selectedIndex].text;
                        selectedtext = selectedtext.substring(selectedtext.indexOf('(') + 1, selectedtext.lastIndexOf(')'));

                        document.getElementById("viewDetail").href = ItemDetailUrl + selectedtext;

                    }
                    else {
                        document.getElementById("viewDetail").href = ItemDetailUrl + auction.stockCode;

                    }

                }
               
                // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

                //document.getElementById("lblStockCode").innerHTML = "Item Code";
                //document.getElementById("lblStockCode").style.visibility = 'visible';
                document.getElementById("divLiveDesc").style.display = 'block';
                document.getElementById("divLiveImage").style.display = 'block';
                document.getElementById("divLiveShowDetail").style.display = 'block';

                if (auction.maxWebLimit || (!auction.isLoggedin)) {

                    if (auction.maxWebLimit && auction.isLoggedin) {
                        //document.getElementById("ImgLoginToBid").style.visibility = 'hidden';
                        document.getElementById("cantBidNote").style.display = 'block';
                        document.getElementById("cantBidNote").innerHTML = "Sorry, Web bidding is not available on this item. Please call 0844-375-4444 to bid.";
                        // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

                        //document.getElementById("bidItem").style.visibility = 'hidden';
                        //document.getElementById("bidItem").href = "";
                        document.getElementById("LiveTVbidItem").style.display = 'block';
                        document.getElementById("LiveTVbidItem").href = "";
                        document.getElementById('btn_disply').style.display = 'none';
                        document.getElementById('btn_disply1').style.display = 'none';

                    }
                    else {
                        //document.getElementById("ImgLoginToBid").style.visibility = 'visible';
                        // Added by Paramveer Singh on 27 Feb 2011 for make link to seperate page

                        document.getElementById('btn_disply1').style.display = 'none';
                        document.getElementById('btn_disply').style.display = 'block';
                        document.getElementById("LoginToBid").href = loginUrl;

                        document.getElementById("cantBidNote").style.display = 'none';
                        // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

                        // document.getElementById("cantBidNote").innerHTML = "Please log on to bid.";
                        //document.getElementById("bidItem").style.visibility = 'hidden';
                        //document.getElementById("bidItem").href = "";
                        document.getElementById("LiveTVbidItem").style.display = 'none';
                        document.getElementById("LiveTVbidItem").href = "";
                    }
                }
                else {
                    document.getElementById("ImgLoginToBid").style.display = 'block';
                    document.getElementById('btn_disply').style.display = 'none';
                    document.getElementById('btn_disply1').style.display = 'block';
                    document.getElementById("cantBidNote").style.display = 'none';
                    document.getElementById("cantBidNote").innerHTML = "";
                    // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

                    //document.getElementById("bidItem").style.visibility = 'visible';
                    //document.getElementById("bidItem").href = BidItemUrl + auction.auctionCode;
                    document.getElementById("LiveTVbidItem").style.display = '';

                    // Added by Paramveer Singh on 27 Feb 2011 for new link to confim bid fro Live TV
                    //document.getElementById("LiveTVbidItem").href = LiveTVBidItemUrl + auction.auctionCode;

                    if (auction.IsGroupAuction == 'true') {
                        //document.getElementById("LiveTVbidItem").href = "#";
                       
                        //document.getElementById('LiveTVbidItem').onclick = function anonymous() { validation() };


                        if (groupauctioncode == '') {

                            document.getElementById("LiveTVbidItem").href = LiveTVBidItemUrl + auction.auctionCode;
                        }

                       
                        
                         var url = document.referrer;
                         var startIndexOf = url.lastIndexOf('/');
                         var lastIndexOf = url.indexOf('?');

                         if ((url.substring(startIndexOf + 1, lastIndexOf) == "TJC_NewLogin.aspx" || url.substring(startIndexOf + 1, lastIndexOf) == "RegisterNewCustomer.aspx")) {
                             document.getElementById("LiveTVbidItem").href = LiveTVBidItemUrl + auction.auctionCode;
                             
                            
                            }


                    }
                    else {


                        document.getElementById("LiveTVbidItem").href = LiveTVBidItemUrl + auction.auctionCode;
                    }

                }

                Shadowbox.setup();
                stockcode = auction.stockCode;
            }
        }
    }
    else {
        // TODO: Implement fallback
        noAuction();
    }
}

/*************************************Group Auction******************************************
'Module Name  :  Group Auction  
'Purpose	   :                               
'ITS Issue No :
'Created By   : Avinash Sharma
'Created On   : 31-March-2011
*********************************************************************************************/

function RemoveDrpItem() {
    //ctl06_ddlsize
    // var objDrpList = document.getElementById('ctl17_ctl01_ddlsize');
    var objDrpList = document.getElementById('ddlsize');
    for (i = objDrpList.length - 1; i >= 0; i--) {
        objDrpList.options[i] = null;
    }
}

function noAuction() {

    groupauctioncode = '';
    document.getElementById("lblAvailableGAType").innerHTML = '';
    previousvalue = 0;

    document.getElementById("liveAuctionDescription").innerHTML = "";
    document.getElementById("price").innerHTML = "";
    // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

    //document.getElementById("qty").innerHTML = "";
    //document.getElementById("startprice").innerHTML = "";
    document.getElementById("image").style.visibility = 'hidden';
    document.getElementById("viewDetailButton").style.visibility = 'hidden';
    // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

    //document.getElementById("lblStartPrice").style.visibility = 'hidden';
    //document.getElementById("lblStartPriceCurrency").style.visibility = 'hidden';
    document.getElementById("lblCurrentPrice").style.visibility = 'hidden';
    document.getElementById("lblCurrentPriceCurrency").style.visibility = 'hidden';
    document.getElementById("lblQuantity").style.visibility = 'hidden';
    document.getElementById("image").style.visibility = 'hidden';
    document.getElementById("divLiveDesc").style.display = 'block';
    document.getElementById("divLiveImage").style.display = 'none';
    document.getElementById("cantBidNote").innerHTML = "";
    document.getElementById("divLiveShowDetail").style.display = 'none';
    document.getElementById("lblNoAuction").style.display = 'block';
    document.getElementById("lblNoAuction").style.visibility = 'visible';
    // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

    //document.getElementById("bidItem").style.visibility = 'hidden';
    //document.getElementById("bidItem").href = "";
    document.getElementById("LiveTVbidItem").style.display = 'none';
    document.getElementById("LiveTVbidItem").href = "";
    document.getElementById("hdnStockCode").innerHTML = "";
    document.getElementById("hdnStockCode").style.visibility = 'hidden';
    // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 

    //document.getElementById("lblStockCode").innerHTML = "";
    //document.getElementById("lblStockCode").style.visibility = 'hidden';
    document.getElementById("live_current_Price").style.display = 'none';

    document.getElementById("btn_disply").style.display = 'none';


    document.getElementById("divgroupauction").style.display = 'none';
    document.getElementById("gaavailableoption").style.display = 'none';




}

function itemDetail() {

    try {
        ItemDetailURL = ItemDetailUrl + stockcode;
        if (ItemDetailURL != "")
        //window.open(ItemDetailURL, 'Gemstone', 'LEFT=65,top=110, height=550px, width=1050px,scrollbars=1,menubar=no,toolbars=no,resizable =');

            window.open(ItemDetailURL, 'Gemstone', "menubar=1,resizable=1,width=350,height=250");
    }
    catch (e) {
    }

}


function LiveAuction(xmlElement) {


    var myArray2 = new Array();
    if (moz) {



        this.auctionCode = xmlElement.getElementsByTagName("AuctionCode")[0].firstChild.nodeValue;
        // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 
        //        this.startPrice = xmlElement.getElementsByTagName("StartPrice")[0].firstChild.nodeValue;
        this.currentPrice = xmlElement.getElementsByTagName("CurrentPrice")[0].firstChild.nodeValue;
        this.description = xmlElement.getElementsByTagName("StockDescription")[0].firstChild.nodeValue;
        this.stockRemaining = xmlElement.getElementsByTagName("StockRemaining")[0].firstChild.nodeValue;
        this.bidCount = xmlElement.getElementsByTagName("BidCount")[0].firstChild.nodeValue;
        this.stockCode = xmlElement.getElementsByTagName("StockCode")[0].firstChild.nodeValue;
        this.imageName = xmlElement.getElementsByTagName("ImageName")[0].firstChild.nodeValue;
        this.type = xmlElement.getElementsByTagName("Type")[0].firstChild.nodeValue;



        this.auctionStatus = xmlElement.getElementsByTagName("AuctionStatus")[0].firstChild.nodeValue;
        this.maxWebLimit = (xmlElement.getElementsByTagName("maxWebLimit")[0].firstChild.nodeValue == "true");
        this.isLoggedin = (xmlElement.getElementsByTagName("isLoggedin")[0].firstChild.nodeValue == "true");


        /*************************************Group Auction******************************************
        'Module Name  :  Group Auction  
        'Purpose	  :                               
        'ITS Issue No :
        'Created By   : Avinash Sharma
        'Created On   : 31-March-2011
        *********************************************************************************************/




        this.IsGroupAuction = xmlElement.getElementsByTagName("IsGroupAuction")[0].firstChild.nodeValue;

        if (this.IsGroupAuction == 'true') {


            this.groupsize = xmlElement.getElementsByTagName("GroupItem")[0].firstChild.nodeValue;
            this.groupsizearray = myArray2;



            for (var i = 0; i < xmlElement.getElementsByTagName("GroupItem").length; i++) {


                myArray2[i] = xmlElement.getElementsByTagName("ItemSize")[i].firstChild.nodeValue + '~@' +
                          xmlElement.getElementsByTagName("ItemStockRemaining")[i].firstChild.nodeValue + '~@' +
                          xmlElement.getElementsByTagName("ItemAuctionCode")[i].firstChild.nodeValue + '~@' +
                          xmlElement.getElementsByTagName("ItemStockCode")[i].firstChild.nodeValue;

            }

            this.groupsizearray = myArray2;

        }
        /*Avinash Sharma Group Auction II Phase 3-1-2012*/
        this.GACategoryName = xmlElement.getElementsByTagName("GACategoryName")[0].firstChild.nodeValue;


    }
    if (ie) {
        this.auctionCode = xmlElement.selectSingleNode("TVauction/AuctionCode").text;
        // Commented by Paramveer Singh on 27 Feb 2011 to disable various information as per Live TV new interface 
        //this.startPrice = xmlElement.selectSingleNode("TVauction/StartPrice").text;
        this.currentPrice = xmlElement.selectSingleNode("TVauction/CurrentPrice").text;
        this.description = xmlElement.selectSingleNode("TVauction/StockDescription").text;
        this.stockRemaining = xmlElement.selectSingleNode("TVauction/StockRemaining").text;
        this.bidCount = xmlElement.selectSingleNode("TVauction/BidCount").text;
        this.stockCode = xmlElement.selectSingleNode("TVauction/StockCode").text;
        this.imageName = xmlElement.selectSingleNode("TVauction/ImageName").text;
        this.type = xmlElement.selectSingleNode("TVauction/Type").text;
        this.auctionStatus = xmlElement.selectSingleNode("TVauction/AuctionStatus").text;
        this.maxWebLimit = (xmlElement.selectSingleNode("maxWebLimit").text == "true");
        this.isLoggedin = (xmlElement.selectSingleNode("isLoggedin").text == "true");

        /*************************************Group Auction******************************************
        'Module Name  :  Group Auction  
        'Purpose	  :                               
        'ITS Issue No :
        'Created By   : Avinash Sharma
        'Created On   : 31-March-2011
        *********************************************************************************************/
        this.IsGroupAuction = xmlElement.getElementsByTagName("IsGroupAuction")[0].firstChild.nodeValue;
        this.groupsizearray = myArray2;

        for (var i = 0; i < xmlElement.getElementsByTagName("GroupItem").length; i++) {
            myArray2[i] = xmlElement.getElementsByTagName("ItemSize")[i].firstChild.nodeValue + '~@' +
                          xmlElement.getElementsByTagName("ItemStockRemaining")[i].firstChild.nodeValue + '~@' +
                          xmlElement.getElementsByTagName("ItemAuctionCode")[i].firstChild.nodeValue + '~@' +
                          xmlElement.getElementsByTagName("ItemStockCode")[i].firstChild.nodeValue;
        }

        this.groupsizearray = myArray2;

        /*Avinash Sharma Group Auction II Phase 3-1-2012*/
        this.GACategoryName = xmlElement.selectSingleNode("TVauction/GACategoryName").text;
    }




}

//Added by ashish bansal on 26-oct-2010

function requireCustomerLogin() {
    window.location = loginUrl;
}

function requireCustomerLoginAmmolite() {
    window.location = AmmoliteloginUrl;
}

function setTimers() {
    //2000 ms seems to be a bit too short for the AMS service/auctionhandler to respond before next request
    //window.setInterval("setAuctionsRequest()",2000);     
    window.setInterval("setAuctionsRequest()", 4000);
}

setTimers();


function validation() {

    document.getElementById('divWarning').style.display = "none";
    document.getElementById('divConfirm').style.display = "none";

    if (document.getElementById('ddlsize').value == "0") {

        document.getElementById('divWarning').style.display = "block";
        return;
    }
    document.getElementById('divConfirm').style.display = "block";

    document.getElementById('divff').style.display = "none";
    document.getElementById('divee').style.display = "none";

    document.getElementById('btncancel').onclick = function anonymous() { return hideControl('divConfirm'); };
    if (navigator.appName == "Microsoft Internet Explorer") {
        document.getElementById('divee').style.display = "block";
        document.getElementById('ee').href = LiveTVBidItemUrl + document.getElementById('ddlsize').value;
        document.getElementById('ee').target = 'mainWindow';

    }
    else {
        document.getElementById('divff').style.display = "block";
        document.getElementById('btnconfirm').onclick = function anonymous() { return confirmationforff(document.getElementById('ddlsize').value); };
    }
}
function confirmationforff(auctioncode) {

    if (auctioncode == 0) {
        document.getElementById('divWarning').style.display = "block";
        document.getElementById('divConfirm').style.display = "none";
        return;
    }
    if (window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1) == "LiveTVPopup.aspx") {
        hideControl('divConfirm');
        window.opener.location.href = "/ConfirmLiveTvBid.aspx?AuctionCode=" + auctioncode;
    }
    else {
        window.location = LiveTVBidItemUrl + auctioncode;
    }
}

function checkvalidationforee(auctioncode) {

    if (auctioncode == 0) {
        document.getElementById('divWarning').style.display = "block";
        document.getElementById('divConfirm').style.display = "none";
        document.getElementById('ee').href = '';
        return;
    }
}

function hideControl(controlToHide) {


    var control = document.getElementById(controlToHide);
    control.style.display = "none";

    return true;
}
function GetAuctionCode(id) {

    groupauctioncode = document.getElementById(id).value;
    document.getElementById("LiveTVbidItem").href = LiveTVBidItemUrl + groupauctioncode;

    var ddlid = document.getElementById(id);
    var selectedtext = ddlid.options[ddlid.selectedIndex].text;
    selectedtext = selectedtext.substring(selectedtext.indexOf('(') + 1, selectedtext.lastIndexOf(')'));
    document.getElementById("viewDetail").href = ItemDetailUrl + selectedtext;
    setCookie("GroupAuctionCode", groupauctioncode, 1);
    setAuctionsRequest();
}

function checkurl() {
}



function getCookie(c_name) {
    var i, x, y, ARRcookies = document.cookie.split(";");
    for (i = 0; i < ARRcookies.length; i++) {
        x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
        y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
        x = x.replace(/^\s+|\s+$/g, "");
        if (x == c_name) {
            return unescape(y);
        }
    }
}

function setCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie = c_name + "=" + value;
}



