//avoid all pages from being framed
if (top != self) {
    top.location.href = location.href;
}

//Creation of image codes table
var codeArray = new Array( );
codeArray[codeArray.length] = {value:"3CI"+"L34"+"IH2"};
codeArray[codeArray.length] = {value:"CD5"+"423"+"FGR"};
codeArray[codeArray.length] = {value:"ADA"+"T17"+"FGR"};
codeArray[codeArray.length] = {value:"AC2"+"2AA"+"FIR"};
codeArray[codeArray.length] = {value:"8C2"+"2BB"+"ER2"};

function OnLoad()
{
   var hrefString = window.location.href.toLowerCase();
   var hrefColor  = "#FF0000";
   
   if (hrefString.substring(hrefString.length - 8, hrefString.length) == "riga.com"  || 
       hrefString.substring(hrefString.length - 9, hrefString.length) == "riga.com/" || 
       hrefString.indexOf("default.asp") > -1)
   {
      document.getElementById("mindex").style.color= hrefColor;
      document.getElementById("findex").style.color= hrefColor;
   }else if (hrefString.indexOf("arrive.asp") > -1)
   {
      document.getElementById("marrive").style.color= hrefColor;
      document.getElementById("farrive").style.color= hrefColor;
   }else if (hrefString.indexOf("accommodation.asp") > -1)
   {
      document.getElementById("maccommodation").style.color= hrefColor;
      document.getElementById("faccommodation").style.color= hrefColor;
   }else if (hrefString.indexOf("around.asp") > -1)
   {
      document.getElementById("maround").style.color= hrefColor;
      document.getElementById("faround").style.color= hrefColor;
   }else if (hrefString.indexOf("to_do.asp") > -1)
   {
      document.getElementById("mto_Do").style.color= hrefColor;
      document.getElementById("fto_Do").style.color= hrefColor;
   }else if (hrefString.indexOf("photos.") > -1)
   {
      document.getElementById("fphotos").style.color= hrefColor;
   }else if (hrefString.indexOf("words.asp") > -1)
   {
      document.getElementById("fwords").style.color= hrefColor;
   }else if (hrefString.indexOf("latvia.asp") > -1 || 
             hrefString.indexOf("in-latvia.com") > -1 ||
             hrefString.indexOf("in-latvia.com/") > -1)
   {
      document.getElementById("mLatvia").style.color= hrefColor;
      document.getElementById("fLatvia").style.color= hrefColor;
   }

   SearchQuery();
}

var browseWin1, browseWin2; //two active subwindows so user can compare
function OpenBrowseOld(theURL)
{
  if (browseWin2 && !browseWin2.closed) {
     browseWin2.close();
  }
  browseWin2 = browseWin1;

	var theTitle  = theURL;   /* nothing interesting yet */
  var winWidth  = screen.availWidth;
  var winHeight = (screen.availHeight / 3) * 2;
  /* winLeft  = screen.availLeft useful when taskbar in vertical but property only in NN4+ */ 
		
  var winSettings ='height='+winHeight+',width='+winWidth+',top=0,left=0,toolbar=yes,location=no,scrollbars=yes,resizable=yes,titlebar=no';

  browseWin1= window.open("", "_blank", winSettings);
  browseWin1.document.write("<html><head>"+
					"<title>"+theTitle+"</title>" +
					"<link rel=\"stylesheet\" href=\"assets/in-Riga.css\" type=\"text/css\"></head>"+
					"<body class=\"bodyFrame\">" +
				   "<div class=\"bodyFrame\">" +
							  "<strong>" + theURL + "</strong><br /><br />" +
				  	  "Do you like this link about Riga? Send me your comments!" +
					    "<a href=\"feedback.aspx?link="+ theURL +"\" style=\"font-size:9px; margin-left:3em;\">Feedback</a>"+
    			  "<a href=\"javascript:top.location.replace('" + theURL + "');\" style=\"font-size:9px\">No Frame</a>"+
			  		  "<a href=\"javascript:\" onclick=\"window.close()\" style=\"font-size:9px\">Close</a>"+
					  "</div>"+
					  "<iframe src=\""+ theURL +"\" height=\"100%\" width=\"100%\"  name=\"info\">"+
					    "Seems that your browser does not support iframes, please go to to: <br />" +
					    "<a href=\""+ theURL +"\"><br />" +
					    "to visit the link" +
					  "</iframe>" +
//Check what will happen with Google Analitics if no file???
					  "<script type=\"text/javascript\" src=\"http://www.google-analytics.com/urchin.js\">"+
            "</script>" +
            "<script type=\"text/javascript\">" +
            "_uacct = \"UA-274111-1\";" +
            "urchinTracker();" +
            "</script>" +
					"</body></html>");
		browseWin1.document.close();

}

//Less parameter better for Google Search and time to load
function OpenBrowse(theURL)
{
  if (browseWin2 && !browseWin2.closed) {
     browseWin2.close();
  }
  browseWin2 = browseWin1;

	var theTitle  = theURL; /* nothing interesting yet */
  var winWidth  = screen.availWidth;
  var winHeight = (screen.availHeight / 6) * 5;
  /* winLeft  = screen.availLeft useful when taskbar in vertical but property only in NN4+ */ 
		
  var winSettings ='height='+winHeight+',width='+winWidth+',top=0,left=0,toolbar=yes,location=no,scrollbars=yes,resizable=yes,titlebar=no';

  browseWin1= window.open("", "_blank", winSettings);
  browseWin1.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">"+
          "<html><head>"+
					"<title>" + theTitle + "</title>" +
					"<link rel=\"stylesheet\" href=\"assets/in-Riga.css\" type=\"text/css\"></head>" +
					"<frameset rows=\"12%, 88%\">" +
							"<frame src=\"frame_top.aspx?link=" + theURL + "\" name=\"RigaHead\" marginwidth=\"0\" scrolling=\"no\" frameborder=\"0\" />" + 
					    "<frame src=\"" + theURL + "\" name=\"RigaInfo\" marginwidth=\"0\" scrolling=\"yes\" frameborder=\"0\" />" + 
              "<noframes>"+
					       "Seems that your browser does not support FRAMES, please go to: " + theURL + " to visit the link" +
					    "</noframes>" +
					"</frameset></html>");
		browseWin1.document.close();
}

function OpenBrowsePop(theURL)
{
  if (browseWin2 && !browseWin2.closed) {
     browseWin2.close();
  }
  browseWin2 = browseWin1;

	var theTitle  = theURL; /* nothing interesting yet */
  var winWidth  = screen.availWidth;
  var winHeight = (screen.availHeight / 3) * 2;
  /* winLeft  = screen.availLeft useful when taskbar in vertical but property only in NN4+ */ 
		
  var winSettings ='height='+winHeight+',width='+winWidth+',top=0,left=0,toolbar=yes,location=no,scrollbars=yes,resizable=yes,titlebar=no';

  browseWin1= window.open("", "_blank", winSettings);
  browseWin1.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">"+
          "<html><head>"+
					"<title>" + theTitle + "</title>" +
					"<link rel=\"stylesheet\" href=\"assets/in-Riga.css\" type=\"text/css\"></head>" +
					"<frameset rows=\"25%, 75%\">" +
							"<frame src=\"frame_top.aspx?org=pop&link=" + theURL + "\" name=\"RigaHead\" marginwidth=\"0\" scrolling=\"no\" frameborder=\"0\" />" + 
					    "<frame src=\"" + theURL + "\" name=\"RigaInfo\" marginwidth=\"0\" scrolling=\"yes\" frameborder=\"0\" />" + 
              "<noframes>"+
					       "Seems that your browser does not support FRAMES, please go to: " + theURL + " to visit the link" +
					    "</noframes>" +
					"</frameset></html>");
		browseWin1.document.close();
}

var photoWin;
function OpenPhoto(theURL, theTitle, theWidth, theHeight)
{
  if (photoWin && !photoWin.closed) {
     photoWin.close()
  }
  
  var availHeight = screen.availHeight - 50;  //discount for Windows taskbar
		
  var winWidth  = (screen.availWidth >= theWidth ) ? theWidth : screen.availWidth;
  var winHeight = (availHeight       >= theHeight) ? theHeight : availHeight;
  var winLeft   = (screen.availWidth-winWidth)/2;
		
  var winSettings ='height='+winHeight+',width='+winWidth+',top=0,left='+winLeft+',toolbar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no';
      
  photoWin = window.open(theURL, "_blank", winSettings);

  /*
    photoWin.document.write("<html><head><title>"+theTitle+"</title></head><body>" +
       "<img src=\""+theURL+ "\" width=\""+theWidth+ "\" height=\""+theHeight+ "\" name=\"photo\""+
       " onclick=\"javascript:photo.height*=2;photo.width*=2\" "+
       " ondblclick=\"javascript:photo.height/=2;photo.width/=2\">"+
					  "</body></html>");
		  photoWin.document.close();
  */
}

var mapWin1, mapWin2; //two active subwindows so user can compare
function OpenMap(theAddress)
{
  if (mapWin2 && !mapWin2.closed) {
     mapWin2.close();
  }
  mapWin2 = mapWin1;

  var winWidth  = 600;
  var winHeight = 600;
  var winLeft   = (screen.availWidth-winWidth)/2;
		
  var winSettings ='height='+winHeight+',width='+winWidth+',top=0,left='+winLeft+',toolbar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no';
      
  mapWin1 = window.open("http://www.118.lv/karte?lang=en&isearch=" + theAddress, 
                        "_blank", winSettings);
}

//Write the map icon and the link to open the window with the map
function WriteMap(theAddress){
   document.write("<a href=\"javascript:\" onclick=\"OpenMap('" + theAddress + "')\" >");
   document.write("<img src=\"assets/images/icon_Map.gif\" width=\"25\" height=\"10\" alt=\"Check the Location in the Map\" /></a>");
}

function WriteEM(user, domain){

   document.write('<a href=\"');
   document.write('mailto:');
   document.write(user + '@' + domain + '\">');
   document.write(user + '@' + domain + '</a>');
}

function WriteBrokenLink(link){
//Make a script to report a broken link and add it to all the links so a visitor can report broken links easily and you get feedback and automaintenance (limit the number by IP)
}

// ADD TO FAVOURITES: FIRST STEP
function AddFavour(lang){
var url=window.location;
var title;

   if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
	  switch (lang.toLowerCase()){
	  case 'es':
		    title = "In-Riga.com Guia de viaje";
		 break;
	  case 'it':
      title = "In-Riga.com (Lettonia)";
		 break;
   default:
		    title = "In-Riga.com Guide (Latvia)";
	  }
      window.external.AddFavorite(url,title);
   }
   else {
      if(navigator.appName == "Netscape") 
      alert ("Press Crtl+D to add to your Bookmarks");
   }
}

// Contact Us (First Step)
function ContactUs(lang){
var subjMsg;
var bodyMsg;

   switch (lang.toLowerCase()){
   case 'es':
	     subjMsg = "Informacion sobre Riga.";
       bodyMsg = "Contact Details"; 
       bodyMsg += "%0D%0A"
	     bodyMsg += "Name: ";
       bodyMsg += "%0D%0A"
	     bodyMsg += "Email: ";
       bodyMsg += "%0D%0A"
	     bodyMsg += "Country: "; 
       bodyMsg += "%0D%0A"
	     bodyMsg += "Telephone: ";
       bodyMsg += "%0D%0A"
       bodyMsg += "Comments/Question: ";  
       break;
   case 'it':
       subjMsg = "  .";
       bodyMsg = "Contattaci Details"; 
       bodyMsg += "%0D%0A"
	     bodyMsg += "Name: ";
       bodyMsg += "%0D%0A"
	     bodyMsg += "Email: ";
       bodyMsg += "%0D%0A"
	     bodyMsg += "Country: "; 
       bodyMsg += "%0D%0A"
	     bodyMsg += "Telephone: ";
       bodyMsg += "%0D%0A"
       bodyMsg += "Comments/Question: ";  
	  break;
   default:
       subjMsg = "Information request about Riga.";
       bodyMsg = "CONTACT DETAILS"; 
       bodyMsg += "%0D%0A"
       bodyMsg += "Name: ";
       bodyMsg += "%0D%0A"
	     bodyMsg += "Surname: ";
       bodyMsg += "%0D%0A"
	     bodyMsg += "Email: ";
       bodyMsg += "%0D%0A"
	     bodyMsg += "Telephone(Country prefix): ";
       bodyMsg += "%0D%0A"
       bodyMsg += "Comments/Question: ";  
   }
   window.location = "mailto:"+"feedbacks"+"@"+"in-riga.com"+"?subject="+subjMsg+"&body="+bodyMsg;
}

// Feedback about Rent Riga page (First Step)
function Feedback(lang){
var subjMsg;
var bodyMsg;

   switch (lang.toLowerCase()){
   case 'es':
      subjMsg = "Sugerencia sobre In-Riga.com";
      bodyMsg = "Por favor, escribe aqui tu sugerencia. Gracias por mejorar este website.";
      break;
   case 'it':
   default:
      subjMsg = "In-Riga.com Feedback";
      bodyMsg  = "Hi, dear visitor!"
      bodyMsg += "In-Riga.com Team will be very happy to hear from your suggestions."
      bodyMsg += "%0D%0A"
      bodyMsg += "Thanks for make this website better.";
      bodyMsg += "%0D%0A"
      bodyMsg += "Please, write below your feedback and/or website improvement suggestion:"
      bodyMsg += "%0D%0A"
   }
   window.location = "mailto:"+"feedbacks"+"@"+"in-riga.com"+"?subject="+subjMsg+"&body="+bodyMsg;
}

// EMAIL LINK TO FRIEND: FIRST STEP
function EmailLink(lang){
var subjMsg;

   switch (lang.toLowerCase()){
   case 'es':
	  subjMsg = "Mira este link con información sobre Riga";
      break;
   case 'it':
   default:
      subjMsg = "I thought this link with information about Riga might interest you.";
   }
   window.location = "mailto:"+"?subject="+ subjMsg + "&body="+ document.title + "%0D%0A  " + window.location;
}

//
function GetHTMLSocialBook(numLinks)
{
   var arrayLinks = [["Del.icio.us", "del.icio.us/post?url="],
                     ["Digg.com",    "digg.com/submit?phase=2&url="],
                     ["Reddit.com",  "reddit.com/submit?url="],
                     ["Furl.net",  "www.furl.net/storeIt.jsp?u="],
                     ["Shadows.com",  "www.shadows.com/features/tcr.htm?url="],
                     ["Y! MyWeb",  "myweb2.search.yahoo.com/myresults/bookmarklet?u="],
                     ["Blinkbits", "www.blinkbits.com/bookmarklets/save.php?v=1&source_url="],
//                     ["Spurl", "ttp://www.spurl.net/spurl.php?url="],
                     ["StumbleUpon",  "www.stumbleupon.com/submit?url="],
                     ["PreFound",  "www.prefound.com/submit?url="],
                     ["Technorati","technorati.com/faves?sub=addfavbtn&amp;add="],
                     ["LinkAGoGo","www.linkagogo.com/go/AddNoPopup?url="]];

   var iLink= Math.floor(Math.random() * arrayLinks.length);
   for (var i=0; i< numLinks; i++)
   {
      document.write("<a href=\"http://" + 
                  arrayLinks[iLink][1] + window.location + 
                  "\" title=\"Let people know Riga submitting this site to " + arrayLinks[iLink][0] + "\"" + 
                  "target=\"_blank\">" + arrayLinks[iLink][0] +"</a><br>");
      iLink++;
      if (iLink >= arrayLinks.length) iLink= 0;
   }
}

/////////////////////////////////////////////////////////////
// FORM VALIDATION FUNCTIONS
//
function IsValidFormFeedback(theform) {

//validate there is something in the name
   if (theform.name.value == null || theform.name.value == "") {
	    theform.name.focus();
		  alert("Please enter your -Name- before submit the form!");
		  return false;
	 }
	 
//validate one rate is selected
   var optSel = false;
   for (var i = 0; i < theform.rate.length && !optSel; i++)
      optSel = theform.rate[i].checked;

   if (!optSel){
		  alert("Please -Rate Section- before submit the form!");
		  return false;
	 }
  		
   return ValidateCode(theform.code);
}

var codeValue;
var codeRetries = 0;
//Call this function before the page loads 
function GenerateCode()
{
   codeValue= Math.floor(Math.random() * codeArray.length);
}

function GetCodeImage()
{
   document.write("<img src=\"assets/images/code_image" + codeValue + ".gif\" width=\"112\" height=\"30\" alt=\"Anti-bots validation code to use before submitting the form\" />");
}

//validate the code in the image
function ValidateCode(formCode)
{
   if (formCode.value == null || 
       formCode.value.toUpperCase() != codeArray[codeValue].value || codeRetries > 10)
   {
//   	  formCode.focus();
		  alert("-Control Code- does not match the image OR too many retries!");
      codeRetries++;
      return false;
   }
   return true;
}

function IsValidFormAddLink(theform) {
   
   if (theform.name.value == null || theform.name.value == "") {
			theform.name.focus();
		  alert("Please enter your -Name- before submit the form!");
		  return false;
	 }
	 
	 if (theform.link.value == null || theform.link.value == "") {
			theform.link.focus();
		  alert("Please give the -URL Link- before submit the form!");
		  return false;
	 }

   return ValidateCode(theform.code);
}


//CheckCR (1 Of 2)
// - Return Key Disable - Contributor: Volker Schubert (js@volker-schubert.de)
// - This script prevents the "early submitting" of forms by disabling the Return Key in simple Input Tags and allowing it in TextAreas
function CheckCR(evt) 
{
  var evt  = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  
  if ((evt.keyCode == 13) && (node.type=="text"))
  {
     return false;
  }
}
// CheckCR (2 of 2)
// Assign the function previously defined to a javascript function
document.onkeypress = CheckCR;


// Validate Date - Contributor: Torsten Frey
// This is a simple date validation. The script is written for the European format (ddmmyy), but can easily be changed. 
function CheckDate(field){
var checkstr = "0123456789";
var dateField = field;
var dateValue = "";
var dateTemp = "";
var seperator = "/";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;

   err = 0;
   dateValue = dateField.value;
   
   if ((dateValue==null)||(dateValue=="")){
      alert("Please Enter the date")
      return false
   }
   /* Delete all chars except 0..9 */
   for (i = 0; i < dateValue.length; i++) {
	  if (checkstr.indexOf(dateValue.substr(i,1)) >= 0) {
	     dateTemp = dateTemp + dateValue.substr(i,1);
	  }
   }
   dateValue = dateTemp;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (dateValue.length == 6) {
      dateValue = dateValue.substr(0,4) + '20' + dateValue.substr(4,2); }
   if (dateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = dateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   /* Validation of month*/
   month = dateValue.substr(2,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = dateValue.substr(0,2);
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
   if (err == 0) {
      dateField.value = day + seperator + month + seperator + year;
	  return true;
   }
   /* Error-message if err != 0 */
   else {
      alert("Date is incorrect!");
	  return false;
   }
}

//** Validate form EMAIL ADDRESS (E-mail Address Validation2)
// This is an e-mail address validation function. It allows the usual user@domain syntax, but in addition allows user@[ip] format as well as "User with Spaces"@domain or [ip], all of which are legal syntax, according to W3C. It also checks that the user hasn't done anything silly like having multiple @'s or continuous .'s in the address (e.g. jim@b@c.com and jim@c..b.co.uk). 
function EmailCheck(field) {
var str = field.value
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
  
   if ((str==null)||(str=="")){
      alert("Please Enter your Email ID")
      return false
   }
   if (str.indexOf(at)==-1){
      alert("Invalid E-mail ID")
      return false
   }
   if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
      alert("Invalid E-mail ID")
      return false
   }
   if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Invalid E-mail ID")
      return false
   }
   if (str.indexOf(at,(lat+1))!=-1){
      alert("Invalid E-mail ID")
      return false
   }
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Invalid E-mail ID")
      return false
   }
   if (str.indexOf(dot,(lat+2))==-1){
      alert("Invalid E-mail ID")
      return false
   }
   if (str.indexOf(" ")!=-1){
      alert("Invalid E-mail ID")
      return false
   }
   return true          
}

/////////////////////////////////////////////////////////////
//Floating window scripts
function JSFX_FloatTopRight(section)
//From http://www.javascript-fx.com
{
        var startX = 0, startY = 120;
        var ns = (navigator.appName.indexOf("Netscape") != -1);
        var d  = document;
        var px = document.layers ? "" : "px";
        function ml(id)
        {
          var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
          if(d.layers)el.style=el;
          el.sP=function(x,y){this.style.right=x+px;this.style.top=y+px;};
          el.x = startX; el.y = startY;
          return el;
        }
        window.stayTopRight=function()
        {
          var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
          var dY = (pY > startY) ? pY : startY;
          ftlObj.y += (dY - ftlObj.y)/8;
          ftlObj.sP(ftlObj.x, ftlObj.y);
          setTimeout("stayTopRight()", 40);
        }
        ftlObj = ml(section);
        stayTopRight();
}

function JSFX_FloatTopLeft(section)
//From http://www.javascript-fx.com
{
  var startX = 0, startY = 120;
  var ns = (navigator.appName.indexOf("Netscape") != -1);
  var d  = document;
  var px = document.layers ? "" : "px";

  function mlLeft(id)
  {
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};
		el.x = startX; el.y = startY;
		
		return el;
 }

 window.stayTopLeft=function()
 {
		var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		var dY = (pY > startY) ? pY : startY;
		
		ftlObj.y += (dY - ftlObj.y)/8;
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 40);
 }

 ftlObj = mlLeft(section);
 stayTopLeft();
}

//!!! Does not work
function FloatLeftY(section)
{
    var startY = 120;
    var ns = (navigator.appName.indexOf("Netscape") != -1);
    var d  = document;
    var px = document.layers ? "" : "px";
    function ml(id)
    {
      var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
      if(d.layers)el.style=el;
      el.sP=function(y){this.style.top=y+px;};
      el.y = startY;
      return el;
    }
    window.stayLeftY=function()
    {
      var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
      var dY = (pY > startY) ? pY : startY;
      ftlObj.y += (dY - ftlObj.y)/8;
      ftlObj.sP(ftlObj.y);
      setTimeout("stayLeftY()", 10);
    }
    ftlObj = ml(section);
    stayLeftY();
}


////////////////////////////////////////////////////////////
//Search for a word if the query string contains "?search=" (Only works in MS IE - Windows)
function SearchQuery()
{
    if (navigator.appName == "Microsoft Internet Explorer")
    {
      if (location.search.length > 8 && location.search.substring(1, 8) == "search=")  //"?search="
      {
         var srchString = unescape(location.search.substring(8, location.search.length));
         srQuery(document.body, srchString, false, true);
      }
    }
}

// Global range object variable
var rng;

function getArgs(caseSensitive, wholeWord) {
    var isCaseSensitive = (caseSensitive) ? 4 : 0;
    var isWholeWord = (wholeWord) ? 2 : 0;
    return isCaseSensitive ^ isWholeWord;
}
   
// Prompted search and replace
function srQuery(container, search, caseSensitive, wholeWord)
{
    var nextOccurrence = true;
    
    if (search)
    {
        var args = getArgs(caseSensitive, wholeWord);
        rng = document.body.createTextRange( );
        rng.moveToElementText(container);
        while (rng.findText(search, 10000, args) && nextOccurrence)
        {
            rng.select( );
            rng.scrollIntoView( );
            nextOccurrence = confirm("Go to next occurrence of \"" + search.toUpperCase() + "\" ?");
            rng.collapse(false);
        }    
    }
}
