/* Helper function to change the filter title on the subcategory page */
    function gotoUrlNav(url){
        if (url!="") window.open(url, "countryWindow");
    }

    function SetFilterTitle(tagid, val){
        var objTitle = $get(tagid);
        if (objTitle!=null) {
            objTitle.innerHTML = val;
        }
    }
    
    function returnObjById(id) { 
        if (document.getElementById) 
            var returnVar = document.getElementById(id); 
        else if (document.all) 
            var returnVar = document.all[id]; 
        else if (document.layers) 
            var returnVar = document.layers[id]; 
        return returnVar; 
    } 

    function gosearch()
    {	
	    var mf = GetMainFormName();		
	    if (mf==null) return;
	    
	    if (document.forms[mf].elements["SearchKeywords"].value != '' && document.forms[mf].elements["SearchKeywords"].value != null){
	        document.forms[mf].action="/search/index.aspx?SearchKeywords=" + document.forms[mf].elements["SearchKeywords"].value;
	        document.forms[mf].submit();
	    }
    }	

    function gosearch2()
    {	
	    var mf = GetMainFormName();
	    if (mf==null) return;
	    document.forms[mf].action="/search/index.aspx?SearchKeywords=" + document.forms[mf].elements["SearchKeywords2"].value;
	    document.forms[mf].submit();
    }	

    function search_onfocus(elt)
    {
	    elt.value = '';
    	
	    var mf = GetMainFormName();
	    if (mf==null) return;
	    document.forms[mf].action="/search/index.aspx?<%=Intrinsics.GetURLParams()%>";
    }
    function isEnter(e)
    {
	    if (e.keyCode == 13)
	    {		
		    gosearch();
	    }	
	    return true;
    }

    // FLASH ACTIVATION
    function CreateControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, FLASHVARS, AUTOSTART,BGCOLOR)
    {
      var d = document.getElementById(DivID);
      var objectTag = '<object classid=' + CLSID + ' id=' + ObjectID + ' width=' + WIDTH + ' height=' + HEIGHT +' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">';
      objectTag = objectTag + '<param name="allowScriptAccess" value="sameDomain">';
      objectTag = objectTag + '<param name="movie" value=' + URL + '>'
      objectTag = objectTag + '<param name="FlashVars" value="' + FLASHVARS + '">';
      objectTag = objectTag + '<param name="quality" value="high">'  
      //objectTag = objectTag + '<param name="bgcolor" value="#000000">'  
      objectTag = objectTag + '<param name="bgcolor" value=' + BGCOLOR +'>'  
      objectTag = objectTag + '<param name="autoStart" value=' + AUTOSTART + '/>';
      objectTag = objectTag + '<embed src="' + URL + '" flashVars="' + FLASHVARS + '" quality="high" bgcolor="' + BGCOLOR + '"  width="' + WIDTH + '" height="' + HEIGHT +'" name="main" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
      objectTag = objectTag + "</object>";
      d.innerHTML = objectTag;
    }
    				
    function CreateTransparentControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, FLASHVARS, AUTOSTART)
    {
      var d = document.getElementById(DivID);
      var objectTag = '<object classid=' + CLSID + ' id=' + ObjectID + ' width=' + WIDTH + ' height=' + HEIGHT +' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">';
      objectTag = objectTag + '<param name="allowScriptAccess" value="sameDomain">';
      objectTag = objectTag + '<param name="movie" value=' + URL + '>'
      objectTag = objectTag + '<param name="FlashVars" value="' + FLASHVARS + '">';
      objectTag = objectTag + '<param name="quality" value="high">'  
      objectTag = objectTag + '<param name="autoStart" value=' + AUTOSTART + '/>';
      
      objectTag = objectTag + '<param name="wmode" value="transparent" />'
    				
      objectTag = objectTag + '<embed wmode="transparent" src="' + URL + '" flashVars="' + FLASHVARS + '" quality="high" bgcolor="#ffffff" width="' + WIDTH + '" height="' + HEIGHT +'" name="main" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
      objectTag = objectTag + "</object>";
      d.innerHTML = objectTag;
    }
    
    function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
    {
       var arVersion = navigator.appVersion.split("MSIE")
       var version = parseFloat(arVersion[1])
         if ((version >= 5.5)&& (version < 7.0) && (document.body.filters)) 
       {
          for(var i=0; i<document.images.length; i++)
          {
             var img = document.images[i]
             
             var imgName = img.src.toUpperCase()
             if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
             {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText 
                //if (img.align == "left") imgStyle = "float:left;" + imgStyle
                //if (img.align == "right") imgStyle = "float:right;" + imgStyle
                //if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass + imgTitle
                + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                + "(src=\'" + img.src + "\', sizingMethod='crop');\"></span>"; 
                img.outerHTML = strNewHTML;
                i = i-1
             }
          }
       }    
    }

    
    //// Start: Looks/Look Details pages
//
//    function returnObjById(id) { 
//        if (document.getElementById) 
//            var returnVar = document.getElementById(id); 
//        else if (document.all) 
//            var returnVar = document.all[id]; 
//        else if (document.layers) 
//            var returnVar = document.layers[id]; 
//        return returnVar; 
//    } 
//
//    function toggle(id,state) {
//        var obj=returnObjById(id);
//
//        if(state=="on") {
//	        obj.style.display="block";
//        } else {
//	        obj.style.display="none";
//        }
//    }
///* Toggles for the Product Pages */
//    function toggle(id,state) {
//	    var obj=$get(id);
//
//        if (obj != null){
//	        if(state=="on") {
//		        obj.style.display="block";
//	        } else {
//		        obj.style.display="none";
//	        }
//	    }
//    }
//    
//    function toggleToolTip(objName) {
//        var obj = $get(objName); 
//        obj.style.display = "";
//    }
//    
//    function clearToolTip(objName) {
//        var obj = $get(objName); 
//        obj.style.display = "none";
//    }
//    
//    function toggleRow(rowId,state) {    
//	    var sfEls = $get(rowId).getElementsByTagName("A");
//	    for (var i=0; i<sfEls.length; i++) {
//	        if(state=="on") {
//		        sfEls[i].className="swatchLinkCurrent";
//	        } else {
//		        sfEls[i].className="swatchLink";
//	        }	
//		}		
//    }
//
//    function toggleLink(id,state) {
//        var obj=returnObjById(id);
//
//        if(state=="on") {
//	        obj.style.color="#323232";
//        } else {
//	        obj.style.color="#1A62A4";
//        }
//    }
//
//
//    function toggleDictionary(id,state,linkId,linkState) {
//        toggle(id,state);
//        toggleLink(linkId,linkState);
//    }
//
//    function showMultipan(hexValues, prodCode){
//        var colors=hexValues.split(",");
//        
//        var imgPrefix = IMAGES_RELATIVE_OR_ABSOLUTE_PATH +VARIANT_LARGE_SHADE_IMAGE_PREFIX;
//        var imgSuffix = VARIANT_LARGE_SHADE_IMAGE_SUFFIX;
//        var imgSuffix_S = VARIANT_SMALLMULTIPAN_SHADE_IMAGE_SUFFIX;
//        var imgSuffix_L = VARIANT_LARGEMULTIPAN_SHADE_IMAGE_SUFFIX;
//        var pngName="";	
//        var divSize="";
//        var pngWidth="";
//        var pngHeight=""
//        if(colors.length==1) {
//            divSize="multPanLargeDiv";
//            pngName=imgPrefix + prodCode + imgSuffix;
//            pngWidth="99";
//            pngHeight="120"
//        } else if (colors.length>=2 && colors.length<=4) {
//            divSize="multPanMediumDiv";
//            pngName=imgPrefix + prodCode + imgSuffix_L;
//            pngWidth="99";
//            pngHeight="120"
//        } else {
//            divSize="multPanSmallDiv";
//            pngName=imgPrefix + prodCode + imgSuffix_S;
//            pngWidth="60";
//            pngHeight="73"
//        }
//
//        var newInner="<div id=\"muliPanDiv\">";
//        newInner=newInner + "<div class=\"" + divSize + "\">";
//
//        for(i=0;i<colors.length;i++) {
//            newInner=newInner + "<div style=\"background-color:" + colors[i] + "\"><img src=\"" + pngName + "\" border=\"0\" style=\"width:" + pngWidth + "px;height:" + pngHeight + "px; \" width='" + pngWidth + "' height='" + pngHeight + "'></div>";
//            
//            
//        }
//
//        newInner=newInner + "</div></div>";
//
//        return newInner;
//    }
//
//
//    function hideAll(idBaseName,count) {
//    		
//	        for (var i=1;i<=count;i++) {
//		        var idName=idBaseName+i;
//    			
//    			
//		        var theElement=returnObjById(idName);
//		        if(theElement==null) {
//			        break;
//		        } else {
//			        theElement.style.display="none";
//		        }
//    			
//	        }
//    }
//
//    function showAll(idBaseName,count) {
//    		
//	        for (var i=1;i<=count;i++) {
//		        var idName=idBaseName+i;
//    			
//    			
//		        var theElement=returnObjById(idName);
//		        if(theElement==null) {
//			        break;
//		        } else {
//			        theElement.style.display="block";
//		        }
//    			
//	        }
//    }
//
//   // End: Looks/Look Details pages
//    function getCookie (name) 
//    {
//        var dcookie = document.cookie; 
//        var cname = name + "=";
//        var clen = dcookie.length;
//        var cbegin = 0;
//        while (cbegin < clen) 
//        {
//            var vbegin = cbegin + cname.length;
//            if (dcookie.substring(cbegin, vbegin) == cname) 
//            { 
//                var vend = dcookie.indexOf (";", vbegin);
//                if (vend == -1) vend = clen;
//                    return unescape(dcookie.substring(vbegin, vend));
//            }
//            cbegin = dcookie.indexOf(" ", cbegin) + 1;
//                if (cbegin == 0) break;
//        }
//        return document.referrer;
//    }
//
//    function setCookie (name) {
//        var expires = new Date ();
//        expires.setTime (expires.getTime() + (1000 * 60 * 60 * 24 * 1));   
//        var pathname = window.location.pathname + window.location.search;
//        document.cookie = name + "=" + pathname + "; expires=" + expires.toGMTString() +  "; path=/"; 
//    }
//    
//    // Video Gallery
//    
//    // JavaScript Document
//function changeImage(index,imageId) {
//		var imageObj = returnObjById(imageId);
//		imageObj.src=imageArray[index];
//	}
//	
////Photo Gallery Script
////Requires imageArray, currentIndex, totalImages variables in in-line javascript on page
////Requires <div class="mediaDiv" id="galleryDiv"></div> 
////requires onload=printGallery() to initialize
//
//	function printGallery() {
//		var galleryDiv = returnObjById("galleryDiv");
//			
//			galleryDiv.innerHTML="<div><img src=\"" + imageArray[currentIndex][0] + "\" id=\"galleryImage\"></div>";
//			galleryDiv.innerHTML+="<div class=\"marginTop10\">"+imageArray[currentIndex][1]+"</div>";
//			galleryDiv.innerHTML+="<div class=\"marginTop5 marginBottom10\" id=\"galleryBar\">";
//			galleryDiv.innerHTML+="<a href=\"javascript:prevImage()\"><img src=\"/images/buttons/prev.png\" border=\"0\" class=\"prevButton\"></a>";
//									
//			galleryDiv.innerHTML+="<div class=\"imageCount floatLeft\"><span id=\"displayIndex\">"+currentIndex+"</span> of <span id=\"totalImages\">"+totalImages+"</span></div>";
//			galleryDiv.innerHTML+="<a href=\"javascript:nextImage()\"><img src=\"/images/buttons/next.png\" border=\"0\" class=\"nextButton\"></a>";
//			galleryDiv.innerHTML+="</div>";
//			galleryDiv.innerHTML+="<div class=\"clearBoth\"></div>";
//			
//	}
//
//	function printSingleModelGallery() {
//		var galleryDiv = returnObjById("galleryDiv");
//			
//			galleryDiv.innerHTML="<div><img src=\"" + imageArray[currentIndex][0] + "\" id=\"galleryImage\"></div>";
//			
//	}
//	
//	function nextImage() {
//		currentIndex++;
//		if (currentIndex>imageArray.length-1) {
//			currentIndex=imageArray.length-1;
//		}
//		changeImage(currentIndex,"galleryImage");
//		
//		printGallery();
//	}
//	
//	function prevImage() {
//		currentIndex--;
//		if (currentIndex<1) {
//			currentIndex=1;
//		}
//		changeImage(currentIndex,"galleryImage");
//		
//		printGallery();
//	}
//	
//	function printEvents(increment) { //0 prints current -1 prints previous 1 prints next, 2 prints next 2 etc;
//		var index=currentIndex+increment;
//		
//		if (index<0) { //can have negative index
//			index=0;
//		}
//		
//		if(index>eventsArray.length-1) { //cant exceed array bounds
//			index=eventsArray.length-1
//		}
//		
//		currentIndex=index;//readjust the current index;
//		
//		var lastIndex=index+5; //get the last index
//		if (lastIndex>eventsArray.length-1) {//last index can't go beyond max
//			lastIndex=eventsArray.length-1;
//		}
//		
//		var content="";
//		for(i=index;i<=lastIndex;i++) {
//			content+="<div class=\"module\">";
//			content+="<a href=\"" + eventsArray[i][0] + "\" ><img src=\"" + eventsArray[i][1] + "\" border=\"0\" class=\"floatLeft\"></a>";
//			content+="<div class=\"text\">";
//			//content+=eventsArray[i][2] + "<br>";
//			content+="<a href=\""+ eventsArray[i][0] + "\" >" + eventsArray[i][2] + "</a><br>";
//			content+=eventsArray[i][4]+"<br>";
//			content+="</div>";
//			content+="<div class=\"clearBoth\"></div>";
//			content+="</div>";
//		
//		
//			
//		}
//		
//		var buzzEventContent = returnObjById('buzzEventContainer');
//		buzzEventContent.innerHTML=content;
//	}
//	function changeModelText(indexCount) {
//		
//		var modelTextDiv = returnObjById("modelText");
//		var textTo="<img src='/images/titles/models/" + modelTextArray[indexCount][0] + ".gif'/><br>";
//		textTo+=modelTextArray[indexCount][1]+"<br>";
//		textTo+="<a href=\"" + modelTextArray[indexCount][3] + "\"><img src=\"/images/arrow_transparent.png\"> " + modelTextArray[indexCount][2] + "</a>";
//		
//		modelTextDiv.innerHTML=textTo;
//	}
//	
//	//END Photo Gallery Script
//	
//    function GoToChapter(video,streampath,chapter)
//    {
//        CreateTransparentControl( "FLASH_DIV_ID",
//        "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
//        "slideshow_40", 
//        "417", /*width*/ /*550*/ 
//        "400", /*height*/
//        VIDEO_GALLERY_PLAYER_PATH + '?content=' + video + '&streampath=' + streampath + '&seek=' + chapter,
//        "" /*Flash Vars*/,
//        "-1",
//        "1",
//        "#FFFFFF" );
//    }
//    
//    function printBuzzEvents(increment) { //0 prints current -1 prints previous 1 prints next, 2 prints next 2 etc;
//        index=currentIndex+increment;
//		
//        if (index<0) { //can have negative index
//	        index=0;
//        }
//		
//        if(index>eventsArray.length-1) { //cant exceed array bounds
//	        index=eventsArray.length-1
//        }
//		
//        currentIndex=index;//readjust the current index;
//		
//        var lastIndex=index+3; //get the last index
//        if (lastIndex>eventsArray.length-1) {//last index can't go beyond max
//	        lastIndex=eventsArray.length-1;
//        }
//		
//        var content="";
//        for(i=index;i<=lastIndex;i++) {
//	        content+="<div class=\"module\">";
//	        content+="<a href=\"" + eventsArray[i][0] + "\"><img src=\"" + eventsArray[i][1] + "\" border=\"0\" class=\"floatLeft\"></a>";
//	        content+="<div class=\"text\">";
//	        content+=eventsArray[i][2] + "<br>";
//	        content+="<a href=\""+ eventsArray[i][0] + "\">" + eventsArray[i][3] + "</a><br>";
//	        content+=eventsArray[i][4]+"<br>";
//	        content+="</div>";
//	        content+="<div class=\"clearBoth\"></div>";
//	        content+="</div>";
//		
//		
//			
//        }
//		
//        var buzzEventContent = returnObjById("buzzEventContainer");
//        buzzEventContent.innerHTML=content;
//    }
//    var newWindow;
//    function openPopup(url, popupWidth, popupHeight) {
//        if (newWindow && !newWindow.closed)	{
//            newWindow.close();
//        }	
//
//        var winl = (screen.width - popupWidth) / 2;
//        var wint = (screen.height - popupHeight) / 2;
//
//        newWindow = open(url, 'popup', ("toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,top=" + wint + ",left=" + winl + ",width=" + popupWidth + ",height=" + popupHeight + "\""));
//        newWindow.focus();
//    }
//    function getCookie (name) 
//    {
//        var dcookie = document.cookie; 
//        var cname = name + "=";
//        var clen = dcookie.length;
//        var cbegin = 0;
//        while (cbegin < clen) 
//        {
//            var vbegin = cbegin + cname.length;
//            if (dcookie.substring(cbegin, vbegin) == cname) 
//            { 
//                var vend = dcookie.indexOf (";", vbegin);
//                if (vend == -1) vend = clen;
//                    return unescape(dcookie.substring(vbegin, vend));
//            }
//            cbegin = dcookie.indexOf(" ", cbegin) + 1;
//                if (cbegin == 0) break;
//        }
//        return document.referrer;
//    }
//
//    function setCookie (name) {
//        var expires = new Date ();
//        expires.setTime (expires.getTime() + (1000 * 60 * 60 * 24 * 1));   
//        var pathname = window.location.pathname + window.location.search;
//        document.cookie = name + "=" + pathname + "; expires=" + expires.toGMTString() +  "; path=/"; 
//    }
//    
//    			    function ChangeToHowTo(StartIndex)
//		    {
//		        if(eventsArray!=howToArray)
//		        {
//                    var startOfList = typeof(StartIndex) == 'undefined' ? 0 : StartIndex;
//                    
//                    eventsArray = howToArray;
//		            currentIndex=0;
//		            printEvents(startOfList);
//
//                    var theElement=returnObjById('linkHowToVideos');
//                    if(theElement==null) {
//                    } else {
//                        theElement.style.backgroundColor="#FFFFFF";
//                    }
//
//                    var theElement=returnObjById('linkGivingBackVideos');
//                    if(theElement==null) {
//                    } else {
//                        theElement.style.backgroundColor="#D7D7D7";
//                    }
//
//                    var theElement=returnObjById('linkBackstageVideos');
//                    if(theElement==null) {
//                    } else {
//                        theElement.style.backgroundColor="#D7D7D7";
//                    }
//		        }
//		    }
//
//		    function ChangeToGivingBack(StartIndex)
//		    {
//		        if(eventsArray!=givingBackArray)
//		        {
//                    var startOfList = typeof(StartIndex) == 'undefined' ? 0 : StartIndex;
//
//                    eventsArray = givingBackArray;
//		            currentIndex=0;
//		            printEvents(startOfList);
//
//                    var theElement=returnObjById('linkHowToVideos');
//                    if(theElement==null) {
//                    } else {
//                        theElement.style.backgroundColor="#D7D7D7";
//                    }
//
//                    var theElement=returnObjById('linkGivingBackVideos');
//                    if(theElement==null) {
//                    } else {
//                        theElement.style.backgroundColor="#FFFFFF";
//                    }
//
//                    var theElement=returnObjById('linkBackstageVideos');
//                    if(theElement==null) {
//                    } else {
//                        theElement.style.backgroundColor="#D7D7D7";
//                    }
//		        }
//		    }
//		
//		    function ChangeToBackStage(StartIndex)
//		    {
//		        if(eventsArray!=backstageArray)
//		        {
//                    var startOfList = typeof(StartIndex) == 'undefined' ? 0 : StartIndex;
//
//                    eventsArray = backstageArray;
//		            currentIndex=0;
//		            printEvents(startOfList);
//
//                    var theElement=returnObjById('linkHowToVideos');
//                    if(theElement==null) {
//                    } else {
//                        theElement.style.backgroundColor="#D7D7D7";
//                    }
//
//                    var theElement=returnObjById('linkGivingBackVideos');
//                    if(theElement==null) {
//                    } else {
//                        theElement.style.backgroundColor="#D7D7D7";
//                    }
//
//                    var theElement=returnObjById('linkBackstageVideos');
//                    if(theElement==null) {
//                    } else {
//                        theElement.style.backgroundColor="#FFFFFF";
//                    }
//		        }
//		    }
