// JavaScript Document

function showMailer(firstPart,secondPart,thisDiv)
{ 
	var mailer=document.getElementById(thisDiv);
	
	var sPath = window.location.pathname;
//	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	var formAction = "php/sendMail.php";
	
	// To correct the path for the employee subfolder
	if(sPath.search("employees")==1){//sPage=="employee.php") {
	   formAction = "../php/sendMail.php";
	}
	
	//create form here to print to the screen, include firstPart and secondPart as hidden form elements 
	var mailForm = "<form name='secureMailForm' method='post' action='"+formAction+"'>";
	mailForm += "Subject <input name='subject' type='text' /><br/><br/>";
	mailForm += "Return e-Mail Address <input name='returnAddress' type='text' /><br/><br/>";
	mailForm += "Body <br/><textarea name='body' cols='100' rows='5'></textarea><br/>";
	mailForm += "<input name='firstPart' type='hidden' value='"+firstPart+"' />";
	mailForm += "<input name='secondPart' type='hidden' value='"+secondPart+"' />";
	mailForm += "<input name='msgDiv' type='hidden' value='"+thisDiv+"' />";
	mailForm += "<input name='submit' type='submit' value='Send' />";
	mailForm += "</form>";
	
	mailer.innerHTML = mailForm;
	
}

function message(thisDiv,msg){
	var messageDiv=document.getElementById(thisDiv);
	messageDiv.innerHTML = msg+"<br/>";
}