function loader(_) {
	_ = this;
	_.F = new Array();
	_.addF = function(F) {
		_.F[_.F.length] = F;
	}
	_.onload = function() { for (var i=0;i<_.F.length;i++) _.F[i]() }
}

function resizer(_) {
	_ = this;
	_.F = new Array();
	_.addF = function(F) {
		_.F[_.F.length] = F;
	}
	_.onresize = function() { for (var i=0;i<_.F.length;i++) _.F[i]() }
}

function runner(_){
	_ = this;
	_.F = new Array();
	_.addF = function(F) { _.F[_.F.length] = F }
	_.run = function() {
		for (var i=0;i<_.F.length;i++) try{_.F[i]()}catch(e){}
		for (var i=0;i<_.F.length;i++) _.F[i]();
	}
}

function bgFix(){try{document.execCommand('BackgroundImageCache', false, true);}catch(e){}}

function pngFix(){
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	if ((version >= 5.5) && (document.body.filters)){
		for(var i=0; i < document.images.length; i++){
			var img = document.images[i]
			var imgName = img.src.toUpperCase()
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText 
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				img.outerHTML = strNewHTML
				i = i-1
			}
		}
	}
}

function windowOpenCenter(path,name,w,h,bars) { return window.open(path,name,"width=" + w + ",height=" + h + ",top=" + Math.floor((screen.height-h)/2) + ",left=" + Math.floor((screen.width-w)/2) + "," + bars);}
function footerOver(){document.getElementById('pFooter').className="over";}
function footerOut(){document.getElementById('pFooter').className="";}

function positionElements(){
	document.getElementById('mainBottom').style.height='0px';

	if(parseInt(document.getElementById('mainBottom').clientHeight) <= 420) document.getElementById('mainBottom').style.height=mainBottomMinHeight+'px';
	else document.getElementById('mainBottom').style.height='auto';

	if ( typeof( window.innerHeight ) == 'number' ) windowHeight=window.innerHeight;  // Non IE browser
	else if (document.documentElement && document.documentElement.clientHeight) windowHeight=document.documentElement.clientHeight;  // IE6
	else if (document.body && document.body.clientHeight) windowHeight=document.body.clientHeight; // IE4

	contentHeight = parseInt(document.getElementById('head').clientHeight+document.getElementById('barraHeadFooter').clientHeight*2+document.getElementById('mainBottom').clientHeight+document.getElementById('pFooter').clientHeight);

	if(contentHeight < windowHeight) document.getElementById('mainBottom').style.height=parseInt(document.getElementById('mainBottom').clientHeight+windowHeight-contentHeight-mainBottomMinusHeight)+'px';
}

function closeSub(menu) {
	for (var i=0; i < menu.childNodes.length; i++)
		if (menu.childNodes[i].nodeName.toLowerCase()=="li") {
			li = menu.childNodes[i];
			li.onmouseover = li.onactivate = li.onfocus = function() { if (this.subMenu) this.subMenu.className = this.subMenu.className.replace(/subMenu-off/g,"subMenu-on") };
			li.onmouseout = li.ondeactivate = li.onblur = function() { if (this.subMenu) closeSub(this.subMenu) };
			for (j=0; j < li.childNodes.length; j++){
				if (li.childNodes[j].nodeName.toLowerCase()=="ul" || li.childNodes[j].nodeName.toLowerCase()=="ol") closeSub(li.subMenu = li.childNodes[j]);
			}
		}
	menu.className = menu.className.replace(/\s?subMenu-on/g,"")+" subMenu-off";
}

function loadNavV(div){
	try{reqLoadNavV.abort()}catch(e){};
	reqLoadNavV = new request();
	reqLoadNavV.url = '/_navV/navV.html';
	reqLoadNavV.onDone = function() {
		document.getElementById(div).innerHTML=reqLoadNavV.responseText;
	}
	reqLoadNavV.async=false;
	reqLoadNavV.get();
}

function initNavV(navId,menuClassName){
	if(document.getElementById(navId) && document.getElementById(navId).getElementsByTagName('ul')[0]) document.getElementById(navId).getElementsByTagName('ul')[0].className=menuClassName;
	if(tags_ = document.getElementsByTagName('ul')){
		for(i=0; i < tags_.length; i++){
			if (tags_[i].className==menuClassName){
				for(j=0; j < tags_[i].getElementsByTagName('a').length; j++) tags_[i].getElementsByTagName('a')[j].innerHTML='<span>'+tags_[i].getElementsByTagName('a')[j].innerHTML+'</span>';
				for(j=0; j < tags_[i].getElementsByTagName('li').length; j++){
					for(k=0; k < tags_[i].getElementsByTagName('li')[j].childNodes.length; k++){
						if(tags_[i].getElementsByTagName('li')[j].childNodes[k].nodeName.toLowerCase()=="ul" || tags_[i].getElementsByTagName('li')[j].childNodes[k].nodeName.toLowerCase()=="ol"){
							tags_[i].getElementsByTagName('li')[j].childNodes[k].parentNode.getElementsByTagName('span')[0].className='isParent';
						}
					}
				}
				closeSub(tags_[i]);
			}
		}
	}
	if(tags_ = document.getElementsByTagName('ol')){
		for(i=0; i < tags_.length; i++){
			if (tags_[i].className==menuClassName){
				for(j=0; j < tags_[i].getElementsByTagName('a').length; j++) tags_[i].getElementsByTagName('a')[j].innerHTML='<span>'+tags_[i].getElementsByTagName('a')[j].innerHTML+'</span>';
				for(j=0; j < tags_[i].getElementsByTagName('li').length; j++){
					for(k=0; k < tags_[i].getElementsByTagName('li')[j].childNodes.length; k++){
						if(tags_[i].getElementsByTagName('li')[j].childNodes[k].nodeName.toLowerCase()=="ul" || tags_[i].getElementsByTagName('li')[j].childNodes[k].nodeName.toLowerCase()=="ol"){
							tags_[i].getElementsByTagName('li')[j].childNodes[k].parentNode.getElementsByTagName('span')[0].className='isParent';
						}
					}
				}
				closeSub(tags_[i]);
			}
		}
	}
}
