// JavaScript Document
//JQuery function to load lightbox class in links

   /*$(document).ready(function(){
   var simpleMenuLeft = $("ul.simplemenu").eq(0);
   		var thickboxlink = $(simpleMenuLeft).children("li").children('a');
		thickboxlink.each( function(){
			var href = $(this).attr('href');
			if (href.indexOf('photo-gallery.aspx')>0){
				$(this).addClass('thickbox');
				var newhref = href + '?KeepThis=true&TB_iframe=true&height=675&width=670&modal=true'
				$(this).attr('href', newhref);
			}
			
		});
   });*/
   		
	/*for left side menu light box using apollo menu*/
      $(document).ready(function(){
   		var thickboxlink = $("a.SkinObject");
		thickboxlink.each( function(){
			var href = $(this).attr('href');
			if (href.indexOf('photo-gallery.aspx')>0){
				$(this).addClass('thickbox');
				var newhref = href + '?KeepThis=true&TB_iframe=true&height=675&width=670&modal=true'
				$(this).attr('href', newhref);
			}
			
		});
   });
   
   //the tower photo gallery
    $(document).ready(function(){
		var thickboxlink2 = $("#ctl09_ApolloNAV_ctlApolloNAVt417");
		var anchortag = '<a class="thickbox" href="/language/en-us/the-tower/tower_photo_gallery.aspx?KeepThis=true&TB_iframe=true&height=675&width=670&modal=true" style="color:#fff; text-decoration: none;">Photo Gallery</a>';
		thickboxlink2.html(anchortag);
   });
	
	
	//downtown photo gallery
	$(document).ready(function(){
		var thickboxlink4 = $("#ctl09_ApolloNAV_ctlApolloNAVt394");
		var anchortag = '<a class="thickbox" href="/language/en-us/downtown-dubai/photo-gallery.aspx?KeepThis=true&TB_iframe=true&height=675&width=670&modal=true" style="text-decoration: none;">Photo Gallery</a>';
		thickboxlink4.html(anchortag);
   });

	
	
  
//This section is for setting the on setting for the page you are on in the left navigation	
 $(document).ready(function(){
	var urlCurrent = window.location.href;
	
	$('#side_nav .simplemenu li a').each(function(){
		var hrefHold = $(this).attr('href');
		if(urlCurrent == hrefHold)
		{
			
			$(this).addClass('selected');
		}
	});
	
	var urlCurrent = window.location.href;
	
	$('#tertiary_menu #dnn_MenuPane .simplemenu li a').each(function(){
		var hrefHold = $(this).attr('href');
		if(urlCurrent == hrefHold)
		{
			
			$(this).addClass('selected');
		}
	});
	
 });
 
 
 // basic show and hide for main pages
 $(document).ready(function(){
    //swap box1
    $("#show1").hover(
      function () {
        $('.box1_hover').fadeIn();
      },
	  function() {}
    );
	$(".box1_hover").hover(
		function () {},	
		function() {
			$('.box1_hover').fadeOut();
		}
	);
	
	//swap box2
    $("#show2").hover(
      function () {
        $('.box2_hover').fadeIn();
      },
	  function() {}
    );
	$(".box2_hover").hover(
		function () {},	
		function() {
			$('.box2_hover').fadeOut();
		}
	);
	
	//swap box3
    $("#show3").hover(
      function () {
        $('.box3_hover').fadeIn();
      },
	  function() {}
    );
	$(".box3_hover").hover(
		function () {},	
		function() {
			$('.box3_hover').fadeOut();
		}
	);
	
	//swap box4
    $("#show4").hover(
      function () {
        $('.box4_hover').fadeIn();
      },
	  function() {}
    );
	$(".box4_hover").hover(
		function () {},	
		function() {
			$('.box4_hover').fadeOut();
		}
	);
	
	//swap box5
    $("#show5").hover(
      function () {
        $('.box5_hover').fadeIn();
      },
	  function() {}
    );
	$(".box5_hover").hover(
		function () {},	
		function() {
			$('.box5_hover').fadeOut();
		}
	);
	
	//swap box6
    $("#show6").hover(
      function () {
        $('.box6_hover').fadeIn();
      },
	  function() {}
    );
	$(".box6_hover").hover(
		function () {},	
		function() {
			$('.box6_hover').fadeOut();
		}
	);
	
	
  });
 
 //pop up window for maps
 function popup(url)
{
  if (navigator.appName == "Microsoft Internet Explorer")
  {
    if ( navigator.appVersion.indexOf( "Macintosh" ) != -1 ) // IE Mac
    {
      window.open(url,'','status=no,location=no,menubar=no,toolbar=no,scrollbars=no,width=700,height=703,top=50,left=50,resizable=yes');
    }
    else // IE Win
    {
      window.open(url,'','status=no,location=no,menubar=no,toolbar=no,scrollbars=no,width=700,height=703,top=50,left=50,resizable=yes');
    }
  }
  if (navigator.appName != "Microsoft Internet Explorer")
  {
    if ( navigator.appVersion.indexOf( "Macintosh" ) != -1 ) // Netscape Mac
    {
      window.open(url,'','status=no,location=no,menubar=no,toolbar=no,scrollbars=no,width=700,height=703,top=50,left=50,resizable=yes');
    }
    else // Netscape WIn
    {
      window.open(url,'','status=no,location=no,menubar=no,toolbar=no,scrollbars=no,width=700,height=703,top=50,left=50,resizable=yes');
    }
  }
}

//Jump menu for photo gallery
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
