
function openPopup(pstrdirectory,pstrpage) {
var pstrURL, pinttop, pintleft;
if (pstrdirectory != '')
{pstrURL=pstrdirectory+"/wai_"+pstrpage+".jsp";}
else
{pstrURL="/wai_"+ pstrpage +".jsp";};


pinttop = (screen.availHeight/2-185);
pintleft = (screen.availWidth/2-255);
if (navigator.appName == 'Microsoft Internet Explorer') 
	{window.open(pstrURL,"popup", "directories=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no, height=370, width=510,top="+pinttop+",left="+pintleft);}
else
	{popupwindow=window.open(pstrURL,'popup','resizable,scrollable,height=370,width=510');}
}

function newRegister(){
	document.location.href="/SrvCtl?CtlInvoke=au.com.elk.waitta.EntrantLogic&CtlStore=Request&CtlAction=MTH_ENTRANT_NEWREGISTER";
}	

function turnOn(imageName) {

  if (document.images) {

    document[imageName].src = eval(imageName + "on.src");

  }

}

 
function turnOff(imageName) {

  if (document.images) {

    document[imageName].src = eval(imageName + "off.src");

  }

}
var mwinLoginWindow;
function login(pstrContinueURL) {
  var newURL;
  
  if(pstrContinueURL=="")
	newURL = "/wai_login.jsp?LoginContinueURL=wai_default.jsp";
  else
  	newURL = "/wai_login.jsp?LoginContinueURL=" + pstrContinueURL + "&ReturnUser=Y";
   
	if (navigator.appName == 'Microsoft Internet Explorer')
		{mwinLoginWindow = window.open(newURL,"popuppage", "directories=no, location=no, menubar=no, scrollbars=no, resizable=no, status=no, toolbar=no, height=280 width=350, top=50, left=75");}
	else
		{mwinLoginWindow = tourwindow=window.open(newURL,'popuppage','resizable=no,height=280,width=350');}
		
		
	if(!mwinLoginWindow) {
    	alert("WA Inventor of the Year uses pop-up windows which your browser configuration does not allow. Please enable ALL pop-ups for this site before continuing.");  
    	return;
    }
		
	mwinLoginWindow.focus();	
}

function logout(pstrPage){		
	document.location.href="/wai_logout.jsp?Redirect=Y&LogoutTo=" + pstrPage;
}

function uploadFile(pstrFileType, pstrFieldName){
var mwinUploadWindow;
var newURL = "/wai_uploadfile.jsp?FileType=" + pstrFileType + "&FieldName="+pstrFieldName;
	if (navigator.appName == 'Microsoft Internet Explorer')
		{mwinUploadWindow = window.open(newURL,"popuppage", "directories=no, location=no, menubar=no, scrollbars=no, resizable=yes, status=yes, toolbar=no, height=370, width=500, top=150, left=150");}
	else
		{mwinUploadWindow = tourwindow=window.open(newURL,'popuppage','resizable=yes,height=450,width=500');}	
		
	mwinUploadWindow.focus();	
}	



function viewFile(pstrFileUrl, pstrFileId){
var mwinFileWindow;

if(pstrFileId==""){
	alert('No file selected');
	return;
}

	var newURL = pstrFileUrl + pstrFileId+"&Popup=Y";

	if (navigator.appName == 'Microsoft Internet Explorer')
		{mwinFileWindow = window.open(newURL,"popuppage", "directories=no, location=no, menubar=yes, scrollbars=yes, resizable=yes, status=no, toolbar=yes, height=400, width=700, top=100, left=150");}
	else
		{mwinFileWindow = tourwindow=window.open(newURL,'popuppage','resizable=yes,height=400,width=700');}	
		
	mwinFileWindow.focus();		
}

function viewFileContentHost(pstrFileUrl, pstrFileId){
	var mwinFileWindow;

	if(pstrFileId==""){
		alert('No file selected');
		return;
	}

	if (navigator.appName == 'Microsoft Internet Explorer')
		{mwinFileWindow = window.open(pstrFileUrl,"popuppage", "directories=no, location=no, menubar=yes, scrollbars=yes, resizable=yes, status=no, toolbar=yes, height=400, width=700, top=100, left=150");}
	else
		{mwinFileWindow = tourwindow=window.open(pstrFileUrl,'popuppage','resizable=yes,height=400,width=700');}	
		
	mwinFileWindow.focus();		
}


if (document.images) {

  btn_registeron = new Image();
  btn_registeron.src = "/images/ioty_btn_register1_on.gif";
  btn_registeroff = new Image();
  btn_registeroff.src = "/images/ioty_btn_register1.gif";

  btn_loginon = new Image();
  btn_loginon.src = "/images/ioty_btn_login1_on.gif";
  btn_loginoff = new Image();
  btn_loginoff.src = "/images/ioty_btn_login1.gif";
  
  btn_logouton = new Image();
  btn_logouton.src = "/images/ioty_btn_logout_on.gif";
  btn_logoutoff = new Image();
  btn_logoutoff.src = "/images/ioty_btn_logout.gif";  
  
  btn_resumeon = new Image();
  btn_resumeon.src = "/images/ioty_btn_resume_on.gif";
  btn_resumeoff = new Image();
  btn_resumeoff.src = "/images/ioty_btn_resume.gif";  
}

function getFormGroup(name) {
	return document.getElementsByName(name);
}

function getRadio(name) 
{elements = getFormGroup(name);
if (elements)
/* loop over all the radio buttons */
	for (i = 0; i < elements.length; i++)
	if (elements[i].checked)
		return elements[i];
	
		/* either no group by that name was foundor none were selected */
		return null;	
}

function getRadioValue(name) {
	element = getRadio(name);
	
	if (element)
		return element.value;
	
	/* there must not have been a radio buttonselected */
	return '';
}	



function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function removeCookie(name) {
	createCookie(name,"",-1);
}

function showItem(pstrId){
	document.getElementById(pstrId).style.display="";
}

function hideItem(pstrId){
	document.getElementById(pstrId).style.display="none";
}

function isCookiesEnabled () {  
  var pdatNow = new Date();
  var pstrCookie = "IAWTestCookie=" + pdatNow;
  var pstrRetrievedCookie = "";

  document.cookie = pstrCookie;
  pstrRetrievedCookie = document.cookie;

  if (pstrRetrievedCookie == null) {
    return false;
  }

  if (pstrRetrievedCookie == "") {
    return false;
  }

  if (pstrRetrievedCookie.indexOf(pstrCookie) > -1) {     
    return true;
  }

  return false;
}	
