//alert("Initial Start");
//GLOBAL VARIABLE FOR WORKFLOW PRODUCTS
var ALLOWPAGING = false;
var WORKFLOW_PARENT_PRODUCT = new Array();
var WORKFLOW_PRODUCT = null;
var WORKFLOW_PRODUCT_MANDATORY = 0;
var WORKFLOW_PRODUCT_CURRENT = 0;


var PAGE_SHOPPINGCART = "http://" + window.location.host + "/Shopping/Cart.aspx";
var PAGE_WORKFLOWPRODUCT = "http://" + window.location.host + "/shopping/SystemOrders.aspx";
var PAGE_WORKFLOWORDER = "http://" + window.location.host + "/shopping/SystemOrders.aspx";

var _WorkflowProduct = null;
var _NavigationCommands = null;
var _CurrentWorkflowProduct = null;

var _Workflows = new Array();
var _WorkflowProducts = new Array();
var _WorkflowCounter = 0;
//END GLOBAL VARIABLE FOR WORKFLOW PRODUCTS

var _Domain = "http://" + window.location.host;
var catloadCheckerNew, advertisementCheckerNew, bannerCheckerNew = "Done";
var loadPagesImageNew;
var mainPagePicNew;
var fullDomainNameNew = "";
var CurrentProductID = 0;
var navigateToHomeNew = false;
var topCategoryNew, leftCategoryNew;
var mainscriptCheck;
var mainscript_Load_Caller;
var frameLoading;
var _ProductCommands;
var _SlideShowCommands;
var dom;
var _wizardGlobalChk;
var _relatedresultchk;
var fullScreenIframeSrc;
var catComView = '';
var sldbox = 1;
var horizontalDefaultCat = 1;
var resizeInfiniViewWithResolution = false;
var IpRedirect = false;
fullViewWithURLsNew();
var fullPageWidth = screen.width * 0.95;
var CurrentProductPrice = "0.00";
var timer;
var sliderTimer;
var TimeToWaitForFilesToLoad = 1;
var CycleFileDelay = 20;
var currentImageNo = 0;
var MuteState;
var mute_image = "../images/sound.gif";
var sound_image = "../images/mute.gif";
var CurrentSlideShow = 0;
var product_image = "images/cat_img/new/product.gif";
var simple_image = "images/cat_img/new/convince_simple.gif";
mainscriptCheck = "Loaded";
mainscript_Load_Caller = "loading";
catloadCheckerNew = "Done";
advertisementCheckerNew = "Done";
bannerCheckerNew = "Done";
var ns4 = (document.layers) ? true : false
var ie4 = (document.all) ? true : false
var loadPagesImageNewCenter = "<img src='../images/barpreload.gif' border='0' vAlign='middle' align='center' />";

if (GetUAgent() != "") {
    loadPagesImageNewCenter = "<img src='../images/ProgressBar.gif' border='0' vAlign='middle' align='center' />";
}


var loadPagesImageNewCenterNew = "<img src='../images/ProgressBar.gif' border='0' vAlign='middle' align='center' width='15px' height='15px' />"; // image shows while data loaded
var loadPagesImageNew = "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='LoadingText'></td></tr><tr><td align='center' valign='top'>" + loadPagesImageNewCenter + "</td></tr></table>";
var mainPagePicNew = "../Images_Private/Main_Image/main.html"; // Main default page center picture
var USE_DATABASE_PRODUCTCOMMANDS = false;
var USE_FILESYSTEM_PROUDCTCOMMANDS = true;
var Filetype = "";
var Typestepno = "";
var SharedProdId = "";
var CheckSharedURL = "";
var checkSearchResult = false;

// add by asher 20090120
var RedirectedToWorkflowOrder = null;
var _mainCateId, _mainCatImage;
_mainCatImage = null;
_mainCateId = null;
/**
var isIPhone = navigator.userAgent.indexOf('iPhone');

if (navigator.userAgent.indexOf('MSIEMobile') != -1) {
isIPhone = navigator.userAgent.indexOf('MSIEMobile');
}
if (navigator.userAgent.indexOf('Android') != -1) {
isIPhone = navigator.userAgent.indexOf('Android');
}
**/
var isIPhone = GetUAgent();

var descriptiontext;
var navigatesrc;
var ptype = "";
var CFname = "";
var directSearchProductId = "";
var CouponWindow = false;
var tblDate_bgcolor;


function CheckBrowserNew(chkTOP) {
    //catComView = chkTOP;
    /**
    if(catComView.toLowerCase() == "topper")
    {
    FrameSize('large');
    }
    **/
    if (window.location.search.length > 0 && IpRedirect == false) {
        setTimeout('addJsElementNew()', 1000);
    }
}
function defaultPageBannerVisibleNew() {
    /**
    var screen_height = screen.height;
    var screen_width = screen.width;
    if((screen_width<=800) && (screen_height<=600))
    {
    BottomBannerLoad();
    LeftBannerLoad();
    }
    if((screen_width>800) && (screen_width<=1024) && (screen_height<=768) )
    {
    if(resizeInfiniViewWithResolution == false)
    {
    BottomBannerLoad();
    LeftBannerLoad();
    }
    }
    else if((screen_width>1024)  && (screen_width<=1280) && (screen_height>=720) && (screen_height<960))
    {
    if(resizeInfiniViewWithResolution == false)
    {
    BottomBannerLoad();
    LeftBannerLoad();
    RightBannerLoad();
    }
    }
    else if((screen_width>=1280) && (screen_height>=960))
    {
    if(resizeInfiniViewWithResolution == false)
    {
    BottomBannerLoad();
    LeftBannerLoad();
    RightBannerLoad();
    }
    }
    **/
}
function initnew() {

    if (GetUAgent() == "") {

        if (ns4 || ie4) {
            if (ns4) block = document.dynamic
            if (ie4) block = dynamic.style
            block.x = parseInt(block.left);
        }
    }

    SelectDefaultLanguageNew();
    /**
    if(mainscriptCheck == "Loaded")
    {
    mainscript_Loaded_Caller = "Loaded";
    }
    **/
    var qsVariableName, qsVariableValue;
    var query = location.href;
    query = query.substring(query.indexOf('?') + 1, query.length);
    qsVariableName = query.substring(0, query.indexOf('='))
    qsVariableValue = query.substring(query.indexOf('=') + 1, query.length);
    if ((qsVariableName.toLowerCase()) == "didro") {

        if (document.getElementById("LogoTable")) {
            document.getElementById("LogoTable").style.display = 'none';
        }

        document.getElementById("leftbartable").style.display = 'none';
        SetSourceNew('/shopping/checkout.aspx' + '?OrderID=' + qsVariableValue);
    }
    if (window.location.search.length <= 0 || IpRedirect == true) {
        //SetSourceNew(mainPagePicNew);
    }
    /**
    if(mainscriptCheck == "Loaded" && mainscript_Load_Caller == "loading")
    {
    mainscript_Loaded_Caller = "Loaded";
    }
    **/

}
function CatgeoryMenuSingle() {
    //catComView = chktop;
    CheckMenu();
    if (catComView == "topper") {
        FrameSize('Large');
    }
    //if (window.location.search.length <= 0 || IpRedirect == true || checkSearchResult == true || queryStringNew('noheader').toLowerCase() == "1") {
    if (window.location.search.length <= 0 || IpRedirect == true || checkSearchResult == true || isIPhoneApp() == true || GetUAgent() != "") {
        //SetSourceNew(mainPagePicNew);
        if (catComView == "topper") {
            FrameSize('Large');
            catloadCheckerNew = "Done";
            checkMainInterFaceNew();

        }

        else {
            //document.getElementById("catBall").innerHTML = loadPagesImageNew;
            var req = null;
            req = initXMLHTTPRequestNew();
            if (req) {
                if (GetUAgent() != "") {
                    //Commented by Zeeshan for Mobile application optimization on - 4 oct 2010
                    //req.open("POST", "Catalog/NewCatPageDis.aspx?iphone=true", true);
                    req.open("GET", "Catalog/NewCatPageDis.aspx?iphone=true", true);
                }
                else {
                    //req.open("POST", "Catalog/NewCatPageDis.aspx", true);
                    req.open("GET", "Catalog/NewCatPageDis.aspx", true);
                }
                req.onreadystatechange = function() {
                    var ready = req.readyState;
                    var data = null;
                    if (ready == 4) {
                        if (GetUAgent() != "") {
                            document.getElementById("DIV_LIST").innerHTML = "";
                            // $("#DIV_LIST:hidden").removeAttr('style').hide().fadeIn();
                            document.getElementById("DIV_LIST").innerHTML = req.responseText;
                            document.getElementById("catBall").innerHTML = "";
                            //$("#DIV_LIST:hidden").removeAttr('style').hide().fadeIn();
                            // $("#DIV_LIST").effect('slide', '', 700, '');
                            //$("#MainCatList").overscroll();
                        }
                        else {
                            document.getElementById("DIV_LIST").innerHTML = "";
                            document.getElementById("DIV_LIST").innerHTML = req.responseText;
                            document.getElementById("catBall").innerHTML = "";
                            catloadCheckerNew = "Done";
                            checkMainInterFaceNew();
                            myMainCategoryMovingNew();
                        }

                    }
                    else {
                        //document.getElementById("catBall").innerHTML=loadPagesImageNew;
                    }
                }
                //req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                req.send("");
            }
            if (GetUAgent() == "") {
                SetObjectSizeNew("DIV_LIST", 220, 314);
            }
        }
    }
}

function CatLoadCallerNew() {
    if (!navigateToHomeNew == true) {
        if (window.location.search.length > 0 && IpRedirect == false) {
            var query_new = window.location.search.substring(1);
            var vars = query_new.split("&");
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (pair[0].toLowerCase() == "prourl_id") {
                    //CurrentProductID = pair[1];
                    if (GetUAgent() != "") {
                        HideLogo_wap();
                        iPhoneInifiniView("block", "none");
                    }
                    SharedProdId = pair[1];
                }
                else if (pair[0].toLowerCase() == "type") {
                    Filetype = pair[1];
                }
                else if (pair[0].toLowerCase() == "step") {
                    Typestepno = pair[1];
                }
                else if (pair[0].toLowerCase() == "categoryid") {
                    if (GetUAgent() != "") {
                        iPhoneInifiniView("none", "block");
                    }
                    //Calling Category with new menu 21/12/2010 Usman
                    //DirectCategoryOpen(pair[1]);
                    SetIframeMenuSrc(pair[1]);
                    //End Calling Category with new menu 21/12/2010 Usman
                }
                else if (pair[0].toLowerCase() == "cartid") {
                    if (GetUAgent() != "") {

                        iPhoneInifiniView("block", "none");
                    }
                    HideBottomPagebannersNew();
                    var fullURL = window.location.search;
                    var SubURL = fullURL.substring(fullURL.indexOf('&'), fullURL.length);
                    //alert(SubURL.indexOf('cartid'));
                    if (SubURL.indexOf('cartid') == -1) {
                        var SpUrl = 'http://' + window.location.host + '/Catalog/Questions.aspx?product_id=' + pair[1] + SubURL;
                    }
                    else {
                        var SpUrl = 'http://' + window.location.host + '/Catalog/Questions.aspx?product_id=' + pair[1];
                    }

                    //var SpUrl = 'http://' + window.location.host + '/Catalog/Questions.aspx?product_id=' + pair[1] + SubURL;
                    //					alert(SpUrl);
                    SetSourceNewWithCommands(SpUrl);
                    downslideNew();
                }
                else if (pair[0].toLowerCase() == "navigateto") {

                    HideLogo_wap();
                    if (pair[1].toLowerCase() == "thanks") {
                        //downslideNew();
                        if (GetUAgent() != "") {
                            iPhoneInifiniView("block", "none");
                        }
                        navigatesrc = true;
                        NavigateToThanks();

                    }
                }
                else if (pair[0].toLowerCase() == "description") {
                    if (navigatesrc == true) {
                        NavigateToThanks(pair[1]);
                    }

                }
                else if (pair[0].toLowerCase() == "ptype") {
                    ptype = pair[1];
                }
                else if (pair[0].toLowerCase() == "cfname") {
                    CFname = unescape(pair[1]);

                }
                else if (pair[0].toLowerCase() == "directsearchproductid") {
                    //PCFid = pair[1];
                    CurrentProductID = pair[1];
                    currentRelatedProId = CurrentProductID;
                }
            }
            if (SharedProdId != "") {
                CurrentProductID = SharedProdId;
                var url = "http://" + window.location.host + "/AJAX/WorkFlowCheckSharedURL.aspx?ProID=" + SharedProdId;
                var xmlRequest = DoCallbackNew(url, "")
                if (xmlRequest) {
                    var str = xmlRequest.responseText;
                    if (str.toLowerCase() == 'true') {
                        // changes asghar
                        //var W_URL = "http://" + window.location.host + "/AJAX/WorkflowProduct.aspx" + "?product_id=" + SharedProdId;
                        var W_URL = "http://" + window.location.host + "/shopping/SystemOrders.aspx" + "?product_id=" + SharedProdId;
                        SetSource(W_URL);
                    }
                    else {
                        NavigateToProductFromSupportNew(SharedProdId);
                        myMainCategoryMovingNew();
                        checkMainInterFaceNew();
                    }
                }
            }
            if (CheckEQuotequeryStringNewNew() == true) { return; }
            if (CheckWorkflowQueryStringNew() == true) { return; }
            var urlQuery = window.location.search;
            GlobalMpQuery = urlQuery;
            var MP_Query = queryStringNew("Query")
            if (MP_Query == 'bestoffer') {
                FrameSize('');
                MP_Query = '\BestOffer/Default.aspx' + urlQuery;
                parent.document.getElementById('frame_details').src = MP_Query;
                var MyDiv = document.getElementById('ACTIVECOMMANDS');
                MyDiv.style.visibility = 'visible';
                MyDiv.innerHTML = '<img src=\Images/pro-2-chkout.jpg onClick=MarketPlace_CheckOut("checkout") /> ';
                downslideNew();
            }
            else if (MP_Query == 'imp_cart') {
                FrameSize('');
                var QueryType = queryStringNew("Query");
                var type = queryStringNew("type");
                var mp_id = queryStringNew("mp_id");
                var merchant_product_id = queryStringNew("merchant_product_id");
                var mp_product_id = queryStringNew("mp_product_id");
                var price = queryStringNew("price");
                var Quantity = queryStringNew("Quantity");
                var bidid = queryStringNew("bidid");
                var original_product_id = queryStringNew("original_product_id");
                CurrentProductID = original_product_id;
                CurrentProductPrice = price;
                ShowHideProductCommandsNew('Product', CurrentProductID, window.location.search, CurrentProductID, 'nosearch');
                totalPriceRemoverNew();
                RelatedProductNew(original_product_id);
                downslideNew();
            }
            else if (MP_Query == 'infinioffice') {
                SetSourceNew("Customer/Home.aspx");
                downslideNew();
            }
            else if (MP_Query == 'ebay') {
                SetSourceNew("Ajax/ebay.aspx?eBayLogId=" + queryStringNew("eBayLogID"));
            }
            else if (queryStringNew("qstr") == 'controlledbid') {
                FrameSize('');
                downslideNew();
                RedirectPlaceBidNew();
            }
            else if (queryStringNew("qstr") == 'login') {
                FrameSize('');
                downslideNew();
                var url = "http://" + window.location.host + "/MP_AJAX/displayDescription.aspx" + GlobalMpQuery + "&checkBanner=true&_screen=" + screen.width;
                var xmlRequest = DoCallbackNew(url, "")
                if (xmlRequest) {
                    var str = xmlRequest.responseText;
                    if (str == 'ok') {
                        var merchant_id = queryStringNew("merchant_product_id");
                        src = '../ProductFiles/' + merchant_id + '/1/1/resolution/index.htm';
                        SetSourceNewWithCommands(src);
                    }
                    else {
                        SetSourceNewWithCommands("http://" + window.location.host + "/MP_AJAX/displayDescription.aspx" + GlobalMpQuery);
                    }
                }
                var url = "http://" + window.location.host + "/MP_AJAX/MP_ProductDetails.aspx" + GlobalMpQuery;
                var xmlRequest = DoCallbackNew(url, "")
                if (xmlRequest) {
                    var str = xmlRequest.responseText;
                    var MyDiv = document.getElementById('ACTIVECOMMANDS');
                    MyDiv.style.visibility = 'visible';
                    MyDiv.innerHTML = str;
                }
                else {
                    var MyDiv = document.getElementById('ACTIVECOMMANDS');
                    MyDiv.style.VISIBILITY = 'visible';
                    MyDiv.innerHTML = str;
                }
                document.getElementById("BottomBannerTD").style.display = "none";
            }
            else if (queryStringNew('type') == 'profile') {
                FrameSize('');
                downslideNew();
                ProfileBidNew();
            }
            else if (MP_Query == 'true') {
                FrameSize('');
                downslideNew();
                var src = queryStringNew("productid");
                src = "\ImageHandler.ashx?imp_pid=" + src;
                BestOfferBidNew();
                document.getElementById("BottomBannerTD").style.display = "none";

            }
            else if (MP_Query == 'NavigateToProductFromSupportNew') {
                NavigateToProductFromSupportNew(queryStringNew("productid"));
            }
            else if (MP_Query == 'infinimarket') {
                FrameSize('');
                downslideNew();
                SetSourceNew("Mp_Ajax/Mp_login.aspx?" + window.location.search);
            }
        }
        SearchCompany();
        navigateToHomeNew = false;
    }
}

function defaultPageBannerNew() {
    var screen_height = screen.height;
    var screen_width = screen.width;
    var IFrame = document.getElementById("frame_details");
    var MainTable = document.getElementById("Page_Table");
    if ((screen_width <= 1023) || (screen_height <= 767)) {
        document.getElementById("Banner_left").style.display = "none";
        document.getElementById("Banner_bottom").style.display = "block";
        document.getElementById("Banner_right").style.display = "none";
        document.getElementById("ag").style.verticalAlign = "middle";
        myMainCategoryMovingNew();
    }
    else if ((screen_width <= 1279) || (screen_height <= 1023)) {
        if (resizeInfiniViewWithResolution == false) {
            document.getElementById("Banner_left").style.display = "block";
            document.getElementById("Banner_bottom").style.display = "block";
        } else {
            MainTable.width = fullPageWidth // Returns "972.8" on Resoluation 1024x768;
        }
        document.getElementById("ag").style.verticalAlign = "middle";
        myMainCategoryMovingNew();
    }
    else if ((screen_width >= 1280) || (screen_height >= 1024)) {
        if (resizeInfiniViewWithResolution == false) {
            document.getElementById("Banner_left").style.display = "block";
            document.getElementById("Banner_bottom").style.display = "block";
            document.getElementById("Banner_right").style.display = "block";
        } else {
            MainTable.width = fullPageWidth			///"1200"
            MainTable.height = screen.height * 0.8		// 80% of Screen Resolution
        }
        document.getElementById("ag").style.verticalAlign = "Top";
    }
    bannerCheckerNew = "Done";
    FrameSetDefault();
}
function LoadAdvertisementsNew() {
    document.getElementById("DIV_BOTTOM").innerHTML = loadPagesImageNew;
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("POST", "AJAX/Advertisements.aspx", true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                document.getElementById("DIV_BOTTOM").innerHTML = req.responseText;
                advertisementCheckerNew = "Done";
                checkMainInterFaceNew();
                myMainCategoryMovingNew();
            }
            else {
                document.getElementById("DIV_BOTTOM").innerHTML = loadPagesImageNew;
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function myMainCategoryMovingNew() {


    //var ActiveCommandHTML = document.getElementById("ACTIVECOMMANDS").innerHTML;
    //document.getElementById("ACTIVECOMMANDS").innerHTML = "";
    if (catComView.toLowerCase() == "topper") {
        findPosYNew(document.getElementById("catBallNew"));
        findPosXNew(document.getElementById("catBallNew"));
    }
    else {
        findPosYNew(document.getElementById("catBall"));
        findPosXNew(document.getElementById("catBall"));
    }
    //document.getElementById("ACTIVECOMMANDS").innerHTML = ActiveCommandHTML;	
    document.getElementById("RelatedProductDiv").style.top = topCategoryNew + 10;
    document.getElementById("RelatedProductDiv").style.left = leftCategoryNew + 5;
    document.getElementById("FavouriteProductDiv").style.top = topCategoryNew + 10;
    document.getElementById("FavouriteProductDiv").style.left = leftCategoryNew + 5;
    document.getElementById("leftbartable").style.top = topCategoryNew;
    document.getElementById("leftbartable").style.left = leftCategoryNew;
    document.getElementById("CompareProductDiv").style.top = topCategoryNew + 10;
    document.getElementById("CompareProductDiv").style.left = leftCategoryNew + 5;
}
function renderFavouriteBarNew() {
    var xmlRequest = DoCallbackNew(_Domain + "/AJAX/Favourites.aspx", "");
    document.getElementById("FavouriteProductDiv").innerHTML = "";
    if (xmlRequest.responseText == "Log_error") {
        SetSourceNew("Customer/Home.aspx");
        document.getElementById("FavouriteProductDiv").innerHTML = "<span class='text13'>Your are not logged In</span>";
    }
    else {
        document.getElementById("FavouriteProductDiv").innerHTML = xmlRequest.responseText;
    }
}
function renderHistoryBarNew() {
    var xmlRequest = DoCallbackNew("AJAX/History.aspx", "");
    document.getElementById("HistoryResult").innerHTML = "";
    if (xmlRequest.responseText == "Log_error") {
        document.getElementById("HistoryResult").innerHTML = "<span class='text13'>Your are not logged In</span>";
    }
    else {
        document.getElementById("HistoryResult").innerHTML = xmlRequest.responseText;
    }
}
function chatroomImageShowNew() {
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("POST", "Customer/CustomerChat.aspx", true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                xmlResult = req.responseText;
                if (xmlResult != "notLogged In") {
                }
            }
            else {
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function ContactInfoNew() {
}
function SelectDefaultLanguageNew() {
    if (document.getElementById('select_lang')) {
        var _Host = window.location.hostname;
        var selectLang = document.getElementById('select_lang');
        var s = selectLang.options.length;
        for (s; s >= 1; s--) {
            var Val = selectLang.options[selectLang.options.length - s].value;
            var getHost = Val.split("/");
            for (var i = 0; i <= getHost.length; i++) {
                if (_Host == getHost[i]) {
                    selectLang.options[selectLang.options.length - s].selected = true;
                }
            }
        }
    }
}
function checkMainInterFaceNew() {
    document.getElementById("DIV_LIST").style.visibility = 'hidden';
    if ((catloadCheckerNew == "Done") && (advertisementCheckerNew == "Done") && (bannerCheckerNew == "Done")) {
        if (catComView == "topper") {
            hrMenu_HideAllLayers('level1');
            hrMenu_RootLevel(horizontalDefaultCat, 'hrMenuContainer');
            document.getElementById("DIV_LIST").style.visibility = 'hidden';
        }
        else {
            document.getElementById("DIV_LIST").style.visibility = 'visible';
        }
        if (document.getElementById("ProductSearch1_searchtxt").style.visibilty == "visible") {
            document.getElementById("ProductSearch1_searchtxt").focus();
        }
    }
}
function H_MenuControlHeadingNew(cat) {
    var currentCat;
    currentCat = "?currentCat=" + cat;
    var req = null;
    req = initXMLHTTPRequestNew();
    downLayer = "blank";
    if (req) {
        req.open("POST", "AJAX/h_Cat_main.aspx" + currentCat, true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                document.getElementById("stackText").innerHTML = "";
                document.getElementById("stackText").innerHTML = req.responseText;
                h_InitializeNew();
            }
            else {
                document.getElementById("stackText").innerHTML = loadPagesImageNew;
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function h_InitializeNew() {
    if (dom) {
        layer = document.getElementById("h_contectText").getElementsByTagName("table");
        layer['h_contectFirst'].style.visibility = "visible";
        layer['h_contectFirst'].style.left = 0;
    }
    else if (ns4) {
        layer = "document['h_contectText'].document";
        eval(layer + "['h_contectFirst']" + '.visibility = "visible"');
        eval(layer + "['h_contectFirst']" + '.left = -15');
    }
}
function initXMLHTTPRequestNew() {
    var xRequest = null;
    if (window.XMLHttpRequest) {
        xRequest = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        xRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return xRequest;
}
function spaceRow() {
}
function SetSourceNew(src) {
  
    
    
    
    /*getIPhoneIViewForNew("SetSourceNew");
    try {
    RestoreScreenWindow(src);
    parent.RestoreScreenWindow(src); 
    }
    catch (e) {
    }

    if (window.frames["frame_details"] != undefined) {
    var catURLForFullView = CateFilesWithResoltuionNew(src)
    if (resizeInfiniViewWithResolution == true) {
    window.frames["frame_details"].location.replace(catURLForFullView);
    } else {
    window.frames["frame_details"].location.replace(src);
    }
    UnLoadCommandsNew();
    }
    else {
    this.location.href = src;
    }*/
    /*$(document).ready(
        function() {
    $('iframe#frame_details').attr('src', src);
        }
     );/*/

    if (window.frames["frame_details"] != undefined) {
        window.frames["frame_details"].location.replace(src);

    } else {
        this.location.href = src;
    }

    
}
function downslideNew() {
    topLayerHideNew();
    document.getElementById("DIV_LIST").style.display = 'none';
    if (ns4 || ie4) {
        if (block.x < 205) {
            block.x += 10
            block.left = block.x
            setTimeout("downslideNew()", 6)
        }
        else {
            combNew('textbarcol', 'textbarcol2')
        }
    }
}
function RelatedProductNew(CurrentproId) {

    document.getElementById("FavouriteProductDiv").style.display = "none";
    document.getElementById("HistoryProductDiv").style.display = "none";
    currentRelatedProId = CurrentproId;
    var params;
    params = "?CurrentProId=" + CurrentproId;
    document.getElementById("RelatedProductDiv").innerHTML = frameLoading;
    var _RelatedResult;
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("GET", _Domain + "/AJAX/RelatedProduct.aspx" + params, true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                xmlResult = req.responseText;
                if (xmlResult == "No Data") {
                    _RelatedResult = xmlResult;
                    document.getElementById("RelatedProductDiv").style.display = 'none';
                }
                else {
                    document.getElementById("RelatedProductDiv").innerHTML = xmlResult;
                    _resWizardPro = document.getElementById("RelatedProductDiv").innerHTML;
                    initArrowNew('reletedProducts');
                    var lengthArr;
                    lengthArr = document.getElementById("arrayLength").innerText;
                    RelatedProductNewLength = new Array(lengthArr);
                    for (var i = 0; i < lengthArr; i++) {
                        if (document.getElementById("RelatedCheckBox" + i) != null) {
                            if (document.getElementById("RelatedCheckBox" + i).checked == true) {
                                RelatedProductNewLength[i] = document.getElementById("RelatedCheckBox" + i).value;
                            }
                            else {
                                RelatedProductNewLength[i] = null;
                            }
                        }
                    }
                }
                chkWizard4_RelatedNew(params, _RelatedResult);
            }
            else {
                document.getElementById("RelatedProductDiv").innerHTML = frameLoading;
            }
        }
        // req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function initArrowNew(layerId) {
    try {
        var tablename;
        if (layerId == "content") {
            tablename = "first";
        }
        else if (layerId == "contentTop") {
            tablename = "SecondTop";
        }
        else if (layerId == "reletedProducts") {
            tablename = "relpro";
        }
        else if (layerId == "searchRes") {
            tablename = "srchres";
        }
        else if (layerId == "MainCatTop") {
            tablename = "maincatcontain";
        }
        else if (layerId == "FavProducts") {
            tablename = "FavPro";
        }
        else if (layerId == "HistoryProducts") {
            tablename = "HistoryPro";
        }
        if (dom) {
            if (tablename == "first") {
                layer = document.getElementById(layerId).getElementsByTagName("table");
                layer[tablename].style.visibility = "visible";
                layer[tablename].style.top = 0;
            }
            else if (tablename == "srchres") {
                try {
                    layer = document.getElementById(layerId).getElementsByTagName("table");
                    layer[tablename].style.visibility = "visible";
                    layer[tablename].style.top = 0;
                }
                catch (ex) { }
            }
            else if (tablename == "FavPro") {
                try {
                    layer = document.getElementById(layerId).getElementsByTagName("table");
                    layer[tablename].style.visibility = "visible";
                    layer[tablename].style.top = 0;
                }
                catch (ex) { }
            }
            else if (tablename == "HistoryPro") {
                try {
                    layer = document.getElementById(layerId).getElementsByTagName("table");
                    layer[tablename].style.visibility = "visible";
                    layer[tablename].style.top = 0;
                }
                catch (ex) { }
            }
            else if (tablename == "relpro") {
                layer = document.getElementById(layerId).getElementsByTagName("table");
                layer[tablename].style.visibility = "visible";
                layer[tablename].style.top = 0;
            }
            else if (tablename == "maincatcontain") {
                layer = document.getElementById(layerId).getElementsByTagName("table");
                layer[tablename].style.visibility = "visible";
                layer[tablename].style.top = 0;
            }
        }
        else if (ns4) {
            layer = "document['content'].document";
            eval(layer + "[tablename]" + '.visibility = "visible"');
            eval(layer + "[tablename]" + '.top = -15');
        }
    }
    catch (err) {
        //alert("error in initPro Function" + err.description);
    }
}
function SetObjectSizeNew(object, width, height) {
    //document.getElementById(object).style.width = width;
    //document.getElementById(object).style.height = height;
    // iPhone Change
    if (GetUAgent() == "") {
        document.getElementById(object).style.width = getDynamicTransformNew("SetObjectSizeNew", width, height)['width'];
        document.getElementById(object).style.height = getDynamicTransformNew("SetObjectSizeNew", width, height)['height'];
    }

}
function CheckEQuotequeryStringNewNew() {
    var Customer = queryStringNew("customer");
    var Product = queryStringNew("product");
    var Action = queryStringNew("action");
    if (Customer != "false" && Product != "false" && Action != "false") {
        var request = new XMLHttpRequest();
        if (request) {
            request.onreadystatechange = function() {
                if (request.readyState == 4) {
                    document.getElementById("DIV_LIST").innerHTML = request.responseText;
                    document.getElementById("DIV_LIST").style.visibility = 'visible';
                    SetObjectSize("DIV_LIST", 226, 100);
                    initArrow('searchRes');
                    topLayerShowNew();
                    CurrentProductID = Product;
                    DisplayEQuoteProduct(CurrentProductID);
                }
            }
            request.open('POST', EQuotePage + "?customer=" + Customer + "&product=" + Product + "&action=" + Action);
            request.send("");
        }
        return true;
    }
    else {
        return false;
    }
}
function queryStringNew(key) {
    var page = new PageQueryNew(window.location.search);
    return unescape(page.getValue(key));
}
function ShowHideProductCommandsNew(type, params, queryString, ProdId, proType) {
    //FrameSize('');
    relatedPro_ParentID = ProdId;
    if (type == "Category") {
        UnLoadCommandsNew();
        var xmlRequest = DoCallbackNew("Catalog/DisplayWithDetails.aspx", params);
        document.getElementById("DIV_LIST").innerHTML = xmlRequest.responseText;
    }
    if (type == "Product") {
        ProAlert = 1;
        FavproductId = ProdId;
        FavProType = "true"
        CurrentProductID = params;
        if (proType == "search") {
            LoadProductCommandsNew(queryString);
            productCmdQuerry = queryString;
        }
        else if (proType == "nosearch") {
            productCmdQuerry = queryString;
            LoadProductCommandsNew(queryString);
        }
    }
    HideBottomPagebannersNew();
}
function DoCallbackNew(url, params) {
    var pageUrl = url + params;
    var xmlRequest;
    try {
        xmlRequest = new XMLHttpRequest();
    }
    catch (e) {
        try {
            xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    xmlRequest.open("POST", pageUrl, false);
    xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlRequest.send("");
    return xmlRequest;
}
function UnLoadCommandsNew() {
    parent.removeElement("ACTIVECOMMANDS", "_TabsContainer", "SlidePagingContainer");
    var ACTIVECOMMANDS = GlobalObjectNew("ACTIVECOMMANDS");
    ACTIVECOMMANDS.style.visibility = 'hidden';
    ACTIVECOMMANDS.innerHTML = "";
    if (CurrentProductID != 0) {
        var _document = null;
        try {
            _document = window.frames["frame_ProductFilesFS"].window.document;
            if (_document != null) {
                window.frames["frame_ProductFiles"].MediaFiles = null;
                window.frames["frame_ProductFiles"].AudioFiles = null;
            }
        }
        catch (err) {
        }
    }
    parent.SlideShow_Stop();
}
function LoadProductCommandsNew(QueryString) {
    document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
    document.getElementById("ACTIVECOMMANDS").innerHTML = loadPagesImageNewCenter;
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        if (USE_DATABASE_PRODUCTCOMMANDS) {
            req.open("GET", _Domain + "/AJAX/ProductCommands.aspx" + QueryString, true);
        }
        if (USE_FILESYSTEM_PROUDCTCOMMANDS) {
            //debugger;
            if (WORKFLOW_PRODUCT == true && WORKFLOW_PRODUCT_MANDATORY == 1) {
                if (parseInt(WORKFLOW_PARENT_PRODUCT[WORKFLOW_PARENT_PRODUCT.length - 1]) == WORKFLOW_PRODUCT_CURRENT) {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString() + "&ForceCommands=true";
                }
                else {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString();
                }

                req.open("GET", _Domain + "/AJAX/ProductCommandsFS.aspx" + QueryString, true);
            }
            else if (WORKFLOW_PRODUCT == true && WORKFLOW_PRODUCT_MANDATORY == 0) {
                if (parseInt(WORKFLOW_PARENT_PRODUCT[WORKFLOW_PARENT_PRODUCT.length - 1]) == WORKFLOW_PRODUCT_CURRENT) {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString() + "&ForceCommands=true";
                }
                else {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString();
                }

                req.open("GET", _Domain + "/AJAX/ProductCommandsFS.aspx" + QueryString, true);
            }
            else {
                req.open("GET", _Domain + "/AJAX/ProductCommandsFS.aspx" + QueryString, true);
            }
        }
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                xmlResult = req.responseText;
                document.getElementById("ACTIVECOMMANDS").innerHTML = "";
                document.getElementById("ACTIVECOMMANDS").innerHTML = xmlResult;
                if (USE_DATABASE_PRODUCTCOMMANDS) {
                    CycleFile();
                    LoadSlideShowCommands();
                }
                if (USE_FILESYSTEM_PROUDCTCOMMANDS) {

                    _ProductCommands = new ProductCommands(CurrentProductID);
                    var ProductType = document.getElementById("PRODUCT_TYPE");
                    if (document.getElementById("buybt").innerHTML == "") {
                        downslidetwo();
                    }
                    if (CheckSharedURL == true) {
                        document.getElementById("SharedURLID").innerHTML = "";
                    }
                    if (ProductType != null) {
                        switch (ProductType.innerHTML) {
                            case "NORMAL":
                                //alert(document.getElementById("WizardType").innerHTML);
                                if (document.getElementById("WizardType").innerHTML == "CONFIGURE") {
                                    ProductCommands_FileSystem_Init_Configure();
                                    document.getElementById("PriceRow").style.visibility = 'hidden';

                                }
                                else {
                                    ProductCommands_FileSystem_Init();
                                }

                                //ProductCommands_FileSystem_Init();	
                                break;
                            case "BUYER":
                                ProductCommands_FileSystem_Init_Buyer();
                                break;
                            case "AP":
                                ProductCommands_FileSystem_Init2();
                                break;
                            case "AP_WITHBUY":
                                ProductCommands_FileSystem_Init3();
                                break;
                            case "HR_PRODUCT":
                                /* var ProductCategory = GetQueryStringValue(QueryString,"ProductCategory");
                                if (ProductCategory == "HR_PRODUCT")
                                {
                                ProductCommands_FileSystem_Init4(ProductCategory);	
                                } */
                                var ProductCategory = 'HR_PRODUCT';
                                ProductCommands_FileSystem_Init4(ProductCategory);
                                break;
                            case "WORKFLOW_PRODUCT":
                                ProductCommands_FileSystem_Init5();
                                break;
                        }
                    }
                }
            }
            else {
                //	document.getElementById("ACTIVECOMMANDS").innerHTML=frameLoading;
            }
        }
        //   req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function addJsElementNew() {
    /***var scriptFiles = new Array(0);
   
    if (isIPhone != -1) {
    //scriptFiles[0] = "http://library2.infinishops.com/HttpCombiner.ashx?s=set_js3B&t=type/javascript";
    scriptFiles[0] = "http://library2.infinishops.com/HttpCombiner.ashx?s=set_js12&t=type/javascript";
    scriptFiles[1] = "http://library2.infinishops.com/HttpCombiner.ashx?s=set_js13&t=type/javascript";
    AppAutoLogin();
       
    }
    else {
    scriptFiles[0] = "http://library2.infinishops.com/HttpCombiner.ashx?s=set_js3&t=type/javascript";
    }**/

    var scriptFiles = new Array(23);
    scriptFiles[0] = "http://library.infinishops.com/v2/scripts/BrowserDetect.js";
    scriptFiles[1] = "http://library.infinishops.com/v2/scripts/mainscript.js";
    scriptFiles[2] = "http://library.infinishops.com/v2/scripts/IMP_Script.js";
    scriptFiles[3] = "http://library.infinishops.com/v2/scripts/querystring.js";
    scriptFiles[4] = "http://library.infinishops.com/v2/scripts/ProductCommands_FileSystem/FSCommand.js";
    scriptFiles[5] = "http://library.infinishops.com/v2/scripts/ProductCommands_FileSystem/Common.js";
    scriptFiles[6] = "http://library.infinishops.com/v2/scripts/ProductCommands_FileSystem/ProductCommands.js";
    scriptFiles[7] = "http://library.infinishops.com/v2/scripts/ProductCommands_FileSystem/SlideShowCommands.js";
    scriptFiles[8] = "http://library.infinishops.com/v2/scripts/ProductCommands_FileSystem/Sound.js";
    scriptFiles[9] = "http://library.infinishops.com/v2/scripts/ProductCommands_FileSystem/MediaPlayer.js";
    scriptFiles[10] = "http://library.infinishops.com/v2/scripts/ProductCommands_FileSystem/AudioPlayer.js";
    scriptFiles[11] = "http://library.infinishops.com/v2/scripts/QuestionAnswers/Common.js";
    //scriptFiles[12] = "http://library.infinishops.com/v1/scripts/IMP_AdvProducts.js";
    scriptFiles[13] = "http://library.infinishops.com/v2/scripts/sarissa/sarissa.js";
    scriptFiles[14] = "http://library.infinishops.com/v2/scripts/jsXMLParser/xmlsax.js";
    scriptFiles[15] = "http://library.infinishops.com/v2/scripts/jsXMLParser/xmlw3cdom.js";
    scriptFiles[16] = "http://library.infinishops.com/v2/scripts/com/ProductSlideShow.js";
    scriptFiles[17] = "http://library.infinishops.com/v2/scripts/WorkflowProducts/Workflow_Common.js";
    scriptFiles[18] = "http://library.infinishops.com/v2/scripts/WorkflowProducts/Workflow.js";
    scriptFiles[19] = "http://library.infinishops.com/v2/scripts/WorkflowProducts/WorkflowProduct.js";
    scriptFiles[20] = "http://library.infinishops.com/v2/scripts/WorkflowProducts/NavigationCommands.js";
    scriptFiles[21] = "http://library.infinishops.com/v2/scripts/QuestionAnswers/CompanyFormation.js";
    scriptFiles[22] = "http://library.infinishops.com/v2/scripts/WorkflowProducts/ShoppingCart.js";

    var scrptLoop;
    for (scrptLoop = 0; scrptLoop < scriptFiles.length; scrptLoop++) {
        var headID = document.getElementsByTagName("head")[0];
        var newScript = document.createElement("script");
        newScript.type = 'text/javascript';
        newScript.src = scriptFiles[scrptLoop];
        headID.appendChild(newScript);
    }

    if (GetUAgent() == '') {
        var css = document.createElement("link");
        css.setAttribute("href", "../stylesheet/mainstyle.css");
        css.setAttribute("rel", "stylesheet");
        css.setAttribute("type", "text/css");
        document.getElementsByTagName("HEAD")[0].appendChild(css);
    }
    /**
    var css2 = document.createElement("link");
    css2.setAttribute("href","../stylesheet/WorkflowProduct.css");
    css2.setAttribute("rel","stylesheet");
    css2.setAttribute("type","text/css");
    document.getElementsByTagName("HEAD")[0].appendChild(css2);


var css3 = document.createElement("link");
    css3.setAttribute("href","../stylesheet/wap_mainstyle.css");
    css3.setAttribute("rel","stylesheet");
    css3.setAttribute("type","text/css");
    document.getElementsByTagName("HEAD")[0].appendChild(css3);
    **/

}
function findPosXNew(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curleft += obj.offsetLeft
            obj = obj.offsetParent;
        }
    }
    else if (obj.x)
        curleft += obj.x;
    leftCategoryNew = curleft;
    return curleft;
}
function findPosYNew(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curtop += obj.offsetTop
            obj = obj.offsetParent;
        }
    }
    else if (obj.y)
        curtop += obj.y;
    topCategoryNew = curtop;
    return curtop;
}
function GetDocumentTitleNew() {
    var domain = document.domain;
    var words = domain.split('.');
    var result = "::.. Welcome to " + words[1] + " ..::";
    return result;
}
function setDocumentDomainNew() {
    if (fullDomainNameNew == "") {
        fullDomainNameNew = document.domain;
    }
    var domain = document.domain;
    document.domain = domain.substring(domain.indexOf('.') + 1);
    setCookie();
}
function CateFilesWithResoltuionNew(src) {
    var splitSrc, fileName, newPattren, newCatURL, getResoluation;
    getResoluation = ValidResoltuionNew()
    if ((resizeInfiniViewWithResolution == true) && (src.match(".aspx") == null)) {
        splitSrc = src.split("/");
        fileName = splitSrc[splitSrc.length - 1];
        newPattren = getResoluation + "/" + fileName;
        newCatURL = src.replace(fileName, newPattren);
        return newCatURL;
    }
    splitSrc = src.split("/");
    fileName = splitSrc[this.length + 1];
    newPattren = getResoluation + "/" + fileName;
    newCatURL = src.replace(fileName, newPattren);
    return newCatURL;
}
function isIPhoneBrowser() {
    if (navigator.userAgent.indexOf('iPhone') != -1) {
        return true;
    }
    else {
        return false;
    }
}
function ValidResoltuionNew() {
    if (GetUAgent() != "") {
        return "250x250";
    }
    else {
        if (catComView.toLowerCase() == "topper") {
            return "855x475";
        }
        else {
            if ((screen.width <= 1023) || (screen.height <= 767)) { return "800x600"; }
            else if ((screen.width <= 1279) || (screen.height <= 1023)) { return "1024x768"; }
            else { return "1280x1024"; }
        }
    }
}

function GetBrowserIndependentElementNew(element) {
    if (document.getElementById) {
        return document.getElementById(element);
    }
    else if (document.getElementsByName) {
        return document.getElementsByName(element);
    }
    else if (document.layers) {
        return document.layers[element];
    }
    else if (document.all) {
        return document.all[element];
    }
}
function downslidetwoNew() {
    //    document.getElementById("DIV_LIST").style.display = 'block'; 		// New Updation for product
    //    if (sldbox == 1) {
    //        if (ns4 || ie4) {
    //            if (block.x > 1) {
    //                document.getElementById('textbarcol2').style.display = 'none';
    //                block.x -= 10
    //                block.left = block.x
    //                setTimeout("downslidetwo()", 6)
    //            }
    //            else {
    //            }
    //        }
    //    }
    //    else if (sldbox == 2) {
    //        topLayerShowNew();
    //        if (ns4 || ie4) {
    //            if (block.x > 1) {
    //                document.getElementById('textbarcol2').style.display = 'none';
    //                block.x -= 10
    //                block.left = block.x
    //                setTimeout("downslidetwo()", 6)
    //            }
    //            else {
    //            }
    //        }
    //    }
}
function topLayerShowNew() {
    if (document.getElementById("topLink").style.visibility == "visible") {
        return;
    }
    else {
        document.getElementById("topLink").style.visibility = "visible";
    }
}
function PageQueryNew(q) {
    if (q.length > 1) this.q = q.substring(1, q.length);
    else this.q = null;
    this.keyValuePairs = new Array();
    if (q) {
        for (var i = 0; i < this.q.split("&").length; i++) {
            this.keyValuePairs[i] = this.q.split("&")[i];
        }
    }
    this.getKeyValuePairs = function() {
        return this.keyValuePairs;
    }
    this.getValue = function(s) {
        for (var j = 0; j < this.keyValuePairs.length; j++) {
            if (this.keyValuePairs[j].split("=")[0] == s)
                return this.keyValuePairs[j].split("=")[1];
        }
        return false;
    }
    this.getParameters = function() {
        var a = new Array(this.getLength());
        for (var j = 0; j < this.keyValuePairs.length; j++) {
            a[j] = this.keyValuePairs[j].split("=")[0];
        }
        return a;
    }
    this.getLength = function() { return this.keyValuePairs.length; }
}
function totalPriceRemoverNew() {
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("POST", "AJAX/remove_total.aspx", true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
            }
            else {
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function NavigateToProductFromSupportNew(productID) {
    var PageName = GetPageNameNew();
    if (PageName.toLowerCase() == '/ajax/home.aspx') {
        var URL = "http://" + window.location.host + "/default.aspx?ProURL_ID=" + productID;
        parent.window.location = URL;
    }
    else {
        document.getElementById("stackText").innerHTML = "";
        SetSourceNew("/loadingpage.html");
        totalPriceRemoverNew();
        var url = "http://" + location.hostname + "/Utility.asmx";
        var xmlRequest = RemoteCallWebServiceNew(url, "business4less.com", "ValidProduct", "<ProductID>" + productID.toString() + "</ProductID>");
        var xContent = ParseXMLResponse(xmlRequest)
        var result = xContent;
        if (result == "1") {
            downslideNew();
            RelatedProductNew(productID);
            ShowHideProductCommandsNew('Product', productID, '?product_id=' + productID, productID, 'nosearch');
            if (SharedProdId == "") {
                productCatLedder(productID);
            }
            //productCatLedder(productID);
        }
    }
}
function RemoteCallWebServiceNew(url, ns, method, params) {
    var xmlRequest;
    xmlRequest = globalAjaxHttpObjectNew();
    xmlRequest.open("POST", url, false);
    xmlRequest.setRequestHeader("Man", "POST " + url + "HTTP/1.1")
    xmlRequest.setRequestHeader("MessageType", "CALL")
    xmlRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    xmlRequest.setRequestHeader("SOAPAction", ns + "/" + method);
    var sr = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope " +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
"<soap:Body>" +
"<" + method + " xmlns=\"" + ns + "\">" + params + "</" + method + "></soap:Body></soap:Envelope>";
    xmlRequest.send(sr);
    return xmlRequest;
}
function topLayerHideNew() {
    if (document.getElementById("topLink")) {
        if (GetUAgent != '') {

            if (document.getElementById("topLink").style.visibility == "hidden") {
                return;
            }
            else {
                document.getElementById("topLink").style.visibility = "hidden";
            }
        }
    }
}

function combNew(layerhide, layershow) {
    if (document.getElementById("textbarcol2")) {
        imgoneNew(layerhide);
        imgtwoNew(layershow);
        document.getElementById("textbarcol2").style.display = 'none'; 	// New Updation for product
        document.getElementById("DIV_LIST").style.display = 'none'; 		// New Updation for product
    }
}

function imgoneNew(layerhide) {
    if (document.getElementById(layerhide)) {
        document.getElementById(layerhide).style.display = 'none';
    }
}

function imgtwoNew(layershow) {
    if (document.getElementById(layershow)) {
        document.getElementById(layershow).style.display = 'block';
    }
    //favlink();
}

function BestOfferBidNew() {
    var url = "http://" + window.location.host + "/MP_AJAX/MP_ProductDetails.aspx" + GlobalMpQuery + "&placebid=true";
    var xmlRequest = DoCallbackNew(url, "")
    if (xmlRequest) {
        var str = xmlRequest.responseText;
        if (str == 'NOTLOGIN') {
            SetSourceNew('/MP_AJAX/MP_bid.aspx' + GlobalMpQuery)
        }
        else {
            PlaceBestOfferBidNew();
        }
    }
    else {
    }
}
function PlaceBestOfferBidNew() {
    var url = "http://" + window.location.host + "/MP_AJAX/MP_ApprovedSuppiler.aspx" + window.location.search + "&check=supplier";
    //var xmlRequest = DoCallback(url,"")
    var xmlRequest = DoCallbackNew(url, "");
    if (xmlRequest) {
        var str = xmlRequest.responseText;
        if (str == 'APPROVED') {
            parent.window.location = "http://" + window.location.host + "/Default.aspx" + window.location.search + "&qstr=login";
        }
        else if (str == 'CONTROLLEDBID') {
            downslideNew
            SetSourceNew("/loadingpage.html");
            RedirectPlaceBidNew()
        }
        else if (str == 'NOTAPPROVED') {
            var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + window.location.search;
            parent.SetSourceNew(url)
        }
        else if (str == 'FIXTENDER') {
            SubmitBestOfferBidNew()
        }
        else if (str == 'FIXBIDDER') {
            SubmitBestOfferBidNew()
        }
        else if (str == 'SELLING') {
            PlaceapprovebidNew()
        }
        else if (str == 'NOTAPPROVEDBIDDER') {
            var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + window.location.search;
            SetSourceNew(url)
        }
        else if (str == 'NOTALLOWED') {
            var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + window.location.search + "&bidder=NOTALLOWED";
            SetSourceNew(url)
        }
    }
}
function SubmitBestOfferBidNew() {
    if (queryStringNew("isfixpricetender") == 'Y') {
        var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + window.location.search;
        SetSourceNew(url);
    }
    else if (queryStringNew("type") == 'profile') {
        var PQnty = document.getElementById('lbl_quantity').innerText;
        var NPrice = document.getElementById('new_offer').value;
        var qstring = "new_offer=" + NPrice + "&purchased_quantity=" + PQnty;
        var url = "http://" + window.location.host + "/MP_AJAX/MP_CheckBid.aspx" + GlobalMpQuery + "&" + qstring + "&" + "check=" + imp_check + "&base_percentage=" + imp_base_per;
        if (fixMoney(document.getElementById('new_offer')) == true) {
            var xmlRequest = DoCallbackNew(url, "")
            {
                var str = xmlRequest.responseText;
                var temp = new Array();
                temp = str.split('&');
                if (queryStringNew("type") == 'profile') {
                    if (temp[0] == 'false1') {
                        document.getElementById('err_msg_head').value = "* Please enter";
                        document.getElementById('err_msg').value = " bid greater than current bid";
                    }
                    else if (temp[0] == 'false2') {
                        document.getElementById('err_msg_head').value = "* You can not ";
                        document.getElementById('err_msg').value = "place bid greater than " + temp[1];
                    }
                    else {
                        var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + GlobalMpQuery + "&" + qstring + "&" + str;
                        SetSourceNew(url);
                    }
                }
                else {
                    if (temp[0] == 'false1') {
                        document.getElementById('err_msg_head').value = "* Please enter";
                        document.getElementById('err_msg').value = " bid greater than current bid";
                    }
                    else if (temp[0] == 'false2') {
                        document.getElementById('err_msg_head').value = "* You can not ";
                        document.getElementById('err_msg').value = "place bid greater than " + temp[1];
                    }
                    else {
                        var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + GlobalMpQuery + "&" + qstring + "&" + str;
                        SetSourceNew(url);
                    }
                }
            }
        }
    }
    else if (queryStringNew("type") == 'selling') {
        var NPrice = document.getElementById('new_offer').value;
        var qstring = "new_offer=" + NPrice; //+"&purchased_quantity="+PQnty;
        var url = "http://" + window.location.host + "/MP_AJAX/MP_CheckBid.aspx" + GlobalMpQuery + "&" + qstring + "&" + "check=" + imp_check + "&base_percentage=" + imp_base_per;
        if (fixMoney(document.getElementById('new_offer')) == true) {
            var xmlRequest = DoCallbackNew(url, "")
            {
                var str = xmlRequest.responseText;
                var temp = new Array();
                temp = str.split('&');
                if (queryStringNew("type") == 'selling') {
                    if (temp[0] == 'false1') {
                        document.getElementById('err_msg_head').value = "* Please enter";
                        document.getElementById('err_msg').value = " bid greater than current bid";
                    }
                    else if (temp[0] == 'false2') {
                        document.getElementById('err_msg_head').value = "* You can not ";
                        document.getElementById('err_msg').value = "place bid less than " + temp[1];
                    }
                    else {
                        var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + GlobalMpQuery + "&" + qstring + "&" + str;
                        SetSourceNew(url);
                    }
                }
            }
        }
    }
    else {
        var PQnty = document.getElementById('lbl_quantity').innerText;
        var NPrice = document.getElementById('new_offer').value;
        var qstring = "new_offer=" + NPrice + "&purchased_quantity=" + PQnty;
        var url = "http://" + window.location.host + "/MP_AJAX/MP_CheckBid.aspx" + GlobalMpQuery + "&" + qstring + "&" + "check=" + imp_check + "&base_percentage=" + imp_base_per;
        if (fixMoney(document.getElementById('new_offer')) == true) {
            var xmlRequest = DoCallbackNew(url, "")
            {
                var str = xmlRequest.responseText;
                var temp = new Array();
                temp = str.split('&');
                if (temp[0] == 'false1') {
                    document.getElementById('err_msg_head').value = "* Please enter";
                    document.getElementById('err_msg').value = " bid less than current bid";
                }
                else if (temp[0] == 'false2') {
                    document.getElementById('err_msg_head').value = "* You can not ";
                    document.getElementById('err_msg').value = "place bid less than " + temp[1];
                }
                else {
                    var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + GlobalMpQuery + "&" + qstring + "&" + str;
                    SetSourceNew(url);
                }
            }
        }
    }
}
function RedirectPlaceBidNew() {
    src = "http://" + window.location.host + "/Specialize/PlaceControllBidBid.aspx" + GlobalMpQuery;
    SetSourceNew(src);
}
function chkWizard4_RelatedNew(params, resultRealted) {
    if (USE_DATABASE_PRODUCTCOMMANDS) {
        if (resultRealted == "No Data") {
            document.getElementById("RelatedProductDiv").style.display = 'none';
        }
        else if (resultRealted != "No Data") {
            document.getElementById("RelatedProductDiv").style.display = 'block';
        }
    }
    if (USE_FILESYSTEM_PROUDCTCOMMANDS) {
        var req = null;
        req = initXMLHTTPRequestNew();
        if (req) {
            req.open("GET", "AJAX/PreActivateFileCheck.aspx" + params, true);
            req.onreadystatechange = function() {
                var ready = req.readyState;
                var data = null;
                if (ready == 4)
                    if (ready == 4) {
                    xmlResult = req.responseText;
                    if (xmlResult == "NoWizard," && resultRealted == "No Data") {
                        document.getElementById("RelatedProductDiv").style.display = 'none';
                    }
                    else if (xmlResult == "NoWizard," && resultRealted != "No Data") {
                        document.getElementById("RelatedProductDiv").style.display = 'block';
                    }
                    else if ((xmlResult == "Wizard," || xmlResult == "Wizard,VR") && resultRealted != "No Data") {
                        _wizardGlobalChk = xmlResult;
                        _relatedresultchk = resultRealted;
                        document.getElementById("RelatedProductDiv").style.display = 'block';
                    }
                    else if ((xmlResult == "Wizard," || xmlResult == "Wizard,VR") && resultRealted == "No Data") {
                        _wizardGlobalChk = xmlResult;
                        _relatedresultchk = resultRealted;
                        document.getElementById("RelatedProductDiv").style.display = 'none';
                    }
                    else if ((xmlResult != "Wizard," || xmlResult != "Wizard,VR") && (resultRealted != "No Data" || resultRealted == "No Data")) {
                        _wizardGlobalChk = xmlResult;
                        _relatedresultchk = resultRealted;
                        document.getElementById("RelatedProductDiv").style.display = 'none';
                    }
                }
            }
            // req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            req.send("");
        }
    }
}
function fullViewWithURLsNew() {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0].toLowerCase() == "ipcheck") {
            IpRedirect = true;
        }
    }
    resizeInfiniViewWithResolution = false;
    /**
    var req=null;
    req=initXMLHTTPRequestNew();
    if (req)
    {
    req.open("POST",_Domain + "/AJAX/CheckFullScreen.aspx",true);
    req.onreadystatechange=function()
    {
    var ready=req.readyState;
    var data=null;
    if (ready==4)
    {
    var Result = req.responseText ;
    Result = Result.replace(/^\s+|\s+$/g,"");
    if(Result.toLowerCase() == 'y')
    {
    resizeInfiniViewWithResolution = true;
    }
    else
    {
    resizeInfiniViewWithResolution = false;
    }
    }
    }
    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req.send("");
    }
    **/
}
function SetCookie() {
    if (arguments.length < 2) { return; }
    var n = arguments[0];
    var v = arguments[1];
    var d = 0;
    if (arguments.length > 2) { d = parseInt(arguments[2]); }
    var exp = '';
    if (d > 0) {
        var now = new Date();
        then = now.getTime() + (d * 24 * 60 * 60 * 1000);
        now.setTime(then);
        exp = '; expires=' + now.toGMTString();
    }
    document.cookie = n + "=" + escape(String(v)) + '; path=/' + exp;
} // function SetCookie()

function ReadCookie(n) {
    var cookiecontent = new String();
    if (document.cookie.length > 0) {
        var cookiename = n + '=';
        var cookiebegin = document.cookie.indexOf(cookiename);
        var cookieend = 0;
        if (cookiebegin > -1) {
            cookiebegin += cookiename.length;
            cookieend = document.cookie.indexOf(";", cookiebegin);
            if (cookieend < cookiebegin) {
                cookieend = document.cookie.length;
            }
            cookiecontent = document.cookie.substring(cookiebegin, cookieend);
        }
    }
    return unescape(cookiecontent);
} // function ReadCookie()

function setCookie() {
    var acookie = ReadCookie("infiniCookie");
    return Parser(acookie);
}

function Parser(str) {
    var parseCookie = new String(str)
    if (parseCookie != "") {
        var splitCookie = parseCookie.split("=");
        var parseUserId = splitCookie[1].split("&");
        var parseJabberId = splitCookie[3]
        var visterID = parseUserId[0];
        postURL(visterID)
    }
}

function postURL(visiterId) {
    var tempurl, tempStr, strLth;
    var newlth;
    tempurl = document.location.href;
    tempurl = tempurl.substring(7, tempurl.length);
    var tempStr = tempurl.split("/");
    var value = "http://" + tempStr[0] + "/tracker/tracker.aspx?referrer=" + escape(document.referrer);
    //var value = "http://tracker.infinishops.com/tracker.aspx?referrer=" + escape(document.referrer);
    var docLocation = document.location.href;
    value += "&customerId=" + visiterId;
    if (readJabberCookie("InfiniCustomerJabberId") != null) {
        docLocation += "&customerId=" + visiterId + "&customerJID=" +
		readJabberCookie("InfiniCustomerJabberId") + "&operatorJID=" +
		readJabberCookie("InfiniCustomerOpreatorId");
    }
    value += "&location=" + escape(docLocation);
    var html_doc = document.getElementsByTagName("head").item(0);
    var scriptTag = document.createElement("SCRIPT");
    scriptTag.src = value;
    html_doc.appendChild(scriptTag);
}

function getJID(JID, operatorJID) {
    createJabberCookie("InfiniCustomerJabberId", JID, 7)
    createJabberCookie("InfiniCustomerOpreatorId", operatorJID, 7)
    setCookie();
}

function createJabberCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readJabberCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}
function ParseXMLResponse(request) {
    var xmlDoc;
    if (isIE() == true) {
        xmlDoc = request.responseXML
        return xmlDoc.text;
    }
    else {
        parser = new DOMParser();
        xmlDoc = parser.parseFromString(request.responseText, "text/xml");
        return xmlDoc.firstChild.textContent;
    }
}
function isIE() {
    if (navigator.appName == "Microsoft Internet Explorer") {
        return true;
    } else {
        return false;
    }
}
function globalAjaxHttpObjectNew() {
    var xmlRequest;
    try {
        xmlRequest = new XMLHttpRequest();
        return xmlRequest;
    }
    catch (e) {
        try {
            xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
            return xmlRequest;
        }
        catch (e) {
            try {
                reqVar = new ActiveXObject("Microsoft.XMLHTTP");
                return xmlRequest;
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
}
function DirectCategoryOpen(CatID) {
    if (catComView != "topper") {
        if (CatID > 0) {
            if (GetUAgent != "") {

                //iPhoneInifiniView("none", "block");
                //var xmlResult;
                //var xmlRequest = DoCallback(_Domain + "/resultCate.aspx?catid=", CatID);
                //xmlResult = xmlRequest.responseText;
                //hideFavRight();
                //hideHistoryRight();
                document.getElementById("RelatedProductDiv").style.display = 'none';
                nullAllVar();
                SetIframeMenuSrc(CatID);
                //LoadChildren1_wap('Category', xmlResult, 'javascript:');
                //parentStacking(CatID);

            }
            else {
                var xmlResult;
                var xmlRequest = DoCallback(_Domain + "/resultCate.aspx?catid=", CatID);
                xmlResult = xmlRequest.responseText;
                hideFavRight();
                hideHistoryRight();
                document.getElementById("RelatedProductDiv").style.display = 'none';
                FrameSize('');
                topLayerShow();
                nullAllVar();
                LoadChildren1('Category', xmlResult, 'javascript:');
                slidebox('slidebox1');
                textbar('textbarcol');
                parentStacking(CatID);

            }
        }

    }
}
function RedirectToCategoryNew(outsider) {
    if (outsider > 0) {
        location.href = "../default.aspx?CategoryID=" + outsider;
    }
}
function catImageChange(catId, imageUrl, status, catPathId) {
    if (status == "hover") {
        if (_mainCateId != null) {
            _mainCateId.src = '../cat_files/' + _mainCatImage + '/cat_textImg/simple.gif';
            _mainCateId = null;
        }
        else {
            catId.src = imageUrl;
            _mainCateId = catId;
        }
        _mainCatImage = catPathId;
    }
}
function CouponTicket(Orderid, MerchantID, CustomerID, EmailAddress, EmailType, ProductName) {
    var url = "http://" + top.window.location.host + "/shopping/CouponRedirection.aspx?OrderId=" + Orderid + "&MerchantID=" + MerchantID + "&CustomerID=" + CustomerID + "&ProductName=" + ProductName + "&EmailType=" + EmailType + "&EmailAddress='" + EmailAddress + "'";
    var xmlRequest = DoCallbackNew(url, "")
    if (xmlRequest) {
        alert("Email Has Been Successfully Sent");
    }
}
function PageBannerLoad(screen, Banner, slot) {
    var url = _Domain + "/MP_Ajax/MP_PageBanner.aspx?slot_name=" + slot + "&screen=" + screen + "&banner=" + Banner;
    var xmlRequest = DoCallbackNew(url, "")
    if (xmlRequest) {
        if (Banner == 'Banner_right') {
            document.getElementById("Banner_right").style.display = "block";
            PageAdRender(xmlRequest.responseText, 'Banner_right')
        }
        else if (Banner == 'Banner_left') {
            document.getElementById("Banner_left").style.display = "block";
            PageAdRender(xmlRequest.responseText, 'Banner_left')
        }
        else if (Banner == 'Banner_bottom') {
            document.getElementById("Banner_bottom").style.display = "block";
            PageAdRender(xmlRequest.responseText, 'Banner_bottom')
        }
    }
}
var temp_right = new Array();
var temp_left = new Array();
var temp_bottom = new Array();
function PageAdRender(res, banner) {
    var str = res;
    if (banner == 'Banner_right') {
        temp_right = str.split('&&');
        PageAd();
        var ints1;
        ints = setInterval("PageAd();", 30000)
    }
    else if (banner == 'Banner_left') {
        temp_left = str.split('&&');
        PageAdleft();
        var ints2;
        ints = setInterval("PageAdleft();", 30000)
    }
    else if (banner == 'Banner_bottom') {
        temp_bottom = str.split('&&');
        PageAdbottom();
        var ints3;
        ints = setInterval("PageAdbottom();", 30000)
    }
}
var count = 0
function PageAd() {
    if (temp_right[count] != null) {
        if (temp_right[count] != '') {
            document.getElementById("Banner_right").style.display = "block";
            document.getElementById("Banner_right").innerHTML = temp_right[count];
            count = count + 1;
        }
        else {
            count = 0
        }
    }
    else {
        document.getElementById("Banner_right").style.display = "block";
        count = 0
    }
}
var count1 = 0
function PageAdleft() {
    if (temp_left[count1] != null) {
        if (temp_left[count1] != '') {
            document.getElementById("Banner_left").style.display = "block";
            document.getElementById("Banner_left").innerHTML = temp_left[count1];
            count1 = count1 + 1;
        }
        else {
            count1 = 0
        }
    }
    else {
        document.getElementById("Banner_left").style.display = "block";
        count1 = 0
    }
}
var count2 = 0
function PageAdbottom() {
    if (temp_bottom[count2] != null) {
        if (temp_bottom[count2] != '') {
            document.getElementById("Banner_bottom").style.display = "block";
            document.getElementById("Banner_bottom").innerHTML = temp_bottom[count2];
            count2 = count2 + 1;
        }
        else {
            count2 = 0
        }
    }
    else {
        document.getElementById("Banner_bottom").style.display = "block";
        count2 = 0
    }
}
function SetSourceNewWithCommands(src) {
    getIPhoneIViewForNew("SetSourceNewWithCommands");
    if (USE_FILESYSTEM_PROUDCTCOMMANDS) {
        _screenWidthChkr = screen.width;
        if (_screenWidthChkr >= 1280) {
            src = src.replace("resolution", "1280x1024")
            window.frames["frame_details"].location.replace(src);
            fullScreenIframeSrc = src;
        }
        else if (_screenWidthChkr >= 1024 && _screenWidthChkr < 1280) {
            src = src.replace("resolution", "1024x768")
            window.frames["frame_details"].location.replace(src);
            fullScreenIframeSrc = src;
        }
        else if (_screenWidthChkr >= 800 && _screenWidthChkr < 1024) {
            src = src.replace("resolution", "800x600")
            window.frames["frame_details"].location.replace(src);
            fullScreenIframeSrc = src;
        }
    }
    else {
        window.frames["frame_details"].location.replace(src);
        return;
    }
}
function ProfileBidNew() {
    var url = "http://" + window.location.host + "/MP_AJAX/MP_ProductDetails.aspx" + GlobalMpQuery + "&placebid=true";
    var xmlRequest = DoCallbackNew(url, "")
    if (xmlRequest) {
        var str = xmlRequest.responseText;
        if (str == 'NOTLOGIN') {
            SetSourceNew('/MP_AJAX/MP_Profiler.aspx' + GlobalMpQuery)
        }
        else {
            PlaceProfileBidNew();
        }
    }
}
function PlaceProfileBidNew() {
    var url = "http://" + window.location.host + "/MP_AJAX/MP_ApprovedSuppiler.aspx" + window.location.search + "&check=supplier";
    var xmlRequest = DoCallbackNew(url, "")
    if (xmlRequest) {
        var str = xmlRequest.responseText;
        if (str == 'APPROVED') {
            parent.window.location = "http://" + window.location.host + "/Default.aspx" + window.location.search + "&qstr=login";
        }
        else if (str == 'CONTROLLEDBID') {
            downslideNew();
            RedirectPlaceBidNew();
        }
        else if (str == 'NOTAPPROVED') {
            var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + window.location.search;
            SetSourceNew(url)
        }
        else if (str == 'FIXTENDER') {
            SubmitBestOfferBidNew();
        }
    }
    else {
    }
}
function DirectConvenceMeNew() {
    if (Filetype == "2" && Typestepno != "") {
        _ProductCommands.LoadConvinceMeFiles();
    }
}
function ControlOption() {
    findPosYNew(document.getElementById("OptionCont"));
    findPosXNew(document.getElementById("OptionCont"));
    document.getElementById("OptionControl").style.top = topCategoryNew + 25;
    document.getElementById("OptionControl").style.left = leftCategoryNew - 180;
    document.getElementById("OptionControl").style.display = "Block";
    document.getElementById("OptionControl").innerHTML = loadPagesImageNew;
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("POST", "AJAX/ControlPanel.aspx", true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                document.getElementById("OptionControl").innerHTML = req.responseText;
            }
            else {
                document.getElementById("OptionControl").innerHTML = loadPagesImageNew;
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function CloseControlPanel() {
    document.getElementById("OptionControl").style.display = "none";
    document.getElementById("preferences").src = "images/preferences.jpg";
}
function ControlValueChange(CookieType) {
    var query = '?Cookietype=' + CookieType;
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("POST", "AJAX/ControlPanelValueChange.aspx" + query, true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                document.getElementById(CookieType).innerHTML = req.responseText;
            }
            else {
                document.getElementById(CookieType).innerHTML = loadPagesImageNewCenterNew;
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function ControlValueChangeRefresh(CookieType) {
    var query = '?Cookietype=' + CookieType;
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("POST", "AJAX/ControlPanelValueChange.aspx" + query, true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                document.getElementById('loading').innerHTML = "";
                parent.document.execCommand('Refresh');
            }
            else {
                document.getElementById('loading').innerHTML = loadPagesImageNewCenterNew;
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function FrameSizeOld(size) {
    if (catComView.toLowerCase() == "topper") {
        var screen_height = screen.height;
        var screen_width = screen.width;
        var IFrame = document.getElementById("frame_details");
        var MainTable = document.getElementById("Page_Table");
        if ((screen_width <= 1023) || (screen_height <= 767)) {
            if (size.toLowerCase() == 'large') {
                document.getElementById("fullframeNew").style.display = 'none';
                document.getElementById("leftbartable").style.display = "none";
                IFrame.width = "772";
                IFrame.height = "355"
            }
            else {
                document.getElementById("fullframeNew").style.display = 'block';
                IFrame.width = "546";
                IFrame.height = "314"
            }
        }
        else if ((screen_width <= 1279) || (screen_height <= 1023)) {
            if (resizeInfiniViewWithResolution == false) {
                if (size.toLowerCase() == 'large') {
                    document.getElementById("fullframeNew").style.display = 'none';
                    document.getElementById("leftbartable").style.display = "none";
                    IFrame.width = "772";
                    IFrame.height = "355"
                }
                else {
                    document.getElementById("fullframeNew").style.display = 'block';
                    IFrame.width = "546";
                    IFrame.height = "314"
                }
            }
            else {
                if (size.toLowerCase() == 'large') {
                    document.getElementById("fullframeNew").style.display = 'none';
                    document.getElementById("leftbartable").style.display = "none";
                    document.getElementById("catBall").style.width = '0px';
                    IFrame.width = "970";
                    IFrame.height = "356";
                }
                else {
                    document.getElementById("fullframeNew").style.display = 'block';
                    document.getElementById("catBall").style.width = '250px';
                    IFrame.width = "768"
                    IFrame.height = "314";
                }
            }
        }
        else if ((screen_width >= 1280) || (screen_height >= 1024)) {
            if (resizeInfiniViewWithResolution == false) {
                if (size.toLowerCase() == 'large') {
                    document.getElementById("fullframeNew").style.display = 'none';
                    document.getElementById("leftbartable").style.display = "none";
                    IFrame.width = "780";
                    IFrame.height = "355"
                }
                else {
                    document.getElementById("fullframeNew").style.display = 'block';
                    IFrame.width = "546";
                    IFrame.height = "314"
                }
            }
            else {
                if (size.toLowerCase() == 'large') {
                    document.getElementById("fullframeNew").style.display = 'none';
                    document.getElementById("leftbartable").style.display = "none";
                    IFrame.width = "1205";
                    IFrame.height = "597";
                }
                else {
                    document.getElementById("fullframeNew").style.display = 'block';
                    IFrame.width = "960";
                    IFrame.height = "477";
                }
            }
        }
    }
}
function NavigateToThanks(Desc) {
    SetSourceNew('../thanks.aspx?description=' + Desc);
}
function PlaceapprovebidNew() {

    var url = "http://" + window.location.host + "/MP_AJAX/displayDescription.aspx" + GlobalMpQuery + "&checkBanner=true&_screen=" + screen.width;
    //var xmlRequest = DoCallback(url,"")
    var xmlRequest = DoCallbackNew(url, "");
    if (xmlRequest) {
        var str = xmlRequest.responseText;
        if (str == 'ok') {
            var merchant_id = queryStringNew("merchant_product_id");
            src = '../ProductFiles/' + merchant_id + '/1/1/resolution/index.htm';
            SetSourceWithCommandsNew(src);
        }
        else {
            SetSourceWithCommandsNew("http://" + window.location.host + "/MP_AJAX/displayDescription.aspx" + GlobalMpQuery);
        }
    }

    var url = "http://" + window.location.host + "/MP_AJAX/MP_ProductDetails.aspx" + window.location.search + "&qstr=login";
    var xmlRequest = DoCallbackNew(url, "")
    if (xmlRequest) {
        document.getElementById('ACTIVECOMMANDS').style.visibility = 'visible';
        document.getElementById('ACTIVECOMMANDS').innerHTML = xmlRequest.responseText;
    }
}
function OpenCategoryProduct(productID) {
    if ((productID.toLowerCase()) != 'nothing') {
        CheckSharedURL = true;
        totalPriceRemoverNew();
        var url = "http://" + location.hostname + "/Utility.asmx";
        var xmlRequest = RemoteCallWebServiceNew(url, "business4less.com", "ValidProduct", "<ProductID>" + productID.toString() + "</ProductID>");
        var xContent = ParseXMLResponse(xmlRequest)
        var result = xContent;
        if (result == "1") {
            ShowHideProductCommandsNew('Product', productID, '?product_id=' + productID, productID, 'nosearch');
        }
    }
}
function CheckBottombannerNew() {
    if (document.getElementById("ACTIVECOMMANDS").innerHTML != "") {
        document.getElementById("BottomBannerTD").style.display = "none";
    }
    else {
        document.getElementById("BottomBannerTD").style.display = "block";
    }
}
function HidebuttonandChat() {
    document.getElementById("BottomBannerTD").style.display = "block";
    document.getElementById("btd").style.display = "none";
    document.getElementById("sup").style.visibility = "visible";
    document.getElementById("cht").style.display = "none";
}

function HideBottomPagebannersNew() {
    if (GetUserAgent() != "") {
        GetElement('BottomBannerTD').style.display = "none";
    }
}
function FrameSetDefault() {
    /**
    document.getElementById("loadingLayer").style.display = "none";
    document.getElementById("Layer1").style.visibility = "visible";
    var screen_height = screen.height;
    var screen_width = screen.width;
    var IFrame = document.getElementById("frame_details");
    if ((screen_width<=1023) || (screen_height<=767)){
    myMainCategoryMovingNew();
    IFrame.width="546"
    IFrame.height="314"
    }
    else if((screen_width<=1279) || (screen_height<=1023)){
    if(resizeInfiniViewWithResolution == false){
    IFrame.width="546";
    IFrame.height="314";
    }else{
    IFrame.width="768"
    IFrame.height="235";
    IFrame.align="left";
    }
    myMainCategoryMovingNew();
    }
    else if ((screen_width>=1280) || (screen_height>=1024)){
    if(resizeInfiniViewWithResolution == false){
    IFrame.width="546";
    IFrame.height="314"
    }else{
    IFrame.width= "960";
    IFrame.height= "477";
    IFrame.align="left";
    }
    myMainCategoryMovingNew();
    }
    **/
}
function LeftBannerLoad() {
    var LeftBannerSource = 'http://' + window.location.host + '/Images_Private/Banners/BannerLeft.htm';
    var BannerLeft = document.getElementById('Banner_left'); //window.frames["Banner_left"];
    var LeftxmlRequest = DoCallbackNewSecond(LeftBannerSource, "")
    if (LeftxmlRequest) {
        var Leftstr = LeftxmlRequest.responseText;
        if (Leftstr != '') {
            BannerLeft.innerHTML = Leftstr;
        }
    }
}
function RightBannerLoad() {
    var RightBannerSource = 'http://' + window.location.host + '/Images_Private/Banners/BannerRight.htm';
    var BannerRight = document.getElementById('Banner_right'); //window.frames["Banner_right"];
    var RightxmlRequest = DoCallbackNewSecond(RightBannerSource, "")
    if (RightxmlRequest) {
        var Rightstr = RightxmlRequest.responseText;
        if (Rightstr != '') {
            BannerRight.innerHTML = Rightstr;
        }
    }
}
function BottomBannerLoad() {
    var BottomBannerSource = 'http://' + window.location.host + '/Images_Private/Banners/BannerBottom.htm';
    var BannerBottom = document.getElementById('Banner_bottom'); // window.frames["Banner_right"];
    var BottomxmlRequest = DoCallbackNewSecond(BottomBannerSource, "")
    if (BottomxmlRequest) {
        var Bottomstr = BottomxmlRequest.responseText;
        if (Bottomstr != '') {
            BannerBottom.innerHTML = Bottomstr;
        }
    }
}
function DoCallbackNewSecond(url, params) {
    var pageUrl = url + params;
    var xmlRequest;
    try {
        xmlRequest = new XMLHttpRequest();
    }
    catch (e) {
        try {
            xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    xmlRequest.open("GET", pageUrl, false);
    xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlRequest.send("");
    return xmlRequest;
}
function MP_ProductAd() {
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("GET", "../MP_AJAX/MP_ProductAdvertisement.aspx", true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                document.getElementById('CAuction').innerHTML = req.responseText;
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function MP_ProductAdTender() {
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("GET", "../MP_AJAX/MP_ProductAdvertisementTender.aspx", true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                document.getElementById('CTender').innerHTML = req.responseText;
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function AddScriptFiles() {

    if (window.location.search.length <= 0 || IpRedirect == true) {
        setTimeout('addJsElementNew()', 1000);
    }
}
function ScrollMPProduct() {


    var xmlRequest = DoCallbackNew(_Domain + "/MP_AJAX/MP_Advertisement.aspx?checkAd=true", "");
    var str = xmlRequest.responseText;
    var temp = new Array();
    temp = str.split(',');
    for (var i = 0; i < temp.length; i++) {

        if (temp[i] == 1) {
            setTimeout("AE.widget.SimpleScroll.decorate('Auction', {lineHeight: 12, startDelay: 1});", 30000);
        }
        if (temp[i] == 2) {
            setTimeout("AE.widget.SimpleScroll.decorate('Tender', {lineHeight: 12, startDelay: 1});", 30000);
        }
        if (temp[i] == 3) {
            //setTimeout("AE.widget.SimpleScroll.decorate('hotNews', {lineHeight: 12, startDelay: 1});",30000);

        }


    }


}
function AllMainFucntion() {
    if (window.location.search.length > 0 && IpRedirect == false && window.location.search.toLowerCase() != "?noheader=1") {
        setTimeout('CatLoadCallerNew();', 2000);
        DirectConvenceMeNew();
    }
}
function MP_AdvertisementCall() {

    var xmlRequest = DoCallbackNew(_Domain + "/MP_AJAX/MP_Advertisement.aspx?checkAd=true", "");
    var str = xmlRequest.responseText;
    var temp = new Array();
    temp = str.split(',');
    for (var i = 0; i < temp.length; i++) {

        if (temp[i] == 1) {
            MP_ProductAdAuction();
        }
        if (temp[i] == 2) {
            MP_ProductAdTender();
        }
        if (temp[i] == 3) {
            //MP_ProductAd();
        }
    }
}

function CheckWorkflowQueryStringNew() {
    //debugger;
    var Workflow = queryStringNew("Workflow");
    var Order = queryStringNew("Order");
    var Code = queryStringNew("Code");
    var Display = queryStringNew("Display");

    if (Workflow != "false" && Order != "false" && Code != "false" && Display != "false") {
        if (parent.RedirectedToWorkflowOrder == null) {
            RedirectedToWorkflowOrder = true;
            var url = PAGE_WORKFLOWORDER + "?Workflow=" + Workflow + "&Order=" + Order + "&Code=" + Code + "&Display=" + Display
            SetSourceNew(url);
            return true;
        }
    }
    else {
        return false;
    }
}
function OpencategoryUrl(URL) {
    if (URL.toLowerCase() != 'javascript:') {
        parent.window.location = URL;
    }
}
function GetPageNameNew() {
    var sPath = window.location.pathname;
    //var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
    //var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    return sPath;
}

function SetBOMCart(src) {
    //alert('test1');
    top.parent.SetSourceNew(src);
    top.parent.HideBottomPagebannersNew();
    var xmlRequest = DoCallbackNew(_Domain + "/AJAX/CartCommands.aspx", "");
    top.parent.document.getElementById("ACTIVECOMMANDS").innerHTML = "";
    top.parent.document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
    top.parent.document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
    top.parent.ShowCartButton();
    //alert('sds');
    //top.parent.window.frames["frame_details"].location.replace(src);
}


function SetIOBOMCart(src) {

    window.frames["frame_details"].location.replace(src);


    //alert('sds');
    //top.parent.window.frames["frame_details"].location.replace(src);
}



function SetConfigureWizard(src) {
    var SrcNew = "http://" + window.location.host + "/" + src
    parent.window.frames["IFWizardDetail"].location.replace(SrcNew);

    top.document.getElementById('BottomBannerTD').style.display = "none";
    var xmlRequest = DoCallbackNew(_Domain + "/AJAX/CartCommands.aspx", "");
    parent.document.getElementById("ACTIVECOMMANDS").innerHTML = "";
    parent.document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
    parent.document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;


    //top.parent.window.frames["frame_details"].location.replace(src);
}

// iPhone Change
function getDynamicTransformNew(funcName, dw, dh) {
    var sizeOf = new Array();
    switch (funcName) {
        //------------------------------------------------------    
        case "SetObjectSizeNew":

            if (GetUAgent() != "") {
                sizeOf["width"] = (document.body.clientWidth * .9); //"100%";
                sizeOf["height"] = "302";
            }
            else {
                sizeOf["width"] = dw;
                sizeOf["height"] = dh;
            }
            return sizeOf;
            break;
        //-----------------------------------------------------    
    }
}
function PreviewShow(Src, func) {
    var ImagePreviewSetNew = 'false';
    var USettings = ReadCookie("usersettings");
    if (USettings != '') {
        var varsnew = USettings.split("&");
        for (var i = 0; i < varsnew.length; i++) {
            var pairnew = varsnew[i].split("=");
            if (pairnew[0].toLowerCase() == "productimagepreview") {
                ImagePreviewSetNew = pairnew[1];
            }
        }
    }
    if (ImagePreviewSetNew.toLowerCase() == 'true' || catComView.toLowerCase() == "topper") {
        if (func.toLowerCase() == 'sw') {
            SetSourceWithCommandsNew(Src);
        }
        else if (func.toLowerCase() == 'ss') {
            SetSourceNew(Src);
        }
    }
}
function setTemplateImage(src) {
    //setTempImage = src;
}
function myaccount() {

}

var h = 20;
var w = 250;
var eH = 50;
var eW = 825;
var sH = 248;
var eSH = 480;
var redirectToInfinishopsURL = null;

//Added by Asghar for Closing popup window
function NewPopupShow_Close() {
    //Layer DIV
    var divBG = document.getElementById('FilePreviewBg').style;
    divBG.display = 'none';

    var divSlideShow = document.getElementById('FileProShow').style;
    divSlideShow.width = "250";
    divSlideShow.height = "0";
    divSlideShow.display = 'none';


    var tblFileproduct = document.getElementById('tbl_Fileproductprivew').style;
    tblFileproduct.width = "825"
    tblFileproduct.height = "";

    //Description td of default page
    parent.parent.document.getElementById('tdDescription').style.display = 'block';
    CouponWindow = false;

    //Main IFRAME of default page
    var frm_FileProSlideShow = document.getElementById('frm_FileProSlideShow');
    frm_FileProSlideShow.width = "580";
    frm_FileProSlideShow.height = "340"

    //td of TableBody just for descresing width and hegiht
    document.getElementById("td1_TableBody").style.height = "20";
    document.getElementById("td2_TableBody").style.height = "15";
    //Background Color of FileProShow
    if (tblDate_bgcolor != undefined) { document.getElementById("FileProShow").style.backgroundColor = tblDate_bgcolor; }
}



function NewPopupShow(URL, PProcess) {
    if (GetUAgent() == "") {
        if (document.getElementById('FilePreviewBg')) {
            var ACinnerhtml = "<p><a href='http://www.visaeurope.com/personal/onlineshopping/verifiedbyvisa/main.jsp' target='_blank'><img id='img1' src='../Shared_Images/visa.jpg' border='0'></a></p><p><a href='http://www.mastercard.com/uk/personal/en/cardholderservices/securecode/index.html' target='_blank'><img  id='img2' src='../Shared_Images/mc_securecode.jpg' border='0'></a></p><p><IMG SRC='../Shared_Images/ssl_banner.gif'/></p>";
            var PPinnerhtml = "<p><a href='#' onClick=javascript:window.open('" + "https://www.paypal.com/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside" + "'," + "'" + "olcwhatispaypal" + "'," + "'" + "toolbar=no" + "," + "location=no" + "," + "directories=no" + "," + "status=no" + "," + "menubar=no" + "," + "scrollbars=yes" + "," + "resizable=yes" + "," + "width=400" + "," + "height=350" + "'" + ");><img  src='https://www.paypal.com/en_US/i/bnr/vertical_solution_PPeCheck.gif' border='0' alt='Solution Graphics'></a></p><p><IMG SRC='../Shared_Images/ssl_banner.gif'/></p>";
            var divBG = document.getElementById('FilePreviewBg').style;
            var divSlideShow = document.getElementById('FileProShow').style;
            var Body_Height = document.body.scrollHeight;
            var Body_Width = document.body.scrollWidth;
            if (PProcess != undefined) // in case paypal isnt available for the that merchant, next line will create an error
            // to avoid this prb, this condition is added
            {
                if (PProcess.toLowerCase() == 'pp') {
                    document.getElementById('PaymentProcessIcon').innerHTML = PPinnerhtml;
                }
                else {
                    if (document.getElementById('PaymentProcessIcon')) // remove this line, u need to add that ElementId in the html version of infinishops sites. 
                    {
                        document.getElementById('PaymentProcessIcon').innerHTML = ACinnerhtml;
                    }
                }
            }

            redirectToInfinishopsURL = null;
            document.getElementById('frm_FileProSlideShow').src = "http://" + window.location.host + "/loadingpage.html";
            redirectToInfinishopsURL = URL;
            //divSlideShow.top 	= "30%";
            //divSlideShow.left 	= "45%";

            if (BrowserDetect.browser == "Explorer") {

                divSlideShow.top = "9%"
                divSlideShow.left = "23%"
            }
            else if (BrowserDetect.browser == "Safari") {

                //divSlideShow.top = "100%";
                //divSlideShow.left = "275%";
                divSlideShow.top = "20%";
                divSlideShow.left = "100%";
            }
            else if (BrowserDetect.browser == "Firefox") {

                divSlideShow.top = "5%";
                divSlideShow.left = "7%";
            }
            else {

                divSlideShow.top = "20%";
                //divSlideShow.left = "25%";
                divSlideShow.left = "100%";


            }

            divSlideShow.height = "20";
            divSlideShow.width = "250";
            divBG.height = Body_Height;
            divBG.width = Body_Width;
            divBG.display = 'block';

            document.getElementById('tbl_Fileproductprivew').style.display = 'none';
            setTimeout("SlideShow_ImageContainerNew('FileProShow')", 500);
            //displayCounter();
        }
        else {
            try {
                parent.document.getElementById('frame_details').src = URL;
            }
            catch (e) {
                document.getElementById('frame_details').src = URL;
            }
        }
    }
    else {
        //window.location = URL;
        try {
            parent.document.getElementById('frame_details').src = URL;
        }
        catch (e) {
            document.getElementById('frame_details').src = URL;
        }
    }

}


//Added by Asghar for working of popup discount
function NewPopupShow_Coupon(URL, PProcess) {
    CouponWindow = true;
    if (GetUAgent() == "") {
        if (document.getElementById('FilePreviewBg')) {
            var divBG = document.getElementById('FilePreviewBg').style;
            var divSlideShow = document.getElementById('FileProShow').style;
            var Body_Height = document.body.scrollHeight;
            var Body_Width = document.body.scrollWidth;

            redirectToInfinishopsURL = null;
            document.getElementById('frm_FileProSlideShow').src = "http://" + window.location.host + "/loadingpage.html";
            redirectToInfinishopsURL = URL;

            if (BrowserDetect.browser == "Explorer") {
                divSlideShow.top = "220";
                divSlideShow.left = "300";
            }
            else if (BrowserDetect.browser == "Safari") {
                divSlideShow.top = "220";
                divSlideShow.left = "300";
            }
            else if (BrowserDetect.browser == "Firefox") {
                divSlideShow.top = "220";
                divSlideShow.left = "337";

                var tblDate = document.getElementById("FileProShow");
                if (tblDate != undefined) {
                    tblDate_bgcolor = tblDate.style.backgroundColor;
                    tblDate.style.backgroundColor = "Transparent";
                }

            }
            //Added by Asghar for chrome
            else if (BrowserDetect.browser == "Mozilla") {
                divSlideShow.top = "220";
                divSlideShow.left = "300";
            }
            else {
                divSlideShow.top = "20%";
                divSlideShow.left = "25%";
            }
            divSlideShow.height = "10";
            divSlideShow.width = "50";
            divBG.height = Body_Height;
            divBG.width = Body_Width;
            divBG.display = 'block';
            document.getElementById('tbl_Fileproductprivew').style.display = 'none';
            setTimeout("SlideShow_ImageContainerNew('FileProShow')", 500);


        }
        else {
            try {
                parent.document.getElementById('frame_details').src = URL;
            }
            catch (e) {
                document.getElementById('frame_details').src = URL;
            }
        }
    }
    else {
        try {
            parent.document.getElementById('frame_details').src = URL;
        }
        catch (e) {
            document.getElementById('frame_details').src = URL;
        }
    }

    //    //hide bottom description td of popup window
    document.getElementById("tdDescription").style.display = "none";

    //    //seting table tbl_Fileproductprivew minimum width and height
    var tblFileproduct = document.getElementById('tbl_Fileproductprivew').style;
    tblFileproduct.width = "0px"
    tblFileproduct.height = "0px"


    //    //seting background div properties
    var frm_FileProSlideShow = document.getElementById('frm_FileProSlideShow');
    frm_FileProSlideShow.width = "380";
    frm_FileProSlideShow.height = "228"

    //    //td of TableBody just for descresing width and hegiht
    document.getElementById("td1_TableBody").style.height = "0";
    document.getElementById("td2_TableBody").style.height = "0";
    //    //    alert(document.getElementById("tbl_Fileproductprivew").style);



}


function SlideShow_ImageContainerNew(id) {
    var divContainer = document.getElementById(id).style;
    divContainer.display = 'block';
    setTimeout("SlideShow_ContainerHeightNew('" + id + "')", 500);
}

function SlideShow_ContainerHeightNew(id) {
    var eH = 200;
    var elem = document.getElementById(id).style;
    if (h < eH) {
        h += 20;
        elem.height = h + "px";
        SlideShow_ContainerTopPosNew(id);
        setTimeout("SlideShow_ContainerHeightNew('" + id + "')", 10);
    }
    else {
        h = 200;
        setTimeout("SlideShow_ContainerWidthNew('" + id + "')", 200);
    }
}
function SlideShow_ContainerTopPosNew(id) {
    var elem = document.getElementById(id).style;
    elem.posTop = elem.posTop - 1;
}

function SlideShow_ContainerWidthNew(id) {
    var eW = 625;
    //If this function is called from Coupon Discount Then
    if (CouponWindow == true) { eW = 125; }
    var elem = document.getElementById(id).style;
    if (w < eW) {
        w += 20;
        elem.width = w + "px";
        setTimeout("SlideShow_ContainerWidthNew('" + id + "' )", 10);
        SlideShow_ContainerLeftPosNew(id);
    }
    else {
        w = 250;
        //alert("Redirect URL : " + redirectToInfinishopsURL);
        document.getElementById('frm_FileProSlideShow').src = "";
        document.getElementById('frm_FileProSlideShow').src = redirectToInfinishopsURL;
        document.getElementById('tbl_Fileproductprivew').style.display = 'block';

    }
}
function SlideShow_ContainerLeftPosNew(id) {
    var elem = document.getElementById(id).style;
    elem.posLeft = elem.posLeft - 1;
}
var milisec = 0;
var seconds = 60;
function displayCounter() {
    if (milisec <= 0) {
        milisec = 9
        seconds -= 1
    }
    if (seconds <= -1) {
        milisec = 0
        seconds += 1
        seconds = 60
        displayCounter();
    }
    else {
        milisec -= 1
        if (document.getElementById('d2') != null) {
            document.getElementById('d2').value = seconds; //+"."+milisec 
        }
        setTimeout("displayCounter();", 100)
    }
}

function thanksdescripion() {
    if (window.location.search.length > 0) {
        var query_new = window.location.search.substring(1);
        var vars = query_new.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0].toLowerCase() == "description") {
                if (pair[1] != 'undefined') {
                    var NewURL = pair[1];
                    var patt1 = /\+/g;
                    NewURL = NewURL.replace(patt1, ' ');
                    document.getElementById("text").innerHTML = unescape(NewURL.replace("BREAK", "<br/>"));
                }
            }
        }
    }
}

function WorldWideSiteRedirection(Domain) {
    var redirectURL = Domain + '/Default.aspx?ipcheck=no';
    var cookie_name = "WorldWideSite";
    var dt = new Date();
    dt.setFullYear(eval(dt.getYear() + 5));
    if (document.cookie) {
        index = document.cookie.indexOf(cookie_name);
    } else {
        index = -1; 1
    }
    if (index == -1) {
        document.cookie = cookie_name + "=" + redirectURL + "; expires=Wednesday, 01-Aug-2040 08:00:00 GMT";
    } else {

        document.cookie = cookie_name + "=" + redirectURL + "; expires=Wednesday, 01-Aug-" + eval(dt.getYear() + 5) + " 08:00:00 GMT";
    }
    top.parent.window.location = redirectURL;
}


function RedirectToActivitationProduct(domain, arg, Pid) {

    try {
        var CName = document.getElementById("companyName").value;
        // CHANGE THIS TO UK.BUSINESSGRID.COM FOR 
        var RedirectURL = 'http://' + domain + '/default.aspx?ptype=' + arg + '&CFname=' + escape(CName) + '&directSearchProductId=' + Pid;
        //window.navigate =  RedirectURL;
        //hrefvalue.href = RedirectURL;
        document.getElementById('redirectlink').href = RedirectURL;
        //window.location.href = 
    }
    catch (ex) {

    }
}
function SearchCompany() {

    try {
        if (ptype != "" && CFname != "") {
            hideFavRight();
            hideHistoryRight();
            HideBottomPagebannersNew();
            _ProductCommands = new ProductCommands(CurrentProductID);
            _ProductCommands.LoadWizard_ForActivationProduct();
            ptype = "";
            CFname = "";
        }
    }
    catch (ex) {
    }
}

// INFINIMARKET CHANGE
function MP_ProductAdAuction() {

    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("GET", "../MP_AJAX/MP_ProductAdvertisementAuction.aspx", true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                if (document.getElementById('CDailyAuction')) {
                    document.getElementById('CDailyAuction').innerHTML = req.responseText;
                }
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }

}

function FrameSize(size) {
    if (catComView) {
        if (catComView.toLowerCase() == "topper") {
            var IFrame = document.getElementById("frame_details");
            var MainTable = document.getElementById("Page_Table");
            document.getElementById("Banner_left_container").style.display = "none";
            document.getElementById("Banner_bottom_container").style.display = "none";
            document.getElementById("Banner_right_container").style.display = "none";
            document.getElementById("hrMenuMainContainer").style.display = 'block';
            document.getElementById("StackRow").style.display = "none";
            MainTable.align = "center"
            MainTable.width = "855";
            MainTable.height = '100%'
            document.getElementById("fullframeNew").style.display = 'block';
            document.getElementById("leftbartable").style.display = "none";
            IFrame.width = "855";
            IFrame.height = "475"
            IFrame.align = "center"
        }
    }
}
function FrameSizeHome(size) {
    if (catComView) {
        if (catComView.toLowerCase() == "topper") {
            var IFrame = document.getElementById("Container_InfiniOffice");
            var IFrameMain = document.getElementById("IO_Office_Container");
            var MainTable = document.getElementById("Page_Table");
            document.getElementById("Banner_left_container").style.display = "none";
            document.getElementById("Banner_bottom_container").style.display = "none";
            document.getElementById("Banner_right_container").style.display = "none";
            MainTable.align = "center"
            MainTable.width = "855";
            MainTable.height = '100%'
            IFrame.width = "855";
            IFrame.height = "475"
            IFrameMain.height = "475"
            IFrame.align = "center"
        }
    }
}
function XMLDOMObjectNew(xmlStr) {
    try {
        //Internet Explorer
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async = "false";
        xmlDoc.load(xmlStr);
        return xmlDoc.documentElement;
    }
    catch (e) {
        try {
            //Firefox, Mozilla, Opera, etc.
            parser = new DOMParser();
            xmlDoc = parser.parseFromString(xmlStr, "text/xml");
            return xmlDoc.documentElement;
        }
        catch (e) { alert(e.message) }
    }
}
function CheckMenu() {
    try {
        //alert(navigator.userAgent);
        if (navigator.userAgent.indexOf('Firefox') >= 0) {

            xmlDoc = document.implementation.createDocument("", "", null);
            xmlDoc.async = false;
            xmlDoc.load("../Config.xml");
            if (xmlDoc.documentElement.nodeName == "Root") {
                var Name = xmlDoc.documentElement.childNodes[1].childNodes[1].firstChild.nodeValue;
                if (Name) {
                    if (Name.toLowerCase() == "horizontal") {
                        catComView = 'topper';
                    }
                }
            }
        }
        else if (navigator.userAgent.indexOf('MSIE') > 0) {
            //	alert(2)
            var xmlRequest = "../Config.xml";
            var xmldoc = XMLDOMObjectNew(xmlRequest);
            var Name = xmldoc.childNodes(0).childNodes(0).firstChild.text;
            if (Name) {
                if (Name.toLowerCase() == "horizontal") {
                    catComView = 'topper';
                }
            }
        }
        else {
            try {
                /************var xmlRequest = "../Config.xml";
                var xmlDoc = //(new DOMParser()).parseFromString(xmlRequest, "text/xml");
                //alert(xmlDoc.getElementsByTagName('Style').textContent);
                var secondRowValue = xmlDoc.evaluate(".//Root/Menu[0]", xmlDoc, null, XPathResult.STRING_TYPE, null).stringValue;
                //alert("DOMParser works fine in your browser.\nSecond row data value is: '" + secondRowValue + "'.");
                ******************/
                if (GetUAgent() == "") {
                    var xmlRequest = "../Config.xml";
                    xmlhttp = new XMLHttpRequest();

                    if (xmlhttp == null) {
                        //alert ("Your browser does not support XMLHTTP!");
                        return;
                    }
                    xmlhttp.onreadystatechange = onResponse;
                    xmlhttp.open("GET", xmlRequest, false);
                    xmlhttp.send(null);
                }

            } catch (e) {
                alert("Your browser don't support DOMParser.");
            }
        }
    }

    catch (e) {
        //alert(e.message);
    }
}

function onResponse() {

    if (xmlhttp.readyState != 4) { return; }
    if (xmlhttp.status != 200 && xmlhttp.readyState != 4) { alert("Problem retrieving XML data"); return; }
    xDoc = xmlhttp.responseXML;
    var name = xDoc.childNodes[0].childNodes[1].childNodes[1].firstChild.nodeValue;
    //alert(name);
    if (name) {
        if (name.toLowerCase() == "horizontal") {
            catComView = 'topper';

        }
    }
}

function getIPhoneIViewForNew(funcName) {

    switch (funcName) {
        case "SetSourceNew": if (GetUAgent() != "") { iPhoneInifiniViewNew("block", "none"); } break;
        case "SetSourceNewWithCommands": if (GetUAgent() != "") { iPhoneInifiniViewNew("block", "none"); } break;

    }
}
function HomeURLRedirect(URL) {
    if (URL.length > 0) {
        parent.window.location.href = URL;
    }
}


function iPhoneInifiniViewNew(iViewVisibility, mainCategoryVisibility) {
    var elems = ["FavouriteProductDiv", "HistoryProductDiv"]
    for (var i = 0; i < elems.length; i++) {
        if (document.getElementById(elems[i]) != null) {
            document.getElementById(elems[i]).style.display = "none";
        }
    }
    var infiniViewTable = document.getElementById("IFrameTD");
    var infiniViewFrame = document.getElementById("frame_details");
    var mainCategories = document.getElementById("leftbartable");
    document.getElementById("catBall").style.display = mainCategoryVisibility;
    document.getElementById("actCmd_Container").style.display = iViewVisibility;
    mainCategories.style.display = mainCategoryVisibility;
    infiniViewTable.style.display = iViewVisibility;
    infiniViewFrame.style.display = iViewVisibility;
}

//********** Windows Mobile ***********//

function CatgeoryMenuSingle_WinCE() {
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("POST", "Catalog/NewCatPageDis.aspx?iphone=true", true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {

                document.getElementById("DIV_LIST").innerHTML = "";
                document.getElementById("DIV_LIST").innerHTML = req.responseText;
            }
            else {
                //document.getElementById("catBall").innerHTML=loadPagesImageNew;
            }
        }
        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}
function ShowHeader() {

    if (GetUAgent() != "") {
        if (isIPhoneApp()) {
            // alert('1');
            document.getElementById('Headerbar').style.display = 'none';
        }
        else {
            //alert(document.getElementById('Headerbar'));
            document.getElementById('Headerbar').style.display = 'block';
        }
    }
}

function HideLogo_wap() {
    //if (document.getElementById('LogoTable')) {
    //    document.getElementById('LogoTable').style.display = 'none';
    //}
}
function GetUAgent() {
    var UserAgnt = navigator.userAgent.toLowerCase();
    var re = new RegExp("webkit/[5-9]|iemobile/[7-9]");
    if (UserAgnt.indexOf('iphone') >= 0) {
        return "iPhone";
    }
    else if (UserAgnt.indexOf('android') >= 0) {
        return "android";
    }
    //else if (UserAgnt.indexOf('blackberry') > 0 && UserAgnt.indexOf('applewebkit')) {
    else if (UserAgnt.indexOf('blackberry') >= 0 && UserAgnt.match(re)) {
        return "iPhone";
    }
    else if (UserAgnt.indexOf('symbianos/') >= 0 && UserAgnt.match(re)) {
        return "iPhone";
    }
    else if (UserAgnt.indexOf('msie') >= 0 && UserAgnt.match(re)) {
        return "iPhone"
    }
    else if (UserAgnt.indexOf('cfnetwork') >= 0 || UserAgnt.indexOf('darwin') >= 0) {
        return "iPhone";
    }
    else if (UserAgnt.indexOf('widgetmanager') >= 0 && UserAgnt.match(re)) {
        return "iPhone";
    }
    else {
        return "";
    }
}

function GlobalObjectNew(objID) {
    if (document.getElementById(objID)) {
        return document.getElementById(objID);
    }
    if (parent.document.getElementById(objID)) {
        return parent.document.getElementById(objID);
    }
}
function GetURLForInfiniOffice() {
    if (document.getElementById('InfiniOffice1_InfiniOffice')) {
        if (!isIE()) {
            return document.getElementById('InfiniOffice1_InfiniOffice').contentWindow.GetURL();
        }
        else {
            //if(typeof(document.frames['IFChatAPI'].ShowAthena)!='undefined'){document.frames['IFChatAPI'].ShowAthena();}else{alert();};
            return document.frames['InfiniOffice1_InfiniOffice'].GetURL();
        }
    }
}
function InfiniViewMenu(CatId, ProURL, CatURL, StackData) {
    OpencategoryUrl(CatURL);
    OpenCategoryProduct(ProURL);
    //stackCat(StackData);
    SetIframeMenuSrc(CatId);
}
function SetIframeMenuSrc(Catid, Type, CatType, SortOrder) {
    var CategoryType = 'NotSocial';
    var SO = "";
    if (SortOrder) {
        SO = "&SortOrder=" + SortOrder;
    }
    if (CatType) {
        CategoryType = CatType;
    }
    UnLoadCommandsNew();
    if (GetUAgent() != "") {
        DisplayFrameWithCommandHideList();
    }
    var PageURL;
    if (Catid) {
        if (GetUAgent() != "") {
            var Stack = StackArray.length;
            if (StackArray[Stack - 1] != Catid) {
                StackArray[Stack] = Catid;
            }
        }
        if (Type == undefined) {
            PageURL = "/\Catalog/InfiniViewMenu.aspx?categoryid=" + Catid + "&uAgent=" + GetUAgent() + "&CatType=" + CategoryType;
        }
        else {
            PageURL = "/\Catalog/InfiniViewMenu.aspx?categoryid=" + Catid + "&uAgent=" + GetUAgent() + '&DisplayStyleNo=' + Type + "&CatType=" + CategoryType;
        }
        PageURL += SO;
    }
    else {
        PageURL = "/\Catalog/InfiniViewMenu.aspx?" + "uAgent=" + GetUAgent() + "&CatType=" + CategoryType;
    }
    if (parent.window.frames["frame_details"]) {
        if (ALLOWPAGING) {
            PageURL = PageURL + "&AllowPaging=Y"
        }
       
        parent.window.frames["frame_details"].location.replace(PageURL);
    }
    else {
        DisplayMenu(Catid, CatType)
    }

}
function DisplayMenu(CatId, CatType) {

    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        if (CatType) {
            req.open("Get", "/\Catalog/InfiniViewMenu.aspx?categoryid=" + CatId + "&uAgent=" + GetUAgent() + "&CatType=" + CatType, false);
        }
        else {
            req.open("Get", "/\Catalog/InfiniViewMenu.aspx?categoryid=" + CatId + "&uAgent=" + GetUAgent(), false);
        }
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                var result = req.responseText;
                if (result != "") {
                    document.write(result);
                }
            }
            else {
                SetSourceNew("/\loadingpage.html");
            }
        }
        //  req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}

function DisplayProductsInfiniMenu(CatID, SortOrder, DisplayStyle) {
    
    if (CatID != '') {

        var req = null;
        req = initXMLHTTPRequestNew();
        if (req) {

            req.open("GET", "../Catalog/CheckProductsExist.aspx?catid=" + CatID, true);
            req.onreadystatechange = function() {
                var ready = req.readyState;
                var data = null;
                if (ready == 4) {

                    var result = req.responseText;
                    if (result == "y") {
                        UnLoadCommandsNew();

                        SetIframeMenuSrc(CatID, DisplayStyle, null, SortOrder);



                    }
                    else {

                        if (resizeInfiniViewWithResolution == true) {
                            _fileURL = "http://" + window.location.host + '/cat_files/' + CatID + '/cat_img/resolution/index.htm';
                            SetSourceWithCommands(_fileURL);
                            currentCenterImage = _fileURL;
                        }
                        else {
                            _fileURL = "http://" + window.location.host + '/cat_files/' + CatID + '/cat_img/index.htm';
                            SetSource(_fileURL);
                            currentCenterImage = _fileURL;
                        }
                    }
                }
                //                else {
                //                    alert(8);
                //                    SetSourceNew("/loadingpage.html");
                //                }
            }
            req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            req.send("");
        }
    }
}
function showToolTip(e, Name, Price) {

    if (GetUserAgent() == "") {
        var ToolTipNew = GetElement('ToolTip');
        //ToolTipNew.innerHTML = "<span class='TooltipName'>" + Name + "</span><br/><span class='TooltipPrice'>" + Price + "</span>";
        ToolTipNew.innerHTML = "<span class='tooltipBalloon' onclick=this.style.visibility='hidden'><span class='tooltipBalloonTop'></span><span class='tooltipBalloonMiddle'>" + Name + "</br>" + Price + "</span><span class='tooltipBalloonBottom'></span></span>"
        //ToolTipNew.style.left = (e.clientX + 70 + document.body.offsetLeft);
        //ToolTipNew.style.top = (e.clientY + 60 + document.body.offsetTop);
        ToolTipNew.style.left = (e.clientX + 230 + document.body.offsetLeft); //(e.clientX + document.body.offsetLeft);
        ToolTipNew.style.top = (e.clientY + 100);
        ToolTipNew.style.visibility = "visible";
    }
}
function hideToolTip() {
    if (GetUAgent() == "") {
        var ToolTipNew = document.getElementById('ToolTip');
        ToolTipNew.style.visibility = "hidden";
    }
}
function GetExternalAppUrl() {
    if (parent.ExAppUrl != "") {
        return parent.ExAppUrl;
    }
    else {
        return null;
    }
}
function SetExternalAppiframeSrc(Src) {
    if (Src != "") {
        parent.ExAppUrl = Src;
        var src = window.location.protocol + "//" + window.location.host + "/Mobile/ExternalApp.aspx";
        parent.window.frames["ExternalAppIFrame"].location.replace(src);
    }
}

function VideoFile_Click() {
    var src = window.location.protocol + "//" + window.location.host + "/Mobile/iPhoneAppVideo.aspx?productid=" + this.CurrentProductID;
    parent.window.frames["iPhoneAppVideo"].location.replace(src);
}
function isIPhoneApp() {
    var usrAgnt = navigator.userAgent.toLowerCase();
    if ((usrAgnt.indexOf('iphone') >= 0) && !(usrAgnt.indexOf('safari') >= 0)) {
        return true;
    }
}


// AddProductDirectinCart Start
function AddProductDirectinCart(ProductID, ReDirectToPage) {
    if (ProductID != '') {
        var requestURL = window.location.protocol + '//' + window.location.host + '/Product/Components/DirectInCart.aspx';
        var xmlReq; //= QCDoCallback(requestURL,'');
        xmlReq = DoCallbackNew(requestURL + '?product_id=', ProductID);
        //var ReDirectToPage = '/Product/option.aspx';
        if (!ReDirectToPage) {
            //ReDirectToPage = '/Product/option.aspx';
            ReDirectToPage = '';
        }

        if (ReDirectToPage == '') {
            SetSourceNew(window.location);

        }
        else {
            //    var _fileURL = "http://" + window.location.host + '/Product/option.aspx';
            var _fileURL = "http://" + window.location.host + ReDirectToPage;
            SetSourceNew(_fileURL);
        }
        //window.location.reload();
    }
}

// AddProductDirectinCart End 


// DelProductDirectinCart Start
//Function Added by GQ on 07122010 for testing
function DelProductDirectinCart(ProductID) {
    if (ProductID != '') {
        var requestURL = window.location.protocol + '//' + window.location.host + '/Shopping/Cart.aspx';
        var xmlReq; //= QCDoCallback(requestURL,'');
        xmlReq = DoCallbackNew(requestURL + '?remove_product=', ProductID);
        //SetSourceNew(_fileURL);
        window.location.reload();

    }
}
// DelProductDirectinCart End



//function calcHeight(obj) {
//    alert(obj.contentWindow.document.body.scrollHeight);
//    obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
//    //obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';
//}

function calcHeight(obj) {

    try {
        obj.style.height = "250px";
        //var the_height = document.getElementById('frame_details').contentWindow.document.body.offsetHeight;
        var the_height = obj.contentWindow.document.body.scrollHeight + 'px';
        obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
        //change the height of the iframe
        if (the_height == "0") {
            obj.style.height = "250px";
        }
        else {
            obj.style.height = the_height;
        }
        var URL = parent.window.frames["frame_details"].location.href;
        if (URL.indexOf('/ProductFiles/') > 0) {
            parent.document.getElementById('OpenAppFullScreenDiv').style.display = 'block';
        }
        else {
            parent.document.getElementById('OpenAppFullScreenDiv').style.display = 'none';
        }

    }
    catch (ex) {
        obj.style.height = "250px";
        //        alert(ex);
    }
}

function OpenAppFullScreen() {
    try {
        var URL = parent.window.frames["frame_details"].location.href;
        if (URL.indexOf('/ProductFiles/') > 0) {
            if (CurrentProductID != '0') {
                parent.SetiPhoneAppFullScreenURL(CurrentProductID);
            }
        }
    }
    catch (ex) {

    }
}



function GetShopCount() {
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {

        var myDate = new Date();
        var myTime = myDate.getTime();
        req.open("GET", "/\Mobile/ShoppingCartCount.aspx?t=" + myTime);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            if (ready == 4) {
                var result = req.responseText;
                GetElement("ShopCounter").innerHTML = result.toUpperCase();
                GetElement("_CheckOut").style.display = 'block';
                _CheckOut
                if (GetUserAgent() != "") {
                    var Count = result.substring(result.indexOf(";'>") + 3, result.indexOf("</span>"))
                    var src = window.location.protocol + "//" + window.location.host + "/Mobile/CallShoppingCartCount.aspx?t=" + myTime + "&Count=" + Count;
                    parent.window.frames["ExternalAppIFrame"].location.replace(src);

                }
            }
        }
    }
    req.send("");
}

function ShowCategoryiPhone() {
    // blank on live for temporary app fix
    var myDate = new Date();
    var myTime = myDate.getTime();

    var UserAgnt = navigator.userAgent.toLowerCase();
    var re = new RegExp("webkit/[5-9]|iemobile/[7-9]");
    if (UserAgnt.indexOf('msie') >= 0 && UserAgnt.match(re)) {
        alert("at calling window.external");
        window.external.notify("openview,fullscreen_category");
    }
    else {
        var requestURL = window.location.protocol + '//' + window.location.host + '/Mobile/ShowCategory.aspx?t=' + myTime;
        parent.window.frames["iPhoneAppFullScreen"].location.replace(requestURL);
    }
    //    var req = null;
    //    req = initXMLHTTPRequestNew();
    //    if (req) {
    //        var myDate = new Date();
    //        var myTime = myDate.getTime();
    //        req.open("GET", "../Mobile/ShowCategory.aspx?t=" + myTime);
    //        req.onreadystatechange = function() {
    //            var ready = req.readyState;
    //            if (ready == 4) {
    //                // var result = req.responseText;
    //            }
    //        }
    //    }
    //    req.send("");
}
function DisplayiPhoneMenu(CatId) {
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        req.open("Get", "../Catalog/InfiniViewMenu.aspx?categoryid=" + CatId + "&uAgent=" + GetUAgent(), false);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                var result = req.responseText;
                if (result != "") {
                    //document.write(req.responseText);
                    document.getElementById("DIV_LIST").innerHTML = "";
                    document.getElementById("DIV_LIST").innerHTML = req.responseText;
                }
            }
            else {
                document.getElementById("DIV_LIST").innerHTML = loadPagesImageNew;
            }
        }
        req.send("");
    }
}
function stackcall() {
    var displaytype;
    if (StackArray.length >= 1) {
        if (StackArray.length > 1) {
            StackArray.splice(StackArray.length - 1, 1);
        }
        if (parent.window.frames["frame_details"]) {
            var URL = parent.window.frames["frame_details"].location.href;
            URL = URL.toLowerCase();
            displaytype = URL.substring(URL.indexOf('displaystyleno=') + 15, URL.length);
        }
        if (displaytype != undefined && displaytype.length < 2) {
            if (IsSocial == true) {
                SetIframeMenuSrc(StackArray[StackArray.length - 1], displaytype, 'Social');
            }
            else {
                SetIframeMenuSrc(StackArray[StackArray.length - 1], displaytype);
            }

        }
        else {
            if (IsSocial == true) {
                SetIframeMenuSrc(StackArray[StackArray.length - 1], '0', 'Social');
            }
            else {
                SetIframeMenuSrc(StackArray[StackArray.length - 1]);
            }

        }
        //  MainCategoryWithParam(StackArray[StackArray.length - 1]);
    }
    else {
        if (IsSocial == true) {
            MainCategory('Social');
        }
        else {
            MainCategory();
        }

        // window.location.href = "../MSIEMobile.aspx";
    }
}
function loadingiframeshow() {

    parent.SetSourceNew("/\loadingpage.html");
    parent.document.getElementById('frame_details').height = "250px";
}
function AppAutoLogin() {
    var req = null;
    req = initXMLHTTPRequestNew();
    if (req) {
        var myDate = new Date();
        var myTime = myDate.getTime();
        req.open("GET", "/\Mobile/AutoLogin.aspx?t=" + myTime, true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            if (ready == 4) {
                var result = req.responseText;
                //alert(result);
                if (req.responseText != "") {
                    parent.window.frames["IOfficeFrame"].location.replace(result);
                }
                // var result = req.responseText;
            }
        }
    }
    req.send("");
}

function Page_Init() {
    GetShopCount();
    AllMainFucntion()
    AddScriptFiles();
    HORIZONTAL_MENU_COMPONENT();
    NavigateByQueryString();
 

    //MainSlides_Load(true, 1, 6);
    // MainSlides_Load(true); //@It loads from image_private/main_image/main.html
}


function MainSlides_Load(Speed, Count) {
    var url = _Domain + "/Images_Private/Main_Image/Slides/~SlideNo~.htm";
    SlidePaging('SlidePagingContainer', "SlideShow_Load('" + url + "')", Count, "SlideShow_PlayPauseHandler()", true);
    //SlidePagingDynamic('SlidePagingContainer', "SlideShow_Load('" + url + "')", 1, "PageButtonClick=false;SlideShow_PlayPauseHandler()");
    SlideShow_AutoPlay(Speed, url);
}
function SignInSignOut() {
    AjaxCall('SignInSignOutDiv', '/Customer/SignInSignOut.aspx?BreakCache=' + new Date().getTime(), '');
}

function trackerMultipleProductsInsert(strProducts) {

    var parseCookie = new String(ReadCookie("infiniCookie"));
    if (parseCookie != "") {
        var arr = strProducts.split(",");
        for (i = 0; i < arr.length; i++) {
            var splitCookie = parseCookie.split("=");
            var parseUserId = splitCookie[1].split("&");
            var visiterId = parseUserId[0];
            var tempurl, tempStr, strLth;
            var newlth;
            tempurl = document.location.href;
            tempurl = tempurl.substring(tempurl.indexOf("//") + 2, tempurl.length);
            var tempStr = tempurl.split("/");
            var value = document.location.protocol + "//" + tempStr[0] + "/tracker/tracker.aspx?referrer=" + escape(document.referrer);
            var docLocation = document.location.href;
            value += "&customerId=" + visiterId;
            value += "&location=" + escape(docLocation) + "?product_id=" + arr[i] + '%26js=trackerMultipleProductsInsert()';
            var html_doc = document.getElementsByTagName("head").item(0);
            var scriptTag = document.createElement("SCRIPT");
            scriptTag.src = value;
            html_doc.appendChild(scriptTag);
        }
    }
}
/**
function ReviewContent(ProductID) {

UnLoadCommandsNew();
relatedProductBarHide();
var requestURL = window.location.protocol + '//' + window.location.host + '/Review/ReviewControl.aspx?product_id=' + ProductID;
parent.window.frames["frame_details"].location.replace(requestURL);


//        var req = null;
//        req = initXMLHTTPRequestNew();
//        if (req) {
//            var myDate = new Date();
//            var myTime = myDate.getTime();
//            req.open("GET", "/\ajax/RatingControl.aspx?product_id=" + CurrentProductID, true);
//            req.onreadystatechange = function() {
//                var ready = req.readyState;
//                if (ready == 4) {
//                    alert(req.responseText);
//                    var result = req.responseText;
//                    if (req.responseText != "") {
//                        document.getElementById("RatingContent").innerHTML = result;
//                    }
//                    // var result = req.responseText;
//                }
//            }
//        }
//        req.send("");
}
**/

function iPhoneDirectOpenProduct(ProductID) {
    //SetSourceNew("../loadingpage.html");
    var requestURL = window.location.protocol + '//' + window.location.host + '/loadingpage.html';
    parent.window.frames["frame_details"].location.replace(requestURL);
    RelatedProductNew(ProductID);
    ShowHideProductCommands('Product', ProductID, '?product_id=' + ProductID, ProductID, 'nosearch');
}

function AddComments(ProductId, Action) {
    //        var requestURL = window.location.protocol + '//' + window.location.host + '/Review/CommentsControl.aspx?product_id=' + ProductId + '&action=' + Action;
    //        document.location.replace(requestURL);
    //UnLoadCommandsNew();
    //relatedProductBarHide();
    var requestURL = window.location.protocol + '//' + window.location.host + '/Review/ReviewControl.aspx?product_id=' + ProductId;
    //parent.window.frames["frame_details"].location.replace(requestURL);
    window.location.replace(requestURL)
}
/*
function WriteComments(ProductID) {
UnLoadCommandsNew();
//relatedProductBarHide();
var requestURL = window.location.protocol + '//' + window.location.host + '/Review/CommentsControl.aspx?product_id=' + ProductID;
parent.window.frames["frame_details"].location.replace(requestURL);
}
*/

function WriteComments(ProductID, ReplyParams, CatParams) {
    UnLoadCommandsNew();
    //relatedProductBarHide();
    var Query = "";
    if (ReplyParams && ReplyParams != "") {
        Query = "&" + ReplyParams;
    }
    if (CatParams && CatParams != "") {
        Query = "&CatType=" + CatParams;
    }

    var requestURL = window.location.protocol + '//' + window.location.host + '/Review/CommentsControl.aspx?product_id=' + ProductID + Query;
    parent.window.frames["frame_details"].location.replace(requestURL);
}



function iOfficeAddProduct(CatID, CatName) {
    var requestURL = window.location.protocol + '//' + window.location.host + '/customer/home.aspx?CatID=' + CatID + '&CatName=' + CatName;
    parent.window.location.replace(requestURL);
}

function ReviewContent(ProductID) {
    try {
        var RatingPanel = GlobalObjectNew('RatingPanel');
        RatingPanel.style.display = "block";
        if (IsLoggedIn() == "True") {
            //UnLoadCommandsNew();
            var requestURL = window.location.protocol + '//' + window.location.host + '/Review/ReviewControl.aspx?product_id=' + ProductID + "&Display=rating";
            RatingPanel.innerHTML = "<iframe src='" + requestURL + "' width='100%' height='100%' frameborder='0' >"
            RatingPanel.style.width = "500px";
            RatingPanel.style.height = "230px";
            RatingPanel.style.border = 'dashed 1px #ccc';
            RatingPanel.style.left = (document.body.clientWidth / 2) - (parseInt(RatingPanel.style.width) / 2);
            RatingPanel.style.top = (document.body.clientHeight / 2) - (parseInt(RatingPanel.style.height) / 2);
            //window["frame_details"].location.replace(requestURL);
        } else {
            RatingPanel.innerHTML = "<span class='tooltipBalloon' onclick=this.style.visibility='hidden'><span class='tooltipBalloonTop'></span><span class='tooltipBalloonMiddle'>Please <a href=javascript:SetSourceNew('../Customer/SignIn.aspx');removeElement('SUB_CATEGORIES','SlidePagingContainer','ACTIVECOMMANDS','_TabsContainer');AutoResizeIFrame('frame_details','signin')>login</a> to your accout.</span><span class='tooltipBalloonBottom'></span></span>"
            RatingPanel.style.left = findPosXNew(document.getElementById("RatingFrameDiv2"));
        }
    }
    catch (ex) {
        alert(ex);
    }

}
/*
function Wap_AddComments(ContainerID, ProductID) {
var O = GlobalObjectNew(ContainerID);
try {
O.innerHTML = "<table width='95%' cellspacing='0' cellpadding='0' style='border:solid 1px #ccc' ><tr><td width='100%'><input id='tbWriteReview' type='text' style='width:100%; height:30px; border:0' /></td><td><img src='../images/sendicon.jpg' onclick=PAGEMETHODS_COMMENTS('AddComments','" + ProductID + "') /></td></tr></table>"

} catch (ex) {
alert(ex);
}
}*/

function Wap_AddComments(ContainerID, ProductID) {

    var O = GlobalObjectNew(ContainerID);
    try {
        //O.innerHTML = "<table width='100%' cellspacing='0' cellpadding='0' style='border:solid 1px #ccc' ><tr><td width='100%'><input id='tbWriteReview' type='text' style='width:100%; height:30px; border:0'  /></td><td><img src='../wap_images/sendicon.jpg' onclick=PAGEMETHODS_COMMENTS('AddComments','" + ProductID + "') /></td></tr></table>"
        O.innerHTML = "<table width='100%' cellspacing='0' cellpadding='0' style='border:solid 1px #ccc' ><tr><td width='100%'><input id='tbWriteReview' type='text' style='width:100%; height:30px; border:0'  /></td><td><img src='../images/sendicon.jpg' id='SendComments'  /></td></tr></table>";
        GlobalObjectNew('SendComments').onclick = function() {
            //onclick= WriteComments('" + ProductID + "','&action=WRITE&Comments="+ tb.value + "')
            var tb = GlobalObjectNew('tbWriteReview');
            WriteComments(ProductID, '&action=WRITE&Comments=' + tb.value + '');
        }

    } catch (ex) {
        alert(ex);
    }
}





function NavigateByQueryString() {
    var Search = queryStringNew("SK");
    var ShpppingCart = queryStringNew("VC");

    if (Search != "false") {
        SearchProductAtInfiniView(Search);

    } else if (ShpppingCart != "false") {
        SetSourceNew('/Shopping/Cart.aspx');
    } else {
        SetSourceNew("../Images_Private/Main_Image/main.aspx");
    }
}
