var navImages = new Array();
	var imNames = new Array( 'collections' , 'shop' , 'press' , 'about'  , 'stores'  , 'contact'  , 'charity' , 'viewCart' , 'searchButton' , 'signIn' , 'blog' );
	var subNames = new Array( 'snCollections' , 'snShop' ,  'snPress'  , 'snAbout'  , 'snStores'  , 'snContact' , 'snLinks' , 'snCart' ,'snCollections' ,'nothing' , 'nothing' );

	var navLoaded = 0;
	function loadImages( ActiveNavId ){
		if ( isJapan) {
		imNames = new Array( 'collections' , 'shop' , 'press' , 'about'  , 'stores'  , 'contact'  , 'links' , 'viewCart' );
						for ( var i=0,j=0 ; j < imNames.length ; i+=2,j++  ) {
						navImages[  i  ] = new Image();
						navImages[  i  ].src = "images/jp/tn_" + imNames[  j  ]   +  "_NT.gif" ;
						navImages[  i+1  ] = new Image();
						navImages[  i+1  ].src = "images/jp/tn_"  + imNames[  j  ] +  "_RO.gif" ;
					}// end for
						
					//if ( IE )  document.getElementById( 'snShop' ).style.pixelLeft = ( isMac)? 160: 45  ;
					//else   document.getElementById( 'snShop' ).style.left  = ( isMac)? 160: 45  ; 
					
					if ( IE )  document.getElementById( 'snShop' ).style.pixelLeft = ( isMac)? 20: 60  ;
					else   document.getElementById( 'snShop' ).style.left  = ( isMac)? 20: 140;  
					
					if ( IE )  document.getElementById( 'snAbout' ).style.pixelLeft = 399 ;
					else   document.getElementById( 'snAbout' ).style.left  = 399 ;
					
					if ( IE )  document.getElementById( 'snStores' ).style.pixelLeft = 466 ;
					else   document.getElementById( 'snStores' ).style.left  = 466 ;
					
					if ( IE )  document.getElementById( 'snContact' ).style.pixelLeft = 527 ;
					else   document.getElementById( 'snContact' ).style.left  = 527 ;
					 
					 
					 document.getElementById( 'snShop' ).style.width = 700
				
		}else if ( isPort ){
		imNames = new Array( 'collections' , 'shop' , 'press' , 'about'  , 'stores'  , 'contact'  , 'links' , 'viewCart' );
		
					for ( var i=0,j=0 ; j < imNames.length ; i+=2,j++  ) {
						navImages[  i  ] = new Image();
						navImages[  i  ].src = "images/pg/tn_" + imNames[  j  ]   +  "_NT.gif" ;
						navImages[  i+1  ] = new Image();
						navImages[  i+1  ].src = "images/pg/tn_"  + imNames[  j  ] +  "_RO.gif" ;
					}// end for
					
					if ( IE )  document.getElementById( 'snShop' ).style.pixelLeft =  163  ; //237
					else   document.getElementById( 'snShop' ).style.left  = 163  ;  
					
					if ( IE )  document.getElementById( 'snPress' ).style.pixelLeft = 324 ;
					else   document.getElementById( 'snPress' ).style.left  = 324 ;
					
					
					if ( IE )  document.getElementById( 'snAbout' ).style.pixelLeft = 397 ;
					else   document.getElementById( 'snAbout' ).style.left  = 397 ;
					
					if ( IE )  document.getElementById( 'snStores' ).style.pixelLeft = 476 ;
					else   document.getElementById( 'snStores' ).style.left  = 476 ;
					
					if ( IE )  document.getElementById( 'snContact' ).style.pixelLeft = 545 ;
					else   document.getElementById( 'snContact' ).style.left  = 545 ;
		
		
		}else if ( isItalian ){
		imNames = new Array( 'collections' , 'shop' , 'press' , 'about'  , 'stores'  , 'contact'  , 'charity' , 'viewCart' );
		
					for ( var i=0,j=0 ; j < imNames.length ; i+=2,j++  ) {
						navImages[  i  ] = new Image();
						navImages[  i  ].src = "images/it/tn_" + imNames[  j  ]   +  "_NT.gif" ;
						navImages[  i+1  ] = new Image();
						navImages[  i+1  ].src = "images/it/tn_"  + imNames[  j  ] +  "_RO.gif" ;
					}// end for
					
					if ( IE )  document.getElementById( 'snShop' ).style.pixelLeft =  67  ; //237
					else   document.getElementById( 'snShop' ).style.left  = 67  ;  
					
					if ( IE )  document.getElementById( 'snPress' ).style.pixelLeft = 335 ;
					else   document.getElementById( 'snPress' ).style.left  = 335 ;
					
					
					if ( IE )  document.getElementById( 'snAbout' ).style.pixelLeft = 389 ;
					else   document.getElementById( 'snAbout' ).style.left  = 389 ;
					
					if ( IE )  document.getElementById( 'snStores' ).style.pixelLeft = 454 ;
					else   document.getElementById( 'snStores' ).style.left  = 454 ;
					
					if ( IE )  document.getElementById( 'snContact' ).style.pixelLeft = 504 ;
					else   document.getElementById( 'snContact' ).style.left  = 504 ;
		
		
		
		}else{
				 for ( var i=0,j=0 ; j < imNames.length ; i+=2,j++  ) {
						navImages[  i  ] = new Image();
						navImages[  i  ].src = "images/tn_" + imNames[  j  ]   +  "_NT.gif" ;
						navImages[  i+1  ] = new Image();
						navImages[  i+1  ].src = "images/tn_"  + imNames[  j  ] +  "_RO.gif" ;
				}
		} // end if else
		navLoaded = 1;
		activate_section_nav( ActiveNavId );
	}// end func
	
var t_clock  ;
var selectdIM = "_empty";	
var selectdSUB = "";
var selectdAR;
var currentPage = "";
var resetTimer_currentPage;

// Language options
var isJapan = 0;
var isPort = 0;
var isItalian = 0;
var isFrench = 0;



var navJsStatements = new Array();

navJsStatements.collections = new Array( 'collections' , 1 , 'snCollections' );
navJsStatements.shop = new Array( 'shop' , 3 , 'snShop' );
navJsStatements.press = new Array( 'press' , 5 , 'snPress' );
navJsStatements.about = new Array( 'about' , 7 , 'snAbout' );
navJsStatements.stores = new Array( 'stores' , 9 , 'snStores' );
navJsStatements.contact = new Array( 'contact' , 11 , 'snContact' );
navJsStatements.links = new Array( 'links' , 13 , 'snLinks' );
navJsStatements.viewCart = new Array( 'viewCart' , 15 , 'snCart' );

navJsStatements.charity = new Array( 'charity' , 13 , 'snLinks' );

function activate_section_nav( id ){
	if ( id ) { 
		var sArray =  navJsStatements[ id ]
											//alert ( sArray );
		onMenu( sArray[ 0 ]  , sArray[ 1 ] , sArray[ 2 ] );
		currentPage = sArray[ 0 ];
	}
}
	
	
var waitTimer;
	
	function onMenu( HTMLid  , arID , subNavId ){
	
		if (navLoaded ){    //alert ( "in onMenu" + HTMLid );
			clearTimeout ( t_clock );
			
			if (( selectdIM != "_empty" ) && (  selectdIM != HTMLid )) {
				hideSub( selectdSUB );
				offMenu( selectdIM , (selectdAR-1) )
			}
			
			document.images[  HTMLid  ].src = navImages[  arID ].src;
			showSub ( subNavId );
				
			selectdIM = HTMLid ;
			selectdAR = arID ;
			selectdSUB = subNavId;
		}
		//waitTimer = setTimeout ( "onMenu(" +  HTMLid  + " , " +  arID + " , " + subNavId + " )" , 1000 );
	} // end onMenu
	
	
	function showSub ( id ){
			document.getElementById( id ).style.visibility = 'visible';
	}
	
	function hideSub( id ){
			document.getElementById( id ).style.visibility = 'hidden';
	}
	
	function offMenu( id , arID ) {
		if (navLoaded ){
			document.images[  id  ].src = navImages[  arID ].src;
		}
	}

	function timer(){
		t_clock = setTimeout ( 'clear_all()' , 1200 );
	}

	function clear_all(){
	  	for ( var y=0; y < imNames.length ; y++ ){
		if ( imNames[ y ] == currentPage ) continue ;
		//alert ( imNames[ y ] );
	  			document.images[  imNames[ y ]  ].src = navImages[ y*2 ].src;
				document.getElementById( subNames[ y ] ).style.visibility = 'hidden';
	  	}
		clearTimeout ( t_clock );
		
		resetTimer_currentPage = setTimeout (  "activate_section_nav('" + currentPage +"' )"  , 50 );

	}
	
	function clear_timer(){
		clearTimeout ( t_clock );
	}
	
// END NAV FUNCTIONS

/* ************** SET UPS ***************************
****************************************************  */

	function getClientWidth(){
		var cw =(IE)?document.body.clientWidth :window.innerWidth ;
	
			if( NS )  { 
				if ( window.innerHeight < document.height )cw -= 13;
				//alert ( 'window.innerHeight=' + window.innerHeight + 'document.height =' + document.height)
			}
		return cw ;
	}
	
	function getClientHeight(){  // not used as yet
		var ch =(IE)?document.body.clientHeight :window.innerHeight ;
			if( NS )  { 
			
			}
		return ch;
	}
	
	function getScreenHeight(){
		//alert ( screen.height );
	}
	
	function DynamicPosDiv( id , objectWidth , offsetAmount ){
		this.object = id ;
		this.div_obj = document.getElementById( this.object ).style;
		//this.lpos = cw/2 - offset
		this.offset = parseInt( objectWidth / 2 )+ offsetAmount ;
	}

DynamicPosDiv.prototype.set = function(){
 			this.cw = getClientWidth();
 			this.lpos = this.cw/2 - this.offset;
			this.initPos = 1;
			if(this.cw > 764 ){
			if ( this.lpos < this.initPos ) this.lpos = this.initPos; 
	 			if (IE )this.div_obj.pixelLeft = this.lpos ;
	 			if( NS )this.div_obj.left = this.lpos ;
				this.div_obj.visibility="visible";
			
			}else{
				if (IE )this.div_obj.pixelLeft = this.initPos ;
	 			if( NS )this.div_obj.left = this.initPos ;
				this.div_obj.visibility="visible";
			}
		//for ( i=0; i<unhideArray.length ; i++ ){//var snv = new dop( unhideArray[ i ]  );//snv.el.visibility="visible";}
 }

 var isLoaded = 0;
 var obj_topNavContainer;
 
function setUpDivs( ActiveNavId ) {
		setVal = 400 ; 
		id = 'topNavContainer' ;
		isLoaded=1;
 		obj_topNavContainer = new DynamicPosDiv ( 'topNavContainer' , 762 , -1 )
		obj_topNavContainer.set();
		// activate_section_nav( ActiveNavId ); call moved to load nav images()
}
	
function setDivPos(){
	if ( isMac || ns4 )this.location.href = this.location.href;
	if(isLoaded){
	 	obj_topNavContainer.set();
	}
}
var checkOutUrl = '';  //  set via Cbusiness Props in SF6 leftNav cntrl 
function getCheckOutUrl( ){	
		if ( checkOutUrl ) {
			return checkOutUrl ;  // will have been set on ssl page load with session_id
		}else{
			return "shoppingcart.aspx" ;
		}
} 

function veiwBasket(){
	this.window.location = getCheckOutUrl( );//alert ( "in :" +  getCheckOutUrl( ) );
}

function pageInit( id ){
	setUpDivs(  ); //id
	loadImages( id );
	//alert ( getCheckOutUrl( ) );
}
//alert ( screen.availableHeight ) if avail h < 601 : move top of page ( margin ) and top of topNav up 14px.....


var selectd_leftNav = '' ; // request.QueryString ( subCat )
	
function setLeftNavItem (){
		if (selectd_leftNav){
			document.getElementById( selectd_leftNav ).style.color = "#FFeBAA"  ;//'leftNavLinkSelctd';
			document.getElementById( selectd_leftNav ).style.fontWeight = "bold"  ;
		}
}

function openSecCodeWindow(){
	var scWin = window.open ( 'sec_code.html','scWin','titlebar=0,status=0,location=0,toolbar=0,menubar=0,scrollbars=no,resizable=no,width=440,height=400' )
	scWin.focus();
}


function openJewelWin( html ){
	html += ".html"
	var jWin = window.open ( html,'jWin','titlebar=0,status=0,location=0,toolbar=0,menubar=0,scrollbars=no,resizable=no,width=440,height=260' )
	jWin.focus();
}
// openJewelWin( spessartite )  openJewelWin( diopside )
// onload="pageInit()" onResize="setDivPos()"

function posEmailIE(){
			if ( IE ){
			//document.getElementById( 'ecapContainer' ).style.pixelTop = -37;
			}
}
function posEmailIE_02(){
			if ( IE ){
			document.getElementById( 'ecapContainer' ).style.pixelTop = -20;
			}
}

function getMeroCookie(c_name){
	if ( document.cookie.length>0 ){
  			c_start=document.cookie.indexOf( c_name + "=" );
  			if ( c_start!=-1 ){ 
    			c_start=c_start + c_name.length+1; 
    			c_end=document.cookie.indexOf( ";", c_start);
    			if ( c_end==-1 ) c_end=document.cookie.length;
    			return unescape( document.cookie.substring( c_start,c_end ) );
    		} 
  	}
	
	return "";
}

function setMeroCookie( c_name , StrValue ){
	var cVal = getMeroCookie ( c_name ) ;
	//alert ( "c_name = " + c_name + "  StrValue= " + StrValue );
	StrValue = StrValue + ',' + cVal  ;
	document.cookie = c_name+ "=" + escape( StrValue );
}

function setMeroCookie02( c_name , PID , CatID , PageID, PosID ){
	var cVal = getMeroCookie ( c_name ) ;
	//alert ( "c_name = " + c_name + "  StrValue= " + StrValue );
	StrValue = PID + ',' +  CatID + ',' + PageID + ',' + PosID 
	StrValue = StrValue + ',' + cVal  ;
	document.cookie = c_name+ "=" + escape( StrValue );
	//alert (   StrValue  );
	//alert ( " cname = " +  c_name + " PID = " + PID  + " CatID = " + CatID + " PageID = " + PageID + " PosID = " +  PosID );
}

function deleteMeroCookie (){
		c_name = "mero_usrViewCookie";
		document.cookie = c_name+ "=" +  "";
}	
		
		
function openPressDetail( id ){
	//alert ( id );
	getPid = id ; 
	html = 'popDetail.aspx?p_id=' + getPid;
	var meroPress = window.open ( html,'contentWin','titlebar=0,status=0,location=0,toolbar=0,menubar=0,scrollbars=no,resizable=yes,width=327,height=450' )
	meroPress.focus();	
}


var fade_timer;
var fade_timer_count = 0;
var fadeArray = new Array ( "opacity15" , "opacity25" , "opacity35"  , "opacity50" , "opacity65" , "opacity80" , "opacity100" , "opacity100");

function changeFade( ){
//alert ( fadeArray[ fade_timer_count ] );
	//document.getElementById('nycImage').setAttribute("class", fadeArray[ fade_timer_count ] );
	clearTimeout(fade_timer);
	document.getElementById('nycImage').className = fadeArray[ fade_timer_count ];
	//alert ( document.getElementById('nycImage').className );
	timer_changeFade();
	
	
}

function timer_changeFade(){
	if ( fade_timer_count < (fadeArray.length-1)){
	 	fade_timer = setTimeout("changeFade()",200);
		fade_timer_count ++
	}else {
	clearTimeout(fade_timer);
	fade_timer_count = 0;
	}
}