function dynamic_link(thepage)
{
  if (parent.main) {
    mainloc = parent.main.location.href;
    if (mainloc.indexOf("/club_") != -1) {
      lastsep = mainloc.lastIndexOf("/");
      filebase = mainloc.substring(0,lastsep+1);
      lastsep = thepage.lastIndexOf("/");
      filename = thepage.substring(lastsep+1, thepage.length);
      newloc = filebase + filename;
      parent.main.location = newloc;
      return false;
    }
    else {
      if (mainloc.indexOf("?club_") != -1) {
		firstsep = mainloc.indexOf("?club_")
        filebase = mainloc.substring(firstsep+1,mainloc.length)
        lastsep = thepage.lastIndexOf("/");		
        filename = thepage.substring(lastsep, thepage.length);
        newloc = "../" + filebase + filename;
        parent.main.location = newloc;
        return false;
      }
      else {
        return true;
	  }
    }
  }
}

function semidynamic_link(thepage)
{
  if (parent.main) {
    mainloc = parent.main.location.href;
    if (mainloc.indexOf("/club_") != -1) {
      lastsep = mainloc.lastIndexOf("/")
	  firstsep = mainloc.indexOf("/club_")
      filebase = mainloc.substring(firstsep+1,lastsep)
      newloc = thepage + "?" + filebase
      parent.main.location = newloc
      return false
    }
      if (mainloc.indexOf("?club_") != -1) {
		firstsep = mainloc.indexOf("?club_")
        filebase = mainloc.substring(firstsep+1,mainloc.length)
        newloc = thepage + "?" + filebase
        parent.main.location = newloc;
        return false;
      }
      else {
        return true;
	  }
  }
}

function club_name()
{
  if (document.images && parent.main) {
    var mainloc = parent.main.location.href;
    var newimg = "../graphics/pixels/clear.gif";
    if (mainloc.indexOf("/club_") != -1) {
      var lastsep = mainloc.lastIndexOf("/");
      var filebase = mainloc.substring(0,lastsep+1);
      newimg = filebase + "graphics/sub_club_name.gif"
    }
    if (mainloc.indexOf("?club_") != -1) {
      var firstsep = mainloc.indexOf("?club_");
      var filebase = mainloc.substring(firstsep+1,mainloc.length);
      newimg = "../" + filebase + "/graphics/sub_club_name.gif"
//	  alert(newimg)
    }
    if (document["img_club_name"]) {
      var currntimg = document["img_club_name"].src
      if (currntimg.indexOf(newimg) == -1) {
        document["img_club_name"].src = newimg
      }
    }  
  }
  setTimeout("club_name()",1000);
}

function checkpage(mainloc, imgroot, section, override)
{
  var newimg = imgroot + section + ".gif"
  var result = false
  if ((!override) && (mainloc.indexOf(section) != -1)) {
    newimg = imgroot + section + "_hi.gif"
	result = true
  }
  if (document["img_" + section]) {
    var currntimg = document["img_" + section].src
    if (currntimg.indexOf(newimg) == -1) {
      document["img_" + section].src = path_modifier + newimg
    }
  }
  return result
}

function checkframe()
{
  if (document.images && parent.main)
  {
    var mainloc = parent.main.location.href
    var menu_btn_root = "menus/graphics/sub_"
	
    // Club Pages
    resvalue = checkpage(mainloc, menu_btn_root, "classes", false)
    resvalue |= checkpage(mainloc, menu_btn_root, "facilities", resvalue)
    resvalue |= checkpage(mainloc, menu_btn_root, "feedback", resvalue)
    resvalue |= checkpage(mainloc, menu_btn_root, "jobs", resvalue)
    resvalue |= checkpage(mainloc, menu_btn_root, "location", resvalue)
    resvalue |= checkpage(mainloc, menu_btn_root, "timetables", resvalue)
	
    // Common Page(s)
    resvalue |= checkpage(mainloc, menu_btn_root, "index", resvalue)	
  }
  setTimeout("checkframe()",1000);
}
checkframe()
club_name()