var VA;
if (!VA) VA = {};
if (!VA.util) VA.util = {};
VA.util.addEventListener = function(eType,el,func) {
	if (window.addEventListener) { // W3C/Mozilla
		el.addEventListener(eType,func,false)
	} else if (window.attachEvent) { // IE
		el.attachEvent('on' + eType,func)
	}
}
//=====================================================================
//  DOM Image Rollover v3 (hover)
//
//  Demo: http://chrispoole.com/scripts/dom_image_rollover_hover
//  Script featured on: Dynamic Drive (http://www.dynamicdrive.com)
//=====================================================================
//  copyright Chris Poole
//  http://chrispoole.com
//  This software is licensed under the MIT License 
//  <http://opensource.org/licenses/mit-license.php>
//=====================================================================
class_name = 'roll'
hover_state = true
down_state = false
function domRollover(hs, ds, cn) {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var postStr=/(_off|_hover|_down)\.(jpg|gif|png)/
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf(cn)!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			if (hs) {
				imgPreload[i]=new Image();
				imgPreload[i].src = imgSrc[i].replace(postStr,"_hover.$2");	
				imgarr[i].onmouseover=function(){
					this.setAttribute('src',this.src.replace(postStr,"_hover.$2"));
				}
			}
			if (ds){
				imgPreload[i]=new Image();
				imgPreload[i].src = imgSrc[i].replace(postStr,"_down.$2");
				imgarr[i].onmousedown=function(){
					this.setAttribute('src',this.src.replace(postStr,"_down.$2"));
				}
				imgarr[i].onmouseup=function(){
					this.setAttribute('src',this.src.replace(postStr,"_hover.$2"));
				}
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.src.replace(postStr,"_off.$2"));
			}
		}
	}
}
VA.util.addEventListener('load',window,function(){
	domRollover(hover_state, down_state, class_name);
});
