/*
put in place by - vic 23/11/2006
*/



/** Rollover Start **/


function attachEvent_rollover(ob,eType,f,cap){
       if(ob.addEventListener)
                ob.addEventListener(eType,f,cap);
        else if(ob.attachEvent)
                ob.attachEvent("on"+eType,f);
        else if(navigator.userAgent.toLowerCase().indexOf('mac')!=-1||
                      navigator.userAgent.toLowerCase().indexOf('apple')!=-1)
                eval('ob.on'+eType+'='+f);
      /*   else
               alert("Handler could not be added"); // can't do on zenith*/
}

function init() {
	doc_imgs = document.getElementsByTagName("IMG");
	doc_inputs = document.getElementsByTagName("INPUT");
	for(i=0; i<doc_imgs.length; i++) {
		if(doc_imgs[i].className.substr(0,8) == 'rollover') {
				attachEvent_rollover(doc_imgs[i],'mouseover',rollover,true);
				attachEvent_rollover(doc_imgs[i],'mouseout',rollout,true);
		}
		//alert(doc_imgs[i].className.substr(1,8));

	}
	for(i=0; i<doc_inputs.length; i++) {
		if(doc_inputs[i].className.substr(0,8) == 'rollover') {
				attachEvent_rollover(doc_inputs[i],'mouseover',rollover,true);
				attachEvent_rollover(doc_inputs[i],'mouseout',rollout,true);
		}
	}
}
 
function rollover(e) {
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
	
	old_src = targ.src;	
	if(!old_src.match("_f2")) {
		new_src = old_src.replace(".gif","_f2.gif");
		targ.src = new_src;
	}
}
 
function rollout(e) {
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
	
	old_src = targ.src;	
	new_src = old_src.replace("_f2.gif",".gif");
	targ.src = new_src;
}


function addLoadEvent(f) { //pass the actual func not a string.
    var ol = window.onload;
    if (typeof window.onload!='function'){
        window.onload=f;
    }else{
        window.onload=function() {
            ol();
            f();
        }
    }
}
addLoadEvent(init);

/** ROLLOVER END **/
