/**/
/**/
/*++++++++++++++++++++++++++++++++ Function to set the correct content background image ++++++++++++++++++++++++++++++++*/

function setBackground(id)
{
	if (id != null)
	{
		el = document.getElementById("content-background");
		if (el != null)
		{
			el.style.backgroundImage='url(Content/Images/'+id+')';
		}
	}
}
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
function doSearch()
{
  var el = document.getElementById("SEARCHTXT");
  var idsite = siteid;
  if (idsite == 1)
	searchpageid = 105;
  else if (idsite == 158)
	searchpageid = 248;
  if (el!=null)
  {
	if (el.value != null)
	{
		if (el.value != "") to(searchpageid,"SEARCH="+el.value);
	}
  }
}
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
function keydown(e) {
  if (e==null) return;
  try 
  {
    var keyCode = e.keyCode;
  }
  catch(e) 
  {
    alert(e.message);
  }
  if (keyCode==null) keyCode=e.which;
  if (keyCode==13) {
    try 
    {
	    if (e.cancelBubble!=null) e.cancelBubble=true;
	    if (e.returnValue!=null) e.returnValue=false;
	    if (e.keyCode!=null) e.keyCode=0;
	    if (e.which!=null) e.which=0;
    }
    catch(e)
    {
    }
    doSearch();
    return false;
  };
}

function carrousel()
{
	var dest = document.getElementById("carroussel");
	var images = new Array();
	images[0] = "images/mediteren.jpg";
	images[1] = "images/india.jpg";
	images[2] = "images/chinese.jpg";

	var total = images.length;
	
	var nr = Math.floor(Math.random() * (total));
	if (dest != null)
	{
		dest.src=images[nr];
	}
}

function initMenu()
{
	var menu = document.getElementById("nav");
	if (menu != null)
	{
		var list = menu.getElementsByTagName("ul");
		if (list.length > 0)
		{
			for (var i = 0; i < list.length; i++)
			{
				var list2 = list[i].getElementsByTagName("li");
				if (list2.length > 0)
				{
					for (var a = 0; a < list2.length; a++)
					{
						if (a == 0)
							list2[a].style.display="none";
					}
				}
			}
		}
	}
}

function setActiveMenu(aid)
{
	var menu = document.getElementById("nav");
	if (menu != null)
	{
		var list = menu.getElementsByTagName("ul");
		if (list.length > 0)
		{
			for (var i = 0; i < list.length; i++)
			{
				var list2 = list[i].getElementsByTagName("a");
				if (list2.length > 0)
				{
					for (var a = 0; a < list2.length; a++)
					{
						if (list2[a].id == (aid - 1))
						{
							list2[a].parentNode.parentNode.style.display="block";
							list2[a].className += " active";
						}
					}
				}
			}
		}
	}
}

window.onload = function()
{
	initMenu();
	if (window.activePage!=null)
	  setActiveMenu(activePage);
}