var basketBalloonTimeout; // ************************************************************ // Name : updateTradePrices() // Purpose : Update prices to reflect users login // Change Requests: // Name Date Summary // ************************************************************ function updateTradePrices(){ var strPath = (("https:" == document.location.protocol) ? "https://www.peeks.co.uk/api/" : "http://www.peeks.co.uk/api/"); var usertype = getCookie("usertype"); var userid = getCookie("userid"); var strHTML = ""; if(usertype==null||usertype.length<1){ }else{ if(usertype == "TRADE"){ var ids = ""; $jq("span[id^='LISTINGTRADEPRICE_']").each(function() { var id = this.id; var idNumber = id.replace("LISTINGTRADEPRICE_", ""); ids = ids + idNumber + ","; }); if(ids.length >0){ ids = Left(ids, ids.length-1); $jq.ajax({ type: "POST", url: strPath + "getTradePrices.aspx", dataType: 'json', data: {campaign: 'PEEKS', userid: userid, productids: ids}, async: false, success: function(j){ for (var i = 0 ; i < j.length ; i++) { if(j[i]["productid"].length > 0 && parseFloat(j[i]["tradepriceexvat"]) > 0){ strHTML = '
£' + j[i]["tradepriceexvat"].toFixed(2) + ' TRADE
'; document.getElementById("LISTINGTRADEPRICE_" + j[i]["productid"]).innerHTML = strHTML; document.getElementById("LISTINGCUSTOMERPRICE_" + j[i]["productid"]).style.display = "none"; }else{ document.getElementById("LISTINGTRADEPRICE_" + j[i]["productid"]).style.display = "none"; } } } }); } } } } // ************************************************************ // Name : showBasketPopup() // Purpose : Display the basket // Change Requests: // Name Date Summary // ************************************************************ function showBasketPopup(){ basketPopupOverlay.load(); //Make the background of everything else dark document.getElementById("basket").style.display = "block"; $jq("#basket").center(); getBasket(); } // ************************************************************ // Name : closeBasketPopup() // Purpose : Hide the basket // Change Requests: // Name Date Summary // ************************************************************ function closeBasketPopup(){ document.getElementById("basket").style.display="none"; basketPopupOverlay.close(); //Close overlay getBasketSummary(); } // ************************************************************ // Name : getBasket() // Purpose : Get basket contents // Change Requests: // Name Date Summary // ************************************************************ function getBasket(){ var usertype = getCookie("usertype"); var userid = getCookie("userid"); var strBasket = ""; if(usertype==null||usertype.length<1){usertype = "";} if(userid==null||userid.length<1) {userid = "";} $jq.ajax({ type: "GET", url: "/getBasket.aspx", dataType: 'html', data: {basket: document.getElementById("formBasket_strBasket").value, custombasket: document.getElementById("formBasket_strBalloonBasket").value, usertype: usertype, userid: userid}, async: true, success: function(strHTML){ //The results just need to be split var arraySplit = strHTML.split("*separator*"); document.getElementById("basketPopupScrollPanel").innerHTML = arraySplit[0]; document.getElementById("basketPopupFooterBar_intTotal").innerHTML = arraySplit[1]; strBasket = getCookie("Basket"); if(strBasket==null||strBasket.length < 1){ //Cannot be null really as we must have something in it in order to drag over to this remove product from basket handler! }else{ var j=eval("[" + strBasket + "]"); for (var i = 0 ; i < j.length ; i++) { eval(getTradePrice(j[i]["Id"])); } } } }); } // ************************************************************ // Name : getTradePrice() // Purpose : Get trade price for the basket contents // Change Requests: // Name Date Summary // ************************************************************ function getTradePrice(getTradePrice_strProductGUID){ var strReturn = ""; $jq.ajax({ async: false, url: "/getTradePrice.aspx", data: {type: "BASKET", id: getTradePrice_strProductGUID, priceexvat: "", template: 'tradepricelisting'}, dataType: "html", success: function(j) { strReturn = j; } }); return strReturn; } // ************************************************************ // Name : addAllToBasket() // Purpose : Add a list of product (must be non variants) to basket // Change Requests: // Name Date Summary // ************************************************************ function addAllToBasket(addAllToBasket_productIDs){ var arraySplit = addAllToBasket_productIDs.split(","); closeBasket(); showBasketBalloon(); var strBasket = ""; strBasket = getCookie("Basket"); for(var s = 0; s < arraySplit.length; s++){ var Id = arraySplit[s]; var quantity = 1; var variants = ""; if(strBasket==null||strBasket.length < 1){ strBasket = "{\"Id\":\"" + Id + "\",\"QTY\":\"" + quantity + "\",\"Variant\":\"" + variants + "\"}"; }else{ var bolFound = false; //We now see if this product already exists in the basket in order to increase the quantity var j = eval("[" + strBasket + "]"); strBasket = ""; for (var i = 0 ; i < j.length ; i++) { if(j[i]["Id"]==Id && j[i]["Variant"]==variants){ strBasket = strBasket + "{\"Id\":\"" + j[i]["Id"] + "\",\"QTY\":\"" + (parseInt(j[i]["QTY"])+parseInt(quantity)) + "\",\"Variant\":\"" + j[i]["Variant"] + "\"},"; bolFound = true; }else{ strBasket = strBasket + "{\"Id\":\"" + j[i]["Id"] + "\",\"QTY\":\"" + j[i]["QTY"] + "\",\"Variant\":\"" + j[i]["Variant"] + "\"},"; } } if(bolFound==false){ strBasket = strBasket + "{\"Id\":\"" + Id + "\",\"QTY\":\"" + quantity + "\",\"Variant\":\"" + variants + "\"},"; } strBasket = Left(strBasket, strBasket.length-1); } } setCookie("Basket", strBasket, "", "/", "", ""); if(strBasket.length > 0){document.getElementById("formBasket_strBasket").value = "[" + strBasket + "]";}else{document.getElementById("formBasket_strBasket").value = "";} getBasketSummary(); } // ************************************************************ // Name : getBasketSummary() // Purpose : Get basket summary // Change Requests: // Name Date Summary // ************************************************************ function getBasketSummary(){ var usertype = getCookie("usertype"); var userid = getCookie("userid"); var intQuantity = 0; var intTradeSubTotalExVAT = 0; var intTradeSubTotalIncVAT = 0; var intExVATSubTotal = 0; var intSubTotal = 0; if(usertype==null||usertype.length<1){usertype = "";} if(userid==null||userid.length<1) {userid = "";} //PERSONALISED BALLOONS if(document.getElementById("formBasket_strBalloonBasket").value.length>0){ var j = eval(document.getElementById("formBasket_strBalloonBasket").value); for (var i = 0 ; i < j.length ; i++) { intQuantity += parseFloat(j[i]["qty"]); if(usertype=="TRADE"){ intSubTotal = intSubTotal + (parseFloat(j[i]["exvattotal"])); }else{ intSubTotal = intSubTotal + (parseFloat(j[i]["total"])); } } } if(document.getElementById("formBasket_strBasket").value.length>0){ var strPath = (("https:" == document.location.protocol) ? "https://www.peeks.co.uk/api/" : "http://www.peeks.co.uk/api/"); $jq.ajax({ async: false, type: "POST", url: strPath + "getBasket.aspx", data: {campaign: "PEEKS", formBasket_strBasket: document.getElementById('formBasket_strBasket').value, usertype: usertype, userid: userid}, dataType: "json", success: function(j) { var strReturn = ""; for (var i = 0 ; i < j.length ; i++) { intQuantity += parseFloat(j[i]["QTY"]); intTradeSubTotalExVAT += parseFloat(j[i]["intTradeSubTotalExVAT"]); intTradeSubTotalIncVAT += parseFloat(j[i]["intTradeSubTotalIncVAT"]); intExVATSubTotal += parseFloat(j[i]["intExVATSubTotal"]); intSubTotal += parseFloat(j[i]["intSubTotal"]); } if(usertype=="TRADE"){ intSubTotal = parseFloat(intTradeSubTotalExVAT); } } }); } if(intQuantity > 0){ if(intQuantity==1){ document.getElementById("divBasketText").innerHTML = intQuantity + " item"; }else{ document.getElementById("divBasketText").innerHTML = intQuantity + " items"; } document.getElementById("divBasketTotal").innerHTML = "£" + intSubTotal.toFixed(2); if(document.getElementById("basketIcon")){document.getElementById("basketIcon").src = "/images/basket-full.png";} }else{ document.getElementById("divBasketText").innerHTML = "0 items"; document.getElementById("divBasketTotal").innerHTML = "£0.00"; if(document.getElementById("basketIcon")){document.getElementById("basketIcon").src = "/images/basket-empty.png";} } } // ************************************************************ // Name : removeFromBasket() // Purpose : Remove item from the basket // Change Requests: // Name Date Summary // ************************************************************ function removeFromBasket(Id, Variant) { var strBasket = ""; strBasket = getCookie("Basket"); if(strBasket==null||strBasket.length < 1){ //Cannot be null really as we must have something in it in order to drag over to this remove product from basket handler! }else{ var j=eval("[" + strBasket + "]"); strBasket = ""; for (var i = 0 ; i < j.length ; i++) { if(j[i]["Id"]==Id && j[i]["Variant"]==Variant){ // Remove completely }else{ strBasket = strBasket + "{\"Id\":\"" + j[i]["Id"] + "\",\"QTY\":\"" + j[i]["QTY"] + "\",\"Variant\":\"" + j[i]["Variant"] + "\"},"; } } strBasket = Left(strBasket, strBasket.length-1) } setCookie("Basket", strBasket, "", "/", "", ""); if(strBasket.length > 0){document.getElementById("formBasket_strBasket").value = "[" + strBasket + "]";}else{document.getElementById("formBasket_strBasket").value = "";} getBasket(); } // ************************************************************ // Name : removeFromCustomBasket() // Purpose : Remove item from the custom basket // Change Requests: // Name Date Summary // ************************************************************ function removeFromCustomBasket(Id) { var strBasket = ""; strBasket = getCookie("balloonBasket"); if(strBasket==null||strBasket.length < 1){ //Cannot be null really as we must have something in it in order to drag over to this remove product from basket handler! }else{ var j=eval("[" + strBasket + "]"); strBasket = ""; for (var i = 0 ; i < j.length ; i++) { if(j[i]["id"]==Id){ // Remove completely }else{ if(j[i]["type"] == "PERSONALISEDBALLOON" || j[i]["type"] == "PERSONALISEDBALLOONLOGO"){ strBasket = strBasket + "{\"id\":\"" + j[i]["id"] + "\",\"image\":\"" + j[i]["image"] + "\",\"logoid\":\"" + j[i]["logoid"] + "\",\"title\":\"" + j[i]["title"] + "\",\"type\":\"PERSONALISEDBALLOON\",\"reference\":\"" + j[i]["reference"] + "\",\"Size\":\"" + j[i]["Size"] + "\",\"Colour\":\"" + j[i]["Colour"] + "\",\"Font\":\"" + j[i]["Font"] + "\",\"Line-1-Size\":\"" + j[i]["Line-1-Size"] + "\",\"Neck-Down\":\"" + j[i]["Neck-Down"] + "\",\"Line1\":\"" + j[i]["Line1"] + "\",\"Line2\":\"" + j[i]["Line2"] + "\",\"Line3\":\"" + j[i]["Line3"] + "\",\"Line4\":\"" + j[i]["Line4"] + "\",\"total\":\"" + j[i]["total"] + "\",\"qty\":\"" + j[i]["qty"] + "\"},"; } } } strBasket = Left(strBasket, strBasket.length-1) } setCookie("balloonBasket", strBasket, "", "/", "", ""); if(strBasket.length > 0){document.getElementById("formBasket_strBalloonBasket").value = "[" + strBasket + "]";}else{document.getElementById("formBasket_strBalloonBasket").value = "";} getBasketSummary(); getBasket(); } function getProductVariations(strProductGUID){ var strReturn = ""; var intVariant = 1; var strRow = "odd" $jq.ajax({ async: false, url: "http://www.peeks.co.uk/api/doGetProductVariations.aspx", data: {campaign: "PEEKS", strGet: strProductGUID}, dataType: "json", success: function(j) { if(j.length == 0){ }else{ for (var i = 0 ; i < j.length ; i++) { if(j[i]["Status"]=="1"){ strReturn = strReturn + ""; strReturn = strReturn + "
')\">
"; //Variants for(var ii = 0; ii < j[i]["Variants"].length; ii++){ strReturn = strReturn + "" + j[i]["Variants"][ii]["Value"] + ""; } //Stock check if(parseFloat(j[i]["Stock"]) < 1){ strReturn = strReturn + "
Out of stock
"; }else{ //Variant Price if(j[i]["vatexempt"]=="true"){ strReturn = strReturn + "£" + j[i]["priceexvat"] + ""; }else{ if(j[i]["specialpriceincvat"] == "0" || j[i]["specialpriceincvat"] == "0.00"){ strReturn = strReturn + "£" + j[i]["priceincvat"] + ""; }else{ strReturn = strReturn + "£" + j[i]["specialpriceincvat"] + ""; } } strReturn = strReturn + "
"; intVariant++; } strReturn = strReturn + "\n"; if(strRow=="odd"){strRow = "even";}else{strRow = "odd";} //We check to see if actually all variants are out of stock and if so then of course we cannot add this to the basket if(parseFloat(j[i]["variantstocklevel"]) < 1){ document.getElementById("add-button").style.display = "none"; } } } } } }); return strReturn; } function addtobasket(Id, quantity){ addtobasketproducts(Id, quantity); } function closeBasket(){ document.getElementById('light').style.display='none'; basketOverlay.close(); //Close overlay } function addtobasketproducts(strProductGUID, intQuantity){ var strVariations = ""; var strReturn = ""; var variantProducts = ""; var strProductVariations = ""; var bolVariations = false; if(isNaN(intQuantity) == true){intQuantity = 1;} document.getElementById("add-button").style.display = ""; $jq.getJSON("http://www.peeks.co.uk/api/dogetaddtobasketproducts.aspx", {campaign: "PEEKS", strGet: strProductGUID}, function(j) { //data = "[]"; if(j.length == 0){ addproducttobasket(strProductGUID, intQuantity, ""); }else{ // Variation pop-up header and image strReturn = strReturn + "')\">"; if("BUNDLE" == j[0]["producttype"]){ strReturn = strReturn + "
" + j[0]["producttitle"] + " - "; if(j[0]["specialofferpriceexvat"] == "0.00"){strReturn = strReturn + "£" + j[0]["priceincvat"];}else{strReturn = strReturn + "£" + j[0]["specialofferpriceincvat"];} if(j[0]["saving"] != "0.00"){strReturn = strReturn + " Saving £" + j[0]["saving"];} strReturn = strReturn + "
"; }else{ //strReturn = strReturn + "
" + j[0]["producttitle"] + "
"; strReturn = strReturn + "
Please select your product option
"; } document.getElementById("headerBar").innerHTML = strReturn; strReturn = ""; for (var i = 0 ; i < j[0]["variants"].length ; i++) { strReturn = strReturn + "
" + j[0]["variants"][i]["title"] + "
"; if(j[0]["variants"][i]["headings"].length > 0){ strReturn = strReturn + ""; strReturn = strReturn + ""; strReturn = strReturn + " "; //Image column var strHeadingSplit = j[0]["variants"][i]["headings"].split(""); for(var s = 0; s < strHeadingSplit.length; s++){ strReturn = strReturn + ""; } strReturn = strReturn + ""; strReturn = strReturn + ""; strProductVariations = getProductVariations(j[0]["variants"][i]["productid"]); //It may be the case that although a product type should have variants, it may not have any and the default stock level is used instead if(strProductVariations == ""){ if(parseFloat(j[0]["variants"][i]["stocklevel"]) < 1){ strReturn = strReturn + ""; strReturn = strReturn + " "; strReturn = strReturn + " "; for(var s = 1; s < strHeadingSplit.length; s++){ strReturn = strReturn + ""; } strReturn = strReturn + " "; strReturn = strReturn + ""; document.getElementById("add-button").style.display = "none"; }else{ //We firstly determine whether this is a single product (not a bundle) because we can auto-add it to the basket if(j[0]["variants"].length==1){ addproducttobasket(strProductGUID, intQuantity, ""); return; }else{ strReturn = strReturn + ""; strReturn = strReturn + " "; strReturn = strReturn + " "; for(var s = 1; s < strHeadingSplit.length; s++){ strReturn = strReturn + " " } if(j[0]["variants"][i]["vatexempt"]=="true"){ strReturn = strReturn + " "; }else{ strReturn = strReturn + " "; } strReturn = strReturn + " "; strReturn = strReturn + ""; } } } strReturn = strReturn + strProductVariations + "
" + strHeadingSplit[s] + "  
')\">
Standard
Out of stock
')\">
Standard£" + j[0]["variants"][i]["priceexvat"] + "£" + j[0]["variants"][i]["priceincvat"] + "
"; variantProducts = variantProducts + j[0]["variants"][i]["productid"] + "," }else{ strReturn = strReturn + "
"; } } if(variantProducts.length>0){variantProducts = Left(variantProducts, variantProducts.length-1);} document.getElementById("variantQuantity").value = intQuantity; document.getElementById("variantProduct").value = strProductGUID; document.getElementById("variantProductsWithVariants").value = variantProducts; document.getElementById("scrollPanel").innerHTML = strReturn; document.getElementById("qtyInput").value = intQuantity; basketOverlay.load(); //Make the background of everything else dark document.getElementById('light').style.display = 'block'; $jq("#light").center(); } } ); } function minusQuantity(){ var intQuantity = parseInt(document.getElementById('qtyInput').value); if(intQuantity>1){ document.getElementById("qtyInput").value = intQuantity-1; } } function plusQuantity(){ var intQuantity = parseInt(document.getElementById('qtyInput').value); if(intQuantity<999){ document.getElementById("qtyInput").value = intQuantity+1; } } function GetRadioButtonValue(id) { var radio = document.getElementsByName(id); for (var ii = 0; ii < radio.length; ii++) { if (radio[ii].checked) return radio[ii].value; } } function addtobasketproductwithvariants(strRadioButton, intQuantity){ if(isNaN(intQuantity)==true){intQuantity = 1;} var arraySplit = document.getElementById("variantProductsWithVariants").value.split(","); var chosenVariants = ""; for(var s = 0; s < arraySplit.length; s++){ chosenVariants = chosenVariants + GetRadioButtonValue(strRadioButton + arraySplit[s]) + ","; } if(chosenVariants.length>0){chosenVariants = Left(chosenVariants, chosenVariants.length-1);} //We now also set the quantity to the quantity box in the pop-up if(document.getElementById("qtyInput").value=="0"){ closeBasket(); }else{ document.getElementById("variantQuantity").value = intQuantity; //document.getElementById("qtyInput").value; addproducttobasket(document.getElementById("variantProduct").value, document.getElementById("variantQuantity").value, chosenVariants); } } function addskewtobasket(addskewtobasket_strProductGUID, addskewtobasket_strSkew, addskewtobasket_strRedirect){ setCookie("skew_" + addskewtobasket_strProductGUID, addskewtobasket_strSkew, "", "/", "", ""); if(addskewtobasket_strRedirect.length > 0){ addproducttobasket(addskewtobasket_strProductGUID, 1, "", addskewtobasket_strRedirect); }else{ addproducttobasket(addskewtobasket_strProductGUID, 1, ""); } } function addproducttobasket(Id, quantity, variants, redirect){ var strBasket = ""; closeBasket(); showBasketBalloon(); //deleteCookie("Basket"); strBasket = getCookie("Basket"); if(strBasket==null||strBasket.length < 1){ strBasket = "{\"Id\":\"" + Id + "\",\"QTY\":\"" + quantity + "\",\"Variant\":\"" + variants + "\"}"; }else{ var bolFound = false; //We now see if this product already exists in the basket in order to increase the quantity var j = eval("[" + strBasket + "]"); strBasket = ""; for (var i = 0 ; i < j.length ; i++) { if(j[i]["Id"]==Id && j[i]["Variant"]==variants){ strBasket = strBasket + "{\"Id\":\"" + j[i]["Id"] + "\",\"QTY\":\"" + (parseInt(j[i]["QTY"])+parseInt(quantity)) + "\",\"Variant\":\"" + j[i]["Variant"] + "\"},"; bolFound = true; }else{ strBasket = strBasket + "{\"Id\":\"" + j[i]["Id"] + "\",\"QTY\":\"" + j[i]["QTY"] + "\",\"Variant\":\"" + j[i]["Variant"] + "\"},"; } } if(bolFound==false){ strBasket = strBasket + "{\"Id\":\"" + Id + "\",\"QTY\":\"" + quantity + "\",\"Variant\":\"" + variants + "\"},"; } strBasket = Left(strBasket, strBasket.length-1) } setCookie("Basket", strBasket, "", "/", "", ""); if(strBasket.length > 0){document.getElementById("formBasket_strBasket").value = "[" + strBasket + "]";}else{document.getElementById("formBasket_strBasket").value = "";} if(redirect==undefined){ getBasketSummary(); }else{ window.location = redirect; } } // ************************************************************ // Name : showBasketBalloon() // Purpose : Show the basket balloon // Change Requests: // Name Date Summary // ************************************************************ function showBasketBalloon(){ basketOverlayBalloon.load(); //Make the background of everything else dark // Position the basket balloon var arrayBasketPosition = findElementPosition(document.getElementById("shoppingbasket")); document.getElementById("basketBalloon").style.top = arrayBasketPosition[1]+50 + "px"; document.getElementById("basketBalloon").style.left = arrayBasketPosition[0]-310 + "px"; document.getElementById("basketBalloon").style.display = "block"; //Take user to top of page in order to see basket balloon scroll(0,0); basketBalloonTimeout = setTimeout(closeBasketBalloon,3000); } // ************************************************************ // Name : gotoCheckout() // Purpose : Redirect user to checkout // Change Requests: // Name Date Summary // ************************************************************ function gotoCheckout(){ closeBasketBalloon(); window.location = "/checkout.aspx"; } // ************************************************************ // Name : closeBasketBalloon() // Purpose : Hide the basket balloon // Change Requests: // Name Date Summary // ************************************************************ function closeBasketBalloon(){ document.getElementById("basketBalloon").style.display = "none"; basketOverlayBalloon.close(); clearTimeout(basketBalloonTimeout); //We need to determine whether a product was added into the basket on the checkout page because if so then the whole checkout needs to be refreshed var url = window.location.pathname; var filename = url.substring(url.lastIndexOf('/')+1); if(filename=="checkout.aspx"){window.location="checkout.aspx";} } // ************************************************************ // Name : findElementPosition() // Purpose : Find the position of the basket image // Change Requests: // Name Date Summary // ************************************************************ function findElementPosition(obj) { var curleft = curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); return [curleft,curtop]; } } function Left(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else return String(str).substring(0,n); } function Right(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else { var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } } // ************************************************************ // Name : checkNumeric() // Purpose : Make sure only numbers can be added into text box // Change Requests: // Name Date Summary // ************************************************************ function checkNumeric(booAllowFullstop) { // Allow chars between 0 - 9. Allow fullstop if booAllowFullstop = true if ((window.event.keyCode < 48 || window.event.keyCode > 57) && (window.event.keyCode != 45) && (window.event.keyCode != 46 || !booAllowFullstop)) { window.event.keyCode = 0; // Don't allow any other character } } // ************************************************************ // Name : getWindowSize() // Purpose : Find size of users browser window // Change Requests: // Name Date Summary // ************************************************************ function getWindowSize() { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer if(document.documentElement.clientWidth){ windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = xScroll; } else { pageWidth = windowWidth; } return [pageWidth,pageHeight]; } // ************************************************************ // Name : logOut() // Purpose : Clear the user cookies and redirect to home page // Change Requests: // Name Date Summary // ************************************************************ function logOut() { setCookie("userid", "", "", "/", "", ""); setCookie("usertype", "", "", "/", "", ""); //window.location.reload(); window.location = "/"; }