window.addEvent("domready", function(){
	
	//$$('.productPrice').getElement('span').setStyle('color', '#f0f');
	   
	$$('#pro_filter a').addEvents({
		'click': function(){			
			var subMenuLi = $(this).getParent().getParent().getNext();
			if ($(subMenuLi).getStyle("display") != "none"){
				$(subMenuLi).setStyle("display", "none");
				$(this).setStyle("background-position","132px bottom");
			}
			else{
				$(subMenuLi).setStyle("display", "block");
				$(this).setStyle("background-position","132px top");
			}
		}
	});
	
	//	
	var box = new MultiBox('mb', {
		descClassName: 'multiBoxDesc',
		useOverlay: true,
		showControls:false,
		onOpen: function(){$$('select').setStyle('visibility', 'hidden')},
		onClose: function(){$$('select').setStyle('visibility', 'visible')}
	});
	//
	//
	if ($('txtCustom'))
	{
		$('txtCustom').addEvents({
			'focus': function()
			{
				if (this.value.contains('Please type here to describe which color you would like from our Color chart and for what object if applicable.'))
					this.value = '';
			}, 
			'blur': function()
			{
				if (!this.value)
					this.value = 'Please type here to describe which color you would like from our Color chart and for what object if applicable.';
			}
		});
	}
	//
	//
	if ($("collectionImg")) {
		var mask = $("collectionImg").getNext();
		mask.setStyle("cursor", "pointer");
		mask.addEvent("mouseenter", function(e){
			$(this).getNext().setStyle("background-position", "left bottom");
		});
		mask.addEvent("mouseleave", function(e){
			$(this).getNext().setStyle("background-position", "left top");
		});
		mask.addEvent("click", function(e){
			window.location.href = $(this).getNext().href;
		});
		var lnk = mask.getNext();
		lnk.addEvent("mouseenter", function(e){
			$(this).setStyle("background-position", "left bottom");
		});
		lnk.addEvent("mouseleave", function(e){
			$(this).setStyle("background-position", "left top");
		});
	}
	//
	// init thumbnail of portfolio links
	if ($("portfolioItem")) {
		var portfolioItem = $$("#portfolioItem a");
		portfolioItem.each(function(item){
			item.onmouseover = function(){
				if ($(this).hasClass("selected")) {
					return;
				}
				$(this).getChildren()[1].setStyles({visibility: "hidden"});
				$(this).getChildren()[2].setStyles({visibility: "visible"});
			}
			item.onmouseout = function(){
				if ($(this).hasClass("selected")) {
					return;
				}
				$(this).getChildren()[1].setStyles({visibility: "visible"});
				$(this).getChildren()[2].setStyles({visibility: "hidden"});
			}
		});
	}
	//
	if ($('colorList'))
	{
		$$('#colorList li').each(function(itm, idx){
			if ((idx+1)/4 == 1)
				itm.setStyle('margin-right', '0px');
			if (($$('#colorList li').length > 4) && idx < 4)
				itm.setStyle('margin-bottom', '3px');
		});
	}
	
	
	
/*	//
	// init color chart
	if ($("colorChart")){
		new Element("div").setProperty("id", "mask").setStyles({
			backgroundColor: "#000",
			width: $$("body")[0].getCoordinates().width,
			height: $$("body")[0].getCoordinates().height,
			position: "absolute",
			top: 0,
			left: 0,
			zIndex:99
		}).injectBefore($("colorChart"));
		//
		var maskFX = new Fx.Style("mask", "opacity").set(0);
		var chartFX = new Fx.Style("colorChart", "opacity").set(0);
		$("colorChart").setStyles({
			top: $("sideContent").getPosition().y+0,
			left: $("sideContent").getPosition().x+300
		});
		$("colorChart").addEvent("click", function(){
			chartFX.start(1, 0);
			maskFX.start(0.8, 0);
		});
		if ($("colorChartLink")) {
			$("colorChartLink").addEvent("click", function(){
				chartFX.start(0, 1);
				maskFX.start(0, 0.8);
			});
		}
	}
	
	//
	// product list hover
	if ($("collectionList")) {
		var productList = $$("#collectionList a");
		productList.each(function(linkItem){
			var img = linkItem.getElement("img");
			linkItem.newImg = img.src.substr(0, img.src.lastIndexOf("."))+"_hover"+img.src.substr(img.src.lastIndexOf("."));
			linkItem.oldImg = img.src;
			linkItem.addEvent("mouseover", function(){
				img.setProperty("src", this.newImg);
			});
			linkItem.addEvent("mouseout", function(){
				img.setProperty("src", this.oldImg);
			});
			// preload images
			var tempImg = new Image();
			tempImg.src = linkItem.newImg;
		});
	}
*/	


	/* Tips 2 */
	if ($('colorList'))
		var Tips2 = new Tips($$('.Tips2'), {
			initialize:function(){
				this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0.5);
			},
			onShow: function(toolTip) {
				this.fx.start(0.8);
			},
			onHide: function(toolTip) {
				this.fx.start(0);
			}
		});
});


/* Product list - tooltip */
/*var dom = (document.getElementById) ? true : false;
var ns5 = (!document.all && dom || window.opera) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var _ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !_ie4 && !ie5 && !dom) ? true : false;

var origWidth, origHeight;
if (nodyn) { event = "nope" }
var tipFollowMouse= true;	
var tipWidth= 200;
var offX= 20;
var offY= 20; 
var tooltip, tipcss;
function initTip() {
	if (nodyn) return;
	tooltip = (_ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipcss = tooltip.style;
	
	if (tooltip&&tipFollowMouse) {
		document.onmousemove = trackMouse;
	}
}
var t1,t2;	
var tipOn = false;	
function doTooltip(evt, imgUrl, imgWidth, imgHeight) {
	if (!tooltip) return;
	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	tipOn = true;	
	if (_ie4||ie5||ns5) {
		if (!imgWidth) imgWidth='';
		if (!imgHeight) imgHeight='';
		var tip ="<img src='"+imgUrl+"' width='"+imgWidth+"' height='"+imgHeight+"' />";
	 	tooltip.innerHTML = tip;
	}
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);
}
function doTooltip_error(evt,value) {	
	if (!tooltip) return;
	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	tipOn = true;	
	if (_ie4||ie5||ns5) {					
		var tip_error ="<img src='"+imgUrl+"' width='"+imgWidth+"' height='"+imgHeight+"' />";
	tooltip.innerHTML = tip_error;
	}
	
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);
}
var mouseX, mouseY;
function trackMouse(evt) {
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body 
	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	if (tipOn) positionTip(evt);
}
function positionTip(evt) {
	if (!tipFollowMouse) {
		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;		
	}
	var tpWd = (_ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (_ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	var winWd = (ns5)? window.innerWidth+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	var winHt = (ns5)? window.innerHeight+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	if ((mouseX+offX+tpWd)+17>winWd) 
		tipcss.left = winWd-505+"px";
	else tipcss.left = mouseX+offX+"px";
 tipcss.top = mouseY+offY+"px";			

	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}
function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}
document.write('<div id="tipDiv"></div>')*/




