// JavaScript Document
// this file is used to draw graph top buttons and manage functionality
// is uses functions defined in graphs/chageHeader-and-Image.js

//var ns4 = (document.layers)? true:false;

var ns4 = (navigator.appName == 'Netscape')? true:false;
var ie4 = (document.all)? true:false;

week_img_src 	= "top_week_f1.gif";
month_img_src 	= "top_month_f1.gif";
m4_img_src 		= "top_4m_f1.gif";
year_img_src 	= "top_year_f1.gif";

if (int==1) { // if custom interval specified, show no active tabs on top
	week_img_src = "top_week_f2.gif";
} if (int==2) { // if custom interval specified, show no active tabs on top
	month_img_src = "top_month_f2.gif";
} if (int==3) { // if custom interval specified, show no active tabs on top
	m4_img_src = "top_4m_f2.gif";
} if (int==4) { // if custom interval specified, show no active tabs on top
	year_img_src = "top_year_f2.gif";
} else {
	year_img_src = "top_year_f1.gif";
}

if (graph_mode==1) {
	document.write('<img src="graphs/images/graph_large_background_top_line.gif" width=331 height=12 border=0>');
} else {
	document.write('<img src="graphs/images/spacer.gif" width=33 height=12 border=0>');
}

parameter_tail = '&f=' + fund_number + '&graph_mode=' + graph_mode;
if ( cat_id > 0 ) {
	parameter_tail = parameter_tail + '&cat=' + cat_id	
}

if (graph_mode==1) {
	w = 480;
	h = 139;
} else {
	w = 183;
	h = 101;
}

if (ns4) {

	document.write('<a href="index.php?int=1&'+parameter_tail+'">');
	document.write('<img src="graphs/images/'+week_img_src+'" border=0 width=36 height=12>');
	document.write('</a>');
	
	document.write('<a href="index.php?int=2&'+parameter_tail+'">');
	document.write('<img src="graphs/images/'+month_img_src+'" border=0 width=38 height=12>');
	document.write('</a>');
	
	document.write('<a href="index.php?int=3&'+parameter_tail+'">');
	document.write('<img src="graphs/images/'+m4_img_src+'" border=0 width=36 height=12>');
	document.write('</a>');
	
	document.write('<a href="index.php?int=4&'+parameter_tail+'">');
	document.write('<img src="graphs/images/'+year_img_src+'" border=0 width=39 height=12>');
	document.write('</a>');
	
} else {
	
	document.write('<a href="javascript:changeHeader(0);layerWrite(\'divId\',null,\'graphs/graph.php?int=1'+parameter_tail+'\', \''+w+'\', \''+h+'\');" onMouseOver="window.status=\'Week period\';return true" onMouseOut="window.status=\'\';return true">'); // 
	document.write('<img id=h0 name=h0 src="graphs/images/top_week_f1.gif" border=0 width=36 height=12>');
	document.write('</a>');
	
	document.write('<a href="javascript:changeHeader(1);layerWrite(\'divId\',null,\'graphs/graph.php?int=2'+parameter_tail+'\', \''+w+'\', \''+h+'\');" onMouseOver="window.status=\'Month period\';return true" onMouseOut="window.status=\'\';return true">');
	document.write('<img id=h1 name=h1 src="graphs/images/top_month_f1.gif" border=0 width=38 height=12>');
	document.write("</a>");
	
	//onmousemove="window.status=\' \'" onmouseout="window.status=\'Done\'" 
	document.write('<a href="javascript:changeHeader(2);layerWrite(\'divId\',null,\'graphs/graph.php?int=3'+parameter_tail+'\', \''+w+'\', \''+h+'\');" onMouseOver="window.status=\'4 months period\';return true" onMouseOut="window.status=\'\';return true">');
	document.write('<img id=h2 name=h2 src="graphs/images/top_4m_f1.gif" border=0 width=36 height=12>');
	document.write('</a>');
	
	document.write('<a href="javascript:changeHeader(3);layerWrite(\'divId\',null,\'graphs/graph.php?int=4'+parameter_tail+'\', \''+w+'\', \''+h+'\');" onMouseOver="window.status=\'Year period\';return true" onMouseOut="window.status=\'\';return true">');
	document.write('<img id=h3 name=h3 src="graphs/images/'+year_img_src+'" border=0 width=39 height=12>');
	document.write('</a>');
}
