function isValidURL(url) {
	var v   = new RegExp();
	v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
	if(!v.test(url)) { return false; }
	else { return true; }
}

function JumpURL(selection) {
	var tempIndex, selectedURL;
	tempIndex = selection.selectedIndex;
	selectedURL = selection.options[tempIndex].value;
	location.href = selectedURL;
}

function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 

function isNumber(InString){
        if(InString.length==0)
                return (false);
        RefString="1234567890";
        for (Count=0; Count < InString.length; Count++)  {
                TempChar= InString.substring (Count, Count+1);
                if (RefString.indexOf (TempChar, 0)==-1)
                        return (false);
        }
        return (true);
}

function isEmail (emailStr) {	// updated 4/22/2008
	var checkTLD=1;	// 1 to check for two-letter country or well-known TLD - 0 to ignore
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	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; }	// Email address seems incorrect (check @ and .'s)
	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) { return false; }	// The username contains invalid characters
	}
	for (i=0; i<domain.length; i++) { 
		if (domain.charCodeAt(i)>127) { return false; }	// The domain name contains invalid characters
	}

	if (user.match(userPat)==null) { return false; }	// The username is invalid

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {	// this is an IP address
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) { return false; }	// Destination IP address is invalid
		}
		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; }	// The domain name is invalid
	}

	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
		return false;	// The address must end in a well-known domain or two letter country code
	}

	if (len<2) { return false; }	// This address is missing a hostname
	return true;
}


function OLDisEmail(str) {
        var supported = 0;
        if (window.RegExp) {
                var tempStr = "a";
                var tempReg = new RegExp(tempStr);
                if (tempReg.test(tempStr)) supported = 1;
        }
        if (!supported) 
                return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
        var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
        var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
        return (!r1.test(str) && r2.test(str));
}

function isNumberString (InString)  {
	if(InString.length==0) 
		return (false);
	RefString="1234567890";
	for (Count=0; Count < InString.length; Count++)  {
		TempChar= InString.substring (Count, Count+1);
		if (RefString.indexOf (TempChar, 0)==-1)  
			return (false);
	}
	return (true);
}

function viewSlideShow(id,pg) {
	win = window.open ("/viewslides.html?id="+id+"&pg="+pg, "images", "height=550,width=700,RESIZABLE=1,TOOLBAR=0,MENUBAR=0,LOCATION=0,STATUS=0,DIRECTORIES=0,SCROLLBARS=1");
}
