var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isDyn = (isDOM || isIE4 || isNS4);

function getTag(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

function getTagStyle(id) {
	return (isNS4 ? getTag(id) : getTag(id).style);
}

function MenuDisplay(l_element) {
	if (navigator.appName != "Microsoft Internet Explorer") { return;}
	getTagStyle(l_element).display = 'block';
}

function MenuHide(l_element) {
	if (navigator.appName != "Microsoft Internet Explorer") { return;}
	getTagStyle(l_element).display = 'none';
}
function dynamicPhp(php,query){
	if(window.XMLHttpRequest) // Firefox 
		xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest non supporté par le navigateur 
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		return; 
	} 
 
	xhr_object.open("POST", php, true); 
     
	xhr_object.onreadystatechange = function() { 
	if(xhr_object.readyState == 4) 
		eval(xhr_object.responseText); 
	} 
 
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
	var data = query; 
	xhr_object.send(data);
}
/****************************/
/* POP UP */
/****************************/
function openWin(file, w, h) {
	var nom=0;
	nom = window.open(file, "fenetre", "toolbar=no, width=" + w + ", height=" + h + ", directories=no, status=no, scrollbars=yes, resize=no, resizable=no, menubar=no");
}
/****************************/

/****************************/
/* CHANGE LES IMAGES */
/****************************/
function change_image(img) {
	image = new Image;
	image.src = img;
	if(clientIs.ns) {
		document.destination.src = image.src;
	} else {
		destination.src = image.src;
	}
	return this;
}
/****************************/

/****************************/
/* RESTORE LES IMAGES */
/****************************/
function restore_image(img) {
	image = new Image;
	image.src = img;
	if(clientIs.ns) {
		document.destination.src = image.src;
	} else {
		destination.src = image.src;
	}
	return this;
}
/****************************/


function selectAll(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName]){
		return;
	}
	for (var j=0;j<FieldName.lenght;j++){
		var objCheckBoxes = document.forms[FormName].elements[FieldName[j]];
		if(!objCheckBoxes){
			return;
		}
		var countCheckBoxes = objCheckBoxes.length;
		if(!countCheckBoxes){
			objCheckBoxes.checked = CheckValue;
		}else{
			// set the check value for all check boxes
			for(var i = 0; i < countCheckBoxes; i++){
				objCheckBoxes[i].checked = CheckValue;
			}
		}
	}
}

/**********************************************/
// RECHERCHE DU NAVIGATEUR
/**********************************************/

/*function sniffer() 
{

    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);

    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major == 4));
//    this.ns6 = (this.ns && (this.major >= 5));
//	this.ns7 = (this.ns6 && document.clientHeight);

	this.safari = (navigator.product == 'Gecko' && agent.indexOf('Safari')!=-1) ? true:false;
	this.ns6 =(navigator.product == 'Gecko' && !window.find && !this.safari)?true:false;
	this.ns7 =(navigator.product == 'Gecko' && window.find && !this.safari)?true:false;


    this.ie   = (agent.indexOf('msie') != -1);
    this.ie3  = (this.ie && (this.major == 2));
    this.ie5  = (this.ie && (this.major >= 4) && (document.getElementById) ) ? true : false ;
    this.ie6  = (this.ie5 && (agent.indexOf('msie 6')!=-1) ) ? true : false ;
    this.ie4  = (this.ie && (this.major >= 4) && !(this.ie5));
    this.op3 = (agent.indexOf("opera") != -1);
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
    this.dom = (this.ns6|| this.ns7 || this.ie5 || this.safari );

}
clientIs = new sniffer();*/

/**********************************************/
// FONCTIONS MACROMEDIA
/**********************************************/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_showHideLayers_basket(ob, etat) { //v6.0
	if (etat == 0) {
		MM_showHideLayers(ob, '', 'show');
		return(1);
	} else {
		MM_showHideLayers(ob, '', 'hide');
		return(0);
	}
}


function menu_visible(calque){
	tout_effacer();
	MM_showHideLayers(calque,'','show');
	return true;
}

function tout_effacer(){
	for (i=0; i<60; i++){
		MM_showHideLayers('bulle'+i,'','hidden');
		MM_showHideLayers('bulle2_'+i,'','hidden');
	}
	// LA GROSSE BULLE
	MM_showHideLayers('bullebig0','','hidden');
	MM_showHideLayers('bulle2_big0','','hidden');
	return true ;
}

// JAVASCRIPT D'AFFICHAGE/MASKAGE DES SOUS MENUS DANS CONTENT LEFT 2007
function clicMenu(num,nbTotalMenu) {
	
//   nbTotalMenu = 2;	
  // Booléen reconnaissant le navigateur (vu en partie 2)
  
  isIE = (document.all)
  isNN6 = (!isIE) && (document.getElementById)
  if (isNN6) isIE = false;

  // Compatibilité : l'objet menu est détecté selon le navigateur
  if (isIE) menu = document.all['menu' + num];
  if (isNN6) menu = document.getElementById('menu' + num);
  
    // On ferme tout les menus déjà ouvert
  for (i=0;i<nbTotalMenu;i++) {
   if (i != num) {
    if (isIE) menuDiff = document.all['menu'+i];
    if (isNN6) menuDiff = document.getElementById('menu'+i);
    if (menuDiff.style.display != "none") {
     menuDiff.style.display = "none"
    }
   }
  }

  // On ouvre ou ferme
  if (menu.style.display == "none"){
    // Cas ou le tableau est caché
    menu.style.display = ""
  } else {
    // On le cache
    menu.style.display = "none"
   }
}

function ouvrirLien(url,ouverture,cible) {
  // Cette fonction permet d'ouvrir trois type de lien
  // 1 : Dans la fenêtre courante
  // 2 : Dans une nouvelle fenêtre
  // 3 : Dans une frame dont la cible doit être précisé

  switch (ouverture) {
    case "1" :
      // Ouverture dans la fenêtre courante
      document.location.href = url;
      break;
  }
}
// FIN JAVASCRIPT D'AFFICHAGE/MASKAGE DES SOUS MENUS DANS CONTENT LEFT 2007
//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
//Animated Collapsible DIV- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated June 27th, 07'. Added ability for a DIV to be initially expanded.

var uniquepageid=window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, "") //get current page path and name, used to uniquely identify this page for persistence feature

function animatedcollapse(divId, animatetime, persistexpand, initstate){
	this.divId=divId;
	this.divObj=document.getElementById(divId);
	this.divObj.style.overflow="hidden";
	this.timelength=animatetime;
	this.initstate=(typeof initstate!="undefined" && initstate=="block")? "block" : "contract";
	if (this.inistate == 'block') {
		this.isExpanded = 'yes';
	} else {
		this.isExpanded = 'no';
	}
//	this.isExpanded=animatedcollapse.getCookie(uniquepageid+"-"+divId) //"yes" or "no", based on cookie value
	this.contentheight=parseInt(this.divObj.style.height)
	if (this.inistate == 'contract') {
		this.contentheight="0px";
	}
	var thisobj=this
	if (isNaN(this.contentheight)){ //if no CSS "height" attribute explicitly defined, get DIV's height on window.load
		animatedcollapse.dotask(window, function(){thisobj._getheight(persistexpand)}, "load")
		if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes") //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
			this.divObj.style.visibility="hidden" //hide content (versus collapse) until we can get its height
	}
	else if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes") //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
		this.divObj.style.height=0 //just collapse content if CSS "height" attribute available
	if (persistexpand)
		animatedcollapse.dotask(window, function(){animatedcollapse.setCookie(uniquepageid+"-"+thisobj.divId, thisobj.isExpanded)}, "unload")
}

animatedcollapse.prototype._getheight=function(persistexpand){
	this.contentheight=this.divObj.offsetHeight
	if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes"){ //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
		this.divObj.style.height=0 //collapse content
		this.divObj.style.visibility="visible"
	}
	else //else if persistence is enabled AND this content should be expanded, define its CSS height value so slideup() has something to work with
		this.divObj.style.height=this.contentheight+"px"
}


animatedcollapse.prototype._slideengine=function(direction){
	var elapsed=new Date().getTime()-this.startTime //get time animation has run
	var thisobj=this
	if (elapsed<this.timelength){ //if time run is less than specified length
		var distancepercent=(direction=="down")? animatedcollapse.curveincrement(elapsed/this.timelength) : 1-animatedcollapse.curveincrement(elapsed/this.timelength)
	this.divObj.style.height=distancepercent * this.contentheight +"px"
	this.runtimer=setTimeout(function(){thisobj._slideengine(direction)}, 10)
	}
	else{ //if animation finished
		this.divObj.style.height=(direction=="down")? this.contentheight+"px" : 0
		this.isExpanded=(direction=="down")? "yes" : "no" //remember whether content is expanded or not
		this.runtimer=null
	}
}


animatedcollapse.prototype.slidedown=function(){
	if (typeof this.runtimer=="undefined" || this.runtimer==null){ //if animation isn't already running or has stopped running
		if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
			alert("Veuillez attendre que la page soit chargée et cliquez a nouveau")
		else if (parseInt(this.divObj.style.height)==0){ //if content is collapsed
			this.startTime=new Date().getTime() //Set animation start time
			this._slideengine("down")
		}
	}
}

animatedcollapse.prototype.slideup=function(){
	if (typeof this.runtimer=="undefined" || this.runtimer==null){ //if animation isn't already running or has stopped running
		if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
			alert("Veuillez attendre que la page soit chargée et cliquez a nouveau")
		else if (parseInt(this.divObj.style.height)==this.contentheight){ //if content is expanded
			this.startTime=new Date().getTime()
			this._slideengine("up")
		}
	}
}

animatedcollapse.prototype.slideit=function(){
	if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
		alert("Veuillez attendre que la page soit chargée et cliquez a nouveau")
	else if (parseInt(this.divObj.style.height)==0)
		this.slidedown()
	else if (parseInt(this.divObj.style.height)==this.contentheight)
		this.slideup()
}

// -------------------------------------------------------------------
// A few utility functions below:
// -------------------------------------------------------------------

animatedcollapse.curveincrement=function(percent){
	return (1-Math.cos(percent*Math.PI)) / 2 //return cos curve based value from a percentage input
}


animatedcollapse.dotask=function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
}

animatedcollapse.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

animatedcollapse.setCookie=function(name, value, days){
	if (typeof days!="undefined"){ //if set persistent cookie
		var expireDate = new Date()
		var expstring=expireDate.setDate(expireDate.getDate()+days)
		document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()
	}
	else //else if this is a session only cookie
		document.cookie = name+"="+value
}
function clearDefault(el){if(el.defaultValue==el.value)el.value=""}
var bigWidth;var smallWidth;var bigHeight;var bigX=0;var bigY=0;var zoomRatio=0.25;var productImageMarginTop=32;var productImageMarginSides=50;var productImageMarginBottom=20;var zoomWindowBoxWidth=0;var zoomWindowBoxHeight=0;var smallHeight;var bigBoxWidth;var bigBoxHeight;var factorY;var factorX;var easing=0.22;var zoomInterval=0;var mouseX=0;var mouseY=0;var sHeight;var elements;var scrollBorder;var thumbsPos=new Array();var thumbsPosDown=new Array();var imgAmount;var i=0;var g=92*5;var idc=0;var delay=0;var rollOverInetrval;var hideInterval;var str=new String(window.location);var zoomImageShown=false;var nr;var issueNumber;var pageNumber;var images;var scrollHeight;var isZoomOn=false;var isVideoOn=false;var videoHasBeenLoaded=false;var productPageMaxVisible=4;function initProductPage()
{sHeight=92;document.body.onmousemove=setMouseCoords;elements=countElements("thumbnails-mask","img");scrollHeight=sHeight*elements;smallWidth=230;smallHeight=345;bigBoxWidth=document.getElementById('zoom-box').offsetWidth;bigBoxHeight=document.getElementById('zoom-box').offsetHeight;if(elements>productPageMaxVisible){YAHOO.util.Event.addListener("up-arrow","click",moveDown);YAHOO.util.Event.addListener("down-arrow","click",moveUp);}
var oUpArrow=document.getElementById("up-arrow");var oDownArrow=document.getElementById("down-arrow");countsImages('thumbnails-mask');document.getElementById('medium-image').onclick=showBig;bigWidth=document.getElementById('zoom-image').offsetWidth;bigHeight=document.getElementById('zoom-image').offsetHeight;zoomWindowBoxWidth=(zoomRatio*bigBoxWidth);zoomWindowBoxHeight=(zoomRatio*bigBoxHeight);document.getElementById('zoomWindowBox').style.width=zoomWindowBoxWidth+'px';document.getElementById('zoomWindowBox').style.height=zoomWindowBoxHeight+'px';}
function prevPage()
{navigtionsetup();if(pageNumber>1){pageNumber--;window.location="themes/aubazar//Content/"+issueNumber+"/Issue&pageNo="+pageNumber+"";}}
function navigateToPage(nr)
{navigtionsetup();window.location="themes/aubazar//Content/"+issueNumber+"/Issue&pageNo="+nr+"";}
function nextPage()
{navigtionsetup();pageNumber++;window.location="themes/aubazar//Content/"+issueNumber+"/Issue&pageNo="+pageNumber+"";}
function navigtionsetup()
{str=new String(window.location);str=str.split("/");issueNumber=str[4];if(str[5]!="Issue"){pageNumber=str[5].split("=");pageNumber=pageNumber[1];pageNumber=pageNumber.split("");if(pageNumber[1]=="?"||pageNumber[1]==undefined){pageNumber=pageNumber[0];}else{pageNumber=pageNumber[0]+""+pageNumber[1];}}}
function countsImages(element_id)
{images=document.getElementById(element_id).getElementsByTagName('img');imgAmount=(images.length-1);idcc=(images.length-1);scrollBorder=(sHeight*3)-(sHeight*images.length);if(images.length>productPageMaxVisible){for(var d=0;d<images.length;d++)
{thumbsPos.push(sHeight*(d-1));thumbsPosDown.unshift(sHeight*(d-1));document.getElementById(images[d].id).style.top=thumbsPos[d]+'px';YAHOO.util.Event.addListener(images[d].id,"click",moveUp);}}}
function setMouseCoords(e)
{var ie=document.all?true:false;if(!e){e=window.event;}
if(e.pageX||e.pageY){mouseX=e.pageX;mouseY=e.pageY;}else if(e.clientX||e.clientY){mouseX=YAHOO.util.Event.getPageX(e);mouseY=YAHOO.util.Event.getPageY(e);}}
function imageOn(imageName){var imgSrcOff=new String(imageName.src);var imgSrcOn=imgSrcOff.replace(/inactive/gi,"active");var promoTxtOff=document.getElementById("promo-text").src;var promoTxtOn=promoTxtOff.replace(/off/gi,"on");var promoId=imageName.id;var issueNbr=document.getElementById("promo-text").src;issueNbr=issueNbr.split("/");promoId=promoId.slice(5);imageName.src=imgSrcOn;document.getElementById("promo-text").src="/images/issues/2008/"+issueNbr[6]+"/cover/promotext"+promoId+"_active.jpg";}
function imageOff(imageName){var imgSrcOff=new String(imageName.src);var imgSrcOn=imgSrcOff.replace(/active/gi,"inactive");;var promoTxtOff=document.getElementById("promo-text").src;var promoTxtOn=promoTxtOff.replace(/active/gi,"inactive");var promoId=imageName.id;var issueNbr=document.getElementById("promo-text").src;var issueNbr=issueNbr.split("/");promoId=promoId.slice(5);imageName.src=imgSrcOn;document.getElementById("promo-text").src="/images/issues/2008/"+issueNbr[6]+"/cover/promotext_inactive.jpg";}
function showBig()
{largeImageShown=true;if(isVideoOn){hideVideo();}
clearIntrv();setVisibilityById('demo',false);setVisibilityById('sizing',false);setVisibilityById('designer',false);setVisibilityById('zoom-image',true);setVisibilityById('zoom-box',true);setVisibilityById('zoomWindowBox',true);zoomInterval=setInterval("animateBigImage()",10);isZoomOn=true;}
function removeZoom()
{clearInterval(zoomInterval);setVisibilityById('zoom-image',false);setVisibilityById('zoom-box',false);isZoomOn=false;}
function showVideo(prodId)
{if(isZoomOn){removeZoom();}
if(!isVideoOn){var flashvars=[];flashvars.prodID=prodId;swfobject.embedSWF("/images/flash/productVideo.swf","prod-page-video","390","412","9.0.0",null,flashvars);videoHasBeenLoaded=true;setVisibilityById('video-box',true);setVisibilityById('demo',false);setVisibilityById('sizing',false);setVisibilityById('designer',false);isVideoOn=true;}}
function hideVideo()
{setVisibilityById('video-box',false);setVisibilityById('prod-page-video',false);setVisibilityById('demo',true);setVisibilityById('sizing',true);setVisibilityById('designer',true);isVideoOn=false;}
function showtab(tabname)
{var measuring_guide_tab=document.getElementById('measuring-guide');var size_conversion_tab=document.getElementById('size-conversion');var product_measurement_tab=document.getElementById('product-measurement');measuring_guide_tab.style.display='none';size_conversion_tab.style.display='none';product_measurement_tab.style.display='none';document.getElementById(tabname).style.display='block';}
function prepViewLargeImageLink(product_id,image_type,cache_url)
{var fullsize_link=document.getElementById('full-size-image-link');if(fullsize_link!=null){fullsize_link.onclick=function()
{launchNamePopUp('imgL','/'+channel+'/ViewFullSizeImage.ice?productID='+product_id+'&currentImage='+image_type,580,760);}}}
function loadBig(img,prodId,emptyString,cache_url)
{if(cache_url==undefined){cache_url="http://cache.net-a-porter.com";}
prepViewLargeImageLink(prodId,img,cache_url);document.getElementById("medium-image").src=cache_url+'/images/products/'+prodId+'/'+img+'_l.jpg';var str=new String("http://cachexl.net-a-porter.com");loadZoomImage(img,prodId,str);}
function loadZoomImage(img,prodId,str)
{document.getElementById("zoom-image").src=str+'/images/products/'+prodId+'/'+img+'_xl.jpg';}
function clearIntrv()
{clearTimeout(hideInterval);}
function hideBig()
{hideInterval=setTimeout("hideDelay()",250);}
function hideDelay()
{if(isZoomOn){if(!isVideoOn){setVisibilityById('demo',true);setVisibilityById('sizing',true);setVisibilityById('designer',true);setVisibilityById('zoom-image',false);setVisibilityById('zoom-box',false);setVisibilityById('zoomWindowBox',false);clearInterval(zoomInterval);}
isZoomOn=false;}}
function hideBigBox()
{setVisibilityById('zoom-image',false);}
function countElements(container_id,tag)
{var container=document.getElementById(container_id);var elem_count=container.getElementsByTagName(tag).length;return elem_count;}
function moveDown(e)
{if(idc>0){idc--;}else{idc=images.length-1;}
var tempPoss=thumbsPos.shift();thumbsPos.push(tempPoss);document.getElementById(images[idc].id).style.top=-92+'px';for(var d=0;d<images.length;d++)
{var moves=new YAHOO.util.Anim(images[d].id,{top:{to:thumbsPos[d]}},0.6,YAHOO.util.Easing.easeOutStrong);moves.animate();}}
function moveUp(e)
{if(document.getElementById(images[idc].id).offsetTop<92)
{document.getElementById(images[idc].id).style.top=368+'px';}
if(idc<imgAmount)
{idc++;}
else
{idc=0;}
var tempPos=thumbsPos.pop();thumbsPos.unshift(tempPos);for(var d=0;d<images.length;d++)
{var move=new YAHOO.util.Anim(images[d].id,{top:{to:thumbsPos[d]}},0.6,YAHOO.util.Easing.easeOutStrong);move.animate();}}
function openSignUp()
{if(validateEmail())
{var url='/'+channel+'/Content.ice?page=Sign-Up-For-Fashion-News&pgForward=popup'+'&email='+document.getElementById('email').value;open(url,'SignupForFashionNews','width=700,height=500');var tmp=open(url,'SignupForFashionNews','width=700,height=500');tmp.focus();}
return false;}

function jsubmit()
{if(validate())
{document.emailreg.submit();}}
function validate()
{if(!isGoodEmail(document.emailreg.email.value))
{alert("Please make sure that you\ninput a valid e-mail address");document.emailreg.email.focus()
return false}
return true;}
function validateEmail()
{if(!isGoodEmail(document.emailreg.email.value,false))
{alert("Please make sure that you\ninput a valid e-mail address");document.emailreg.email.focus()
return false}
return true;}
function isGoodEmail(emailStr,thankyouflag)
{if(thankyouflag==null)
{thankyouflag=true;}
var emailPat=/^(.+)@(.+)$/;var specialChars="\\(\\)<>@,;:\!\\\\\\\"\\.\\[\\]";var validChars="\[^\\s"+specialChars+"\]";var firstChars=validChars;var quotedUser="(\"[^\"]*\")";var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;var atom="("+firstChars+validChars+"*"+")";var word="("+atom+"|"+quotedUser+")";var userPat=new RegExp("^"+word+"(\\."+word+")*$");var domainPat=new RegExp("^"+atom+"(\\."+atom+")*$");var matchArray=emailStr.match(emailPat);if(matchArray==null)
{return false;}
var user=matchArray[1];var domain=matchArray[2];if(user.match(userPat)==null)
{return false;}
var IPArray=domain.match(ipDomainPat)
if(IPArray!=null)
{for(var i=1;i<=4;i++)
{if(IPArray[i]>255)
{return false;}}
return true;}
var domainArray=domain.match(domainPat)
if(domainArray==null)
{return false;}
var atomPat=new RegExp(atom,"g");var domArr=domain.match(atomPat);var len=domArr.length;if(domArr[domArr.length-1].length<2||domArr[domArr.length-1].length>3)
{return false}
if(domArr[domArr.length-1].length==3&&len<2)
{return false}
if(thankyouflag)
{window.open('Thank You','newFormWindow','width=340,height=260');}
return true;}
var rollover_state_re=/\/images\/issues.*(_on|_off)\.(gif|jpg)$/;function rolloverimage_handler()
{var ON='_on';var OFF='_off';var SUFFIX='.';if(rollover_state_re.test(this.src))
{this.src=this.src.replace(RegExp.$1+SUFFIX,(RegExp.$1==ON?OFF:ON)+SUFFIX);}}
function rolloverimage_setup()
{for(var i=0;i<document.images.length;i++)
{var img=document.images[i];if(rollover_state_re.test(img.src))
{img.onmouseover=rolloverimage_handler;img.onmouseout=rolloverimage_handler;}}}
function s(o,f)
{eval("document."+o+".src= "+f+".src;");}
function csoon()
{launchNamePopUp('csoon','http://www.net-a-porter.com/popups/comingsoon.html',340,110);}
function msg(a)
{if(a==1)
{csoon();}
else
{launchNamePopUp('soldout','http://www.net-a-porter.com/popups/soldout.html',340,260);}}
function stay()
{}
var dom,ns,ie;if(document.getElementById)
{dom=1;}
else if(document.layers)
{nn=1;}
else if(document.all)
{ie=1;}
function set_visible(div,value)
{var ref;if(dom==1)
{ref=document.getElementById(div).style;}
else if(ie==1)
{ref=eval('document.all.div.style');}
else if(nn==1)
{ref=eval('document.layers[div]');}
ref.visibility=value;}
function image_swap(layer,id,newpic)
{if(dom||ie)
{eval("document."+id+".src = "+newpic+".src;");}
else if(nn)
{eval("document.layers['"+layer+"'].document.images['"+id+"'].src = "+newpic+".src");}}
function switchClass(which,what)
{if(!document.layers)
{if(document.all)
{switchObj=eval('document.all.'+which+'');}
else
{switchObj=document.getElementById(''+which+'');}
switchObj.className=what;}}
function product_info(designer,status)
{this.designer=designer;this.status=status;}
var product=new Array();function clickOn(sku)
{var _sku='_'+sku;var status=product[_sku].status;if(!status||status=="none"){ri(product[_sku].designer,sku);}else if(status==3){launchNamePopUp('soldout','/'+channel+'/Content.ice?page=Sold-Out&pgForward=popup',280,210);}else{window.location.href="/product/"+sku;}}
var ri_subdir="";var Collection_ID="";function ri(designer,sku)
{designer=designer.toLowerCase();var url='/'+channel+'/Content.ice?page=RegisterInterest&pgForward=popup&designer='+designer+'&sku='+sku;if(sku==null)
{url='/'+channel+'/Content.ice?page=RegisterInterest&pgForward=popup&designer='+designer+'&sku='+Collection_ID+'&collection=1';}
if(ri_subdir!=null&&ri_subdir!="")
{url+='&subdir='+ri_subdir;}
launchNamePopUp('ri',url,320,320);}
function designerri(designer,sku)
{designer=designer.toLowerCase();var url='/'+channel+'/Content.ice?page=DesignerRegisterInterest&pgForward=popup&designer='+designer;if(sku==null)
{url='/'+channel+'/Content.ice?page=DesignerRegisterInterest&pgForward=popup&designer='+designer;}
if(ri_subdir!=null&&ri_subdir!="")
{url+="&subdir="+ri_subdir;}
launchNamePopUp('des_ri',url,320,300);}
function show_instock_tags()
{var string="";for(var _id in product)
{var sku=_id.replace(/_(\d+).*/,"$1");var id=_id.replace(/^_/,"");var instock_tag=product[_id].status;if(product[_id].status==0||product[_id].status==""||product[_id].status=="none")
{continue;}
switch(product[_id].status)
{case 1:instock_tag="instock";break;case 3:instock_tag="soldout";break;case 2:instock_tag="prepay";break;}
string+="<div id=\"instock"+id+"\">\n"+"<a href=\"javascript:clickOn("+sku+")\" onmouseover=\"switchClass('link"+id+"','black')\" onmouseout=\"switchClass('link"+id+"','a')\"><img src=\"/i/nav_elements/"+instock_tag+".gif\" border=0 alt=\"\"></a>\n"+"</div>\n";}
document.write(string);}
if(top.tempo==null)top.tempo=new Object();function save(id,val)
{if(val!=null)top.tempo[id]=val;}
function restore(id)
{return(top.tempo[id]!=null)?top.tempo[id]:null;}
function clear(id)
{if(top.tempo[id]!=null)top.tempo[id]=null;}
function launchGenericPopUp(winName,url,w,h,incScroll)
{var newWindow=window.open(url,winName,'width='+w+',height='+h+',menubar=no,location=no,resizable=1,status=no,scrollbars='+incScroll);if(window.focus){newWindow.focus();}}
function launchNamePopUp(name,url,w,h)
{launchGenericPopUp(name,url,w,h,1);}
function launchNamePopUpNoScroll(name,url,w,h)
{launchGenericPopUp(name,url,w,h,0);}
function launchPopUp(url,w,h)
{launchNamePopUp('NAP_pop',url,w,h);}
function launchPopUpNoScrolls(url,w,h)
{launchNamePopUpNoScroll('NAP_pop_noscr',url,w,h);}
function help(url)
{launchNamePopUp('NAPHelp',url,670,540);}
function mouseAction(state,image)
{rollOverDiv="div"+image.name;rollOverImageName=image.name;rollOverImage="";if(state=="on")
{rollOverImage=image.name+"1";}
else if(state=="off")
{rollOverImage=image.name+"0";}
image_swap(rollOverDiv,rollOverImageName,rollOverImage);}
var rollover_state_re=/\/images\/issues.*(_on|_off)\.(gif|jpg)$/;function rolloverimage_handler()
{var ON='_on';var OFF='_off';var SUFFIX='.';if(rollover_state_re.test(this.src))
{this.src=this.src.replace(RegExp.$1+SUFFIX,(RegExp.$1==ON?OFF:ON)+SUFFIX);}}
var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;function ControlVersion()
{var version;var axo;var e;try
{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version");}
catch(e)
{}
if(!version)
{try
{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version");}
catch(e)
{}}
if(!version)
{try
{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version=axo.GetVariable("$version");}
catch(e)
{}}
if(!version)
{try
{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version="WIN 3,0,18,0";}
catch(e)
{}}
if(!version)
{try
{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version="WIN 2,0,0,11";}
catch(e)
{version=-1;}}
return version;}
function GetSwfVer()
{var flashVer=-1;if(navigator.plugins!=null&&navigator.plugins.length>0)
{if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"])
{var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var flashDescription=navigator.plugins["Shockwave Flash"+swVer2].description;var descArray=flashDescription.split(" ");var tempArrayMajor=descArray[2].split(".");var versionMajor=tempArrayMajor[0];var versionMinor=tempArrayMajor[1];if(descArray[3]!="")
{tempArrayMinor=descArray[3].split("r");}
else
{tempArrayMinor=descArray[4].split("r");}
var versionRevision=tempArrayMinor[1]>0?tempArrayMinor[1]:0;var flashVer=versionMajor+"."+versionMinor+"."+versionRevision;}}
else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1)flashVer=4;else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1)flashVer=3;else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1)flashVer=2;else if(isIE&&isWin&&!isOpera)
{flashVer=ControlVersion();}
return flashVer;}
function DetectFlashVer(reqMajorVer,reqMinorVer,reqRevision)
{versionStr=GetSwfVer();if(versionStr==-1)
{return false;}
else if(versionStr!=0)
{if(isIE&&isWin&&!isOpera)
{tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",");}
else
{versionArray=versionStr.split(".");}
var versionMajor=versionArray[0];var versionMinor=versionArray[1];var versionRevision=versionArray[2];if(versionMajor>parseFloat(reqMajorVer))
{return true;}
else if(versionMajor==parseFloat(reqMajorVer))
{if(versionMinor>parseFloat(reqMinorVer))
{return true;}
else if(versionMinor==parseFloat(reqMinorVer))
{if(versionRevision>=parseFloat(reqRevision))
{return true;}}}
return false;}}
function uncheckAll()
{email_prefs.weekly_newsletter.checked=false;email_prefs.sale_special.checked=false;}
function toggleOpenClosedById(id)
{var elem=document.getElementById(id);if(elem){if((' '+elem.className+' ').indexOf(' closed ')!=-1){elem.className=elem.className.replace('closed','open');}else{elem.className=elem.className.replace('open','closed');}}}
function toggleDisplay(id)
{var elem=document.getElementById(id);var disp=elem.style.display;if('none'!=disp)
{elem.style.display='none';}
else
{elem.style.display='block'}}
function toggleArrowClass(src)
{var elem=document.getElementById(src);var elemclass=elem.getAttributeNode('class').value;if('productnav-toggle-rightarrow'==elemclass)
{elem.setAttribute('class','productnav-toggle-downarrow');elem.className='productnav-toggle-downarrow';}
else if('productnav-toggle-downarrow'==elemclass)
{elem.setAttribute('class','productnav-toggle-rightarrow');elem.className='productnav-toggle-rightarrow';}}
goToLocation=function(url){window.location=url;}
function setVisibilityById(id,visibility){if(document.getElementById(id)!=null){if(visibility){document.getElementById(id).style.visibility='visible';}else{document.getElementById(id).style.visibility='hidden';}}}
var imageTimeout=0;function rollOverImage(imageElem,cache_image_url,event){var e=window.event||event;function changeImageOver(){imageElem.src=cache_image_url;}
function changeImageOut(){imageElem.src=cache_image_url;}
if(imageElem){if(e.type=="mouseover"){imageTimeout=setTimeout(changeImageOver,200);}else if(e.type=="mouseout"){clearTimeout(imageTimeout);changeImageOut();}}}
