function showHide(id) {

	// Close tabs
	
	closeTabs();
	
	var tabID = document.getElementById(id);

	// Check to see if we should:
	// show or hide
	if (tabID.style.display == "block") {
		tabID.style.display = "none";
	} else {
		//Show the tab's content
		tabID.style.display = "block";
		
		//Change the display of the tab
		document.getElementById(id+"_tab").className = "here";
	}

}

function closeTabs() {
		// Set display to none and change classes on tabs to "default"
		document.getElementById("productdesc").style.display = "none";
		document.getElementById("productdesc_tab").className = "";
		document.getElementById("related").style.display = "none";
		document.getElementById("related_tab").className = "";
		document.getElementById("friend").style.display = "none";
		document.getElementById("friend_tab").className = "";
}

function closePopup(id) {
	//show all drop down boxes
	var s = document.getElementsByTagName('select');
	for (var i=0; i<s.length; i++) {
		s[i].style.display = "block";
	}
	//hide popup
	document.getElementById(id).style.display = "none";
}

function openPopup(id) {
	if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer") {
		scrollingDistance = document.documentElement.scrollTop + 150;
	} else {
		scrollingDistance = document.documentElement.scrollTop;
	}
	document.getElementById(id).style.padding = scrollingDistance + "px" + " 0 0 0";
	document.getElementById(id).style.width = document.body.offsetWidth + "px";
	if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer") {
		bodyHeight = parseInt(document.body.offsetHeight*1.028);
	} else {
		bodyHeight = parseInt(document.body.offsetHeight*1.045);
	}
	//hide all drop down boxes
	var s = document.getElementsByTagName('select');
	for (var i=0; i<s.length; i++) {
		s[i].style.display = "none";
	}
	//display pop up
	document.getElementById(id).style.height = (bodyHeight - scrollingDistance) + "px";
	document.getElementById(id).style.display = "block";

}

function popupScroll(scrollDistance) {
	if(document.getElementById('attributes_bg')){
		document.getElementById('attributes_bg').style.padding = (scrollDistance+150) + "px 0 0 0";
		if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer") {
			bodyHeight = document.body.offsetHeight*1.028;
		} else {
			bodyHeight = document.body.offsetHeight*1.045;
		}
		document.getElementById('attributes_bg').style.height = ((bodyHeight-scrollDistance)-150) + "px";
	}
}

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	window.attachEvent("onload", alphaBackgrounds);
}

function alphaBackgrounds(){
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	for (i=0; i<document.all.length; i++){
		var bg = document.all[i].currentStyle.backgroundImage;
		if (itsAllGood && bg){
			if (bg.match(/\.png/i) != null){
				var mypng = bg.substring(5,bg.length-2);
				document.all[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='crop')";
				document.all[i].style.backgroundImage = "url('./images/spacer.gif')";
			}
		}
	}
	if (document.getElementById('attributes_bg') != null) {
		document.getElementById('attributes_bg').style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./images/attributes-bg.png', sizingMethod='scale')";
		document.getElementById('attributes_bg').style.backgroundImage = "url('./images/spacer.gif')";
	}
}