function driHide() {
	showhideDiv(getRefToDiv('dri'),'hidden') ;
}

function driShow() {
	showhideDiv(getRefToDiv('dri'),'visible') ;
}

function driSubmit() {
  setTimeout("driHide()",4000) ;
}

function showhideDiv(theDiv,theState) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		theDiv.style.visibility = theState; 
	} 
	else { 
		if (document.layers) { // Netscape 4 
			document.hideshow.visibility = theState; 
		} 
		else { // IE 4 
			document.all.hideshow.style.visibility = theState; 
		} 
	} 
} 


function driCheck(z) {
  var driPath1;
  
  driPath1 = document.frames['iFr'].location.pathname;
  if (driPath1 == '/include/dri/drieval.asp') {
    driShow();
  } 
}

function getRefToDiv(divID) {
    if( document.layers ) { //Netscape layers
        return document.layers[divID]; }
    if( document.getElementById ) { //DOM; IE5, NS6, Mozilla, Opera
        return document.getElementById(divID); }
    if( document.all ) { //Proprietary DOM; IE4
        return document.all[divID]; }
    if( document[divID] ) { //Netscape alternative
        return document[divID]; }
    return false;
}


//window floating..

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.dri : document.getElementById("dri");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}




function setCookie(name, value, days) {

	 var expires = new Date(); 
	 expires.setTime(expires.getTime() + days*24*60*60*1000); 
	 
	 //alert (expires.toGMTString());
	 
	document.cookie= name + "=" + value +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	";domain=michigan.org" ;

}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


function eraseCookie(name)
{
	setCookie(name,"",-1);
}



function ValidEMail(item) {
	// Validates EMail entry as
	//Not having a space, Having the @ sign, and having the dot sign
	//Greater than equal to 7 characters  X@X.XXX
	var string = item.value
	if (string.indexOf("*") != -1 || 
        string.indexOf("|") != -1 ||
		string.indexOf(",") != -1 || 
        string.indexOf('"') != -1 ||
		string.indexOf(":") != -1 || 
        string.indexOf("<") != -1 ||
		string.indexOf(">") != -1 || 
        string.indexOf("[") != -1 ||
		string.indexOf("]") != -1 || 
        string.indexOf("{") != -1 ||
		string.indexOf("}") != -1 || 
        string.indexOf("`") != -1 ||
		string.indexOf("'") != -1 || 
        string.indexOf(";") != -1 ||
		string.indexOf("(") != -1 || 
        string.indexOf(")") != -1 ||
		string.indexOf(".") == -1 ||
        string.indexOf("@") == -1 ||
		string.indexOf("$") != -1 ||
        string.indexOf("&") != -1 ||
		string.indexOf("#") != -1 ||
		string.indexOf(" ") != -1 ||
        string.indexOf("%") != -1){
		alert("I'm sorry. This email address seems wrong. Please"
   		+" check the prefix and '@' sign.");
		// item.focus();
		return false;
	}
	else
		return true;
}
 function capsLc(item){
  /* Unfortunately, some of the more esoteric parsing
     is misread by the 2.x, but is fine with the 3.x,
     so a branch is required.  The old version does not
     parse and correct conjunctions and prepositions to
     lower case at the end of a sentence or next to
     quote marks. 'Bout the only difference... */
  if (navigator.appVersion.substring(0,1)=="2"){
   navOld(item);
   }
   else navNew(item);
  }
 function navOld(item){
  txt=item.value+" ";
  txt=txt.toLowerCase();
  txtl="";
  while ((txt.length>0)&&(txt.indexOf(" ")>-1)){
   pos=txt.indexOf(" ");
   wrd=txt.substring(0,pos);
   cmp=" "+wrd+" ";
   if (tst.indexOf(cmp)<0){
    ltr=wrd.substring(0,1);
    ltr=ltr.toUpperCase();
    wrd=ltr+wrd.substring(1,wrd.length);
    }
   txtl+=wrd+" "; 
   txt=txt.substring((pos+1),txt.length);
   }
  ltr=txtl.substring(0,1);
  ltr=ltr.toUpperCase();
  txtl=ltr+txtl.substring(1,txtl.length-1);
  item.value=txtl;
 }
 function navNew(item){
  txt=item.value+" ";
  txt=txt.toLowerCase();
  txtl="";
  tst=" in into of on onto with within by to for the "
  +"at upon over under and or a ";
  punc=",.?!:;)'";
  punc+='"';
  while ((txt.length>0)&&(txt.indexOf(" ")>-1)){
   pos=txt.indexOf(" ");
   wrd=txt.substring(0,pos);
   wrdpre="";
   if (punc.indexOf(wrd.substring(0,1))>-1){
    wrdpre=wrd.substring(0,1);
    wrd=wrd.substring(1,wrd.length);
    }
   cmp=" "+wrd+" ";
   for (var i=0;i<9;i++){
    p=wrd.indexOf(punc.substring(i,i+1));
    if (p==wrd.length-1){
     cmp=" "+wrd.substring(0,wrd.length-1)+" ";
     i=9;
     }
    }
   if (tst.indexOf(cmp)<0){
    ltr=wrd.substring(0,1);
    ltr=ltr.toUpperCase();
    wrd=ltr+wrd.substring(1,wrd.length);
    }
   txtl+=wrdpre+wrd+" "; 
   txt=txt.substring((pos+1),txt.length);
   }
  ltr=txtl.substring(0,1);
  ltr=ltr.toUpperCase();
  txtl=ltr+txtl.substring(1,txtl.length-1);
  item.value=txtl;
 }
 
 
 function numericCheck(item){
  nr1=item.value;
  flg=0;
  str="";
  spc=""
  arw="";
  for (var i=0;i<nr1.length;i++){
   cmp="0123456789"
   tst=nr1.substring(i,i+1)
   if (cmp.indexOf(tst)<0){
    flg++;
    str+=" "+tst;
    spc+=tst;
    arw+="^";
   }
   else{arw+="_";}
  }
  if (flg!=0){
   if (spc.indexOf(" ")>-1) {
    str+=" and a space";
    }
   alert("I'm sorry. This entry must be a number.");
// item.focus();
   return false;
  }
  return true;
 }