// ProductPage.js


var httpRequestSupported = true;
var errorMessageString = "";

/*This function is to display the glossary. This function is called after the ajaxCall() in case of a glossary link.
We pass the html to be displayed in the pop-up as well as the id of the html element in this case it being a link */
function showGlossary(value,linkId){
        
    var hyperlinks = document.getElementsByTagName("a");
    for (var i=0; i<hyperlinks.length; i++) {
        if (hyperlinks[i].id == linkId){
            findPos(hyperlinks[i]);
            define(value);
        }
    }
}  

/*This function is to display the glossary. This function is called after the ajaxCall() in case of a glossary image.
We pass the html to be displayed in the pop-up as well as the id of the html element in this case it being an image */
function showImageGlossary(value,imageId){
        
    var images = document.getElementsByTagName("img");
    for (var i=0; i<images.length; i++) {
        if (images[i].id == imageId){
            findPos(images[i]);
            define(value);
        }
    }
} 

function showEnergyGuide(value){ 
        document.getElementById("energyGuideDiv").innerHTML = value;
        document.getElementById("energyGuideDiv").style.display="block";
}  

/*To display the contents inside the div after the ajax call*/
function displayTabContent(value,id){
    var zipCode = getCookie('zipCode'+storeId);
    document.getElementById('tab3').style.display="none";
    document.getElementById(id).innerHTML = value;
    if ((zipCode != '') && (zipCode != null) && (zipCode != "undefined") && (id=="tab3"))
    {
        document.getElementById('tab3').style.display="block";
        var tempForm = document.zipForm;
        if(tempForm){
            document.zipForm.zipCode.value=zipCode;
            document.zipForm.style.display="none";
            if(document.zipFormWithZip){
            document.getElementById('zipFormWithZip').style.display="block";
            document.getElementById('zippe').innerHTML=zipCode;
            document.getElementById('zipFormWithZip').zipCode.value=zipCode;
            }
            zipChangedProductPageWithZip();
        }
     } 
     else if(id=="tab3")
     { 
             document.getElementById('tab3').style.display="block";

     }
}


//Ajax call using post method
function ajaxCallUsingPost(url,callbackFunction,returnData,linkId,params) { 
    var httpRequest = false; 
	if(typeof jspStoreImgDir !='undefined' && jspStoreImgDir!="")
		imagePath=jspStoreImgDir;
    // Exit if this function is not supported
    if (!httpRequestSupported) {
        return;  
    }
    
    // check if supported
    httpRequest = isHttpRequestSupported();
    if (!httpRequest) { 
        httpRequestSupported = false;
        return false; 
    } 
    httpRequest.open('POST', url, true);
    //Send the proper header information along with the request
    httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    httpRequest.setRequestHeader("Content-length", params.length);
    httpRequest.setRequestHeader("Connection", "close");    
    // Map the response to the callback function
    httpRequest.onreadystatechange = function() { 
        if (httpRequest.readyState == 4) {  
            if (httpRequest.status == 200) {
                if (returnData) { 
                    eval(callbackFunction + '(httpRequest.responseXML,linkId)'); 
                } else { 
                    eval(callbackFunction + '(httpRequest.responseText,linkId)'); 
                } 
            } else { 
                // TODO:  Keep this line commented in production.  The user will have no idea what this means.
                //('The AJAX request was made to our backend server and the following error occurred: ' + httpRequest.status); 
                eval(callbackFunction + '("")'); 
            } 
        }
        else{
            if(callbackFunction == 'displayTabContent'){
                htmlValue = "<img src= '"+ imagePath + "img/backgrounds/loading.gif' />";
                document.getElementById(linkId).innerHTML = htmlValue;
            }
        } 
    } 
    httpRequest.send(params); 
}




function showSendToFriend(value)
    {
        var userDetail=value.split('%#%');
        send2friend('crumbWrapper',userDetail);
    }

/*
 * NEW :  Function called after the ajaxCall completes execution on clicking
 *        of add to wishlist button
 */
function fnAjaxReturnAddToWishlist(value)
{
    
    object = document.getElementById("addToWishListButton");
        flag = '';
    if(value == "Success")
    {
        if(document.getElementById("remembered")!=null)
         {
           var remem = document.getElementById("remembered").value;
            if(remem=="yes")
                flag = 'error8';
         }
        else        
          flag = 'error6';
        
        showErrorPopUpBox(object,flag);
    }else if(value == "Redirect")
    {
        showLogonForm();
    }
    else
    {
        wishlistExceptionMessage = value;
        showErrorPopUpBox(object,flag);
    }
}

//Function to set Omniture variables for Print

function printProdPage(){
s.pageName.Value = 'Product Summary > Print';
omnitureTracking('Print');
print();
}

//Function to set Omniture variables for Helper

function searsHelpClick(targetUrl,popUp,dimensions,helperType){
if(helperType=='A'){
	s.pageName.Value = 'Product Summary > Advisor';
	omnitureTracking('Advisor');
}
else if(helperType=='G'){
	s.pageName.Value = 'Product Summary > Buying Guide';
	omnitureTracking('Buying Guide');
}
else if(helperType=='B'){
	s.pageName.Value = 'Product Summary > Brochure';
	omnitureTracking('Brochure');
}
	window.open(targetUrl,popUp,dimensions);
}

//Function to set Omniture variables for Video
function playVideo(videoUrlList,newWindow,dimensions){
s.pageName.Value = 'ProductSummary > Video';
omnitureTracking('Video');
window.open(videoUrlList,newWindow,dimensions);
}

//Function to set Omniture variables for Brochure
function ownersManual(targetUrl,popUp,dimensions){
s.pageName.Value = 'ProductSummary > Brochure';
omnitureTracking('Brochure');
window.open(targetUrl,popUp,dimensions);
}



function getAddToWishlistStatus(value)
{
    object = document.getElementById("addToWishListButton");
    flag = '';
    if(value == "Success")
    {
        flag = 'error6';
        showErrorPopUpBox(object,flag);
    }
    
    else if(value == "Redirect")
    {
       showLogonPage();
    }
    else  
    {
        wishlistExceptionMessage = "Unable to add item to wishlist";
        showErrorPopUpBox(object,value);
    }
    
}

function getAddToRegistryStatus(value)
{
    
    object = document.getElementById("addToRegistry");
    flag = '';
    
    if(value.substring(7,value.length) == 'ItemsExceeded'){
    
    flag = value.substring(7,value.length);
    
    }
     else {
    
    if(value.substring(0,7) == "Success")
    {
        if(document.getElementById("remembered")!=null)
        {
           var remem = document.getElementById("remembered").value;
           if(remem=="yes")
                flag = 'error11'+value.substring(7,value.length);
           else
                flag = 'error7'+value.substring(7,value.length);
        }
        else
            flag = 'error7'+value.substring(7,value.length);
    }
   }
    showErrorPopUpBox(object,flag);
    cursor_Default();
}

function getAddToNewWishList(value)
{
    object = document.getElementById("addToNewWishList");
    flag = '';
    
    if(value.substring(7,value.length) == 'ItemsExceeded'){
    
    flag = value.substring(7,value.length);
    
    }
     else {
    
    
    if(value.substring(0,7) == "Success")
    {
        if(document.getElementById("remembered")!=null)
        {
           var remem = document.getElementById("remembered").value;
           if(remem=="yes")
                flag = 'error12'+value.substring(7,value.length);
           else
                flag = 'error9'+value.substring(7,value.length);
        }
        else
            flag = 'error9'+value.substring(7,value.length);

    }
   }
    showErrorPopUpBox(object,flag);
    cursor_Default();
}




addLoadEvent( function() 
    { 
    
    //start
    
    var a=document.getElementsByTagName('a');
        for (i=0;i<a.length;i++)
        {
            if (a[i].rel=='emailMe')
            {
                
                a[i].onclick = function (){
                    mePop(this.getAttribute('info'),this.rel);
                };
            }
            
        }
    
    //end

        //setRequestProperties();
        if(document.getElementById("addToWishListButton"))
        {
            displayErrorPopUp_WishList();
        }
        if(document.getElementById("addToCartButton"))
        {
            displayErrorPopUp_Cart(); 
        }
        //breadCrumbsForProductPage();
        //pickupOnLoad();
        //parseUrl();
    }
);





function rtrim (s){
    
   return s.replace( /\s*$/, "" );
}

function ltrim ( s ){
    
  return s.replace( /^\s*/, "" );
}

function displayMoreOffer(url)
    {
        var object = document.getElementById("specialOfferLink");
        var oy = findPosY(object);
        var ox = findPosX(object);
        xPos = ox+20;
        yPos = oy-130;
        define(url);
    }
function getNewCookieValue(cookievalue,partNumFromUrl){


var temcookiesplit = cookievalue.split('^');

var finalUrl='';
var returnUrl='';
var partNumArray=new Array();
var tempLength = temcookiesplit.length;

for (var i=0;i<tempLength-1;i++){
    /*  
    if(temcookiesplit[i] != partNumFromUrl){
        partNumArray[i]=temcookiesplit[i];
    }else{
        partNumArray[i]='undefinednum';
    }*/
            
    if(temcookiesplit[i] != partNumFromUrl){
    finalUrl= finalUrl+temcookiesplit[i]+'^';
    
    }
}

returnUrl=partNumFromUrl+'^'+finalUrl;
return returnUrl;

}

function getWithEvarUrl(url){
    var vName = gup('vName');
    var cName = gup('cName');
    var sName = gup('sName');
    window.location = url + "vName="+vName + "&cName="+cName+ "&sName="+sName+ "&mv=rp";
}

function getUrl(url){
    var vName = gup('vName');
    var cName = gup('cName');
    var sName = gup('sName');
    window.location = url + "vName="+vName + "&cName="+cName+ "&sName="+sName;
}

function getColorAndUrl(url,colorName,colorClass){
	if(colorName!= undefined && colorName!='' )
	{	
		$("div.attributes .color strong").html(colorName);
		colorClass.className='selected';
	}
	getUrl(url);
}


/*commented for testing great price with the following code in global.js
function greatPrice(def) {
    if(!document.createElement) return false;
    var defDiv = document.createElement("div");
    document.body.appendChild(defDiv);
    defDiv.id = 'greatPrice';
    defDiv.className = 'floatWindow';
    defDiv.innerHTML = "<p onclick='remove(this.parentNode);'><a href='javascript:;' class='closeWindow'>Close</a></p><br clear='all'>" + "<p>" + def + "</p>";
    defDiv.style.top = yPos - defDiv.offsetHeight + 15 + "px";
    defDiv.style.left = xPos - defDiv.offsetWidth + "px";
}

function prepareGreatPrice() {
    if(!document.getElementsByTagName) return false;
    var links = document.getElementsByTagName("a");
    for (var i=0; i<links.length; i++) {
        if (links[i].className == "greatPrice"){
            links[i].onclick = function() {
                if(!document.getElementById("greatPrice")) {
                    findPos(this);
                    greatPrice(this.getAttribute("info"));
                } else {
                    var details = document.getElementById("greatPrice")
                    document.body.removeChild(details);
                    findPos(this);
                    greatPrice(this.getAttribute("info"));
                }
            }
        }
    }
}
addLoadEvent(prepareGreatPrice);*/

// START - From HardlineProduct.jsp     
function outOfStock(obj){
           var mesg = "Product is Out of stock";
           showErrorMsgPopUpBox(obj,mesg,'Cart');
          
}
// END - From HardlineProduct.jsp

// START - CollectionProduct.jsp
function checkQtyAndGetItem(item, catEntryId, isInStock, qty,isStorePick) {
    var qty = rObj(qty).value;
    if(qty != '' && (isNumeric(qty) == 0) && (qty > 0) ) {
        addItem(item, catEntryId, isInStock,isStorePick);
    } else {    
        var mesg = 'Quantity must be a positive number.  Please enter the quantity again.';
        showErrorMsgPopUpBox(item,mesg,'Cart');
    }
}
// END - CollectionProduct.jsp

// START - Softlineproduct.jsp
function checkQtyAndAddToWishList() {
    var qty = rObj('p0_qty').value;
    if(qty != '' && (isNumeric(qty) == 0) && (qty > 0) ) {
        return qty;
    }
     else {
        return 0;
    }
    return 0;
}
// END - Softlineproduct.jsp

// START - AddTogiftregistrtryDisplay.jsp
function Add2WishList(toform, fromForm, catEntryId, catEntryQuantity)
{
    if (!busy) {
        busy = true;
        toform.action='GiftRegistryItemAdd';
        toform.catEntryId.value = catEntryId;
        toform.productId.value = catEntryId;
        toform.quantity.value = catEntryQuantity;       
        toform.URL.value='GiftRegistryItemUpdateView';
        toform.externalId.value=toform.wishListId.value;
        toform.submit();
    }
}
// END - AddTogiftregistrtryDisplay.jsp

// START - CachedBreadCrumb.jsp
/*This function replaces special character in the URL */
function urlDecodeUrl(str) {
    var string=str.split("%27").join("\'").split("+").join(" ").split("%2C").join(",").split("%26").join("&").split("%24").join("$").split("%20").join(" ").split("%28").join("(").split("%29").join(")").split("%5B").join("[").split("%5D").join("]").split("%5E").join("^").split("%3A").join(":").split("%2C").join(",").split("%2F").join("/");
    return string;
}   
// END - CachedBreadCrumb.jsp

// START - CachedIncentiveMessage.jsp
function openPopUpForSpecialFinancing(url){         
         window.open(url,"SpecialFinance","location=no,resizable=yes,scrollbars=yes,toolbar=yes,toolbar=no,status=no,menubar=0");
}
// END - CachedIncentiveMessage.jsp


// START - CachedProductAttrSelection.jsp
/* This function will replace the bad char with the appropriate character */
function replaceFitChar(origString,inChar,outChar) {
    var newString = origString.split(inChar);  
    newString = newString.join(outChar);  
    return newString;
}
// END - CachedProductAttrSelection.jsp

// START - EmailMeEligible.jsp
function closeThisDiv() {
    document.getElementById('EmailMeEligible1').style.display = 'none';
}

function submitForm (email) {
    if(validateEmailAddress(email)) {
        submitEmail();
    }
}
// END - EmailMeEligible.jsp


// START - ProductReview.jsp
/*Following Methods are moved to store specific global.js - JS code cleanup
BVcheckLoadStateRdNew()
checkEmailChar(temail)

//Following methods are removed as it already present in store specific global.js
getCookie(cookieName)
setCookie(cookieName,cookieValue)
*/
// END - ProductReview.jsp

// START - ViewSimilarItems.jsp
function setNextPage(url) {
        window.location = url;
    }
// END - ViewSimilarItems.jsp


// START - ProductActions.jsp   
function submitAddToCart(isSmartCartFlag){


    if(document.addToCart.addToCartBtn.value == 'false') {
    
        if(typeof allRegiSS != 'undefined' && allRegiSS.length >0){
            var regZip = getCookie('zipCode');
            document.forms['addToCart'].zipCode.value = regZip;
        }
		var quantity = checkHardlineQuantity();
		if(quantity > 0) {
			if(typeof  allRegiSS != 'undefined' && allRegiSS.length >0){
	            var regZip = getCookie('zipCode');
	            document.forms['addToCart'].zipCode.value = regZip;
	        }
	        //Add to cart button has been clicked once
	        document.addToCart.quantity_1.value = quantity;
	        //document.addToCart.submit();
	
	var qsMode = "OtherMode";
			var qsHardline = "";
			var SmartCartFlag = isSmartCartFlag;
			var img = "http://s.sears.com/is/image/Sears/"
			var image = imgSmartCart;
	    	var displayValue=isSmartCartFlag+"^"+img+"^"+qsMode;
		  	var sid = document.addToCart.storeId.value;
		    var lid = document.addToCart.langId.value;
		    var cid = document.addToCart.catalogId.value;
		    var indicatorA = document.addToCart.IndicatorA.value;
		    var vName = document.addToCart.vName.value;
		    var cName = document.addToCart.cName.value;
		    var sName = document.addToCart.sName.value;
		    //var qsAdd = document.addToCart.qsAdd.value;
		   	var addToCartBtn = document.addToCart.addToCartBtn.value;
		    var catEntryId = document.addToCart.catEntryId_1.value;
		    var partNumber = document.addToCart.partNumber.value;
		    var grUserType = document.addToCart.grUserType.value;	
		
		
		displayValue=SmartCartFlag+"^"+img+"^"+qsMode+"^"+sid+"^"+cid+"^"+vName+"^"+cName+"^"+sName;
		
		 	var url = "ProductOptionsOrderItemAddCmd?storeId=" + sid + "&langId="+lid+ "&catalogId="+cid+"&indicatorA="+indicatorA+"&vName="+vName+"&cName="+cName+"&sName="+sName+"&URL=SmartCartUpdateView&quantity="+quantity+"&catEntryId_1="+catEntryId+"&partNumber="+partNumber+"&addToCartBtn="+addToCartBtn+"&grUserType="+grUserType+"&qsHardline="+qsHardline+"&url=SmartCartUpdateView&fwdURL=SmartCartUpdateView";
		    ajaxCall(url,'addToCartAjax',null,displayValue);
	
	        document.addToCart.addToCartBtn.value = 'true';
		} else {
			var objImage = document.getElementById('cart_enable');
			var mesg = "Please enter a valid quantity";
		 	showErrorMsgPopUpBox(objImage,mesg,'Cart');
		}
    } 
}


	

function proceedToUpdateItem(value,objImage)
{
document.getElementById("itemsInCart").innerHTML = value;
var prodURL =document.location.search;	
var orderId="";
var orderItemId_2=""; 
var rowCount="0";
var temp=prodURL.split("&");
    for(var i=0;i<temp.length;i++)
    {
    	if(temp[i].search("orderId") != -1)
    	{
   		orderId=temp[i].substring(temp[i].indexOf("=")+1,temp[i].length);
    	}
    	    	 	
	}
	orderItemId_2=document.getElementById('updateOrderItemId').value;
	

	if(document.addToCart.addToCartBtn.value == 'false') {
		//Add to cart button has been clicked once
		var qty = checkHardlineQuantity(objImage);
		if(qty > 0){
		
			 /* Added for Smart Cart --Start */
		  
		  	var sid = document.addToCart.storeId.value;
		    var lid = document.addToCart.langId.value;
		    var cid = document.addToCart.catalogId.value;
		    var indicatorA = document.addToCart.IndicatorA.value;
		    var vName = document.addToCart.vName.value;
		    var cName = document.addToCart.cName.value;
		    var sName = document.addToCart.sName.value;
		    //var qsAdd = document.addToCart.qsAdd.value;
		   	var addToCartBtn = document.addToCart.addToCartBtn.value;
		    var catEntryId = document.addToCart.catEntryId_1.value;
		    var partNumber = document.addToCart.partNumber.value;
		    var grUserType = document.addToCart.grUserType.value;
		    var url = "OrderItemUpdate?storeId=" + sid + "&langId="+lid+ "&catalogId="+cid+"&orderId="+orderId+"&orderItemId_1="+orderItemId_2+"&quantity_1=0&errorViewName=SmartCartUpdateView&updatePrices=1&URL=SmartCartUpdateView&quantity_2="+qty+"&catEntryId_2="+catEntryId+"&addToCartBtn="+addToCartBtn+"&grUserType="+grUserType+"&smartCartFlag=1&parentCatalogId="+'${parentCatalogId}';
		
		   
		    ajaxCall(url,'updateItemAjaxFromProduct');
	
			/* Added for Smart Cart --End */
			
			document.addToCart.quantity_1.value = qty;
			
			/* Commented for Smart Cart --Start */
				//document.addToCart.submit();
			/* Commented for Smart Cart --End */
			document.addToCart.addToCartBtn.value = 'true';
		}
	} 
} 

/*function showSmartCartfullview(value){
document.getElementById("items").innerHTML = value;
//alert("smartcartview is finished");
}*/

function updateItemAjaxFromProduct(value){
	
		document.getElementById("smartcartresponse").innerHTML=value;
		var status=document.smartcartresponseform.status.value;
		
		var trimVal = trim(status);
		if(trimVal== "SUCCESS") 
		{
		
		var orderItemId=document.getElementById('updateOrderItemId').value;
		
		if(document.getElementById("postOrderItemId").value!=null){
		
		var newOrderItemId=document.getElementById("postOrderItemId").value;
		var tempRowId="#row_"+newOrderItemId+"_id";		
		var newItemROw='#'+newOrderItemId;
		var newHTML=jQuery(newItemROw).parent().parent().html();		
		var oldItemRow='#'+orderItemId;	
		jQuery(oldItemRow).parent().parent().html(newHTML);	
		var blankVal = '';
		jQuery(tempRowId).html(blankVal);				
		document.getElementById('updateOrderItemId').value=newOrderItemId;		
		
		
		}
			refreshDetails();
			var referanceRow="#"+newOrderItemId;
			var rewrite= jQuery("#"+newOrderItemId).parent();
			
			jQuery("#cartNav").click();
			if ((jQuery('#show').text() == 'Show Cart')){				
	  			jQuery("#show").click();  	
  			}
  			var JQobject = jQuery(referanceRow);  		
  			var updateAttributeFlag="true";  		
  			updateItemsEffect(JQobject,updateAttributeFlag);
  			
 
		}
		else{			
			message(trimVal,'error');
		}
	document.addToCart.addToCartBtn.value = 'false';
}

/**For Updating softline Items**/
function updateSoftLineItem(referance,parentCatalogId,storeId){
referanceToButton=referance;
var showcartUrl="SmartCartView?catalogId="+parentCatalogId+"&storeId="+storeId;
	if(document.addToCart.addToCartBtn.value=='false'){
		ajaxCall(showcartUrl,'showFullCart');		
		document.addToCart.addToCartBtn.value='true';
		
	}
}

function cursor_wait()
{
    Load.style.display = "block";
    
}
function cursor_Default()
{
    Load.style.display = "none";
    
}

function hardAddTocartBtn(val){

    /*0 add to cart disabled
      1 add to cart enabled*/
    var elemEn = document.getElementById('cart_enable');
    if(val == 0){
        if(elemEn) {    
        elemEn.style.display = "none";  
        }   
    }else if(val == 1){
        if(elemEn) {
        elemEn.style.display = "block"; 
       }    
    }
}

function checkZipPA(zip,objImg) 
{
 
  var lv_pattern = /^\d{5}$|^\d{5}\-?\d{4}$/;
  var passed = lv_pattern.test(zip); 
  if (!passed) 
  {
        
        var mesg = 'Please enter a valid 5-digit ZIP code (example: 60515).';
        
        showErrorMsgPopUpBox(objImg,mesg,'ZipCodeEnter');
        return false;
  }
  else 
  {
    return true;
  }
}

function hidePickUpOptions() {
 
    shipMsgDiv.innerHTML = '&nbsp;';
    shipMsgDiv.style.display = "block";
}


/*Code for caching of the error or popup messages*/
var addToWishlistCalled = gup('addToWishlistCalled');
var cartException = "3";
var wishlistException = "3";
var wishlistErrorFlag = gup('errorMessage');
var wishlistExceptionMessage = "";
var cartExceptionMessage = errorMessageString;

if(addToWishlistCalled == 'YES')
{
      
    if(wishlistErrorFlag!="")
    {
        /*The exception message was picked from the url variable errorMessage*/
        wishlistException = "1";
        wishlistExceptionMessage = "Unable to add item to wishlist";
    }
    else
    {
        /*There was no exception thrown*/
        
        wishlistException = "0";
    }
}

if(errorMessageString !="")
{
    /*The exception message was picked from the errormessagescart.jspf*/
    cartException = "1";
}
function displayErrorPopUp_WishList()
{

    /*Setting an empty to string to type of error message*/
    var value = "";
    if(wishlistException != "3")
    {
        /*Add to wishlist button has been clicked*/
        if(wishlistException == "0")
        {
            /*Item was added successfully*/
            value="error6";
        }
        object = document.getElementById("addToWishListButton");
        showErrorPopUpBox(object,value);
    }
}


function displayErrorPopUp_Cart()
{
    /*Setting an empty to string to type of error message*/
    
    var value = "";
    if(cartException != "3")
    {
        /*The add to cart button had been clicked*/
        if(cartException == "1")
        {
            /*An exception had occured*/
            object = document.getElementById("addToCartButton");
            showErrorPopUpBox(object,value);
        }
    }
}

function showStoreShipMsg() 
{    
    holidayShipCalComboDelivery();
    shipEnterZipDiv.style.display = "none";
    shipEnterZipDivNew.style.display = "block";
    displayZipDiv.style.display = "block";
}
//For showing or hiding Return to QuickShop link
function quickShopParseUrl(){
    var quickShopMode = gup('qsMode');
    var qsAdd = gup('qsAdd');
    if(quickShopMode=="search" && (qsAdd == null || qsAdd == "")){
        document.getElementById("returnQuickShop").style.display="block";
    }
    else{
        if(document.getElementById("returnQuickShop")){
            document.getElementById("returnQuickShop").style.display="none";
        }
    }
}
/*call quickShopParseUrl on page load only if qsMode  is search*/
/* Commenting out the reference for 'return to quickshop' same as of production ECOM-34102
if("search"==gup('qsMode')){
    addLoadEvent(quickShopParseUrl);
} */

// END - ProductActions.jsp 
//Function to update partnumber and storeId
function fnPartNumValue(pickUpValue)
{
	if((location.href).indexOf('?')>=0)
	{
		var searchUrl=((location.href).split('?'));
		var searchItem=searchUrl[0];
	}
	else
	{
		var searchItem=(location.href);
	}
	var partNumberTemp=((searchItem).split('_'));
	var pickUp=pickUpValue;
	var tempStoreId=partNumberTemp[1];
  	var tempPartNumber=partNumberTemp[3];
   	
   	//Checking whether the store is KMart
   	if(tempStoreId==10151)
  	{
 		if(pickUp==1)
		{
			// appending "0" to part number if product is store pickup enabled
			tempPartNumber+="|0";
			updateRecentlyViewedCookie(tempPartNumber,tempStoreId);
		}
		else
		{
			// appending "1" to part number if product is store pickup enabled
			tempPartNumber+="|1";
			updateRecentlyViewedCookie(tempPartNumber,tempStoreId);
		}	
	}
}
//Function to update recently viewed cookie

function updateRecentlyViewedCookie(partNum,strId){
    
   
    //Check if allRegiSS.length is greater than zero
    //If yes then it is zipcode priced item
    // Append 0 if the item is zipcode priced else append 1 for normal items
    if(typeof  allRegiSS != 'undefined'){
        if(allRegiSS.length > 0){
            partNum+="|0"; 
        }else{
            partNum+="|1"; 
        }
    }
    
    else{
           partNum+="|1"; 
    }
    var partNumFromUrl = partNum+'#'+strId;
    if(getCookie('RecentViewPartNum')==''){
        //create a cookie if its not present
        document.cookie = "RecentViewPartNum="+partNumFromUrl+"^;";
    }else{
        //append values to the cookie if exist
        var cookievalue = getCookie('RecentViewPartNum');
        var temp = getNewCookieValue(cookievalue,partNumFromUrl);
        document.cookie="RecentViewPartNum="+temp+";";
    }
}
function checkCookieAndDisableCart(){

     if(typeof  allRegiSS != 'undefined'){
    var zipp = getCookie('zipCode');
    if(allRegiSS.length > 0 && zipp ==''){
        enableDisableCart('none');
       }
    }
}
function define(def) {
	if(!document.createElement) return false;
	var defDiv = document.createElement("div");
	document.body.appendChild(defDiv);
	defDiv.id = 'definition';
	defDiv.className = 'floatWindow';
	//defDiv.innerHTML = "<p onclick='remove(this.parentNode);'><a href='javascript:;' class='closeWindow'>Close</a></p><br clear='all'>" + "<p><b>" + def.split(":")[0] + ":</b> " + def.split(":")[1] + "</p>";
	defDiv.innerHTML = "<p onclick='remove(this.parentNode);'><a href='javascript:;' class='closeWindow'>Close</a></p><br clear='all'>" + "<p><b>" + def + "</b></p>";
	defDiv.style.top = yPos + "px";
	defDiv.style.left = (xPos-100) + "px";
}

//this function is used to hide / show add to cart
function enableDisableCart(prop){
    /* Commented out for resolving ECOM-14498
    prepareGreatPrice();	*/
    if(document.getElementById('addToCartButton')){
        document.getElementById('addToCartButton').style.display=prop;
    }
}
function afterRegiSS(){
    enableDisableCart('block');
}
