// JavaScript Document

//Author: Phillip Busche
//Generic functions to be used on site pages.
//Can be used independently or in conjuction with prototype or jquery. 

//TFMAIL Code
//This was inherited from the UNLV.edu 
var Clicked =0;
var C12037089126262= "tfmail/TFmail.pl";
var FormName="wcform";
var C12037089126261= "/cgiwrap/webcgi/";

function CL()
{ 

var baseURL = "http://web.unlv.edu";

Clicked++;

	if(Clicked > 1)
	{ 
	return; 
	}


//alert(baseURL+C12037089126261+C12037089126262);

eval("document."+FormName+".action='"+baseURL+C12037089126261+C12037089126262+"'");
}



//revised CL function

//CL2
//pre-condition: form mailer type
//post-condition: works like CL but can be flexible with the ability to add additional mailer paths

var Clicked2 =0;

function CL2(mailerType)
{ 

var FormName="wcform";

var baseURL = "http://web.unlv.edu";
var C12037089126261= "/cgiwrap/webcgi/";
var C12037089126262 = null;
	
	
	if(mailerType == "tfmail")
	C12037089126262= "tfmail/TFmail.pl";
	else if(mailerType == "formmail")
	C12037089126262= "formmail/FormMail.pl";
	else
	{
	alert("Invalid mailer type submitted");
	return;
	}

Clicked2++;

	if(Clicked2 > 1)
	{ 
	return; 
	}

//alert(baseURL+C12037089126261+C12037089126262);

eval("document."+FormName+".action='"+baseURL+C12037089126261+C12037089126262+"'");
}





//Pre-Condition: elemID is the ID of the element, toggle is either true or false
function showElem(elemID,toggle)
{
	if(toggle)
	toggle = "block";
	else
	toggle = "none";
	
document.getElementById(elemID).style.display = toggle;
}



//setEqualHeights
//sets divs to an equal height
//pre-condition: sends in a comma separated string such as "test1,test2,test3"
//post-condition: will set the DIVs to an equal height to the largest DIV
function setEqualHeights(elemList)
{
var elemArray = elemList.split(",");

	for(i=0;i<elemArray.length;i++)
	{
	
	if(document.getElementById(elemArray[i]))	
	currElemHeight	= document.getElementById(elemArray[i]).offsetHeight;	
	else
	{
	alert("Invalid DIV ID: " + elemArray[i] + " passed in.");
	return;
	}
	
	
	
		if(i == 0)
		{
		tallestElemHeight = currElemHeight;
		continue;
		}
		else
		{
			if(tallestElemHeight < currElemHeight)
			tallestElemHeight = currElemHeight;
		}
	
	
	//alert("Tallest Elem Height: " + tallestElemHeight);	
	
	} //end for


	for(i=0;i<elemArray.length;i++)
	{
	//alert("resizing element: " + elemArray[i] + "to " + tallestElemHeight);
	document.getElementById(elemArray[i]).style.height = tallestElemHeight + "px";
	}
}

