// JavaScript Document

addEventHandler(window, "load", onLoadMap, false);
addEventHandler(window, "load", onUnLoadMap, false);

$(document).ready(function(){
	
	var txtImageTitle = "";
	
	switch(curPage){
	case"home":
		$("h3#homeNav").addClass("leftNavSelected");
		$("h3#homeNav").addClass("yellow");
		break;
		
	case"suit":
		$("h3#suitNav").addClass("leftNavSelected");
		$("h3#suitNav").addClass("yellow");
		txtImageTitle = "HRH Holmes and Son - Suit hire <br/> Image";
		break;	

	case"shirt":
		$("h3#shirtsNav").addClass("leftNavSelected");
		$("h3#shirtsNav").addClass("yellow");
		txtImageTitle = "HRH Holmes and Son - Shirt hire <br/> Image";
		break;
	
	case"waist":
		$("h3#waistcoatsNav").addClass("leftNavSelected");
		$("h3#waistcoatsNav").addClass("yellow");
		txtImageTitle = "HRH Holmes and Son - Waistcoat hire <br/> Image";
		break;
		
	case"retail":
		$("h3#retailNav").addClass("leftNavSelected");
		$("h3#retailNav").addClass("yellow");
		txtImageTitle = "HRH Holmes and Son - Retail <br/> Image";
		break;
	
	case"contact":
		$("h3#contactNav").addClass("leftNavSelected");
		$("h3#contactNav").addClass("yellow");
		break;
	
	case"location":
		$("h3#locationNav").addClass("leftNavSelected");
		$("h3#locationNav").addClass("yellow");
		break;
	
	default:
		$("h3#homeNav").addClass("leftNavSelected");
		$("h3#homeNav").addClass("yellow");
	}
	
	/***************LIGHT BOX SETUP**************/
	$(function() {
        $(".contentImagesContainer a").lightBox();
    });
	
	$(function() {
   	$('a[@rel*=lightbox]').lightBox({
	overlayBgColor: '#FFF',
	overlayOpacity: 0.6,
	imageLoading: '../images/loading.gif',
	imageBtnClose: '../images/closelabel.gif',
	imageBtnPrev: '../images/prevlabel.gif',
	imageBtnNext: '../images/nextlabel.gif',
	containerResizeSpeed: 350,
	txtImage: txtImageTitle,
	txtOf: 'of'
   });
	/********************************************/
	
	$("h3#homeNav").click(function(){
		if(curPage != "home"){
			window.location = "http://hrhholmes.co.uk/index.php";
		}
 	});
	
	$("h3#suitNav").click(function(){
		if(curPage != "suit"){
			window.location = "http://hrhholmes.co.uk/suit_hire/index.php";
		}
 	});
	
	$("h3#shirtsNav").click(function(){
		if(curPage != "shirt")
			window.location = "http://hrhholmes.co.uk/shirts/index.php";	
 	});
	
	$("h3#waistcoatsNav").click(function(){
		if(curPage != "waist")
			window.location = "http://hrhholmes.co.uk/waistcoats/index.php";	
 	});
	
	$("h3#retailNav").click(function(){
		if(curPage != "retail")
			window.location = "http://hrhholmes.co.uk/retail/index.php";	
 	});
	
	$("h3#locationNav").click(function(){
		if(curPage != "location")
			window.location = "http://hrhholmes.co.uk/location/index.php";	
 	});
	
	$("h3#contactNav").click(function(){
		if(curPage != "contact")
			window.location = "http://hrhholmes.co.uk/contact_us/index.php";	
 	});
	
	/*$("h3#suitNav").addClass("yellow");
	$("h3#shirtsNav").addClass("yellow");
	$("h3#waistcoatsNav").addClass("yellow");
	$("h3#waistcoats").addClass("yellow");
	$("h3#contactNav").addClass("yellow");*/
	
	
	$("h3#homeNav").hover(
      function() {
	  	if(curPage != "home")
			$(this).addClass("leftNavHover"); $(this).addClass("pointable");
      }, 
      function() {
	  	if(curPage != "home")
        	$(this).removeClass("leftNavHover");
      }
    );
	
	$("h3#suitNav").hover(
      function() {
	  	if(curPage != "suit")
			$(this).addClass("leftNavHover"); $(this).addClass("pointable");
      }, 
      function() {
	  	if(curPage != "suit")
        	$(this).removeClass("leftNavHover");
      }
    );
	
	$("h3#shirtsNav").hover(
      function() {
	  	if(curPage != "shirt")
			$(this).addClass("leftNavHover"); $(this).addClass("pointable");
      }, 
      function() {
	  	if(curPage != "shirt")
        	$(this).removeClass("leftNavHover");
      }
    );
	
	$("h3#waistcoatsNav").hover(
      function() {
	  	if(curPage != "waist")
			$(this).addClass("leftNavHover"); $(this).addClass("pointable");
      }, 
      function() {
	  	if(curPage != "waist")
        	$(this).removeClass("leftNavHover");
      }
    );
	
	$("h3#retailNav").hover(
      function() {
	  	if(curPage != "retail")
			$(this).addClass("leftNavHover"); $(this).addClass("pointable");
      }, 
      function() {
	  	if(curPage != "retail")
        	$(this).removeClass("leftNavHover");
      }
    );
	
	$("h3#contactNav").hover(
      function() {
	  	if(curPage != "contact")
			$(this).addClass("leftNavHover"); $(this).addClass("pointable");
      }, 
      function() {
	  	if(curPage != "contact")
        	$(this).removeClass("leftNavHover");
      }
    );
	
	$("h3#locationNav").hover(
      function() {
	  	if(curPage != "location")
			$(this).addClass("leftNavHover"); $(this).addClass("pointable");
      }, 
      function() {
	  	if(curPage != "location")
        	$(this).removeClass("leftNavHover");
      }
    );
	
	
	$("div#centerColmnContainer").show("slow");
	
	
});

	
});

function addEventHandler(oNode, evt, oFunc, bCaptures)
{
	if (typeof(window.event) != "undefined")
		oNode.attachEvent("on"+evt, oFunc);
	else
		oNode.addEventListener(evt, oFunc, bCaptures);
}

function onLoadMap()
{
	load();
}

function onUnLoadMap()
{
	GUnload();
}
