var screenx=768;
var screeny=1024;
if (window.screen){
	screenx = screen.availHeight
	screeny = screen.availWidth
	}
function getdocsize(){
//	docwidth=screeny;
//	docheight=screenx;
	var de = document.documentElement;
	var docwidth = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth || screeny;
	var docheight = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight || screenx;
//	if(document.documentElement.offsetWidth){
//		docwidth = document.documentElement.offsetWidth;
//		docheight = document.documentElement.offsetHeight;
//		}
	return [docwidth,docheight];
	}
function SmallWindow(theURL,winName,features,width,height){
	if(features==null || typeof(features)=="undefined"){
		var oWin = window.open(theURL);
		}
	else{
		var top = screenx/2-height/2
		var left = screeny/2 - width/2
		var winsize ='width='+width+',height='+height+',top='+top+',left='+left+'';
		var oWin = window.open(theURL,winName,features+','+winsize);
		}
	if (oWin==null || typeof(oWin)=="undefined") alert("This popup was blocked. Please allow popups by selecting this option from your Tools menu and/or Anti Virus software.");
	}
/* hides <select> and <applet> objects (for IE only) */
function hideElm( elmID, overDiv ){
      if(/MSIE (5|6)/.test(navigator.userAgent)){
        for( i = 0; i < document.all.tags( elmID ).length; i++ ){
          obj = document.all.tags( elmID )[i];
          if( !obj || !obj.offsetParent ){continue;}

          // Find the element's offsetTop and offsetLeft relative to the BODY tag.
          objPos    = findPos(obj);
          overDivPos = findPos(overDiv);
          if(( overDivPos[0] + overDiv.offsetWidth ) <= objPos[0] );
          else if(( overDivPos[1] + overDiv.offsetHeight ) <= objPos[1] );
          else if( overDivPos[1] >= ( objPos[1] + obj.offsetHeight ));
          else if( overDivPos[0] >= ( objPos[0] + obj.offsetWidth ));
          else{obj.style.visibility = "hidden";}
        }
      }
    }
     
/* unhides <select> and <applet> objects (for IE only)  */
function showElm( elmID ){
      if(/MSIE (5|6)/.test(navigator.userAgent)){
        for( i = 0; i < document.all.tags( elmID ).length; i++ ){
          obj = document.all.tags( elmID )[i];
          
          if( !obj || !obj.offsetParent ){continue;}
        
          obj.style.visibility = "";
        }
      }
    }
//function addOnLoad(fn){
//	var old = window.onload; 
//	window.onload = function(){ 
//		old();
//		fn(); 
//		};
//	}
function visibility(type,id){
	if (document.getElementById){
		x = document.getElementById(id);
		x.style.visibility = type;
		}
	else if (document.all){
		x = document.all[id];
		x.style.visibility = type;
		}
	}
function zIndex(index,id){
	if (document.getElementById){
		x = document.getElementById(id);
		x.style.zIndex = index;
		}
	else if (document.all){
		x = document.all[id];
		x.style.zIndex = index;
		}
	}
function writeDIV(text,id){
	if (document.getElementById){
		x = document.getElementById(id);
		x.innerHTML = text;
		}
	else if (document.all){
		x = document.all[id];
		x.innerHTML = text;
		}
	else if (document.layers){
		x = document.layers[id];
		x.document.open();
		x.document.write(text);
		x.document.close();
		}
	}
function findPos(x){
	var curleft = curtop = 0;
	if (x.offsetParent) {
		curleft = x.offsetLeft
		curtop = x.offsetTop
		while (x = x.offsetParent) {
			curleft += x.offsetLeft
			curtop += x.offsetTop
			}
		}
	return [curleft,curtop];
	}
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 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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function ChangeStyle(objName, style){
  obj = MM_findObj(objName);
  if (obj.style){
    obj.style.cssText = style;
	}
  }
function ChangeClass(objName, newclass){
  obj = MM_findObj(objName);
  if (obj.className){
    obj.className = newclass;
	}
  }
function getinnerHTML(id){	var TxT = "";	if (document.getElementById){
		x = document.getElementById(id);
		TxT = x.innerHTML;
		}
	else if (document.all){
		x = document.all[id];
		TxT = x.innerHTML;
		}
	return(TxT);	}
if (!String.prototype.lTrim){String.prototype.lTrim=function(){return this.replace(/^\s*/,'');}}
if (!String.prototype.rTrim){String.prototype.rTrim=function(){return this.replace(/\s*$/,'');}}
if (!String.prototype.Trim){String.prototype.Trim=function(){return this.lTrim().rTrim();}}
function getCookie(name){
	var index = document.cookie.indexOf(name + "=");
	if (index == -1) return null;
	index = document.cookie.indexOf("=", index) + 1; // first character
	var endstr = document.cookie.indexOf(";", index);
	if (endstr == -1) endstr = document.cookie.length; // last character
	return unescape(document.cookie.substring(index, endstr));
	}
function setCookie(name, value){
	var expires = new Date();
	expires.setTime(expires.getTime() + 3E11);   // about 10 years = "forever"
	if (name == "EMail"){
		if (VEmail(value)){
			document.cookie =  name + "=" + escape (value) + "; expires=" + expires.toGMTString() 
			}
		else{
			deleteCookie("EMail");
			}
		}
	else{
		document.cookie =  name + "=" + escape (value) + "; expires=" + expires.toGMTString() 
		}
	}
function deleteCookie(name) {
	document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT"
   }
function VEmail(add){
	if ((add.search(/[^\w@\._-]/)== -1)&&(add.length > 5)){
		var len = add.length
		var atpos = add.search(/@/)
		if (( atpos > 0)&& (atpos < len)){
			add = add.slice(atpos+1,len)
			if (add.search(/@/)!=-1){
				return false
				}
			len = add.length
			var dotpos = add.search(/\./)
			if (( dotpos > 1)&& (dotpos < len-2)){
				return true;
				}
			}
		}
	return false;
	}
function isValidDate(tdate,allowToDay){
	if(typeof(allowToDay)=="undefined"){allowToDay=false;}
	var status = true;
//	var dateobj = new Date();
	var ADate = new Array();
	ADate = tdate.split(" ");
	var	months =	new	Array("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
	var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31);
//	var now = new Date(dateobj.getDate()+" "+months[dateobj.getMonth()]+" "+dateobj.getFullYear());
//	Client PC could have incorrect date
	var m;
	if ((ADate[2] >= now.getFullYear())&&(ADate[2] < now.getFullYear()+6)){
		for (n = 0; n < months.length; n++){if(months[n] == ADate[1].toLowerCase().slice(0,3)){m = n;break;}}
		if ((m >= 0)&&(m <12)){
			var	startDate =	new	Date (ADate[2],m,1);
			var endDate;
			if (m==1){endDate = new Date (ADate[2],m+1,1);endDate = new Date (endDate - (24*60*60*1000));numDaysInMonth = endDate.getDate();}
			else{numDaysInMonth = aNumDays[m];}
			if (ADate[0]>0){
				if (ADate[0] > numDaysInMonth){
					return (false);
					}
				}
			else{return (false)}
			}
		else{return (false)}
		}
	else{return (false)}	
	if(status){
		if(allowToDay){
			if(now > new Date(tdate)){
				return (false);
				}
			}
		else{
			if(now >= new Date(tdate)){
				return (false);
				}
			}
		}
	return (true);
	}
function bookmarksite(title, url){
	if (document.all){
		window.external.AddFavorite(url, title);
		}
	else if (window.sidebar){
		window.sidebar.addPanel(title, url, "")
		}
	}
function CreateDrop(Name,Where,Style,Class,OnChange){
	if(Name!=""){
		if(Class!=""){Class=" class=\""+Class+"\""}
		if(OnChange!=""){OnChange=" onchange=\""+OnChange+"\""}
		if(Style!=""){Style=" style=\""+Style+"\""}
		var DIVTxT = "<select size=\"1\" name=\""+Name+"\" id=\""+Name+"\""+OnChange+" disabled"+Style+""+Class+">";
		DIVTxT += "<option value=0>------------------</option>";
		DIVTxT += "</select>"
		writeDIV(DIVTxT,Where);
		}
	}
function PopulateDrop(Drop,Data,Selected,All,VAll,WAll){
	Obj=new Object(eval("document.InputForm."+Drop));
	Obj.length=0;					//Clear Drop
	i=0;
	SI=0;
	if(WAll=="B"){Obj.options[i]=new Option(All,VAll);i++;}
	for ( var n = 0; n < Data.length ; n++ ){Obj.options[i]=new Option(Data[n][1],Data[n][0]);if(Data[n][0]== Selected){SI=i}i++;}
	if(WAll=="T"){Obj.options[i]=new Option(All,VAll);if(VAll == Selected){SI=i};i++;}
	Obj.selectedIndex = SI;
	}
