window.onerror = naverror;
function naverror(){
	return true;
}

function setContactBox(obj){
	var ha = document.getElementById("contactbox_href_1");
	var hb = document.getElementById("contactbox_href_2");
	var ba = document.getElementById("contactbox_1");
	var bb = document.getElementById("contactbox_2");
	ha.className="";
	hb.className="";
	ba.style.display="none";
	bb.style.display="none";
	document.getElementById("contactbox_href_" + obj.toString()).className="active";
	document.getElementById("contactbox_" + obj.toString()).style.display="block";
}


//弹出层
var old_y_position = 200;
function showbox(){
   create_global_opacity_div();
   var div;
   if(document.getElementById('popupbox')==null)
   {
	   div = document.createElement("div");
   }
   else
   {
	   div=document.getElementById('popupbox');
   }
   div.setAttribute('id', 'popupbox');
   div.className = 'box4';
   div.innerHTML = document.getElementById("recommendbox").innerHTML;
   div.style.top = parseInt(getScroll().t) + 200 + 'px';
   document.body.appendChild(div);
   var gf_position_handle = setInterval('init();', 1);
}
function getScroll(){
   var t, l, w, h;
   if (document.documentElement && document.documentElement.scrollTop) {
        t = document.documentElement.scrollTop;
        l = document.documentElement.scrollLeft;
        w = document.documentElement.scrollWidth;
        h = document.documentElement.scrollHeight;
   } else if (document.body) {
        t = document.body.scrollTop;
        l = document.body.scrollLeft;
        w = document.body.scrollWidth;
        h = document.body.scrollHeight;
   }
   return { t: t, l: l, w: w, h: h };
}
function init(){
   var b = document.getElementById('popupbox');//定位是相当于父div的
        var top = getScroll().t + 200;

        var step = 0.1*(top-old_y_position);

        if(step>0){
            step = Math.ceil(step);
        }else{
            step = Math.floor(step);
        }
        if(step==0){
            return '';
        }
        old_y_position = old_y_position + step;
        b.style.top = old_y_position + "px";
}
function create_global_opacity_div(){
   var div;
   if(document.getElementById('suopingdiv')==null)
   {
	   div = document.createElement("div");
   }
   else
   {
	   div=document.getElementById('suopingdiv');
   }
   div.setAttribute('id', 'suopingdiv');
   div.className = 'opacity_div_class';
   div.style.height = (document.body.clientHeight+20) + 'px';
   document.body.appendChild(div);
}

//收藏
function addfavorite()
{
   if (document.all)
   {
      window.external.addFavorite('http://www.ceibe.edu','Executive MBA, China Europe International Business School');
   }
   else if (window.sidebar)
   {
      window.sidebar.addPanel('Executive MBA, China Europe International Business School', 'http://www.ceibe.edu', "");
   }
} 

//打印
function printsetup(){ 
	// 打印页面设置 
	wb.execwb(8,1); 
} 
function printpreview(){ 
// 打印页面预览 
	wb.execwb(7,1); 
} 
function printit() 
{ 
	if (confirm('Are you sure to print this page?')) { 
		wb.execwb(6,6) 
	} 
} 


//tab选项卡切换
function settab(tabid){
	var headerlist = document.getElementById("tabheader").getElementsByTagName("li");
	for (var i=0; i<headerlist.length; i++)
	{
		headerlist[i].className = "";
	}
	var tablist = document.getElementById("tabcontentcontain").getElementsByTagName("div");
	for (var i=0; i<tablist.length; i++)
	{
		if(tablist[i].className=="tabcontent")
		{
			tablist[i].style.display = "none";
		}
	}
	document.getElementById("tabheader_" + tabid.toString()).className = "active";
	document.getElementById("tabcontent_" + tabid.toString()).style.display = "block";
}

//左侧菜单切换
function setSideBar(){
	var hreflist = document.getElementById("sidebar").getElementsByTagName("a");
	var activehref=window.location.href;
	for (var i=0; i<hreflist.length; i++)
	{
		if(searchword(activehref,hreflist[i].href)!=-1)
		{
			hreflist[i].style.color="#1a3897";
		}
	}
}
function searchword(str1,str2){ 
	var s = str1.indexOf(str2); 
	return(s); 
} 

//中英文版切换
function jumpsrc(){
var path;
var newpath;
var i;
var tmp;
var pos;
path=document.location.pathname;
pAry=path.split("/");
newpath="";
for(i=0;i<=pAry.length-1;i++)
{
	if(i==1)
	{
		tmp=pAry[i];
		pos=tmp.indexOf('_c');
		if(pos!=-1)
		{
		 	newpath=newpath+'/'+tmp.substring(0,pos);
		}
		else
		{
			newpath=newpath+'/'+pAry[i]+'_c';
		}
	}
	else if(i==pAry.length-1)
	{
		newpath=newpath+'/index.shtml';
	}
	else if(i==0)
	{
		newpath='';
	}
	else
	{
		newpath=newpath+'/'+pAry[i];
	}
}
window.location.href=newpath;
}