var dots = new Array("one", "two", "three");

function threepositionslide(myDirection, myBlock, myDistance) {
  var mypositions = new Array(0, 0 - myDistance, 0 - myDistance * 2);

  /* This is to prevent a ghetto 1px difference when window is sized in certain ways */
  var currentPos = $("#" + myBlock + "window").css("left");
  currentPos = currentPos.replace("px", "");

  for($i = 0; $i < mypositions.length; $i++) {
    if (currentPos == mypositions[$i]) {
      if (myDirection == "right") { myIndex = $i + 1; }
      if (myDirection == "left") { myIndex = $i - 1; }
      
      if (myIndex < 0) { myIndex = 0; }
      if (myIndex > mypositions.length - 1) { myIndex = mypositions.length - 1; }
      $("." + myBlock + "one").attr({src: "/customcode/images/lightdot.jpg"});
      $("." + myBlock + "two").attr({src: "/customcode/images/lightdot.jpg"});
      $("." + myBlock + "three").attr({src: "/customcode/images/lightdot.jpg"});
      $("." + myBlock + dots[myIndex]).attr({src: "/customcode/images/darkdot.jpg"});
      $("#" + myBlock + "window").animate({ left: mypositions[myIndex] + "px"}, 500, "easeOutQuad");
    }
  }
}

function videogallery(name, category, page, number) {
  $.post("/customcode/actions.cfm", { func: "o_videogallery", name: name, category: category, page: page, number: number }, function(data) { 
    $("#videogallery").html(data); 
  }
  );
}

function tabs(olink, oblock, olist) {
  $("#" + oblock + " .tabs .active").removeClass("active");
  olink.className = "active";

  $("#" + oblock + " .lists .active").removeClass("active");
  $("#" + oblock + " .lists ." + olist).addClass("active");
}

function o_logout() {
  $.get("/customcode/users/logout.cfm", "", function(data) {
    if (data.code == "1") {
      alert("User logged out");
      window.location.reload(true);
    } else {
      alert(data.message);
    }
  }, "json");
}

sfHover = function() {     
  var sfEls = document.getElementById("topnav").getElementsByTagName("LI");     
  for (var i=0; i<sfEls.length; i++) {         
    sfEls[i].onmouseover=function() {             
      this.className+=" sfhover";         
    }         
    sfEls[i].onmouseout=function() {             
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");         
    }     
  } 
} 

if (window.attachEvent) window.attachEvent("onload", sfHover);
