// JavaScript Document
//
// <a href="javascript:mailto('yourdomain.com','you')">you@yourdomain.com</a>
//
function mailto(domain,user) 
{ 
document.location.href = "mailto:" + user + "@" + domain;
}

function showImg(theImgId){
//document.getElementById(theCurrentImgId).style.display = "none";
//theCurrentImgId = theImgId;
document.getElementById(theImgId).style.display = "block";
}

function showLaserElement() {
	var displayValue = "none";
	if ( arguments.length < 1 ) { displayValue = "block" };
	// Find targeted elements: tables with class="laserPanel"
	var theElementList = document.getElementsByTagName("table");
	for ( var i = 0; i < theElementList.length; i++ ) {
		theClass = theElementList[i].className;
		if ( theClass == "laserPanel" ) {
			theElementList[i].style.display = displayValue;
		};
	};
	// Show all targeted elements
	for ( var i = 0; i < arguments.length; i++ ) {
		theElementID = arguments[i];
		document.getElementById(theElementID).style.display = "block";
	};
	document.getElementById("showAll").style.display = "block";
}

function showAllLaserElements() {
	clearCurrent();
	showLaserElement();
	document.getElementById("showAll").style.display = "none";
	theSubTitle = document.getElementById("subTitle");
	theSubTitle.style.display = "none";
}

function clearCurrent() {
	var theElementList = document.getElementsByTagName("li");
	for ( var i = 0; i < theElementList.length; i++ ) {
		theClass = theElementList[i].className;
		if ( theClass == "currentTreatment" ) {
			theElementList[i].className = "";
		};
	};
}

function setCurrent(theID) {
	clearCurrent();
	theID.className = "currentTreatment";
	theText = theID.childNodes[1].nodeValue;
	theSubTitle = document.getElementById("subTitle");
	theSubTitle.firstChild.nodeValue = '>> '+theText;
	theSubTitle.style.display = "block";
}

// Show/Hide Before/After iamges and panel
function clearPanel() {
	var theElementList = document.getElementsByTagName("img");
	for ( var i = 0; i < theElementList.length; i++ ) {
		theTAG = theElementList[i].id.substring(0,3);
		if ( theTAG == "IMG" ) {
			theElementList[i].style.display = "none";
		};
	};
}
function showPanel(theID) {
	clearPanel();
	thePanel = document.getElementById("detailPanel");
	thePanel.style.display ="block";
	theText = document.getElementById("mainUpper");
	if ( theID.substring(0,4) == "WSHP" ) {
	    theDateTag = document.getElementById(theID).firstChild.nodeValue;
		document.getElementById("theDateLabel").firstChild.nodeValue = "Date: " + theDateTag;
		theText.style.height ="562px";
		thePanel.style.height ="562px";
	} else {
		theText.style.height ="462px";
		thePanel.style.height ="462px";
	};
	theImage = document.getElementById(theID);
	theImage.style.display ="block";
}
function closePanel() {
	thePanel = document.getElementById("detailPanel");
	thePanel.style.display ="none";
	theText = document.getElementById("mainUpper");
	theText.style.height ="auto";
}


function flipSpecPanel(theID) {
	theClickTag = theID.firstChild.nodeValue;
	theSplashPage = document.getElementById("splashPage")
	theSpecPage = document.getElementById("specPage")
	if ( theClickTag == 'Read Specifications' ) {
		theID.firstChild.nodeValue = 'Hide Specifications'; 
		theSplashPage.style.display = "none";
		theSpecPage.style.display = "block";
	};
	if ( theClickTag == 'Hide Specifications' ) {
		theID.firstChild.nodeValue = 'Read Specifications';
		theSplashPage.style.display = "block";
		theSpecPage.style.display = "none";
	};
}

