function getScrollY() {
	var  scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//scrOfY = window.pageYOffset;
		scrOfY = document.documentElement.scrollWidth;
	} else if( document.body && ( document.body.scrollLeft  )) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
	} else if( document.documentElement && ( document.documentElement.scrollLeft  )) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
	}
	return scrOfY ;
}

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function setFooter() {
	if (document.getElementById) {
		var scr= getScrollY();
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('container').offsetHeight;
			contentHeight = contentHeight + document.getElementById('header').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if( typeof( window.pageYOffset ) == 'number' ) {
				var aux=window.pageYOffset;
				var scr1 = window.pageYOffset;
				var scr2 = document.documentElement.scrollHeight;
				var scr3 = document.documentElement.scrollTop;

				if (windowHeight -  scr2   < 0) {
					footerElement.style.position = 'static';
					footerElement.style.top = (windowHeight - footerHeight) + 'px';
				} else {
					footerElement.style.position = 'absolute';
					footerElement.style.top = (windowHeight -footerHeight ) + 'px';
				}
			} else {
				if (windowHeight - (contentHeight + footerHeight +scr ) >= 0) {
					footerElement.style.position = 'absolute';
					footerElement.style.top = (windowHeight - footerHeight) + 'px';
				}
				else {
					footerElement.style.position = 'static';
					footerElement.style.top = (windowHeight -footerHeight + scr) + 'px';
				}
			}
		}
	}
}

window.onload = function() {
	setFooter();
}
window.onresize = function() {
	setFooter();
}
function OnOff(name) {
	if (document.getElementById)
	{
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	}
	else if (document.all)
	{
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}
	else if (document.layers)
	{
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}

	if (this.style.display == "none") {
		this.style.display = ""
	} else {
		this.style.display = "none"
	}
}
function onLink(id,clas) {
	document.getElementById('n'+id).style.textDecoration='underline';
	document.getElementById('t'+id).style.textDecoration='underline';
	document.getElementById('n'+id).style.color='#E60004';
	document.getElementById('t'+id).style.color='#E60004';
	document.getElementById('s'+id).className=clas;
}
function offLink(id,clas) {
	document.getElementById('n'+id).style.textDecoration='none';
	document.getElementById('t'+id).style.textDecoration='none';
	document.getElementById('n'+id).style.color='#666';
	document.getElementById('t'+id).style.color='#666';
	document.getElementById('s'+id).className=clas;
}
function showmenu(div,num){
	document.getElementById(div).style.display='block';
	desactive=num;
}
function hidemenu(div,num){
	if(desactive==num){
		menuactive=false;
	}
	if(!menuactive){
		document.getElementById(div).style.display='none';
	}
	
	
}
function show(div) {
	document.getElementById(div).style.display='block';
}
function hide(div) {
	document.getElementById(div).style.display='none';
}
loginshow=false;
function hideL(){
	if(!loginshow){
		hide('login');
	}
}

function checkparent(){
	valor=document.getElementById('parent').value;
	if(valor>0){
		document.getElementById('cate').style.display='none';
		document.getElementById('cate2').style.display='';
	}else{
		document.getElementById('cate').style.display='';
		document.getElementById('cate2').style.display='none';
	}
}
function popup(file){

	window.open(file, 'popup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600');
}
