
addEvent(window,"load",initDropShadow);

function initDropShadow() {
    if (!document.createElement) return;
    
    // Sigh, IE doesn't do getElementsByTagName("*")
    if (document.all) {
        var els = document.all;
    } else {
        var els = document.getElementsByTagName("*");
    }
    for (i=0;i<els.length;i++) {
        if ((' '+els[i].className+' ').indexOf(' dropshadow ') != -1) {
            DS_process(els[i])
        }
    }
}

function DS_process(e) {
    // Make a duplicate of this element, with all its subelements
    var nel = e.cloneNode(1);
    // Set its class to shadowed
    nel.className = "shadowed";
    nel.className += e.className.replace('dropshadow','');
    // Set floating text colour
    textColour = e.getAttribute("textColour");
    if (textColour) nel.style.color = textColour;
    textColor = e.getAttribute("textColor");
    if (textColor) nel.style.color = textColor;
    // Add it to the document
    
    nel.style.position = 'absolute';
    
    e.parentNode.insertBefore(nel,e);
    i++;
    nel.style.top = (e.offsetTop - 2) + "px";
    //nel.style.top = (2) + "px";
    
    //nel.style.left = (e.offsetLeft - 400 - e.width) + "px";
    nel.style.left = (e.offsetLeft - 2) + "px";
    //nel.style.left = (2) + "px";
    
}

function addEvent(obj, evType, fn) {
  /* adds an eventListener for browsers which support it
     Written by Scott Andrew: nice one, Scott */
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, true);
    return true;
  } else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
	return false;
  }
}


function popUp(URL) {
day = new Date();
URL = unescape(URL);
id = day.getTime();
window.open(URL, 'x', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=400,left = 415,top = 312');
}

function makePrintUrl(t) {

	var myUrl = new String((document.URL));

	re = /detail_en/gi;
	myUrl = myUrl.replace(re, "print");
	re = /detail_sp/gi;
	myUrl = myUrl.replace(re, "print");
	re = /detail_pt/gi;
	myUrl = myUrl.replace(re, "print");	
	re = /detail/gi;
	myUrl = myUrl.replace(re, "print");
	re = /'/gi;
	myUrl = myUrl.replace(re, "");
	re = /www\.glistour\.com/gi;
	myUrl = myUrl.replace(re, "glistour.manux.org");
	document.write("<a class=\"link\" style=\"color: black\" href=\"JavaScript:popUp('" + myUrl + "')\">" + t + "</a><br/>");

}




var currentdate = 0
var core = 0

function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '

  }
}

image = new StringArray(10)
image[0] = 'top01.jpg'
image[1] = 'top02.jpg'
image[2] = 'top03.jpg'
image[3] = 'top04.jpg'
image[4] = 'top05.jpg'
image[5] = 'top06.jpg'
image[6] = 'top07.jpg'
image[7] = 'top08.jpg'
image[8] = 'top09.jpg'
image[9] = 'top10.jpg'
image[10] = 'top11.jpg'

var ran = 60/image.length

function ranimage() {
  currentdate = new Date()
  core = currentdate.getSeconds()
  core = Math.floor(core/ran)
    return(image[core])
}

function switchImage() {

	var mytd;
	mytd = document.getElementById('topbanner');
	mytd.background = "/images/" + ranimage();
	//alert(mytd.background);

}
