// lazy shortcut

d=document;

// set up rollovers

sections = new Array("what","why","visit","faq","treat","insurance");
for (x=0;x<=sections.length-1;x++){
setup = sections[x]+'on = new Image();'+sections[x]+'on.src = "resources/img/nav/'+sections[x]+'_on.gif";'+sections[x]+'off = new Image();'+sections[x]+'off.src = "resources/img/nav/'+sections[x]+'_off.gif";';
eval(setup);
}

// rollover functions
function on(which) {if (d.images) {document[which].src = eval(which+"on.src");}}
function off(which) {if (d.images) {document[which].src = eval(which+"off.src");}}

// status bar set

window.status=d.title;

// window popper

function popwin(url,width,height){
window.open(url,'popup','width='+width+',height='+height+',location=0,address=0,scrollbars=0,status=0,noresize');
}

// alternate new window
function newWindow(url) {
	window.open(url,'externalsite','');
}

// show/hide

function show(object) {
	if (d.getElementById && d.getElementById(object) != null)
	node = d.getElementById(object).style.visibility='visible';
	else if (d.layers && d.layers[object] != null)
	d.layers[object].visibility = 'visible';
	else if (d.all)
	d.all[object].style.visibility = 'visible';
}

function hide(object) {
	if (d.getElementById && d.getElementById(object) != null)
	node = d.getElementById(object).style.visibility='hidden';
	else if (d.layers && d.layers[object] != null)
	d.layers[object].visibility = 'hidden';
	else if (d.all)
	d.all[object].style.visibility = 'hidden';
}

// the homepage picture and content display function

function doit(which){

	// find out which image is currently highlighted (starts with 1, of course).
	
	bigpicsrc=document.big_pic.src.split("/");
	bigpicsrc=bigpicsrc[bigpicsrc.length-1];
	
	// set the new source for the small pic, knowing we're sending the big pic there.
	new_smallpicsrc=bigpicsrc.replace("_color","_bw");
	
	// find out the source of the small pic we just clicked. we get the content and new big pic info here
	contentaddress=which.src.split("/");
	contentaddress=contentaddress[contentaddress.length-1];
	contentsrc=contentaddress.replace("_bw.jpg","")+"_content";
	new_bigpicsrc=contentaddress.replace("_bw","_color");
	
	// hide all the content
	hide('roll_1_content');
	hide('roll_2_content');
	hide('roll_3_content');
	
	// show the proper content, and change the two images
	show(contentsrc);
	which.src="resources/img/home/"+new_smallpicsrc;
	document.big_pic.src="resources/img/home/"+new_bigpicsrc;
	which.src="resources/img/home/"+new_smallpicsrc;
	document.big_pic.src="resources/img/home/"+new_bigpicsrc;

}