initialHeight=0; //this was done to compensate for IE6
function init() {
	the('mainTextID').innerHTML = the('originalTextID').innerHTML;
	setTimeout("setStageShadowsO()", 100);
	initialHeight = the("stageID").offsetHeight; //this was done to compensate for IE6
}


function the(element) {
	return window.document.getElementById(element);
}






function booyah() {
	window.alert("booyah");
}





//N.B. java doesn't pick up the 'px' part of the positioning co-ods numbers from the CSS
function setStageShadows() {	
	temp = the("stageID").offsetHeight; 
	the("stageSideShadowImage").height = temp-30;
	the("stageSideShadowImage").width = 10;
	
	the("stageCornerShadowID").style.top = (temp-20)+"px";
	the("stageCornerShadowID").style.visibility = "visible";
}




//N.B. java doesn't pick up the 'px' part of the positioning co-ods numbers from the CSS
function setStageShadowsO() {	
	if (!expanded)
		temp = initialHeight; //this was done to compensate for IE6
	else	
		temp = the("stageID").offsetHeight;

	the("stageSideShadowImage").height = temp-43;
	the("stageSideShadowImage").width = 10;
	
	the("stageBottomShadowImage").width = 738;

	the("stageCornerOptionsID").style.top = (temp-33)+"px";
	the("stageCornerOptionsID").style.visibility = "visible";
}





expanded = false;
function swapTexts() {
	if (!expanded) {
		the('mainTextID').innerHTML = the('expandedTextID').innerHTML;
		the('stageCornerOptionsID').innerHTML='<a href="#"><img src="images/cornerCollapse.png" onclick="expandShrinkStage()"></a>';
		expanded=true;
	} else {
		the('mainTextID').innerHTML = the('originalTextID').innerHTML;
		the('stageCornerOptionsID').innerHTML='<a href="#"><img src="images/cornerOptions.png" onclick="expandShrinkStage()"></a>';
		expanded=false;
	}
	setStageShadowsO();
}




function expandShrinkStage() {	  //!fade using Jquery 	 
	the("stageCornerOptionsID").style.visibility = "hidden";
	$("#mainTextID").hide("", swapTexts());
	$("#mainTextID").fadeIn("slow");
}






function submitForm() {
    msg_data = "msg_name="+window.document.send_msg.msg_name.value + "&msg_email="+window.document.send_msg.msg_email.value + 
	"&msg_phone="+window.document.send_msg.msg_phone.value + "&msg_text="+window.document.send_msg.msg_text.value;

	try { xhr = new XMLHttpRequest(); }                 
    catch(e) 
    {    
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
    } 
 
    xhr.onreadystatechange  = function()    {	
		if(xhr.readyState  == 4)
        {
			if(xhr.status  == 200)
				window.document.getElementById("send_status").innerHTML="send status: "+ xhr.responseText; 
         }
    }; 
	
	xhr.open("POST", "email.php", false);
	xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  
	xhr.send(msg_data);

	window.document.send_msg.msg_name.value="";
	window.document.send_msg.msg_email.value="";
	window.document.send_msg.msg_phone.value="";
	window.document.send_msg.msg_text.value="";
}

