sfHover = function() {
//	var sfEls = document.getElementById("country_list").getElementsByTagName("LI");
//	for (var i=0; i<sfEls.length; i++) {
//		sfEls[i].onmouseover=function() {
//			this.className+=" sfhover";
//		}
//		sfEls[i].onmouseout=function() {
//			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
//		}
//	}
}

if (window.attachEvent) window.attachEvent("onload", sfHover);

function goToPage(page) {
	document.location.href = page;
}


function ddHighLight(objReference, blOn) {

	var elem = document.getElementById(objReference);
	
	if (blOn) {
		elem.className = "ddCountryOn";
	} else {
		elem.className = "";
	}
	
}

function resetForm() {
	
	document.forms[0].reset();
	
	for (var i=0; i < document.forms[0].elements.length; i++) {
					
		if(document.forms[0].elements[i].type == "select-one") {
			document.forms[0].elements[i].selectedIndex = 0;
		}
		if(document.forms[0].elements[i].type == "text") { 
			document.forms[0].elements[i].value = "";
		}
		if(document.forms[0].elements[i].type == "checkbox") { 
			document.forms[0].elements[i].checked = false;
		}
		if(document.forms[0].elements[i].type == "radio") { 
			document.forms[0].elements[i].checked = false;
		}
		
	}
	
}

function popUpWindow(strURL, intWidth, intHeight) {
	window.open( strURL, "_blank", "status=1, height=" + intHeight + ", width=" + intWidth + ", resizable=1, scrollbars=1, toolbar=1, location=1" )
}
function popUpWindowNoScroll(strURL, intWidth, intHeight) {
	window.open( strURL, "_blank", "status=1, height=" + intHeight + ", width=" + intWidth + ", resizable=0, scrollbars=0, toolbar=0, location=0" )
}

// clickButton() function
// This function is used to make sure the "Enter" key submits the correct form button
// based on which form the focus is on

function clickButton(e, buttonid)
{
    var bt = document.getElementById(buttonid);	
    
    if (typeof bt == 'object')
    {
        if(navigator.appName.indexOf("Netscape")>(-1))
        {
            if (e.keyCode == 13)
            {
                bt.click();
                return false;
            }
        }
        if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        {
            if (event.keyCode == 13)
            {
				//bt.focus();
                bt.click();
                return false;
            }
        }
    } 
} 

if (document.images) {

	home1on = new Image();
	home1on.src = "/c/images/nav/n_home_2.gif";
	home1off = new Image();
	home1off.src = "/c/images/nav/n_home_1.gif";

	explore1on = new Image();
	explore1on.src = "/c/images/nav/n_explore_2.gif";
	explore1off = new Image();
	explore1off.src = "/c/images/nav/n_explore_1.gif";
	
	patient1on = new Image();
	patient1on.src = "/c/images/nav/n_patients_2.gif";
	patient1off = new Image();
	patient1off.src = "/c/images/nav/n_patients_1.gif";
	
	diet1on = new Image();
	diet1on.src = "/c/images/nav/n_diet_2.gif";
	diet1off = new Image();
	diet1off.src = "/c/images/nav/n_diet_1.gif";
	
	understanding1on = new Image();
	understanding1on.src = "/c/images/nav/n_understanding_2.gif";
	understanding1off = new Image();
	understanding1off.src = "/c/images/nav/n_understanding_1.gif";
	
	working1on = new Image();
	working1on.src = "/c/images/nav/n_working_2.gif";
	working1off = new Image();
	working1off.src = "/c/images/nav/n_working_1.gif";
	
	studies1on = new Image();
	studies1on.src = "/c/images/nav/n_studies_2.gif";
	studies1off = new Image();
	studies1off.src = "/c/images/nav/n_studies_1.gif";
	
	tools1on = new Image();
	tools1on.src = "/c/images/nav/n_tools_2.gif";
	tools1off = new Image();
	tools1off.src = "/c/images/nav/n_tools_1.gif";
		
}

function changeImages(strImageID, strType) {
      if ((document.images) && (changeImages.arguments[0] != '')) {
            for (var i=0; i<2; i+=2) {          
                  strNewImagePath = eval(changeImages.arguments[i+1] + ".src").toString();                      
                  document[changeImages.arguments[i]].src = strNewImagePath;  
            }
      }
}

function readCookie(name)
{
	var cookieValue = "";
	var search = name + "=";
	if(document.cookie.length > 0)
	{ 
		offset = document.cookie.indexOf(search);
		if (offset != -1)
		{ 
		offset += search.length;
		end = document.cookie.indexOf(";", offset);
		if (end == -1) end = document.cookie.length;
		cookieValue = unescape(document.cookie.substring(offset, end))
		}
	}
	return cookieValue;
}

function changeClass(object, style){
    object.setAttribute("class", style);
    object.setAttribute("className", style);
}
function changeSubListClass(id, style,subpage, page,  state){
    document.getElementById(id).className = style;
    document.getElementById('subnavimage'+subpage).src = '/esp/images/esp/nav/subpage_'+page+'_'+subpage+ state +'.gif'
}
function changeListClass(id, style, page, state){
    document.getElementById(id).className = style;
    document.getElementById('navimage'+page).src = '/esp/images/esp/nav/page_'+page+ state +'.gif'
}
function goToPage(url){
	window.location=url;
}

function changeTab(show, hide1 , hide2){
	document.getElementById(show+'cnt').style.display = "inline"
	document.getElementById(hide1+'cnt').style.display = "none"
	document.getElementById(hide2+'cnt').style.display = "none"
	document.getElementById(show).className="tab_on"
	document.getElementById(hide1).className="tab_off"
	document.getElementById(hide2).className="tab_off"							
}

function tabHover(id, hover){
	var currentClassName = ""
	currentClassName = id.className
	if(!(currentClassName == "tab_on")){
		if(hover){
			id.className = "tab_off_over"
		}else {		
				id.className =	"tab_off"				
		}
	}			
}

function menuonstate()
{
	
	var nav5 = document.getElementById('list5');
	var img5 = document.getElementById('navimage5');
	
	nav5.setAttribute("class", "menuListItemIsActive");
	nav5.setAttribute("className", "menuListItemIsActive");
	nav5.setAttribute("onmouseout", "newMouseOutState()");
	img5.setAttribute("src", "/images/nav/eng_page5_on.gif");
				
	return;
}
function newMouseOutState()
{
	img5.setAttribute("src", "/images/nav/eng_page5_on.gif");
		
	return;
}