﻿function $(x){
	return document.getElementById(x)
}
/************************************************************/
var ie=document.all;
var nn6=document.getElementById&&!document.all;
/************************************************************/
function show_banner(id){
	if(id==0)id=1
	if(ie){
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="500" height="170" name="flash_header" id="flash_header" align="middle"> \n')
		document.write('<param name="allowScriptAccess" value="sameDomain" /> \n')
		document.write('<param name="movie" value="images/flash/mov0'+id+'.swf" /> \n')
		document.write('<param name="quality" value="best" /> \n')
		document.write('<param name="bgcolor" value="#ffffff" /> \n')
		document.write('<param name="wmode" value="transparent" /> \n')
	}
	document.write('<embed src="images/flash/mov0'+id+'.swf" quality="high" bgcolor="#ffffff" wmode="transparent" width="800" height="170" name="flash_header" id="flash_header" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> \n')
	if(ie){
		document.write('</object> \n')
	}
}

function show_header(txt, _width, divID){
	var collectHTML = "";
	if(ie){
		collectHTML += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+_width+'" height="30" name="flash_header" id="flash_header" align="middle"> \n'
		collectHTML += '<param name="allowScriptAccess" value="sameDomain" /> \n'
		collectHTML += '<param name="movie" value="images/flash/header.swf" /> \n'
		collectHTML += '<param name="quality" value="best" /> \n'
		collectHTML += '<param name="bgcolor" value="#ffffff" /> \n'
		collectHTML += '<param name="flashVars" value="txt='+txt+'" /> \n'
		collectHTML += '<param name="wmode" value="transparent" /> \n'
	}
	collectHTML += '<embed src="images/flash/header.swf" quality="high" bgcolor="#ffffff" flashVars="txt='+txt+'" wmode="transparent" width="'+_width+'" height="30" name="flash_header" id="flash_header" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> \n'
	if(ie){
		collectHTML += '</object> \n'
	}
	$(divID).innerHTML = collectHTML
}

/************************************************************/
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}
/************************************************************/
function set_window_size(){
	var main_part = $('main_part');
	var nav_div = $('nav_div');
	// decide which part is highier and then make it the determiner
	var heightCollector = (main_part.offsetHeight) + (nav_div.offsetHeight) + 230;
	if(heightCollector<getPageSize()[3]){
		$('footer_positioning').style.top = (getPageSize()[3]) + "px";
		$('all_page').style.height = (getPageSize()[3]-6) + "px";
	}else{
		$('footer_positioning').style.top = (heightCollector) + "px";
		$('all_page').style.height = (heightCollector) + "px";
	}
	$('footer_positioning').style.display = "inline";
	// after setting the footer in it's place - set the height of both objects.
	$('main_part').style.height = (findPos($('footer_positioning'))[1] - findPos($('main_part'))[1] - 40) + "px";
	
}
/************************************************************/	
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	
	return [curleft,curtop];
}


