//---------------- MISC

dt.flyouts();

function global() {
}

function getVenue(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

//---------------- //

function myvalidate(f,vAr) {
	var errorColor = "#FF9900";
	var error='';
	for (i=0;(obj=vAr[i]);i++) {
		con='';arg='';objAr='';objAr=obj.split(",");
		if(objAr[0])obj=eval('document.'+f.name+'.'+objAr[0]);
		arg=objAr[1];alt=objAr[2];
		if(obj.style&&!obj.n) {
			objbc = obj.style.backgroundColor;
			if (objbc) obj.n=objbc;
			else obj.n="#FFFFFF";
			obj.e=errorColor; }else if(obj.style&&obj.n) obj.style.backgroundColor=obj.n;
		myerror=function(){error+='- '+alt+'\n';if(obj.style)obj.style.backgroundColor=obj.e;}
		if(arg.length>3) con=eval(objAr[1]);
		if(con) myerror();
		if(arg=='req') if(!obj.value) myerror();
		if(arg=='eml') if(!isMyEmail(obj.value)) myerror();
		if(arg=='num') if(isNaN(obj.value)||!obj.value) myerror();
	}if(error) {alert('Please correct the following fields:\n\n'+error);return false}
	else return true;
}

function isMyEmail(eml) {
	var emailPat = /^(\".*\"|[A-Za-z0-9\_][A-Za-z0-9\.\-\_]*)@(\[\d{1,3}(\.\d{1,3}){3}]|([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,4})$/;
	var matchArray = eml.match(emailPat);
	if (matchArray == null) return false;
	var IPArray = matchArray[2].match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/);
	if (IPArray != null) for(i=1;i<=4;i++) if (IPArray[i]>255) return false;
	return true;
}
