//var isIE = $.browser.msie;
var original_display_mode = 0;  
var anchor_string = window.document.URL;
var firstTime=true;
var msg=window.document.title; 
var delay=300;
var open_=false;
var login_action_record = -1;
var gwk = new Array(["start2.do?"],["index_cj.do?"],["index_pm.do?"],["his.do?"],["info2.do?"],["top_ten.do?"]);
var player_update_switch=1;  
var player_setup_switch=0;   
var leave_bbs_last_url="/bbs/bbs/cityV3.do?city_id=1";
var init_mode_cx=0;

var syncheck = 1; 
var curr_city=-1; 

var test_cx;

var fixed_iframe_height = 0;

function setSyncheck(value){
	syncheck=value;
	if(syncheck>0 && curr_city!=syncheck){
		goto_city_bbs(curr_city);
	}
}

function getSyncheck(){
	return syncheck;
}

function jump_city(city_id,uuid){
	if(syncheck>0){
		//goto_city_bbs(city_id,uuid);
		city_bbs(city_id,uuid);
	}
	curr_city=city_id;
}

function goto_anchor(anchor_name){
   goto_("#"+anchor_name);
   if($.browser.mozilla){
       scrollTo(0,window._content.document);
   } else {
       window.scrollTo(0);
   }
}

function copyToClipBoard(title,id)
{
   if(!$.browser.msie){
      return ;
   }
   var text=window.parent.document.URL+" [ft="+id+"]"+title+"[/ft]";
   window.clipboardData.setData("Text",text);
   alert("复制成功!");
}

function getIFrameDocument(id) {
	var iframe = window.document.getElementById(id);
	if (!iframe) {
		return null;
	}
	var doc = iframe.contentDocument ? iframe.contentDocument : iframe.contentWindow.document;
	return doc;
}

function resetFrameSize() {
	try{
		var oBody = getIFrameDocument("bbsiframe").body;
	       var height_t = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
           var height_now = $("#bbsiframe").height();
           if(height_now>0&&height_t!=0&&height_now!=height_t){
                $("#bbsiframe").height(height_t);
           }
	}catch(e){
	}
}

function flash_window_display() {
	flash_window_set(3);
}

var minModel=false;
function flash_window_set(model){
	/*if((model==3 ||model==1) && original_display_mode==0){
		$("#bbsiframe").height(0);
	    flash.height("100%");
	    change_mode();
	}else if((model==3||model==2) && original_display_mode==1){
	    flash.height(450);
		var oBody = getIFrameDocument("bbsiframe").body;
	    var height_t = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
		$("#bbsiframe").height(height_t);
		change_mode();
	}else if(model==4){
		if(minModel){
			original_display_mode=original_display_mode==1?0:1;
			minModel=false;
			flash_window_set(3);
		}else{
			flash.height(50);
			var oBody = getIFrameDocument("bbsiframe").body;
	   	 	var height_t = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
			$("#bbsiframe").height(height_t);
			minModel=true;
		}
	}*/
}

function change_mode(){
	if(original_display_mode){
		original_display_mode=0;
		if (isIE) {
		    window.document.body.style.overflowY="scroll";
		    window.document.body.style.overflowX="hidden";
		}
	} else {
		original_display_mode=1;
		if (isIE) {
			window.document.body.style.overflow="hidden";
		}
	}
}

function goto_(url){
   window.location.replace(url);
}



function user_login(uuid , action , city){
    var bbsiframe = document.getElementById("bbsiframe");
    $("#bbsiframe").height(10);
    if(action==0){
         login_action_record=0;
         return;
    }
    if(action==1){
    	login_action_record=1;
    	goto_city_bbs_login(city,uuid,0,action);
    	return;
    }
    if(action == 2){
    	login_action_record=2;
    	goto_city_bbs_login(city,uuid,0,action);
    	return;
    }
    if(action ==3){
    	if(action==3){
		var frame_url=window.frames[0].document.URL;
		var fa=frame_url.split("&uuid=");
		var url=fa[0]+"&uuid="+uuid;
		if(fa.length>1 && fa[1].indexOf("&")>0){
			var ifa=fa[1].split("&");
			if(ifa.length>1){
				url=url+"&"+ifa[1];
			}
		}
		$("#bbsiframe").attr("src",url);
		return;
	    }
    }
}

function refresh_page(){
    var url = window.location.href;
    goto_(url);
}

function changeScene(id) {
	window.location.hash = id;
}

function tha_setHash(){
	document.title = 'fotologue';
	document.currentHref =location.href;
}

function flash_tell_goto_thread(thread_id,uuid,city_id){
//	setCookie('uuid',uuid,-1, '/', '.this6.com');
	window.open("http://m.this6.com/"+thread_id+"_1.html");
}

function flash_tell_goto_url(url,uuid){
	open_win(url);
}

function move_clear(){
   move_real_count = 0 ;
   move_stop_count = 0 ;
}

function dynamic_ifream_height(){
	resetFrameSize();
    setTimeout("dynamic_ifream_height();",2000);
}

function set_leave_bbs_last_url(url){
    this.leave_bbs_last_url=url; 
}

function get_leave_bbs_last_url(){
    return this.leave_bbs_last_url;
}

function return_bbs(){
    $("#bbsiframe").attr("src",get_leave_bbs_last_url());
}

function goto_agreement_file(){
    $("#bbsiframe").attr("src","/bbs/agreement.html");
}

function goto_work_manager(system_id){
   if(system_id<1){
      return;
   }
   var fream = $("#bbsiframe");
   var src_ = fream.attr("src");
   if(src_.indexOf("/bbs/workmanager/")<0){
   		set_leave_bbs_last_url(src_);
   }
   var date = new Date();
   $("#bbsiframe").attr("src","/bbs/workmanager/index.do?system_id="+system_id+"&time="+date.getTime());
}

function goto_city_bbs(city,uuid){
    city_bbs(city,uuid);
    
    if(original_display_mode==1){
      flash_window_display();
    }
}


function city_bbs(city,uuid) {
	var date = new Date();
	if(uuid==null){
		$("#bbsiframe").attr("src","/bbs/bbs/cityV3.do?city_id="+city+"&time="+date.getTime());
	}else{
		$("#bbsiframe").attr("src","/bbs/bbs/cityV3.do?city_id="+city+"&uuid="+uuid+"&time="+date.getTime());
	}
}

function go_curr_city_bbs(){
	var city=get_curr_url("city")
	if(city){
		city_bbs(city);
	}	
}

function goto_city_bbs_login(city,uuid,jump,action){
	var thread = get_curr_url("thread");
	var cityhash = get_curr_url("city");
	var user = ger_curr_url("user");
	if(thread>0){
	}else if (cityhash>0){
	}else if(user>=0){
	}else{
		if(jump==1){
		    curr_city=city;
	        if(syncheck>0){
		       city_bbs(city,uuid);
	        }
		}
	}
	if(original_display_mode==1){
      flash_window_display();
    }
}

function getKeyNumber(key){
	if (key=="scene"){
   	  return "s";
   } else if (key=="thread"){
      return "t";
   } else if (key=="city"){
   	 return "c";
   } else if (key=="user"){
   	 return "u"
   } else {
   	 return -1;
   }
}

function changeUrl(key,value){
   var number = getKeyNumber(key);
   if(number==-1){
   	  return;
   }
   if(value==null){
   	  value = "";
   }
  
   var url=window.location.hash;
   if(!url){
      window.location.hash = (number=="s"?"":number)+value;
      return ;
   }
   
   var has2 = "not";
   if(url.indexOf("t")>-1){
   	   has2="t";
   } else if (url.indexOf("c")>-1){
       has2="c";
   }else if (url.indexOf("u")>-1){
       has2="u";
   }
   
   if(has2=="not"){
   	  if(number=="s"){
   	  	window.location.hash=value;
   	  }else{
   	  	if(value!=""){
   	  		window.location.hash=url+number+value;
   	  	}
   	  }
   	  return ;
   }
   
   if(number=="s"){
   	  var re=value;
   	  window.location.hash=re+has2+url.split(has2)[1];
   	  return;
   }
   
   if(has2==number){
   	  var re=url.split(has2)[0];
   	  if(value!=""){
   	  		re=re+number+value;
   	  }
   	  window.location.hash=re;
   	  return;
   }
   
   if(value==""){
   	  window.location.hash=url;
   	  return ;
   }

   var re=url.split(has2)[0];
   window.location.hash=re+number+value;
}

function get_curr_url(key){
  var url=window.location.hash;
  if(key==null){
  	var str = url;
  	return str;
  }
  var number = getKeyNumber(key);
  if(number==-1){
  	return ;
  }
  if(url!=null && url.length > 0){
      var value = null;
      if(number=="s"){
      	 if(url.indexOf("t")>-1){
      	 	value = url.split("t")[0];
      	 } else if (url.indexOf("c")>-1){
      	 	value = url.split("c")[0];
      	 } else if (url.indexOf("u")>-1){
      	 	value = url.split("u")[0];
      	 } else {
      	 	value = url;
      	 }
      }else{
      	 if(url.indexOf(number)>-1){
      	 	value=url.split(number)[1];
      	 }else{
      	 	value="";
      	 }
      }
      if(value.indexOf('#')==0){
      	 return value.substr(1,value.length-1);
      }
      return value;
   }else{
      return null;
   }
}

function deleteMark(key){
   changeUrl(key,null);
}

function refresh_index(){
	var url = window.document.URL.split("#")[0];
	window.location.replace(url);
}

function coop_type(){
	var url = window.document.URL.split("#")[0];
	if(url.indexOf("jdz.this6.com")>=0) {
		return 3;
	}
	return 0;
}

var coop_this6 = ["http://www.this6.com/bbs/newpage/register.do",
		"http://www.this6.com",
		"http://www.this6.com",
		"http://m.this6.com",
		"http://www.this6.com/bbs/pay/index.html",
		"http://www.this6.com/bbs/c/user_info.do",
		"http://www.this6.com/bbs/c/user_info.do",
		"http://m.this6.com/forumdisplay.php?fid=5",
		"http://www.this6.com"];
var coop_yiwei = ["http://home.9igame.com",
		"http://home.9igame.com",
		"http://home.9igame.com",
		"http://home.9igame.com/space-mtag-tagid-57889.html",
		"http://pay.9igame.com/index.action",
		"http://user.9igame.com/user/default.action",
		"http://user.9igame.com/user/default.action",
		"http://home.9igame.com/space-mtag-tagid-57889.html",
		"http://home.9igame.com"];
var coop_tw = ["http://www.showparty.com.tw",
               "http://www.showparty.com.tw",
               "http://www.showparty.com.tw",
               "http://wiki.98173.com.tw/WiKiPage/PageView.aspx?PgID=8015605&cno=1105000100040001&fmid=1735",
               "http://lovehouse.showparty.com.tw/EasyPlay/Purchase.aspx",
               "","","","http://www.showparty.com.tw"];
var coop_fl = ["","","http://www.yaofanli.com","","http://www.yaofanli.com/pay!toPay.do?gameid=49","","","","http://www.yaofanli.com"];
var coop_zonyou = ["http://i.zonyou.com/register.aspx",
                   "http://i.zonyou.com/login.aspx",
                   "http://i.zonyou.com/logout.aspx",
                   "http://i.zonyou.com/",
                   "http://www.zonyou.com/pay/",
                   "http://i.zonyou.com/center/setting.aspx",
                   "",
                   "",
                   "http://www.zonyou.com"];
var coop_fbook = ["http://www.fbook.net/user/userReg.html",
                  "http://www.fbook.net/user/userLogin.asp",
                  "http://www.fbook.net/",
                  "http://forum.fbook.net/","http://game1.fbook.net/gamepay_this6.asp","","","","http://www.fbook.net"];
var coop_st = ["http://www.st023.com/bbs/register.aspx","","http://www.st023.com","http://www.st023.com/bbs/index.aspx","","","","","http://www.st023.com"];
var coop_gtv = ["http://www.xiog.com.cn/account/action/signup.shtml",
                "http://www.xiog.com.cn/account/action/login.shtml",
                "http://this6.xiog.com.cn",
                "http://bbs.xiog.com.cn/forumdisplay.php?fid=100",
                "http://www.xiog.com.cn/service/pay/this6.shtml",
                "",
                "",
                "http://www.xiog.com.cn/customer/",
                "http://this6.xiog.com.cn"
                ];
var coop_game163 = ["",
                "",
                "",
                "",
                "http://www.game163.com/yeePay.aspx?gameid=48",
                "",
                "",
                "",
                ""
                ]; 
var coop_zhulang = ["http://6th.zhulang.com/?do=reg",
                    "http://6th.zhulang.com/",
                    "http://6th.zhulang.com/",
                    "http://free.zhulang.com/index.php?gid=200",
                    "http://game.zhulang.com/charge/",
                    "http://game.zhulang.com/user/",
                    "http://game.zhulang.com/user/fcm.php",
                    "http://6th.zhulang.com/",
                    "http://6th.zhulang.com/"
                    ];
var coop_huanyu = ["http://www.uniskyol.com/reg.html",
                   "http://this6.uniskyol.com/",
                   "http://this6.uniskyol.com/",
                   "http://bbs.uniskyol.com/WebGame/",
                   "http://www.uniskyol.com/Payment.html",
                   "http://www.uniskyol.com/ChangeAccountInfo.html",
                   "http://www.uniskyol.com/ChangePersonalID.html",
                   "",
                   "http://this6.uniskyol.com/"
                   ];
var coop_equan = ["http://www.equan.com/register.aspx",
                  "http://www.equan.com/login.aspx",
                  "http://www.equan.com/WebGame/This6/default.aspx",
                  "http://www.equan.com/groups/groupDetail.aspx?groupid=41606",
                  "http://a.this6.com/bbs/coop/equan_pay_link.do",
                  "http://www.equan.com/UserInfo/BasicInfo.aspx",
                  "",
                  "",
                  "http://www.equan.com/WebGame/This6/default.aspx"
                  ];
var coop_aoyou = ["http://www.19193.cn/register.aspx",
                  "http://www.19193.cn/index.aspx",
                  "http://www.19193.cn/index.aspx",
                  "http://bbs.19193.cn/",
                  "http://www.19193.cn/chongzhi.aspx",
                  "http://www.19193.cn/userMsg.aspx",
                  "http://www.19193.cn/moduser.aspx",
                  "",
                  "http://www.19193.cn/index.aspx"
                  ];
var coop_tjst = ["http://119.167.210.31/goRegUser.do",
                 "http://119.167.210.31/Login.jsp",
                 "http://119.167.210.31/doLogout.do",
                 "http://119.167.210.31/goBBS.do",
                 "",
                 "",
                 "",
                 "http://119.167.210.31/customerServiceComm.jsp",
                 "http://119.167.210.31/index.jsp"
                 ];
var coop_tiantian = ["http://www.tiantiangame.cn/web/game.do",
                     "http://www.tiantiangame.cn/web/game.do",
                     "http://www.tiantiangame.cn/web/game.do",
                     "http://bbs.tiantiangame.cn/forum-1-21-1.html",
                     "http://www.tiantiangame.cn/web/pay.do?gameid=7",
                     "http://www.tiantiangame.cn/web/userlogin.do",
                     "",
                     "http://bbs.tiantiangame.cn/forum-1-21-1.html",
                     "http://www.tiantiangame.cn/web/game.do"
                     ];

// type 1 注册 2 登录 3 退出 4 论坛 5 充值 6 个人资料 7 防沉迷 8 在线帮助 9 首页
function coop_register(coop_type,type,server_id,uuid){
	if(type==3) { // logout
		$.cookie('username', null);
		$.cookie('uuid', null);
		$.cookie('save_password', null);
		$.cookie('auto_login', null);
	}
	if(uuid==null&&((server_id >= 400 && server_id <= 410)||server_id==500)){
		coop_type=12;
	}
	var url;
	switch (coop_type) {
	case 11:
		url = coop_yiwei[type-1];
		break;
	case 12:
		url = coop_tw[type-1];
		break;
	case 14:
		url = "/bbs/coop/sc_jump.do?token="+$.cookie('SC_TOKEN')+"&uuid="+uuid;
		break;
	case 17:
		url = coop_zonyou[type - 1];
		break;
	case 18:
		url = coop_fl[type - 1];
		break;
	case 19:
		url = coop_zhulang[type -1];
		break;
	case 23:
		url = coop_gtv[type - 1];
		break;
	case 24:
		url = coop_fbook[type - 1];
		break;
	case 25:
		url = coop_game163[type - 1];
		break;
	case 28:
		url = coop_huanyu[type - 1];
		break;
	case 31:
		url = coop_equan[type - 1] +"?uuid="+uuid;
		break;
	case 32:
		url = coop_aoyou[type - 1];
		break;
	case 33:
		url = coop_tjst[type - 1];
		break;
	case 35:
		url = coop_tiantian[type - 1];
		break;
	default:
		url = coop_this6[type-1];
		break;
	}
	if (type==4||type==5||type==6||type==7||type==8) {
		if (type == 5 && coop_type == 16) { /*新网虫充值*/
			if (server_id == 1) {
				open_win("http://a2.this6.com/bbs/pay/st_pay.do");
			} else {
				open_win("http://a3.this6.com/bbs/pay/st_pay.do");
			}
		} else {
			open_win(url);
		}
		
	} else {
		window.location.replace(url);
	}
}
/*
 * @author Eideo
 * 打开新窗口，避免给浏览器屏蔽
 * */
function open_win(url){
	var f = document.getElementById("this6form");
	url = ((typeof url) == 'string') ? url : url.join(""); 
	var urls = url.split("?");
	if(f){
		$(f).attr("action",urls[0] + "?rnd=" + Math.random() * 1000);
		$(f).html(createHidden(urls[1]));
		$(f).submit();
	}else{
		var form = document.createElement("form");
		$(form).css("display","none").attr("target","_blank").attr("action",urls[0] + "?rnd=" + Math.random() * 1000).attr("id","this6form");		
		document.body.appendChild(form);
		$(form).html(createHidden(urls[1]));
		$(form).submit();	
	}
}
function createHidden(param){
	var hiddens = "";
	if(param){
		var params = param.split("&");
		for ( var i = 0; i < params.length; i++) {
			var p = params[i].split("=");
			hiddens += "<input type='hidden' name='" + p[0] +"' value='" + p[1] + "' />";
		}
	}
	return hiddens;
}
var video_file_path  ;

function video_post(video_name){
	var array_s = new String(video_name);
	var array = array_s.split(",");
	var content=" ";
	for(var i=0 ; i<array.length ; i++){
		if(array[i].length>0){
			content=content+"[ktv]"+array[i]+"[/ktv]";
		}
	}
	try{
		var url = window.frames[0].creat_thread(content);
		$("#bbsiframe").attr("src", "/bbs/bbs/"+url);
		if(original_display_mode==1){
            flash_window_display();
        }
	}catch(exce){
		return ;
	}
}

function video_download(video_name){
	var html_content="<a href='"+video_name+"' target=''><div id='video_download_' name='video_download_'></div></a>"
	$("#video").html(html_content);
	$("#video_download_").click();
}

function test(){
	var yy = new Number;
	var time = new Date();
	time.getSeconds()
	time.setTime(time.getTime()+3600000);
}

function get_uuid() {
	return $.cookie('uuid');
}

function index_page() {
	window.location.replace(coop_this6[2]); // the same as logout
}

/* invoke flash */
function flash_user_info(user_id,fromOutPage){
	flash.focus();
	window.document.this6index.display_user_info(user_id);
	if(fromOutPage==null){
		beDoo();
	}
}
function user_info(user_id){
	flash_user_info(user_id);
}
function go_scene(type,scene,fromOutPage) {
	flash.focus();
	window.document.this6index.go_scene(type,scene);
	if(fromOutPage==null){
		setTimeout("beDoo()",500);
	}
}
function go_user_local(user_id){
	flash.focus();
	window.document.this6index.go_user_local(user_id);
	setTimeout("beDoo()",500);
}
function user_edit(text){
	flash.focus();
	window.document.this6index.user_edit(text);
	setTimeout("beDoo()",500);
}
function flash_open_rank_paihang(type) {
	flash.focus();
	window.document.this6index.open_rank_paihang(type);
}

function flash_open_fight_paihang(type) {
	flash.focus();
	window.document.this6index.open_fight_paihang(type);
}
function display_vote(vote_id) {
	flash.focus();
	window.document.this6index.display_vote(vote_id);
}

function go_user_zone(id,uuid){
	return;
}

var save_game_before_url;
function workshop_game(id, uuid, npc_id){
	open_workshop(id,npc_id);
	/*
	 * var curr_url=window.frames[0].location.href; if (!npc_id) { npc_id = 0; }
	 * if(curr_url.indexOf("/bbs/workshop.do?")==-1){
	 * save_game_before_url=curr_url; } $("#bbsiframe").attr("src",
	 * "/bbs/bbs/workshop.do?id=" + id + "&npc_id=" + npc_id);
	 * if(original_display_mode==1){ flash_window_display(); }
	 */
}

function exite_workshop_game(){
	if(original_display_mode==0){
         flash_window_display();
    }
    $("#bbsiframe").attr("src", save_game_before_url);
}

function flash_add_friend(user_id,nickname){
	flash.focus();
	window.document.this6index.add_friend(user_id,nickname);
}

function jump_scene(scene_id , scene_name,server_id){
	changeUrl("scene",scene_id);
	title_text=scene_name;
	if((server_id >= 400 && server_id <= 410)||server_id==500){
		window.document.title="☀ "+scene_name+" ☀ 愛情小窩☀";
	}else{
		window.document.title="☀ "+scene_name+" ☀ 第6大陆 ☀";
	}
}

var do_count=0;
var do_lock=false;
function beDoo(count){
	if((count!=1)&&(do_lock)){
		return;
	}
	if(open_||(do_count==20)){
		do_lock=false;
		do_count=0;
		return;
	}
	do_lock=true;
	var currFalg=window.document.title;
	if((do_count%2)==0){
		window.document.title="　　　"+currFalg;
	}else if((do_count%2)==1){
		window.document.title=currFalg.substring(3,currFalg.length);
	}
	do_count++;
	setTimeout("beDoo(1)",180);
}

function receive_message(action , nickname,server_id){
   if(action == 0){
     	msg = "☜ 收到 ["+nickname+"] 的消息！ ";
        if(!open_){
        	open_=true;
            setTimeout("scrollTitle()",200);
        }
   }else{
   		open_=false;
   		setTimeout("scrollTitle()",200);   
   		if((server_id >= 400 && server_id <= 410)||server_id==500){
   			window.document.title="☀ "+title_text+" ☀ 愛情小窩 ☀";
   		}else{
   			window.document.title="☀ "+title_text+" ☀ 第6大陆 ☀";
   		}
   }
}

function scrollTitle() {
  if(!open_){
     return;
  }
  window.document.title=msg; 
  msg=msg.substring(1,msg.length)+msg.substring(0,1,1); 
  setTimeout("scrollTitle()",delay); 
} 


function addfavorite(server_id)
{
	if((server_id!=null)&&((server_id >= 400 && server_id <= 410)||server_id==500)){
		if (document.all)
		{
			window.external.AddFavorite('http://www.showparty.com.tw','☀ 愛情.從這裡開始 ☀ 愛情小窩 ☀'); 
		}
		else if (window.sidebar)
		{
			window.sidebar.addPanel('☀ 愛情.從這裡開始 ☀ 愛情小窩 ☀', 'http://www.showparty.com.tw',  "");
		}
	}else{
		if (document.all)
		{
			window.external.AddFavorite('http://www.this6.com','☀ 创造世界 享受生活 ☀ 第6大陆 ☀'); 
		}
		else if (window.sidebar)
		{
			window.sidebar.addPanel('☀ 创造世界 享受生活 ☀ 第6大陆 ☀', 'http://www.this6.com',  "");
		}			
	}
} 

var flash;
var title_text="创造世界 享受生活";
function bbs_index_function(){
	if(isIE){
	      flash = $("object[@name='this6index']");
	}else{
	      flash = $("embed[@name='this6index']");
	}
	
	flash.focus(function() { 
	  window.document.title="☀ "+title_text+" ☀ 第6大陆 ☀";
	});

    /*
	 * var thread = get_curr_url("thread"); var scene = get_curr_url("scene");
	 * var user = get_curr_url("user"); var city = get_curr_url("city");
	 * if(thread>0 && !scene>0){ $("#bbsiframe").attr("src",
	 * "/bbs/bbs/thread.do?id="+thread); }else if(user>=2000000 && !scene>0){
	 * $.post("/bbs/getUserHomeSceneId.do", { user_id: user }, function(data){
	 * if(data>0){ flash_go_scene(2,data); $("#bbsiframe").attr("src",
	 * "/bbs/bbs/user.do?id="+user); } } ); }
	 */
	// dynamic_ifream_height();

	$("#bbsiframe").load(function() {
		try{
			resetFrameSize();
		    if($.browser.msie){
                window.frames[0].last_load_img_flash();
			}  
		}catch(exception){
		    return ;
		}finally{
		    return ;
		}
	});
}

function open_user_figure(id){
	if(id>=2000000){
		window.open("/bbs/figure.do?id="+id, '_blank', 'height=310, width=410, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
	}
}

function open_url(url) {
	window.open(url);
}
function open_bbs(uuid, server_id) {
	if(uuid) {
		//setCookie('uuid',uuid,-1, '/', '.this6.com');
	}
	open_url('http://m.this6.com');
}
function open_workshop(id, npc_id) {
	if (!npc_id) {		npc_id = 0;	}
	open_url("/bbs/bbs/workshop.do?id=" + id + "&npc_id=" + npc_id);
}

function cancelDefault(event)
{
	if(event.preventDefault){
		event.preventDefault();
	}else{
		event.returnValue=false;
	}
}

function not_protect(hash) {
	window.location.replace('/bbs/newpage/not_protect.do?hash='+hash);
}

function cancelBubble(e)
{   	
    if(e.stopPropagation) e.stopPropagation(); 
    else e.cancelBubble=true;
}

function user3Dmodel(uuid){
	//window.open("/modeldiy/user3Dmodel.html?uuid="+uuid, '_blank', 'height=800, width=800, top=100%, left=100%, toolbar=no, menubar=no, scrollbars=yes, location=no, status=no');
}

function OpenNewWin(url)
{
    window.open(url,"_blank");
}

function go_top(){
	flash.focus();
}

function wordcount(tagid,minval,maxval){
    var count=window.document.getElementById(tagid).value.length;
    var show="当前字符数为"+count;
    if(minval!=null && minval>count){
    	show=show+" 您至少还需要输入"+(minval-count)+"个字符";
    }else if(maxval!=null){
    	if(maxval>=count){
    		show=show+" 您还可以输入"+(maxval-count)+"个字符";
    	}else{
    		show=show+" 最多只能输入"+(maxval)+"个字符";
    	}
    }
    alert(show);
}

function wordclear(tagid){
	var count=window.document.getElementById(tagid).value="";
}

function linkPost(url,inputs){
	var f = document.createElement("form");
	if(inputs){
		var kvs=inputs.split(";");
		var count=kvs.length;
		for(var i=0;i<count;i++){
			var kv=kvs[i].split("=");
			if(kv.length==2){
				var i = document.createElement("input");
				i.type="hidden";
				f.appendChild(i);
				i.name = kv[0];
				i.value = kv[1];
			}
		}
	}
	f.action = url;
	f.method = "POST";
	f.style.display = 'none';
	document.body.appendChild(f);
	f.submit();
}

function user_info(uuid,type,server_id) {
	//setCookie('uuid',uuid,-1, '/', '.this6.com');
	if(server_id==200){
			window.open('/bbs/c/user_info.do');
	}else{
			window.open('http://www.this6.com/bbs/c/user_info.do');
	}
}
function coop_anti_indulge(uuid,coop_type,server_id) {
	if(coop_type==0||coop_type==8||coop_type==10) {		
		if(server_id==200){
			window.open('/bbs/c/user_info.do');
		}else{
			window.open('http://www.this6.com/bbs/c/user_info.do');
		}
	}
}