<!-- // standard javascript library

function checkAlphNum(name) {
        // check the valid alphanumeric field
        var check_element = String(name);
        var cmp;
        var tst;
        var flg=0;
        var dot=0;
        for (var j = 0; j < check_element.length; j++) {
                var cmp= new String;
                cmp = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
                tst = check_element.substring(j, j+1);
                if (cmp.indexOf(tst) >= 0) {
                        flg++;
                }
        }
        if (flg == check_element.length){
                return false;
        }
        return true;
}

function checkLowerCase(name) {
    var check_element = String(name);
    var cmp;
    var tst;
    var flg=0;
    var dot=0;
    for (var j = 0; j < check_element.length; j++) {
        var cmp= new String;
        cmp = "abcdefghijklmnopqrstuvwxyz0123456789-_";
        tst = check_element.substring(j, j+1);
        if (cmp.indexOf(tst) >= 0) {
            flg++;
        }
    }
    if (flg == check_element.length){
        return false;
    }
    return true;
}

function isNumberString(InString)  {
        var TempChar;
        var 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 genpasswd8(form)

{
        var iNum0,iNum1,iNum2,iNum3,iNum4,iNum5,iNum6,iNum7,iNum8=0;
        iNum0 = Math.round(Math.random()*100)%26+97;
        iNum0 = (iNum0==108 || iNum0==111 ? iNum0-1 : iNum0);
        iNum1 = (Math.round(Math.random()*100) > 50 ? Math.round(Math.random()*100)%26+97 :
Math.round(Math.random()*100)%8+50);
        iNum1 = (iNum1==108 || iNum1==111 ? iNum1-1 : iNum1);
        iNum2 = (Math.round(Math.random()*100) > 50 ? Math.round(Math.random()*100)%26+97 :
Math.round(Math.random()*100)%8+50);
        iNum2 = (iNum2==108 || iNum2==111 ? iNum2-1 : iNum2);
        iNum3 = (Math.round(Math.random()*100) > 50 ? Math.round(Math.random()*100)%26+97 :
Math.round(Math.random()*100)%8+50);
        iNum3 = (iNum3==108 || iNum3==111 ? iNum3-1 : iNum3);
        iNum4 = (Math.round(Math.random()*100) > 50 ? Math.round(Math.random()*100)%26+97 :
Math.round(Math.random()*100)%8+50);
        iNum4 = (iNum4==108 || iNum4==111 ? iNum4-1 : iNum4);
        iNum5 = (Math.round(Math.random()*100) > 50 ? Math.round(Math.random()*100)%26+97 :
Math.round(Math.random()*100)%8+50);
        iNum5 = (iNum5==108 || iNum5==111 ? iNum5-1 : iNum5);
        iNum6 = (Math.round(Math.random()*100) > 50 ? Math.round(Math.random()*100)%26+97 :
Math.round(Math.random()*100)%8+50);
        iNum6 = (iNum6==108 || iNum6==111 ? iNum6-1 : iNum6);
        iNum7 = (Math.round(Math.random()*100) > 50 ? Math.round(Math.random()*100)%26+97 :
Math.round(Math.random()*100)%8+50);
        iNum7 = (iNum7==108 || iNum7==111 ? iNum7-1 : iNum7);
form.value=String.fromCharCode(iNum0,iNum1,iNum2,iNum3,iNum4,iNum5,iNum6,iNum7);
}

function YorN(form) {
	input_box=confirm("Are You Sure?");
      if (input_box==false)
      { return false }
	return true
};


function emailCheck (emailStr) {

var checkTLD=1;
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 (emailStr=="") {
return true;
}

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

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

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("The username doesn't seem to be valid.");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
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) {
alert("The domain name does not seem to be valid.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

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

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("This address is missing a hostname!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
};


function changedate(m,d,y) {  
	mydate=new Date(parseInt(y.options[y.selectedIndex].text),parseInt(m.options[m.selectedIndex].text) - 1,1);
	day=d.selectedIndex;
	for (i=0;i<parseInt(d.options.length);i++) {    
		d.options[0]=null;  
	}  
	for (i=1;i<=31;i++) {
		mydate.setDate(i);
		if (mydate.getMonth()!=parseInt(m.options[m.selectedIndex].text)-1) {      
			break;    
		}     
		d.options[i-1]=new Option(i,i);
		if (day+1==i) {
			d.options[i-1].selected=true;    }
	}  
	if (day>i-2)    d.options[0].selected=true;
};
	

function openWin(theURL,winName,features) {
  window.open(theURL,winName,features);
}


// -->


