// JavaScript Document

$(document).ready(function(){
//Start JQuery Code

	
	//Outside Links
	$("a.target").click(function(){
		window.open($(this).attr("href"));
		return false;
	});	
	
	$("a.intermap").click(function(){
		mapInterface();
		return false;
	});	

	$("a#opt-in").click(function(){
		dcfPopup();
		return false;
	});
	
	$("a#location").click(function(){
		directionsPopup();
		return false;
	});
	
	$("a#privacy").click(function(){
		privacyPopup();
		return false;
	});	
	
	$("a.gatarget, a.booking, a#checkroom").click(function(){
		window.open($(this).attr("href"));
		ga_url = $(this).attr("href").replace("http://www.hamiltonhoteldc.com","");
	  	pageTracker._trackPageview(ga_url);		
		return false;
	});	

	//sIFR
	sIFRloader();
	
//End JQuery Code
});

/* Replacement calls. Please see documentation for more information. */
function sIFRloader() {
	if(typeof sIFR == "function"){
	
	// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:"p.wait", sFlashSrc:"user-styles/garamond_pro.swf", sColor:"#211215", sBgColor:"#ece9d8", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:"textalign=center&offsetTop=0&offsetLeft=0"}));
		sIFR.replaceElement(named({sSelector:"p.call", sFlashSrc:"user-styles/garamond_pro.swf", sColor:"#802007", sBgColor:"#ece9d8", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:"textalign=center&offsetTop=0&offsetLeft=0"}));	
		sIFR.replaceElement(named({sSelector:"p.call_zh", sFlashSrc:"user-styles/garamond_pro.swf", sColor:"#802007", sBgColor:"#ece9d8", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:"textalign=center&offsetTop=0&offsetLeft=0"}));		
		sIFR.replaceElement(named({sSelector:"p.call_de", sFlashSrc:"user-styles/garamond_pro.swf", sColor:"#802007", sBgColor:"#ece9d8", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:"textalign=center&offsetTop=0&offsetLeft=0"}));			
	};	
};


//Hamilton Crowne Site Functions
// Map popup
function mapInterface() {
newWin=window.open("http://www.hamiltonhoteldc.com/map/index.html","form_window1","resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=800,height=460,top=5,left=10");
newWin.focus();
if (newWin.opener == null) newWin.opener = self;
}
// directions popup
function directionsPopup() {
newWin=window.open("http://www.hamiltonhoteldc.com/popup-directions.html","form_window2","resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=617,height=610,top=0,left=0");
newWin.focus();
if (newWin.opener == null) newWin.opener = self;
}
// privacy policy popup
function privacyPopup() {
newWin=window.open("http://www.hamiltonhoteldc.com/popup-privacy.html","form_window3","resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=617,height=610,top=0,left=0");
newWin.focus();
if (newWin.opener == null) newWin.opener = self;
}
// map popup
function mapPopup() {
newWin=window.open("http://www.hamiltonhoteldc.com/popup-map.html","form_window3","resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=617,height=610,top=0,left=0");
newWin.focus();
if (newWin.opener == null) newWin.opener = self;
}
// DCF popup
function dcfPopup() {
newWin=window.open("http://www.magnetmail.net/actions/subscription_form_IHR_hamdc.cfm","form_window4","resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=458,height=610,top=0,left=0");
newWin.focus();
if (newWin.opener == null) newWin.opener = self;
}