// This is the implementation of SimpleSwap
// by Jehiah Czebotar
// Version 1.1 - June 10, 2005
// Distributed under Creative Commons
//
// Include this script on your page
// then make image rollovers simple like:
// <img src="/images/ss_img.gif" oversrc="/images/ss_img_over.gif">
//
// http://jehiah.com/archive/simple-swap

function abrir(URL) {

  var width = 650;
  var height = 550;

  var left = 99;
  var top = 99;

  window.open(URL,'_blank', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

}

VideoThumbCount = 0;
VideoTimeoutID = 0;

VideoThumbInit = function(alvo){
 VideoTimeoutID = window.setInterval(function(){
     if(VideoThumbCount==0){
      alvo.style.backgroundPosition = '-321px -69px';
      VideoThumbCount++;
     }
	      else if(VideoThumbCount==1){
      alvo.style.backgroundPosition = '-10px -301px';
      VideoThumbCount++;
     }
	      else if(VideoThumbCount==2){
      alvo.style.backgroundPosition = '-321px -301px';
      VideoThumbCount++;
     }
	 
     else{
      alvo.style.backgroundPosition = '-10px -69px';
      VideoThumbCount = 0;
     }  
 },1000);
}

VideoThumbReset = function(alvo){
      alvo.style.backgroundPosition = '-10px -69px';
      window.clearInterval(VideoTimeoutID); 
	  VideoThumbCount = 0;
}

function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}


