<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function submitForm(cheform){
	document.forms[cheform].submit();
}


function FB_trim(chestring){
	var chestring = chestring.split(" ");
	chestring = chestring.join();
	return chestring;
}

function FB_isnumeric(chestring){
	if(FB_trim(chestring) == ""){
		return true;
	}
	return (chestring.match(/\d+/g));
}

function isInteger(s){
	var i;
	for (i = 0; i < s.length; i++){   
		// Check that current character is number.
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
	// All characters are numbers.
	return true;
}

function stripCharsInBag(s, bag){
	var i;
	var returnString = "";
	// Search through string's characters one by one.
	// If character is not in bag, append to returnString.
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}
	return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
	// EXCEPT for centurial years which are not also divisible by 400.
	return (((year % 4 == 0) && (((!(year % 100 == 0)) || (year % 400 == 0))))?29:28);
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++){
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11){
			this[i] = 30;
		}
		if (i==2){
			this[i] = 29;
		}
   } 
   return this;
}

function FB_isdata(chestring){

	if(FB_trim(chestring) == ""){
		return true;
	}
	if(chestring.length != 10){
		return false;
	}

	var dtCh= "/";
	var daysInMonth = DaysArray(12);
	var pos1=chestring.indexOf(dtCh);
	var pos2=chestring.indexOf(dtCh,pos1+1);
	var strDay=chestring.substring(0,pos1);
	var strMonth=chestring.substring(pos1+1,pos2);
	var strYear=chestring.substring(pos2+1);
	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1){
		strDay=strDay.substring(1);
	}
	if (strMonth.charAt(0)=="0" && strMonth.length>1){
		strMonth=strMonth.substring(1);
	}
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1){
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false;
	}
	if (strYear.length != 4 || year==0){
		return false;
	}
	if (chestring.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(chestring, dtCh))==false){
		return false;
	}

	return true;
}

function emailCheck (emailStr) {
	if(FB_trim(emailStr) == ""){
		return true;
	}
	var checkTLD=0;
	var knownDomsPat=/ ^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|it|fr|co.uk|de)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			return false;
		}
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			return false;
		}
	}
	if (user.match(userPat)==null) {
		return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray>255) {
				return false;
			}
		}
		return true;
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			return false;
		}
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 &&
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		return false;
	}
	if (len<2) {
		return false;
	}
	return true;
}

//-->
