//----公共变量或函数全部以“pub_”开始------------------------------------------
var pub_siteRoot = window.location.protocol + "//" + window.location.host + "/site/";
//var pub_siteRoot = window.location.href;
//var pos1 = pub_siteRoot.lastIndexOf("\\");
//if(pos1 == -1)
//	pos1 = pub_siteRoot.lastIndexOf("/")
//pub_siteRoot = pub_siteRoot.substring(0, pos1 + 1);

var gTatameUrl = "../ttm/";
var gTataweUrl = "../ttw/";
var items = [
	"首&emsp;页|http://www.meebo.com.cn/|_self",
	"meebo&nbsp;Me|http://www.meebo.com.cn/ttm/guide.html|_blank",
	"meebo&nbsp;We|http://www.meebo.com.cn/ttw/guide.html|_blank",
	"产&emsp;品|http://www.meebo.com.cn/site/product.html|_self",
	"客&emsp;服|http://www.meebo.com.cn/site/kef.html|_self",
	"论&emsp;坛|http://bbs.meebo.com.cn/|_blank",
	"帮&emsp;助|http://www.meebo.com.cn/site/Help.html|_self"
    

];

function header(n, hideflashbanner, bNewVersion){
	var strflashcode = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
		+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"'
		+ 'width="468" height="60" title="flash_banner">'
		+ '<param name="movie" value="' + pub_siteRoot + 'img/banner.swf"/>'
		+ '<param name="wmode" value="transparent"/>'
		+ '<embed src="' + pub_siteRoot + 'img/banner.swf" name="flash_banner" width="468" height="60" wmode="transparent"'
		+ 'pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>'
		+ '</object>';
	var html = '<div class="page-logo">';
	html += '\n		<a href="http://www.meebo.com.cn"><img src="' + pub_siteRoot + 'img/logo.gif" border="0" align="absbottom" style=" margin-top:9px;" /></a>';
	html += '\n		<div class="logo-label"></div>';
	html += '\n			<div id=\"banner_container\" class="gif" style="float:left;margin-top:-58px; margin-left:170px !important;margin-left:80px;">' + strflashcode + '</div>';
	if(bNewVersion)
		html += '\n      <div class="ty" style="float=left; margin-top:-55px; margin-left:650px !important;margin-left:20px;"><a href="http://bbs.meebo.com.cn/forumdisplay.php?fid=13" target="_blank"><img src="' + pub_siteRoot + 'img/ty.gif" border="0" align="absbottom"></a></div>';
	else
		html += '\n      <div class="wen2"><a class="red" href="http://www.meebo.com.cn/site/newguy.html" target="_blank">新手上路</a></div>';
	html += '\n		</div>';
	html += '\n	<!--div class="page-logowen"></div-->';
	html += '\n	<div class="page-dao">';
	html += '\n		<div class="dao1" style="float:left;margin-top:5px;"><img src="' + pub_siteRoot + 'img/tatame01.gif" /></div>';
	html += '\n		<div class="dao2">';
	for(var i=0;i < items.length;i++){
		var arr = items[i].split("|");
		if(i == n){
			html += '\n		<div class="menu-item-focus"><a href="' + arr[1] + '" target="' + arr[2] + '">' + arr[0] + '</a></div>';
			html += '\n		<div class="menu-sep-focus"></div>';
		}else{
			html += '\n		<div class="menu-item"><a href="' + arr[1] + '" target="' + arr[2] + '">' + arr[0] + '</a></div>';
			html += '\n		<div class="menu-sep"></div>';
		}
		arr = null;
	}
	html += '\n	</div>';
	html += '\n	<div class="dao5" style="float:left; margin-top:5px;"><img src="' + pub_siteRoot + 'img/tatame02.gif" /></div>';
	html += '\n</div>';
	window.document.write(html);
	//var obj = window.document.getElementById("banner_container");
	//if(typeof(hideflashbanner)=="undefined" || !hideflashbanner)
	//pub_createFlash(obj, "flash_banner", pub_siteRoot + "site/img/Movie1.swf", "", "468", "60");
}
function footer(){
	var html = '\n<div class="page-footer">'
		+ '\n	<div class="wenzi1"><a'
		+ '\n		href="http://www.meebo.com.cn/site/aboutus.html">关于我们</a>&nbsp;∣&nbsp;<a'
		+ '\n		href="http://www.meebo.com.cn/site/xinwenzheong.html">新闻公告</a>&nbsp;∣&nbsp;<a'
		+ '\n		href="http://www.meebo.com.cn/site/shangwu.html">商务合作</a>&nbsp;∣&nbsp;<a'
		+ '\n		href="http://www.meebo.com.cn/site/zhaopinzong.html">meebo招聘</a>&nbsp;∣&nbsp;<a'
		+ '\n		href="http://www.meebo.com.cn/site/Link.html">友情链接</a>&nbsp;∣&nbsp;<a'
		+ '\n   href="http://www.meebo.com.cn/site/Privacy.html">隐私声明</a></div>'
		+ '\n	<div class="wenzi1">北京趣通网络技术有限公司. 版权所有</div>'
		+ '\n</div>';
	window.document.write(html);
}
function pub_$(id){
	return window.document.getElementById(id);
}
function pub_showException(e){
	var a = [];
	for(var id in e){
		a.push(id + "=" + e[id]);
	}
	window.alert(a.join("\n"));
}
function pub_initFlash(parentId, flashId, url, title, sw, sh){
	var div = window.document.getElementById(parentId);
	pub_createFlash(div, flashId, url, title, sw, sh);
}
function pub_showFlash(flashId, url){
	var fla = window.document.getElementById(flashId);
	if(window.document.all)  //ie
		fla.setAttribute("movie", url);
	else{
		var sw = fla.getAttribute("width");
		var sh = fla.getAttribute("height");
		var obj = fla.parentNode;
		obj.removeChild(fla);
		pub_createFlash(obj, flashId, url, "flash object", sw, sh);
	}
}
function pub_createFlash(parent, id, src, title, w, h){
	var obj;
	if(window.document.all){
		obj = window.document.createElement("OBJECT");
		if(id) obj.setAttribute("id", id);
		if(title) obj.setAttribute("title", title);
		obj.setAttribute("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
		obj.setAttribute("codeBase", "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab");
		obj.setAttribute("movie", src);
		//obj.src = "bin/filetransfer.swf";
		//obj.setAttribute("quality", "high");
		obj.setAttribute("wmode", "transparent");
		obj.setAttribute("menu", "false");
		obj.setAttribute("width", w);
		obj.setAttribute("height", h);
		obj.setAttribute("allowScriptAccess", "always");
		//obj.style.width = w + "px";
		//obj.style.height = h + "px";
	}else{
		obj = window.document.createElement("EMBED");
		if(id) obj.setAttribute("id", id);
		obj.setAttribute("type", "application/x-shockwave-flash");
		obj.setAttribute("name", id);
		obj.setAttribute("src", src);
		obj.setAttribute("pluginspage","http://www.adobe.com/go/getflashplayer");
		obj.setAttribute("quality", "high");
		obj.setAttribute("wmode", "transparent");
		obj.setAttribute("menu", "false");
		obj.setAttribute("width", w);
		obj.setAttribute("height", h);
		obj.setAttribute("allowScriptAccess", "always");
		obj.style.width = w + "px";
		obj.style.height = h + "px";
	}
	if(!obj){  //失败
		obj = window.document.createElement("div");
		obj.id = id;
		obj.style.width = w + "px";
		obj.style.height = h + "px";
		obj.appendChild(window.document.createTextNode("flash创建失败，请您确定浏览器设置允许播放flash，或刷新浏览器重试，如果仍然不能正常使用请重新安flash插件"));
	}
	if(parent)
		parent.appendChild(obj);
	return obj;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
/*
function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
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 MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
*/

var numLogins = [1, 1, 2];
function createFormBlock(imtype){
	if(numLogins[2] >= 6) return false;
	var html;
	if(imtype == 0){  //qq
		html = '\
				<div class="form-box">\
					<div class="form-field">QQ&nbsp;帐号：&nbsp;&nbsp;<input\
						class="text" id="qq" name="qq" type="text" style="width:100px;" maxlength="10"\
						onKeyPress="if(gLogon){return gLogon.onKeyPress(event, this);}else return false;" onfocus="closekeyboard();" /></div>\
					<div class="form-field">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;密码：&nbsp;&nbsp;<input\
						class="text" id="qqpassword" name="qqpassword" type="password" style="width:100px;" maxlength="16"\
						onKeyPress="if(gLogon){return gLogon.onKeyPress(event, this);}else return false;" onfocus="onPassFocus(this);"/></div>\
				</div>\
				<div class="form-close">\
					<img src="' + pub_siteRoot + 'img/form_panel_msn_close.gif" title="点击关闭" onclick="deleteFormBlock(0, this.parentNode.parentNode);" />\
				</div>';
	}else if(imtype == 1){  //msn
		html = '\
				<div class="form-box">\
					<div class="form-field">MSN&nbsp;帐号：&nbsp;&nbsp;<input\
						class="text" id="msn" name="msn" type="text" style="width:100px;" maxlength="120"\
						onKeyPress="if(gLogon){return gLogon.onKeyPress(event, this);}else return false;" onfocus="closekeyboard();" /></div>\
					<div class="form-field">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;密码：&nbsp;&nbsp;<input\
						class="text" id="msnpassword" name="msnpassword" type="password" style="width:101px;" maxlength="16"\
						onKeyPress="if(gLogon){return gLogon.onKeyPress(event, this);}else return false;" onfocus="onPassFocus(this);"/></div>\
				</div>\
				<div class="form-close">\
					<img src="' + pub_siteRoot + 'img/form_panel_msn_close.gif" title="点击关闭" onclick="deleteFormBlock(1, this.parentNode.parentNode);" />\
				</div>';
	}
	var div = window.document.getElementById((imtype == 0 ? "qq" : "msn") + "logon");
	var obj = window.document.createElement("div");
	obj.innerHTML = html;
	obj.className = "form-block-bg";
	div.parentNode.insertBefore(obj, div);
	numLogins[imtype] ++;
	numLogins[2] ++;
	if(numLogins[imtype] > 1){
		div.parentNode.childNodes[0].className = "form-block-bg";
	}
	return false;
}
function deleteFormBlock(imtype, obj){
	var div = window.document.getElementById((imtype == 0 ? "qq" : "msn") + "logon");
	obj.parentNode.removeChild(obj);
	numLogins[imtype] --;
	numLogins[2] --;
	if(numLogins[imtype] == 1){
		div.parentNode.childNodes[0].className = "form-block";
	}
	return ;
}
/**
 * class ScrollAdv
 */
function ScrollAdv(id){
	this._self = window.document.getElementById(id);
	var scrollHeight = this._self.offsetHeight;
	var _this = this._self;
	var MyMar = window.setInterval(function(){scrollup(_this, scrollHeight, 0);}, 5000);
	this._self.onmouseover = function(){
		window.clearInterval(MyMar);
	};
	this._self.onmouseout = function(){
		MyMar = window.setInterval(function(){scrollup(_this, scrollHeight, 0);}, 5000);
	};
	function scrollup(obj, d, c){
		if(d == c){
			var t = obj.childNodes[0].cloneNode(true);
			obj.removeChild(obj.firstChild);
			obj.appendChild(t);
			t.style.marginTop = obj.firstChild.style.marginTop = "0px";
		}else{
			var s = 3;
			c = c + s;
			var l = (c >= d ? c - d : 0);
			obj.childNodes[0].style.marginTop = -c + l + "px";
			window.setTimeout(function(){
				scrollup(obj, d, c - l);
			}, 100);
		}
	}
	this.dispose = function(){
		if(MyMar)
			window.clearInterval(MyMar);
		this._self.onmouseover = null;
		this._self.onmouseout = null;
		this._self = null;
	};
}
function AScrollImg(){
	if(!this._self){
		window.document.write("<img id=\"img_scroll1\" src=\"img\\kf.gif\" />");
		this._self = window.document.getElementById("img_scroll1");
	}
	var img = this._self;
	function autoScroll(){
		img.style.position = "absolute";
		window.status = document.body.scrollTop;
		img.style.top = (200 + document.body.scrollTop) + "px";
		img.style.left = (document.body.scrollWidth - 100) + "px";
		window.setTimeout(function(){
			autoScroll()
		}, 500);
	}
	autoScroll();
}

/*
img/exam070115/tab_1.jpg
img/exam070115/tab_2.jpg
img/exam070115/tab_3.jpg
img/exam070115/tab_1_focus.jpg
img/exam070115/tab_2_focus.jpg
img/exam070115/tab_3_focus.jpg
*/

/**
 * class TabPage
 */
function TabPage(){
	this._tabs = [];
	this._activeIndex = -1;
	//this._links = [];
	this._flashs = [];
}
var _p = TabPage.prototype;
_p.init = function(obj){
	obj._ptr = this;
	this._self = obj;
	this._self.onclick = function(ev){
		this._ptr.onclick(window.event || ev);
	};
	var divs = this._self.getElementsByTagName("div");
	for(var i=0;i < divs.length;i++){
		this._tabs.push(divs[i]);
		this.activeTab(i);
	}
	this.activeTab(1);
};
_p.dispose = function(){
	for(var i=0;i < this._tabs.length;i++){
		this._tabs[i] = null;
	}
	this._tabs = [];
	this._activeIndex = -1;
	this._self.onclick = null;
	this._self._ptr = null;
	this._self = null;
};
_p.onclick = function(ev){
	var target = ev.srcElement || ev.target;
	if(target.tagName == "SPAN"){
		target = target.parentNode;
	}
	if(target.className == "Tab"){
		var index = parseInt(target.getAttribute("index"));
		this.activeTab(index);
	}
};
_p.activeTab = function(index){
	if(this._activeIndex != -1)
		this.inactiveTab(this._activeIndex);
	this._tabs[index].style.backgroundImage = "url(\"" + pub_siteRoot + "img/exam070115/tab_" + (index + 1) + "_focus.jpg\")";
	this._tabs[index].childNodes[0].className = "focus";
	//window.document.getElementById("subMenu").innerHTML = this._links[index];
	pub_showFlash("flash1", pub_siteRoot + this._flashs[index]);
	this._activeIndex = index;
};
_p.inactiveTab = function(index){
	this._tabs[index].style.backgroundImage = "url(\"" + pub_siteRoot + "img/exam070115/tab_" + (this._activeIndex + 1) + ".jpg\")";
	this._tabs[index].childNodes[0].className = "normal";
};

function web_init(n){
	var tp = new TabPage();
	switch(n){
	default:
	case 1:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/sina1denglu.swf|img/swf/sina2.swf|img/swf/sina4liaotian.swf".split("|");
		break;
	case 2:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/shine1denglu.swf|img/swf/shine2.swf|img/swf/shine4liaotian.swf".split("|");
		break;
	case 3:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/hexun1denglu.swf|img/swf/hexun2.swf|img/swf/hexun4liaotian.swf".split("|");
		break;
	case 4:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/521denglu.swf|img/swf/522.swf|img/swf/524liaotian.swf".split("|");
		break;
	case 5:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/blogcomcn1denglu.swf|img/swf/blogcomcn2.swf|img/swf/blogcomcn4liaotian.swf".split("|");
		break;
	case 6:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/5d1denglu.swf|img/swf/5d2.swf|img/swf/5d4liaotian.swf".split("|");
		break;
	case 7:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/blogcup1denglu.swf|img/swf/blogcup3kuangjia.swf|img/swf/blogcup4liaotian.swf".split("|");
		break;
	case 8:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/sohu1denglu.swf|img/swf/sohu2.swf|img/swf/sohu4liaotian.swf".split("|");
		break;
	case 9:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/mop1denglu.swf|img/swf/mop3kuangjia.swf|img/swf/mop4liaotian.swf".split("|");
		break;
	case 10:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/mov1denglu.swf|img/swf/mov2.swf|img/swf/mov4liaotian.swf".split("|");
		break;
	case 11:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/tf1denglu.swf|img/swf/tf3kuangjia.swf|img/swf/tf4liaotian.swf".split("|");
		break;
	case 12:
		//tp._links = ["", "", ""];
		tp._flashs = "img/swf/yk1denglu.swf|img/swf/yk2.swf|img/swf/yk4liaotian.swf".split("|");
		break;

	}

	tp.init(window.document.getElementById("tabpage1"));
}
