﻿String.prototype.sub = function(n,point){ 
var r = /[^\x00-\xff]/g;
 if(this.replace(r, "mm").length <= n) return this;
  n = n - 3;
  var m = Math.floor(n/2); 
  for(var i=m; i<this.length; i++) {
   if(this.substr(0, i).replace(r, "mm").length>=n) 
   {
   if(point)
   	return this.substr(0, i) +".."; 
   else
    return this.substr(0,i);
   } 
 }
 return this;
 };

var Cookie = {
	setCookie: function(name, value, expires, path, domain)
	{
		document.cookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "; path=/") +
			((domain) ? "; domain=" + domain : "");
	},

	getCookie: function(name)
	{
		var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));

		if (arr != null)
		{
			return unescape(arr[2]);
		
		}

		return null;
	},

	clearCookie: function(name, path, domain)
	{
		if (Cookie.getCookie(name))
		{
			document.cookie = name + "=" +
				((path) ? "; path=" + path : "; path=/") +
				((domain) ? "; domain=" + domain : "") +
				";expires=Fri, 02-Jan-1970 00:00:00 GMT";
		}
	},
    //防灌水，一个动作之完成，１５秒之后才能进行下一动作
    nowarter:function()
    {
        if(Cookie.getCookie("action")==null)
        {
            var ntime = new Date();
		    var stime = new Date(ntime.getYear(), ntime.getMonth(), ntime.getDate(), ntime.getHours(), ntime.getMinutes(), ntime.getSeconds()+15);
		    Cookie.setCookie("action", "ok", stime);
		    return true;
        }
        else
        {
            alert("你丫灌水");
            return false;
        }
    }, 
    
	getUserUin: function()
	{
		var tmp = Cookie.getCookie('uin');
		if (!tmp)
		{
			return '';
		}
		var uin = '';
		var start = 0;
		for (i = 0; i < tmp.length; ++i)
		{
			var c = tmp.charAt(i);
			if (c == 'o' || c == '0' && start == 0)
			{
				continue;
			}
			else
			{
				start = 1;
				uin += c;
			}
		}
		return uin;
	}
};

//右侧菜单

//根据id获取对象
function $(obj){
    return document.getElementById(obj);
}
//获取cookies
function GetCookie(sName){
    var aCookie = document.cookie.split("; ");
    for (var i=0; i < aCookie.length; i++)
    {
        var aCrumb = aCookie[i].split("=");
        if (sName == aCrumb[0])
        {
            return aCrumb[1];
        }
    }
    return null;
 }  
/*热门线路
i       ，排序
id      ，编号
name    ，名称
num     ，预定次数
*/
function ShowHotLine(i,id,name,num){
    document.writeln('<table width="99%" border="0" cellspacing="0" cellpadding="0">');
    document.writeln('<tr>');
    document.writeln('<td width="5%" valign="middle">');
    document.writeln('<img src="../images/'+i+'.gif" width="15" height="15" /></td>');
    document.writeln('<td width="68%" height="27" valign="middle" class="right_z" align="left">');
    document.writeln('<a href="/NewLine/Show-'+id+'.html" title='+name+' target=-blank>'+CutStr(name,18,true)+'</a></td>');
    document.writeln('<td width="27%" align="right" valign="middle" class="right_z">'+num+'</td>');
    document.writeln('</tr>');
    document.writeln('</table>');
    
}

function CutStr(str,length,havepoint)
{
    if(str.length<=length) return str;
    if(havepoint)
        str=str.substring(0,length-2)+"..";
    else
        str=str.substring(0,length);
        
    return str;
}

function HotAsk(id,title,editor,nickname,state){
    if(nickname==null) nickname==editor;
    document.writeln("<table width='309' border='0' cellspacing='0' cellpadding='0' class='right_z'>");
    document.writeln("<tr>");
    document.writeln("<td width='180' height='25' align='left' valign='bottom' class='right_z'><img src='../images/kk.gif' width='6' height='6' /> ");
    document.writeln("<a href='/NewAsk/Show.aspx?ID="+id+"' title='"+title+"'>");
    
    document.writeln(CutStr(title,12,true));
    document.writeln("</a></td>");
    document.writeln("<td width='75' height='25' align='left' valign='bottom' class='right_z'>");
    document.writeln("<a title="+nickname+" target=_blank href='/Member/Space.aspx?UserName="+editor+"'>"+CutStr(nickname,6,true)+"</a>");
    document.writeln("</td>");
    var cstate="";
    switch(state)
    {
        case -1:
            cstate="未回答";
            break;
        case 0:
            cstate="已回答";
            break;
        case 1:
            cstate="已解决";
            break;
    }
    
    document.writeln("<td width='54' align='center' valign='bottom' class='askstate"+state+"'>"+cstate+"</td>");
    
    document.writeln("</tr>");
    document.writeln("</table>");
}

/*类似的线路*/
function SimLine(i,lineid,linename,ordertimes){
     document.writeln("<table width='99%' border='0' cellspacing='0' cellpadding='0'>");
     document.writeln("<tr>");
     document.writeln("<td width='5%' valign='middle'><img src='../images/"+i+".gif' width='15' height='15' /></td>");
     document.writeln("<td width='68%' height='27' valign='middle' class='right_z'>");
     document.writeln("<a href='/NewLine/Show-"+lineid+".html'>"+linename+"</a></td>");
     document.writeln("<td width='27%' align='right' valign='middle' class='right_z'>【已有"+ordertimes+"次】</td>");
     document.writeln("</tr>");
     document.writeln("</table>");
}
/*显示签证*/
function ListVisa(country,visatype,restime){
    document.writeln("<table width='309' border='0' cellspacing='0' cellpadding='0' class='right_z'>");
    document.writeln("<tr>");
    document.writeln("<td width='59' height='25' align='left' valign='middle' class='right_z'><img src='../images/kk.gif' width='6' height='6' />"+country+"</td>");
    document.writeln("<td width='103' align='center' valign='middle' class='right_z'>"+visatype+"</td>");
    document.writeln("<td width='60' align='center' valign='middle' class='right_z'>"+restime+"</td>");
    document.writeln("<td width='45' align='center' valign='middle' class='right_z'>"+mprice+"</td>");
    document.writeln("<td width='42' align='center' valign='middle' class='right_z'>"+wprice+"</td>");
    document.writeln("</tr>");
    document.writeln("</table>");
    
}

/*最精美的游记*/
function HotDiary(index,id,title,editor,NickName,Stars){
    var lenstr=14;//字符长度
    document.writeln("<table width='99%' border='0' cellspacing='0' cellpadding='0'>");
    document.writeln("<tr><td width='5%' valign='middle'>");
    document.writeln("&nbsp;</td>");
    document.writeln("<td width='53%' height='27' valign='middle' class='right_z' align='left'>");
    if(title.length<lenstr)
        document.writeln("<a href='/NewDiary/Show-"+id+".html'>"+title+"</a>");
    else
        document.writeln("<a href='/NewDiary/Show-"+id+".html' title='"+title+"'>"+title.substring(0,lenstr)+"</a>");
    document.writeln("</td>");
    document.writeln("<td width='20%' align='right' valign='middle' class='right_z' >");
    
    document.writeln("<a href='/Member/Space.aspx?UserName="+editor+"' target=_blank title='"+NickName+"'>"+CutStr(NickName,5,true)+"</a>");
    document.writeln("</td>");
    document.writeln("<td width='22%' align='center' valign='middle' class='right_z STYLE2'>");
    for(var i=1;i<=Stars;i++)
        document.write("<img src='../images/xin.gif' width='13' height='11' />");
    document.writeln("</td></tr></table>");
    
}
/*每行显示两个*/
function List2Article(Border,id1,visaname1,id2,visaname2){
document.writeln("<table width='309' border='0' cellspacing='0' cellpadding='0' class='right_z'>");
document.writeln("<tr>");
document.writeln("<td width='149' height='25' align='left' valign='bottom' class='right_z'>");
document.writeln("<img src='../images/kk.gif' width='6' height='6' />");
if(visaname1.length<10)
    document.writeln("<a href='/"+Border+"/Show-"+id1+".html'>"+visaname1+"</a></td>");
else
    document.writeln("<a href='/"+Border+"/Show-"+id1+".html' title='"+visaname1+"'>"+visaname1.substring(0,10)+"</a></td>");
//row2
if(id2==null||id2==""){
    document.writeln("<td width='160' class='right_z'>&nbsp;</td>");
}
else
{
    document.writeln("<td width='160' height='25' align='left' valign='bottom' class='right_z'>");
    document.writeln("<img src='../images/kk.gif' width='6' height='6' />")
    if(visaname2.length<10)
        document.writeln("<a href='/"+Border+"/Show-"+id2+".html'>"+visaname2+"</a></td>");
    else
        document.writeln("<a href='/"+Border+"/Show-"+id2+".html' title='"+visaname2+"'>"+visaname2.substring(0,10)+"</a></td>");
}
document.writeln("</tr></table>");
document.writeln("");
}
/*推荐景点*/
function BuildScenceHtml(index,scencename,d_picture,country,stype,price,Stars,id){
    var html="";
    html+="<table width='95%' cellspacing='0' align='center'>";
    html+="<tr>";
    html+="<td colspan='3' align='left' class='text_line_lQ' width='320'><img src='../images/"+(parseInt(index)+1)+".gif' width='13' height='13' />&nbsp;"+scencename+"</td>"
    html+="</tr><tr>";
    html+="<td colspan='3' align='right' background='../images/x_line.gif'>";
    html+="<img src='../images/BG_d.gif' width='8' height='9' />";
    html+="</td></tr><tr>";
    html+="<td width='147' rowspan='4' valign='top'>";
    html+=" <table width='135' height='80'  align='center' class='box_imgs'>";
    html+=" <tr>";
    html+=" <td width='105' height='76'>";
    html+="<a href='/NewScence/Show"+id+"-.html'></a>"
    
    if(d_picture=="")
        html+="暂无图片";
    else{
    
        html+="<img src='"+d_picture+"' width=128 height=74>";
    }
    html+="</td>"            
    html+=" </tr>";
    html+=" </table></td>";               
    html+="<td width='64' height='24' align='left'>区域：</td>";
    html+="<td width='109' align='left'>"+country+"</td>";  
    html+="</tr><tr>";
    html+="<td align='left'>类型：</td>";
    html+="<td width='109' align='left'>"+stype+"</td>"; 
    html+="</tr><tr>"; 
    html+="<td align='left'>票价参考：</td>";
    html+="<td width='109' align='left'>"+price+"元/RMB</td>";
    html+="</tr><tr>";      
    html+="<td height='24' align='left'>好评指数：</td>";
    html+="<td width='109' align='left'>";
    for(var i=1;i<=Stars;i++)
        html+="<img src='../images/xin.gif' width='13' height='11' />";
    html+="</td></tr></table>";        
    return html;         
}
/*一排两行的*/
function Build2TDHtml(url1,url2,len,title1,title2){
    var html="";
    html+="<table width='309' border='0' cellspacing='0' cellpadding='0' class='right_z'>";
    html+="<tr>";
    html+="<td width='149' height='25' align='left' valign='bottom' class='right_z'>";
    html+="<img src='../images/kk.gif' width='6' height='6' />";
    if(title1.length<len)
        html+="<a href="+url1+">"+title1+"</a>";
    else
        html+="<a href="+url1+" title=\""+title1+"\">"+title1.substring(0,len)+"..</a>";
    html+="</td>";
    html+="<td width='160' height='25' align='left' valign='bottom' class='right_z'>";
    html+="<img src='../images/kk.gif' width='6' height='6' /> ";
    if(title2.length<len)
        html+="<a href="+url2+">"+title2+"</a>";
    else
        html+="<a href="+url2+" title=\""+title2+"\">"+title2.substring(0,len)+"..</a>";
    html+="</td>";
    html+="</tr>"
    html+="</table>";
    return html;
}

function Go()
{
    var url='http://'+$("city").options[$("city").selectedIndex].value+'.ila571.com';
    location.href=url;
}
//初始化头部的导航菜单颜色
function Head_Init(table){
    //修改logo
    try
    {
        $("logo").src="/logo/"+GetYuMi()+".jpg";
        var scity="上海|北京|南京|苏州|杭州|合肥|广州|深圳|惠州";
        var scityvalue="shanghai|beijing|nanjing|suzhou|hangzhou|hefei|guangzhou|shenzhen|huizhou";
        var Array_scity=scity.split('|');
        var Array_scityvalue=scityvalue.split('|');
        for(i=$("city").length-1;i>=0;i--){$("city").options.remove(i);}
        for(i=0;i<Array_scity.length;i++){
            $("city").options.add(new Option(Array_scity[i]+"出发",Array_scityvalue[i]));
	        if(GetYuMi()==Array_scityvalue[i]) $("city")[i].selected=true;
        }
    }
    catch(ex)
    {
        //rwritepage
    }
	var alltable = ["shouye","line","scence","hotel","diary","visa","friend","exp","ask","member"];
		for (i=0; i<alltable.length; i++){
			if(table==alltable[i])
				$(alltable[i]).className = "topbox1";
			else
				$(alltable[i]).className = "topbox2";
		}
}

function GetYuMi()
{
    var url=window.location.href.toLowerCase();
    var yumi=url.substring(7,url.length);
    yumi=yumi.substring(0,yumi.indexOf('.'));
    if(yumi=="") yumi="www";
    if(yumi=="ila571") yumi="www";
    return yumi;
    //alert(yumi);
    
    
}

//获取地址栏参数
function GetQuerry(name)
{
 var str=window.location.search;
 if (str.indexOf(name)!=-1)
 {
  var pos_start=str.indexOf(name)+name.length+1;
  var pos_end=str.indexOf("&",pos_start);
  if (pos_end==-1)
  {
   return str.substring(pos_start);
  }
  else
  {
   return str.substring(pos_start,pos_end)
  }
 }
 else
 {
  return null;
 }
}

//Ajax Start
function Ajax_GetXMLHttpRequest() {
    if(window.XMLHttpRequest){
		return new XMLHttpRequest();
	} else if(window.ActiveXObject){
		return new ActiveXObject("Microsoft.XMLHTTP");
	} 
	throw new Error("XMLHttp object could be created.");
}

function Ajax_CallBack(loadingtext,ID,URL){//Ajax回传
    if(ID==null) return;
    if(loadingtext==null)loadingtext="<p align='center'><img src='/Images/loading.gif'>载入中...</p>";
	var x = Ajax_GetXMLHttpRequest();
	var ID = $(ID);
	x.open("GET",URL,false);
	x.setRequestHeader("REFERER", location.href);
	x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	x.onreadystatechange = function(){
	if(x.readyState == 4 && x.status == 200 && ID){
	    //alert(x.responseText);
	    try
	    {
	    ID.innerHTML=x.responseText;
	    }
	    catch(ex){}
	 }
	else{ 
	    ID.innerHTML=loadingtext;
	 }
	}
	x.send("");
}
function Add(spanid,num)
{
    var total=parseInt($(spanid).innerText)+num;
    $(spanid).innerText=total;
}
/*鸡蛋，鲜花*/
function Ajax_Get_Flower(Border,ID)
{
    var URL="/Ajax/Member/Flower_Egg.aspx?T="+Border+"&ID="+ID+"&F=";
    Ajax_CallBack("0","countFor_"+ID,URL+"1");
    Ajax_CallBack("0","countAgainst_"+ID,URL+"-1");
}
function Ajax_Give_Flower(Border,ID,IsFlower){
	if (Cookie.getCookie("tobtorchcookie") == null)
    {
    if(ID==null) return;
    var loadingtext="投票中...";
	var x = Ajax_GetXMLHttpRequest();
	//var ID = $(ID);
	var URL="/Ajax/Member/Flower_Egg.aspx?T="+Border+"&ID="+ID+"&Act=vote&F=";
	if(IsFlower)
	    URL+="1";
	else
	    URL+="-1";
	x.open("GET",URL,false);
	x.setRequestHeader("REFERER", location.href);
	x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	x.onreadystatechange = function(){
	if(x.readyState == 4 && x.status == 200 && ID){
	    //alert(x.responseText);
	    switch(x.responseText)
	    {
	        case "1":
	            //alert("投票成功");
	            if(IsFlower)
	            {
	                Add("countFor_"+ID,1);
	                $("span_VoteFor_"+ID).innerText="已支持";
	            }    
	            else
	            {
	                $("span_VoteAgainst_"+ID).innerText="已反对";
	                Add("countAgainst_"+ID,1);
	            }   
	            var ntime = new Date();
		        var stime = new Date(ntime.getYear(), ntime.getMonth(), ntime.getDate(), ntime.getHours(), ntime.getMinutes(), ntime.getSeconds()+15);
		        Cookie.setCookie("tobtorchcookie", "ok", stime);
	        break;
	        case "0":
	            alert("投票失败");
	        break;
	        default:
	        {
	            $("span_VoteAgainst_"+ID).innerText="鸡蛋";
	            $("span_VoteFor_"+ID).innerText="鲜花";
	            alert(x.responseText);
	            var ntime = new Date();
		        var stime = new Date(ntime.getYear(), ntime.getMonth(), ntime.getDate(), ntime.getHours(), ntime.getMinutes(), ntime.getSeconds()+15);
		        Cookie.setCookie("tobtorchcookie", "ok", stime);
	        }
	        break;
	    }
	 }
	else{ 
	    if(IsFlower)
	        $("span_VoteFor_"+ID).innerText=loadingtext;
	    else
	        $("span_VoteAgainst_"+ID).innerText=loadingtext;
	    ID.innerHTML=loadingtext;
	 }
	}
	x.send(null);
	}
	else
	
	{
	    alert("抱歉，您的操作过于频繁，请于15秒后重试");
	}
}

    //获取评论条数
	function GetCountPl(id,border)
	{
	    Ajax_CallBack("loading","plcount","/NewAspx/GetCommentsCount.aspx?ID="+id+"&Border="+border);
	}
    function GetMemberStar(id,border)
    {
        Ajax_CallBack("","member_star","/Ajax/GetAvg.aspx?ID="+id+"&T="+border)
    }
//Ajax End


function IsInArray(str,arr){
    for(var i=0;i<arr.length;i++){
        if(str==arr[i]) return true;
    }
    return false;
}

//隐藏某个层
function Div_Hide(obj){
	$(obj).style.visibility="hidden";
}
function Div_Show(obj){
    $(obj).style.visibility="visible";
}   
//举中层
function  Div_Scall(obj){   
    $(obj).style.top=document.body.scrollTop+(document.body.clientHeight-$(obj).offsetHeight)/2   
    $(obj).style.left=document.body.scrollLeft+(document.body.clientWidth-$(obj).offsetWidth)/2;   
}   

function Vote(border,id)
{
	showModalDialog( '/NewAspx/VoteDialog.aspx?url=Vote.aspx&T='+border+'&id='+id, window , 'dialogWidth:400px;dialogHeight:300px; dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes; ');
	window.location.reload(true);
}

function UnSameBorder(bid,keywods,id){
    switch(bid)
    {
        case 13:
            $("UnSameBorderTitle").innerText="找找相关的签证";
            Ajax_CallBack(null,"UnSameBorderContent","/Ajax/Line_Visa.aspx?Counntrys="+keywods);
            break;
        case 14:
        case 15:
            //$("UnSameBorderTitle").className
            $("UnSameBorderTitle").innerText="找找相关的同游";
            Ajax_CallBack(null,"UnSameBorderContent","/Ajax/Agreed/GetForLine.aspx?ID="+id+"&Key="+keywods);
            break;
        case 16:
            $("UnSameBorderTitle").innerText="找找相关的同游";
            $("UnSameBorderTitle").style.height="0";
            break;
    }
}
//获取静态页id
//function GetHtmlID()
//{
//    var url=location.href;
//    var pagename=url.substring(url.LastindexOf('/'),url.length);
//    //var pageext="";
//    alert(pagename);
//}

function Border_Init(groupname,showid,start,end){
        for(var i=start;i<=end;i++){
            if(i==showid){
                $(groupname+i).className="topbox1";
            }
            else{
                $(groupname+i).className="topbox2";
            }
        }
    }
function Border_Init2(groupname,showid,start,end){
        for(var i=start;i<=end;i++){
            if(i==showid){
                $(groupname+i).className="topboxb1";
            }
            else{
                $(groupname+i).className="topboxb2";
            }
        }
    }
function IsEmptyTextBox(obj,msg)
{
if($(obj).value=="")
{
    alert(msg);
    $(obj).focus();
    return true;
}
return false;
}

function Build_AD_Img(url,pic){
    var html="";
    html+="<a href='"+url+"' target=\"_blank\">";
    html+="<img class='imgAD_GreeBorder' src=\""+pic+"\" border='0'/></a>";
    return html;
}

function Build_AD_SWF(swfurl,width,height)
{
    var html="";
    html+="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+width+"\" height=\""+height+"\">";
    html+="<param name=\"movie\" value=\""+swfurl+"\">";
    html+="<param name=\"quality\" value=\"high\">";
    //滤镜支持
    html+="<param value=\"false\" name=\"menu\"/>";
    html+="<param value=\"opaque\" name=\"wmode\"/>";
    //end
    html+="<embed src=\""+swfurl+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\"></embed>";
    html+="</object>";
    return html;

}
function LoadJS(path){
	var header = document.getElementsByTagName("head")[0];
	var s = document.createElement("script");
	s.src = path;
	header.appendChild(s);
}

//显示登陆对话框
function ShowLoginForm()
{
    if(Cookie.getCookie("UserName")==null){
        //style1
        var divId=$('windlocation');
        if(divId==null)
        {//create;
            
            divId=document.createElement("DIV");
            divId.id="shadow";
            document.body.appendChild(divId);
            
            divId=document.createElement("DIV");
            divId.id="windlocation";
            divId.style.visibility="visible";
            divId.innerHTML="<iframe src=\"/Member/LoginForm.html\" id=\"loginframe\" scrolling=\"no\" frameborder=\"0\" width=\"385\" height=\"205\"></iframe>";
            $("shadow").appendChild(divId);
            
            
//            divId = document.createElement("DIV");
//            divId.id = "windlocation";
//            divId.style.visibility="visible";
//            //divId.innerHTML="<iframe src=\"/Member/LoginForm.html\" id=\"loginframe\" scrolling=\"no\" frameborder=\"0\" width=\"385\" height=\"205\"></iframe>";
//            divId.innerHTML="<iframe src=\"/Member/MiniReg.aspx\" id=\"loginframe\" scrolling=\"no\" frameborder=\"0\" width=\"600\" height=\"500\"></iframe>";
//            //alert(divId.innerHTML);
//            document.body.appendChild(divId);
            
        }
        if($("mask")==null)
        {
            var mask=document.createElement("DIV");
            mask.id="mask";
            mask.style.visibility="visible";
            document.body.appendChild(mask);
        }
        //.shadow{position:absolute;top:35%;left:25%;width:205px;background:#999;}
        divId.style.left=(document.documentElement.clientWidth-divId.clientWidth)/2+document.documentElement.scrollLeft;
        divId.style.top =(document.documentElement.clientHeight-divId.clientHeight)/2+document.documentElement.scrollTop ;
        $("mask").style.height=document.documentElement.clientHeight+document.documentElement.scrollTop+1000;
	    $("loginframe").src=$("loginframe").src;
	    Div_Show("windlocation");
	    Div_Show("mask");
	    return false;
	}
	else
	{
	    return true;
	}
	//adDiv.visibility="visible";
	//setTimeout("ShowLogin()",500);
    
}

//全选或者全不选
function checkAll(itemName,bool)
{
  var aa = document.getElementsByName(itemName);
  for (var i=0; i<aa.length; i++)
   aa[i].checked = bool;
}

 function CheckAll(checkboxname)
 {
		var obj=event.srcElement;
		if(obj.value=="全选")
		{
			checkAll(checkboxname,true);
			obj.value="取消";
		}
		else
		{
			checkAll(checkboxname,false);
			obj.value="全选";
		}
 }

function HideLogin()
{
    Div_Hide("mask");
    Div_Hide("windlocation");
}
function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
} 

//检查是否为中文字符
function IsChinese(str){
      var reg = /^[u4E00-u9FA5]+$/;
      return reg.test(str);
}

//帖子类型，这里用来做线路锁定
function setIdentify(identify)
{
	identify.style.left = ((document.body.clientWidth - $('container').clientWidth)/2 + $('container').clientWidth - 400) + 'px';
	identify.style.top = identify.offsetTop + 25 + 'px';
}

function HotMember(username,nickname,pic,sex,igrade,sgrade,ub,p1,p2,p3,p4,p5,p6,p7)
{
    var html="";
    html+="<table width='96%' border='0' align='center' cellpadding='0' cellspacing='0'>";
    html+="  <tr>";
    html+="    <td width='28%' rowspan='2'>";
    html+="<a href='/Member/Space.aspx?UserName="+username+"'>";
    html+="<img border=0 src='"+pic+"' width=97 height=97>";
    html+="</a>";
    html+="</td>            <td height='36' valign='top' class='right_o' align='left'> 昵 称：<span class='STYLE8'>";
    html+=nickname+"</span> ";
    html+="<img src='../images/"+(sex==True?"meb":"women")+".gif' />";
    html+=igrade+"级-"+sgrade+"<br>游B："+ub+"</td>";
    html+="  </tr>";
    html+="  <tr>";
    html+="    <td valign='top' class='right_hei' align='left'><p>已发游记："+p1+"篇 原创"+p2+"篇 精华 "+p3+"篇 <br />";
    html+="      已发评论："+p4+"篇 精华 "+p5+"篇 <br />";
    html+="      已提问题："+p6+"个 已答问题："+p7+"个 </p></td>";
    html+="  </tr>";
    html+="</table>";

return html;
}


  function ShowMemberInfo(head,sex,grade,gradename,pro,city,village,username,nickname)
    {
        var html="";
        html+="<table width='96%' border='0' align='center' cellpadding='0' cellspacing='0'>";
        html+="  <tr>";
        html+="    <td width='42%' height='100'><a target='_blank' href='/sNewSpace.aspx?UserName="+username+"'><img src='"+head+"' width='100' height='100' border='0'></a></td>";
        html+="    <td width='58%'><table width='95%' height='100%' border='0' align='right' cellpadding='0' cellspacing='0'>";
        html+="      <tr>";
        html+="        <td height='20' align='left'><span class='memberName"+(sex?"1":"0")+"'><strong>"+nickname+"&nbsp;&nbsp;"+(sex?"男":"女")+"</strong></span></td>";
        html+="      </tr>";
        html+="      <tr>";
        html+="        <td height='20' align='left'>"+grade+"级-<u>"+GetGradeName(grade)+"</u></td>";
        html+="      </tr>";
        html+="      <tr>";
        html+="        <td height='20' align='left'><p>"+GetCity(pro,city,village)+" </p></td>";
        html+="      </tr>";
        html+="      <tr>";
        html+="        <td height='20' align='left'>";
        html+="		<u><a href='/sNewSpace.aspx?UserName="+username+"' class='memberName0'>进入"+(sex?"他":"她")+"的空间</a></u>";
        html+="		</td>";
        html+="      </tr>";
        html+="      <tr>";
        html+="        <td height='20' align='left'>";
        html+="		<u><a target='_blank' href='/Member/?Go2=FriendList.aspx?Act=Add&UserName="+username+"' class='mylink'>加好友</a></u> ";
        html+="		<u><a target='_blank' href='/member/?Go2=Msg_Send.aspx?UserTo="+username+"' class='mylink'>发信息</a></u> </td>";
        html+="      </tr>";
        html+="    </table>";
        html+="    </td>";
        html+="  </tr>";
        html+="</table>";
        return html;
    }

/*-- 只能输入数字--onKeypress="JHshNumberText()" */
function JHshNumberText()
{
if ( !(((window.event.keyCode >= 48) && (window.event.keyCode <= 57)) 
|| (window.event.keyCode == 13) || (window.event.keyCode == 46) 
|| (window.event.keyCode == 45)))
{
window.event.keyCode = 0 ;
}
} 

    function WriteAge(min,max,defaultvalue)
    {
        for(var i=min;i<=max;i++)
        {
            document.write("<option value='"+i+"'");
            if(i==defaultvalue) document.write(" selected");
            document.write(">"+i+"</option>");
        }
    }
    
    function GetGradeName(igrade)
    {
        if(igrade>12||igrade<0) return "";
        var grade="乞丐,斑蝶,粉蝶,环蝶,绡蝶,灰蝶,喙蝶,绢蝶,蚬蝶,袖蝶,珍蝶,凤蝶,闪蝶";
        
        return grade.split(',')[igrade];
    }
    function ShowFreeShop(shopimg,shopname,shoptype,shopub,shopid)
    {
        var html="";
        
        html+="<table width=\"216\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
        html+="<tr>";
        html+="<td width=\"13%\"><a onclick='return ShowLoginForm()' href='FreeShopShow.aspx?ID="+shopid+"'><img src=\""+shopimg+"\" width=\"80\" height=\"80\" border=0/></a></td>"; 
        html+="<td width=\"87%\">";   
              
        html+="<table width='100%' border='0' cellpadding='0' cellspacing='2'>";
        html+="  <tr>";
        html+="    <td class='blue12_right' align='left'><strong>"+shopname+"</strong></td>";
        html+="  </tr>";
        html+="  <tr>";
        html+="    <td class='blue12_right' align='left'>类别："+shoptype+"</td>";
        html+="  </tr>";
        html+="  <tr>";
        html+="    <td class='blue12_right' align='left'>游B："+shopub+"</td>";
        html+="  </tr>";
        html+="  <tr>";
        html+="    <td><a href='/Member/?Go2=UB2Shop_GetFree.aspx?ID="+shopid+"' onclick='return ShowLoginForm()'><img border=0 src='pink/getfree.jpg' alt='我要兑换'/></a></td>";
        html+="  </tr>";
        html+="</table>";
        
        html+="</td>";                      
        html+="</tr>";
        html+="</table>";          
        
        return html;
    }
    
