function winopen(windowURL,windowname,w,h){
popup = window.open(windowURL,windowname,"width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes");
popup.focus();
}

function validEmail(email) {
	invalidChars = " /:,;"
	if (email == "") {
	    return false
	}
	
	for (i=0; i<invalidChars.length; i++) {
	    badChar = invalidChars.charAt(i)
	    if (email.indexOf (badChar,0) != -1) {
	        return false
	    }
	}  // for (i=o.. 
	
	atPos = email.indexOf ("@",1)
	
	if (atPos == -1) {
	    return false
	}
	
	if ( email.indexOf ("@", atPos+1) != -1) {
	    return false
	}
	periodPos = email.indexOf (".", atPos)
	
	if ( periodPos == -1) {
	    return false
	}
	
	if ( periodPos+3 > email.length)    {
	    return false
	}
	return true
}  // validEmail 


function FlashInstalled()
{
	result = false;
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) {
		result = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
	} else if (document.all && (navigator.appVersion.indexOf("Mac")==-1)) {
		// IE Windows only -- check for ActiveX control, have to hide code in eval from Netscape (doesn't like try)
		eval ('try {var xObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if (xObj)	result = true; xObj = null;	} catch (e)	{}');
	}
	return result;
}

function FlashWrite(url,width,height)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
	document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ');
	document.write(' width="' + width + '" height="' + height + '">');
	document.write(' <param name="movie" value="' + url + '"> <param name="quality" value="high"> <param name="bgcolor">  '); 
	document.write(' <embed src="' + url + '" quality="high"  ');
	document.write(' swliveconnect=false width="' + width + '" height="' + height + '"');
	document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash">');
	document.write(' </embed></object>');
}

function checkForm() {
	var formen = document.forms[0];
	message = '';
	if(formen.fname.value == '') {
		message += "First Name is compulsory\n";
	}
	if(formen.lname.value == '') {
		message += "Last Name is compulsory\n";
	}
	if(formen.country.value == '') {
		message += "Country is compulsory\n";
	}
	if(formen.currency.value == '') {
		message += "Currency is compulsory\n";
	}
	if(formen.occupation.value == '') {
		message += "Occupation is compulsory\n";
	}
	if(!validEmail(formen.email.value)) {
		message += "Email is not a valid address\n";
	}
	if(formen.phone.value == '') {
		message += "Phone is compulsory\n";
	}	
	if(formen.postal.value == '') {
		message += "Postal is compulsory\n";
	}	
	
	if(message == '') {
		winopen('','member',500,250);
		return true;
	} else {
		alert(message);
		return false;
	}
}

