function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}



var newwindow;
function OPENWIN(url, name, width, height)
{
	newwindow=window.open(url, name, 'width=' + width + ',height=' + height + ', scrollbars=yes, top=150, left=150');
	if (window.focus) {newwindow.focus()}
}












function CALLAHAH(url, pageElement, callMessage) 
{
document.getElementById(pageElement).innerHTML = (
'<table style="border-collapse:collapse; width: 100%; height: 100%;"><tr><td style="text-align: center; vertical-align: middle;">' +
'<img src="http://www.froschvacations.com/images/global/loading.gif" />' + 
'</td></tr></table>'
); 


try { req = new XMLHttpRequest(); /* e.g Firefox*/ } catch(e) 
	{
	try	
		{ req = new ActiveXObject("Msxml2.XMLHTTP");  /* Some Versions IE */ } catch (e) 
		{
			try 
			{ req = new ActiveXObject("Microsoft.XMLHTTP"); /* Some Versions IE */ } catch (E) 
	  		{ req = falce; }
		}
	}

	req.onreadystatechange = function() {responseAHAH(pageElement);};
	req.open("GET",url,true);
	req.send(null);
}

function responseAHAH(pageElement) 
		{
	var output = '';
		if(req.readyState == 4) 
			{
			if(req.status == 200) 
				{
				output = req.responseText;
				document.getElementById(pageElement).innerHTML = output;
				}
			}
		}



function CALLSEARCH()
{
	document.getElementById('xssearch').style.display='block';
	document.getElementById('xssearchbg').style.display='block';
}

function CLOSESEARCH()
{	
	document.getElementById('xssearch').style.display='none';
	document.getElementById('xssearchbg').style.display='none';
}

function CALLPOPUP()
{
	document.getElementById('xspopup').style.display='block';
	document.getElementById('xspopupbg').style.display='block';
}

function CLOSEPOPUP()
{	
	document.getElementById('xspopup').style.display='none';
	document.getElementById('xspopupbg').style.display='none';
}




















/* ------ TOGGLE ITIN ------ */


var enablepersist="on";var collapseprevious="no";if (document.getElementById){document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}');document.write('</style>')}function getElementbyClass(classname){ccollect=new Array() ; var inc=0;var alltags=document.all? document.all:document.getElementsByTagName("*")
for (i=0; i<alltags.length;i++){if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]}}function contractcontent(omit){var inc=0;while (ccollect[inc]){if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none";inc++}}


function expandcontent(cid){if (typeof ccollect!="undefined"){if (collapseprevious=="yes")
contractcontent(cid);document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"}}




function revivecontent(){contractcontent("omitnothing");selectedItem=getselectedItem();selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++) document.getElementById(selectedComponents[i]).style.display="block"}function get_cookie(Name) { var search=Name + "=";var returnvalue="";if (document.cookie.length > 0) {offset=document.cookie.indexOf(search)
if (offset != -1) {offset += search.length
end=document.cookie.indexOf(";", offset);if (end == -1) end=document.cookie.length;returnvalue=unescape(document.cookie.substring(offset, end))}}return returnvalue;}function getselectedItem(){if (get_cookie(window.location.pathname) != ""){selectedItem=get_cookie(window.location.pathname)
return selectedItem}else ; return ""}function saveswitchstate(){var inc=0, selectedItem="";while (ccollect[inc]){if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|" ; inc++}  document.cookie=window.location.pathname+"="+selectedItem}function do_onload(){getElementbyClass("switchcontent") ; if (enablepersist=="on" && typeof ccollect!="undefined") ; 
revivecontent()}if (window.addEventListener) window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload
if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate



/* ------ TOGGLE STATEROOM DIAGRAMS ------ */

function showIt(layerName) { 
document.getElementById(layerName).style.display = 'block';
} 

function hideIt(layerName) { 
document.getElementById(layerName).style.display = 'none';
} 
function showCabin(cabin_id){
hideIt('diagram_cabin_'+cabin_id);
showIt('image_cabin_'+cabin_id);

}
function showDiagram(cabin_id){
hideIt('image_cabin_'+cabin_id);
showIt('diagram_cabin_'+cabin_id);
}

