﻿document.writeln("<script language='javascript' type='text/javascript' src='/js/tip.js'></script>");
//var j = jQuery.noConflict();

//AJAX方法取得数据并显示到页面上
function getfooter()
{
   //$("#load").show();
    $.ajax({
        type: "get",//使用get方法访问后台
        dataType: "json",//返回json格式的数据
        url: "/getfooter",//要访问的后台地址
        data: "",//要发送的数据
        //complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
        success: function(json){//json为返回的数据，在这里做数据绑定
            var data = json["result"];
            //$("#footer").html(data);
            $("#xiaoshicount").html(data);
        }
    });
}

//导航高亮显示
function setFocusNav()
{
    var _thisurl = document.location.href.toLowerCase();
    
    if(_thisurl.lastIndexOf("/index")==_thisurl.length-1)
    {
        $("#Image11").attr("src",$("#Image11").attr("src").replace(".gif","_over.gif"));
    }
    if(_thisurl.lastIndexOf("/lastest")!=-1)
    {
        $("#Image12").attr("src",$("#Image12").attr("src").replace(".gif","_over.gif"));
    }
    if(_thisurl.lastIndexOf("/best")!=-1)
    {
        $("#Image13").attr("src",$("#Image13").attr("src").replace(".gif","_over.gif"));
    }
    if(_thisurl.lastIndexOf("/tags")!=-1)
    {
        $("#Image14").attr("src",$("#Image14").attr("src").replace(".gif","_over.gif"));
    }
    if(_thisurl.lastIndexOf("/post")!=-1)
    {
        $("#Image15").attr("src",$("#Image15").attr("src").replace(".gif","_over.gif"));
    }
    if(_thisurl.lastIndexOf("/rank")!=-1)
    {
        $("#Image16").attr("src",$("#Image16").attr("src").replace(".gif","_over.gif"));
    }
    if(_thisurl.lastIndexOf("/elite")!=-1)
    {
        $("#Image17").attr("src",$("#Image17").attr("src").replace(".gif","_over.gif"));
    }
    if(_thisurl.lastIndexOf("/archives")!=-1)
    {
        $("#Image18").attr("src",$("#Image18").attr("src").replace(".gif","_over.gif"));
    }
    if(_thisurl.lastIndexOf("/articles")!=-1)
    {
        
    }
    
    LuoKuang.Url = _thisurl;
}

$(function(){
    initNavgator();
    /**setFocusNav();**/
    IsUserLogin(callbackfuc);
    setTimeout('getfooter()',1000);
    setInterval('getfooter()',1000*300);
    /**setInterval("IsUserLogin(callbackfuc)",1000*60);**/
    OpenAnnounce();
});
function OpenAnnounce(){
    var isread = Cookie.getCookie("isreadannounce");
    if(isread==null||isread==''){
        Cookie.setCookie('isreadannounce','true',{expireDays:15})
        lk_floatwin(this,"<font color='red'>由于新网暂停解析.cn域名，请通过<br/>www.xiaoshiyiluokuang.com<br/>访问本站,由此带来的不便敬请谅解，<br/>我们将会尽快恢复.cn域名。</font>"); 
    }  
    
}
function CheckKeywords()
{
    var kw=document.getElementById("ctl00_cphSearch_Search1_txtKeywords").value;
    var re=/[.<>"%&:\/]{1}/g;
    kw=kw.replace(re,'');
    
    if(kw=="")
    {
        alert("请输入关键字");
    }
    else
    {
        var _url="/"+window.encodeURIComponent(kw)+"/search";
        top.location.replace(_url);
    }
}

//playSwf("134x49_torino.swf",134,49);
function playSwf(fPath,width,height) 
{	
	//alert(fPath,width,height);
	var str;
	str = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+width+"\" height=\""+height+"\">\n\r";
	str += "	<param name=\"movie\" value=\""+fPath+"\" />\n\r";
	str += "	<param name=\"quality\" value=\"high\" />\n\r";
	str += "	<param name=\"wmode\" value=\"transparent\" />\n\r";
	str += "	<embed src=\""+fPath+"\" quality=\"high\"  width=\""+width+"\" height=\""+height+"\" type=\"application/x-shockwave-flash\"></embed>\n\r";
	str += "</object>\n\r";
	//alert(str);
	document.write(str);
}

var Cookie=new Object();
Cookie.setCookie=function(name,value,option)
{
    var str=name+"="+escape(value);

    if(option){
        if(option.expireDays){
            var date=new Date();
            var ms=option.expireDays*24*3600*1000;
            date.setTime(date.getTime()+ms);
            str+="; expires="+date.toGMTString();
        }
        else if(option.expire){
            str+="; expires="+option.expire;
        }
        if(option.path){
            str+="; path="+path;
        }
        else{
            str+="; path=/";
        }
        if(option.domain)str+="; domain"+domain;
        if(option.secure)str+="; true";
    };
    document.cookie=str
};
Cookie.getCookie=function(n){
    var re=new RegExp(n+'=([^;]*);?','gi');  
    var r=re.exec(document.cookie)||[];  
    return (r.length>1?r[1]:null) 
};
Cookie.deleteCookie=function(name){this.setCookie(name,"",{expireDays:-1})};
function trim(s){return s.replace(/(^\s*)|(\s*$)/g,'');}

//隐藏推荐按钮
function HideRecBtn(postid)
{
    var rec_histories = Cookie.getCookie("rec_histories");
    
    if(rec_histories.indexOf('+'+postid)!=-1)
    {
        $('#btnRec').hide();
        //$('#btnRec').attr('disabled','true');
    }
}

// 判断用户是否登录
function IsUserLogin(callbackfuc)
{
    if(LuoKuang.IsLogin) return;
    $.getJSON("/User/IsLoginHandler.ashx",callbackfuc);
}

function callbackfuc(json)
{
    var islogin = json["result"];
                if(islogin){
                    LuoKuang.IsLogin=true;
                    LuoKuang.UserId = json["userid"];
                    LuoKuang.UserName = json["username"];
                    LuoKuang.Pic = json["pic"];
                    LuoKuang.ThumbPic = json["thumbpic"];
                    LuoKuang.OrigPic = json["origpic"];
                }else{
                    LuoKuang.IsLogin=false;
                    getUserInfoFromCookie();
                }
                ShowTopInfo();
}

// 定义全局的箩筐变量
window.LuoKuang={};
LuoKuang=isUndefined(LuoKuang)?{UserId:0,UserName:"",Pic:"",ThumbPic:'',OrigPic:'',IsLogin:false,Url:""}:LuoKuang;

// 初始化导航菜单
function initNavgator()
{

    LuoKuang.Url = document.location.href.toLowerCase();
    $('#navgator > li').each(function(index,item){
        $(this).mouseover(function(){$(this).addClass('d01');});
        $(this).mouseout(function(){$(this).removeClass('d01');});
        
        if(LuoKuang.Url.lastIndexOf($(this).children('a').attr('href'))!=-1){
            $('.d01').removeClass('d01').addClass('m01');
            $(this).addClass('d01');
            //$(this).unbind('mouseout');
        }
    }); 
}

// 获取用户信息
function getUserInfoFromCookie()
{
    var _lkinfo = Cookie.getCookie("LuoKuangUser");
    
    if(_lkinfo != null && _lkinfo != "")
    {
        LuoKuang = eval(_lkinfo);
        
        LuoKuang.UserName = unescape(LuoKuang.UserName);
        
        if(!LuoKuang.IsLogin)
        {
            Login(LuoKuang.UserId,LuoKuang.VerifyCode);
        }
    }
}

// 登陆
function Login(userid,verifycode)
{
    var rUrl = '/AjaxData/userloginhandler.ashx?userid='+userid+'&verifycode='+verifycode;

    $.get(rUrl,function(data){
        var r = eval(data).result;

        if(r)
        {
            LuoKuang.IsLogin = true;
        }
        else
        {
            Cookie.deleteCookie("LuoKuangUser");
            LuoKuang.IsLogin = false;
        }
        ShowTopInfo();
    });
}
// 显示顶部登陆信息
function ShowTopInfo()
{
    var strNologin = "您好，您可以 <a href=\"\/login\" onfocus=\"this.blur()\" class=\"de02\">爬入箩筐<\/a> 或 ";
    strNologin += "<a href=\"\/register\" onfocus=\"this.blur()\" class=\"de02\">注册<\/a>";
    
    var strLogin = "<a href=\"\/users\/"+LuoKuang.UserId+"\" class=\"de02\" title=\""+LuoKuang.UserName+"\">"+LuoKuang.UserName+"<\/a>,";
    strLogin += "您又来逛箩筐啦！| <a href=\"\/messages\/inbox\" class=\"de02\" onfocus=\"this.blur()\">小纸条<\/a> | ";
    strLogin += "<a href=\"\/users\/favorites\" class=\"de02\" onfocus=\"this.blur()\">关注<\/a> | <a href=\"\/editpass\" class=\"de02\" onfocus=\"this.blur()\">修改密码<\/a> |"
    strLogin += " <a href=\"javascript:void(0);\" onclick=\"javascript:logout();\" onfocus=\"this.blur()\" class=\"de02\" onfocus=\"this.blur()\">爬出箩筐<\/a>";
    
    $('#nologin').html(strNologin);
    $('#loginok').html(strLogin);
    
    if(LuoKuang.IsLogin)
    {
        $('#nologin').hide();
        $('#loginok').show();
    }
    else
    {
        $('#nologin').show();
        $('#loginok').hide();
    }
}

//退出
function logout()
{
    var rUrl = "/AjaxData/LogoutHandler.ashx";
    $.get(rUrl, function(data){
        var result = data;
        LuoKuang.IsLogin = false;
        
        ShowTopInfo();
        
        Cookie.deleteCookie("LuoKuangUser");
    });
}

function lk_floatwin(obj,msg)
{
    var strTemplate = "";
	strTemplate += "<div class=\"float\" id=\"floatlayout_messagebox\">";
    strTemplate += "    <div class=\"floatboxnarrow\">";
    strTemplate += "        <h3 class=\"float_ctrl\">";
    strTemplate += "            <em id=\"floatwin_LuoKuangMsg_title\" style=\"font-style:normal\">信息<\/em> <span><a href=\"javascript:;\" class=\"float_close\"";
    strTemplate += "                onclick=\"floatwin('close_LuoKuangMsg')\" title=\"关闭\">关闭<\/a><\/span>";
    strTemplate += "        <\/h3>";
    strTemplate += "        <div class=\"messagebox\">";
    strTemplate += "            <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
    strTemplate += "                <tr>";
    strTemplate += "                    <td width=\"300\" height=\"120\" valign=\"middle\" align=\"center\">{0}</td>";
    strTemplate += "                </tr>";
    strTemplate += "             </table>";    
    strTemplate += "        <\/div>";
    strTemplate += "    <\/div>";
    strTemplate += "<\/div>";
    strTemplate = strTemplate.replace("{0}",msg);
    
    floatwin("open_LuoKuangMsg", "-1", 300, 150);
    $('#floatwin_LuoKuangMsg').html(strTemplate);
}
//*************************************************start floatwin
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
var is_mac = userAgent.indexOf('mac') != -1;

var zoomstatus = parseInt(1);
var imagemaxwidth = parseInt(600);
var aimgcount = new Array();
var ajaxdebug = 0;
var allowfloatwin = '1',IMGDIR = '/images/default/',VERHASH = 'Zge',STYLEID = '1';

function _$(id) {
	return document.getElementById(id);
}

function doane(event) {
	e = event ? event : window.event;
	if(is_ie) {
		e.returnValue = false;
		e.cancelBubble = true;
	} else if(e) {
		e.stopPropagation();
		e.preventDefault();
	}
}
function isUndefined(variable) {
	return typeof variable == 'undefined' ? true : false;
}
function in_array(needle, haystack) {
	if(typeof needle == 'string' || typeof needle == 'number') {
		for(var i in haystack) {
			if(haystack[i] == needle) {
					return true;
			}
		}
	}
	return false;
}

function strlen(str) {
	return (is_ie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length;
}

function AC_FL_RunContent() {
	var ret = AC_GetArgs(arguments, "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash");
	var str = '';
	if(is_ie && !is_opera) {
		str += '<object ';
		for (var i in ret.objAttrs) {
			str += i + '="' + ret.objAttrs[i] + '" ';
		}
		str += '>';
		for (var i in ret.params) {
			str += '<param name="' + i + '" value="' + ret.params[i] + '" /> ';
		}
		str += '</object>';
	} else {
		str += '<embed ';
		for (var i in ret.embedAttrs) {
			str += i + '="' + ret.embedAttrs[i] + '" ';
		}
		str += '></embed>';
	}
	return str;
}

var clipboardswfdata;
function setcopy(text, alertmsg){
	if(is_ie) {
		clipboardData.setData('Text', text);
		if(alertmsg) {
			alert(alertmsg);
		}
	} else {
		floatwin('open_clipboard', -1, 300, 110);
		_$('floatwin_clipboard_title').innerHTML = '剪贴板';
		str = '<div style="text-decoration:underline;">点此复制到剪贴板</div>' +
			AC_FL_RunContent('id', 'clipboardswf', 'name', 'clipboardswf', 'devicefont', 'false', 'width', '100', 'height', '20', 'src', '/images/common/clipboard.swf', 'menu', 'false',  'allowScriptAccess', 'sameDomain', 'swLiveConnect', 'true', 'wmode', 'transparent', 'style' , 'margin-top:-20px');
		_$('floatwin_clipboard_content').innerHTML = str;
		clipboardswfdata = text;
	}
}

var cssloaded= new Array();
function loadcss(cssname) {
	if(!cssloaded[cssname]) {
		css = document.createElement('link');
		css.type = 'text/css';
		css.rel = 'stylesheet';
		css.href = '/css/' + cssname + '.css?' + VERHASH;
		var headNode = document.getElementsByTagName("head")[0];
		headNode.appendChild(css);
		cssloaded[cssname] = 1;
	}
}
//FloatWin
var hiddenobj = new Array();
var floatwinhandle = new Array();
var floatscripthandle = new Array();
var floattabs = new Array();
var floatwins = new Array();
var InFloat = '';
var floatwinreset = 0;
var floatwinopened = 0;

/**
*<a id="emailfriend" onclick="floatwin('open_emailfriend', this.href, 250, 200);return false;" 
* href="misc.php?action=emailfriend&tid=36189">分享</a>
*<a id="ratelink" onclick="floatwin('open_login', this.href, 600, 400);return false;" 
*href="logging.php?action=login">评分</a>
**/
function floatwin(action, script, w, h, scrollpos) {
	var floatonly = !floatonly ? 0 : 1;
	var actione = action.split('_');
	action = actione[0];
	if((!allowfloatwin || allowfloatwin == 0) && action == 'open' && in_array(actione[1], ['register','login','newthread','reply','edit']) && w >= 600) {
		location.href = script;
		return;
	}
	var handlekey = actione[1];
	var layerid = 'floatwin_' + handlekey;
	if(is_ie) {
		var objs = _$('wrap').getElementsByTagName("OBJECT");
	} else {
		var objs = _$('wrap').getElementsByTagName("EMBED");
	}
	if(action == 'open') {
		loadcss('winmodal');
		floatwinhandle[handlekey + '_0'] = layerid;
		if(!floatwinopened) {
			_$('wrap').onkeydown = floatwin_wrapkeyhandle;
			for(i = 0;i < objs.length; i ++) {
				if(objs[i].style.visibility != 'hidden') {
					objs[i].setAttribute("oldvisibility", objs[i].style.visibility);
					objs[i].style.visibility = 'hidden';
				}
			}
		}
		scrollpos = !scrollpos ? '' : 'floatwin_scroll(\'' + scrollpos + '\');';
		var clientWidth = document.body.clientWidth;
		var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
		var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
		if(script && script != -1) {
			if(script.lastIndexOf('/') != -1) {
				script = script.substr(script.lastIndexOf('/') + 1);
			}
			var scriptfile = script.split('?');
			scriptfile = scriptfile[0];
			if(floatwinreset || floatscripthandle[scriptfile] && floatscripthandle[scriptfile][0] != script) {
				if(!isUndefined(floatscripthandle[scriptfile])) {
					_$('append_parent').removeChild(_$(floatscripthandle[scriptfile][1]));
					_$('append_parent').removeChild(_$(floatscripthandle[scriptfile][1] + '_mask'));
				}
				floatwinreset = 0;
			}
			floatscripthandle[scriptfile] = [script, layerid];
		}
		if(!_$(layerid)) {
			floattabs[layerid] = new Array();
			div = document.createElement('div');
			div.className = 'floatwin';
			div.id = layerid;
			div.style.width = w + 'px';
			div.style.height = h + 'px';
			div.style.left = floatwinhandle[handlekey + '_1'] = ((clientWidth - w) / 2) + 'px';
			div.style.position = 'absolute';
			div.style.zIndex = '999';
			div.onkeydown = floatwin_keyhandle;
			_$('append_parent').appendChild(div);
			_$(layerid).style.display = '';
			_$(layerid).style.top = floatwinhandle[handlekey + '_2'] = ((clientHeight - h) / 2 + scrollTop) + 'px';
			_$(layerid).innerHTML = '<div><h3 class="float_ctrl"><em><img src="' + IMGDIR + '/loading.gif"> 加载中...</em><span><a href="javascript:;" class="float_close" onclick="floatwinreset = 1;floatwin(\'close_' + handlekey + '\');">&nbsp</a></span></h3></div>';
			divmask = document.createElement('div');
			divmask.className = 'floatwinmask';
			divmask.id = layerid + '_mask';
			divmask.style.width = (parseInt(_$(layerid).style.width) + 14) + 'px';
			divmask.style.height = (parseInt(_$(layerid).style.height) + 14) + 'px';
			divmask.style.left = (parseInt(_$(layerid).style.left) - 6) + 'px';
			divmask.style.top = (parseInt(_$(layerid).style.top) - 6) + 'px';
			divmask.style.position = 'absolute';
			divmask.style.zIndex = '998';
			divmask.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=90,finishOpacity=100,style=0)';
			divmask.style.opacity = 0.9;
			_$('append_parent').appendChild(divmask);
			if(script && script != -1) {
				script += (script.search(/\?/) > 0 ? '&' : '?') + 'infloat=yes&handlekey=' + handlekey;
				var strTemplate = "";
				strTemplate += "<div class=\"float\" id=\"floatlayout_messagebox\">";
                strTemplate += "    <div class=\"floatboxnarrow\">";
                strTemplate += "        <h3 class=\"float_ctrl\">";
                strTemplate += "            <em id=\"" + layerid + "_title\" style=\"font-style:normal\">信息<\/em> <span><a href=\"javascript:;\" class=\"float_close\"";
                strTemplate += "                onclick=\"floatwin('close_" + handlekey + "')\" title=\"关闭\">关闭<\/a><\/span>";
                strTemplate += "        <\/h3>";
                strTemplate += "        <div class=\"messagebox\">";
                strTemplate += "            <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
                strTemplate += "                <tr>";
                strTemplate += "                    <td width=\"300\" height=\"120\" valign=\"middle\" align=\"center\">{0}</td>";
                strTemplate += "                </tr>";
                strTemplate += "             </table>"; 
                strTemplate += "        <\/div>";
                strTemplate += "    <\/div>";
                strTemplate += "<\/div>";
				try {
					$.ajax({
                       type: "GET",
                       url: script,
                       //data: "",
                       dataType:"text",
                       complete:function(){$("#layerid").html('');},
                       success: function(msg){
                         //alert( "Data Saved: " + msg );
                         var r = strTemplate.replace('{0}',msg);
                         ajaxinnerhtml(_$(layerid),r);
                         scroll(0,_$(layerid).offsetTop);
                       }
                    });
					
				} catch(e) {
				    //alert(e.name);
					//setTimeout("ajaxget('" + script + "', '" + layerid + "', '', '', '', '" + scrollpos + "')", 1000);
				}
			} else if(script == -1) {
				_$(layerid).innerHTML = '<div><h3 class="float_ctrl"><em id="' + layerid + '_title"></em><span><a href="javascript:;" class="float_close" onclick="floatwinreset = 1;floatwin(\'close_' + handlekey + '\');">&nbsp</a></span></h3></div><div id="' + layerid + '_content"></div>';
				_$(layerid).style.zIndex = '1099';
				_$(layerid + '_mask').style.zIndex = '1098';
			}
		} else {
			_$(layerid).style.width = w + 'px';
			_$(layerid).style.height = h + 'px';
			_$(layerid).style.display = '';
			_$(layerid).style.top = floatwinhandle[handlekey + '_2'] = ((clientHeight - h) / 2 + scrollTop) + 'px';
			_$(layerid + '_mask').style.width = (parseInt(_$(layerid).style.width) + 14) + 'px';
			_$(layerid + '_mask').style.height = (parseInt(_$(layerid).style.height) + 14) + 'px';
			_$(layerid + '_mask').style.display = '';
			_$(layerid + '_mask').style.top = (parseInt(_$(layerid).style.top) - 6) + 'px';
		}
		floatwins[floatwinopened] = handlekey;
		floatwinopened++;
	} else if(action == 'close' && floatwinhandle[handlekey + '_0']) {
		floatwinopened--;
		for(i = 0;i < floatwins.length; i++) {
			if(handlekey == floatwins[i]) {
				floatwins[i] = null;
			}
		}
		if(!floatwinopened) {
			for(i = 0;i < objs.length; i ++) {
				if(objs[i].attributes['oldvisibility']) {
					objs[i].style.visibility = objs[i].attributes['oldvisibility'].nodeValue;
					objs[i].removeAttribute('oldvisibility');
				}
			}
			_$('wrap').onkeydown = null;
		}
		hiddenobj = new Array();
		_$(layerid + '_mask').style.display = 'none';
		_$(layerid).style.display = 'none';
	} else if(action == 'size' && floatwinhandle[handlekey + '_0']) {
		if(!floatwinhandle[handlekey + '_3']) {
			var clientWidth = document.body.clientWidth;
			var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
			var w = clientWidth > 800 ? clientWidth * 0.9 : 800;
			var h = clientHeight * 0.9;
			floatwinhandle[handlekey + '_3'] = _$(layerid).style.left;
			floatwinhandle[handlekey + '_4'] = _$(layerid).style.top;
			floatwinhandle[handlekey + '_5'] = _$(layerid).style.width;
			floatwinhandle[handlekey + '_6'] = _$(layerid).style.height;
			_$(layerid).style.left = floatwinhandle[handlekey + '_1'] = ((clientWidth - w) / 2) + 'px';
			_$(layerid).style.top = floatwinhandle[handlekey + '_2'] = ((document.documentElement.clientHeight - h) / 2 + document.documentElement.scrollTop) + 'px';
			_$(layerid).style.width = w + 'px';
			_$(layerid).style.height = h + 'px';
		} else {
			_$(layerid).style.left = floatwinhandle[handlekey + '_1'] = floatwinhandle[handlekey + '_3'];
			_$(layerid).style.top = floatwinhandle[handlekey + '_2'] = floatwinhandle[handlekey + '_4'];
			_$(layerid).style.width = floatwinhandle[handlekey + '_5'];
			_$(layerid).style.height = floatwinhandle[handlekey + '_6'];
			floatwinhandle[handlekey + '_3'] = '';
		}
		_$(layerid + '_mask').style.width = (parseInt(_$(layerid).style.width) + 14) + 'px';
		_$(layerid + '_mask').style.height = (parseInt(_$(layerid).style.height) + 14) + 'px';
		_$(layerid + '_mask').style.left = (parseInt(_$(layerid).style.left) - 6) + 'px';
		_$(layerid + '_mask').style.top = (parseInt(_$(layerid).style.top) - 6) + 'px';
	}
}

function floatwin_scroll(pos) {
	var pose = pos.split(',');
	try {
		pagescroll.defaultleft = pose[0];
		pagescroll.defaulttop = pose[1];
		pagescroll.init();
	} catch(e) {}
}

function floatwin_wrapkeyhandle(e) {
	e = is_ie ? event : e;
	if(e.keyCode == 9) {
		doane(e);
	} else if(e.keyCode == 27) {
		for(i = floatwins.length - 1;i >= 0; i--) {
			floatwin('close_' + floatwins[i]);
		}
	}
}

function floatwin_keyhandle(e) {
	e = is_ie ? event : e;
	if(e.keyCode == 9) {
		doane(e);
		var obj = is_ie ? e.srcElement : e.target;
		var srcobj = obj;
		j = 0;
		while(obj.className.indexOf('floatbox') == -1) {
			obj = obj.parentNode;
		}
		obj.id = obj.id ? obj.id : 'floatbox_' + Math.random();
		if(!floattabs[obj.id]) {
			floattabs[obj.id] = new Array();
			var alls = obj.getElementsByTagName("*");
			for(i = 0;i < alls.length;i++) {
				if(alls[i].getAttribute('tabindex') == 1) {
					floattabs[obj.id][j] = alls[i];
					j++;
				}
			}
		}
		if(floattabs[obj.id].length > 0) {
			for(i = 0;i < floattabs[obj.id].length;i++) {
				if(srcobj == floattabs[obj.id][i]) {
					j = e.shiftKey ? i - 1 : i + 1;break;
				}
			}
			if(j < 0) {
				j = floattabs[obj.id].length - 1;
			}
			if(j > floattabs[obj.id].length - 1) {
				j = 0;
			}
			do{
				focusok = 1;
				try{ floattabs[obj.id][j].focus(); } catch(e) {
					focusok = 0;
				}
				if(!focusok) {
					j = e.shiftKey ? j - 1 : j + 1;
					if(j < 0) {
						j = floattabs[obj.id].length - 1;
					}
					if(j > floattabs[obj.id].length - 1) {
						j = 0;
					}
				}
			} while(!focusok);
		}
	}
}

function ajaxinnerhtml(showid, s) {
	if(showid.tagName != 'TBODY') {
		showid.innerHTML = s;
	} else {
		while(showid.firstChild) {
			showid.firstChild.parentNode.removeChild(showid.firstChild);
		}
		var div1 = document.createElement('DIV');
		div1.id = showid.id+'_div';
		div1.innerHTML = '<table><tbody id="'+showid.id+'_tbody">'+s+'</tbody></table>';
		_$('append_parent').appendChild(div1);
		var trs = div1.getElementsByTagName('TR');
		var l = trs.length;
		for(var i=0; i<l; i++) {
			showid.appendChild(trs[0]);
		}
		var inputs = div1.getElementsByTagName('INPUT');
		var l = inputs.length;
		for(var i=0; i<l; i++) {
			showid.appendChild(inputs[0]);
		}
		div1.parentNode.removeChild(div1);
	}
}
// **************************************************************end floatwin
