function setClassBtn() {
    $("ul#nav li img, .setButton img, .setButton input").each(function() {
        $(this).addClass("btn");
    });
}


function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');
	var aInputs = document.getElementsByTagName('input');
 
	doRollover(aImages);
	doRollover(aInputs);
 
	function doRollover(array) {
		for (var i = 0; i < array.length; i++) {
			if (array[i].className == 'rollover') {
				var src = array[i].getAttribute('src');
				var ftype = src.substring(src.lastIndexOf('.'), src.length);
				var hsrc = src.replace(ftype, '_o'+ftype);
 
				array[i].setAttribute('hsrc', hsrc);
				
				aPreLoad[i] = new Image();
				aPreLoad[i].src = hsrc;
 
					if(src.match(/_o.gif/)) {
					} else {
					
					array[i].onmouseover = function() {
						sTempSrc = this.getAttribute('src');
						this.setAttribute('src', this.getAttribute('hsrc'));
					}
					
					array[i].onmouseout = function() {
						if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
						this.setAttribute('src', sTempSrc);
					}
				}
 
			}
		}
	}
}
 
function addEvent(elm,listener,fn){
	try{
		elm.addEventListener(listener,fn,false);
	}catch(e){
		elm.attachEvent("on"+listener,fn);
	}
}


function pageScroll() {
    $('a[href*=#]').click(function() {
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 500);
                return false;
            }
        }
    });
}

addEvent(window,"load",initRollovers);

