var loaded = 0;
function PreLoad() {

var URL
URL="http://www.ambassadortravel.ca/"

if (document.images != null) {

clickme1 = new Image();
clickme1.src = URL + "images/menu/travel-portal.gif";
clickme1o = new Image();
clickme1o.src = URL + "images/menu/travel-portal-over.gif";
clickme2 = new Image();
clickme2.src = URL + "images/menu/specials.gif";
clickme2o = new Image();
clickme2o.src = URL + "images/menu/specials-over.gif";
clickme3 = new Image();
clickme3.src = URL + "images/menu/newsletter.gif";
clickme3o = new Image();
clickme3o.src = URL + "images/menu/newsletter-over.gif";
clickme4 = new Image();
clickme4.src = URL + "images/menu/testimonials.gif";
clickme4o = new Image();
clickme4o.src = URL + "images/menu/testimonials-over.gif";
clickme5 = new Image();
clickme5.src = URL + "images/menu/about.gif";
clickme5o = new Image();
clickme5o.src = URL + "images/menu/about-over.gif";
clickme6 = new Image();
clickme6.src = URL + "images/menu/contact.gif";
clickme6o = new Image();
clickme6o.src = URL + "images/menu/contact-over.gif";
clickme7 = new Image();
clickme7.src = URL + "images/menu/home.gif";
clickme7o = new Image();
clickme7o.src = URL + "images/menu/home-over.gif";

}

	loaded = 1;
}

function hiLite(imgDocID,imgObjName) {
if (document.images !=null) {
  if (loaded)
   document.images[imgDocID].src = eval(imgObjName + ".src")
  }
}

function popupNewsletter(winName,URL,height,width) {
 var popup = window.open(URL,winName,"height=" + height + ",width=" + width + ",left=28,top=25,status=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0");
 NewWindow = popup;
 NewWindow.focus();
}

    //Define global variables

	    var timerID = null;
		var timerOn = false;
		var timecount = 100;
		var what = null;
		var newbrowser = true;
		var check = false;

    	function init(){
    	//  alert ("Running Init");
          if (document.layers) {
                      //  alert ("Running Netscape 4");
                        layerRef="document.layers";
                        styleSwitch="";
                        visibleVar="show";
			screenSize = window.innerWidth;
			what ="ns4";


          }else if(document.all){
                      //  alert ("Running IE");
                        layerRef="document.all";
                        styleSwitch=".style";
                        visibleVar="visible";
			screenSize = document.body.clientWidth + 18;
			what ="ie";

		  }else if(document.getElementById){
                      //  alert ("Running Netscape 6");
                        layerRef="document.getElementByID";
                        styleSwitch=".style";
                        visibleVar="visible";
			what="moz";
		  
		  }else{
		  	//alert("Older than 4.0 browser.");
			what="none";
			newbrowser = false;
		  }
		  
 
		//window.status='status bar text to go here';
		check = true;
  	 	}


	// Turns the layers on and off
        function showLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="visible";
        			document.getElementById(layerName).style.display="block";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.display="block"');
                  }
		 }
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
		}

        function hideLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
        		else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="hidden";
        			document.getElementById(layerName).style.block="none";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.display="none"');
				}
        
        	}
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
        }


function hideAll(){
//	hideLayer('book');
//	hideLayer('tools');
	hideLayer('newsletter');
}


function startTime() {
	if (timerOn == false) {
    timerID=setTimeout( "hideAll()" , timecount);
    timerOn = true;
}
}

function stopTime() {
	if (timerOn) {
     clearTimeout(timerID);
     timerID = null;
     timerOn = false;
}
}

function onLoad(){
init();
}

 function popupTour(status,url) {
 
 var adWidth = 700;
 var adHeight = 423;

  if (screen) {
   var bottom = screen.availHeight;
   var right = screen.availWidth;
   var pos_x = parseInt((right- adWidth)/2) ;
   var pos_y = parseInt((bottom - adHeight)/2);
   } else {
   pos_x = 30;
   pos_y = 50;
  }
 
 if(status != 0) {
 if(popup != null) popup.focus(); 
 else { 
 var popup = open(url, "popup", "HEIGHT=" + adHeight + ",WIDTH=" + adWidth + ",left=" + pos_y + ",top=" + pos_y + ",status=1,scrollbars=no,toolbar=no,directories=no,menubar=no,location=no");
 popup_window = popup;
 }
 } else {
 if(popup_window != null) popup_window.close();
 }
 }
