/* cache css bg images for IE6 */
if ( document.all )
{  
    try {
      document.execCommand("BackgroundImageCache", false, true);
    } catch(err) {}
}

// adList variables
var dartCalls = new Array();
var dartCounter = 0;
var dartSite = '';
var dartKeywords = '';

    dart = new Object();
    dart["sz"] = "";
    dart["site"] = "";
    dart["zone"] = "";
    dart["target"] = "";
    dart["url"] = "";
    dart["dcopt"] = "";

<!--// 
// BEGIN Standard popup window script BEGIN //
   window.name="opener";



   function popUpBigImageWthNav(url) {
      var detWindow=""
      detWindow=window.open(url,'BIGimg', 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=734,height=470');
   }   

   function popUp7thOnSale(url) {
      var detWindow=""
      detWindow=window.open(url,'BIGimg','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=780,height=600');
   }
   
   function popUpVideoConsole(url) {
      var detWindow=""
      detWindow=window.open(url,'videoConsole','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=1050,height=723');
   }
   
     function popUpTrendAudio(url) {
	 
	  var detWindow=""
      detWindow=window.open(url,'trendAudio','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=731,height=675');
   }

   function popUpBigImagePrintable(url) {
      var detWindow=""
      detWindow=window.open(url,'BIGimgPrint','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=240,height=360');
   }
   
   function popUpTallImage(url) {
	  var width=screen.width;
	  var height=screen.height;
      	  var detWindow="";

	  if (width<900) {
      detWindow=window.open(url,'TALLimg','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=768,height=550,left=0,right=0');
	  } else {
      detWindow=window.open(url,'TALLimg','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=768,height=614');
	  }
	  
   }
   
   function popUpTallImageDetails(url) {
   var detWindow=""
   detWindow=window.open(url,'TALLimgDetails','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=768,height=614, left=50,top=50');
   }

   function popUpBigImageSecondary(url) {
      var detWindow=""
      detWindow=window.open(url,'TALLDetailimg','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=420,height=620');
   }

   function goToURL(url) {
      if (url != "") { self.location=url; }
   }

// END Standard popup window script END //   


// BEGIN  winners popup window script BEGIN //
  window.name="winners";

   function popWinners(url) {
      var detWindow=""
      detWindow=window.open(url,'Winners','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=350,height=550');
   }
// END winners popup window script END //   

// Video one-off
    function popVivierVideo(url) {
      var detWindow=""
      detWindow=window.open(url,'Vivier','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=395,height=330');
   }
//
 
      function gotosite(site) {
                        if (site != "") {
                   self.location=site; } 
                   }
				   
	  function gotonewsite(site) {
	  	if (site != "") {
			newWindow = "";
			newWindow = window.open(site,'newWin');
		}
	  }
	
	/* master roll over code								 
	 Author : Daniel Nolan
	 http://www.bleedingego.co.uk/webdev.php
	 add the attribute class="imgover" to images that requires a mouseover 
     this image must be named exactly the same as the original image,      
	 but it needs _o on the end of the name in the same directory as the   
	 original. 															 
	*/

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');
	
	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

window.onload = initRollovers;

	

          function go(url) {
			if (opener && !opener.closed) {
            	opener.location.href = url;
            	window.close();
			} else { 
				self.location.href = url;
			}
          }


/* Parses URL Pathname
	Author: Jamie L. Marin, Senior Web Developer
	Date: June !5, 2005
*/

/* Sets varibles for URI pathname and pathname length */
var browserURI = location.pathname;
var uriLength = browserURI.length;

/* Creates Array */
var directories = new Array();

/* Find out indexes of first, next, and last slashes */
var startSlash = browserURI.indexOf('/');
var nextSlash =  browserURI.indexOf('/', startSlash + 1);
var lastSlash = browserURI.lastIndexOf('/');
var slashCount = 0;

/* test for one deep section */ 
if (startSlash == lastSlash)
{
	directories[slashCount] = location.pathname.slice(startSlash + 1);
}


/* Loop to define sections from 1 to N */
while (startSlash != lastSlash || nextSlash != -1)
{
	directories[slashCount] = location.pathname.substring(startSlash + 1,nextSlash);	
	
	if (lastSlash + 1 != uriLength)
		directories[slashCount +1] = browserURI.slice(nextSlash + 1);
		
	startSlash = nextSlash;
	nextSlash =  browserURI.indexOf('/', startSlash + 1);		
	slashCount++;	
}

/* Set User Friendly Variables */
var firstDir = directories[0];
var lastDir = directories[directories.length-1];

/* css drop downs */
var totalLists = 1;
var ua = navigator.userAgent.toLowerCase();
var av = navigator.appVersion.toLowerCase();
var mac = ( av.indexOf( 'mac' ) != -1 );
var saf = ( ua.indexOf( 'safari' ) != -1 );
var ie5x = ( document.all && document.getElementById );
var ie5mac = ( mac && ie5x );

function calcHeight() {
	var myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		/*Non-IE*/
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		/*IE 6+ in 'standards compliant mode'*/
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		/*IE 4 compatible*/
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

	
function hideall(ListNum) {
	divItem = document.getElementById('Lst'+ListNum);
	divItem.style.display="none";
	document.getElementById('dropPlus'+ListNum).className = "dropPlus"; // change the drop down icon
}

/* css drop downs - modified js */

var LastListNum = "";

function checkHeightNew(ListNum){
		
		var list = document.getElementById('Lst' + ListNum);	
  
		var winHeight = calcHeight();
		
		var scrollOffset = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		if(!ie5mac) {
			list.style.overflow = "auto";// overflow auto for none ie5 on MAC -- to avoid horizontal scroll bar
			list.style.height = "";
			
			var drop = document.getElementById('Drp' + ListNum);
			var dropPos = findPosY(drop);
			var dropHeight = drop.offsetHeight;
			var spaceBelow = winHeight - (dropPos + dropHeight - scrollOffset) - 30;
			var spaceAbove = dropPos - scrollOffset - 30;
			var lstHeight = (spaceAbove > spaceBelow)? spaceAbove: spaceBelow;
			
			lstHeight = (list.offsetHeight > lstHeight)? lstHeight: list.offsetHeight;
            
            // decrease height of footer subscription links dropdown on video archive pages to prevent overlap of video and dhtml            
            if ( document.URL.indexOf('videoarchives/?designer') != -1 && ListNum == 10 ) 
                lstHeight = lstHeight - 140;
            
			list.style.height = lstHeight + "px"; // adjust the menu height according to the space available
			
			var lstTop = dropPos + dropHeight - 1;  
			list.style.top = lstTop + "px";
		
				if( spaceBelow < lstHeight){ // Display above
				list.style.top = lstTop - dropHeight - lstHeight - 1 + "px";
				//  list.style.top = dropPos - dropHeight - lstHeight + 15;			
				}
  	}
  
  	var listTable = document.getElementById('LstTable' + ListNum);
		if(ie5mac){
			var drop = document.getElementById('Drp' + ListNum);
			var dropPos = findPosY(drop);
			var dropHeight = drop.offsetHeight;
			var spaceBelow = winHeight - (dropPos + dropHeight - scrollOffset) - 30;
			var spaceAbove = dropPos - scrollOffset - 30;
			var lstHeight = (spaceAbove > spaceBelow)? spaceAbove: spaceBelow;
			
				lstHeight = (list.offsetHeight > lstHeight)? lstHeight: list.offsetHeight;
				list.style.height = lstHeight + "px";
		}
		
		if(saf) {
			if(listTable.offsetHeight + 3 > list.offsetHeight && list.offsetWidth <= listTable.offsetWidth + 3)
			list.style.width = list.offsetWidth + 15 + "px";
		}
		
		if(ie5mac) {
			if(listTable.offsetHeight + 2 > list.offsetHeight && list.offsetWidth <= listTable.offsetWidth + 2){
				list.style.width = list.offsetWidth + 15 + "px";
				list.style.overflow = "auto"; 
				list.style.height = "";
			}
		}
    
}

function showListNew(ListNum){
  	if(LastListNum == ListNum)
   		 closeDropDownNew();
  	else{
		closeDropDownNew();
    	LastListNum = ListNum;
   		ListId = "Lst" + LastListNum;
    	if(document.getElementById(ListId)){
	    	document.getElementById(ListId).style.display = "block";	
            
            if ( document.all && document.getElementById('dropdown_iframe') != null )
            {
                dropdown_height = document.getElementById(ListId).offsetHeight;
                iframe_height = dropdown_height - 3 + "px";
                document.getElementById('dropdown_iframe').style.height = iframe_height;
			    document.getElementById('dropdown_iframe').style.display = 'block';
                document.getElementById('dropdown_iframe').style.filter = 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
            }
            
            
	    	document.getElementById('dropPlus'+ListNum).className = "dropPlusOver"; // change the pull down icon
			checkHeightNew(ListNum); 
    }
  }
}

function closeDropDownNew(){
  if(LastListNum!=""){
	    ListId = "Lst" + LastListNum;
    	if(document.getElementById(ListId)){
      		document.getElementById(ListId).style.display = "none";
            
            if ( document.all && document.getElementById('dropdown_iframe') != null )
            {
                document.getElementById('dropdown_iframe').style.display = 'none';
            }
            
      		document.getElementById('dropPlus'+LastListNum).className = "dropPlus";
    }
    	LastListNum = ""; // set the menu ID to null 
  }
}

bw = new checkBrowser();

function checkBrowser(){
	this.ver=navigator.appVersion;
	this.dom= (document.getElementById)? 1 : 0;
	this.ie5=((this.ver.indexOf("MSIE 5") >= 0) && this.dom)? 1 : 0;
	this.ie4=(document.all && !this.dom)? 1 : 0;
    this.ns6=(this.dom && parseInt(this.ver) >= 6)? 1 : 0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5)? 1 : 0;
	this.ns4=(document.layers && !this.dom)? 1 : 0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
	
	this.editBody = function(rootName, code) {
		if (this.dom) {
			document.getElementById(rootName).innerHTML = code;
		} else if (this.ie4) {
			document.all[rootName].innerHTML = code;
		} else if (this.ns4) {
			document.layers[rootName].document.open();
			document.layers[rootName].document.write(code);
			document.layers[rootName].document.close();
		} 
	}
	this.getRef = function(rootName) {
		if (this.dom) {
			return  document.getElementById(rootName)
		} else if (this.ie4) {
			return document.all[rootName]
		} else if (this.ns4) {
			return document.layers[rootName];
		} 
	}
	
}

function styleFlash_DoFSCommand(command, args) {
	var tileNum = parseInt(args), div, script;
	//alert(args.substr(args.indexOf("|") + 1));
	
	if (command == "updateAd") {
		bw.editBody("dartLayer" + tileNum, args.substr(args.indexOf("|") + 1));
		
		//alert(document.all["dartLayer" + tileNum].innerHTML);
	}
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('Sub styleFlash_FSCommand(ByVal command, ByVal args)\n');
  document.write(' call styleFlash_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write("</SCRIPT\> \n");
} 

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/* for Lookbooks */
function openPrintPage(surl){	
	 window.open(surl,'','scrollbars=yes,menubar=no,height=800,width=700,resizable=yes,toolbar=no,location=no,status=no');
}


