// JavaScript Document

function menuMouseOver(object)
{
	object.style.backgroundColor="#ffffff";
	object.style.color="#000000";
};

function menuMouseOut(object)
{
	object.style.backgroundColor="";
	object.style.color="#ffffff";
};

function updateFooter()
{
	var foot=document.getElementById("footer");
	var empty=document.getElementById("emptyLine");

	alert(window.screen.width+"x"+window.screen.height);
//	alert(empty);
//	alert(empty.style.height);
	
//	while (foot.clientHeight+foot.offsetTop<700)
//	{
////		alert(foot.clientHeight+" "+foot.offsetTop);
//		empty.style.height=empty.style.height+10;
//	}
}

function onLoadEvent()
{
	goSubPageOption("","",true);
	updateImgExtensions();
	resizeEvent();
}

function resizeEvent()
{
	resize();
//	setTimeout(resize,2000);
}

function resize(){  
	var foot=document.getElementById("footer");
	var total=document.getElementById("totalDiv");
	var empty = document.getElementById("emptyLine");
	var htmlheight = document.body.parentNode.scrollHeight;
	var bodyheight = document.body.clientHeight;
//	var windowheight = window.innerHeight;  
//	alertSize();
//	alert("htmlheight "+htmlheight+" windowheight "+windowheight+" bodyheight "+bodyheight);
//	alert("total "+total.clientHeight);
//	alert("emptyline "+frame.style.height+" foot "+foot.clientHeight);
//	if ( htmlheight < windowheight ) 
//	{ 
//		document.body.style.height = windowheight + "px"; 
//		total.style.height = windowheight + "px";
//	}  
//	else 
//	{ 
//		document.body.style.height = htmlheight + "px"; 
//		total.style.height = htmlheight-100 + "px"; 
//	}  

//	alert("resize");
	var windowHeight=alertSize();
//	alert("wh "+windowHeight+" th "+total.clientHeight+" th "+total.offsetHeight);
//	var h1=total.clientHeight;
//	var h2=windowHeight;
//	var diff=h1-h2;
//	alert(diff);
//	empty.style.height=h2-(h1-4000);

//	frame.style.height=10;
	var h=500;
	empty.style.height=h+"px";
	while (total.offsetHeight<windowHeight)
	{
//		alert("A "+total.offsetHeight);
		empty.style.height=h+"px";
		diff=windowHeight-total.offsetHeight;
		h=h+diff;
//		alert("B "+total.offsetHeight);
	}
	
} 

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//  window.alert( 'Width = ' + myWidth );
//  window.alert( 'Height = ' + myHeight );
	return myHeight;
}


function isIE6()
{
	var agt=navigator.userAgent.toLowerCase();
	var appVer = navigator.appVersion.toLowerCase();
	var is_minor = parseFloat(appVer);
	var is_major = parseInt(is_minor);
	var iePos = appVer.indexOf('msie');
	if (iePos !=-1) {
		is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
		is_major = parseInt(is_minor);
	}
	var is_getElementById = (document.getElementById) ? "true" : "false"; 
	var is_getElementsByTagName = (document.getElementsByTagName) ? "true" : "false";
	var is_documentElement = (document.documentElement) ? "true" : "false"; 
	var is_ie = ((iePos!=-1));
//	var is_ie3 = (is_ie && (is_major < 4));
//	var is_ie4 = (is_ie && is_major == 4);
//	var is_ie4up = (is_ie && is_minor >= 4);
//	var is_ie5 = (is_ie && is_major == 5);
//	var is_ie5up = (is_ie && is_minor >= 5);
//	var is_ie5_5 = (is_ie && (agt.indexOf("msie 5.5") !=-1)); 
//	var is_ie5_5up =(is_ie && is_minor >= 5.5); 
//	var is_ie6 = (is_ie && is_major == 6);
	var is_ie6down = (is_ie && is_minor <= 6);
	return is_ie6down;
}

function getExtension()
{
	return (isIE6()? ".gif" : ".png");
}

function updateImgExtensions()
{
//	cssrule = document.styleSheets[0] ;
//    selector = cssrule.selectorText; 
//	alert(selector);
	
	ims=document.getElementsByTagName("img");
//	alert(ims.length);
	for (i=0;i<ims.length;i++)
	{
//		alert(ims[i].className);
		var imgg=ims[i];
		if (new String(imgg.className).indexOf("updateExt")>=0)
		{
			imgGifPng(imgg);
		};
//		var atts=ims[i].attributes;
//		alert(atts.length);
//		alert(ims[i].style.selectorText);
//		var str="";
//		for (j=0;j<atts.length;j++)
//			str=str+atts[j].name+'='+atts[j].value+"  ";
//		alert(str);
	}
}

function imgGifPng(imgg)
{
//	alert(imgobject.src);
 	var srcstring=new String(imgg.src);
	var ext=srcstring.substring(srcstring.length-4,srcstring.length);
	var newext=getExtension();
//	alert(ext+" new ext "+newext);
	if (ext!=newext)
	{
		imgg.src=srcstring.substring(0,srcstring.length-4)+newext;
	}
}

