<!--
//=====================================================================================================
//17/06/2011===========================================================================================
//=====================================================================================================
function addLoadEvent(func) {
	var oldonload=window.onload;
	if (typeof window.onload!="function") {
		window.onload=func;
	} else {
		window.onload=function() {
			oldonload();
			func();
		}//end function
	}//end if (typeof window.onload!="function")
}//end function
//=====================================================================================================
function SetInputHighlights() {
	pxInputs=document.getElementsByTagName("input");
	for (pi=0;pi<pxInputs.length;pi++) {
		if (pxInputs[pi].type=="text") {
			pxInputs[pi].onfocus=function() {
					if (this.defaultValue==this.value) {
						this.select();
					}//end if ()
					ShowEpiLabel(this);
				}//end function
			pxInputs[pi].onkeyup=function() {
					ShowEpiLabel(this);
				}//end function
			pxInputs[pi].onblur=function() {
					HideEpiLabel(this);
				}//end function
			pxInputs[pi].onmouseup=function(){return false};//because safari is special
		}//end if (pxInputs[pi].type=="text")
	}//next pi<pxInputs.length
	pxTextAreas=document.getElementsByTagName("textarea");
	for (pi=0;pi<pxTextAreas.length;pi++) {
		pxTextAreas[pi].onfocus=function() {
				if (this.defaultValue==this.value) {
					this.select();
				}//end if ()
				ShowEpiLabel(this);
			}//end function
		pxTextAreas[pi].onkeyup=function() {
				ShowEpiLabel(this);
			}//end function
		pxTextAreas[pi].onblur=function() {
				HideEpiLabel(this);
			}//end function
		pxTextAreas[pi].onmouseup=function(){return false};//because safari is special
	}//next pi<pxTextAreas.length
}//end function
//=====================================================================================================
function ShowEpiLabel(theInput) {
	theMaxLength=theInput.getAttribute("maxlength");
	if (theMaxLength) {
		theSpan=theInput.parentNode.getElementsByTagName("span")[0];
		if (!theSpan) {
			theSpan=document.createElement("span");
			theInput.parentNode.appendChild(theSpan);
		}//end if (theSpan)
		if (theInput.value.length>theMaxLength) {theInput.value=theInput.value.substr(0, theMaxLength)};
		theSpan.innerHTML="&nbsp;"+theInput.value.length+"/"+theMaxLength+" Characters";
	}//end if (theMaxLength)
}//end function
//=====================================================================================================
function HideEpiLabel(theInput) {
	theMaxLength=theInput.getAttribute("maxlength");
	if (theMaxLength) {
		theSpan=theInput.parentNode.getElementsByTagName("span")[0];
		if (theSpan) {
			theInput.parentNode.removeChild(theSpan);
		}//end if (theSpan)
	}//end if (theMaxLength)
}//end function
//=====================================================================================================
function FixChromeBug() {
	if (document.width%2==1) {
		document.getElementsByTagName("html")[0].style.marginLeft="1px";
	} else {
		document.getElementsByTagName("html")[0].style.marginLeft="0px";
	}//end if (document.width%2==1)
}//end function
/*==========================================================================================*/
function ShowInfoOverlay(theForm, theFormResponse) {
	if (theForm) {
		xw=theForm.offsetWidth;
		xh=theForm.offsetHeight;
		theDiv=document.createElement("div");
			theDiv.id="dark"+theForm.id;
			theDiv.style.width=xw+20+"px";
			theDiv.style.height=xh+50+"px";
			theDiv.style.position="absolute";
			theDiv.style.backgroundColor="#efefef";
			theDiv.style.filter="alpha(opacity=75)";
			theDiv.style.opacity="0.75";
			theDiv.style.marginLeft="0px";
			theForm.parentNode.insertBefore(theDiv, theForm);
		theDiv=document.createElement("div");
			theDiv.id="light"+theForm.id;
			theDiv.style.width=xw-0+"px";
			theDiv.style.height=xh+30+"px";
			theDiv.style.position="absolute";
			theDiv.style.backgroundColor="#ffffff";
			theDiv.style.filter="alpha(opacity=80)";
			theDiv.style.opacity="0.8";
			theDiv.style.marginLeft="10px";
			theDiv.style.marginTop="10px";
			theForm.parentNode.insertBefore(theDiv, theForm);
		theDiv=document.createElement("div");
			theDiv.id="msg"+theForm.id;
			theDiv.style.width=xw+"px";
			theDiv.style.height=xh+10+"px";
			theDiv.style.position="absolute";
			theDiv.style.marginLeft="10px";
			theDiv.style.marginTop="20px";
			theDiv.style.textAlign="center";
			theDiv.innerHTML=theFormResponse;
			theDiv.innerHTML+="<p><img src=\"/images/css/buttonok.gif\" width=\"60\" height=\"20\" alt=\"ok\" style=\"cursor: pointer;\" /></p>";
			theDiv.onclick=function() {
				theForm.parentNode.removeChild(document.getElementById("dark"+theForm.id));
				theForm.parentNode.removeChild(document.getElementById("light"+theForm.id));
				theForm.parentNode.removeChild(document.getElementById("msg"+theForm.id));
			}//end function
			theForm.parentNode.insertBefore(theDiv, theForm);
	}//end if (theForm)
}//end function
/*==========================================================================================*/
function ajaxSubmit(theForm) {
	xQuery="";
	if (theForm) {
		xInputs=theForm.getElementsByTagName("input");
		xTextAreas=theForm.getElementsByTagName("textarea");
		xSelects=theForm.getElementsByTagName("select");
		for (i=0;i<xInputs.length;i++) {
			xQuery+=xInputs[i].name;
			xQuery+="=";
			xQuery+=xInputs[i].value.replace(/ /g,"+");
			xQuery+="&";
		}//next i<xInputs.length
		for (i=0;i<xTextAreas.length;i++) {
			xQuery+=xTextAreas[i].name;
			xQuery+="=";
			xQuery+=xTextAreas[i].value.replace(/ /g,"+");
			xQuery+="&";
		}//next i<xTextAreas.length
		for (i=0;i<xSelects.length;i++) {
			xQuery+=xSelects[i].name.replace(/ /g,"+");
			xQuery+="=";
			xQuery+=xSelects[i].options[xSelects[i].selectedIndex].value;
			xQuery+="&";
		}//next i<xSelects.length
		var xmlhttp;
		if (window.XMLHttpRequest) {
		  xmlhttp=new XMLHttpRequest();
		} else {
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}//end if (window.XMLHttpRequest)
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4&&xmlhttp.status==200) {
				theFormResponse=xmlhttp.responseText;
				ShowInfoOverlay(theForm, theFormResponse);
			}//end if (xmlhttp.readyState==4&&xmlhttp.status==200)
		}//end function
		xmlhttp.open("post",theForm.action,true);
		xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		//xmlhttp.preserveWhitespace=true;
		xmlhttp.send(xQuery);
	}//end if (theForm)
	return false;
}//end function
/*==========================================================================================*/
function SetMainHeight() {
	if (document.documentElement.offsetHeight) {
		xWINh=document.documentElement.offsetHeight;	
	} else if (window.innerHeight) {
		xWINh=window.innerHeight;	
	}//end if (document.documentElement.offsetHeight)

xCONTENTheight=xWINh-240;
document.getElementById("content").style.minHeight=xCONTENTheight+"px";

}//end function
/*==========================================================================================*/
addLoadEvent(FixChromeBug);
addLoadEvent(SetInputHighlights);
addLoadEvent(SetMainHeight);
//=====================================================================================================
-->
