document.write("<div id=\"EAFmdlPg\"><div class=\"EAFmdlCont\"><div class=\"EAFmdl\"><div class=\"EAFmdlBdy\">");
document.write("<center><table class=\"EAFMdlTbl\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"250\">");
document.write("<tr><td align=\"left\" rowspan=\"2\" valign=\"top\" width=\"10\" class=\"topLeftCorner\"><img src=\"/imgs/blank.gif\" width=\"10\" height=\"10\"></td>");
document.write("<td colspan=\"3\" align=\"right\"><table border=0 cellpadding=0 cellspacing=0 width=\"83\"><tr><td nowrap valign=\"middle\">");
document.write("<a href=\"JavaScript:hideEAFModal();\" class=\"EAFmdlClseWdw\">Close Window</a>&nbsp;</td><td width=\"13\"><a href=\"JavaScript:hideEAFModal();\" class=\"modalCloseWindow\"><img vspace=\"3\" hspace=\"0\" width=\"13\" height=\"13\" src=\"/imgs/vt/close.gif\" border=\"0\"></a></td></tr></table>");
document.write("</td><td  rowspan=\"2\" valign=\"top\"  width=\"10\" align=\"right\" class=\"topRightCorner\"><img align=\"middle\" src=\"/imgs/blank.gif\" width=\"10\" height=\"\10\"></td></tr><tr><td colspan=3><div id=\"EAFDIV\"></div></td></tr><tr><td align=\"left\"  class=\"botLeftCorner\" valign=\"top\" width=\"10\"><img src=\"/imgs/blank.gif\" width=\"10\" height=\"10\"></td><td colspan=\"3\"><img src=\"/imgs/blank.gif\" width=\"1\" height=\"8\"></td><td  valign=\"top\"  class=\"botRightCorner\" width=\"10\" align=\"right\"><img src=\"/imgs/blank.gif\" width=\"10\" height=\"5\"></td></tr></table></div></div></center></div></div></div>");


function doEmailAFriendAjax() {
var EAFCurrentSite = "";
var EAFCurrentDomain = document.domain;
var EAFCurrentURL =  escape(window.location.href);

var ajaxEAFRequest = null;  // The variable that makes Ajax possible!
var starter = new Date();	


if (EAFCurrentDomain.indexOf("ecruise.com") > 0) { EAFCurrentSite = "DO"; }
if (EAFCurrentDomain.indexOf("icruise.com") > 0) { EAFCurrentSite = "IC"; }
if (EAFCurrentDomain.indexOf("cruisecheap.com") > 0) { EAFCurrentSite = "CC"; }
if (EAFCurrentDomain.indexOf("cheapcaribbean.com") > 0) { EAFCurrentSite = "CH"; }
if (EAFCurrentDomain.indexOf("europecruises.com") > 0) { EAFCurrentSite = "EU"; }
if (EAFCurrentDomain.indexOf("hawaiicruiseoutlet.com") > 0) { EAFCurrentSite = "HCO"; }
if (EAFCurrentDomain.indexOf("alaskacruises.com") > 0) { EAFCurrentSite = "AK"; }

var EAFsendURL = "/common_library/emailFriend.php?site=" + EAFCurrentSite + "&url=" + EAFCurrentURL + "&timer=" + starter.getTime(); 




	try{
		// Opera 8.0+, Firefox, Safari
		ajaxEAFRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxEAFRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxEAFRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Please use the site with a recent browser.");
				return false;
			}
		}
	}
		
	
	// Create a function that will receive data sent from the server
ajaxEAFRequest.onreadystatechange = function thisone(){
 if(ajaxEAFRequest.readyState == 4){
   var EAFInfo = ajaxEAFRequest.responseText;
 
   document.getElementById('EAFDIV').innerHTML = EAFInfo;

}

}

	
	ajaxEAFRequest.open("GET",EAFsendURL, true);
	ajaxEAFRequest.send(null);


}

function hideEAFModal() {
document.getElementById('EAFmdlPg').style.display = "none";
}


function revealEAFModal() {
	doEmailAFriendAjax();
document.getElementById('EAFmdlPg').style.display = "block";
}

function replaceAll(text, strA, strB)
{
    while ( text.indexOf(strA) != -1)
    {
        text = text.replace(strA,strB);
    }
    return text;
}


function submitEAF(elm) {
	var error = false;
	var ajaxEAFRequest = null;  // The variable that makes Ajax possible!
	var EAFsendURL = "/common_library/emailFriend.asp";
	var EAFErrorString = "";
	var EAFparams = "formState=Submitted";


elm = document.EMAILAFRIEND;

if (elm.YourEmail.value == '') {
	EAFErrorString += "Please enter your email address, this will be used only to address email to your friend.\n";
	elm.YourEmail.focus();
	error = true;
}

if (elm.FriendsEmail.value == '') {
	EAFErrorString += "Please enter your friend's email address, this will be used only to address email to your friend.\n";
	error = true;
}


for(var i = 0; i < elm.length; i++)
{ EAFparams += "&" + elm[i].name + "=" + escape(elm[i].value);
} 



EAFparams = replaceAll(EAFparams,"%20", "|");



	
		try{
		// Opera 8.0+, Firefox, Safari
		ajaxEAFRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxEAFRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxEAFRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Please use the site with a recent browser.");
				return false;
			}
		}
	}
	
	
		// Create a function that will receive data sent from the server
ajaxEAFRequest.onreadystatechange = function thisone(){
 if(ajaxEAFRequest.readyState == 4){
   var EAFInfo = ajaxEAFRequest.responseText;
   document.getElementById('EAFDIV').innerHTML = EAFInfo;
	return false;

}

}

if (!error) {	
	ajaxEAFRequest.open("POST",EAFsendURL, true);
	ajaxEAFRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajaxEAFRequest.setRequestHeader("Content-length", EAFparams.length);
	ajaxEAFRequest.setRequestHeader("Connection", "close");
	
	ajaxEAFRequest.send(EAFparams);

} else {
	
	alert(EAFErrorString);
	}
	
	
	
	return false;
	}
