/* 
==========================================
crystalcruises.com default javascripts
updated 3/17/04
==========================================
*/

// ##### Load style sheet #####
// document.write ('<link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.crystalcruises.com/css/ccDefault.css\">');
// document.write ('<link rel=\"stylesheet\" type=\"text/css\" media=\"print\" href=\"http://www.crystalcruises.com/css/ccPrint.css\">');

if (!document.getElementById) {
  document.write ('<table border=0 cellspacing=0 cellpadding=1 width=400 bgcolor=#cc0000><tr><td><table border=0 cellspacing=0 cellpadding=10 width=400 bgcolor=#ffffcc><tr><td><font face=verdana size=2 color=#cc0000><strong>Your browser is not supported by Crystal Cruises.</strong><br /><br />Crystalcruises.com requires a browser with a version number of 5 or higher. Please consider upgrading to any one of these browsers:<ul><li><a href=http://www.microsoft.com/windows/ie/default.asp>Microsoft Internet Explorer</a> (version 5 or higher)</li><li><a href=http://wp.netscape.com/download/>Netscape Navigator</a> (version 6 or higher)</a></li><li><a href=http://www.aol.com>AOL</a> (version 7 or higher)</li><li><a href=http://www.mozilla.org>Mozilla</a> (version 1.2 or higher)</li><li><a href=http://www.apple.com/safari>Safari</a> (version 1.1 or higher, Macintosh OSX only)</li></ul></font></td></tr></table></td></tr></table>	');
}

// ##### browser css bug fixes #####
// Fix IE/Mac bugs
//if (navigator.appName == "Microsoft Internet Explorer" && (navigator.platform.slice(0, 3) == "Mac")) 
//{document.write('<style type=\"text/css\">.macIeFix{display:block;} #rewardsControls {display:none;} .contentUL {width:400px;}</style>');}

// ##### Control resizeable fonts in non-IE browsers (these browsers allow more control over font size) #####
//if (navigator.appName != "Microsoft Internet Explorer")
//{document.write('<style type=\"text/css\">body {font-size:.8em;} table {font-size:1em;} a.more {font-size:1.1em;} a.breadcrumb {font-size:.8em;} .content_small {font-size:.7em;} .sidebarSubheader {font-size:1.1em;} .breadcrumbFont {font-size:.8em;} .footerLink {font-size:.8em;} .footerBar {font-size:1.1em;} .footnote {font-size:1em;} .searchSiteField {font-size:.7em;} #nav a {font-size:.85em;} .flyout a {font-size:.85em;} #tipsTools {font-size:.8em;} #tipsTools .contentSubheader {font-size:1.1em;} .button {font-size:1em;} .buttonSmall {font-size:.7em;} #frontdoor td div.frontdoorSmall {font-size:.8em;} #tabsHorz {font-size:.8em;} #press_contact div {font-size:.7em;} .flyout a:hover {width:165px;}</style>');}


// ##### Popup window #####
// Variables are the url of the popup file, the popup width and popup height 
function popupWindow(popUrl, popWidth, popHeight) {
day = new Date(); pageId = day.getTime();
eval("page" + pageId + " = window.open(popUrl, '" + pageId + "', 'toolbar=0,scrollbars=1,statusbar=0,menubar=0,resizable=1,width='+popWidth+',height='+popHeight+'');");
}

function popupPrintWindow(popUrl, popWidth, popHeight) {
day = new Date(); pageId = day.getTime();
eval("page" + pageId + " = window.open(popUrl, '" + pageId + "', 'toolbar=1,scrollbars=1,statusbar=0,menubar=1,resizable=1,width='+popWidth+',height='+popHeight+'');");
}

//if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.platform.slice(0,3) != "Mac")) {
//document.write ("<iframe id=\"iframeFixLayer\" src=\"javascript:false;\" frameBorder=\"0\" scrolling=\"no\"></iframe>");
//}

// ##### Navigation bar flyouts ##### 
//determine coordinates for flyouts and display
function flyoutNav(linkName, flyoutLayerName) {
var coordinates=new Object();
var x=0,y=0;
var o=document.getElementById(linkName);
x=FlyoutPos_getPageOffsetLeft(o);
y=FlyoutPos_getPageOffsetTop(o);
document.getElementById(flyoutLayerName).style.left = x+"px";
document.getElementById(flyoutLayerName).style.top = (y+22)+"px";

//fix windowed control/layer behavior in IE
if (navigator.appName == "Microsoft Internet Explorer" && navigator.platform.slice(0,3) != "Mac") {
    if (document.getElementById("iframeFixLayer") != null) {
        document.getElementById("iframeFixLayer").style.top = document.getElementById(flyoutLayerName).offsetTop;
        document.getElementById("iframeFixLayer").style.left = document.getElementById(flyoutLayerName).offsetLeft;
        document.getElementById("iframeFixLayer").style.width = document.getElementById(flyoutLayerName).offsetWidth;
        document.getElementById("iframeFixLayer").style.height = document.getElementById(flyoutLayerName).offsetHeight;
        document.getElementById("iframeFixLayer").style.zIndex = "2";
        document.getElementById("iframeFixLayer").style.display = "block";
    }
}
	
document.getElementById(flyoutLayerName).style.visibility = "visible";
}

//find left coordinate
function FlyoutPos_getPageOffsetLeft (el) {
var ol=el.offsetLeft;
while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
if (ol > 598) {ol = 598;}
return ol;
}

//find top coordinate
function FlyoutPos_getPageOffsetTop (el) {
var ot=el.offsetTop;
while((el=el.offsetParent) != null) { ot += el.offsetTop; }
return ot;
}

//turn off flyout on mouseOut
function flyoutHide(flyoutLayerName) {
document.getElementById(flyoutLayerName).style.visibility = "hidden";
if (navigator.appName == "Microsoft Internet Explorer" && navigator.platform.slice(0,3) != "Mac") {
	document.getElementById("iframeFixLayer").style.display = "none";
	}
}

//change background color on mouseOver
function menuColor(state, linkNumber) {
if (state == "on") {
document.getElementById(linkNumber).style.backgroundColor = "#333399";
document.getElementById(linkNumber).style.color = "#ffffff";
}
else {document.getElementById(linkNumber).style.backgroundColor = "#B5CEEF";}
}


// ##### Control browser status bar message #####
function statusOn(statusText) {
if (statusText == '') {window.status="Click for more information";}
else {window.status=statusText;}
}

function statusOff() {
window.status="";
}


// ##### How to Book navigation #####
function howtobookTab(tab) {
if (tab == "tab1") {
	document.getElementById('agent_tab1Layer').style.display = "block";
	document.getElementById('agent_tab2Layer').style.display = "none";
	document.getElementById('agent_tab3Layer').style.display = "none";	
}
else if (tab == "tab2") {
document.getElementById('agent_tab1Layer').style.display = "none";
document.getElementById('agent_tab2Layer').style.display = "block";
document.getElementById('agent_tab3Layer').style.display = "none";	
	}
else if (tab == "tab3") {
document.getElementById('agent_tab1Layer').style.display = "none";
document.getElementById('agent_tab2Layer').style.display = "none";
document.getElementById('agent_tab3Layer').style.display = "block";	
	}


}

function OpenLargeMapWindow(loc)
{
	hgt   = 540;
	wid   = 785;
	setup = 'width=' + wid + ',height=' + hgt + ',resizable=yes,toolbar=no,scrollbars=yes';
	pop   = window.open(loc,'largemap',setup);
	pop.moveTo((window.screen.width/2)-(wid/2), (window.screen.height/2)-(hgt/2));
	pop.focus();
}
