// JavaScript Document

// EDIT THESE VALUES IF REQUIRED
var alertText = 'Are you sure you wish to perform this action' + "\n"; //DEFAULT TEXT DISPLAYED ON CONFIRM BUTTONS/LINKS WHEN NO ALT/TITLE
var newWindowLink = false; //OPEN EXTERNAL LINKS BY DEFAULT IN A NEW WINDOW (TRUE/FALSE)?


var woms = new Array(); //CREATE ARRAY OF FUNCTIONS TO LAUNCH ONLOAD

//ONLOAD MANAGER
function womOn(){
  window.onload = womGo;
}

function womGo(){
  for(var i = 0;i < woms.length;i++)
    eval(woms[i]);
}

function womAdd(func){
  woms[woms.length] = func;
}

function CreateBookmarkLink() {

	title = document.title;
	url = window.location.href;
	
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,"");
	} else if(window.external) {
		window.external.AddFavorite( url, title); 
	} else if(window.opera && window.print) {
		return true;
	}
	
}

function objToggle(obj) { 

	var obj = document.getElementById(obj);

	if(obj.style.display == "block") { 
		obj.style.display = "none";
	} else { 
		obj.style.display = "block";
	}

}

//Animates the top showcase panel on homepage
function homePageScroller() {

    var slide = 0;
    var slides = $("#feature .slide");

    function switchSlide(pos) {

        if (pos > (slides.length - 1)) pos = 0;
        if (pos < 0) pos = (slides.length - 1);
        $("#feature .slide").fadeOut(1000);
        $("#feature .slide:eq(" + pos + ")").fadeIn(1000);
        slide = pos;

        
    }

    if (slides.length > 1) {
        $("#feature .slide").hide();
        $("#feature .slide:eq(" + slide + ")").fadeIn(1000);
        function doSlideRotate() {
            switchSlide((slide + 1));
        }
        window.setInterval(doSlideRotate, 6000);
    }

}

//Animates the top showcase panel on entertain page
function entertainPageScroller() {

    var slide = 0;
    var slides = $("#feature-entertain .slide");

    function switchSlide(pos) {
        
        if (pos > (slides.length - 1)) pos = 0;
        if (pos < 0) pos = (slides.length - 1);
        $("#feature-entertain .slide").fadeOut(1000);
        $("#feature-entertain .slide:eq(" + pos + ")").fadeIn(1000);
        slide = pos;

    }

    if (slides.length > 1) {
        $("#feature-entertain .slide").hide();
        $("#feature-entertain .slide:eq(" + slide + ")").fadeIn(1000);
       
        function doSlideRotate() {
            switchSlide((slide + 1));
        }
        window.setInterval(doSlideRotate, 6000);
    }

}

function shadowBoxSmall() {

    if ($('*[rel="shadowboxsmall"]').length == 0 && $('*[rel="shadowbox[Gallery]"]').length == 0) return false;
    Shadowbox.init({
        height: 300
    });

}

function shadowBox() {

    if ($('*[rel="shadowbox"]').length == 0 && $('*[rel="shadowbox[Gallery]"]').length == 0) return false;
    Shadowbox.init();

}

function clearInputs() {

    if ($('input.clear-val').length == 0) return false;



    $('input.clear-val').bind('focus', function () {

        $(this).attr('value', '');

    });

    $('input.clear-val').bind('blur', function () {

        if ($(this).attr('value') == '' || $(this).attr('value') == false) {
            $(this).attr('value', 'Search');
        }

    });


}

// ground floor plans
function showgroundcafe() {
    document.getElementById('ground').className = "showgroundcafe";
}

function hidegroundcafe() {
    document.getElementById('ground').className = "imagedefaultground";
}

function showgroundexhibition() {
    document.getElementById('ground').className = "showgroundexhibition";
}

function hidegroundexhibition() {
    document.getElementById('ground').className = "imagedefaultground";
}

function showgroundcommittee() {
    document.getElementById('ground').className = "showgroundcommittee";
}

function hidegroundcommittee() {
    document.getElementById('ground').className = "imagedefaultground";
}

// first floor plans
function showfirstpicture() {
    document.getElementById('first').className = "showfirstpicture";
}

function hidefirstpicture() {
    document.getElementById('first').className = "imagedefaultfirst";
}

function showfirstreception() {
    document.getElementById('first').className = "showfirstreception";
}

function hidefirstreception() {
    document.getElementById('first').className = "imagedefaultfirst";
}

function showfirstante() {
    document.getElementById('first').className = "showfirstante";
}

function hidefirstante() {
    document.getElementById('first').className = "imagedefaultfirst";
}

function showfirstfoyer() {
    document.getElementById('first').className = "showfirstfoyer";
}

function hidefirstfoyer() {
    document.getElementById('first').className = "imagedefaultfirst";
}

function showfirstcourt() {
    document.getElementById('first').className = "showfirstcourt";
}

function hidefirstcourt() {
    document.getElementById('first').className = "imagedefaultfirst";
}


// lower ground floor plans
function showlowerexhibitions() {
    document.getElementById('lower').className = "showlowerexhibitions";
}

function hidelowerexhibitions() {
    document.getElementById('lower').className = "imagedefaultlowerground";
}

function showlowergallery() {
    document.getElementById('lower').className = "showlowergallery";
}

function hidelowergallery() {
    document.getElementById('lower').className = "imagedefaultlowerground";
}

function showlowereducation() {
    document.getElementById('lower').className = "showlowereducation";
}

function hidelowereducation() {
    document.getElementById('lower').className = "imagedefaultlowerground";
}

// second floor plans
function showsecondgerald() {
    document.getElementById('second').className = "showsecondgerald";
}

function hidesecondgerald() {
    document.getElementById('second').className = "imagedefaultsecond";
}

function showsecondcollection() {
    document.getElementById('second').className = "showsecondcollection";
}

function hidesecondcollection() {
    document.getElementById('second').className = "imagedefaultsecond";
}

function showsecondreading() {
    document.getElementById('second').className = "showsecondreading";
}

function hidesecondreading() {
    document.getElementById('second').className = "imagedefaultsecond";
}




$(document).ready(function () {
    homePageScroller();
    entertainPageScroller();
    shadowBox();
    shadowBoxSmall();
    clearInputs();
});


