
//--------------------------------------------------------------------------------
function submitForm() {
    getObject("frm").submit();
}
function mouseoverMenu(item) {
    var newSrc;
    var arr;
    var i;
    
    if(item.src.indexOf("_on.") < 0) {
        item.oSrc = item.src;
        arr = item.src.split(".");
        newSrc = "";
        for(i = 0; i < arr.length; i++) {
            if(i == 0) {
                newSrc += arr[i];
            }
            else if(i == arr.length - 1) {
                newSrc += "_on." + arr[i];
            }
            else {
                newSrc += "." + arr[i];
            }
        }
        item.src = newSrc;
    }
}
function mouseOut(item) {
    item.src = item.oSrc;
}
function getObject(item) {
    if(document.all) {
        return document.all(item);
    }
    else {
        return document.getElementById(item);
    }
}
function viewerChangeQ(id) {
    var item;
    var img;
    var name;
    var count;
    
    item = getObject("a" + id);
    img = getObject("i" + id);
    name = item.className;
    count = name.indexOf("_none");
    if(count < 0) {
        item.className = name + "_none";
        img.src = "img/plus.gif";
    }
    else {
        item.className = name.substring(0, count);
        img.src = "img/minus.gif";
    }
}
function clickEventCalender(item) {
    var obj;
    
    obj = getObject("subwin");
    obj.className = "event_view";
    obj.style.top = (item.offsetParent.offsetTop + 320) + "px";
    obj.style.left = (item.offsetParent.offsetLeft + 0) + "px";
}
function clickEventClose() {
    var obj;
    
    obj = getObject("subwin");
    obj.className = "event_hidden";
}

activeMonth = "200803";
function changeCalender(month) {
    var cal;
    var anchor;
    
    cal =getObject(activeMonth);
    anchor = getObject("a" + activeMonth);
    cal.className = "hidden";
    anchor.className = "";
    
    cal =getObject(month);
    anchor = getObject("a" + month);
    cal.className = "view";
    anchor.className = "color_red";
    
    activeMonth = month;
}
//--------------------------------------------------------------------------------
scrj=1;
function ScrollToTop() {
    var y1 = y2 = y3 = 0;
    if (document.documentElement) {
      y1 = document.documentElement.scrollTop || 0;
    }
    if (document.body) {
      y2 = document.body.scrollTop || 0;
    }
    y3 = window.scrollY || 0;
    var y = Math.max(y1, Math.max(y2, y3));
    if(scrj<50 && y) {
        y = (y>2) ? Math.ceil(y*.2) : 1;
        scrj++;
        scrollBy(0,-y);
        setTimeout("ScrollToTop()",20);
    }
    else {
        scrollTo(0,0);
        scrj = 1;
    }
}
//--------------------------------------------------------------------------------
function gotoCarib() {
    window.open("caribbean.html", "_self");
}
function gotoGolf() {
    window.open("golf.html", "_self");
}
function gotoFantasy() {
    window.open("fantasy.html", "_self");
}
function gotoPool() {
    window.open("../pool/", "_self");
}
function gotoResort() {
    window.open("resort.html", "_self");
}
function gotoActive() {
    window.open("active.html", "_self");
}
function goto01() {
    window.open("../attraction/caribbean.html#01", "_self");
}
function goto02() {
    window.open("../attraction/caribbean.html#02", "_self");
}
function goto03() {
    window.open("../attraction/caribbean.html#03", "_self");
}
function goto04() {
    window.open("../attraction/caribbean.html#04", "_self");
}
function goto05() {
    window.open("../attraction/caribbean.html#05", "_self");
}
function goto06() {
    window.open("../attraction/golf.html#07", "_self");
}
function goto07() {
    window.open("../attraction/golf.html#08", "_self");
}
function goto08() {
    window.open("../attraction/golf.html#09", "_self");
}
function goto09() {
    window.open("../attraction/golf.html#10", "_self");
}
function goto10() {
    window.open("../attraction/golf.html#11", "_self");
}
function goto11() {
    window.open("../attraction/fantasy.html#13", "_self");
}
function goto12() {
    window.open("../attraction/fantasy.html#14", "_self");
}
function goto13() {
    window.open("../pool/#15", "_self");
}
function goto14() {
    window.open("../pool/#16", "_self");
}
function goto15() {
    window.open("../pool/#17", "_self");
}
function goto16() {
    window.open("../restaurant/#19", "_self");
}
function goto17() {
}
function goto18() {
}
function goto19() {
    window.open("../attraction/resort.html#22", "_self");
}
function goto20() {
    window.open("../attraction/resort.html#24", "_self");
}
function goto21() {
    window.open("../attraction/resort.html#25", "_self");
}
function goto22() {
}
function goto23() {
}
function goto24() {
}
function goto25() {
    window.open("../attraction/active.html#29", "_self");
}
function goto26() {
    window.open("../attraction/active.html#30", "_self");
}
function goto27() {
    window.open("../attraction/active.html#31", "_self");
}
function goto28() {
    window.open("../attraction/active.html#32", "_self");
}
function goto29() {
    window.open("../attraction/active.html#33", "_self");
}
//--------------------------------------------------------------------------------
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
//--------------------------------------------------------------------------------
