var screenx=600;
var screeny=800;
if (window.screen){
	screenx = screen.availHeight
	screeny = screen.availWidth
	}
//setCookie("ScreenWidth",window.screen.width);
//setCookie("ScreenWidth",screeny);
function SmallWindow(theURL,winName,features,width,height){
	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.");
	}
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 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 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);	}
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){
	var status = false;
//	if (add.search(/[><\[\]\"\'\?\:,;]/)== -1){
	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)
			len = add.length
			var dotpos = add.search(/\./)
			if (( dotpos > 1)&& (dotpos < len-2)){
				var status = true;
				}
			}
		}
	return status;	
	}
function isValidDate(tdate){
	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());
	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(now > new Date(tdate)){
			return (false);
			}
		}
	return (true);
	}

