function getId(id){
	return document.getElementById(id);
}
function tabs (obj,style,status){
	if(typeof(obj) != 'string') return ;
	var currentStyle = style;
	var status = status-1;
	var currentLink = null;
	var currentContent = null;
	var obj = document.getElementById(obj);
	if (!obj) return ;
	var lis = obj.getElementsByTagName("LI");

	for (var i = 0,j=lis.length; i<j ; i++) {
	   var Links = lis[i].getElementsByTagName("a")[0];
	   var href =  Links.href.toString().match(/#(.*)/)[1];
	   getId( href ).style.display = 'none';
	   if(i == status){
		   currentLink = Links;
		   currentContent = getId( href );
		   getId( href ).style.display = 'block';
		   cssjs('add',Links,currentStyle);
		 }
	   Links.onclick = function tabs(e){
		   cssjs('remove',currentLink,currentStyle);
		   currentContent.style.display = 'none';
		   cssjs('add',this,currentStyle);    
		   var herf=this.href.toString().match(/#(.*)/)[1];
		   getId( herf ).style.display = 'block';
		   currentLink = this;
		   currentContent = getId( herf );
		   stopDefault( e );
		}
	}
}

function stopDefault( e ) {
    if ( e && e.preventDefault )
        e.preventDefault();
    else
        window.event.returnValue = false;
    return false;
};

function cssjs(a,o,c1,c2){
    switch (a){
        case 'add':
            if(!cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;}
        break;
        case 'remove':
            var rep=o.className.match(' '+c1)?' '+c1:c1;
            o.className=o.className.replace(rep,'');
        break;
        case 'check':
            return new RegExp("(|\\s)" + c1 + "(\\s|$)").test(o.className)
        break;
    }
};
//addLoadEvent
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}else{
		window.onload = function() {
			if(oldonload) {
				oldonload();
			}
			func();
		}
	}
}
addLoadEvent(function(){

});
