//css selector
var style01;
var css_flag="none";
var css_dir="css/";

function css_selector(){
	if(navigator.appVersion.charAt(0) >= "4"){
		if(navigator.platform.charAt(0)=="M"){
			//mac
			if(navigator.userAgent.indexOf("Safari")!=-1){
				//safari
				style01="mac_safari";
				css_flag="on";
			}else if(navigator.userAgent.indexOf("Opera")!=-1){
				//opera
				style01="mac_opera";
				css_flag="on";
			}else if(navigator.userAgent.indexOf("Netscape")!=-1){
				//netscape
				style01="mac_netscape";
				css_flag="on";
			}else if(navigator.userAgent.indexOf("Gecko")!=-1){
				//mozilla,firefox
				style01="mac_mozilla";
				css_flag="on";
			}else if(navigator.userAgent.indexOf("MSIE")!=-1){
				//ie
				style01="mac_ie";
				css_flag="on";
			}
		}else{
			//win
			if(navigator.userAgent.indexOf("Opera")!=-1){
				//opera
				style01="win_opera";
				css_flag="on";
			}else if(navigator.userAgent.indexOf("Netscape")!=-1){
				//netscape
				style01="win_netscape";
				css_flag="on";
			}else if(navigator.userAgent.indexOf("Gecko")!=-1){
				//mozilla,firefox
				style01="win_mozilla";
				css_flag="on";
			}else if(navigator.userAgent.indexOf("MSIE")!=-1){
				//ie
				style01="win_ie";
				css_flag="on";
			}
		}
		if(css_flag!="none"){
			document.write('<link rel="StyleSheet" type="text/css" href="'+css_dir+style01+'.css">');
		}
	}
}


//run-----------------------
css_selector();


//roll over
function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

window.onload = initRollovers;


