
function newWin(url,wName,attributes) { 
     var newWindow = window.open(url,wName,attributes); 
}
	var NS4 = (document.layers) ? true : false;
	var IE4 = (document.all) ? true : false;
	var NS6 = (document.getElementById && !IE4) ? true : false;
	var NS4MAC = NS4 && (navigator.appVersion.indexOf("Macintosh") > -1);
	//<link rel="stylesheet" href="css/main_pc.css" type="text/css">
	if (IE4) {
		document.write('<link href="css/main_pc.css" rel="stylesheet" type="text/css" />');
		document.write('<link href="../css/main_pc.css" rel="stylesheet" type="text/css" />');
	} else if(NS4 || NS6){
		document.write('<link href="css/main_mc.css" rel="stylesheet" type="text/css" />');
		document.write('<link href="../css/main_mc.css" rel="stylesheet" type="text/css" />');
	} else{
		document.write('<link href="css/main_pc.css" rel="stylesheet" type="text/css" />');
		document.write('<link href="../css/main_pc.css" rel="stylesheet" type="text/css" />');
	}
	
	if (!NS4) {
	
	document.write("<style>\n");
    document.write(".toggleDisplay\n");
    document.write("{\n");
    document.write("display: none\n"); 
    document.write("}\n");
    document.write(".toggleVisibility\n");
    document.write("{\n");
    document.write("visibility: hidden\n"); 
    document.write("}\n");
    document.write("</style>\n");
	
	}

	function ImgTopLeft(imgName) {
	
	  var img = document.images[imgName];
	 
		if (NS4) {
		  imgXfromLeft = img.x;
		  imgYfromTop = img.y;
		} 
		else {
		  imgXfromLeft = IeImgXfromLeft(img);
		  imgYfromTop = IeImgYfromTop(img);
		}
		// -- Need to check NS6 equivalents
		
    return new point(imgYfromTop, imgXfromLeft);
	
	}
	
	function IeImgXfromLeft(img) {
		x = img.offsetLeft;
		tempEl = img.offsetParent;
		while (tempEl != null) {
		  x += tempEl.offsetLeft;
		  tempEl = tempEl.offsetParent;
		}
		return x;
  }
  
	function IeImgYfromTop(img) {
		y = img.offsetTop;
		tempEl = img.offsetParent;
		while (tempEl != null) {
		  y += tempEl.offsetTop;
		  tempEl = tempEl.offsetParent;
	  }
	  return y;
	}
	
	function point(top, left) {
	  this.top = top;
	  this.left = left;
	}

	function setVisibility(name, tf) {
	
		var obj=getLayer(name);
		if (obj==null) return;
		if (NS4) {
			return;
		} else if (IE4 || NS6) {
			obj.style.visibility = ((tf) ? "visible" : "hidden");
		} else {
			// -- nothing
		}
		return;
	}
	
	function setDisplay(name, val) {
	
		if (IE4 || NS6) {
			
			var obj=getLayer(name);
			if (obj==null) return;
			obj.style.display = val;
	
		} else if (NS4) {
	    return;
		}
	
	}
	
	function getDisplay(name) {
	
		// -- Important -- assumes only two settings for display
		//    block or none. Setting of "none" via stylesheet during page load
		//    causes return of "" from obj.style.display, which produces errors
		
		var obj=getLayer(name);
		if (obj==null) return "";
	
		if (IE4 || NS6) {
			return ((obj.style.display=="block") ? "block" : "none");
		} else if (NS4) {
			return "";
		}
	}
	
	function getLayer(name) {
		
		var obj = null;

		if (NS4) {
		  return;
			// -- later
			/*for (var i = 0; i < document.layers.length; i++) {
				var testObj = docment.layers[i];
				if (name==testObj.id) {
					obj = testObj;
					break;
				}
			}*/
		} else if (NS6) {
		  var sEval = "document.getElementById(" + "\"" + name + "\"" + ")";
			if (eval(sEval)) obj = eval(sEval);
		} else if (IE4) {
		  var sEval = "document.all." + name;
			if (eval(sEval)) obj = eval(sEval);
		} else {
			// -- nothing
		}
		return obj;
	}
  
    function getImage(name) {
    
      name=name.toLowerCase();
      for (var i=0; i<= document.images.length; i++) {
        var test = document.images[i];
        if (test.name.toLowerCase()==name) return test;
      }
      return null;
    }
    
    function setSelect(selList, val) {
      val = val.toString().toLowerCase();
      for (var i = selList.options.length - 1; i >= 0; --i) {
        if (val == selList.options[i].value.toLowerCase()) { 
          if (selList.selectedIndex != i) selList.selectedIndex = i;
          i=-1;
        }
      }
    }
    
    function h(s) {
	  if (NS4) window.alert("Got here: " + s);
	}


	function cbePopup(link) {
		var windowW=770;
		var windowH=340;
		var windowX=30;
		var windowY=150;
		
		s = "width="+windowW+",height="+windowH+",scrollbars=yes,resizable=yes";
		mywin = window.open(link ,'popup', s);	
	}

	<!--  function to popup the applevac.com hotel info -->
	function displayHotel(index)
	{
	var windowW=770
	var windowH=340
	var windowX=30
	var windowY=150
	
	s = "width="+windowW+",height="+windowH+",scrollbars=yes,resizable=yes";
	mywin = window.open(url_to_hotelinfo + index,"popHotel",s);
	mywin.focus();
	}	

	function infoPopup(link) {
		var windowW=770;
		var windowH=340;
		var windowX=30;
		var windowY=150;
		
		s = "width="+windowW+",height="+windowH+",scrollbars=yes,resizable=yes";
		mywin = window.open(link ,'info', s);	
	}
	
<!--  function to popup the connection details for a flight -->
function displayFlight(index)
{
var windowW=770
var windowH=340
var windowX=30
var windowY=150

s = "width="+windowW+",height="+windowH+",scrollbars=yes,resizable=yes";
mywin = window.open('' ,'popup', s);
var source_xml = document.booking.booking_state.value;

mywin.focus();

mywin.document.writeln("<HTML><HEAD><TITLE>Retrieving...</TITLE></HEAD><BODY>");
mywin.document.writeln("<FORM NAME=connection METHOD=post ACTION=popups/connection_details.jsp>");
mywin.document.writeln("<TABLE BORDER=0 CELLSPACING=1 ALIGN=CENTER>");
mywin.document.writeln("	<TR BGCOLOR=WHITE><TD ALIGN=CENTER>");
mywin.document.writeln("		<IMG SRC=\"" + ui_path +"/images/banner_apple_vacations.gif\">");
mywin.document.writeln("	</TD></TR>");
mywin.document.writeln("	<TR BGCOLOR=WHITE><TD ALIGN=CENTER><BR>");
mywin.document.writeln("		<FONT SIZE=3 FACE=ARIAL COLOR=BLUE><B>Checking for your flight information...</font>");
//mywin.document.writeln("	<BR><BR><IMG SRC=\"resources/anim_please_wait.gif\">");
mywin.document.writeln("	<BR>&nbsp");
mywin.document.writeln("	</TD></TR>");
mywin.document.writeln("</TABLE>");
mywin.document.writeln("<INPUT TYPE=hidden NAME=ui_path VALUE=\"" + ui_path +"\">");
mywin.document.writeln("<INPUT TYPE=hidden NAME=info VALUE=\"\">");
mywin.document.writeln("<INPUT TYPE=hidden NAME=node_id VALUE=\"" + index + "\">");
mywin.document.writeln("<INPUT TYPE=hidden NAME=flights_xml VALUE=\"" + source_xml + "\">");
mywin.document.writeln("<INPUT TYPE=hidden NAME=xsl VALUE=\"flight_details_html_xslt\">");
mywin.document.writeln("<\/FORM>");
mywin.document.writeln("<SCRIPT language=javascript><!-- "); 
mywin.document.writeln("  document.forms[0].submit(); ");
mywin.document.writeln(" --><\/SCRIPT>");
mywin.document.writeln("<\/BODY><\/HTML>");

}
	
<!--  function to select a new travel agent -->
function fta()
{

mywin = window;
var myform = document.custom;
if (myform == null) myform = document.booking;
var booking_state = myform.booking_state.value;
var return_to = myform.return_to.value;

mywin.focus();

mywin.document.writeln("<HTML><HEAD><TITLE>Retrieving...</TITLE></HEAD><BODY>");
mywin.document.writeln("<FORM METHOD=post ACTION=\"" + url_to_fta + "\">");
mywin.document.writeln("<INPUT TYPE=hidden NAME=booking_state VALUE=\"" + booking_state + "\">");
mywin.document.writeln("<INPUT TYPE=hidden NAME=return_to VALUE=\"" + return_to + "\">");
mywin.document.writeln("<INPUT TYPE=hidden NAME=ui_path VALUE=\"" + ui_path + "\">");
mywin.document.writeln("<\/FORM>");
mywin.document.writeln("<SCRIPT language=javascript><!-- "); 
mywin.document.writeln("  document.forms[0].submit(); ");
mywin.document.writeln(" --><\/SCRIPT>");
mywin.document.writeln("<\/BODY><\/HTML>");

}

function writit(text,id)

{
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		text2 = '<P id="msg1">' + text + '</P>;';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}

function msg_show(fl) {
/*There is a <div id="msg1"></div> on every page wich is a placeholder for the message generated in this function. The parametr "f1" transfers through the link containing msg_show(fl) funtion on the page*/

/*var strMsg1 = document.getElementById('msg1');
 if (fl=='1'){
  writit('GOGO Vacations booking engine opens in new window!','msg1');
  strMsg1.style.visibility = 'visible';
  strMsg1.style.display = 'block';
  setTimeout("document.getElementById('msg1').style.visibility = 'hidden';document.getElementById('msg1').style.display = 'none'", 2500)
 }*/
}
