/* All scripts on this page Copyright 1998-2007 Brent Scott - ScottMedia. Please contact info@scott-media.com to use scripts. */
var dhtml = true;
var page_loaded = false;
var new_win;
// Check for Netscape 4 or lower, and kindly inform the user that they are living in the dark ages.
	if(document.layers){
	  alert('You are using Netscape version 4. This Web site is not compatible with that browser. \n Please use a newer browser.');
		dhtml = false;
    }
	else if((!document.layers)&&(!document.all)&&(!document.getElementById)){
		alert('You are using a very old, non-compatible browser, such as Netscape 3. This Web site will not appear or function as intended');
		dhtml = false;
	}
	
function openQTwin(page){
	new_win = window.open(page,'qt_win','width=415,height=400,top=50,left=50,resizable=yes');
	new_win.focus();
}
function openQTwin2(page){
	new_win = window.open(page,'qt_win','width=320,height=460,top=50,left=50,resizable=yes');
	new_win.focus();
}
	
function init(){
	page_loaded = true;
}

// load these before the page loads:
	image13 = new Image;
	image13.src = "images/button_bg.jpg";
	image14 = new Image;
	image14.src = "images/button_ov.jpg";		
	image15 = new Image;
	image15.src = "images/menu1_bg.png";
	image16 = new Image;
	image16.src = "images/menu2_bg.png";
	image17 = new Image;
	image17.src = "images/menu3_bg.png";
	image18 = new Image;
	image18.src = "images/menu4_bg.png";
	image19 = new Image;
	image19.src = "images/menu5_bg.png";		
	
function loadImages() {
  if(document.images){
		
	//miscellaneous images
	

		
    // over states
	image1 = new Image;
	image1.src = "images/nav_staff_ov.jpg";
	image2 = new Image;
	image2.src = "images/nav_what_ov.jpg";
	image3 = new Image;
	image3.src = "images/nav_fun_ov.jpg";
	image4 = new Image;
	image4.src = "images/nav_office_ov.jpg";
	image5 = new Image;
	image5.src = "images/nav_patient_ov.jpg";
	image6 = new Image;
	image6.src = "images/nav_how_ov.jpg";	

	// active states
	image7 = new Image;
	image7.src = "images/nav_staff_a.jpg";
	image8 = new Image;
	image8.src = "images/nav_what_a.jpg";
	image9 = new Image;
	image9.src = "images/nav_fun_a.jpg";
	image10 = new Image;
	image10.src = "images/nav_office_a.jpg";
	image11 = new Image;
	image11.src = "images/nav_patient_a.jpg";
	image12 = new Image;
	image12.src = "images/nav_how_a.jpg";	
	

	
 // check for current page, and set active link.	
 where = document.location;
 temp = new String(where);
 if (temp.indexOf("staff")!= -1){
  imageSwap('nav_staff',2)
  }
 if (temp.indexOf("whats_new")!= -1){
  imageSwap('nav_what',2)
  } 	
 if (temp.indexOf("fun_stuff")!= -1){
  imageSwap('nav_fun',2)
  }
 if ((temp.indexOf("office")!= -1)||(temp.indexOf("fees")!= -1)||(temp.indexOf("how_can")!= -1)||(temp.indexOf("types")!= -1)){
  imageSwap('nav_office',2)
  }
 if (temp.indexOf("resources")!= -1){
  imageSwap('nav_patient',2)
  } 
 if (temp.indexOf("how_to")!= -1){
  imageSwap('nav_how',2)
  } 
	

}
}	

function imageSwap(pic,inout) {
  if (document.images) {

		currentImage = document.images[pic].src;
        imgtemp = new String(currentImage); 
		 				       //  alert(imgtemp);
         if (imgtemp.indexOf("_a") == -1) {
	  		if (inout == 1) {
	    		document.images[pic].src = 'images/'+pic+'_ov.jpg';
	  		}
	  		else if (inout == 0) {
	    		document.images[pic].src = 'images/'+pic+'.jpg';
	 		}
	  		else if (inout == 2) {
	   			document.images[pic].src = 'images/'+pic+'_a.jpg';
	  		}
  	}
  }
}

var sidebarsub1open = false;
var sidebarsub2open = false;

function showHideMenu(menu,image){
	//alert(document.getElementById('sidebarsub1').style.visibility);
	//menutemp = 'none'
	if(document.getElementById(menu).style.display == 'none'){
	  document.getElementById(menu).style.display = 'block';
	  document.images[image].src = 'images/arrow_down.gif';
	}

	else {
	  document.getElementById(menu).style.display = 'none';
	  document.images[image].src = 'images/arrow_right.gif';		
	}
}


menu_array = new Array();
menu_array[0] = "menu1";
menu_array[1] = "menu2";
menu_array[2] = "menu3";

sub_menu_array = new Array();
sub_menu_array[0] = "menu4";
sub_menu_array[1] = "menu5";


var isactive = false;
var glo_obj = "";	
var glo_obj2 = "";
var htimer;
var submenu_flag = false;

function showHide(obj,onlink,submenu) {
 if((dhtml)&&(page_loaded)){
	 document.images['menu4_arrow'].src = 'images/arrow_down.gif';
	 document.images['menu5_arrow'].src = 'images/arrow_down.gif';		 	 
	 if(submenu == true){
		 submenu_flag = true;
		 current_array = sub_menu_array;
		 glo_obj2 = obj;
		 document.images[obj + '_arrow'].src = 'images/arrow_right.gif';
	 }
	 else{
		 current_array = menu_array; 
     glo_obj = obj;		 
	 }
	current_obj = document.getElementById(obj);
	
	if (onlink) {

		clearTimeout(htimer);		
		for (i=0; i < current_array.length; i++) {
			temp_obj = document.getElementById(current_array[i]);
			temp_obj2 = document.getElementById(sub_menu_array[i]);
			if (temp_obj != null) {
				temp_obj.style.visibility = "hidden";
			}
			if (temp_obj2 != null) {
				temp_obj2.style.visibility = "hidden";
			}
		}

		if (current_obj != null) {
	
			//tempfixed = String(fixed_obj);
			//alert(tempfixed);
			current_obj.style.visibility = "visible";

		}
		isactive = true

	}

		if (!onlink) {
			isactive=false;
			layerTimer()
		}
    }
}
function layerCheck(flag) {
	if((dhtml)&&(page_loaded)){
		if (flag) {
			//alert('checking layer');
		    isactive = true;
			clearTimeout(htimer);
		}
		else {
			isactive = false;
    		layerTimer();
		}
	}
}
function layerTimer() {
	htimer = setTimeout("hideMenu()",1000);
}

function hideMenu() {
	if (!isactive) {

 		 document.images['menu4_arrow'].src = 'images/arrow_down.gif';
		 document.images['menu5_arrow'].src = 'images/arrow_down.gif';	
		if(submenu_flag){
			fixed_obj2 = document.getElementById(glo_obj2);
			if(fixed_obj2 != null){
				fixed_obj2.style.visibility = "hidden";
				submenu_flag = false;
			}
		}
		fixed_obj = document.getElementById(glo_obj);
		if (fixed_obj != null) {
			fixed_obj.style.visibility = "hidden";
		}
	}
}

function changeClass(obj,classn){
	if(page_loaded){
 		obj.className = classn;
	}
} 