
function attachEventAgain(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);
}

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 == 'rollover') {
				attachEventAgain(doc_imgs[i],'mouseover',rollover,true);
				attachEventAgain(doc_imgs[i],'mouseout',rollout,true);
		}
	}
	for(i=0; i<doc_inputs.length; i++) {
		if(doc_inputs[i].className == 'rollover') {
				attachEventAgain(doc_inputs[i],'mouseover',rollover,true);
				attachEventAgain(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;
}

/**
 * Open a form submission in a new window - also define in fuji_homepage.js
 */
var formWin = null;

function submitToPopup(fm) {
	formWin = window.open('', 'form', 'width=505,height=600,toolbar=no,scrollbars,status,resizable=yes');

	if(formWin && !formWin.closed) {
		fm.target = 'form';
		formWin.focus();
	}

	return true;
}