//functions 

var gspacer = new Image();
gspacer.src = 'media/images/spacer.gif'
var gquery = (location.search)?location.search.substring(1):'press-hats';
var bw = new verifyCompatibleBrowser
	


init = function(){
	startlist();
	startimg();
}

function verifyCompatibleBrowser()
{
    this.ver=navigator.appVersion;
    this.dom=document.getElementById?1:0;
    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0; 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
    this.Mac=(navigator.platform.indexOf("MacPPC")>-1)?1:0;
    this.PC=(navigator.platform.indexOf("Win")>-1)?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
    return this;
} 

function startlist() {
	if (document.all&&document.getElementById) {
		//navRoot = document.getElementById("content");
		var arLi = document.getElementsByTagName('LI')
		if(arLi){
		  	for (i=0; i<arLi.length; i++) {
		  	  node = arLi[i];
		  	  node.onmouseover=function() { this.className+=" over";}
		  	  node.onmouseout=function() { this.className=this.className.replace(" over", "");}
		  	}
		}
	}
}


function startimg() {
	if (document.all&&document.getElementById) {
		var root = document.getElementById("bridal-images");
		if(root) var ar = root.getElementsByTagName('IMG');
		
		if(root && ar){
		  	for (i=0; i<ar.length; i++) {
		  	  node = ar[i];
		  	   node.onmouseover=function() {this.className+=" over";}
		  	   node.onmouseout=function() {this.className=this.className.replace(" over", "");}
		  	}
		}
	}
}


window.onload=init;

function preload(img){
	var newimgpath = img.src.replace('thumb','large');	
	var tmp = new Image()
	tmp.src = newimgpath;
}

function removeImage(img,roll)
{
	var imageholder = document.getElementById('imageholder'); 
	
	if(imageholder.firstChild)
		imageholder.removeChild(imageholder.firstChild)
	
	img.src = roll;
	
	var copy = document.getElementById('copy');
	copy.style.display = 'block';
}

function loadImage(img,roll)
{
	var copy = document.getElementById('copy');
	copy.style.display = 'none';

	var imageholder = document.getElementById('imageholder'); 
		
	var lgroll = new Image();
	lgroll.src = gspacer.src;
	lgroll.src = img.src.replace('thumb','large');
	load(lgroll,imageholder)
	img.src = roll;	
}

function load(newimg,imageholder)
{
	gspacer.width = '20';
	gspacer.height = '20';

	imageholder.appendChild(gspacer);
	imageholder.replaceChild(newimg,imageholder.firstChild);
}

function swapImage(img,roll)
{
	img.src = roll;
}

function popBridal(arg)
{
	//window.open('bridal-pop.html','','')
	arg = (arg)?'?'+arg:'';
	window.open('bridal-pop.html'+arg+'','','width=425,height=525')
}

function popFlashBridal()
{
	window.open('leahc_bridal.html','','width=820,height=600')
}

function popFlashCarmen()
{
	window.open('leahc_carmen.html','','width=820,height=600')
}


function popCalendar()
{
	window.open('fashion-calendar.html','','width=570,height=450')
}

function openPress(arg)
{
	arg = (arg)?'?'+arg:'';
	window.open('press.html'+arg,'','width=740,height=506,scrollbars=yes')
}

function showCustomOrder(){
	$('bridal').className ='leftpage bridal-custom-order';
	$('bridal-collection-pages').style.display='none';
	$('bridal-design-pages').style.display='none';
	$('bridal-order-pages').style.display='block';
}

function showCustomDesign(){
	$('bridal').className+='leftpage bridal-custom-design';
	$('bridal-collection-pages').style.display='none';
	$('bridal-order-pages').style.display='none';
	$('bridal-design-pages').style.display='block';
}

function showBridal(page)
{
	$('bridal').className='leftpage';
	$('bridal-order-pages').style.display='none';
	$('bridal-design-pages').style.display='none';
	bridalimages.Run(page+'.xml')
}

function popHowToOrder(){
	window.open('order.html','order','width=400,height=400,scrollbars=yes')
}