// tab_con
function setTab(name,cursel,n){
waitInterval=window.setTimeout("setTab1('"+name+"',"+cursel+","+n+");",160);
}

function setTab1(name,cursel,n){
 for(i=1;i<=n;i++){
  var menu=document.getElementById(name+i);
  var con=document.getElementById("con_"+name+"_"+i);

		menu.className=i==cursel?"on":"";
		con.style.display=i==cursel?"block":"none";
 }
   if((name+cursel)=='x11')
  {
	for(i=1;i<=n;i++){
	var con=document.getElementById("con_"+name+"_"+i);
	con.style.display="block";
	  }
	 
  }
}

// showhide
function showhide(ID) {
  var obj=document.getElementById("table_"+ID);
    if(!obj){
        return;
    }
  var tit=document.getElementById("tit_"+ID);
	if(obj.style.display=="none"){
		obj.style.display="";
		tit.className = "kc_h52";
	}else{
		obj.style.display="none";
		tit.className = "kc_h51";
	}
}

// addBookmark
function addBookmarkForBrowser(sTitle, sUrl)
{

    if (window.sidebar && window.sidebar.addPanel) {
        addBookmarkForBrowser = function(sTitle, sUrl) {
            window.sidebar.addPanel(sTitle, sUrl, "");
        }
    } else if (window.external) {
        addBookmarkForBrowser = function(sTitle, sUrl) {
            window.external.AddFavorite(sUrl, sTitle);
        }
    } else {
        addBookmarkForBrowser = function() {
            alert("do it yourself");
        }
    }

    return addBookmarkForBrowser(sTitle, sUrl);
}


function subEmail(em, keyWord) {
    //var em = document.getElementById('email');
    if (!em || em.value == '') {
        alert('请输入邮件地址!');
        return;
    } else {
        if (!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(em.value)) {
            alert('请输入正确的Email地址');
            return;
        }
    }


    if (document.getElementById(this.scriptelementid)) {
        var el = document.getElementById(this.scriptelementid);
        var p = el.parentNode;
        p.removeChild(el);
    }
    var head = document.getElementsByTagName("head").item(0);
    var script = document.createElement("script");
    script.src = 'http://cms154.koolearn.com/usersubscribeAdmin?_method=subEmail&email=' + em.value + '&keyWord=' + keyWord;
    script.id = this.scriptelementid;
    head.appendChild(script);

    //var s = document.createElement('SCRIPT');
    //s.src='http://cms.neibu.majingang.com:8080/cms2009/usersubscribeAdmin?_method=subEmail&email=' + em.value + '&keyWord=' + keyWord;
    //document.body.appendChild(s);
}

function emailNotEmpty() {
    alert("email地址不能为空！");
}
function emailError() {
    alert("email地址不合法！");
}
var popUpWin = 0;
function PopUpWindow(URLStr, left, top, width, height, newWin, scrollbars) {
    if (typeof (newWin) == "undefined")
        newWin = false;

    if (typeof (left) == "undefined")
        left = 100;

    if (typeof (top) == "undefined")
        top = 0;

    if (typeof (width) == "undefined")
        width = 800;

    if (typeof (height) == "undefined")
        height = 760;

    if (newWin) {
        open(URLStr, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=yes,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + '');
        return;
    }

    if (typeof (scrollbars) == "undefined") {
        scrollbars = 0;
    }

    if (popUpWin) {
        if (!popUpWin.closed) popUpWin.close();
    }
    popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=yes,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + '');
    popUpWin.focus();
}

