// JavaScript Document

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

//菜单

function menuhover() {
	var menu = document.getElementById("menu");
	var links = menu.getElementsByTagName("a");
	for(c=0; c<links.length; c++) {
		links[c].onmouseover = function() {
			for(m=0; m<links.length; m++) {
				links[m].className = '';
			}
			this.className = 'here';
		}
		links[c].onmouseout = function() {
			for(m=0; m<links.length; m++) {
				links[m].className = '';
			}
			links[0].className = 'here';
		}
	}
}

addLoadEvent(menuhover);

//底部控制

function footposition() {
	if(!document.getElementById("foot")) return false;
	var foot = document.getElementById("foot");
	if(document.all) {
		if(document.body.clientHeight < document.documentElement.offsetHeight) {
			foot.style.position = 'absolute';
			foot.style.bottom = '0';
		}
	}
	if(window.opera&&navigator.userAgent.match(/opera/gi)) {
		foot.style.position = '';
		foot.style.bottom = '';
	}
	if(document.body.clientHeight < window.innerHeight) {
		foot.style.position = 'absolute';
		foot.style.bottom = '0';
	}
}

addLoadEvent(footposition);

//幻灯片

var tti = 12000;
var i = 0;
var j = 0;


function operation() {
	var slide_img = document.getElementById("slide_img");
	var imgurl = document.getElementById("imgurl");
	var banner_title = document.getElementById("banner_title");
	var righturl = banner_title.getElementsByTagName("a");
	for(g=0; g<righturl.length; g++) {
			if(righturl[g].href.indexOf(imgurl.href) != -1) {
				righturl[g].className = 'slidenow';
			}
			else {
				righturl[g].className = '';
			}
			righturl[g].onmouseover = function () {
				window.clearInterval(slide);
				for(e=0; e<righturl.length; e++) {
					righturl[e].className = '';
				}
				imgurl.href = this.href;
				for(f=0; f<group.length; f++) {
					if(this.href.indexOf(group[f][0]) != -1) slide_img.src = group[f][1];
				}
				this.className = 'slidenow';
			}
			righturl[g].onmouseout = function () {
				this.className = '';
				slide = setInterval(changeimg,tti);
			}
		}
}

function changeimg() {
	var slide_img = document.getElementById("slide_img");
	var imgurl = document.getElementById("imgurl");
	var banner_title = document.getElementById("banner_title");
	var righturl = banner_title.getElementsByTagName("a");
	if (i==group.length-1) 
    {
       i=0;
    }
    else
    {
       i+=1;
    }
	slide_img.src = group[i][1];
	imgurl.href = group[i][0];
	operation();
}

slide = setInterval(changeimg,tti);
addLoadEvent(operation);

function doClick_news(o){
	 o.className="on";
	 var j;
	 var id;
	 var e;
	 for(var i=1;i<=2;i++){
	   id ="news"+i;
	   j = document.getElementById(id);
	   e = document.getElementById("news_cons"+i);
	   if(id != o.id){
	   	 j.className="off";
	   	 e.style.display = "none";
	   }else{
		e.style.display = "block";
	   }
	 }
	 }	 
	 
function key(){ 
//if(event.shiftKey){ 
//window.close();} 
//禁止shift 
if(event.altKey){ 
alert('禁止CTRL-C复制本贴内容');} 
//禁止alt 
if(event.ctrlKey){ 
alert('禁止CTRL-C复制本贴内容');} 
//禁止ctrl 
return false;} 
document.onkeydown=key; 
if (window.Event) 
document.captureEvents(Event.MOUSEUP); 
//swordmaple javascript article. 
//from www.jx165.com 
//function nocontextmenu(){ 
//event.cancelBubble = true 
//event.returnValue = false; 
//return false;} 
function norightclick(e){ 
if (window.Event){ 
if (e.which == 2 || e.which == 3) 
return false;} 
else 
if (event.button == 2 || event.button == 3){ 
event.cancelBubble = true 
event.returnValue = false; 
return false;} 
} 
function Click(){ 
alert('禁止右键粘贴本贴内容'); 
window.event.returnValue=false; 
} 
document.oncontextmenu=Click; 

