//合并原来的publicjs/IncWin.js  publicjs/cookies.js   /message/dragdrop.js   public/onContent.js
//用于字符串相加操作

function StringBuffer()
{
	this._strings_ = new Array;
}

StringBuffer.prototype.append = function(str)
{
	this._strings_.push(str);
}

StringBuffer.prototype.toString = function()
{
	return this._strings_.join("");
}


/******************************
此方法用于文本区域的截取
**********************************/
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
	field.value = field.value.substring(0, maxlimit); 
else 
	$(countfield).value = maxlimit - field.value.length;
} 
//层控制函数
   
//正文展开/缩起控制
function public_DIV2Show(ele1,ele2,html1,html2){
	var img = document.getElementById("diary_g_c");
	if(!public_isNull(ele1))
		ele1 = (typeof(ele1)=="string")?document.getElementById(ele1):ele1;
	if(!public_isNull(ele2))
		ele2 = (typeof(ele2)=="string")?document.getElementById(ele2):ele2;
	else
		return false;
	//var ele1=document.getElementById("diary_group_control1");
	//var ele2=document.getElementById("diary_group_textDIV");
	if(ele2.style.display=="none"){
		ele2.style.display="";
		if((!public_isNull(html1))&&(!public_isNull(ele1)))
			ele1.innerHTML=html1;
		if(img!=null)
			img.src= "dyncommentimg/group/blog-ico1.gif";
	}
	else{
		ele2.style.display="none";
		if((!public_isNull(html2))&&(!public_isNull(ele1)))
			ele1.innerHTML=html2;
		if(img!=null)
			img.src= "dyncommentimg/group/blog-ico3.gif";
	}	
}
//正文字号控制
function public_DIVFont(ele,size){
	
	if(public_isNull(ele)||public_isNull(size))
		return false;
	else
		ele = (typeof(ele)=="string")?document.getElementById(ele):ele;
	if(size!=""&&isNumeric(size)){
		ele.style.fontSize=size;
		return false;
	}
	var fontSize = ele.style.fontSize;
	if(public_isNull(fontSize)){
		ele.style.fontSize="12px";
		return true;
	}
	else{
		fontSize = fontSize.toLowerCase();
		fontSize = fontSize.split("px")[0];
		if(isNumeric(fontSize)){
			if(size=="l")
				fontSize = parseInt(fontSize)+1;
			else if(size=="s"&&fontSize!=1){
				
				fontSize = fontSize-1;	
			}			
		}
		else{
			return false;
		}
	}
	ele.style.fontSize = fontSize+"px";
}
//tag的搜索链接
function public_tagTourl(ele,searchtype,tag,returnType){
	var tags = null;
	var rtype = (public_isNull(returnType))?"innerHTML":returnType;
	if(rtype=="innerHTML"){
		ele = (typeof(ele)=="string")?document.getElementById(ele):ele;
		if(public_isNull(tag)){
			if(public_isNull(ele)&&public_isNull(ele.innerHTML))
				return false;		
			tags = (ele.innerHTML).split(',');
		}
		else{
			tags = tag.split(',');
		}
	}
	else{
		tags = tag.split(',');
	}
	var html='';
	var url = new StringBuffer();
	url.append('http://search.blogcn.com/');
	if(public_isNull(searchtype)||searchtype=="0")
		url.append('ArticleResult.aspx?SearchType=0&PageIndex=1&txtQuery=');
	else if(searchtype=="1")
		url.append('UserResult.aspx?SearchType=1&PageIndex=1&txtQuery=');
	else if(searchtype=="2")
		url.append('BlogResult.aspx?SearchType=2&PageIndex=1&txtQuery=');
	else if(searchtype=="3")
		url.append('CircleResult.aspx?SearchType=3&PageIndex=1&txtQuery=');
	else if(searchtype=="4")
		url.append('PictureResult.aspx?SearchType=4&PageIndex=1&txtQuery=');
	else if(searchtype=="5")
		url.append('ActiveResult.aspx?SearchType=5&PageIndex=1&txtQuery=');
	for(var i=0;i<tags.length;i++){
		var tag	= tags[i];//class=link-blue-u diary_tag_info
		html+='<a href="'+url.toString()+escape(tag)+'" class="link-blue-u" target="_blank"><span class="my_info">'+tag+'</span></a>';
		if(i!=tags.length-1)
			html+=',';
	}
	if(rtype=="innerHTML")
		ele.innerHTML=html;
	else{
		return html;
	}				
}
//判断参数是否为空
function public_isNull(parameter){
	if(typeof(parameter)=="undefined"){
		return true;
	}
	if(parameter==null)
		return true;
	else{
		if(typeof(parameter)=="string"&&(parameter.length==0||parameter=="null"))
			return true;
		return false;
	}
}
//判断是否登陆
function public_islogin(){
	if(GetCookie("newuserid") == null || GetCookie("newuserid")=="" || GetCookie("newuserid")=="-1"|| GetCookie("newuserid")=="0")
		return false;
	else{
		return true;
	}
}

//获取当前博客域

function public_getblogdomain(){
	var myurl = location.href;
	var re = RegExp("http:\/\/([a-z0-9A-Z_-]{3,30})\..*","i"); 
	var username = myurl.replace(re,"$1");
	return username;
}

//公用图片等比例缩放
function public_img_limit(imgid,maxh,maxw){
	var img = (typeof(imgid)=="string")?document.getElementById(imgid):imgid;//灵活的接受imgid为对象或对象id
	var load_img = new Image();//新建一个图片对象

	var onloadFun = function(){//计算图片实际大小
		public_img_load(load_img,maxh,maxw);
		img.setAttribute("height",load_img.height);//重置图片大小
		img.setAttribute("width",load_img.width);
	};
	load_img.onload = onloadFun;//注册新图片对象的onload事件
	load_img.src = img.src;//新图片对象开始载入图片

}

//计算图片比例
function public_img_load(imgid,height,width){
	var imgEle=(typeof(imgid)=="string")?document.getElementById(imgid):imgid;
	if(imgEle.height==0||imgEle.width==0){
		imgEle.setAttribute("height",height);
		imgEle.setAttribute("width",width);
		return true;
	}
	if(imgEle.height>height||imgEle.width>width){
		if((imgEle.height/imgEle.width)<(height/width)){
			imgEle.setAttribute("height",(imgEle.height/imgEle.width)*width);
			imgEle.setAttribute("width",width);
			return true;
		}
		else{
			imgEle.setAttribute("width",(imgEle.width/imgEle.height)*height);
			imgEle.setAttribute("height",height);
			return true;
		}
	}
}

//使用ajax调用
function public_ajax(callback,url){
    if (window.XMLHttpRequest) {
		var req = new XMLHttpRequest();
        req.onreadystatechange = function(){callback(req);};
        req.open("GET", url, true);
        req.send(null);
    }
    else if (window.ActiveXObject) {
       var req = new ActiveXObject("Microsoft.XMLHTTP");
       if (req) {
		req.onreadystatechange = function(){callback(req);};
        req.open("GET", url, true);
        req.send();
       }
    }
}

function public_AjaxFunction(){
	var xmlhttp = false,isComplete = false;
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){
		if (window.XMLHttpRequest)
			xmlhttp = new XMLHttpRequest();
		else if (window.ActiveXObject)
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
 	this.open = function(url, method, feedback, arg,asyc){
 		try{
    		if (!xmlhttp) return false;
    		isComplete = false;
			var asy;
			if(asyc!=null&&asyc==false){asy=false;}
			else{asy=true;}
			method = method.toUpperCase();
			try{
				xmlhttp.setRequestHeader("Cache-Control: no-store, no-cache, must-revalidate");
				xmlhttp.setRequestHeader("Connection","close");
			}
			catch(e){}
      		if (method == "GET"){
        		xmlhttp.open(method, url+"?"+arg,asy);
        		arg = "";
      		}
      		else{
        		xmlhttp.open(method, url, asy);
        		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			}
      		xmlhttp.send(arg);
	  		getValue_timer=setTimeout("this.Abort()",60000);
			xmlhttp.onreadystatechange = function(){feedback(xmlhttp);};
//      xmlhttp.onreadystatechange = function(){
//		if (xmlhttp.readyState == 4 && !isComplete){
//			isComplete = true;
//		  	clearTimeout(getValue_timer);
//		  	if(xmlhttp.status==200||xmlhttp.status==0){
//			  	try{var json=eval(xmlhttp.responseText);}
//			  	catch(e){var json="not support";}
//			  	try{feedback(xmlhttp.responseText,xmlhttp,json);}catch(e){}
//		  	}
//		  	else{
//		  		try{feedback(xmlhttp.status);}catch(e){}}
//         	}
//		else{
//			try{process(xmlhttp.readyState);}catch(e){}}
//		};
//	}
		}
    	catch(z) { return false; }
    	return true;
	};
  	this.Abort=function(){
		alert('获取数据失败');
		try{
			this.abort();
  		}
  		catch(e){}
  	};
  	return this;
};
//博客对象
function public_blog(){
	var id;
	var blogtypeid;
	var blogdomain;
	var status;
	var blogheading;
	var clientkey;
}
//获取下拉框当前选中值
function public_getSelected(ele){
	if(public_isNull(ele))
		return null;
	ele = (typeof(ele)=="string")?document.getElementById(ele):ele;
	return ele.options[ele.selectedIndex];
}
//字符串截取
function sub(str,i,flag){
		if(str==null||str==""){
			document.write("");
		}else{
			len = str.length;
			if(len>i){
				str = str.substring(0,i);
			}else{
				str = str;
			}
			if(public_isNull(flag)||flag){}
			else{str +="...";}
			document.write(str);
		}
}
String.prototype.replaceBase=function(){
	var str=this.replace(/\&/g,"&amp;");
	str=str.replace(/\</g,"&lt;");
	str=str.replace(/\>/g,"&gt;");
	return str.replace(/\"/g,"&quot;");
}
//区分中英文的字符串截取,cutnum 的计量单位是指一个中文字，两个英文字或符号
//当截取前的英文或符号为奇数个时，截取cutnum+0.5个单位
//当字符串的单位大于等于cutnum时，截取後加上“..”
//并且转义输出“<”、“>”
//sunning 2007-06-18
function cutstring(cutstr,cutnum){
	if(cutstr==null){
		return "";
	}else{
		var strreturn = "";
		var temp = "";
		var j = 0;
		var i = 0;
		for(i=0;i<cutnum*2;i++){
			temp = cutstr.substr(j,1);
			if(escape(temp).length==6)
				i++;
			j++;
			if(temp=="<" || temp==">"){
				temp = temp.replaceBase();
			}
			strreturn = strreturn + temp;
		}
	
		if(temp!="")
			strreturn = strreturn+"..";
		return strreturn;
	}
}

String.prototype.strLen = function () {
    return this.replace(/[^\x00-\xff]/g,"xx").length;
}

String.prototype.str = function (len) {	
	if(this!=null && this.strLen()>len){
		return this.replace(/([\u0391-\uffe5])/ig,'$1a').substring(0,len).replace(/([\u0391-\uffe5])a/ig,'$1')+'..';
	}
	else return this;
}
//跳转控制面板
function gotoControl(flag,ele,div){
	if(ele==null){
		var elt = public_getEvent();
		ele=elt.srcElement||elt.target;
	}
	if(!public_islogin()){
		alert('请先登陆');
		return false;
	}
	if(blogid==GetCookie("blogid")){
		//return true;
	}
	var divhtml = null;
	if(div!=null){
		div = document.getElementById(div);
		divhtml = div.innerHTML;
		div.innerHTML = "载入中...";
	}
	
	if(public_isNull(blogid)||public_isNull(blogtype))
		return false;
	var url = "/blogLogin?action=goto&blogid="+blogid+"&blogtypeid="+blogtype+"&myblogdomain="+myblogdomain+"&status="+1+"&time="+new Date();
	var goto_callback = function(goto_req){
		if (goto_req.readyState == 4){
   	   		if (goto_req.status == 200){
   	   			
   	   			var re = goto_req.responseText;
   	   			if(re>0){
   	   				window.open(ele.href);
   	   				if(divhtml!=null){
   	   					div.innerHTML=divhtml;
   	   				}
   	   			}
   	   			else if(re==0){
   	   				if(blogtype==2)
   	   					alert("您不是本圈子成员!");
   	   				else
   	   					alert("您不是本博客成员!");
   	   			}
   	   			else if(re==-1){
   	   				alert("您无此权限！")
   	   			}
   	   			if(divhtml!=null){
   	   				div.innerHTML=divhtml;
   	   			}
   	   		}
	 	}
	}
	public_ajax(goto_callback,url);
	return false;	
	/*var forlength = toolbar_blogs.length;
	for(var i=0;i<forlength;i++){
		var blog = toolbar_blogs[i];
		if(blog.id==blogid){
			if(flag==null||flag==-1||flag==blog.blogtypeid){
				switchCookie(blog);
				createBlogSelect(toolbar_blogs);
				//alert(document.cookie);
				return true;
			}			
		}
	}
	if(flag==2)
		alert("您无此权限，请先加入此圈子");
	else if(flag==3)
		alert("您无此权限，请先加入此博客");
	return false;*/
}
//获得问候语
function public_fGreet(){
		var d=new Date();
		var h=d.getHours();
		var m=d.getMinutes();
		if(h<5){
			return "凌晨好";
			
		}if(h<10||(h==10&&m<30)){
			return "早上好";
			
		}if(h<13||(h==13&&m<30)){
			return "中午好";
			
		}if(h<18){
			return "下午好";
			
		}if(h<24){
			return "晚上好";
			
		}
	}

/*-------------------------------------------------------------------------------------------------------------*/
function getParameter(name){
	var urlinfo=window.location.href; //获取当前页面的url
    var len=urlinfo.length;//获取url的长度


    var offset=urlinfo.indexOf("?");//设置参数字符串开始的位置
    if (offset==-1){
    	//alert('error:parameter is null');
    	return null;
    }
    var newsidinfo=urlinfo.substr(offset+1,len)//取出参数字符串 这里会获得类似“id=1”这样的字符串

    var strs = newsidinfo.split("&");
    var str;
    for(var i=0;i<strs.length;i++){
    	var avg = strs[i].split('='); 
    	if(name == avg[0]) {
    	//把那个锚#去掉后的参数
    	   var strsp = avg[1].split("#");
    		str = strsp[0];
    	}
    } 
    return str;
}
function getParameterI(name){
	var urlinfo=window.location.href; //获取当前页面的url
    var len=urlinfo.length;//获取url的长度
    var offset=urlinfo.indexOf("?");//设置参数字符串开始的位置
    if (offset==-1){
    	//alert('error:parameter is null');
    	return null;
    }else{
    	urlinfo = urlinfo.substr(offset+1)
    }
    offset=urlinfo.indexOf("?");
    if (offset==-1){
    	//alert('error:parameter is null');
    	return null;
    }
    var newsidinfo=urlinfo.substr(offset+1)//取出参数字符串 这里会获得类似“id=1”这样的字符串

    var strs = newsidinfo.split("&");
    var str;
    for(var i=0;i<strs.length;i++){
    	var avg = strs[i].split('='); 
    	if(name == avg[0]) {
    	//把那个锚#去掉后的参数
    	   var strsp = avg[1].split("#");
    		str = strsp[0];
    	}
    }
    return str;
}
function setParameter(name,value){
	var oldvalue = getParameter(name);
	var urlinfo=window.location.href;
	if(urlinfo.indexOf('#?')==-1)
		urlinfo = urlinfo.replace("?","#?")
	if(oldvalue!=null){
		return urlinfo.replace(name+"="+oldvalue,name+"="+value);
	}
	else{
		var offset=urlinfo.indexOf("?");
		
		if(offset==-1||offset==urlinfo.length){
			
			return urlinfo + "#?" + name + "=" + value;
		}
		else{
			return urlinfo + "&" + name + "=" + value;
		}
	}
}
function setParameterI(name,value){
	var oldvalue = getParameterI(name);
	var urlinfo=window.location.href;
	if(urlinfo.indexOf('#?')==-1)
		urlinfo = urlinfo.replace("?","#?")
	if(oldvalue!=null){
		return urlinfo.replace(name+"="+oldvalue,name+"="+value);
	}
	else{
		urlinfo=window.location.href;
		var offset=urlinfo.indexOf("#?");
		if(offset==-1||offset==urlinfo.length){
			
			return urlinfo + "#?" + name + "=" + value;
		}
		else{
			return urlinfo + "&" + name + "=" + value;
		}
	}
}
/*------------------------------------------------------------------------------------------------------------------*/
function getSelectValue(fieldName) 
{
	var field=document.getElementsByName(fieldName);
	var userids="";
	var flag=0;
	var truthBeTold;

	if(field==null)
		return;

	for(i = 0; i < field.length; i++)
		{
			if (field[i].disabled != true)
			{
				if(field[i].checked == true)
				{
					flag=1;
					//if (i=0){
							//userids=userids+field[i].value;
					//}else{
						userids=userids+field[i].value+",";
					//}
				}
			}
		}

	if(field.length == null)	//处理可能只有一条记录的Bug
	{
		if(field.checked == true)
		{
			flag=1;
			userids=userids+field.value;
		}		
	}

	if (flag==0)
	{
		alert("没有选择好友无法推荐，请选择好友！");
		return null;
	}
	else
	{
		return userids;
	}
}


function getXmlHttp()
{
	var ie4 = document.all;
	var ns4 = document.layers;
	var ns6 = document.getElementById && !document.all; 
	var http=null;
	if(ie4)	 http=new ActiveXObject("Microsoft.XMLHTTP");
	else if(ns6) http=new XMLHttpRequest();
	return http;
}
function GetE( elementId )
{
	return document.getElementById( elementId )  ;
}

//层控制
function ShowE( element, isVisible ,align)
{
	if ( typeof( element ) == 'string' )
		element = GetE( element ) ;
		
	if(!public_isNull(align)&&isVisible){
		var p = align.split(":");
		if(p[0]=="center"){
			var swidth = document.body.scrollWidth/2;
			var sheight = document.body.scrollTop;
			//element.style.left =(element.offsetParent.clientWidth/2)-(element.clientWidth/2)+element.offsetParent.scrollLeft;
			//element.style.top = (element.offsetParent.clientHeight/2)-(element.clientHeight/2)+element.offsetParent.scrollTop;
			element.style.display = isVisible ? '' : 'none' ;
			//element.style.left =(element.offsetParent.clientWidth/2)-(element.clientWidth/2)+element.offsetParent.scrollLeft;
			//element.style.top = (element.offsetParent.clientHeight/2)-(element.clientHeight/2)+element.offsetParent.scrollTop;
			element.style.top = (document.body.scrollTop+200)+"px";
			element.style.left = (parseInt(document.body.offsetWidth)-p[1])/2+"px";
		}
	}
	element.style.display = isVisible ? '' : 'none' ;
}

//我的好友，团队成员（有关几行几列的）
function useTableLoading(pagearea)
{
	 var frag = document.createDocumentFragment();
    
    var disabledZone = document.createElement('div');
    disabledZone.setAttribute('id', 'disabledZone');
    document.body.appendChild(disabledZone);

    var messageZone = document.createElement('div');
    messageZone.setAttribute('id', 'messageZone');

    messageZone.style.background = "blue";
    messageZone.style.color = "white";

    disabledZone.appendChild(messageZone);

    var text = document.createTextNode('正在加载中...');
    messageZone.appendChild(text);

    document.getElementById('disabledZone').style.visibility = 'visible';
    
     document.getElementById(pagearea).appendChild(document.getElementById('disabledZone'));
     
     
    DWREngine.setPreHook(function() { document.getElementById('disabledZone').style.visibility = 'visible'; });
    DWREngine.setPostHook(
    function() 
      { 
        document.getElementById('disabledZone').style.visibility = 'hidden'; 
      }
      );
}
/*------------------------------------------------------------------------------------------------------------------------*/
//动态载入js
function JsLoader(){
  this.load=function(url){
  //获取所有的<scrcipt>标记
  var ss=document.getElementsByTagName("script");  
  //判断指定的文件是否已经包含，如果已包含则触发onsuccess事件并返回  
  for(i=0;i<ss.length;i++)
  {   
    if(ss[i].src && ss[i].src.indexOf(url)!=-1)
    {   
      this.onsuccess(); 
      return;   
    }
  }
  //创建script结点，并将其属性设为为外联JavaScript文件  
  s=document.createElement("script");  
  s.type="text/javascript";  
  s.src=url;
  
  //获取head结点，并将<script>插入到其中  
  var head=document.getElementsByTagName("head")[0];  
  head.appendChild(s);  
  //获取对象自身的引用 
  var self=this;
  //对于IE浏览器，使用readystatechange事件判断是否载入成功  
  //对于其他浏览器，使用onload事件判断载入是否成功  
  s.onload=s.onreadystatechange=function(){   
  	//在此函数中this指针指的是s结点对象，而不是JsLoader实例，   
  	//所以必须用self来调用onsuccess事件，下同。  
  	if(this.readyState && this.readyState=="loaded"){
  		return; 
  	}
    self.onsuccess();     
  }
  s.onerror=function(){
  //如果发生错误，则删除插入的结点，并触发失败事件   
  head.removeChild(s);   
  self.onfailure();  } 
  };
  //定义载入成功事件 
  this.onsuccess=function(){}; 
  //定义载入失败事件 
  this.onfailure=function(){};}
  
 //载入pv计数器
 function loadjs_pv(){
	var pid="95";
	if(typeof(blogtype)!="undefined"){
		var pid="93";
		if(typeof(htmltype)!="undefined"&&htmltype!=null&&typeof(blogtype)!="undefined"){
			if(htmltype=="diary_mainbody"){
				if(blogtype==2){
					pid="90";
				}
				else{
					pid="93";
				}
			}
			else if(htmltype=="diary_browse"){
				pid="91";
			}
		}
		else{
			if(typeof(diaryid)=="undefined"){
				if(blogtype==2){
					pid="90";
				}
				else{
					pid="93";
				}
			}
			else
				pid="91";
		}
	}
	var jl=new JsLoader();
  	//定义载入成功处理程序
  	jl.onsuccess=function(){}
  	//定义载入失败处理程序
  	jl.onfailure=function(){}
  	//开始载入
  	jl.load("http://cc.blogcn.com/cgi-bin/class/CMS.Count/SysCount.aspx?id="+pid+"&url="+escape(document.location));
}

//为老系统遗留标签做的冗余
function public_oldtag(tagStr){
	if(tagStr=="wap"){
		document.write("<SPAN id=blog_wap><SPAN align=\"center\"><IMG alt=用手机访问我的博客:"+myblogdomain+".w.blogcn.com src=\"http://www.blogcn.com/wap.gif\" border=0></SPAN></SPAN>");
	}
	//document.write("");
}
//取触发事件对象
function public_getEvent(){//同时兼容ie和ff的写法
	if(document.all)
		return window.event;
	func=public_getEvent.caller;
	while(func!=null){
		var arg0=func.arguments[0];
		if(arg0){
			if((arg0.constructor==Event || arg0.constructor ==MouseEvent)|| (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation)){    
				return arg0;
			}
		}
		func=func.caller;
	}
	return null;
}

/****************************************************
获取坐标
*******************************************************/
function getPageXY() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	}else if (document.body.scrollHeight > document.body.offsetHeight){
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	}else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	}else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	}else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	}else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	}else {
		pageWidth = xScroll;
	}

	var arrayPageXY = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageXY;
}

/***********************************************************
*winnie-weiting 有异议请与我联系 最好不要直接修改此js
*弹出层的封装对象
*popLayerObj.show(sHTML<html 代码>,nWidth<弹出层的宽>,nHeight<弹出层的高>) 	-----方法描述：打开弹出层


*popLayerObj.close()													-----方法描述：关闭弹出层
*popLayerObj.showPrompt(msg<提示信息>,flag<可选默认1 1=确定 2=确定 取消>) 	-----方法描述：系统提示框
*popLayerObj.loading(msg<可选默认为‘正在处理数据’ 加载信息>);					-----方法描述：加载进度条
*popLayerObj.ofush()													-----方法描述：如果你重写了popLayerObj.createBefore 
																					 popLayerObj.closeEnd 可以调用这个方法清除
*popLayerObj.showWorking()												-----方法描述：打开一个遮盖层 此方法主要针对弹出层以上的数据处理的遮盖
*popLayerObj.closeWorking()												-----方法描述：关闭遮盖层
*popLayerObj.timeingPrompt(msg<提示信息>)											-----方法描述：提示 4秒内自动关闭
***********************************************************/
var popLayerObj={};
popLayerObj.show = function (sHTML,nWidth,nHeight) {
	popLayerObj.create();
	var pageSize = getPageXY();
	document.getElementById("popLayer").innerHTML = sHTML;
	document.getElementById("bcPopLayer").style.width = pageSize[0]+'px';
	document.getElementById("bcPopLayer").style.height = pageSize[1]+'px';
	document.getElementById("popLayer").style.left	= (pageSize[0] - nWidth)/2+'px';
	document.getElementById("popLayer").style.top	= document.documentElement.scrollTop-4 + (pageSize[3] - nHeight) / 2+'px';
	document.getElementById("popLayer").style.width = nWidth;
	document.getElementById("popLayer").style.height = nHeight;
}
popLayerObj.close = function () {
	var bcEle=document.getElementById("bcPopLayer");
	var ele=document.getElementById("popLayer");
	bcEle.style.display='none';
	ele.style.display='none';
	ele.innerHTML='';
	var ele=document.getElementsByTagName("select");
	for(var i=0;i<ele.length;i++){
		if(ele[i]!=null) ele[i].style.display='inline';
	}
	popLayerObj.closeEnd();
}
//提示框 1=确定 2=确定 取消
popLayerObj.showPrompt=function(msg,flag){
	var sb=[];
	sb.push('<div class="layer_size2" style="height:140px;" >');
		sb.push('<div class="lilayer_title">');
			sb.push('<span class="float_left layer_title">系统提示</span>');
			sb.push('<span class="float_right layer_close ">');
				sb.push('<a href="javascript:void(0)" onclick="popLayerObj.close();"><img src="http://style.blogcn.com/blogcnpage/style/images/control/images/close.gif" alt="关闭" border="0" /></a>');
			sb.push('</span>');
		sb.push('</div>');		
		sb.push('<div class="layer_connect" style="text-align:left;padding-left:10px;">');
			sb.push('<p>'+msg+'</p>');
		sb.push('</div>');
		sb.push('<div class="layer_post">');
			sb.push('<input name="button6222" type="button" onclick="popLayerObj.close();" class="layer_input01" value="确 定" />');
			if(flag && flag==2) sb.push('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input onclick="popLayerObj.close();" name="button6" type="button" class="layer-input01" value="取消" />');
		sb.push('</div>');
	sb.push('</div>');
	popLayerObj.show(sb.join(''),300,60);
}
popLayerObj.ofush=function(){//如果你重写了popLayerObj.createBefore popLayerObj.closeEnd 可以调用这个方法清除
	popLayerObj.createBefore=function(){};
	popLayerObj.closeEnd=function(){};
}

popLayerObj.createBefore=function(){};//可以重写的


popLayerObj.closeEnd=function(){};//可以重写的



popLayerObj.create = function () {
	popLayerObj.createBefore();	
	var bcEle=document.getElementById("bcPopLayer");
	var ele=document.getElementById("popLayer");	
	if(bcEle==null){
		var str = '<div style="position:absolute;background:#6699FF; top: 0px; left: 0px; filter:alpha(opacity=20);-moz-opacity:0.2;opacity: 0.2;" id="bcPopLayer"></div><div id="popLayer"  style="background:white;position:absolute;"></div>';
		addHTML(document.body, str);
	}else{
		bcEle.style.display='';
		ele.style.display='';
	}
	var ele=document.getElementsByTagName("select");
	for(var i=0;i<ele.length;i++){
		if(ele[i]!=null) ele[i].style.display='none';
	}
}

popLayerObj.reSize = function (nWidth,nHeight) {
	var pageSize = getPageXY();
	document.getElementById("popLayer").style.left	= (pageSize[0] - nWidth)/2+'px';
	document.getElementById("popLayer").style.top	= document.documentElement.scrollTop-4 + (pageSize[3] - nHeight) / 2+'px';
	document.getElementById("popLayer").style.width = nWidth;
	document.getElementById("popLayer").style.height = nHeight;
}

function addHTML(oParentNode, sHTML) {
	if(window.addEventListener) {
		var oRange = oParentNode.ownerDocument.createRange();
		oRange.setStartBefore(oParentNode);
		var oFrag = oRange.createContextualFragment(sHTML);
		oParentNode.appendChild(oFrag);
	}else {
		oParentNode.insertAdjacentHTML("BeforeEnd", sHTML);
	}
}






/*
  Description:根据name从cookie中取值
  Input:name cookie名称
*/
function GetCookie (name) {
	var value = GetCookieValue(name);
	if(value==null){
		var userinfo = GetUserinfoCookie();
		if(userinfo!=null){
			for(var i=0;i<userinfo.length;i++){
				if(userinfo[i].indexOf(name)==0){
					value = userinfo[i];
					var index = value.indexOf('=');
					value = value.substring(index+1,value.length);
					//alert(name+"="+value);
					return value;
				}
			}
		}
		var bloginfo = GetBloginfoCookie();
		if(bloginfo!=null){
			for(var i=0;i<bloginfo.length;i++){
				value = bloginfo[i];
				if(value.indexOf(name)==0){
					var index = value.indexOf('=');
					value = value.substring(index+1,value.length);
					//alert(name+"="+value);
					return value;
				}
			}
		}
		var currenttime = GetCurrenttimeCookie();
		if(currenttime!=null){
			for(var i=0;i<currenttime.length;i++){
				value = currenttime[i];
				if(value.indexOf(name)==0){
					var index = value.indexOf('=');
					value = value.substring(index+1,value.length);
					//alert(name+"="+value);
					return value;
				}
			}
		}
		return null;
	}
	else{
		//alert(name+"="+value);
		return value;
	}
}

/*
  Description:根据name从cookie中取值（非组合串中的值）
  Input:name cookie名称
*/
function GetCookieValue(name){
	var cookie = document.cookie.split("; ");
	for(var i=0;i<cookie.length;i++){
		var index = cookie[i].indexOf("=");
		if(index!=-1){
			var cookiename = cookie[i].substring(0,index);
			if(name==cookiename){
				return cookie[i].substring(index+1,cookie[i].length);
			}
		} 
	}
	return null;
}

// 从cookie中取用户信息
function GetUserinfoCookie(){
	var userinfo = GetCookieValue('userinfo');
	if(userinfo!=null&&userinfo!=''){
		
		var cookies = userinfo.split('|^^|');
		cookies[0]='key='+cookies[0];
		cookies[1]='newuserid='+cookies[1];
		cookies[2]='username='+cookies[2];
		cookies[3]='nickname='+unescape(cookies[3]);
		//cookies[4]='headportraiturl='+cookies[4];
		cookies[4]='systemstate='+cookies[4];
		cookies[5]='ip='+cookies[5];
		cookies[6]='ouserid='+cookies[6];
		if(cookies.length>7)
			cookies[7]='state='+cookies[7];
		else
			cookies[7]='state=1';
		//alert(cookies[0]+"\n"+cookies[1]+"\n"+cookies[2]+"\n"+cookies[3]+"\n"+cookies[4]+"\n"+cookies[5]+"\n"+cookies[6]);
		return cookies;
	}
	else
		return null;
}

// 从cookie中取博客信息
function GetBloginfoCookie(){
	var bloginfo = GetCookieValue('bloginfo');
	if(bloginfo!=null&&bloginfo!=''){
		var cookies = bloginfo.split('|^^|');
		cookies[0]='blogid='+cookies[0];
		cookies[1]='blogdomain='+cookies[1];
		cookies[2]='blogtypeid='+cookies[2];
		cookies[3]='status='+cookies[3];
		cookies[4]='pblogid='+cookies[4];
		cookies[5]='pblogdomain='+cookies[5];
		return cookies;
	}
	else
		return null;
}
//设置cookie博客信息
function SetBlogInfoCookie(blog){
	var cookies = GetBloginfoCookie();
	var bloginfo = blog.id + '|^^|' + blog.blogdomain + '|^^|' + blog.blogtypeid + '|^^|' + blog.status + '|^^|' + cookies[4] + '|^^|' + cookies[5];
	SetCookie('bloginfo',bloginfo,null,false);
}

// 从cookie中取活动时间
function GetCurrenttimeCookie(){
	var currenttime = GetCookieValue('currenttime');
	if(currenttime!=null&&currenttime!=''){
		var cookies = currenttime.split('|^^|');
		cookies[0]='currenttime0='+cookies[0];
		cookies[1]='date0='+cookies[1];
		return cookies;
	}
	else
		return null;
}

/*
  Description:设置Cookie
  Input:name Cookie名称
        value Cookie值
        hours 过期时间
        flag 标志是否要处理value，进行escape
*/
function SetCookie (name,value,hours,flag){
  var domain=";domain=blogcn.com";
  var expire = "";
  if(hours!=null){
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  if(flag==null||flag)
  	value= escape (value);
  document.cookie = name + "=" + value + expire + "; path=" + "/" + domain;
}

//清除cookie
function cleanupCookie(){
	var cookie = document.cookie.split("; ");
	//alert("alert.length=="+cookie.length);
	for(var i=0;i<cookie.length;i++){
		
		var index = cookie[i].indexOf("=");
		if(index!=-1){
			var cookiename = cookie[i].substring(0,index);
				//alert("cookiename=="+cookiename);
			if(cookiename!="hitdate"){
				SetCookie(cookiename,"");
			}
		} 
	}
	/*alert(document.cookie);
	return false;
	for(var i=0;i<cookie.length;i++){
		
		var index = cookie[i].indexOf("=");
		if(index!=-1){
			alert("还有cookies=="+cookie[i]);
		}
	}*/
	
}

//切换cookie
function switchCookie(blog){
	SetCookie("clientkey",blog.clientkey,null,false);
	SetBlogInfoCookie(blog);
	//alert(document.cookie);	
}

/*
  Description:取老系统cookie
  Input:cookiename cookie名称
*/
function getOldCookie(cookiename,sname){
	var cookie = document.cookie.split("; ");
	for(var i=0;i<cookie.length;i++){
		if(cookie[i].indexOf(sname)==0){
			var con = cookie[i].substring(9,cookie[i].length);
			cookie = con.split("&");
			for(var j=0;j<cookie.length;j++){
				if(cookie[j].indexOf(cookiename)==0){
					con = cookie[j].substring(9,cookie[j].length);
					return unescape(con);
				}
			}			 
			break;		
		}
	}
}





//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//*****************************************************************************

// Determine browser and version.

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",	dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",	dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,	true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}






//DOM文档完全载入后激活的函数（与onload比较区别在与不等待图片等外部资源）
//onContent(function(){alert("onContent :)")});
//一个例子http://www.3site.eu/jstests/onContent/final.html
function onContent(f) {
    var a = onContent, b = navigator.userAgent, d = document, w = window, c = "onContent", e = "addEventListener", o = "opera", r = "readyState", s = "<scr".concat("ipt defer src='//:' on", r, "change='if(this.", r, "==\"complete\"){this.parentNode.removeChild(this);", c, ".", c, "()}'></scr", "ipt>");
    a[c] = (function (o) {
        return function () {
            a[c] = function () {
            };
            for (a = arguments.callee; !a.done; a.done = 1) {
                f(o ? o() : o);
            }
        };
    })(a[c]);
    if (d[e]) {
        d[e]("DOMContentLoaded", a[c], false);
    }
    if (/WebKit|Khtml/i.test(b) || (w[o] && parseInt(w[o].version()) < 9)) {
        (function () {
            /loaded|complete/.test(d[r]) ? a[c]() : setTimeout(arguments.callee, 1);
        })();
    } else {
        if (/MSIE/i.test(b)) {
            d.write(s);
        }
    }
}
/*
取时间戳
*/
function timestamp(){
	var timestamp = Date.parse(new Date());
    return timestamp;
}

/*
设置时间限制cookie
*/
function set_restrictcookie(visit_int){
		var time = timestamp();
		var cookievalue = time + '|' + window.location.href + '|' +visit_int;
		SetCookie('visit_time',cookievalue,null,true);
}

/*
iframe模拟ajax效果:
iframename:iframe的名称
reload:回调函数
RequestUrl:请求地址
*/
function public_GetServerText(iframename,reload,RequestUrl) { 
	
	//var span = document.getElementById('spanIFrame')  
  	//if(span==null){   
  	//	var spanIFrame=document.createElement("span");   
  	//	spanIFrame.id="spanIFrame";   
  	//	spanIFrame.innerText="";   
  	//	spanIFrame.style.display="none";   
  	//	document.body.appendChild(spanIFrame);   
  	//}
  var iframe = document.getElementById(iframename);
  
  if(iframe==null){   
  	iframe=document.createElement("iframe");   
  	iframe.id=iframename;
	iframe.name = iframename;
  	if (navigator.userAgent.indexOf("MSIE") != -1){
		iframe.attachEvent("onload",reload);
	} 
	else {
		iframe.onload = reload;
	}
  	iframe.src=RequestUrl;   
  	iframe.style.display="none"; 
  	
	document.body.appendChild(iframe); 
  }
  else{   
  	iframe.src=RequestUrl;
  } 
  return true;   
}

/**
 * 时间prototype格式化时间
 * @author 	springpig
 * @email	wangyouyi1983@hotmail.com
 */
Date.prototype.format = function(format){   
	var o = {   
		"M+" : this.getMonth()+1, //month   
     	"d+" : this.getDate(),    //day   
     	"h+" : this.getHours(),   //hour   
     	"m+" : this.getMinutes(), //minute   
     	"s+" : this.getSeconds(), //second   
     	"q+" : Math.floor((this.getMonth()+3)/3), //quarter   
     	"S" : this.getMilliseconds() //millisecond   
     }   
   	if(/(y+)/.test(format)) 
   		format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));   
   	for(var k in o)
   		if(new RegExp("("+ k +")").test(format))   
     		format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));   
   return format;   
}