function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function change(obj) {
  if(obj.selectedIndex == 0) { return false; }
  urlhtml=obj.options[obj.selectedIndex].value;
  window.open(urlhtml);
  obj.selectedIndex=0;
  return true;
  }

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3){
	   if ((obj=MM_findObj(args[i]))!=null) { 
		   	v=args[i+2];
		    if (obj.style) { 
		    	obj=obj.style;
		    	v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
		    }
		    obj.visibility=v; 
	  }
  }
}

function ShowHideLayers(id,thiscss,v){
	var sonid;
	for(i=1;i<5;i++){
		sonid = "son"+i;		
		document.getElementById(sonid).style.display='none';
	}
	v=(v=='show')?'block':(v=='hide')?'none':v; 
	document.getElementById(id+"_a").className=thiscss;
	document.getElementById(id).style.display=v;
	
}

var $ = function(element) {
	if (typeof element == 'string') element = document.getElementById(element);
	return element;
};
var setNoticeList = function(container,row,delay,speed) {
	if (typeof container == 'string') container = $(container);
	if( typeof container == 'undefined' || !container ) return;
	if( typeof row == 'undefined' || row == null ) row = 2;
	if( typeof delay == 'undefined' || delay == null ) delay = 10000;
	if( typeof speed == 'undefined' || speed == null ) speed = 30;
	var ps = container.getElementsByTagName('li');
	var length = ps.length;
	var cheight = length > 0 ? ps[0].offsetHeight : 0;
	var movetime = null;
	var time = null;
	var pause = false;
	container.onmouseover=function(){pause=true;};
	container.onmouseout=function(){pause=false;};
	var show = function(delay,d) {
		clearInterval(movetime);
		clearTimeout(time);
		var top = 0;
		var start = function() {
			movetime = setInterval(move, speed);
		};
		var setNode = function() {
			var plist = container.getElementsByTagName('li');
			var i = 0;
			var t = container.scrollTop;
			while( t >= cheight ) {
				t -= cheight;
				container.appendChild(plist[i++]);
			}
			container.scrollTop = 0;
		};
		var move = function() {
			if (pause) return;
			var plist = container.getElementsByTagName('li');
			container.scrollTop += 2;
			var mod = container.scrollTop % cheight;
			if( mod ==  0 || mod ==  1 || mod ==  -1 ) {
				clearInterval(movetime);
				container.appendChild(plist[0]);
				container.scrollTop = 0;
				time = setTimeout(start, delay);
			}
		};
		setNode();
		start();
	};
	show(delay);
};
window.onload = function() {
	setNoticeList('list',1,2000,50);
};