function submitRegistration()
{
        var oForm = document.forms.frmContact;
        var sError = "";
        var sName=''+oForm.Name.value;
        if (sName=='') sError += "Please enter your name.\n";
        var sAddress=''+oForm.Address.value;
        if (sAddress=='') sError += "Please enter your street address or PO Box.\n";
        var sCity=''+oForm.City.value;
        if (sCity=='') sError += "Please enter your town or city.\n";
        var sProv=''+oForm.Prov.value;
        if (sProv=='') sError += "Please enter your province or state.\n";
        var sPostalCode=''+oForm.PostalCode.value;
        if (sPostalCode=='') sError += "Please enter your postal or zip code.\n";								
        var sEmail =''+oForm.Email.value;
        if (sEmail=='') sError += "Please enter your email address.\n";
        if (sError == "")
        {
                oForm.submit();
        }
        else
        {
                alert("\n\n"+sError+"\n\n");
        }
}
function submitVolunteer()
{
	var oForm = document.forms.frmContact;
	var sError = ""; 
	var sName=''+oForm.Name.value; 
	if (sName=='') sError += "Please enter your name.\n"; 
	var sPhone=''+oForm.Phone.value; 
	if (sPhone=='') sError += "Please enter your phone number.\n"; 	
	var sEmail =''+oForm.Email.value; 
	if (sEmail=='') sError += "Please enter your email address.\n"; 
	if (sError == "") 
	{
		oForm.submit(); 
	}
	else 
	{
		alert("\n\n"+sError+"\n\n");
	}
}
function setImage(obj) 
{
	var nID = obj.value;
	var sName = "minicard"
	oImage = document.getElementsByName(sName);
	for(x=0;x<oImage.length;x++)
	{
		oImage[x].className = "preload";
	}
	if(nID > 0)
	{
		oImage = document.getElementById(nID);
		oImage.className = "show";
	}
	return;			
}

/******************************************************************************
* Name      : autoTab()
* Author    : Clint Krismer
* Purpose   : tab to the next form field after max length
* Parameters: 
* Returns   :  
*			: 
* Description: Typically used for dates or phone numbers.  When called in the form
*			this function will automatically tab the cursor to the next form field.
*
* Maintenance Log
* -----------------------------------------------------------------------------
*          Who         |   When            |  Why
* -----------------------------------------------------------------------------
*  Clint Krismer |   Aug 2002        | Initial Code
*******************************************************************************/
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) 
{
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)) 
	{
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
	function containsElement(arr, ele) 
	{
		var found = false, index = 0;
		while(!found && index < arr.length)
		if(arr[index] == ele)
		found = true;
		else
		index++;
		return found;
	}
	function getIndex(input) 
	{
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
		if (input.form[i] == input)
			index = i;
		else 
			i++;
		return index;
	}
	return true;
}
function lastnamesearch()
{
	alert("searching based on last name");
}
function UserStats()
{
	// Information that needs to be collected are setup as variables.
	var Agent = navigator.userAgent;
	var Available_Height = screen.availHeight;
	var Available_Width =screen.availWidth;
	var Browser_Language = navigator.browserLanguage;
	var Browser_Name = navigator.appName;
	var Browser_Version = navigator.appVersion;
	var Browser_Version_Num = parseFloat(Browser_Version);
	var CPU = navigator.cpuClass;
	var Color_Depth = screen.colorDepth + " Bit";
	var Cookies_Enabled = navigator.cookieEnabled;
	var Height = screen.height;
	var Java_Enabled = navigator.javaEnabled();
	var Minor_Version = navigator.appMinorVersion;
	var Operating_System ="unknown";
	var Width = screen.width;

	if (Agent.indexOf("SunOS")!=-1) {Operating_System='Sun'}
	if (Agent.indexOf("IRIX")!=-1) {Operating_System='SGI'}
	if (Agent.indexOf("HP-UX")!=-1) {Operating_System='HP'}
	if (Agent.indexOf("AIX")!=-1) {Operating_System='IBM'}
	if (Agent.indexOf("Linux")!=-1) {Operating_System='Linux'}
	if (Agent.indexOf("Macintosh")!=-1) {if (Agent.indexOf("PC)")!=-1) {Operating_System='Mac PPC'} else {Operating_System='Mac 68000'}}
	if ((Agent.indexOf("Win16")!=-1)||(Agent.indexOf("Windows 3.1")!=-1)) {Operating_System='Windows 3.x'}
	if ((Agent.indexOf("Win95")!=-1)||(Agent.indexOf("Windows 95")!=-1)) {Operating_System='Windows 95'}
	if ((Agent.indexOf("Win98")!=-1)||(Agent.indexOf("Windows 98")!=-1)) {Operating_System='Windows 98'}
	if ((Agent.indexOf("WinNT")!=-1)||(Agent.indexOf("Windows NT")!=-1)) {Operating_System='Windows NT'}
	if ((Agent.indexOf("WinNT5")!=-1)||(Agent.indexOf("Windows NT 5.0")!=-1)) {Operating_System='Windows 2000'}

	document.write("Your Operating System is: <b>"+ Operating_System +"</b><br>");
	document.write("CPU: <b>" + CPU + "</b><br>");
	document.write("Your Browser is: <b>"+ Browser_Name +"</b><br>");
	document.write("Your Browser Version is: <b>"+ Browser_Version +"</b><br>");
	document.write("Your Browser Version Number is: <b>"+ Browser_Version_Num +"</b><br>");
	document.write("Is Java Enabled: <b>"+ Java_Enabled +"</b><br>");
	document.write("Your User Agent is: <b>"+ Agent +"</b><br>");
	document.write("Cookies Enabled?: <b>"+ Cookies_Enabled +"</b><br>");
	document.write("Your Color Depth is: <b>"+ Color_Depth +"</b><br>");
	document.write("Your Screen Height is: <b>"+ Height +"</b><br>");
	document.write("Your Screen Width is: <b>"+ Width +"</b><br>");
	document.write("Your Screen Available Height is: <b>"+ Available_Height +"</b><br>");
	document.write("Your Screen Available Width is: <b>"+ Available_Width +"</b><br>");
	if (document.referrer)
	{
		document.write("You came from: <b> "+ document.referrer +" <b><br>");
	}
	document.write("Browser Language: <b>"+ Browser_Language +"</b><br></p>");
}
function emailsearch()
{
	alert("searching based on email");
}
function validateEmail()
{
	if(document.frmEmail.cmbTo.selectedIndex == 0)
	{
		alert("The field \"To:\" is required in order to send.");
		document.frmEmail.cmbTo.focus();
	}
	else if(document.frmEmail.txtSubject.value == 0)
	{
		alert("The field \"Subject:\" is required in order to send.");
		document.frmEmail.txtSubject.focus();
	}
	else if(document.frmEmail.txtBody.value == 0)
	{
		alert("The field \"Body:\" is required in order to send.");
		document.frmEmail.txtBody.focus();
	}
	else if(document.frmEmail.txtFile.value != 0)
	{
		if(bGetFileExtension(document.frmEmail.txtFile.value.toLowerCase()) == "exe" || 
	       bGetFileExtension(document.frmEmail.txtFile.value.toLowerCase())== "dll" || 
	       bGetFileExtension(document.frmEmail.txtFile.value.toLowerCase())== "bat")
		{
			alert("This file extension is not permitted. Please choose another file.");
			document.frmEmail.txtFile.focus();
		}
		else
		{
			document.frmEmail.txtEmailSubmitted.value = true
			document.frmEmail.submit();
		}
	}
	else
	{
		document.frmEmail.txtEmailSubmitted.value = true
		document.frmEmail.submit();
	}
}
/******************************************************************************
* Name      : bGetFileExtension()
* Author    : Clint Krismer
* Purpose   : get the file extension
* Parameters: 
* Returns   : a string 
*			: the file extension of the string submitted
* Description: returns everything after the last occurance of "."
*
* Maintenance Log
* -----------------------------------------------------------------------------
*          Who         |   When            |  Why
* -----------------------------------------------------------------------------
*  Clint Krismer |   Aug 2002        | Initial Code
*******************************************************************************/
function bGetFileExtension(sFileName)
{
	var sLength = sFileName.length
	var nIndex = sFileName.lastIndexOf(".")+1
	var sExtension = sFileName.substr(parseInt(nIndex), parseInt(sLength))
	return sExtension;
}
/******************************************************************************
* Name      : validateMemberEmail()
* Author    : Clint Krismer
* Purpose   : validate memberCorrespondance.asp 
* Parameters: 
* Returns   : Submits the form if all tests pass 
*			: notifies the user of missing data
* Description: Checks for required values
*
* Maintenance Log
* -----------------------------------------------------------------------------
*          Who         |   When            |  Why
* -----------------------------------------------------------------------------
*  Clint Krismer |   Aug 2002        | Initial Code
*******************************************************************************/
function validateMemberEmail()
{
	if (!document.frmMemberEmail.chkNoEmail.checked)
	{
		document.frmMemberEmail.txtSendEmail.value = "true"
		if(document.frmMemberEmail.txtSubject.value == 0)
		{
			alert("The field \"Subject:\" is required in order to send.");
			document.frmMemberEmail.txtSubject.focus();
			return;
		}
		else if(document.frmMemberEmail.txtBody.value == 0)
		{
			alert("The field \"Body:\" is required in order to send.");
			document.frmMemberEmail.txtBody.focus();
			return;
		}
		else if(document.frmMemberEmail.txtFile.value != 0)
		{
			if(bGetFileExtension(document.frmMemberEmail.txtFile.value.toLowerCase()) == "exe" || 
	           bGetFileExtension(document.frmMemberEmail.txtFile.value.toLowerCase())== "dll" || 
	           bGetFileExtension(document.frmMemberEmail.txtFile.value.toLowerCase())== "bat")
			{
				alert("This file extension is not permitted. Please choose another file.");
				document.frmMemberEmail.txtFile.focus();
				return;
			}
		}
	}
	else
	{
		document.frmMemberEmail.txtSendEmail.value = "false"
	}
	document.frmMemberEmail.txtEmailSubmitted.value = true
	document.frmMemberEmail.submit();
}

function SayOK(strWhereToGo) 
{
	//3000 - is the amount of time to wait before redirecting the user
	//I think it's in ,milliseconds or something, you can change that  as required.
	objTimer = window.setTimeout(strWhereToGo,5000);
}

/******************************************************************************
* Name      : validateContact()
* Author    : Clint Krismer
* Purpose   : validate contact.asp 
* Parameters: 
* Returns   : Submits the form if all tests pass 
*			: notifies the user of missing data
* Description: Checks for required values only
*
* Maintenance Log
* -----------------------------------------------------------------------------
*          Who         |   When            |  Why
* -----------------------------------------------------------------------------
*  Clint Krismer |   Aug 2002        | Initial Code
*******************************************************************************/
function validateContact()
{
	if (document.frmContact.txtFirstName.value == 0) 
	{
		alert("The field \"First Name\" is required in order to save.");
		document.frmContact.txtFirstName.focus();
	}
	else if (document.frmContact.txtLastName.value == 0) 
	{
		alert("The field \"Last Name\" is required in order to save.");
		document.frmContact.txtLastName.focus();
	}
	else if (document.frmContact.txtAddress.value == 0) 
	{
		alert("The field \"Address\" is required in order to save.");
		document.frmContact.txtAddress.focus()
	}
	else if (document.frmContact.txtCity.value == 0) 
	{
		alert("The field \"City\" is required in order to save.");
		document.frmContact.txtCity.focus();
	}
	else if (document.frmContact.txtProvince.value == 0) 
	{
		alert("The field \"Province\" is required in order to save.");
		document.frmContact.txtProvince.focus();
	}
	else if (document.frmContact.txtPostalCode.value < 6) 
	{
		alert("The field \"Postal Code\" is required in order to save.");
		document.frmContact.txtPostalCode.focus();
	}
	else if (document.frmContact.txtCountry.value == 0) 
	{
		alert("The field \"Country\" is required in order to save.");
		document.frmContact.txtCountry.focus();
	}
	else if (document.frmContact.txtPassword.value == 0) 
	{
		alert("The field \"Password\" is required in order to save.");
		document.frmContact.txtPassword.focus();
	}
	else
	{
		document.frmContact.txtSubmitted.value = true;
		document.frmContact.submit();
	}
}

/******************************************************************************
* Name      : addNewContact()
* Author    : Clint Krismer
* Purpose   : reset contact.asp 
* Parameters: 
* Returns   : 
* Description: Sets the values to what they were when the page loaded
*
* Maintenance Log
* -----------------------------------------------------------------------------
*          Who         |   When            |  Why
* -----------------------------------------------------------------------------
*  Clint Krismer |   Aug 2002        | Initial Code
*******************************************************************************/
function addNewContact()
{	
	strURL = "default.asp?page=" + 
			  document.frmContact.txtPage.value + 
			  "&menu=" +
			  document.frmContact.txtMenu.value + 
			  "&contactID=add"
	window.location = strURL;
}

/******************************************************************************
* Name      : resetContact()
* Author    : Clint Krismer
* Purpose   : reset contact.asp 
* Parameters: 
* Returns   : 
* Description: Sets the values to what they were when the page loaded
*
* Maintenance Log
* -----------------------------------------------------------------------------
*           Who         |   When            |  Why
* -----------------------------------------------------------------------------
*  Clint Krismer |   Aug 2002        | Initial Code
*******************************************************************************/
function resetContact()
{
	document.frmContact.reset();
}

/************************************************************************************
* Name      : validDate()
* Author    : Clint Krismer
* Purpose   : validate dates passed
* Parameters: a date string as strDate
* Returns   : True if all tests pass, false otherwise
* Description: Validate the date in several ways.
*   1.  Check for correct format.
*   2.  Check if February.
*   	a.  If it's February, check for leap year.
*   	b.  Check for maximum day number for that year.
*   3.  Check for 30-day month.
*   	a.  If it's a 30-day month, make sure the day is <= 30
*   4.  If the first digit of the month or date is zero or not there:
*   	a.  Make sure the second digit is not 0
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*           Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*                       |                   |
************************************************************************************/
function validDate(strDate)
{
	blnValidDate = true
	//Set up the regular expression format
	rxpRegExDate = /(\d?\d)\/(\d?\d)\/(20\d\d)$/
	//Test strDate to make sure it's in the right basic format
	if (rxpRegExDate.test(strDate))
	{
		//Test for legitimate Month
		if (RegExp.$1.valueOf() > 12)
			{ return false }
		//Test for February
		if (RegExp.$1 == "02" || RegExp.$1 == "2")
		{
			blnLeapYear = false
			//Check for leap year
			if (RegExp.$3.valueOf() % 4 == 0)
			{
				blnLeapYear = true
			}
			//Check for maximum date based on leap year test
			if (blnLeapYear & (RegExp.$2.valueOf() > 29))
				{ blnValidDate = false }
			else if (!blnLeapYear & (RegExp.$2.valueOf() > 28))
				{ blnValidDate = false }
		}
		//Check for 30-day months (There are only 4)
		else if (RegExp.$1 == "04" || RegExp.$1 == "4" ||
					RegExp.$1 == "06" || RegExp.$1 == "6" ||
					RegExp.$1 == "09" || RegExp.$1 == "9" ||
					RegExp.$1 == "11")
		{
			if (RegExp.$2.valueOf() > 30)
				{ blnValidDate = false }
		}
		//Check the remaining 31-day months
		else
		{
			if (RegExp.$2.valueOf() > 31)
				{ blnValidDate = false }
		}
		//Make sure the month and date are not zero
		if (RegExp.$1.valueOf() < 1 || RegExp.$2.valueOf() < 1)
			{ blnValidDate = false }
	}
	else
	{
		blnValidDate = false
	}
	return blnValidDate
}
/************************************************************************************
 Name      : validateContest()
 Author    : Clint Krismer
 Purpose   : validate ContestDisplay.asp
 Parameters: none
 Returns   : Submits the form if all tests pass 
			: notifies the user of missing data
 Description: Checks for required values
 Maintenance Log
 ----------------------------------------------------------------------------------
         Who         |   When            |  Why
 ----------------------------------------------------------------------------------
  Clint Krismer        |   Aug 2002        | Initial Code
***********************************************************************************/
function validateContest(intType)
{
    var intIndex = document.frmContest.Country.selectedIndex;       
    var strCountry = document.frmContest.Country.options[intIndex].value;

    if (intType == 1 && document.frmContest.txtEssay.value < '1') 
    {
	    alert("The Contest text is required.");
		document.frmContest.txtEssay.focus();
	}
    else if(document.frmContest.FName.value < '1')
	{
		alert("The field \"First name\" is required.");
		document.frmContest.FName.focus();
	}
    else if(document.frmContest.LName.value < '1')
	{
		alert("The field \"Last name\" is required.");
		document.frmContest.LName.focus();
	}	
    else if(document.frmContest.Add2.value < '1')
	{
		alert("The field \"Street Address\" is required.");
		document.frmContest.Add2.focus();
	}	
    else if(document.frmContest.City.value < '1')
	{
		alert("The field \"City\" is required.");
		document.frmContest.City.focus();
	}
    else if ((document.frmContest.prov_st.selectedIndex == 0) && (strCountry == "N/A" || strCountry == "CA" || strCountry == "US")) 
	{
   		alert("The field \"Prov/State\" is required.");
    	document.frmContest.prov_st.focus();
	}	
    else if(document.frmContest.post_zip.value < '0')
	{
		alert("The field \"Postal Code / Zip Code\" is required.");
		document.frmContest.post_zip.focus();
	}	
    else if(document.frmContest.Country.selectedIndex == 0)
	{
		alert("The field \"Country\" is required.");
		document.frmContest.Country.focus();
	}	
    else if ((document.frmContest.Other_State.value < '1') && (strCountry != "CA" && strCountry != "US")) 
	{
   		alert("The field \"Prov/State/Region\" is required.");
    	document.frmContest.Other_State.focus();
	}	
    else if(document.frmContest.email.value < '1')
	{
		alert("The field \"Email\" is required.");
		document.frmContest.email.focus();
	}	
	else
	{
		document.frmContest.txtSubmitted.value = true
		document.frmContest.submit();
	}
}


/************************************************************************************
* Name      : validateArticleSearch()
* Author    : Clint Krismer
* Purpose   : validate articleSearch.asp
* Parameters: 
* Returns   : Submits the form if all tests pass 
*			: notifies the user of missing data
* Description: Checks for valid dates entered on the form 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer       |   Aug 2002        | Initial Code
************************************************************************************/
function validateArticleSearch()
{
	if((document.frmArtSearch.txtStartDate.value != 0) & (validDate(document.frmArtSearch.txtStartDate.value) == false))
	{
		alert("Please enter a valid date for the field \"Start Date\" before searching.");
		document.frmArtSearch.txtStartDate.focus();

	}
	else if((document.frmArtSearch.txtEndDate.value != 0) & (validDate(document.frmArtSearch.txtEndDate.value) == false))
	{
		alert("Please enter a valid date for the field \"End Date\" before searching.");
		document.frmArtSearch.txtEndDate.focus();
	}
	else
	{
		document.frmArtSearch.submit();
	}
}


/************************************************************************************
* Name      : addMediaGroup()
* Author    : Clint Krismer
* Purpose   : add a group from the media group drop down to the 
			: cmbGroupSelected listbox
* Parameters: 
* Returns   : 
* Description: 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer       |   Aug 2002        | Initial Code
************************************************************************************/
function addMediaGroup() 
{
	
	var Index = document.frmMedia.cmbGroup.selectedIndex;
	if (Index != 0) 
	{
		/* An Option object is created with the arguments "Three" and "3". The first 
		argument is the text that will appear in the list. The second argument is 
		the value for that Option. The length of the Select List is 
		retrieved, which is one more than the index of the last element in the list. So, 
		a new Object is added to the options array by using that number. 
		
		document.createElement("Option") does not work in NS 6
		*/
		var sText = document.getElementById("cmbGroup").options[Index].text;
		var sValue = document.getElementById("cmbGroup").options[Index].value;
		var newOpt  = new Option(sText, sValue);
		var selLength = document.getElementById("cmbGroupSelected").length;
		document.getElementById("cmbGroupSelected").options[selLength] = newOpt;
		document.getElementById("cmbGroup").options[0].selected = true;
	}
	
	
	/* the following works in IE only
	
	var Index = document.frmMedia.cmbGroup.selectedIndex;
	if (Index != 0) 
	{
		var oOption = document.createElement("OPTION");
		oOption.text = document.frmMedia.cmbGroup.options[Index].text;
		oOption.value = document.frmMedia.cmbGroup.options[Index].value;
		document.frmMedia.cmbGroupSelected.add(oOption);
		document.frmMedia.cmbGroup.options[0].selected = true;
	}
	
	*/
}

/************************************************************************************
* Name      : removeGroup()
* Author    : Clint Krismer
* Purpose   : removes a group from the listbox 
* Parameters: 
* Returns   : 
* Description: 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer       |   Aug 2002        | Initial Code
************************************************************************************/
function removeGroup() 
{
	var List = document.frmMedia.cmbGroupSelected;
    for(var i=List.options.length;i>0;i--)
    {
		if (List.options[i-1].selected) 
		{
			List.remove(List.options[i-1].index);
		}
    }
}

/************************************************************************************
* Name      : makeCriteria()
* Author    : Clint Krismer
* Purpose   : sets all the values in the cmbGroupSelected as SELECTED
* Parameters: 
* Returns   : 
* Description: 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer       |   Aug 2002        | Initial Code
************************************************************************************/
function makeCriteria() 
{
	var f = document.frmMedia;
	var sSelected = ''
	// THESE MUST DONE. It's mark them as selected which builds a list of ID's seperated by comma's.
	for(var i=f.cmbGroupSelected.options.length;i>0;i--) 
	{
		//f.cmbGroupSelected.options[i-1].selected = true;
		if(i!=1)
		{
			sSelected = sSelected + f.cmbGroupSelected.options[i-1].value + ","
		}
		else
		{
			sSelected = sSelected + f.cmbGroupSelected.options[i-1].value
		}
	}
	sSelected = sSelected + ''
	document.frmMedia.txtSelectedValues.value = sSelected
	
}

/******************************************************************************
* Name      : validateEmailMedia()
* Author    : Clint Krismer
* Purpose   : validate EmailMediaArticles.asp 
* Parameters: 
* Returns   : Submits the form if all tests pass 
*			: notifies the user of missing data
* Description: Checks for required values
*
* Maintenance Log
* -----------------------------------------------------------------------------
*          Who         |   When            |  Why
* -----------------------------------------------------------------------------
*  Clint Krismer |   Aug 2002        | Initial Code
*******************************************************************************/
function validateEmailMedia()
{	
	makeCriteria();
	if(document.frmMedia.txtSubject.value == 0)
	{
		alert("The field \"Subject:\" is required in order to send.");
		document.frmMedia.txtSubject.focus();
		return;
	}
	else if(document.frmMedia.cmbGroupSelected.options.length == 0)
	{
		alert("The field \"Media Group:\" is required in order to send.");
		document.frmMedia.cmbGroup.focus();
		return;
	}
	else if(bGetFileExtension(document.frmMedia.txtFile.value.toLowerCase()) == "exe" ||
	        bGetFileExtension(document.frmMedia.txtFile.value.toLowerCase())== "dll" ||
	        bGetFileExtension(document.frmMedia.txtFile.value.toLowerCase())== "bat")
	{
		alert("This file extension is not permitted. Please choose another file.");
		document.frmMedia.txtFile.focus();
		return;
	}
	else
	{	
		document.frmMedia.submit();
	}
}


/******************************************************************************
* Name      : showPrint()
* Author    : Clint Krismer
* Purpose   : open up the clients print dialog for their browser
* Parameters: none
* Returns   : none
* Description: open up the clients print dialog for their browser
*
* Maintenance Log
* -----------------------------------------------------------------------------
*          Who         |   When            |  Why
* -----------------------------------------------------------------------------
*  Clint Krismer |   Aug 2002        | Initial Code
*******************************************************************************/
function showPrint()
{
    window.print();
}

/************************************************************************************
* Name      : validateimagesolicitation()
* Author    : Clint Krismer
* Purpose   : validate imagesolicitation.asp
* Parameters: 
* Returns   : Submits the form if all tests pass 
*			: notifies the user of missing data
* Description: Checks for valid dates entered on the form 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer         |   Aug 2002        | Initial Code
************************************************************************************/
function validateimagesolicitation()
{
	var strTest = document.frmImage.txtPhoto.value
	
	if(!document.frmImage.optAgree[0].checked)
	{	
		alert("In order to submit your image you must agree to the terms and conditions")
		document.frmImage.optAgree[0].focus()
	}
	else if(document.frmImage.txtDate.value <='')
	{
		alert("Please enter a \"Season/Date Taken\"")
		document.frmImage.txtDate.focus()
	}
	else if(document.frmImage.txtDescription.value <='')
	{
		alert("Please enter a \"Description\"")
		document.frmImage.txtDescription.focus()
	}
	else if(document.frmImage.txtName.value <='')
	{
		alert("Please enter a \"Name\"")
		document.frmImage.txtName.focus()
	}
	else if(document.frmImage.txtEmail.value <='')
	{
		alert("Please enter an \"Email\"")
		document.frmImage.txtEmail.focus()
	}
	else if(document.frmImage.txtPhoto.value <='')
	{
		alert("Please select a photo to attach")
		document.frmImage.txtPhoto.focus()
	}
	
	
	/*
	else if(bGetFileExtension(strTest.toLowerCase()) == "exe" || 
	        
	        bGetFileExtension(strTest.toLowerCase())== "dll" || 
	        bGetFileExtension(strTest.toLowerCase())== "bat")
	{
		alert("This file extension is not permitted. Please choose another file");
		document.frmImage.txtPhoto.focus();
		return false
	}
	*/
	else
	{
		document.frmImage.submit();
	}
}


/************************************************************************************
* Name      : validateClassified()
* Author    : Clint Krismer
* Purpose   : validate classifiedAds.asp
* Parameters: 
* Returns   : Submits the form if all tests pass 
*			: notifies the user of missing data
* Description: Checks for valid dates entered on the form 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer       |   Aug 2002        | Initial Code
************************************************************************************/
function validateClassified()
{
	if(document.frmClassified.txtTitle.value == 0)
	{
		alert("Please enter a \"Title\" before saving.");
		document.frmClassified.txtTitle.focus();
	}
	else if(document.frmClassified.txtText.value == 0)
	{
		alert("Please enter \"Text\" before saving.");
		document.frmClassified.txtText.focus();
	}
	else if(!validDate(document.frmClassified.txtStartDate.value))
	{
		alert("Please enter a valid date for the field \"Start Date\" before saving.");
		document.frmClassified.txtStartDate.focus();
	}
	else if((document.frmClassified.txtPhone.value == 0) && (document.frmClassified.txtEmail.value == 0))
	{
		alert('Please enter either "Phone" or "Email" before saving.');
		document.frmClassified.txtPhone.focus();
	}
	else
	{
		var nDays
		if(document.frmClassified.cmbEndDate.value == '1')
		{
			nDays = 7
		}
		else if(document.frmClassified.cmbEndDate.value == '2')
		{
			nDays = 14
		}
		else if(document.frmClassified.cmbEndDate.value == '3')
		{
			nDays = 21
		}
		else if(document.frmClassified.cmbEndDate.value == '4')
		{
			nDays = 28
		}
		
		document.frmClassified.txtEndDate.value = dateAdd(document.frmClassified.txtStartDate.value, nDays)
		document.frmClassified.submit();
	}
}


/************************************************************************************
* Name      : dateAdd()
* Author    : Clint Krismer
* Purpose   : add months, days, years to a date
* Parameters: 
* Returns   : the new date
* Description: 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer       |   Aug 2002        | Initial Code
************************************************************************************/
function dateAdd(sStartDate, nDays)
{
	var returnDate = new Date(sStartDate)
	returnDate.setTime(returnDate.getTime()+60000*60*24*nDays)
	return returnDate;
}

/************************************************************************************
* Name      : savecoupon()
* Author    : Clint Krismer
* Purpose   : Validate and submit the coupon form
* Parameters: none
* Returns   : none
* Description: 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer        |   Sept 2002        | Initial Code
************************************************************************************/
function savecoupon()
{
	if(document.frmCoupon.txtBusinessName.value == 0)
	{
		alert("Please enter a \"Business Name\" before saving.");
		document.frmCoupon.txtBusinessName.focus();
	}
	else if(document.frmCoupon.txtHeading.value == 0)
	{
		alert("Please enter a \"Heading\" before saving.");
		document.frmCoupon.txtHeading.focus();
	}
	else if(document.frmCoupon.txtDescription.value == 0)
	{
		alert("Please enter a \"Description\" before saving.");
		document.frmCoupon.txtDescription.focus();
	}
	else if((document.frmCoupon.txtExpiryDate.value == 0) || (validDate(document.frmCoupon.txtExpiryDate.value) == false))
	{
		alert("Please enter a vaild date for the field \"Expiry Date\" before saving.");
		document.frmCoupon.txtExpiryDate.focus();
	}
	else
	{
        document.frmCoupon.submit();
    }
}

/************************************************************************************
* Name      : SayOKcoupon()
* Author    : Clint Krismer
* Purpose   : Display message for a set amount of time
* Parameters: none
* Returns   : none
* Description: 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer        |   Sept 2002        | Initial Code
************************************************************************************/
function SayOKcoupon()
{
	objTimer = window.setTimeout('gotocouponmenu()',2000);
}

/************************************************************************************
* Name      : gotocouponmenu()
* Author    : Clint Krismer
* Purpose   : Redirect to coupon Admin
* Parameters: none
* Returns   : none
* Description: 
*
* Maintenance Log
* ----------------------------------------------------------------------------------
*          Who         |   When            |  Why
* ----------------------------------------------------------------------------------
*  Clint Krismer        |   Sept 2002        | Initial Code
************************************************************************************/
function gotocouponmenu()
{
	document.location.href = 'couponadmin.asp';
}

/******************************************************************************
* Name      : validateMembership()
* Author    : Clint Krismer
* Purpose   : Validates membership.asp before submitting
* Parameters: none
* Returns   : none
* Description: checks the capacity field to ensure the value entered is a number
*
* Maintenance Log
* -----------------------------------------------------------------------------
*          Who         |   When            |  Why
* -----------------------------------------------------------------------------
*  Clint Krismer       |   Sept 2002       | Initial Code
******************************************************************************/
function validateMembership()
{
	// check for empty select box
	if(document.frmMembership.cmbVoting.selectedIndex == -1)
	{
		alert('Please select a "Voting Member" before saving.');
		document.frmMembership.cmbVoters.focus();
	}
	if(document.frmMembership.cmbSector.selectedIndex == -1)
	{
		alert('Please select a "Sector" before saving.');
		document.frmMembership.cmbSector.focus();
	}
	if(document.frmMembership.txtCapacity.value != 0)
	{
		if(isNaN(parseInt(document.frmMembership.txtCapacity.value)))
		{
			alert("The capacity entered is not a number.");
			document.frmMembership.txtCapacity.focus();
		}
		else
		{
			document.frmMembership.submit();
		}
	}
	else
	{
		document.frmMembership.submit();
	}
}

function opencoupon(intCouponId) 
{
	strFeatures = "top=40,left=40,width=450,height=360,toolbar=no,scrollbars=no,menubar=no,location=no,directories=no";
	objNewWindow = window.open("../utils/coupondetails.asp?couponId=" + intCouponId, "CouponDetails", strFeatures);
}  
function tick(dClock,dClockDate) 
{
	var hours, minutes, seconds, ap;
	var intHours, intMinutes, intSeconds;
	dClock=parseInt(dClock)
	var today=new Date(dClock);
	intHours = today.getHours();
	intMinutes = today.getMinutes();
	intSeconds = today.getSeconds();
	if (intHours == 0) 
	{
		hours = "12:";
		ap = "AM";
	} 
	else if (intHours < 12) 
	{ 
		hours = intHours+":";
		ap = "AM";
	} 
	else if (intHours == 12) 
	{
		hours = "12:";
		ap = "PM";
	} 
	else 
	{
		intHours = intHours - 12
		hours = intHours + ":";
		ap = "PM";
	}
	if (intMinutes < 10) 
	{
		minutes = "0"+intMinutes+":";
	} 
	else 
	{
		minutes = intMinutes+":";
	}
	if (intSeconds < 10) 
	{
		seconds = "0"+intSeconds+" ";
	} 
	else 
	{
		seconds = intSeconds+" ";
	} 
	timeString = dClockDate+' '+hours+minutes+seconds+ap;
	Clock.innerHTML = timeString;
	dClock=dClock+1000;
	setTimeout('tick(' + dClock + ',"' + dClockDate + '");', 1000);
}
