// 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";
}
//Abre una Ventana del popUp virtual
//<a href="javascript:popUpVirtual('http://www.vpapel.net/vpapel/catalogos/novios_verano_08/index.htm')">abre popupvirtual</a>
function popUpVirtual(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=990,height=680');");
}

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;
}

function getDominioB2b()
{
	if( document.location.hostname.indexOf( "local" ) >= 0 )
	{
		return "";
	}
	if( document.location.hostname.indexOf( "testws" ) >= 0 )
	{
		if( document.location.hostname.indexOf("viaxis.") >= 0 )
		{
			return "http://viaxis.testws.soltour.pt"; 
		}
		else
		{
			return "http://www.testws.soltour.pt";
		}
	}
	else
	{
		{
			if( document.location.hostname.indexOf("viaxis.") >= 0 )
			{
				return "http://viaxis.soltour.pt"; 
			}
			else
			{
				return "http://b2b.soltour.pt";
			}
		}
	}
}
