
// SWF objects, flash

window.onload = function() { 
	var header = new SWFObject('\/images\/pam08.swf', 'pam-header', '725', '90', '6', '#000000'); 
	header.addParam("wmode", "transparent");
	var YT = new SWFObject('http:\/\/www.youtube.com\/v\/xdQkrgJK9eo&hl=en&fs=1', 'ww-ii', '425', '344', '6', '#000000'); 
	YT.addParam("wmode", "transparent");
	YT.addParam("allowFullScreen","true");
	YT.addParam("allowscriptaccess","always");
	if (document.getElementById('pam-header')) { header.write('pam-header'); }
	if (document.getElementById('yt-video')) { YT.write('yt-video'); }
}; 


// really only used on few pages 

   function newWindow(imgName, windowTitle, imgWidth, imgHeight) {

     var winWidth = imgWidth + 60;
     var winHeight = imgHeight + 125;
	 windowTitle = (windowTitle != '')?windowTitle:imgName;

     if (winHeight > 480) {
       if (screen.height) { winHeight = screen.height - 100; }
       else { winHeight = 480; }
     }
     var params = 'scrollbars=1,resizeable=1,width=' + winWidth + ',height=' + winHeight;
     var win;
     var day = new Date();
     var id = day.getTime();

	 var msg = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n'+
	           '<html><head><title>' + windowTitle + ' <\/title>\n'+
			   '<style type="text/css">\n'+
			   'body { background-color:#804000;}\n'+
			   'td { background-color:#FFFFFF; font-family: Arial, Helvetica, Sans-Serif; text-align:center; font-size:14px; color: #000000;}\n'+
               'h3 {font-family: Arial, Helvetica, Sans-Serif; text-align: center; color:#ffffff;}\n'+
			   '#container { width: 95%; margin: auto; padding: 12px; text-align: center; }\n'+
               '<\/style><body>\n'+
               '<div id="container"><h3>'+windowTitle+'<\/h3><form>\n'+
               '<a href="#" onClick="window.close\(\)\; return false\;"><img src="\/images\/' + imgName + '" width="' + imgWidth + '" height="' + imgHeight + '" border="0"><\/a>\n'+
               '<p><input type="button" name="closeButton" value="Close Window" onClick="window.close\(\)\;"><\/p>\n'+
               '<\/form><\/div><\/body><\/html>\n\n';
     win = open('', id, params);
     win.document.write(msg);
     win.document.close();
     return false;
   }

// for all forms, note required arrays
   
function checkForm(form,which) { 

	var requireds = new Array('Name', 'Email'); // used for all, only item used for contact form
	if (which == 'sponsors') { requireds.push('Phone'); }
	if (which == 'links')    { requireds.push('URL', 'Phone'); }
	if (
		(which == 'join') || (which == 'air_show') || (which == 'building')
		){ requireds.push('Phone','Address', 'City', 'State', 'Zip'); }

	var obj=checkThis=msg='';

	for (i=0; i<requireds.length; i++) {
		var obj = document.getElementById(requireds[i]);
		if (requireds[i] == 'State') { 
			var ind=obj.selectedIndex;
			checkThis=obj.options[ind].value;
		}
		else { checkThis = obj.value; }
		if ((checkThis == '') || (checkThis == 'none')) {
			msg = 'Please provide your ' + requireds[i] + ' before submitting this form.';
			break;
		}
	}
	if ((msg == '') && (form.Email.value != '')) {
		var found = false;
		var emailString = form.Email.value;
		for (j=0; j < emailString.length; j++) {
			if (emailString.charAt(j) == "@") { found = true; }
		}
		if (found == false) {
			msg = 'Is that your true email address?\n' +
			'Please enter your correct email address.\n' +
			'We will not place you on any mailing lists!\n';
			passChecks = false;
		}
	}
	if (msg != '') {  alert(msg);  }
	else  { form.submit(); }
	return false;
}