<!--
// JavaScript Document

function errorMessage(elem,message){
	alert(message);
	elem.focus();
	elem.select();
}
function showDisplay(theDisplay){
//thedisplay='<span class="main"><font color="#000000">'+theDisplay+'</font></span>'
thedisplay = theDisplay;
document.displaytext.innerHTML = thedisplay;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function restrictLength(pElem,pInt){
if(pElem.value.length > pInt){
 // alert("Sorry, you've reached the maximum number of characters allowed for this text box.");
 pElem.value = pElem.value.substring(0,pInt);}
}

function calcCharLeft(target) {
    var maxLength = 255;
    if (target.value.length > maxLength) {
      target.value = target.value.substring(0,maxLength);
      charleft = 0;
    }
    else {
      charleft = maxLength - target.value.length;
    } document.form1.charCount.value = charleft;
}

function restictLengthWithDisplay(pElem,pLength,pDisplayElem)
{
    if (pElem.value.length > pLength) {
      pElem.value = pElem.value.substring(0,pLength);
      charleft = 0;
    }
    else {
      charleft = pLength - pElem.value.length;
    } pDisplayElem.value = charleft;
}

function moveSelectedOptions(from,to) {
 for (var i=(from.options.length-1); i>=0; i--) {
  var o = from.options[i];
  if (o.selected) {
   to.options[to.options.length] = new Option( o.text, o.value, false, false);
   from.options[i] = null;
   }
  }
 from.selectedIndex = -1;
 to.selectedIndex = -1;
 sortSelect(from);
 sortSelect(to);
 }
 
 function sortSelect(obj) {
	var o = new Array();
	if (obj.options==null) { return; }
	for (var i=0; i<obj.options.length; i++) {
		o[o.length] = new Option( obj.options[i].text, obj.options[i].value, obj.options[i].defaultSelected, obj.options[i].selected) ;
		}
	if (o.length==0) { return; }
	o = o.sort( 
		function(a,b) { 
			if ((a.text+"") < (b.text+"")) { return -1; }
			if ((a.text+"") > (b.text+"")) { return 1; }
			return 0;
			} 
		);

	for (var i=0; i<o.length; i++) {
		obj.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
		}
	}
	
	function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
}

function notValidEmail(pString){
var dotpos=pString.indexOf('.');
var atpos=pString.indexOf('@');
	if(atpos == -1 || (pString=="") || (pString==" ") || (pString.length < 6)){
		return true;
	}
	else if(dotpos + 1 == atpos){
		return true;
	}
	else{
		var emailterm=pString.substring(atpos, (pString.length));
		if(emailterm.indexOf('.')==-1 || emailterm.length < 2){
			return true;}
		else return false;
	}

}

function addFavorite(pUrl, pDesc)
{
	window.external.AddFavorite(pUrl,pDesc)
}


function openWindow(winURL)
{
	var midScreenWidth = (screen.availWidth)/2; // find the mid width
	var midScreenHeight = (screen.availHeight)/2; // find the mid height
	var l = midScreenWidth - 200; // position left
	var t = midScreenHeight - 225; // position top
	var winFeatures = ("width=400,height=450,left="+l+",top="+t+",scrollbars=1,resizable=1");
	popWin = window.open(winURL, 'popWin', winFeatures);
	popWin.focus();
}

function changeDD(theArrayName, theForm, theOtherDD, theJscriptArray) 
{ 
	theJscriptArray = eval(theJscriptArray)
	if (theJscriptArray[theArrayName])
	{
		theForm.elements[theOtherDD].options.length = theJscriptArray[theArrayName].length;
		for (i=0; i < theJscriptArray[theArrayName].length; i++)
		{
			theForm.elements[theOtherDD].options[i].value = theJscriptArray[theArrayName][i][0];
			theForm.elements[theOtherDD].options[i].text = theJscriptArray[theArrayName][i][1];
		}
	} 
}

function addDDOptionOther(pDD)
{
	var ddLen = pDD.options.length
	pDD.options.length =  ddLen + 1;
	pDD.options[ddLen].value='other';
	pDD.options[ddLen].text='Other - please specify';
}

function changeLimitedDD(theArrayName, theForm, theOtherDD, theJscriptArray) 
{ 
	
	var liveDisc = 0
	var theJscriptArray = eval(theJscriptArray)
	
	if (theJscriptArray[theArrayName])
	{
		theForm.elements[theOtherDD].options.length = theJscriptArray[theArrayName].length;
		for (var i=0; i < theJscriptArray[theArrayName].length; i++)
		{
			if(theJscriptArray[theArrayName][i][2])
			{
				theForm.elements[theOtherDD].options[liveDisc].value = theJscriptArray[theArrayName][i][0];
				theForm.elements[theOtherDD].options[liveDisc].text = theJscriptArray[theArrayName][i][1];
				liveDisc ++
			}
		}
		theForm.elements[theOtherDD].options.length = liveDisc;
		theForm.elements[theOtherDD].selectedIndex = theForm.elements[theOtherDD].options[0];
		
	} 
	
}

function openWindowWithDimensions(winURL,w,h)
{
	var midScreenWidth = (screen.availWidth)/2; // find the mid width
	var midScreenHeight = (screen.availHeight)/2; // find the mid height
	var l = midScreenWidth - (w / 2); // position left
	var t = midScreenHeight - (h / 2); // position top
	var winFeatures = ("width="+w+",height="+h+",left="+l+",top="+t+",scrollbars=1,resizable=1");
	var cvWin = window.open(winURL, 'cvWin', winFeatures);
}

function cvUpload(pFrm)
{
	if(pFrm.myCV.value=="")
	{
		alert("Please Browse and select a file");
		return false;
	}
	else
	{
		pFrm.btnCVUp.value="Please be patient...";
		pFrm.btnCVUp.disabled=true;
		return true;
	}
}

<!--
/*
Source - http://www.crockford.com/javascript/remedial.html
*/
function isAlien(a) {
   return isObject(a) && typeof a.constructor != 'function';
}
function isArray(a) {
    return isObject(a) && a.constructor == Array;
}
function isBoolean(a) {
    return typeof a == 'boolean';
}
function isEmpty(o) {
    var i, v;
    if (isObject(o)) {
        for (i in o) {
            v = o[i];
            if (isUndefined(v) && isFunction(v)) {
                return false;
            }
        }
    }
    return true;
}
function isFunction(a) {
    return typeof a == 'function';
}
function isNull(a) {
    return typeof a == 'object' && !a;
}
function isNumber(a) {
    return typeof a == 'number' && isFinite(a);
}
function isObject(a) {
    return (a && typeof a == 'object') || isFunction(a);
}
function isString(a) {
    return typeof a == 'string';
}
function isUndefined(a) {
    return typeof a == 'undefined';
} 

// Write e-mail address dynamically to avoid spambots
function email(name, domain, suffix, text){
   var address = name + "\u0040" + domain + "." + suffix;
   var url = "mailto:" + address;
 
   if( ! text ) {
      text = address;
   }
   document.write("<a href=\"" + url + "\">" + text + "</a>");
}

//-->