<!--

	function toggleVisible( whichLayer )
	{
		var elem, vis;
		
		if( document.getElementById ) // this is the way the standards work
			elem = document.getElementById( whichLayer );
		else if( document.all ) // this is the way old msie versions work
			elem = document.all[whichLayer];
		else if( document.layers ) // this is the way nn4 works
			elem = document.layers[whichLayer];
		
		vis = elem.style;
		// if the style.display value is blank we try to figure it out here
		if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
			vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
		
		vis.display = (vis.display==''||vis.display=='block')?'none':'block';
	}	
	
	function launchWin(url,w,h,scroll)
	{
		window.open(url,'openWin',"toolbar=no,width=" + w + ",height=" + h + ",left=100,top=100,status=no,menubar=no,location=no,scrollbars=" + scroll + ",resize=no");
	}
	
	function setOpacity(id, opacity) {
	  var object = document.getElementById(id).style; 
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = 'alpha(opacity=' + opacity + ')';
		if (opacity <= 1) object.display = 'none';
	}

	// =============================================================

	function fadeOut(id, opacity) {
		if(opacity < 99) {
			document.getElementById(id).style.display = 'block';
			setOpacity(id, opacity);
			opacity = opacity + 3;
			setTimeout("fadeOut('" + id + "'," + opacity + ")", 20);
		} 
	}	

	// =============================================================

	function fadeIn(id, opacity) {
		if(opacity > 0) {
			setOpacity(id, opacity);
			opacity = opacity - 3;
			setTimeout("fadeIn('" + id + "'," + opacity + ")", 20);
		} 
		else {
			document.getElementById(id).style.display = 'none';
		}
	}	
	
	//================================================================================================
	//Ajax functions
	//================================================================================================
	var xmlHttp;
	
	function addSwatchToLightBox(id)
	{
		alert(id);
	}
	
	function addSwatchToLightBox2(id)
	{ 
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request");
			return;
		} 
		var url="ajLightBox.aspx";
		url=url+"?swatchID=" + id;
		url=url+"&sid=" + Math.random();
		xmlHttp.onreadystatechange = stateChanged_LightBox;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
		
	function stateChanged_LightBox() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			document.getElementById("lightbox").innerHTML=xmlHttp.responseText; 
		} 
	}
 	
	function GetXmlHttpObject()
	{ 
		var objXMLHttp=null
		if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		return objXMLHttp	
	}
//-->