// $Archive: /www/en/includes/js/common/main.js $
// $Author: Kiep $ 
// $Modtime: 11/19/04 11:31a $ 
// $Revision: 13 $  




//images needed for navigation
aImg = new Array();
if (document.images) {
	aImg["btnNext"] = new Object();
	aImg["btnNext"].over = new Image();
	aImg["btnNext"].over.src = "images/navig/bottom_next_roll.gif";
	aImg["btnNext"].out = new Image();
	aImg["btnNext"].out.src = "images/navig/bottom_next.gif";
	
	aImg["btnPrev"] = new Object();
	aImg["btnPrev"].over = new Image();
	aImg["btnPrev"].over.src = "images/navig/bottom_back_roll.gif";
	aImg["btnPrev"].out = new Image();
	aImg["btnPrev"].out.src = "images/navig/bottom_back.gif";
	
	aImg["btnPrint"] = new Object();
	aImg["btnPrint"].over = new Image();
	aImg["btnPrint"].over.src = "images/navig/bottom_print_roll.gif";
	aImg["btnPrint"].out = new Image();
	aImg["btnPrint"].out.src = "images/navig/bottom_print.gif";
	
	aImg["btnLogo"] = new Object();
	aImg["btnLogo"].over = new Image();
	aImg["btnLogo"].over.src = "images/navig/logo_roll.gif";
	aImg["btnLogo"].out = new Image();
	aImg["btnLogo"].out.src = "images/navig/logo.gif";
}
//-----------------------------------------------------------------
// event handler for rollover
//-----------------------------------------------------------------
function roll(zeitem) {

	if (document.images) {
		mainFrame.document[zeitem].src = aImg[zeitem].over.src;
	}
	
	
	//only if necessary
	if ( (zeitem == "btnPrev" || zeitem == "btnNext") 
		  	&& (detect_DOM || detect_ie4up) 
		  	&& (currentPage) &&  (contentLoaded)) {
		
		//get a ref to the proper page object
		var n = (zeitem == "btnPrev")? oNav.getPageByNumber(currentPage.pageNumber-1): oNav.getPageByNumber(currentPage.pageNumber+1);
		var infotxt = "";
		
		if (typeof n != 'undefined') {
            if (n.useImage) {
                //use an image for navigation prompt at the bottom
                var imgHref = n.image;
                imgHref = imgHref.replace(".gif",oNav.imgBottomSuffix);
                
                infotxt = "<span class='navblue'><img src='" + imgHref + "' border='0'></span>";
            } else {
			    infotxt = "<span class='navblue'>" + n.description + "</span>";
            }
		} else {
			if (zeitem=="btnPrev") infotxt= "<span class='navblue'>"+hStrings.start+"</span>";
		}
		
		if (detect_ie4up) {
			mainFrame.document.all("lyrinfo").innerHTML = infotxt;
		} else {
			mainFrame.document.getElementById("lyrinfo").innerHTML = infotxt;
			
		}
	}
	
	if (zeitem == "btnPrev"  && (!currentPage) && (detect_DOM || detect_ie4up)  ) {
		var infotxt= "<span class='navblue'>"+hStrings.start+"</span>";
		if (detect_ie4up) {
			mainFrame.document.all("lyrinfo").innerHTML = infotxt;
		} else {
			mainFrame.document.getElementById("lyrinfo").innerHTML = infotxt;
			
		}
	}
	
}

function unroll(zeitem) {
	
	if (document.images) {
		mainFrame.document[zeitem].src = aImg[zeitem].out.src;
	}	
	
	//only if necessary
	if ( (zeitem == "btnPrev" || zeitem == "btnNext") 
		  	&& (detect_DOM || detect_ie4up) 
		  	&& (currentPage) &&  (contentLoaded)) {
		
		var infotxt = "";
		
		if (detect_ie4up) {
			mainFrame.document.all("lyrinfo").innerHTML = infotxt;
		} else {
			mainFrame.document.getElementById("lyrinfo").innerHTML = infotxt;
			
		}
	}
	if (zeitem == "btnPrev"  && (!currentPage) && (detect_DOM || detect_ie4up)  ) {
		var infotxt= "";
		if (detect_ie4up) {
			mainFrame.document.all("lyrinfo").innerHTML = infotxt;
		} else {
			mainFrame.document.getElementById("lyrinfo").innerHTML = infotxt;
			
		}
	}
}

//-----------------------------------------------------------------
// event handler for content load
//-----------------------------------------------------------------
function pageLoaded() {
	//main = top.mainFrame;
	//lang = getLang(main.location.href);
	
	currentPage = oNav.getCurrentPage(mainFrame.location.href);	
	contentLoaded = true;
}
//-----------------------------------------------------------------



//-----------------------------------------------------------------
// event handler for content click next
//-----------------------------------------------------------------
function goNext() {
	if ( (!currentPage) || (!contentLoaded) ) return false;
	
	var n = currentPage.next();
	
	if (n != "" ) mainFrame.location = n;
	
}
//-----------------------------------------------------------------



//-----------------------------------------------------------------
// event handler for content click prev
//-----------------------------------------------------------------
function goPrev() {
	if (  (!contentLoaded) ) return;
	
	
	if ( !currentPage ) {
		mainFrame.location = "start.html";
		return;
	}
	

	
	var n = currentPage.prev();
	
	if (n != "" ) {	
		mainFrame.location = n;
	} else {
		mainFrame.location = "start.html";
	}
	
}
//-----------------------------------------------------------------




//-----------------------------------------------------------------
// event handler to navigate to a numbered page
//-----------------------------------------------------------------
function goPageNo(x) {
	if ( (!currentPage) || (!contentLoaded) ) return;
	
	if (oNav) {
		var targetPage;
		targetPage = oNav.getPageByNumber(x);
		if (typeof targetPage != 'undefined' && targetPage.href != "" ) {
			mainFrame.location = targetPage.href;
		}
	}
	
}
//-----------------------------------------------------------------


//-----------------------------------------------------------------
// event handler for printing
//-----------------------------------------------------------------
function popPrint(colorMode) {
	//get the last part of the href
	var href = oNav.getHrefFromLocation(mainFrame.location.href);
	href = "print/"+colorMode+"/"+href;
	
	var zz = window.open(href,'Hemophilia','width=628,height=440,scrollbars=no,resizable=yes');
	zz.focus();
}


//-----------------------------------------------------------------
// event handler for click on popup link
//-----------------------------------------------------------------
function popPage(href) {
	var zz = window.open(href,'Hemophilia','width=628,height=400,scrollbars=yes,resizable=yes');
	zz.focus();
}
//-----------------------------------------------------------------




//-----------------------------------------------------------------
// called during content loading to document.write the page number
//-----------------------------------------------------------------
function pageNumber(href) {
	var zePage = oNav.getCurrentPage(mainFrame.location.href);	
	
	if (typeof zePage != 'undefined' && typeof zePage.pageNumber != 'undefined') {
			return zePage.pageNumber+1;
	} else {
			return "0";
	}
	
}
//-----------------------------------------------------------------


//-----------------------------------------------------------------
// called during content loading to document.write the left nav
//-----------------------------------------------------------------
function getNavigation(href) {
	var a = "";
	
	
	a += '<table width="145" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="2">';
	
	a += '<a href="index.html" target="_top" onMouseOver="if(top.roll) top.roll(\'btnLogo\');window.status=\'Home\';return true" ';
	a += 'onMouseOut="if(top.unroll) top.unroll(\'btnLogo\');window.status=\'\';return true">';
	a += '<img src="images/navig/logo.gif" width="145" height="41" name=btnLogo id=btnLogo border="0"></a></td></tr>';
	
	//init navigation presentation
	a += '<tr bgcolor="#1E61A9">';
	a += '<td><img src="images/pix1.gif" width="6" height="1"></td>';
	a += '<td><img src="images/pix1.gif" width="139" height="1"></td>';
	a += '</tr>';
	
		
	//fetch content from menu coll
	if (oNav) a += oNav.getHtml( href );
	
	//end nav presentation
	a += '</table>';	
   
	return a;
}
//-----------------------------------------------------------------



