// 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 SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}


function tagMyProfile() {
	over = 7;
	SimpleSwapSetup();
}
var over = -1;
function SimpleSwapSetup(){
  var strHref = window.location.href;
  var str = strHref.split("/");
  
  if(!str[3]) {over = 0;}
  else {
	if(str[3]=="index.html"||str[3]=="index.htm") over = 0;
	if(str[3]=="mixer.html") over = 1;
	if(str[3]=="showcase.html") over = 2;
	
	//if(str[3]=="publicprofile.html"&&loggedin) over = 7;
	if(str[3]=="viewpoints.html") over = 3;
	if(str[3]=="interviews.html") over = 4;
	if(str[3]=="stories.html") over = 5;
	if(str[3]=="polls.html") over = 6;
  
  }
  var count = 0;
  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
	if(count!=over) {
    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);
	if(count==over){x[i].src=oversrc;}
	count++;
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}

