/*the base image directory location*/
var base = "/images/";

/*********
pop up a new window
*********/
function openWindow(url,x,y,toolbar,scrollbars,resizable)
{
	new_x=x+20;
	new_y=y+20;
	var options = "toolbar=" + toolbar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",width=" + new_x + ",height=" + new_y;
	newWindow=window.open(url,"WinOpen",options);
}

/*********
pop up a new window
*********/
function openGalleryItemWindow(url,x,y,windowName)
{
	new_x=x+20;
	new_y=y+20;
	var options = "toolbar=no,scrollbars=yes,resizable=yes,width=" + new_x + ",height=" + new_y;
	newWindow=window.open(url,windowName,options);
}

/*********
switch an image with an ID
*********/
function switchImage(thisId,thisImageSlice)
{
	//is the text "_off" inside this btn?
	if (document.getElementById(thisId).src.indexOf('_off.') < 0)
	{
		thisImg=base+thisImageSlice+thisId+'_off.gif';
	}
	else
	{
		thisImg=base+thisImageSlice+thisId+'_on.gif';
	}
	//set the image
	document.getElementById(thisId).src=thisImg;
}

/*********
expand code for both browsers
*********/
function expandIt(whichEl){
	var browser=navigator.userAgent.toLowerCase();
	var pos=browser.indexOf("gecko");
	var myElement = document.getElementById(whichEl);
	//do for Gecko Browsers
	if (pos>=0) {
		if (myElement.style.visibility == 'visible') {
			myElement.style.visibility = 'hidden';
			myElement.style.position = 'absolute';
			}
		else {
			myElement.style.position = 'relative';
			myElement.style.visibility = 'visible';
			}
	//do for IE
	} else {
		myElement.style.display = (myElement.style.display == "none" ) ? "" : "none";
	}
}

/*********
toggle the text inside a form on/off
*********/
function toggleFormText(thisId, thisText)
{
	//alert(document.getElementById(thisId).value + ',' + thisText);
	if (document.getElementById(thisId).value == thisText)
	{
		document.getElementById(thisId).value='';
	}
	else if (document.getElementById(thisId).value == '')
	{
		document.getElementById(thisId).value=thisText;
	}
}

/************
toggleSelectMenus - This function hides all select menus on an html page. In IE the select box is always on top so this function counters that bug by
			   hiding the select boxes so drop down menus aren't trumped. Toggle needs to be either: 'hidden' or 'visible'.
************/
function toggleSelectMenus(toggle) {

	// Loop through all the forms on the page
	for (i=0; i < document.forms.length; i++) {

		// Loop through the form's fields
		for (j=0; j < document.forms[i].length; j++) {

			// Test whether form object is a drop down menu
			if (getFormType(document.forms[i].elements[j]) == 'select') {

				document.forms[i].elements[j].style.visibility = toggle;
			}
		}

	}
}

/************
getFormType - Returns a string name of the type of form object. The types are: select, radio, button, submit, hidden, textarea, text
************/
function getFormType(formObject)
{
	type = formObject.type;

	// Make the select type simpler, we don't care which kind of select as long as it's a select
	if ((formObject.type == 'select-one') || (formObject.type == 'select-multiple'))
		type = 'select';

	return type;
}

/*********
validates an email address
*********/
function validateEmail(thisEmail)
{
	//initiate returnMessage variable
	var returnMessage="";

	if(thisEmail == '')
	{
		// alert the user
		returnMessage = "Please type in a valid email address.";
	}
	else
	{
		// function to check email address vilidity
		function emailCheck(emailStr)
		{
			/* The following pattern is used to check if the entered e-mail address
			   fits the user@domain format.  It also is used to separate the username
			   from the domain. */
			var emailPat=/^(.+)@(.+)$/
			/* The following string represents the pattern for matching all special
			   characters.  We don't want to allow special characters in the address.
			   These characters include ( ) < > @ , ; : \ " . [ ]    */
			var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
			/* The following string represents the range of characters allowed in a
			   username or domainname.  It really states which chars aren't allowed. */
			var validChars="\[^\\s" + specialChars + "\]"
			/* The following pattern applies if the "user" is a quoted string (in
			   which case, there are no rules about which characters are allowed
			   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
			   is a legal e-mail address. */
			var quotedUser="(\"[^\"]*\")"
			/* The following pattern applies for domains that are IP addresses,
			   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
			   e-mail address. NOTE: The square brackets are required. */
			var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
			/* The following string represents an atom (basically a series of
			   non-special characters.) */
			var atom=validChars + '+'
			/* The following string represents one word in the typical username.
			   For example, in john.doe@somewhere.com, john and doe are words.
			   Basically, a word is either an atom or quoted string. */
			var word="(" + atom + "|" + quotedUser + ")"
			// The following pattern describes the structure of the user
			var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
			/* The following pattern describes the structure of a normal symbolic
			   domain, as opposed to ipDomainPat, shown above. */
			var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


			/* Finally, let's start trying to figure out if the supplied address is
			   valid. */

			/* Begin with the coarse pattern to simply break up user@domain into
			   different pieces that are easy to analyze. */
			var matchArray=emailStr.match(emailPat);
			//alert(emailStr);
			var checkMatch='-' + matchArray + '-';
			if (checkMatch == "-null-")
			{
			  /* Too many/few @'s or something; basically, this address doesn't
				 even fit the general mould of a valid e-mail address. */
				returnMessage = "The email address seems incorrect (check @ and .'s).";
			}
			else
			{
				var user=matchArray[1];
				var domain=matchArray[2];

				// See if "user" is valid
				if (user.match(userPat)==null)
				{
					// user is not valid
					returnMessage = "The email's username doesn't seem to be valid (before the @).";
				}

				/* if the e-mail address is at an IP address (as opposed to a symbolic
				   host name) make sure the IP address is valid. */
				var IPArray=domain.match(ipDomainPat)
				if (IPArray!=null) {
					// this is an IP address
					  for (var i=1;i<=4;i++) {
						if (IPArray[i]>255) {
							returnMessage = "The email's destination IP address is invalid.";
						}
					}
				}

				// Domain is symbolic name
				var domainArray=domain.match(domainPat)
				if (domainArray==null) {
					returnMessage = "The email's domain name doesn't seem to be valid (after the @).";
				}

				/* domain name seems valid, but now make sure that it ends in a
				   three-letter word (like com, edu, gov) or a two-letter word,
				   representing country (uk, nl), and that there's a hostname preceding
				   the domain or country. */

				/* Now we need to break up the domain to get a count of how many atoms
				   it consists of. */
				var atomPat=new RegExp(atom,"g")
				var domArr=domain.match(atomPat)
				var len=domArr.length
				if (domArr[domArr.length-1].length<2 ||
					domArr[domArr.length-1].length>4) {
				   // the address must end in a two letter or three letter word.
				   returnMessage = "The email must end in a four-letter domain, three-letter domain, or two letter country.";
				}

				// Make sure there's a host name preceding the domain.
				if (len < 2) {
				   returnMessage="This email is missing a hostname!";
				}
			}
		}
		// call the validation function and return its result
		val=emailCheck(thisEmail);
		// if it returns val=no_submit, stop form
	}
	return returnMessage;
}

/************
verify Contact Form
************/
function verifyContactForm()
{
	//form variables
	submitBtnMessage='Saving... Please Wait';
	formName='formContact';

	//initialize submitForm value
	submitForm=true;
	warningMessage="";
	formFocus="";

	//check name
	if (submitForm)
	{
		formElement="name";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your name.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check the email
	if (submitForm)
	{
		formElement="email_address";
		thisDOM=eval('document.' + formName + '.' + formElement);
		//check the email address
		thisMessage=validateEmail(thisDOM.value);
		//if there is no message sent back, set the alert.
		if (thisMessage.length != 0)
		{
			warningMessage=thisMessage;
			formFocus=formElement;
			submitForm=false;
		}
	}
	//check comment
	if (submitForm)
	{
		formElement="comments";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in a comment.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//disable the form if the form checks out
	if (!submitForm)
	{
		alert(warningMessage);
	}

	//focus the form if necessary
	if (formFocus.length > 0)
	{
		thisDOM=eval('document.' + formName + '.' + formFocus);
		thisDOM.focus();
	}

	//return the boolean value whether or not we should submit this form
	return submitForm;
}

/************
verify Newsletter
************/
function verifyNewsletterSubscribe(checkboxCount)
{
	//form variables
	submitBtnMessage='Saving... Please Wait';
	formName='formNewsletterSubscribe';

	//initialize submitForm value
	submitForm=true;
	warningMessage="";
	formFocus="";

	//check name_first
	if (submitForm)
	{
		formElement="name_first";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your first name.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check name
	if (submitForm)
	{
		formElement="name_last";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your last name.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check the email
	if (submitForm)
	{
		formElement="email_address";
		thisDOM=eval('document.' + formName + '.' + formElement);
		//check the email address
		thisMessage=validateEmail(thisDOM.value);
		//if there is no message sent back, set the alert.
		if (thisMessage.length != 0)
		{
			warningMessage=thisMessage;
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check for newsletter category checked
	if (submitForm)
	{
		newsletterSelected=false;
		formElement="newsletter_categories";
		thisDOM=eval('document.' + formName + '.' + formElement);
		// loop thru all the checkboxes in the page
		for (var i=1; i <= checkboxCount; i++)
		{
			if (document.getElementById('checkbox' + i).checked)
			{
				newsletterSelected=true;
			}
		}
		// no newsletter selected, don't submit the form
		if (!newsletterSelected)
		{
			warningMessage="Please select a newsletter to subscribe to.";
			submitForm=false;
		}
	}

	//disable the form if the form checks out
	if (!submitForm)
	{
		alert(warningMessage);
	}

	//focus the form if necessary
	if (formFocus.length > 0)
	{
		thisDOM=eval('document.' + formName + '.' + formFocus);
		thisDOM.focus();
	}

	//return the boolean value whether or not we should submit this form
	return submitForm;
}

/************
verify Send to a Friend
************/
function verifySendToAFriend()
{
	//form variables
	submitBtnMessage='Sending... Please Wait';
	formName='formSendToAFriend';

	//initialize submitForm value
	submitForm=true;
	warningMessage="";
	formFocus="";
	toEmailFound=false;

	//check friends_emails
	if (submitForm)
	{
		formElement="to_bookerball_1";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in an email address.';
			formFocus=formElement;
			submitForm=false;
		}
		// verify correctly formed email
		else
		{
			// set variable so next function knows a to_email has been found
			toEmailFound=true;
			//check the email address
			thisMessage=validateEmail(thisDOM.value);
			//if there is no message sent back, set the alert.
			if (thisMessage.length != 0)
			{
				warningMessage=thisMessage;
				formFocus=formElement;
				submitForm=false;
				toEmailFound=true;
			}
		}
	}

	//check the second email
	if (!toEmailFound)
	{
		formElement="to_bookerball_2";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in an email address.';
			formFocus="to_email_1";
			submitForm=false;
		}
		// verify correctly formed email
		else
		{
			// set variable so next function knows a to_email has been found
			toEmailFound=true;
			//check the email address
			thisMessage=validateEmail(thisDOM.value);
			//if there is no message sent back, set the alert.
			if (thisMessage.length != 0)
			{
				warningMessage=thisMessage;
				formFocus=formElement;
				submitForm=false;
			}
		}
	}

	//check the third email
	if (!toEmailFound)
	{
		formElement="to_bookerball_3";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in an email address.';
			formFocus="to_email_1";
			submitForm=false;
		}
		// verify correctly formed email
		else
		{
			//check the email address
			thisMessage=validateEmail(thisDOM.value);
			//if there is no message sent back, set the alert.
			if (thisMessage.length != 0)
			{
				warningMessage=thisMessage;
				formFocus=formElement;
				submitForm=false;
			}
		}
	}

	//check from name
	if (submitForm)
	{
		formElement="from_name";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your name.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check the email
	if (submitForm)
	{
		formElement="from_thunderbirds";
		thisDOM=eval('document.' + formName + '.' + formElement);
		//check the email address
		thisMessage=validateEmail(thisDOM.value);
		//if there is no message sent back, set the alert.
		if (thisMessage.length != 0)
		{
			warningMessage=thisMessage;
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check from name
	if (submitForm)
	{
		formElement="securitycode";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in the displayed security code numbers.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//disable the form if the form checks out
	if (!submitForm)
	{
		alert(warningMessage);
	}

	//focus the form if necessary
	if (formFocus.length > 0)
	{
		thisDOM=eval('document.' + formName + '.' + formFocus);
		thisDOM.focus();
	}

	//return the boolean value whether or not we should submit this form
	return submitForm;
}

/************
verify Contact Form
************/
function verifyCommentForm()
{
	//form variables
	submitBtnMessage='Saving... Please Wait';
	formName='formComment';

	//initialize submitForm value
	submitForm=true;
	warningMessage="";
	formFocus="";

	//check name
	if (submitForm)
	{
		formElement="username";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your username.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check password
	if (submitForm)
	{
		formElement="password";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your password.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check comment
	if (submitForm)
	{
		formElement="comment";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your comment.';
			formFocus=formElement;
			submitForm=false;
		}
		// set the cookie value here in case they need to edit it again.
		setCookie('THISCOMMENT',thisDOM.value,1);
	}

	//disable the form if the form checks out
	if (!submitForm)
	{
		alert(warningMessage);
	}

	//focus the form if necessary
	if (formFocus.length > 0)
	{
		thisDOM=eval('document.' + formName + '.' + formFocus);
		thisDOM.focus();
	}

	//return the boolean value whether or not we should submit this form
	return submitForm;
}


/************
show the message
************/
function showMessage()
{
	var thisMessage = new Array();
	// check for the cookie
	urlVariables = createUrlObject();

	// only alert if there is a message
	if (urlVariables['msg'] != undefined)
	{
		alert(urlVariables['msg']);
	}
}

/************
create an array of url variables in javascript
************/
function createUrlObject()
{
	var getVars = new Array();
	var locvartemp = ( window.location.href.indexOf( "?" ) + 1 ) ? window.location.href.substr( window.location.href.indexOf( "?" ) + 1 ) : "";
	locvartemp = locvartemp.split( "&" );
	for( var x = 0; x < locvartemp.length; x++ )
	{
		var lvTempVar = locvartemp[x].split( "=" );
		getVars[ unescape( lvTempVar[0] ) ] = unescape( lvTempVar[1] );
	}
	return(getVars);
}

/************
setCookie
************/
function setCookie(name, value, expires, path, domain, secure)
{
	var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toLocaleString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

/************
getCookie
************/
function getCookie(name)
{
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
	if (begin != 0) return null;
		} else
	begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1)
		end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

/************
deleteCookie
************/
function deleteCookie(name, path, domain)
{
	if (getCookie(name))
	{
		document.cookie = name + "=" +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

/************
verify TRRW article Form
************/
function verifyTRRWArticleForm()
{
	//form variables
	submitBtnMessage='Saving... Please Wait';
	formName='formArticleSubmit';

	//initialize submitForm value
	submitForm=true;
	warningMessage="";
	formFocus="";

	//check title
	if (submitForm)
	{
		formElement="title";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your title.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check summary
	if (submitForm)
	{
		formElement="teaser";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your summary.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check body
	if (submitForm)
	{
		formElement="body";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your story/poem/article.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check name
	if (submitForm)
	{
		formElement="username";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your username.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check password
	if (submitForm)
	{
		formElement="password";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your password.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//disable the form if the form checks out
	if (!submitForm)
	{
		alert(warningMessage);
	}

	//focus the form if necessary
	if (formFocus.length > 0)
	{
		thisDOM=eval('document.' + formName + '.' + formFocus);
		thisDOM.focus();
	}

	//return the boolean value whether or not we should submit this form
	return submitForm;
}


/************
verify Contact Form
************/
function verifyContestForm()
{
	//form variables
	submitBtnMessage='Saving... Please Wait';
	formName='formContest';

	//initialize submitForm value
	submitForm=true;
	warningMessage="";
	formFocus="";

	//check name
	if (submitForm)
	{
		formElement="name";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your name.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check the email
	if (submitForm)
	{
		formElement="email_address";
		thisDOM=eval('document.' + formName + '.' + formElement);
		//check the email address
		thisMessage=validateEmail(thisDOM.value);
		//if there is no message sent back, set the alert.
		if (thisMessage.length != 0)
		{
			warningMessage=thisMessage;
			formFocus=formElement;
			submitForm=false;
		}
	}

	//address
	if (submitForm)
	{
		formElement="address";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your address.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//city
	if (submitForm)
	{
		formElement="city";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your city.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//state
	if (submitForm)
	{
		formElement="state";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your state.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//zip
	if (submitForm)
	{
		formElement="zip";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your zip/postal code.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//country
	if (submitForm)
	{
		formElement="country";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your country.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//comment
	if (submitForm)
	{
		formElement="comment";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your answer!';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//disable the form if the form checks out
	if (!submitForm)
	{
		alert(warningMessage);
	}

	//focus the form if necessary
	if (formFocus.length > 0)
	{
		thisDOM=eval('document.' + formName + '.' + formFocus);
		thisDOM.focus();
	}

	//return the boolean value whether or not we should submit this form
	return submitForm;
}

/************
verify Contact Form
************/
function verifyPetitionForm()
{
	//form variables
	submitBtnMessage='Saving... Please Wait';
	formName='formPetition';

	//initialize submitForm value
	submitForm=true;
	warningMessage="";
	formFocus="";

	//check name
	if (submitForm)
	{
		formElement="name";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your name.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check the email
	if (submitForm)
	{
		formElement="email_address";
		thisDOM=eval('document.' + formName + '.' + formElement);
		//check the email address
		thisMessage=validateEmail(thisDOM.value);
		//if there is no message sent back, set the alert.
		if (thisMessage.length != 0)
		{
			warningMessage=thisMessage;
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check securitycode
	if (submitForm)
	{
		formElement="securitycode";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in the secure numbers to confirm your signature.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//disable the form if the form checks out
	if (!submitForm)
	{
		alert(warningMessage);
	}

	//focus the form if necessary
	if (formFocus.length > 0)
	{
		thisDOM=eval('document.' + formName + '.' + formFocus);
		thisDOM.focus();
	}

	//return the boolean value whether or not we should submit this form
	return submitForm;
}


/************
Gallery Upload Form Confirmation
************/
function confirmUploadForm()
{
	//form variables
	submitBtnMessage='Saving... Please Wait';
	formName='formUpload';

	//initialize submitForm value
	submitForm=true;
	warningMessage="";
	formFocus="";

	// check logo image
	if (submitForm)
	{
		formElement = "uploadedFile";
		thisDOM = eval('document.' +formName + '.' + formElement);

		if (thisDOM.value != "")
		{
			// check for the extensions
			if ((thisDOM.value.indexOf('.gif') > 0) || (thisDOM.value.indexOf('.jpg') > 0) || (thisDOM.value.indexOf('.jpeg') > 0) || (thisDOM.value.indexOf('.png') > 0))
			{
				submitForm = true;
			}
			// no proper extension found
			else
			{
				warningMessage = "Please upload either a .gif, .jpg, or .png image.";
				formFocus = formElement;
				submitForm = false;
			}
		}
		// no file uploaded
		else
		{
			warningMessage = "Please click the \"Browse\" button to select a .gif, .jpg, or .png image to upload.";
			formFocus = formElement;
			submitForm = false;
		}
	}

	//check title
	if (submitForm)
	{
		formElement="title";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your image\'s title.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check original artist
	if (submitForm)
	{
		formElement="artist";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in the name of the original artist.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check for consent checked
	if (submitForm)
	{
		consentChecked = false;
		formElement="consent_approval";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (document.getElementById('consent_checkbox').checked)
		{
			consentChecked=true;
		}
		// no consent checked, don't submit the form
		if (!consentChecked)
		{
			warningMessage="Please read the Consent Information, and click the box next to \"I Consent\".";
			submitForm=false;
		}
	}

	//check username
	if (submitForm)
	{
		formElement="username";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your username.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check password
	if (submitForm)
	{
		formElement="password";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your password.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//disable the form if the form checks out
	if (!submitForm)
	{
		alert(warningMessage);
	}

	//focus the form if necessary
	if (formFocus.length > 0)
	{
		thisDOM=eval('document.' + formName + '.' + formFocus);
		thisDOM.focus();
	}

	//return the boolean value whether or not we should submit this form
	return submitForm;
}

/************
Feedback Form Confirmation Consent
************/
function confirmFeedbackConsent()
{
	/*if (document.getElementById('consent_checkbox').checked)
	{
		document.getElementById('feedbackSubmitButton').className='formSubmit';
		document.getElementById('feedbackSubmitButton').disabled=false;
	}
	else
	{
		document.getElementById('feedbackSubmitButton').className='formSubmitDisabled';
	}*/
}

/************
verify Comment Form
************/
function verifyCommentForm()
{
	//form variables
	submitBtnMessage='Saving... Please Wait';
	formName='formComment';

	//initialize submitForm value
	submitForm=true;
	warningMessage="";
	formFocus="";

	//check name
	if (submitForm)
	{
		formElement="name";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in your name.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check the email
	if (submitForm)
	{
		formElement="email";
		thisDOM=eval('document.' + formName + '.' + formElement);
		//check the email address
		thisMessage=validateEmail(thisDOM.value);
		//if there is no message sent back, set the alert.
		if (thisMessage.length != 0)
		{
			warningMessage=thisMessage;
			formFocus=formElement;
			submitForm=false;
		}
	}
	//check comment
	if (submitForm)
	{
		formElement="comments";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in a comment.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//check security code
	if (submitForm)
	{
		formElement="securitycode";
		thisDOM=eval('document.' + formName + '.' + formElement);
		if (thisDOM.value == "")
		{
			warningMessage='Please type in the security code numbers.';
			formFocus=formElement;
			submitForm=false;
		}
	}

	//disable the form if the form checks out
	if (!submitForm)
	{
		alert(warningMessage);
	}

	//focus the form if necessary
	if (formFocus.length > 0)
	{
		thisDOM=eval('document.' + formName + '.' + formFocus);
		thisDOM.focus();
	}

	//return the boolean value whether or not we should submit this form
	return submitForm;
}

