
// id del li del menu actual. Por defecto será el del índice
var idLiActual="li_index"; 

var languageArray = new Array();

/**
 * Set the src in the main iframe
 * @param url dirección a la que se accede
 * @return
 */
function goTo(url)
{
	document.getElementById("iframeMain").src=url;
	/*
	if(url == null || url == '')
	{
		document.frames["iframeMain"].src = './welcome.html';
	}
	else
	{
		document.frames["iframeMain"].src = url;
	}
	*/
	
}

/**
 * Marca como seleccionado el elemento de la lista del menu que recibe como argumento
 * @param li_id id del elemento del menu del frame padre(Ha de existir)
 * @return
 */
function selectMenu(li_id)
{
	// Se deseleciona el actual
	parent.document.getElementById(parent.idLiActual).className = "";
	// Se estable el nuevo como actual
	parent.idLiActual = li_id;
	parent.document.getElementById(parent.idLiActual).className = "important";
}

/**
 * Set the GUI language
 * @param language
 * @return
 */
function setLanguage(language)
{
	languageArray = eval("language_" + language);
}

/**
 * Add to the browser favorites menu
 * @return
 */
function addToFavorites()
{
	if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) 
	{
		var url		=	"http://www.hostallascantigas.es";
		var titulo	=	"Hostal Las Cantigas";
		try
		{
			window.external.AddFavorite (url,titulo);
		}
		catch(error)
		{}
	}
	else 
	{
		if(navigator.appName == "Netscape")
		{
			alert (languageArray["inst_favoritos"]);
		}
	}
}

/**
 * Get the url parameters
 * @param parameter
 * @return
 */
function getParameter(parameter)
{
	parameter = parameter.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]" + parameter + "=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null )
	{
		return null;
	}
	else
	{
		return results[1];
	}
}

/**
 * Reset the menus as selected
 * @return
 */
function resetMenus()
{
	document.all.iframeMenuLeft.contentWindow.document.getElementById("hostelMenu").className	= "menu" ;
	document.all.iframeMenuLeft.contentWindow.document.getElementById("roomsMenu").className	= "menu" ;
	document.all.iframeMenuLeft.contentWindow.document.getElementById("servicesMenu").className = "menu" ;
	document.all.iframeMenuLeft.contentWindow.document.getElementById("bookMenu").className 	= "menu" ;
	document.all.iframeMenuLeft.contentWindow.document.getElementById("pricesMenu").className 	= "menu" ;
	document.all.iframeMenuLeft.contentWindow.document.getElementById("locationMenu").className = "menu" ;
	document.all.iframeMenuLeft.contentWindow.document.getElementById("visitMenu").className 	= "menu" ;
	document.all.iframeMenuLeft.contentWindow.document.getElementById("contactMenu").className 	= "menu" ;
	
	document.all.iframeMain.contentWindow.document.all.iframeMenuRight.contentWindow.document.getElementById("recommendMenu").className 	= "menu" ;
	document.all.iframeMain.contentWindow.document.all.iframeMenuRight.contentWindow.document.getElementById("favoritesMenu").className 	= "menu" ;
	document.all.iframeMain.contentWindow.document.all.iframeMenuRight.contentWindow.document.getElementById("linksMenu").className 		= "menu" ;
}
