function clickIE4(){
        if (event.button==2){
                return false;
        }//end if
}//end func

function clickNS4(e){
        if (document.layers||document.getElementById&&!document.all){
                if (e.which==2||e.which==3){
                        return false;
                }//end if
        }//end if
}//end func

function OnDeny(){
        if(event.ctrlKey || event.keyCode==78 && event.ctrlKey || event.altKey || event.altKey && event.keyCode==115){
                return false;
        }//end if
}

if (document.layers){
        document.captureEvents(Event.MOUSEDOWN);
        document.onmousedown=clickNS4;
        document.onkeydown=OnDeny();
}else if (document.all&&!document.getElementById){
        document.onmousedown=clickIE4;
        document.onkeydown=OnDeny();
}//end if

document.oncontextmenu=new Function("return false");

// JavaScript Document
$(function(){
//雙列顏色
$(".list li:odd").addClass ("row");
//點选png取得连结
$('.list li .bg')
.css({cursor: 'pointer'})
.click(function() {
    var href = $(this).parents('li').find('a').attr('href');
    location.href = href;
    return false;
});

//banner ------------------------------------------------------------------------------------------------
	var timer;
	var i = -1;
	var speed = 2000;//停留秒数
	var alpha=1;//说明文底的透明度0~1
	var myItembox = $("#ItemBox ul li a");

	$("#showinfo").html($("#ItemBox ul li a").attr("rel"));
	$("#showinfobg").css("opacity",alpha);
	
	myItembox.click(function(){		
		var imgfile=$(this).attr("data");
		var imginfo=$(this).attr("rel");
		$("#showimg").attr("src",imgfile);
		$("#showinfo").html(imginfo);
		i = myItembox.index($(this));
		
		$("#ItemBox ul li").removeClass("on");//remove		
		$(this).parent().addClass("on");//add		
		
		return false;	
	}).hover(function(){//滑入时停止輪播
		clearTimeout(timer);
	}, function(){
		timer = setTimeout(autoShow, speed);
	});

	//滑入时停止輪播
	$("#ShowBox").hover(function(){
		clearTimeout(timer);
	}, function(){
		timer = setTimeout(autoShow, speed);
	});
	
	//自动輪播函数
	function autoShow(){
		myItembox.eq(i).css("opacity");
		if(i+1<myItembox.length){
			i++;
		}else{
			i=0;
		}
		myItembox.eq(i).click();
		myItembox.removeClass("on");
		myItembox.eq(i).parent().addClass("on");
		timer = setTimeout(autoShow, speed);
	}
	//启动自动輪播
	autoShow();
//banner  END------------------------------------------------------------------------------------------------

//主选单  ------------------------------------------------------------------------------------------------
		// 幫 #menu li 加上 hover 事件
		$('#menu ul>li').hover(function(){
			// 先找到 li 中的子选单 
			var _this = $(this),
				_subnav = _this.children('ul');
			
			// 变更目前母选项的背景顏色
			// 同时淡入子选单(如果有的话)
			_subnav.stop(true, true).fadeIn(400);
		} , function(){
			// 变更目前母选项的背景顏色
			// 同时淡出子选单(如果有的话)
			// 也可以把整句拆成上面的寫法
			$(this).css('backgroundColor', '').children('ul').stop(true, true).fadeOut(400);
		});
		
		// 取消超连结的虛线框
		$('a').focus(function(){
			this.blur();
		});
//主选单  EN D------------------------------------------------------------------------------------------------

}); 
