// common.js

function showSubmenu(elem){ showElem("submenu_" + elem); }
function hideSubmenu(elem){ hideElem("submenu_" + elem); }
function showOriSpan(elem){ showElem("orispan_" + elem); }
function hideOriSpan(elem){ hideElem("orispan_" + elem); }
function showHotSpan(elem){ showElem("hotspan_" + elem); }
function hideHotSpan(elem){ hideElem("hotspan_" + elem); }

function hideElem(elem){
	document.getElementById(elem).style.display = "none";
}

function showElem(elem){
	document.getElementById(elem).style.display = "block";
}

function showElemVisibility(elem){
	document.getElementById(elem).style.visibility = "visible";
}

function hideElemVisibility(elem){
	document.getElementById(elem).style.visibility = "hidden";
}

function alertWindowSize(){
	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 leftDespliegue = (myWidth - 490) / 2;
	//alert ("leftDespliegue: " + leftDespliegue);
	window.alert( 'Width = ' + myWidth + '\nHeight = ' + myHeight );
}

function getWindowWidth(){
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	return myWidth;
}

function trad_texto()
{
	var domain = document.domain;
	var primerTexto = null;
	for( var i = 0; (i + 1) < arguments.length; i += 2 ) 
	{
		var sfx = arguments[i];
		var tx = arguments[i+1];
		
		if( !primerTexto )
		{
			primerTexto = tx;
		}
		if( sfx == '-' || domain.match( sfx + '$' ) )
		{
			return tx;
		}
	}
	return primerTexto;
}