// JavaScript Document
var _ship = "";
var _url = "";
var _shipname = "";
var _str = "";
var _strcontent = "";
var _cabin_lounge = "";
//var dialog;


/*function closeModal(h) {
                      var $modalWindow = $(h.w);
                        $modalWindow.fadeOut('2000', function()
                        {
                                h.o.hide();
                         });
   }*/

 function showModal(type, cabin_lounge, shipname, param)
{  

    var url;
	var strContent;
	var str = "";
  	if (cabin_lounge == 2)  /* Cabin Suites ***/
		{
					   if (type == 1)  /* Photogallery = 1 */
						{
						url =  "../PhotoGallery/PhotoGallery" + str + shipname + ".aspx"
						strcontent = "Cabin";
					  }
					   else  /* BluePrint = 2 */
					  {
						 url = "../BluePrint/BluePrint" + str + shipname + ".aspx"
						 strcontent = "BluePrint";
					  }
		
	}
	else if(cabin_lounge == 0) /* Meetings & Conferences */
	{
						if (type == 1)  /* Photogallery Meetings & Conferences */
					  {
						url =  "../../PhotoGallery/PhotoGalleryMeetingsConferences" + str + shipname + ".aspx"
						strcontent = "Meetings & Conferences";
					  }
					   else  /* BluePrint */
					  {
						 url = "../../BluePrint/BluePrintMeetingsConferences" + str + shipname + ".aspx"
						 strcontent = "BluePrint";
					  }		
	}
	else /* Public Lounge **/
	{
						str = "PublicLounge";
						strcontent = "PublicLounge";
						url =  "../PhotoGallery/PhotoGallery" + str + shipname + ".aspx"
	}   

var cabin_lounge_pass;
/*if (cabin_lounge == 0) cabin_lounge_pass = 2;
else*/ cabin_lounge_pass = cabin_lounge;
	
    url += '?id='+param+'&t=' + cabin_lounge_pass + '&ship='+shipname;
		height = 460;
    width = 760;
    /*dialog = $('#ShipLightBoxID')
        .jqm({ 
            onShow: function(h) {
                var $modal = $(h.w);                
                var $modalContent = $("iframe", $modal); 
                $modalContent.html('').attr('src', url); 
                if (height > 0) $modal.height(height);    
                if (width > 0) $modal.width(width);     
				_str = str;
				_strContent = strContent;
				_shipname = shipname;
  				_cabin_lounge = cabin_lounge;

				_url = url;
                h.w.show();          
            },
            onHide: closeModal
                 
         }).jqmShow();        */
     viewModal(url, '', width, height);
	 //return alert(id);
}


function changepage(val,_cabin_lounge,_shipname,id,cat)
{
	//cat=1;

	  if (val == 1)
	  {
				  if (_cabin_lounge == 2)
		  {
	    	window.parent.jQuery("iframe").attr('src','../Photogallery/Photogallery'+_shipname+'.aspx?id='+id+'&t='+_cabin_lounge+'&ship='+_shipname);
		  }
		  else if(_cabin_lounge == 0)
		  {
										if(cat != "") {
										
											 window.parent.jQuery("iframe").attr('src','../../Photogallery/PhotogalleryMeetingsConferences'+_shipname+'.aspx?id='+id+'&t='+_cabin_lounge+'&ship='+_shipname+'&cat='+cat);	
										
										}
										else{
											   window.parent.jQuery("iframe").attr('src','../../Photogallery/PhotogalleryMeetingsConferences'+_shipname+'.aspx?id='+id+'&t='+_cabin_lounge+'&ship='+_shipname);		  	
									  }
		  }
		  else
		  {
		    window.parent.jQuery("iframe").attr('src','../Photogallery/PhotogalleryPublicLounge'+_shipname+'.aspx?id='+id+'&t='+_cabin_lounge+'&ship='+_shipname);
		  }
	  }
	  else{
				 if(_cabin_lounge == 0){
					window.parent.jQuery("iframe").attr('src','../../BluePrint/BluePrintMeetingsConferences'+_shipname+'.aspx?id='+id+'&t='+_cabin_lounge+'&ship='+_shipname);	  	 	
				 }
				 else{
					  if((cat != "")&&(cat != undefined))  window.parent.jQuery("iframe").attr('src','../BluePrint/BluePrint'+_shipname+'.aspx?id='+id+'&t='+_cabin_lounge+'&ship='+_shipname+'&cat='+cat);
					  else  
					  {
						  //alert("cat undefined");
						  window.parent.jQuery("iframe").attr('src','../BluePrint/BluePrint'+_shipname+'.aspx?id='+id+'&t='+_cabin_lounge+'&ship='+_shipname);}
				}
	  }
}


function getQueryVariable(variable) { 
  var query = window.location.search.substring(1); 
  var vars = query.split("&"); 
  for (var i=0;i<vars.length;i++) { 
    var pair = vars[i].split("="); 
    if (pair[0] == variable) { 
      return pair[1]; 
    } 
  } 
} 
