//below for sub menus
var divMenu = new FSMenu('divMenu', false, 'display', 'block', 'none');
divMenu.animations[divMenu.animations.length] = FSMenu.animFade;
//divMenu.animations[divMenu.animations.length] = FSMenu.animSwipeDown;
//divMenu.animations[divMenu.animations.length] = FSMenu.animClipDown;

//below for round corners
function addCorners() {
	/*
	The new 'validTags' setting is optional and allows
	you to specify other HTML elements that curvyCorners
	can attempt to round.

	The value is comma separated list of html elements
	in lowercase.

	validTags: ["div", "form"]

	The above example would enable curvyCorners on FORM elements.
	*/
	settings = {
			tl: { radius: 6 },
			tr: { radius: 6 },
			bl: { radius: 6 },
			br: { radius: 6 },
			antiAlias: true,
			autoPad: true,
			validTags: ["div"]
	}
	settings2 = {
			tl: { radius: 10 },
			tr: { radius: 10 },
			bl: { radius: 10 },
			br: { radius: 10 },
			antiAlias: true,
			autoPad: true,
			validTags: ["div"]
	}

	/*
	Usage:

	newCornersObj = new curvyCorners(settingsObj, classNameStr);
	newCornersObj = new curvyCorners(settingsObj, divObj1[, divObj2[, divObj3[, . . . [, divObjN]]]]);
	*/
	var myBoxObject = new curvyCorners(settings, "myBox6R");
	myBoxObject.applyCornersToAll();
	var myBoxObject = new curvyCorners(settings2, "myBox10R");
	myBoxObject.applyCornersToAll();
}

// Form Validation Script 
// Revision 2 - Ryan Peters (ryanp@ihtmlmerchant.com)
// BIG rewrite - Michael Slavin (michael@thewebster.com)
// form onSubmit="return validInfo(this)"
// <script language="JavaScript" type="text/javascript" src="appvalidate.js"></script>

var neededFields = new makeAnArray('amount','first_name', 'last_name', 'email', 'streetaddress', 'city','state', 'zipcode','phone');

var neededDesc = new makeAnArray('how many tickets you want to buy','your first name','your last name','your email','your street address','your city','your state','your zipcode','your phone number');

function makeAnArray() {
        this.length = makeAnArray.arguments.length;
        for (var i = 0; this.length > i; i++) {
          	this[i+1] = makeAnArray.arguments[i]
          	}	
	}

function validInfo(obj) {
	var errMsg = '';

	if (isMailAddress(obj)) {
	
		for (var l = 1; neededFields.length > l-1; l ++) {
			if ((obj.elements[neededFields[l]].value == '') ||
				(obj.elements[neededFields[l]].value == ' ')) {
				errMsg = errMsg + 'You didn\'t enter ' + neededDesc[l] + '\n';
				}
			}
		if (errMsg != '') {
			errMsg = 'Sorry, we can\'t process this form because:\n\n' + errMsg;
			alert(errMsg);
			return false;
		} else {
			return true;
		}
	}else {
			return false;
		}
	return true;
}

function isMailAddress(obj) {
	invalidChars = " /|\\\"':;,";
	email = obj.elements['email'].value;
	if (obj.elements['email'].value != obj.elements['email2'].value) {
		alert("Your email entries did not match.");
		obj.elements['email'].focus();
		obj.elements['email'].select();
		return false; 
	}
	if ( ! email) { alert("Sorry, I couldn't make out any email address you're wanting to use."); return false; }
	for (i=0; i<invalidChars.length; i++) { badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1) { alert("Sorry, we cannot accept an email containing the character \"" + badChar + "\""); return false; }	}
	atPos = email.indexOf("@",1)
	if (atPos == -1) { alert("Sorry, your email address must contain an \"@\""); return false; }
	if (email.indexOf("@",atPos+1) != -1) { alert("Sorry, your email address must contain only one \"@\""); return false; }
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) { alert("Sorry, a valid email address contains a dot after the \"@\""); return false; } 
	if (periodPos+3 > email.length) { alert("Sorry, a valid email address contains a TLD type (e.g. com, net, org) after the dot"); return false; } 
	return true;
}

function checke(obj) {
	invalidChars = " /|\\\"':;,";
	email = obj.value;
//	if (obj.elements['email'].value != obj.elements['email2'].value) {
//		alert("Your email entries did not match.");
//		obj.elements['email'].focus();
//		obj.elements['email'].select();
//		return false; 
//	}
	if ( ! email) { return true; }
	for (i=0; i<invalidChars.length; i++) { badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1) { alert("Sorry, we cannot accept an email containing the character \"" + badChar + "\""); return false; }	}
	atPos = email.indexOf("@",1)
	if (atPos == -1) { alert("Sorry, your email address must contain an \"@\""); return false; }
	if (email.indexOf("@",atPos+1) != -1) { alert("Sorry, your email address must contain only one \"@\""); return false; }
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) { alert("Sorry, a valid email address contains a dot after the \"@\""); return false; } 
	if (periodPos+3 > email.length) { alert("Sorry, a valid email address contains a TLD type (e.g. com, net, org) after the dot"); return false; } 
	return true;
}

