function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

window.onresize=myResize;
window.onscroll=myScroll;

var HomePictureDirectory = '/files/home';
var HomePictureDelay = 10000;
var HomePictureNumber = 1;
var HomePicture = new Array();
HomePicture[1] = "image-01.jpg";
HomePicture[2] = "image-02.jpg";
HomePicture[3] = "image-03.jpg"; 
HomePicture[4] = "image-04.jpg"; 
HomePicture[5] = "image-05.jpg"; 

function HomePictureGetRandomNumber()
{
	var Max = HomePicture.length;
	return NewPictureNumber=parseInt((Math.random()*Max-1))+1
}

function HomePictureChange()
{
	var NewPictureNumber=HomePictureGetRandomNumber(); 
	while( NewPictureNumber == HomePictureNumber ){ NewPictureNumber=HomePictureGetRandomNumber(); }
//	alert(NewPictureNumber);
	HomePictureNumber = NewPictureNumber;
	var Image = document.getElementById('HomePicture');
	if( Image ){ Image.src=HomePictureDirectory+'/'+HomePicture[HomePictureNumber]; }
	setTimeout('HomePictureChange()', HomePictureDelay)
}

function Play( animation )
{
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="980" height="280">');
	document.write('<PARAM name="movie" value="'+animation+'.swf">');
	document.write('<PARAM name="quality" value="high">');
	document.write('<PARAM name="wmode" value="transparent">');
	document.write('<EMBED src="'+animation+'.swf" QUALITY="high" WMODE="transparent" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" TYPE="application/x-shockwave-flash" width="980" height="280"></EMBED>');
//	document.write('<EMBED src="'+animation+'.swf" QUALITY="high" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" TYPE="application/x-shockwave-flash" width="980" height="280"></EMBED>');
	document.write('</OBJECT>');
}

function calculateDisclaimerCopyrightPosition()
{
	if( document.getElementById('Header').clientHeight )
	{
	  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;
	  }
		var TextHeight = 36;
	    var Offset = -1;
		Offset = document.documentElement.scrollTop;
	    if( navigator.appName.indexOf('Netscape') != -1 ){ Offset = window.pageYOffset}
		return myHeight-TextHeight-8+Offset;
	}
	else
	{
		return 0;
	}
}
function displayDisclaimerCopyright()
{
	var TopPosition = calculateDisclaimerCopyrightPosition();
	document.write('<DIV id="DisclaimerCopyright" style="top:'+TopPosition+'px" class="NavigationItem"><A href="">Disclaimer</A><BR><A href="">Copyright</A></DIV>');
/*	TopPosition -= 132;
	document.getElementById('RelatedPage').style.height= TopPosition+'px';
	document.getElementById('Content').style.height= TopPosition+'px';*/
}

var HEADER_OFFSET = 132;
function updateDisclaimerCopyrightPosition()
{
	var TopPosition = calculateDisclaimerCopyrightPosition();
	document.getElementById('DisclaimerCopyright').style.top=TopPosition+'px';
	TopPosition -= HEADER_OFFSET;
	if(document.getElementById('RelatedPage')){document.getElementById('RelatedPage').style.height= TopPosition+'px'}
	if(document.getElementById('Content')){document.getElementById('Content').style.height= TopPosition+'px'};
	TopPosition -= 0;
	if(document.getElementById('RelatedHome')){document.getElementById('RelatedHome').style.height= TopPosition+'px'};
}

function updateRelatedHeight()
{
	if( document.getElementById('Header').clientHeight )
	{
		if( document.getElementById('RelatedPage') )
		{
			  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;
		}
		var Offset = -1;
		var HeaderHeight = 178;
		Offset = document.documentElement.scrollTop;
	    if( navigator.appName.indexOf('Netscape') != -1 ){ Offset = window.pageYOffset}
		RelatedHeight = myHeight-HeaderHeight+Offset;
		ContentHeight = document.getElementById('ContentPage').clientHeight;
		if( ContentHeight > myHeight - HeaderHeight ){ RelatedHeight = ContentHeight; }
//    	document.getElementById('RelatedPage').style.height= RelatedHeight+'px';
		}
	}
	else
	{
//    	document.getElementById('RelatedPage').style.height= '0px';
	}
}

function myResize()
{
	updateDisclaimerCopyrightPosition();
	updateRelatedHeight();
}

function myScroll()
{
	updateDisclaimerCopyrightPosition();
	updateRelatedHeight();
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

var MENU_NB = 5;

function OpenNavigationMain( menu )
{
	document.getElementById('NavigationHomeMainOpenBackground'+menu).style.height = document.getElementById('NavigationHomeMainOpen'+menu).clientHeight + 'px';
	MM_showHideLayers('NavigationHomeMain'+menu,'','hide','NavigationHomeMainOpen'+menu,'','show','NavigationHomeMainOpenBackground'+menu,'','show');
	for(i=1; i < MENU_NB; i++ ) { if( i!= menu){ CloseNavigationMain( i ); } }
}
function CloseNavigationMain( menu )
{
	MM_showHideLayers('NavigationHomeMain'+menu,'','show','NavigationHomeMainOpen'+menu,'','hide','NavigationHomeMainOpenBackground'+menu,'','hide');
}


function InsertFlash( anim, width, height )
{
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+width+'" height="'+height+'">');
	document.write('<PARAM name=movie value="'+anim+'"><PARAM name=quality value=high><param name="wmode" value="transparent">');
	document.write('<EMBED src="'+anim+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></EMBED>');
	document.write('</OBJECT>');
}

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
//                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
                  + "(src=\'" + myImage.src + "\', sizingMethod='image');\"></span>"
//                  + "(src=\'" + myImage.src + "\');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}
