function $Gd(id) {
    return document.getElementById(id);
}
String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}


//function getElementsByClassName(className, parentElement){
//   var elems = ($(parentElement)||document.body).getElementsByTagName("*");
//   var result=[];
//   for (i=0; j=elems[i]; i++){
//   if ((" "+j.className+" ").indexOf(" "+className+" ")!=-1){
//   result.push(j);
//   }
//}
//return result;
//} 

 //getElementsByClassName方法
document.getElementsByClassName = function(eleClassName)
{
var getEleClass = [];//定义一个数组
var myclass = new RegExp("\\b"+eleClassName+"\\b");//创建一个正则表达式对像
var elem = this.getElementsByTagName("*");//获取文档里所有的元素
for(var h=0;h<elem.length;h++)
{
var classes = elem[h].className;//获取class对像
if (myclass.test(classes)) getEleClass.push(elem[h]);//正则比较，取到想要的CLASS对像
}
return getEleClass;//返回数组
}




function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

function _AddEvent() {
    var li = $Gd("select_bar") ? $Gd("select_bar").getElementsByTagName("li") : null;
    if (li) {
        for (var i = 1; i <= li.length; i++) {
            li[i - 1].onclick = function() {
                showbox(this, li);
            }
        }
    }
}

function showbox(con,li){
    for (var i = 0; i < li.length; i++) {
		if(con == li[i]){
			li[i].getElementsByTagName('a')[0].style.backgroundImage = "url(http://img.99sushe.com/tgy/tab_bg2.gif)";
			li[i].getElementsByTagName('a')[0].className='link_red link_strong_14px';
			if ($Gd("content_box" + (i + 1))) $Gd("content_box" + (i + 1)).style.display = 'block';																	
		}
		else{
			li[i].getElementsByTagName('a')[0].style.backgroundImage = 'url(http://img.99sushe.com/tgy/tab_bg1.gif)';
			li[i].getElementsByTagName('a')[0].className='link_black link_strong_12px';
			if ($Gd("content_box" + (i + 1))) $Gd("content_box" + (i + 1)).style.display = 'none';					
		}
	}
}

addLoadEvent(_AddEvent);



var G = function(id){return document.getElementById(id)}
var EACH = function(o,fn){for(var i=0;i<o.length;i++){fn.call(o[i],i,o); if(i==o.length-1) return o}}
var _2009_ = function(){this.init.apply(this,arguments)};
_2009_.prototype={
 init:function(o){
  EACH(G(o.id).rows,function(i,O){i%2== +!!o.parity ? this.style.background = o.cor1:'';
   this['color'] = this.style.background;
   this.onmouseover = function(){this.style.background = o.cor2}
   this.onmouseout = function(){this.style.background = this['color']}
  })
 }
};
if (G("table1")) new _2009_({ id: 'table1', cor1: '#F5FCFE', cor2: '#FBF2DC', parity: '1' });
if (G("table2")) new _2009_({ id: 'table2', cor1: '#F5FCFE', cor2: '#FBF2DC', parity: '1' });
if (G("table3")) new _2009_({ id: 'table3', cor1: '#F5FCFE', cor2: '#FBF2DC', parity: '1' });
if (G("table4")) new _2009_({ id: 'table4', cor1: '#F5FCFE', cor2: '#FBF2DC', parity: '1' });
if (G("table5")) new _2009_({ id: 'table5', cor1: '#F5FCFE', cor2: '#FBF2DC', parity: '1' });

function CopyURL(obj) {
    var tempCurLink = obj.parentNode.getElementsByTagName('a')[0].innerHTML;
    if (window.clipboardData) {
        var ok = window.clipboardData.setData('Text', tempCurLink);
        if (ok) {
            alert('OK');
        } else {
            alert('it isn`t IE');
        }
    }
}