//jquery prompt HTML

var message1 = "<div class='popupLogos'><span><img src='/Portals/0/Skins/Global_Images/renaissance_popup_logo.gif' /></span><span><img src='/Portals/0/Skins/Global_Images/marriott_popup_logo.gif' /></span></div><div class='popupText'>To speed up your search, facilitate check-in, and earn reward points and member bonuses, you are being directed to Marriott.com reservations.<br />(You may have to disable your popup blocker.)</div>";
var message2 = "<div class='popupLogos' style=\"margin: 0px auto; width: 116px;\"><span style=\"padding-left:0px;\"><img src='/Portals/0/Skins/Global_Images/renaissance_popup_logo.gif' /></span></div><div class='popupText'>You are being directed to an external website.<br />Click OK to continue.<br />(You may have to disable your popup blocker.)</div>";

// jquery prompt
$(document).ready(function(){
	
	
	
	$("a.popup_link").click(function(){
		var url = $(this).attr("url");
		loadPrompt(message2, url);
		var goalType = $(this).attr("track");
		if(goalType = "packageConversion")
		{
			urchinTracker('/Goals/External/Packages');
		}
		
	});
	
	/*$("a.reservations").click(function(){
		loadPrompt(message1, "https://www.marriott.com/reservation/availability.mi?propertyCode=LASBR");
		urchinTracker('/Goals/External/Reservations');
	});
	*/
	
	$("a.marriott_rewards").click(function(){
		loadPrompt(message1, "https://www.marriott.com/rewards/rewards-program.mi");
		urchinTracker('/Goals/External/Marriott');
	});
	
	// Photo gallery function load
	$("#photogallery_images a").click(function(){
		
		var linkurl = $(this).find("img").attr("src").toString();
		linkurl = linkurl.replace('_tb', '_lg');
		linkurl = linkurl.replace('/thumbs/','/');
		
		var divCode = "<div id='imagePopup'><img src='" + linkurl + "' /></div>";
		
		loadGalleryPopup(divCode);
   });	

});
	

//loads the prompt
/*function loadPrompt(myText, url){
	myUrl = url;
	var jqiprompt = $.prompt(myText, { callback: geturl , buttons: { Continue:true , Cancel:false } } );	
}
// handles the callback from loadPrompt
function geturl(v,m){
	if(v==true){
		window.open(myUrl, "_blank");
		//$.prompt(myText, { callback: geturl , buttons: { Continue:true , Cancel:false } } ).remove();
		function(){jqiprompt.remove();}
	}
	if(v==false){
		//refreshes the page if cancel is clicked
		//window.location.reload();
		//$.prompt(myText, { callback: geturl , buttons: { Continue:true , Cancel:false } } ).remove();
		function(){jqiprompt.remove();}
	}
}*/

//loads the image gallery prompt with a prefix of galleryBox
function loadGalleryPopup(myHtml){
	$.prompt(myHtml, { buttons: { Close: false }, prefix: 'galleryBox' } );
}