         $(document).ready(function(){   
    	   $(".imgAddToCart").click(function() {
    	        rgbQty = $("#" + this.rel).val();
    	        preproc("frmAdd","",this.rel,"0","","0",rgbQty);
    	        return false;
    	    });
    	    
    	   
            $("ul.sf-menu").superfish({ 
                animation: {height:'show'},   // slide-down effect without fade-in 
                delay:     1200               // 1.2 second delay on mouseout 
            }); 
            


			// Tabs
			$('#tabs').tabs();
			//hover states on the static widgets
			$('#dialog_link, ul#icons li').hover(
				function() { $(this).addClass('ui-state-hover'); }, 
				function() { $(this).removeClass('ui-state-hover'); }
			);            
            
        });
            
            
            
            
            function createplayer(theFile, go, ph, w, h) {
                
                // alert(theFile);
                
                if (typeof(ph) == 'undefined') ph = 'placeholder';
                if (typeof(w) == 'undefined') w = '400';
                if (typeof(h) == 'undefined') h = '306';
                var flashvars = {
                  file:             theFile,
                  width:            w,
                  height:           h,
                  displayheight:    h - 20,
                  
                  overstretch:      "fit", 
                  autostart:        "false"
                };

                if (go) flashvars.autostart = "true";

                var params = {wmode:            "opaque",allowfullscreen: "true"};
                var attributes = {};
                
                swfobject.embedSWF("/store/videos/mediaplayer.swf", ph, w, h, "9.0.0","expressInstall.swf", flashvars, params, attributes);

            }    	  
            
            
            
	//***	This function will be called in every page to set the title atttibute for images
	function setTitleForImages()
	{		
		var strUserAgent = navigator.userAgent.toUpperCase();		
		if((strUserAgent.indexOf("NETSCAPE")>=0) || (strUserAgent.indexOf("OPERA")>=0) || (strUserAgent.indexOf("MAC") >= 0) || (strUserAgent.indexOf("GECKO") >= 0))
		{
			for(var intImageIndex=0;intImageIndex<document.images.length;intImageIndex++)
			{		
				document.images[intImageIndex].title = document.images[intImageIndex].alt;
			}
		}
	}

	//*** This function will be called in footer.asp page,customstatement.asp,shipcalculator.asp for mac sumbit key compatability.
	function setHrefForLinks()
	{
		for(var intLinkIndex=0;intLinkIndex<document.links.length;intLinkIndex++)
		{		
			if(document.links[intLinkIndex].onclick != null)
			{						
				var strTemp = document.links[intLinkIndex].onclick + "";	
				strTemp = strTemp.replace("function onclick()","");
				strTemp = strTemp.replace("{","");	
				var pos = strTemp.lastIndexOf("}");
				strTemp = strTemp.substring(0,pos);			
				strTemp = strTemp.replace("return false;","");
				strTemp = strTemp.replace("return false","");								
				if(strTemp.toUpperCase().indexOf("JAVASCRIPT:")==-1) strTemp = "JavaScript:"+strTemp;
				document.links[intLinkIndex].href = strTemp;					
			}			
		}
	}








           

         
        //-----------------------------------------------------------------
        // Function to submit Search for Items
        //-----------------------------------------------------------------         
         function encode (str) {
            str = escape(str);
            return str.replace(/[*+\/@]|%20/g,
                function (s) {
                    switch (s) {
                        case "*": s = "%2A"; break;
                        case "+": s = "%2B"; break;
                        case "/": s = "%2F"; break;
                        case "@": s = "%40"; break;
                        case "%20": s = "+"; break;
                    }
                return s;
                }
            );
        }
        
        


        

        function submitMainsearch() { 
            
            terms = $("#SearchWord").val();
            if (terms == "") {
                terms = $("#SearchWord2").val();
            }
            
            if (terms=="") {
               alert("I need something to search for!");
                }
            url = "/store/searchresult.asp?SearchWord=" + encode(terms);
            
            document.location = url;
            
            return false;
            
            
        	if (document.getElementById("SearchWord").value.indexOf(' ') == 0)
        	{
        		alert('Search string should not start with spaces.');
        		document.getElementById('SearchWord').focus();
        		return false;
        	}
        	if (document.getElementById('SearchWord').value == "")
        	{
        		alert('Please enter a search string.');
        		document.getElementById('SearchWord').focus();
        		return false;
        	}
        	
        	document.getElementById('frmMainsearch').submit();
        	return true;
        }
              
              
              
         function cartstatus(sCartStatus)
			{
				if(sCartStatus == "2")		//Item discontinued/Sales measure is changed
					alert("We no longer offer some of the items you had on your prior saved cart.\nOnly the items we still offer will be retrieved.");
				else if(sCartStatus == "3")	// Kit Reconfigured
					alert("The configuration of the package you had saved in your cart has changed.\nYour package has been accordingly reconfigured to match the current offering.");
				else if(sCartStatus == "4")	// Both 2 & 3
					alert("The saved cart currently contains discontinued items and Kit items with different configuration.\nOnly valid items and Kit will be retrieved.");
				return;
			}
         
         function logoutMe(){
            	if(confirm("Contents of shopping cart will be lost if you logout now."))
            		window.location.href="logout.asp?url=AL"
            	return false;
            }
