		function hide_layer(_name)
		{  
			if(document.layers) 
			{
				document.layers[_name].visibility = 'hide';
			}
			else if(document.all) 
			{
			 	document.all[_name].style.visibility = 'hidden';
			}     
			else if(document.getElementById) 
			{
				document.getElementById(_name).style.visibility = 'hidden';
			}
		}
		
		function show_layer(_name)
		{  
			if(document.layers) 
			{
				document.layers[_name].visibility = 'show';
			}  
			else if(document.all) 
			{
				document.all[_name].style.visibility = 'visible';
			}
			else if(document.getElementById) 
			{
				document.getElementById(_name).style.visibility = 'visible';
			}     
		}          

        function swapImage(imagePath) {
            newImg = new Image();
            newImg.src = imagePath;
            newImg = eval("newImg.src");
            document ["main"].src = newImg;
            document ["main"].onclick = "";
            setcloseup("");
            /*
            spacer = new Image();
            spacer.src = '/wcsstore/carparts/general/en_US/images/spacer.gif';
            spacer = eval("spacer.src");
    
            if(document ["zoomer"])
	            document ["zoomer"].src = spacer;
            //hide_layer("zoom_div");
            */
            document.getElementById("viewLarge").style.display = "none";
        }          
          
        function swapImageWithLink(new_imagePath,new_popupPath) {  
        
        
	        newImg = new Image();
            newImg.src = new_imagePath;
            newImg = eval("newImg.src");
            document ["main"].src = newImg;
            document ["main"].onclick = "";        
            //swapImage(new_imagePath);
			setcloseup(new_popupPath);

            thezoomer = new Image();
            thezoomer.src = '/wcsstore/carparts/general/en_US/ui8_images/zoom_butt.gif';
            thezoomer = eval("thezoomer.src");
            if(document ["zoomer"])
	            document ["zoomer"].src = thezoomer;
			document.getElementById("viewLarge").style.display = "block";
			//show_layer("zoom_div");    
        }    
         
        function onclick_load(url)
        {
        	new_window = window.open(url,null,'width=650,height=650,scrollbars=no');
        	
        	pause(1000);
        	
        	if (checkIt('msie') > -1)
        	{
        		//setTimeout("resize_ie(" + new_window.id + ")", 1000);
        		//setTimeout("new_window.resizeTo(new_window.document.images[0].width+30,new_window.document.images[0].height+70)", 1000)
        		
        		//if(new_window.document.images[0]){
	        		//if (new_window.document.images[0].width != 600 && new_window.document.images[0].height != 600)
	        		//{
		        		//new_window.resizeTo(new_window.document.images[0].width+30,new_window.document.images[0].height+70);
	        		//}
	        	//}
        	}    
        	else  
        	{
        		//setTimeout(resize,1000,new_window);
        		resize(new_window);
        	}
        	  
        	new_window.focus();
        } 
                                
		function pause(numberMillis) 
		{
		    var now = new Date();
		    var exitTime = now.getTime() + numberMillis;
		    while (true) 
			{
		        now = new Date();
		        if (now.getTime() > exitTime)
		            return;
		    }
		}
        
        function resize(_window)
        {
        	if (document.images)
        	{
        	
        		if(_window.document.images && _window.document.images[0]){
	        		if (_window.document.images.length == 1 && _window.document.images[0].width != 600 && _window.document.images[0].height != 600)
	        		{
	       				_window.resizeTo(_window.document.images[0].width+30,_window.document.images[0].height+70);
	        		}
	        	}
        	}        
        }   

		function checkIt(string)
		{
			var detect = navigator.userAgent.toLowerCase();
			place = detect.indexOf(string) + 1;
			return place;
		}
        
        function setcloseupandopen(url)
        {
			if (closeup == "unset")
			{
				setcloseup(url);
			}
			
        	if (closeup != "")    
        	{
        		onclick_load(closeup); 
        	}
        }    
 
        function setcloseup(url) 
        { 
       		closeup = url; 
        }  
        
        function Add2ShopCartPlusInstall(form, catentryId, qty, appId, contractId, mediaCode, installCheckbox) {
            if(!busy) {
                if(installCheckbox != null && installCheckbox.checked) {
                    form.installItemId.value = installCheckbox.value;
                }
                
                Add2ShopCart(form, catentryId, qty, appId, contractId, mediaCode);
            }
        }
        
        function Add2ShopCart(form, catentryId, qty, appId, contractId, mediaCode)
        {
            if (!busy) {
                busy = true;
                form.action = '/webapp/wcs/stores/servlet/OrderItemAdd';
                form.URL.value = 'ShopcartCalculateView?URL=OrderItemDisplay';
                form.quantity.value = qty;
                form.catEntryId.value = catentryId;
                form.comment.value = appId;
                form.contractId.value = contractId;
                form.field2.value = mediaCode;
                form.submit();
            }
        }

        function Add2ShopCartPlusInstallWithIdx(form, catentryId, qty, appId, contractId, mediaCode, installCheckbox,index) {
            if(!busyIdx) {
                if(installCheckbox != null && installCheckbox.checked) {
                    form.installItemId.value = installCheckbox.value;
                }
                
                Add2ShopCartWithIdx(form, catentryId, qty, appId, contractId, mediaCode,index);
            }
        }
        
        function Add2ShopCartWithIdx(form, catentryId, qty, appId, contractId, mediaCode,index) {
            if (!busyIdx) {
                busy = true;
                form.action = '/webapp/wcs/stores/servlet/OrderItemAdd';
                form.URL.value = 'ShopcartCalculateView?URL=OrderItemDisplay';
                form.quantity.value = qty;
                form.catEntryId.value = catentryId;
                form.comment.value = appId;
                form.contractId.value = contractId;
                form.field2.value = mediaCode;
                form.index.value=index;
                form.submit();
            }
        }
        
        function Add2WishList(form)
        {
            if (!busy) {
                busy = true;
                form.action = '/webapp/wcs/stores/servlet/InterestItemAdd';
                form.URL.value = 'InterestItemDisplay';
                form.submit();
            }
        }
        
        function openImageLink(url) {
            window.open(url,'','STATUS=YES,SCROLLBARS=NO,HEIGHT=430,WIDTH=460');
        }  
        
        function getUrl(url,w,h,s,x,y) {
            window.open(url,'window','width=' + w + ',height=' + h + ',scrollbars=' + s + ',screenx=' + x + ',screeny=' + y + ',left=' + x + ',top=' + y + ',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0');
            self.name = 'mainWindow';
        }
        
        function submitRefinement(form) {
            if(form.refinement.selectedIndex > 0)
                document.location.href = form.refinement.options[form.refinement.selectedIndex].value;
        }
        
        function rejectEnterButton(e)
        {
     		var key;
 
     		if(window.event) 
          		key = window.event.keyCode;     //IE
     		else
          		key = e.which;     //firefox

     		if(key == 13)
          		return false;   
     		else
          		return true; 
		}
		function windowOnLoad() {
        	MM_preloadHeaderImages();
        }
      
        function showhide_right(){
		currentIndex = 3;
		paginationText = currentIndex + " of " + totalThumbnails;
		document.getElementById("swapNext").style.display='block';
		document.getElementById("swap").style.display='none';
		document.getElementById("RightDisabled").style.display='block';
		document.getElementById("RightEnabled").style.display='none';
		document.getElementById("LeftEnabled").style.display='block';
		document.getElementById("LeftDisabled").style.display='none';
	}
	function showhide_left(){
		currentIndex = 1;
		document.getElementById("swapNext").style.display='none';
		document.getElementById("swap").style.display='block';
		document.getElementById("LeftDisabled").style.display='block';
		document.getElementById("LeftEnabled").style.display='none';
		document.getElementById("RightEnabled").style.display='block';
		document.getElementById("RightDisabled").style.display='none';
	}

	function scrollToProductFeatures()
	{
			try{
			    var bvEle = document.getElementById("prod_feat_button_id");
			    window.scroll(pageOffsetLeft(bvEle),pageOffsetTop(bvEle));
			}catch(err){}
	}

	function scrollToReview(){
			try{
				ShowReview();
				var bvEle = document.getElementById("CommunityTabs");
				window.scroll(pageOffsetLeft(bvEle),pageOffsetTop(bvEle));
			}catch(err){}
	}
	function scrollToFeatures(){
			try{
				ShowFeatures();
				var bvEle = document.getElementById("CommunityTabs");
				window.scroll(pageOffsetLeft(bvEle),pageOffsetTop(bvEle));
			}catch(err){}
	}
	function groupExists(){ 
		var cookieString=readCookie("RECENTLY_VIEWED_PRODUCTS");
		if(null != cookieString && "null" != cookieString && cookieString.indexOf(groupPartNum) > -1){
			return true;
		}else{
			return false;
		}
	}
