

var MouseIn="yellow";
var MouseOut="blue";
var MouseX;
var MouseY;
var y1 = 154;   // change the # on the left to adjuct the Y co-ordinate
var x1 = 300;   // change the # on the left to adjuct the width of info box.
var iTimeout;
var IE;
var oSource;
var Opera;


function SetupMouseCapture(){
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
  IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;
}



// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    MouseX = event.clientX + document.body.scrollLeft;
    MouseY = event.clientY + document.body.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    MouseX= e.pageX;
    MouseY= e.pageY;
  }  
  // catch possible negative values in NS4
  if (MouseX < 0){MouseX= 0}
  if (MouseY  < 0){MouseY  = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
//  document.Show.MouseX.value = tempX
//  document.Show.MouseY.value = tempY
  return true
}






function hideIt() {
  if (document.layers) {document.layers[oSource].visibility='hide';}
  else {document.getElementById(oSource).style.visibility='hidden';}
  
  
    if (document.layers){
  document.all[oSource].style.width =  0; 
  document.all[oSource].style.height =  0;
  }
  else {
  document.getElementById(oSource).style.width =  0;
  document.getElementById(oSource).style.height =  0;
  }

 // window.clearTimeout(iTimeout);
  
  }



function showIt(source) {
oSource=source;
if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1) {
     if (MouseX > (document.body.clientWidth - (x1+30))) {MouseX=MouseX-x1}
     if (MouseX < 0) {MouseX= 0}

     if (MouseY > document.body.scrollTop +(document.body.clientHeight - y1)) {MouseY=MouseY-y1}
     if (MouseY < 0) {MouseY= 0}

} else {
    if (MouseX > (window.innerWidth - (x1+30))) {MouseX=MouseX-x1}
    if (MouseX < 0) {MouseX= 0}

    if (MouseY > window.pageYOffset + (window.innerHeight - y1)) {MouseY=MouseY-y1}
    if (MouseY < 0) {MouseY= 0}
  }



  if (document.layers) { //Netscape 4
     myObj = eval('document.' + source);

    myObj.left =  MouseX+15;
    myObj.width =  x1;
    myObj.height =  154;
    myObj.top = MouseY;
    document.layers[source].visibility='show';
  }
  else if (navigator.userAgent.indexOf("Opera") != -1) { //Opera
   styleObj = eval('document.all.' + source);

    styleObj.style.pixelLeft =  MouseX+15;
    styleObj.style.pixelWidth =  x1;
    styleObj.style.pixelHeight =  154;
    styleObj.style.pixelTop = MouseY;
    styleObj.style.visibility='visible';

  }
  else if (document.all && !document.getElementById) { //IE 4
     myObj = eval('document.all.' + source);

    myObj.style.pixelLeft =  MouseX+15;
    myObj.style.pixelWidth =  x1;
    myObj.style.pixelHeight =  154;
    myObj.style.pixelTop = MouseY;
    myObj.style.visibility='visible';
  }
  else if (document.getElementById) { //Netscape 6 & IE 5
     myObj = document.getElementById(source);
    myObj.style.left =  MouseX+15;
    myObj.style.width =  x1;
    myObj.style.height =  154;


    myObj.style.top = MouseY;
    myObj.style.visibility='visible';
//alert(myObj.style.top +" " +myObj.style.left)

  }
  else {
     alert('This website uses DHTML. We recommend you upgrade your browser.');
  }
 }




function movein(which,where){
which.style.background=MouseIn;
if (document.all && !document.getElementById) {document.all[where].style.color=MouseOut}
else {
document.getElementById(where).style.color=MouseOut;}
}

function moveout(which,where){
which.style.background=MouseOut;
if (document.all && !document.getElementById) {document.all[where].style.color=MouseIn}
else {
document.getElementById(where).style.color=MouseIn;}
}



function setonclick(info){
	if (window.window4 && !window4.closed) {window4.location=info;}
	else {
        	window4=window.open(info,"ssRussia","height=400,width=700,status=no,scrollbars=no,titlebar=no,resizable=yes,toolbar=no,menubar=no,location=no");}
		window4.focus();
      		return false;
      		
}




function setonclickS(info){
	if (window.window4 && !window4.closed) {window4.location=info;}
	else {
        	window4=window.open(info,"ssRussia","height=400,width=700,status=no,scrollbars=yes,titlebar=no,resizable=yes,toolbar=no,menubar=no,location=no");}
		window4.focus();
      		return false;
      		
}



function displaymenu(pos){
menuString= "<table class=\"menutable\" border=\"2\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#808080\" width=\"100%\" bgcolor=\"#0000FF\">\
  <tr>\
    <td class=\"menu\" onclick=\"document.location.href='index.html'\" onmouseover=\"movein(this,'home"+pos+"')\" onmouseout=\"moveout(this,'home"+pos+"')\" width=\"5%\" align=\"center\">\
    <a id=\"home"+pos+"\" href=\"index.html\">Home</a></td>\
    <td class=\"menu\" onclick=\"document.location.href='Excursions.htm'\" onmouseover=\"movein(this,'Exc"+pos+"')\" onmouseout=\"moveout(this,'Exc"+pos+"')\" width=\"9%\" align=\"center\">\
    <a id=\"Exc"+pos+"\" href=\"Excursions.htm\">Moscow Tours</a></td>\
    <td class=\"menu\" onclick=\"document.location.href='daytrips.html'\" onmouseover=\"movein(this,'day"+pos+"')\" onmouseout=\"moveout(this,'day"+pos+"')\" width=\"13%\" align=\"center\">\
    <a id=\"day"+pos+"\" href=\"daytrips.html\">Moscow Day Trips</a></td>\
    <td class=\"menu\" onclick=\"document.location.href='Petersburg_Tours.php'\" onmouseover=\"movein(this,'pet"+pos+"')\" onmouseout=\"moveout(this,'pet"+pos+"')\" width=\"12%\" align=\"center\">\
    <a id=\"pet"+pos+"\" href=\"Petersburg_Tours.php\">Petersburg Tours</a></td>\
    <td class=\"menu\" onclick=\"document.location.href='golden.htm'\" onmouseover=\"movein(this,'gold"+pos+"')\" onmouseout=\"moveout(this,'gold"+pos+"')\" width=\"11%\" align=\"center\">\
    <a id=\"gold"+pos+"\" href=\"golden.htm\">The Golden Ring</a></td>\
    <td class=\"menu\" onclick=\"document.location.href='baikal.htm'\" onmouseover=\"movein(this,'baikal"+pos+"')\" onmouseout=\"moveout(this,'baikal"+pos+"')\" width=\"9%\" align=\"center\">\
    <a id=\"baikal"+pos+"\" href=\"baikal.htm\">Lake Baikal</a></td>\
    <td class=\"menu\" onclick=\"document.location.href='Adventure.htm'\" onmouseover=\"movein(this,'adv"+pos+"')\" onmouseout=\"moveout(this,'adv"+pos+"')\" width=\"7%\" align=\"center\">\
    <a id=\"adv"+pos+"\" href=\"Adventure.htm\">Adventure</a></td>\
    <td class=\"menu\" onclick=\"document.location.href='TravelRussia.html'\" onmouseover=\"movein(this,'north"+pos+"')\" onmouseout=\"moveout(this,'north"+pos+"')\" width=\"12%\" align=\"center\">\
    <a id=\"north"+pos+"\" href=\"TravelRussia.html\">The Russian North</a></td>\
    <td class=\"menu\" onclick=\"document.location.href=\'services.htm'\" onmouseover=\"movein(this,'serv"+pos+"')\" onmouseout=\"moveout(this,'serv"+pos+"')\" width=\"9%\" align=\"center\">\
    <a id=\"serv"+pos+"\" href=\"services.htm\">Travel Services</a></td>\
    <td class=\"menu\" onclick=\"document.location.href='contact.php?interest=General Inquiry'\" onmouseover=\"movein(this,'cont"+pos+"')\" onmouseout=\"moveout(this,'cont"+pos+"')\" width=\"6%\" align=\"center\">\
    <a id=\"cont"+pos+"\" href=\"contact.php?interest=General Inquiry\">Contact</a></td></tr></table>";
document.write(menuString);
}



function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


function GetSuitcase(where) {
   var ui=getCookie('Userid');
   if (ui == null) {
      alert("You are not logged in! ");
      return where;
   }
  return "suitcase.php?cd="+ui;
}



function showSuitcase() {
  if (document.layers) { //Netscape 4
     document.suitcase.height=208;
     document.layers['divform'].visibility='hide';
     document.layers['suitcase'].visibility='show';
  }
  else if (navigator.userAgent.indexOf("Opera") != -1) { //Opera
    styleObj = document.all.suitcase;
    document.all.divform.style.visibility='hidden';
    styleObj.style.pixelHeight =  208;
    styleObj.style.visibility='visible';

  }
  else if (document.all && !document.getElementById) { //IE 4
    myObj = document.all.suitcase;
document.all.divform.visibility = 'hidden';
    myObj.style.visibility='visible';
    myObj.style.pixelHeight =  208;
  }
  else if (document.getElementById) { //Netscape 6 & IE 5
       document.getElementById('divform').style.visibility='hidden';
     myObj = document.getElementById('suitcase');
    myObj.style.height =  208;
    myObj.style.visibility='visible';

  }
  else {
     alert('This website uses DHTML. We recommend you upgrade your browser.');
  }
 }




function hideSuitcase() {
  if (document.layers) {
      document.layers['suitcase'].visibility='hide';
      document.layers['divform'].visibility='show';
  } else {
    document.getElementById('suitcase').style.visibility='hidden';
    document.getElementById('divform').style.visibility='visible';
  }
  
  
    if (document.layers){
  document.all['suitcase'].style.height =  0;
  }
  else {
  document.getElementById('suitcase').style.width =  0;
  document.getElementById('suitcase').style.height =  0;
  }

 // window.clearTimeout(iTimeout);
  
  }


function LogOut() {
      deleteCookie('Userid', '/', 'firebirdtravel.com') 
    //  hideSuitcase();
   return this.location;
       }



function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}





function additem(tid,clid){
  if (clid == null) {
     alert("You must be logged in to pack a suitcase!");
     return;
     }
  info="additem.php?cd=" + clid + "&Tourid=" + tid;
   if (window.window4 && !window4.closed) {window4.location=info;}
	else {
        	window4=window.open(info,"ssRussia","height=520,width=480,status=no,scrollbars=no,titlebar=no,resizable=yes,toolbar=no,menubar=no,location=no");}
		window4.focus();
      		return false;
      		
}


function subitem(clid){
  info="subitem.php?cd=" + clid ;
   if (window.window4 && !window4.closed) {window4.location=info;}
	else {
        	window4=window.open(info,"ssRussia","height=380,width=380,status=no,scrollbars=no,titlebar=no,resizable=yes,toolbar=no,menubar=no,location=no");}
		window4.focus();
      		return false;

}



function createRequestObject() {
  
  FORM_DATA = new Object();
    // The Object ("Array") where our data will be stored.
  
  separator = ',';
    // The token used to separate data from multi-select inputs
  
  query = '' + this.location;
    
  
    // Get the current URL so we can parse out the data.
    // Adding a null-string '' forces an implicit type cast
    // from property to string, for NS2 compatibility.
    
  query = query.substring((query.indexOf('?')) + 1);
    // Keep everything after the question mark '?'.
    
    
  
  if (query.length < 1) { return false; }  // Perhaps we got some bad data?
  
  keypairs = new Object();
  numKP = 1;
    // Local vars used to store and keep track of name/value pairs
    // as we parse them back into a usable form.
    
  while (query.indexOf('&') > -1) {
    keypairs[numKP] = query.substring(0,query.indexOf('&'));
    query = query.substring((query.indexOf('&')) + 1);
    numKP++;
      // Split the query string at each '&', storing the left-hand side
      // of the split in a new keypairs[] holder, and chopping the query
      // so that it gets the value of the right-hand string.
  }

  keypairs[numKP] = query;
    // Store what's left in the query string as the final keypairs[] data.
  
  for (i in keypairs) {
    keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
      // Left of '=' is name.
    keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
      // Right of '=' is value.
    while (keyValue.indexOf('+') > -1) {
      keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
        // Replace each '+' in data string with a space.
    }
    
    keyValue = unescape(keyValue);
      // Unescape non-alphanumerics
      
     
      
      
    if (FORM_DATA[keyName]) {
      FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
        // Object already exists, it is probably a multi-select input,
        // and we need to generate a separator-delimited string
        // by appending to what we already have stored.
    } else {
      FORM_DATA[keyName] = keyValue;
        // Normal case: name gets value.
    }
  }

  return FORM_DATA;
}




