	// Check cookies and assign login tab graphic
	function loginTabCheck() {	
		// set defaults
		var ceu_user_check="false";
		var login_user_check="false";
		var all_cookies = document.cookie;
		var cookie_array = document.cookie.split(";");
		
		// evaluate cookies and if needed, change defaults. The double evaluation is because depending on where the value is in document.cookie, it may have an additional space in front of it for delimiting purposes
		for (var loop=0; loop < cookie_array.length; loop++) {
		    if ((cookie_array[loop] ==" CEUS_USER=true") || (cookie_array[loop] =="CEUS_USER=true")) {
		      ceu_user_check="true";                        
		 	}
		 	
		 	if ((cookie_array[loop] =="CEUS_LOGIN=true") || (cookie_array[loop] ==" CEUS_LOGIN=true")) {
		      login_user_check="true";                        
		 	}
		
		}
		
		//assign graphic 
		if (document.images) {
			if ((ceu_user_check =="true") && (login_user_check == "false")) {
	
	   			loginoff = new Image;
	   			loginoff.src = '../images/nav_login_flasher.gif';
	
	   			loginon = new Image;
	   			loginon.src = '../images/nav_login_f2.gif';
	   			document.login.src = '../images/nav_login_flasher.gif';
	
			} else if ((ceu_user_check =="true") && (login_user_check == "true")) {
	
			    loginoff = new Image;
			    loginoff.src = '../images/nav_logout.gif';
				document.login.src = '../images/nav_logout.gif';
	
			    loginon = new Image;
			    loginon.src = '../images/nav_logout_f2.gif';
			    document.login.src = '../images/nav_logout.gif';          
			 } else	{
			    loginoff = new Image;
			    loginoff.src = '../images/nav_login.gif';            
			    loginon = new Image;
			    loginon.src = '../images/nav_login_f2.gif';
			}
	 	}
	}

	// *********** The code below direct the user to correct page *************
	function whereToGo() {
		// set defaults
		var ceu_user_check="false";
		var login_user_check="false";
		var all_cookies = document.cookie;
		var cookie_array = document.cookie.split(";");
	
		// evaluate cookies and if needed, change defaults. The double evaluation is because depending on where the value is in document.cookie, it may have an additional space in front of it for delimiting purposes
		for (var loop=0; loop < cookie_array.length; loop++) {
	    	if ((cookie_array[loop] ==" CEUS_USER=true") || (cookie_array[loop] =="CEUS_USER=true")) {
	    	  ceu_user_check="true";                        
	 		}
	 	
	 		if ((cookie_array[loop] =="CEUS_LOGIN=true") || (cookie_array[loop] ==" CEUS_LOGIN=true")) {
	    	  login_user_check="true";                        
	 		}
		}
		
	 	if ((ceu_user_check =="true") && (login_user_check =="false")) {
			location.href="../ceus/login/index.cfm";
		} else if ((ceu_user_check =="true") && (login_user_check =="true")) {	                          
		    location.href="../ceus/security/logout.cfm";
		} else {	                          
		    location.href="../ceus/login/index.cfm";
		}
	}	
	
	// Form navigation script
	
	function drop_menu(form) {
		var myindex = form.dest.selectedIndex
		window.open(form.dest.options[myindex].value, target="_top");
	}               

	// rollover script
	
    if (document.images) {
            
	    signpostoff = new Image;
	    signpostoff.src = '../images/header_signpost.gif';         
	    signposton = new Image;
	    signposton.src = '../images/header_signpost_f2.gif';
	                        
	    homeoff = new Image;
	    homeoff.src = '../images/nav_home.gif';            
	    homeon = new Image;
	    homeon.src = '../images/nav_home_f2.gif';
	                       
	               
	    howoff = new Image;
	    howoff.src = '../images/nav_how.gif';          
	    howon = new Image;
	    howon.src = '../images/nav_how_f2.gif';
	            
	    coursesoff = new Image;
	    coursesoff.src = '../images/nav_courses_selected.gif';         
	    courseson = new Image;
	    courseson.src = '../images/nav_courses_f2.gif';
	                        
	    accountoff = new Image;
	    accountoff.src = '../images/nav_account.gif';            
	    accounton = new Image;
	    accounton.src = '../images/nav_account_f2.gif';
	            
	    contactoff = new Image;
	    contactoff.src = '../images/nav_contact.gif';          
	    contacton = new Image;
	    contacton.src = '../images/nav_contact_f2.gif';
    }
            
    function turnon(i) {
        if (document.images) {
        document[i].src = eval(i+"on.src");
        }	
	}
            
    function turnoff (i) {
        if (document.images) {
        document[i].src = eval(i+"off.src");
        }
        }       
        

	// popup Window script

	function popup(W,H,url,TB,SC,SB,MB,RS) {

		if (typeof(TB) == "undefined") { 
			var TB = 0; // set defaults for optional arguments
		} 
 
		if (typeof(SC) == "undefined") { 
			var SC = 1;
		} 
 
		if (typeof(SB) == "undefined") { 
			var SB = 0;
		} 
 
		if (typeof(MB) == "undefined") { 
			var MB = 1;
		} 
 		
		if (typeof(RS) == "undefined") { 
			var RS = 1;
		}   
 
		popwin = window.open('','help','width='+W+',height='+H+',toolbars='+TB+',scrollbars='+SC+',location=0,statusbars='+SB+',menubar='+MB+',resizable='+RS+'');
		popwin.focus();        // Put window on top.
    	popwin.location = url; // Load the URL.
	}
	
	
	// Disclaimer popUp
	function disclaimer() {
		alert("You are about to leave the SAMHSA Web site. SAMHSA provides links to other Internet sites as a service to its users. References to these links or to other nongovernmental entities, products, services or information does not constitute an endorsement or recommendation by the U.S. Department of Health and Human Services (HHS) or any of its agencies or employees. In addition, HHS does not necessarily endorse the views expressed by such Web sites, nor does it warrant the validity of any sites information or its fitness for any particular purpose.")
	}

 


