var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function popOpen(theURL,winName,features) { window.open(theURL,winName,features); }  
function PopupPic(sPicURL) { window.open( "popup.htm?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200"); } 

function isDefined(property) { return (typeof property != 'undefined'); }

function IsValidEmail(str){  // returns true if invalid email
	var regexEmail = /^[A-Za-z0-9'._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
	return regexEmail.test(str);
} 

function errorAlert(e) {
    // If ErrorString "e" has content, there was at least one error; let them know.
   if (e.length > 0) {
      var msg ="____________________________________________________\n\n";
      msg += "  The form was not submitted for the following reason(s): \n";
      msg += "____________________________________________________\n";
      alert(msg + e);
      return false;
   } 
   return true;
} // end errorAlert()

function ControlVersion()
{
	var version, axo, e;
	try {
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {}

	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			version = "WIN 6,0,21,0";
			axo.AllowScriptAccess = "always";
			version = axo.GetVariable("$version");
		} catch (e) {}
	}

	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {}
	}

	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {}
	}

	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {version = -1;}
	}	
	return version;
}

function CreateControl(DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL)
{
	var d = document.getElementById(DivID);
	if (ControlVersion()) {
		d.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + WIDTH + '" height="' + HEIGHT + '" wmode="' + WMODE + '"><param name="bgcolor" value="#' + BGCOLOR + '" /><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + URL + '"><param name="quality" value="high"><param name="salign" value="lt" /><embed src="' + URL + '" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#' + BGCOLOR + '" width="' + WIDTH + '" height="' + HEIGHT + '" wmode="' + WMODE + '"></embed></object>';
	} else {
		d.innerHTML = '<img src="images/noFlash.jpg" width="600" height="225" border="0" usemap="#noflash-map">';
	}
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}