/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

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, '_o'+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;




//index
$(function(){
	$("div#news li:last-child").css("border-bottom","0");
});


//navigation
function highlightpage(){
	if(!document.getElementsByTagName) return false;
	if(!document.getElementById) return false;
	if(!document.getElementById("gNavi")) return false;
	var nav = document.getElementById("gNavi");
	var links = nav.getElementsByTagName("a");
	
	//
	var len = window.location.protocol.length + 3 + window.location.hostname.length;
	
	for(var i=0; i<links.length; i++){
		var linkurl = links[i].getAttribute("href");
		var currenturl = window.location.href;
		if(currenturl.indexOf(linkurl) != -1){
			var linkimages = links[i].getElementsByTagName("img")[0]
			var src_replace = linkimages.getAttribute("src").replace("_off.", "_off_o.");
			linkimages.setAttribute("src",src_replace);
			if (currenturl.length != len) {
				var indeximage =  links[0].getElementsByTagName("img")[0]
				var src_replace2 = indeximage.getAttribute("src").replace("_off_o.", "_off.");
				indeximage.setAttribute("src",src_replace2);
				
			}	
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", highlightpage, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", highlightpage);
}


/* tab */
$(document).ready(function() {

//*** hover ***//
$('ul.tabmenu > li').hover(
function() {	// over
	imgfile = 'img/tab_sel.gif';
	$(this).css({
		color: '#ffffff',
		background: 'transparent url('+imgfile+') no-repeat 0px 0px'
	});
	$('a', this).css({
		color: '#ffffff',
		background: 'transparent url('+imgfile+') no-repeat 100% 0px'
	});

}, function() {	// out
	cname = jQuery(this).attr('class');
	if (cname == 'act') {
		imgfile = 'img/tab_act.gif';
	} else {
		imgfile = 'img/tab_inact.gif';
	}
	$(this).css({
		color: '#000000',
		background: 'transparent url('+imgfile+') no-repeat 0px 0px'
	});
	$('a', this).css({
		color: '#000000',
		background: 'transparent url('+imgfile+') no-repeat 100% 0px'
	});
});
//*** hover ***//

});
