function setLinkBold(linkName)
{
    var links = new Array('showroomLink', 'menuLink', 'pressLink', 'contactLink');
    for (i = 0; i < links.length; i++){
        if (linkName == links[i])
            document.getElementById(linkName).style.fontWeight = 'bold';
        else
            document.getElementById(links[i]).style.fontWeight = '';
    }
}

function firstLoad()
{
    document.getElementById('rightPanel').innerHTML = document.getElementById('rightPanelImg').innerHTML;       
    document.getElementById('centerPanel').innerHTML = document.getElementById('welcome').innerHTML;
    var banner = new Image();
    var bannerPath = 'images/banner_SPA-Siem-Reap-Angkor-Wat-Cambodia.jpg';
    var image = new Image();
    var imgPath = 'images/lobby_SPA-Siem-Reap-Angkor-Wat-Cambodia.jpg';        

    banner.onload = function()
        {
            document.getElementById('banner').src = bannerPath;
            document.getElementById('rightImg').src = imgPath;
            new Effect.Appear('banner', {duration: 1.0});
            new Effect.Appear('menuContainer', {duration: 0.5, queue: 'end'});
            new Effect.Appear('centerPanel', {duration: 0.5, queue: 'end'});
            new Effect.Appear('rightImg', {duration: 0.5, queue: 'end'});            
            new Effect.Appear('reference', {duration: 2.5, scope: 'informations'});            
        }
    banner.src = bannerPath;
    image.src = imgPath;
}

function loadElements(elName, picName)
{
    if (elName == 'contact')
        setLinkBold('contactLink');
    else
        setLinkBold('');
    document.getElementById('centerPanel').innerHTML = document.getElementById(elName).innerHTML;
    Element.hide('rightImg');
    document.getElementById('rightPanel').innerHTML = document.getElementById('rightPanelImg').innerHTML;

    var image = new Image();
    var imgPath = 'images/' +picName+ '.jpg';
    image.onload = function()
        {
            document.getElementById('rightImg').src = imgPath;
            new Effect.Appear('rightImg'); 
        }
    image.src = imgPath;
    document.getElementById('Pre_Next').innerHTML = "";	
}

var massagePics = new Array(6, 8, 10, 13, 11, 12, 16, 19);

function loadMenu(menuNb)
{
    setLinkBold('menuLink');
    document.getElementById('centerPanel').innerHTML = document.getElementById('Menu' + menuNb).innerHTML;
    Element.hide('rightImg');
    document.getElementById('rightPanel').innerHTML = document.getElementById('rightPanelImg').innerHTML;
    var imgNb = menuNb % 8;
    initNavigButtons(parseFloat(menuNb), 5, "loadMenu");
    var image = new Image();
    var imgPath = 'images/photos/' + massagePics[imgNb] + '_crop_SPA-Siem-Reap-Angkor-Wat-Cambodia.jpg'; 
    image.onload = function()
	{
	    document.getElementById('rightImg').src = imgPath;
	    new Effect.Appear('rightImg');  
	};
    image.src = imgPath;
}

function loadPress(pressNb)
{
    setLinkBold('pressLink');
    document.getElementById('centerPanel').innerHTML = document.getElementById('Press' + pressNb).innerHTML;
    Element.hide('rightImg');
    document.getElementById('rightPanel').innerHTML = document.getElementById('rightPanelImg').innerHTML;
    //var imgNb = Math.floor(20 * Math.random()) + 1;   
    var imgNb = 18 - pressNb;   
    initNavigButtons(parseFloat(pressNb), 6, "loadPress");
    var image = new Image();
    var imgPath = 'images/photos/' + imgNb + '_crop_SPA-Siem-Reap-Angkor-Wat-Cambodia.jpg'; 
    image.onload = function()
	{
	    document.getElementById('rightImg').src = imgPath;
	    new Effect.Appear('rightImg');  

	};
    image.src = imgPath;
}

function loadShowRoom(imgNb)
{
    setLinkBold('showroomLink');
    document.getElementById('rightPanel').innerHTML = document.getElementById('showroomContainer').innerHTML;
    initNavigButtons(parseFloat(imgNb), 20, "loadShowRoom");    
    loadCenterImage(imgNb);    
}

function initNavigButtons(currentNb, lastNb, func)
{
    var buttonsHTML = '<A class="prenext" href="#"';
    if (currentNb > 1)        
        buttonsHTML += " onClick=\"" + func + "('" + (currentNb - 1) + "')\"";        
    buttonsHTML += '>PREV <img class="arrow" src="images/arr2.jpg" alt="pre"></A>';
    buttonsHTML += '<A class="prenext" href="#"';
    if (currentNb < lastNb)
        buttonsHTML += " onClick=\"" + func + "('" + (currentNb + 1) + "')\"";
    buttonsHTML += '><img class="arrow" src="images/arr1.jpg" alt="next"> NEXT</A>';        
    document.getElementById('Pre_Next').innerHTML = buttonsHTML;
}

function seeMap()
{
    window.open('images/plan_ville_Bodia_SPA-Siem-Reap-Angkor-Wat-Cambodia.gif', 'map', 'menubar=no,width=500,height=500');
}

function seeMap2()
{
    window.open('images/plan_Heritage_Siem_Reap_Angkor_Wat_Cambodia.gif', 'map', 'menubar=no,width=500,height=500');
}
	
function loadCenterImage(picNb){
    document.getElementById('centerPanel').innerHTML = document.getElementById('centerPanelImg').innerHTML;
    Element.hide('centerImg');
    
    //load the image
    var image = new Image();
    var imgPath = 'images/photos/' + picNb + '_max_SPA-Siem-Reap-Angkor-Wat-Cambodia.jpg';
    image.onload = function()
	{
	    document.getElementById('centerImg').src = imgPath;
	    new Effect.Appear('centerImg');  	    
	};
    image.src = imgPath;
}
