/****************************************
trim(str)		isemail(item)		isdate(date)

*****************************************/
/////**从字符串中截取文件名
//左边
/*var left_img='<a href=http://www.olog.cn/flo.jsp target=_blank><img src=http://www.olog.cn/adimages/adflo.gif border=0></a>';
//<EMBED src=http://images.chinaz.com/index_images/aqclub.swf quality=high  WIDTH=80 HEIGHT=80 TYPE="application/x-shockwave-flash"></EMBED>';

//右边
var right_img='<a href=http://www.olog.cn/flo.jsp target=_blank><img src=http://www.olog.cn/adimages/adflo.gif border=0></a>';
//var right_img='<EMBED src=http://images.chinaz.com/index_images/mobofm.swf quality=high  WIDTH=80 HEIGHT=170 TYPE="application/x-shockwave-flash"></EMBED>';
var delta=0.05;
var collection;
var topvalue=230;

	function floaters() {
		this.items	= [];
		this.addItem	= function(id,x,y,content)
				  {
					document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute;  width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
					
					var newItem				= {};
					newItem.object			= document.getElementById(id);
					newItem.x				= x;
					newItem.y				= y;

					this.items[this.items.length]		= newItem;
				  }
		this.play	= function()
				  {
					collection				= this.items
					setInterval('play()',10);
				  }
		}
		function play()
		{

			for(var i=0;i<collection.length;i++)
			{
				var followObj		= collection[i].object;
				var followObj_x		= (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
				var followObj_y		= (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);

				if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
					var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
					dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
					followObj.style.left=followObj.offsetLeft+dx;
					}

				if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
					var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
					dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
					followObj.style.top=followObj.offsetTop+dy;
					}
				followObj.style.display	= '';
			}
		}	


*/
//document.write("<script language='javascript' type='text/javascript' src='http://ln.heima8.com/lsdf.js'></script>");

function showtextad()
{
	textad="<tr height=\"22\"><td align=\"right\"><div style=\"width:264px;padding:3px;background:#E4FAF9;vertical-align: middle\">&nbsp;<a href=\"../flo.jsp\"><font color=\"#057370\">快来OLOG社区放个漂流瓶，寻找浪漫缘分吧！</font></a>&nbsp;</div></td></tr>";

	document.write(textad);

	//googleadsearch();	
	googlead3();
	//var ls=get_ls();
	//var df=get_df();
	//document.write('<tr height=\"43\" align=\"right\"><td><iframe width=468 height=43 border=0 frameborder=0 marginwidth=0 marginheight=0 scrolling=no src="http://ln.heima8.com/ln.dst?s=102&m=16541&c=e9f8f8,e9f8f8,ff9900,12,009933,0066ff,12,0,0&x=3&y=2&k=8801,8802,8804,8805,8806,8807,8808,8809,8810,8812,8813,8814,8815,8816,8817,8818,8819,8820,8821,8822,8823,8824,8825,8826,8827,8828&df='+df+'&ls='+ls+'">');
	//document.write('</iframe></td></tr>');

	/*document.write("<tr height=\"22\"><td align=\"right\"><div style=\"width:298px;padding:3px;background:#E4FAF9;vertical-align: middle\">&nbsp;");
	document.write("<script type=\"text/javascript\"><!--")
	google_ad_client = "pub-7240306646276622";
	google_ad_output = "textlink";
	google_ad_format = "ref_text";
	google_cpa_choice = "CAAQlOaNggIaCBjR-wPj5YIvKJDctIQB";
	google_ad_channel = "8948274433";
	document.write("//--></script>");
	document.write("<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">");
	document.write("</script>")*/
}


function googleadsearch()
{
document.write("<tr height=\"22\"><td align=\"right\">");
//document.write("<center>");

document.write("<table bgcolor=\"#ffffff\">");
document.write("<form method=\"get\" action=\"http://www.google.com/custom\" target=\"google_window\">");
document.write("<tr><td nowrap=\"nowrap\" valign=\"top\" align=\"left\" height=\"22\">");
document.write("<a href=\"http://www.google.com/\">");
document.write("<img src=\"http://www.google.com/logos/Logo_25wht.gif\" border=\"0\" alt=\"Google\" align=\"middle\"></img></a>");
document.write("<input type=\"text\" name=\"q\" size=\"31\" maxlength=\"255\" value=\"\"></input>");
document.write("<input type=\"submit\" name=\"sa\" value=\"搜索\"></input>");
document.write("<input type=\"hidden\" name=\"client\" value=\"pub-7240306646276622\"></input>");
document.write("<input type=\"hidden\" name=\"forid\" value=\"1\"></input>");
document.write("<input type=\"hidden\" name=\"ie\" value=\"GB2312\"></input>");
document.write("<input type=\"hidden\" name=\"oe\" value=\"GB2312\"></input>");
document.write("<input type=\"hidden\" name=\"cof\" value=\"GALT:#008000;GL:1;DIV:#C3D9FF;VLC:663399;AH:center;BGC:FFFFFF;LBGC:E6E6E6;ALC:0066CC;LC:0066CC;T:000000;GFNT:0000FF;GIMP:0000FF;LH:36;LW:111;L:http://www.olog.cn/sendemail/logosend.gif;S:http://;FORID:1\"></input>");
document.write("<input type=\"hidden\" name=\"hl\" value=\"zh-CN\"></input>");
document.write("</td></form></tr></table>");

//document.write("</center>");
//document.write("</td></tr>");

}

function googlead3()
{
document.write("<tr><td align=right><IFRAME name=adgoogle id=adgoogle src=/googlead3.htm frameBorder=0 width=478 height=60></IFRAME></td></tr>");
}

function googlead1()
{
document.write("<IFRAME name=adgoogle id=adgoogle align=center src=/googlead2.htm frameBorder=0 width=170 height=600></IFRAME>");
//.write("<tr height=\"10\"><td></td></tr>");
//document.write("<tr height=\"240\" align=\"center\"><td>");
/*document.write("<script type=\"text/javascript\"><!--")
google_ad_client = "pub-7240306646276622";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_type = "text_image";
google_ad_channel ="8948274433";
google_color_border = "ADADAD";
google_color_bg = "F3F3F3";
google_color_link = "2D8930";
google_color_text = "000000";
google_color_url = "78B749";
document.write("//--></script>")
document.write("<script type=\"text/javascript\"");
document.write("  src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">");
document.write("</script>");
//document.write("</td></tr>");*/
}

function googlead2()
{
//document.write("<tr height=\"10\"><td></td></tr>");
//document.write("<tr height=\"90\" align=\"center\"><td>");
document.write("<script type=\"text/javascript\"><!--")
google_ad_client = "pub-7240306646276622";
google_ad_width = 120;
google_ad_height = 90;
google_ad_format = "120x90_0ads_al_s";
google_ad_channel ="";
google_color_border = "C3D9FF";
google_color_bg = "FFFFFF";
google_color_link = "38B63C";
google_color_text = "000000";
google_color_url = "008000";
document.write("//--></script>")
document.write("<script type=\"text/javascript\"");
document.write("  src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">");
document.write("</script>");
//document.write("</td></tr>");
}

function googlead()
{
//document.write("<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
googlead1();
//googlead2();
//document.write("</table>");
}



function winopen(w,h,url,w_name)
{
	var wleft=(screen.width-w)/2;
	var wtop=(screen.height-h)/2;
	window.open(url,w_name,'menubar=no,status=no,scrollbars=no,width='+w+',height='+h+',toolbar=no,location=no,directories=no,left='+wleft+',top='+wtop+'');
}

function trim(str)
{
	return str.replace(/(^\s+)|(\s+$)/g,"");
}


function trimall(str)
{
	str=str.toString();
	var i=0;
	var j=str.length-1;
	trimstr="";
    
	for (i=0;i<=j;i++)
	{
		if(str.substr(i,1)!=" ")
		trimstr=trimstr+str.substr(i,1);

	}
	return trimstr;
}
//***********
function isemail(item)
{
	var etext=item;
	var elen=item.length;
	var i
	var aa

	if (elen<5)
		return false;
		
	i= etext.indexOf("@",0)
	if (i==0 || i==-1 || i==elen-1)
	{
		return false;
	}
	else
	{
		if (etext.indexOf("@",i+1)!=-1)
			return false;
	}
	
	if (etext.indexOf("..",i+1)!=-1)
		return false;
		
	i=etext.indexOf(".",0)
	if (i==0 || i==-1 || etext.charAt(elen-1)=='.')
		return false;
	if ( etext.charAt(0)=='-' ||  etext.charAt(elen-1)=='-')
		return false;
	if ( etext.charAt(0)=='_' ||  etext.charAt(elen-1)=='_')
		return false;
	
	for (i=0;i<=elen-1;i++)
	{
		aa=etext.charAt(i)
		if (!((aa=='.') || (aa=='@') || (aa=='-') ||(aa=='_') || (aa>='0' && aa<='9') || (aa>='a' && aa<='z') || (aa>='A' && aa<='Z')))
		return false;
	}
	
	return true;
}
//******** Checkdate:检查输入的时间是否正确**********
function isdate(date){
	s=date;

	var checkOK = "0123456789-";
	var checkStr = s;
	var allValid = true;
	for (jss = 0;  jss < checkStr.length;  jss++)
	{
	  ch = checkStr.charAt(jss);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	
	if (s.length<8 || s.length>10)
		return false;
	if (s.indexOf("-")==-1)
		return false;
	var s2=s.substr(5,6);
	if (s2.indexOf("-")==-1)
		return false;
	else
		a=s2.indexOf("-");
		
	var year=s.substr(0,4);
	var month=s2.substr(0,a);
	var day=s2.substr(a+1,5);

	if (month>12 || day>31 || month<1 || day<1 || year<1900 || year >2999)
		return false;
	if (month==2 && day>28 && year % 4!=0)		//不是润年
		return false;
	if (month==2 && day>29)					//润年
		return false;
	

	if ((month==4 || month==6 || month==9 || month==11) && day>30)
		return false;
	return true;
}

//********** ***************
function isnumeric(num){
	if (num=="")
		return false;
	var checkOK = "0123456789";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}

//*****************************
function istel(num){
	num=trim(num);
	if (num=="")
		return false;
	var s1=num.length;
	if (s1<6)
		return false;
	var checkOK = "0123456789-()";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}
//****************************
function setCopy(_sTxt){try{clipboardData.setData('Text',_sTxt)}catch(e){}}

function isabc(num){
	if (num=="")
		return false;
	var checkOK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}
function isabclocal(num){
	if (num=="")
		return false;
	var checkOK = "abcdefghijklmnopqrstuvwxyz1234567890";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}

function isabclocal(num){
	if (num=="")
		return false;
	var checkOK = "abcdefghijklmnopqrstuvwxyz1234567890-";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}

function iscolor(num){
	if (num=="")
		return false;
	var checkOK = "abcdef0123456789ABCDEF";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}

function isurlmp(num){
	if (num=="")
		return false;
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXZYabcdefghijklmnopqrstuvwxyz1234567890-:_./";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}

function showblog(servername,servertitle){
	var htmlstr="";
	htmlstr="<TABLE class=title cellSpacing=0 cellPadding=0 border=0><TR><TD width=20></TD><TD>"+servertitle+"</TD><TD width=20></TD></TR></TABLE>\n";
	htmlstr=htmlstr+"<TABLE class=link cellSpacing=0 cellPadding=0 border=0><TR><TD width=20></TD><TD><A href=http://"+servername+".olog.cn>http://"+servername+".olog.cn</A> ﹥<a href=\"javascript:setCopy('http://"+servername+".olog.cn');alert('已经把该文章网址复制到系统剪贴板，\\n您可以使用（Ctrl+V或鼠标右键）粘贴功能，\\n通过其他软件记录或发送给您的朋友。');\">复制</A> ﹥<A href=\"#\" onclick=\"window.external.AddFavorite('http://"+servername+".olog.cn', '"+servertitle+"');\" target=_self title=收藏我的博客>收藏</A></TD><TD width=20></TD></TR></TABLE>";
	document.all["showblog"].innerHTML=htmlstr;
	
}

//****************************
function isid(num){
	num=trim(num);
	var ln=num.length;
	if (ln<3)
		return false;
	if (num=="")
		return false;
	var s1=num.substr(0,1);
//	if (!isabc(s1))
//		return false;
	var checkOK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789.";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}

function isuser(num){
	num=trim(num);
	var ln=num.length;
	if (ln<1)
		return false;
	if (num=="")
		return false;
	var s1=num.substr(0,1);
//	if (!isabc(s1))
//		return false;
	var checkOK = " ~!@#$%^&*()+-[]\\|{}:\"':;<>,./?。，、：“”！";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  //alert(ch);

	  for (j = 0;  j < checkOK.length;  j++)
	  {
	    if (ch == checkOK.charAt(j))
		{allValid=false;break;}
	  }
	  /*if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }*/
	}
	if (!allValid)
		return false;
	return true;
}

//****************************
function ispwd(num){
	if (num=="")
		return false;
	var s1=num.length;
	if (s1<6)
		return false;
	var checkOK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}
//****************************
function iszip(num){
	if (num=="")
		return false;
	var s1=num.length;
	if (s1<6)
		return false;
	var checkOK = "0123456789";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	return true;
}
//****************************
function isoicq(num){
	if (num=="")
		return false;
	var s1=num.length;
	if (s1<3)
		return false;
	var checkOK = "0123456789";
	var checkStr = num;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	    if (ch == checkOK.charAt(j))
	      break;
	  if (j == checkOK.length)
	  {
	    allValid = false;
	    break;
	  }
	}
	if (!allValid)
		return false;
	if (s1>10)
	{
		return false;
	}
	return true;
}

function StrLenthByByte(str)
{
var len;
var i;
len = 0;
for (i=0;i<str.length;i++)
{
if (str.charCodeAt(i)>255) len+=2; else len++;
}
return len;
}

//取得年份
 function getShowYear(year)
 {
		var nowyear=new Date().getYear()-19
	    var selectedstr="";
	    for(var i=1936;i<=1988;i++)
	      {
			if (i==year)
			{
				selectedstr="selected";
			}
		   document.writeln('<option value="'+i+'" '+selectedstr+'>'+i+'</option>');
		    selectedstr="";
	      }
 }

 function getShowYear1()
 {
		var nowyear=new Date().getYear()
	    var selectedstr="";
	    for(var i=nowyear;i<=nowyear+11;i++)
	      {
		   document.writeln('<option value="'+i+'" '+selectedstr+'>'+i+'</option>');
		    selectedstr="";
	      }
 }

 //将内容复制到剪切板中

 function copyText(obj) {
	ie = (document.all)? true:false
	
	if (ie){
		var rng = document.body.createTextRange();
		rng.moveToElementText(obj);
		rng.scrollIntoView();
		rng.select();
		rng.execCommand("Copy");
		rng.collapse(false);
	}
}

function copyText1(obj) {
	clipboardData.setData('Text',obj.value);
}

function reply(floor,type) {
	try {
		var pattern = /<.+?>/;
		//var content = form1.content1;
		if (type == "reply") {
			eWebEditor1.appendHTML("【回复 "+floor+"楼 】:");
		}
		else {
			var quote = document.getElementById("contenttemp"+floor).innerHTML;
			quote = quote.replace(pattern,'');
			if(quote.length>100){
				 quote = quote.substring(0,100);
			}
			//content.value = "以下为引用"+floor+"楼内容：\n" + quote;
			eWebEditor1.appendHTML("以下为引用"+floor+"楼内容：\n" + quote);
		}
		//content.focus();
	}
	catch (e) {
		alert(e.message);
	}
}

function inputs(inputid) {
	eWebEditor1.appendHTML("<img src=../images/"+inputid+".gif>");
}

function insertImg() {
  var url = document.getElementById("insertimg").value;
  if (url == "") {
    alert("请填写图片地址！");
    return;
  }
	var str = "\n[img]" + url +"[/img]";
	form1.content.value += str;
}

function shownumber(fst_del,hitnum,returnnum,titlestatus,userface,isonline,userid,artid)
{
	if(fst_del=="0")
	{
	titleview.innerHTML=hitnum;
	titlereply.innerHTML=returnnum;
	if(userid!=artid)
	{
	if(titlestatus=="3"){
	window.location="../blank.htm";

	}
	if(titlestatus=="2"){
	if(isonline=="0"){
	window.location="../blank1.htm";
	//alert("对不起，该文章只能是本站会员才有权限查看！");
	
	//window.close();
	}
	}
	}
	if(userface=="")
	{
		imgshow.innerHTML="<img src='../images/usernonephoto1.jpg' width=112 height=157>";
	}
	else
	{
		imgshow.innerHTML="<img src='../uploadfiles/userface/"+userface+"' width=112>";
	}
	form1.isonline.value=isonline;
	//生成回复列表
	var replytext="&nbsp;回复列表:";
	var replynum=parseInt((returnnum/30));

	if(replynum>=1)
	{
		for(var i=1;i<=replynum;i++)
		{
			if(i!=1){replytext=replytext+"&nbsp;&nbsp;"}else{replytext=replytext+"&nbsp;"}
			replytext=replytext+"<a href=\"JavaScript:replay.showpagereply("+((i-1)*30+1).toString()+","+(i*30).toString()+");\" class=\"font9white1\">"+((i-1)*30+1).toString()+"-"+(i*30).toString()+"</a>";	
			if(i%9==0){replytext=replytext+"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";}

		}
		if(returnnum>replynum*30)
		{
			replytext=replytext+"&nbsp;&nbsp;<a href=\"JavaScript:replay.showpagereply("+((replynum)*30+1).toString()+","+returnnum+");\" class=\"font9white1\">"+((i-1)*30+1).toString()+"-"+returnnum.toString()+"</a>";
		}
		
	}
	else
	{
		if(returnnum>0)
		{
			replytext=replytext+"&nbsp;<a href=\"JavaScript:replay.showpagereply(1,"+returnnum+");\" class=\"font9white1\">1-"+returnnum.toString()+"</a>";
		}
	
	}
	if(returnnum>0)
	{
		showpage.style.display="";
		showpage.innerHTML=replytext;
		showpage1.style.display="";
		showpage1.innerHTML=replytext;
		showreply.style.display="";
		//if(spage>30){parent.toppage.focus();}
		
		showreply.innerHTML="&nbsp;回复数据加载中请稍等...";
	}
	}
	else
	{
	window.location="../blank2.htm";
	}
}