function sethomepage() {
  var ua=navigator.userAgent.toLowerCase();
  if (ua.indexOf("gecko")>0) {
    alert("You seem to be running a browser that cannot set the home page automatically.\nBookmark this page instead!")
  } else {
    alert("Your homepage is set to www.theglobalweb.com.");
  }
}
var over={};
function shrink(id) {
  if (over[id]) return;
  var obj=document.getElementById(id);
  obj.shrink();
}
function initnetworks() {
  var networks=document.getElementById("networks");
  var div=networks.getElementsByTagName("div");
  for (var i=0; i<div.length; i++) { //i<(div.length-1)/2; i++) {
    var nw=div[i]; //i*2+1];
    nw.onclick=function() {
      var url=this.getAttribute("url");
      if (url) window.open(url);
    }
    nw.onmouseover=function() {
      this.style.color="#000000";
      this.style.borderLeft="1px solid #404560";
      this.style.borderTop="1px solid #404560";
      this.style.borderRight="1px solid #000000";
      this.style.borderBottom="1px solid #000000";
    }
    nw.onmouseout=function() {
      this.style.color="#45515d";
      this.style.borderLeft="1px solid #b6c0cc";
      this.style.borderTop="1px solid #b6c0cc";
      this.style.borderRight="1px solid #8694a5";
      this.style.borderBottom="1px solid #8694a5";
    }
  }
}
var news=new Array(5);
var currentnews=0;
var newstimer;
function initnews() {
  for (var i=0; i<5; i++) news[i]=document.getElementById("news"+i);
  var div=document.getElementById("stories");
  var p=div.getElementsByTagName("li");
  for (var i=0; i<p.length; i++) {
    p[i].onclick=function() {
      var a=this.getAttribute("article");
      a=parseInt(a.substring(4));
      shownews(a);
    }
  }
  newstimer=setInterval("nextnews()",60000);
}
function shownews(idx) {
  var div=document.getElementById("stories");
  var p=div.getElementsByTagName("li");
  for (var i=0; i<5; i++) {
    if (i==idx) {
      news[i].style.visibility="visible";
      news[i].style.display="block";
      p[i].style.background="#cfd4d9";
    } else {
      news[i].style.visibility="hidden";
      news[i].style.display="none";
      p[i].style.background="#ffffff";
    }
  }
  var from=news[idx].getAttribute("from");
  var div=document.getElementById("newssrc");
  div.innerHTML="This article is from "+from;
  currentnews=idx;
}
function registernow() {
  var url=document.getElementById("network").value;
  if (!url||url.length<1) {
    alert("You must select a network to join!");
    return;
  }
  window.location.href=url;
}
function nextnews() {
  currentnews++;
  if (currentnews>4) currentnews=0;
  shownews(currentnews);
}
function togglenewsupdate() {
  var div=document.getElementById("newstimer");
  if (newstimer) {
    clearInterval(newstimer);
    newstimer=0;
    div.innerHTML="Resume Automatic Update";
  } else {
    newstimer=setInterval("nextnews()",60000);
    div.innerHTML="Stop Automatic Update";
  }
}
function init() {
  initnetworks();
}
function goto_ns_state(sel) {
  var val=parseInt(sel.value);
  if (!val) return;
  window.location.href="http://www.nightclubcommunity.com/location.html?s="+val;
}
function goto_rs_state(sel) {
  var val=parseInt(sel.value);
  if (!val) return;
  window.location.href="http://www.restaurantnetwork.com/search.html?s="+val+"&c=0&n=0&r=0&o=1";
}
function goto_ht_state(sel) {
  var val=parseInt(sel.value);
  if (!val) return;
  window.location.href="http://www.globalhotellist.com/search.html?s="+val+"&c=0&n=0&r=0&o=1";
}
