// JavaScript Document
// Author: Jessica Rea :: Brulant, Inc.
	// Date: Feb 22, 2007


// set initial visibility of the Email A Friend div
function init(){
	//hideIt("emailFriendTabContent");
	//hideCon("pConfirmation","sureContent");
}

// set timer for the personaliztion confirmation, div will disappear after 5 seconds has passed
function hideWin(){
	setTimeout("hideCon('pConfirmation')", 5000);
}
// show personalization confirmation 
function showCon(id){
	object = document.getElementById(id);
	if (object != null) object.style.visibility = "visible";
	if (typeof document.getElementById('color')!='undefined'  && null != document.getElementById('color'))
	{
		document.getElementById('color').style.visibility = "hidden";
	}
	hideWin();
}
// hide personalization confirmation
function hideCon(id){
	object = document.getElementById(id);
	if (object != null) object.style.visibility = "hidden";
	if (typeof document.getElementById('color')!='undefined'  && null != document.getElementById('color'))
	{
		document.getElementById('color').style.visibility = "visible";
	}
}

// show div 
function showIt(id){
	object = document.getElementById(id);
	if (object != null) object.style.display = "block";
	if (object != null) object.style.visibility = "visible";
}

// hide div
function hideIt(id){
	object = document.getElementById(id);
	if (object != null) object.style.display = "none";
}

function showLBModal(id,targetURL) {
	lightbox.prototype.hideLBSelects();
	showIt('lb_overlay');
	showIt(id);
	if (targetURL != null && targetURL != "") {
		$j(".lbAction").each(
			function(node){
				if (this.href.indexOf("javascript:") == -1){
				this.href=targetURL;
			  }
			}
		);
	}
}

function hideLBModal(id) {
	lightbox.prototype.showLBSelects();
	hideIt('lb_overlay');
	hideIt(id);
}

function changeNav(nav) {
		var sfEls = document.getElementById("productTabs").getElementsByTagName("li");
		for (var i=0; i<sfEls.length; i++) {
			if(nav==0) {
				sfEls[0].className="active";
				sfEls[1].className="inactive";
			}
			if(nav==1){
				sfEls[0].className="inactive";
				sfEls[1].className="active";
			}
		}
}


/* tabSwitcher
*	structure should be as follows:
*	<ul id="masterId">
*	<li class="active"><a />
*	<li class="inactive"><a />
*	</ul>
*/
function tabSwitcher(){
	var obj = arguments[0];
	var masterId = arguments[1];
	var turnOn = arguments[2];
	
	for(var i = 3 ; i < arguments.length; ++i){
		hideIt(arguments[i]);
	}
	showIt(turnOn);
	
	var pNode = obj;
	var currentId = ""
	var loop = 0;
	while(currentId != masterId && loop <= 20){
		if(pNode.id) currentId = pNode.id;
		if(pNode.parentNode){ 
			if(pNode.id != masterId) pNode = pNode.parentNode;
		}
		++loop;
	}
	var elements = pNode.getElementsByTagName("li");
	for(var i = 0; i < elements.length; ++i){
		elements[i].className = "inactive";
	}
	obj.parentNode.className = "active";
}


function hideSelectBox(selectBoxId){
	if (typeof document.getElementById(selectBoxId)!='undefined' && null != document.getElementById(selectBoxId) )
	{
		document.getElementById(selectBoxId).style.display = 'none';
	}
}
function showSelectBox(selectBoxId){
	if (typeof document.getElementById(selectBoxId)!='undefined'  && null != document.getElementById(selectBoxId))
	{
		document.getElementById(selectBoxId).style.display = 'block';
	}
}
