﻿var semoks="";
function selectAll(formname) 
    {

for (var i=0;i<document.forms[formname].choo.length;i++) {
var temp=document.forms[formname].choo[i];
temp.checked=!temp.checked;
}
    if (document.all.selectButton.value=="")
    {
      document.all.selectButton.value="";
    }
    else
    {
      document.all.selectButton.value="";
    }
}
function selectAlls(formname,selectAllId,type,elementName2) {
	var allcheckbox = document.getElementById(selectAllId);
	var allType = document.getElementsByName(type);
	if(allType != null){
		if(allType.length > 0){
			for (var i=0; i<allType.length; i++) {
				allType[i].checked = allcheckbox.checked;
			}
		}
	}
	var allMessages = document.getElementsByName(elementName2);
	if(allMessages != null){
		if(allMessages.length > 0){
			for (var i=0; i<allMessages.length; i++) {
				allMessages[i].checked = allcheckbox.checked;
			}
		}
	}
}

function selectAllReqDes(formname,selectAllId) {
	var allcheckbox = document.getElementById(selectAllId);
	var allReqMessage = document.getElementsByName("messageRequest");
	if(allReqMessage != null){
		if(allReqMessage.length > 0){
			for (var i=0; i<allReqMessage.length; i++) {
				allReqMessage[i].checked = allcheckbox.checked;
			}
		}
	}	

	var allDescMessage = document.getElementsByName("messageDesc");
	if(allDescMessage != null){
		if(allDescMessage.length > 0){
			for (var i=0; i<allDescMessage.length; i++) {
				allDescMessage[i].checked = allcheckbox.checked;
			}
		}
	}	

	var allRequest = document.getElementsByName("requests");
	if(allRequest!=null){
		if(allRequest.length>0){
			for (var i=0;i<allRequest.length;i++) {
				allRequest[i].checked = allcheckbox.checked;
			}
		}
	}	

	var allDescription = document.getElementsByName("description");
	if(allDescription!=null){
		if(allDescription.length>0){
			for (var i=0;i<allDescription.length;i++) {
				allDescription[i].checked = allcheckbox.checked;
			}
		}
	}	
}

function getObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
  // W3C DOM
  return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
  // MSIE 4 DOM
  return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
  // NN 4 DOM.. note: this won't find nested layers
  return document.layers[objectId];
    } else {
  return false;
    }
}

function displayList(){
        var h = getObject('class_cnt1').offsetHeight;  
        var max_h = 100; 

        var anim = function(){
            h += 50; 
           
            if(h >= max_h){
                getObject('class_cnt1').style.height = "100px"; 
                if(tt){window.clearInterval(tt);} 
            }
            else{ 
                getObject('class_cnt1').style.display="block"; 
                getObject('class_cnt1').style.height = h + "px"; 
            }
        }

        var tt = window.setInterval(anim,2);  
}

function hiddenList(){
       var h = getObject('class_cnt1').offsetHeight; 
       var anim = function(){
           h -= 50; 

           if(h <= 5){
               getObject('class_cnt1').style.display="none"; 
               if(tt){window.clearInterval(tt);}
           }
           else{
               getObject('class_cnt1').style.height = h + "px";
           }
       }

       var tt = window.setInterval(anim,2); 
}

function showClassList(){

   if(getObject('class_cnt1').style.display == "none"){
       displayList(); 
   }
   else{ 
       hiddenList(); 
   }
}

function clear_message(formname,chkAll,actionUrl,ChkName,objSpan){
  var checkBoxList = document.getElementsByName(ChkName);
  if(checkBoxList==null) {
  	return;
  }
  var flag,chkIds="",chkLength=0,divObj="";
  for(var i=0; i<checkBoxList.length; i++) {
  	  divObj=document.getElementById("liMessage"+checkBoxList[i].value);
  	  if(checkBoxList[i].checked&&divObj.style.display!="none") {
  	  	  flag = "ok";
  	  	  chkIds+=checkBoxList[i].value+",";
  	  	  chkLength++;
  	  }
  }
  if(flag!="ok") {
  	alert("你还没有选择项！！！");
  	return;
  }
  if(!confirm('确定删除所选信息吗？')){
		return;
	}
  if(document.getElementById(chkAll).checked==true){
  	document.getElementById(chkAll).checked=false;
  }
  var deleteMessage = document.getElementById(formname); 
  
  jQuery.ajax({
		url:actionUrl,
		type:"post",
		data:jQuery("#"+deleteMessage.id).serialize(),
		success:function(response){
			if(objSpan){
				var allcount=parseInt(document.getElementById(objSpan).innerHTML);
				document.getElementById(objSpan).innerHTML=allcount-chkLength;
			}
			clear_sysmessageCallBack(chkIds);
		}
	});
}
function clear_sysmessageCallBack(ids){
	var arryIds=ids.split(",");
	for(var i=0;i<arryIds.length-1;i++){
		document.getElementById("liMessage"+arryIds[i]).style.display="none";
	}
}

//转到保险箱
function setSafeMessage(formname,chkAll,actionUrl,ChkName,objSpan){
	var checkBoxList = document.getElementsByName(ChkName);
	var flag;
	for(var i=0;i<checkBoxList.length;i++) {
		if(checkBoxList[i].checked) {
			flag="ok";
		}
	}
	if(flag!="ok"){
		alert("你还没有选择项！！！");
		return;
	}
	if(document.getElementById(chkAll).checked==true){
		document.getElementById(chkAll).checked=false;
	}
	var updateMessage = document.getElementById(formname); 
	
	jQuery.ajax({
		url:actionUrl,
		type:"post",
		data:jQuery("#"+updateMessage.id).serialize(),
		success:function(response){
			document.getElementById(objSpan).innerHTML=parseInt(document.getElementById(objSpan).innerHTML)+parseInt(response);
			for(var i=0;i<checkBoxList.length;i++) {
				if(checkBoxList[i].checked) {
					checkBoxList[i].checked=false;
				}
			}
			alert("短信复制成功!");
		}
	});
}
//删除全部
function delect_messages(formname,chkAll,actionUrl,objId,objUl,objSpan,objPage){
	if(!confirm('确定删除全部信息吗？')){
		return false;
	}
	if(document.getElementById(chkAll).checked==true){
		document.getElementById(chkAll).checked=false;
	}
	document.getElementById(objId).style.display="block";
	var deleteMessage = document.getElementById(formname); 
	
	jQuery.ajax({
		url:actionUrl,
		type:"post",
		data:jQuery("#"+deleteMessage.id).serialize(),
		success:function(response){
			if(objSpan!='')
				document.getElementById(objSpan).innerHTML=0;
			if(objPage!='')
				document.getElementById(objPage).style.display="none";
			document.getElementById(objId).style.display="none";
			document.getElementById(objUl).style.display="none";
		}
	});
}
function clear_messages(formname,chkAll,actionUrl,chkName,chkName2){
	var messageReqList = document.getElementsByName(chkName);
	var messageDesList= document.getElementsByName(chkName2);
	if(messageReqList==null) {
		return;
	}
	var flag="",chkRIds="",chkDIds="";
	for(var i=0; i<messageReqList.length; i++) {
		if(messageReqList[i].checked) {
			flag="ok";
			chkRIds+=messageReqList[i].value+",";
		}
	}
	for(var i=0; i<messageDesList.length; i++) {
		if(messageDesList[i].checked) {
			flag="ok";
			chkDIds+=messageDesList[i].value+",";
		}
	}
	if(flag!="ok") {
		alert('你还没有选择项。');
		return;
	}
	if(!confirm('确定删除所选信息吗？')){
		return;
	}
	if(document.getElementById(chkAll).checked==true){
		document.getElementById(chkAll).checked=false;
	}
	var deleteMessage = document.getElementById(formname); 
	
	jQuery.ajax({
		url:actionUrl,
		type:"post",
		data:jQuery("#"+deleteMessage.id).serialize(),
		success:function(response){
			clear_sysmessageRDCallBack(chkRIds,chkDIds);
		}
	});
}
function clear_sysmessageRDCallBack(rIds,dIds){
	var arryRIds=rIds.split(",");
	for(var i=0;i<arryRIds.length-1;i++){
		document.getElementById("liMessageAddFriend"+arryRIds[i]).style.display="none";
	}
	var arryDIds=dIds.split(",");
	for(var j=0;j<arryDIds.length-1;j++){
		document.getElementById("liMessageDescription"+arryDIds[j]).style.display="none";
	}
}
//点击收件箱“查看”触发js事件
function seeMessageBox(liObj,messageId,isRead){	
	//jQuery("p[name='p_figure']").attr("className", "");
	//jQuery("div[name='box']").attr("style", "display:none");

	jQuery("p[name='p_figure']").removeClass();
	jQuery("div[name='box']").hide();	

	document.getElementById("p_figure_" + messageId).className = "closed";
	document.getElementById("box_" + messageId).style.display = "block";
	
	document.getElementById("hfID").value = messageId;

	if(isRead=='F'){
		jQuery.ajax({
			url:"/seemessage/updateMessage.php",
			type:"post",
			data:"messageId="+messageId,
			success:function(response){
				document.getElementById(liObj).className="dashedOn";
			}
		});
	}
}

function openShutMessage(divCount,oSourceObj,oTargetObj,mesId,shutAble,oOpenTip,oShutTip){
	var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj;
	var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj;
	var openTip = oOpenTip || "";
	var shutTip = oShutTip || "";
	for(i=0;i<divCount;i++){
		var boxDiv = document.getElementById("box_"+i);	
		var subsDiv = document.getElementById("subid_"+i);
		var browseA1 = document.getElementById("browseA_"+i);
		if(boxDiv != targetObj){
			boxDiv.style.display="none";
			subsDiv.style.display="block";
			//browseA1.style.display = "block";
		}
	}
	var targetObjId = targetObj.id;
	var subDivIndex = targetObjId.substring(targetObjId.indexOf("_"));
	var subDiv = document.getElementById("subid"+subDivIndex);
	var browseA = document.getElementById("browseA"+subDivIndex);
	if(targetObj.style.display!="none"){
		if(shutAble) return;
		targetObj.style.display="none";
		if(openTip  &&  shutTip){
			sourceObj.innerHTML = shutTip; 
		}
		//browseA.style.display = "block";
		subDiv.style.display = "block";
	} else {
		targetObj.style.display="block";
		if(openTip  &&  shutTip){
			sourceObj.innerHTML = openTip; 
		}
		//browseA.style.display = "none";
		subDiv.style.display = "none";
	}
}

//会员申请注册及会员推荐注册公用js
//检测email的合法性：通过判断长度及正则表达式对email的匹配
function checkEmailIsIllegal(emailNode,resultNode) {
	var email = emailNode.value.trim();
	var emailReg = /\b(^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*$)\b/;
	if(email.length <= 0){
		resultNode.innerHTML = "<img class='error' src='/images/bg.gif'/><span class='mainColor'>请输入Email</span>";
		return false;
	}else if(!emailReg.test(email)) {
		resultNode.innerHTML = "<img class='error' src='/images/bg.gif'/><span class='mainColor'>Email格式错误</span>";
		return false;
	}
	return true;
}
// ajax validate email：通过ajax异步调用检测email是否已存在
function checkEmail(emailNode,resultNode,type){
	resultNode=document.getElementById(resultNode);
	if(checkEmailIsIllegal(emailNode,resultNode)){
		var email = emailNode.value.trim();
		jQuery.ajax({
			url:"/apply/ajaxCheckEmail.php",
			type:"get",
			data:"txtEmail=" + encodeURI(email)+"&type="+type,
			success:function(response){
				checkEmailCallBack(response,resultNode);
			}
		});
	}
}
// ajax validate callback：处理异步调用后的结果
function checkEmailCallBack(responseText,resultNode) {
	var resultText = "该Email可以使用";
	if(responseText.indexOf(resultText) == -1) {
		resultNode.innerHTML = "<img class='error' src='/images/bg.gif'/><span class='mainColor'>" + responseText + "</span>";
	}else{
		resultNode.innerHTML = "<img class='correct' src='/images/bg.gif'/><span class='mainColor'>" + responseText + "</span>";
	}
}


/******************************与添加上传图片控件相关公用js方法**********************************************/
//添加上传图片控件
var count_file = 1;
var fileId = 1;
function addFile(elementId,picNum,isDialog){
	if(isDialog&&parseInt(modualCount)+parseInt(count_file)>=maxModualCount){
		alert("抱歉!最多可以上传"+maxModualCount+"个模块!!!");
		return;
	}
	if(count_file<picNum) {
		count_file = count_file+1;
		fileId ++;
		var file_item = document.createElement("div");
		file_item.className = "picUpBox";
		var picUpId="'picUp"+fileId+"'";
		var fileInnerHTML ='<a class="close1 " href="javascript:void(0)" onclick="delFiled(this,'+isDialog+');return false;"></a>';
		fileInnerHTML+='<input class="picUpText borderOn font14" id="picUp'+fileId+'" name="picUp'+fileId+'" type="text" readonly="true" />';
		fileInnerHTML+=' <input class="buttonS_5 font12" type="button" value="浏览..." onfocus="this.blur()" />';
		fileInnerHTML+='<input class="picUp font14 ie8" type="file" onchange="setValue(this,'+picUpId+')" id="uploadFile'+fileId+'" name="listUpload[]"  style="margin-left:-80px\\0;" />';
		file_item.innerHTML =fileInnerHTML;
		document.getElementById(elementId).appendChild(file_item);
		if(isDialog)
			bkwin('#ajax_upload_dialog');
	} else{
		alert("抱歉，你一次最多只能上传"+picNum+"张图片");
	}
}
//删除添加上传图片的input控件
function delFiled(obj,isDialog){
	count_file = count_file - 1;
	obj.parentNode.parentNode.removeChild(obj.parentNode);
	if(isDialog)
		bkwin('#ajax_upload_dialog');
}
//当input控件中类型不符时，将input控件值置空
function setValue(element,id){
	//document.getElementById(sname).value;

/*
	var FileMaxSize = 1000;//限制上传的文件大小，单位(k)  
 
       
   var image=new Image();        
   image.src=element.value + " ";    
 
		alert(image.fileSize); 
*/
 
	// document.getElementById('zoompic').src=element.value;
	//alert(element.value);
	if(checkType(element)){
		var value = element.value;
		document.getElementById(id).value = value;
	}else{
		document.getElementById(id).value = "";
	}
}

function chkimgsize1(){		
}
// 检查上传文件类型
var ALLOWED_TYPE = ".jpg|.bmp|.jpeg";
var imgTypeErrorInfo = '目前只支持"JPG"或者"BMP"或者"JPEG"格式';
var imgSizeErrorInfo = '图片最大限制是5M';

function validate(obj,type){
	switch(type){
		case "title":  return document.getElementById(obj).value.length > 0;
		case "editor": return (editor.getContent(false).stripTags().trim().length>0&&editor.getContent(false).stripTags().trim()!="?")||(editor.getContent(false).replace(/(?!<\/?[^>]+)/gi,"").search(/<img\/?[^>]+/gi)!=-1);
		case "imageType": return (ALLOWED_TYPE.indexOf(obj.value.slice(obj.value.lastIndexOf(".")).toLowerCase())!=-1);
		//....
		//other validate...
		default: return true;
	}
}
function checkType(obj){
	if(!validate(obj,"imageType")){
		if(navigator.userAgent.toLowerCase().indexOf("firefox")>=0)
	 	 	obj.value = "";
	 	else{
		 	obj.select();
		 	//document.execCommand("delete");
		 	obj.outerHTML += "";
	 	}	
	 	alert(imgTypeErrorInfo);
	 	return false;	
	}
	return true;
}
//转换图片的最大宽度和高度
function resize(img,w,h,width,height){
	var image = new Image();
	image.src = img.src;
	if((w/width) > (h/height)){
		image.width = width;
		image.height = Math.round(h*width/w);
	}
	else {
		image.height = height;
		image.width = Math.round(w*height/h);
	}		
	img.width = image.width;
	img.height = image.height;
}
//图片排序:jquery排序
jQuery(function() {
	jQuery("#photo_list").sortable();
	jQuery("#photo_list").disableSelection();
});


//将表情字符用正则替换成表情图片
function formatImages(objContainer){
	jQuery("#"+objContainer).html(jQuery("#"+objContainer).html().replace(/\{#face:(\d+)\}/g,"<img src='/images/face/$1.jpg' />"));
}
//节点交换位置
function swapNode(node1, node2){  
	//获取父结点  
	var _parent = node1.parentNode; 
	//将node2插入到原来node1的位置  
	_parent.insertBefore(node1, node2); 
}
//textarea中超过字符长度自动截取同时提示对方
function checkTextAreaLengthAlert(obj,maxChars){
	if (obj.value.length > maxChars) {
		obj.value = obj.value.substring(0, maxChars-1);
		alert("字数过长，最多"+maxChars+"字");
	}
}
//点击返回按钮跳转到后台
function goBackStage() {  
    window.location.href="/mgrindex.php";          
}
//返回上页
function goPrePage(){
	window.history.go(-1);
}
//字符串替换
function convertHtmlEncode(str){ 
	str=replaceAll(str,"&","&");   
	str=replaceAll(str,"<","<");   
	str=replaceAll(str,">",">");   
	str=replaceAll(str,"'","'");   
	str=replaceAll(str,"”","\"");   //
	str=replaceAll(str,"“","\"");  
	return str;   
}
//身份照上传页面
function photoVerify(){
	var photo_link="templat/photoVerifys.php";
	window.location = photo_link;
}
//身份照显示页面
function photoList(wkey){
	var photo_link="templat/photoVerifyList.php?wKey="+wkey;
	window.location = photo_link; 
}
//点击上传头像调用弹出层
function logoDialog(flag){
	var userLogoUrl = jQuery("#userLogoUrl").val();
	ajax_pop_photo("/phps/profile/ProfileFigureEdit.php","flag="+flag+"&userLogoUrl="+userLogoUrl,140,130,80,169,730,"上传头像");
};
//上传头像载入图片
function loadLogo(picUrl){
	var errorResultDiv = jQuery("#errorResult");
	errorResultDiv.show();
	if(picUrl == "invalid") {
		errorResultDiv.html("<br />请重新登录！");
	} else if(picUrl == "invalidFile") {
		errorResultDiv.html(imgTypeErrorInfo);
	} else if(picUrl == "invalidFileSize") {
		errorResultDiv.html(imgSizeErrorInfo);
	} else {
		errorResultDiv.hide();
		var picName = picUrl.substring(picUrl.indexOf("logo_src_") + 9);
		imageLoad(picName,picUrl,140,130,80,169);
	}
}
//点击完成提交保存上传头像
function figureSubmit(picInfo,flag) {
	var url =null;
	if(flag=="register"){
		var times = picInfo[0];
		var x1 = parseInt(picInfo[1]);
		var y1 = parseInt(picInfo[2]);
		var x2 = parseInt(picInfo[3]);
		var y2 = parseInt(picInfo[4]);
		jQuery("#idPicture")[0].src ="/imgprocess/facecrop.php?imgSrc="+imageSrc+"&newwidth="+document.getElementById('newImage').width+"&x1="+x1+"&y1="+y1+"&x2="+x2+"&y2="+y2+"&times="+times+"&random="+Math.random()+"&flag=register";
		jQuery("#oriLogoUrl").val("logo_src_" + imageSrc);
		jQuery("#logoUrl").val("logo_des_" + imageSrc);
		bkwin.load_close();
	}else{
			var logoCallBack = function(){
			var userLogoUrl = jQuery("#userLogoUrl").val();
			jQuery("#idPicture").attr("src","/imgprocess/cropAndSaveface.php?random="+Math.random());//"/attac"+imageSrc);//userLogoUrl+"logo_des_"+
		}
		url = "/imgprocess/cropAndSaveface.php";
		bkwin.load_close();
		saveImage(picInfo,url,logoCallBack);
	}
}
/* 上传头像，包括注册，我的首页，档案*/
//修改头像，上传头像、
var imageSrc = "sample.jpg";
//上传图片弹出框
function ajax_pop_photo(url,param,pich,picw,h,w,dialogWidth,title){
	bkwin.remove();
	
	//if( title ==""){ title="Load";}
	bkwin.load(url,{
	    modal: true,
	    draggable : false,
	    resizable : false,
	    bgiframe:true,
	    width:dialogWidth,
	    title:title,
	    dialogClass:" picPop"
	},param,function(){
		jQuery("#ajax_upload_dialog .imgcutbox").height(parseInt(pich)+2*h);
		jQuery("#ajax_upload_dialog .imgcutbox").width(parseInt(picw)+2*w);
		jQuery("#ajax_upload_dialog .imgcutT,.imgcutB").height(h);
		jQuery("#ajax_upload_dialog .imgcutT,.imgcutB").width(parseInt(picw));
		jQuery("#ajax_upload_dialog .imgcutT,.imgcutB").css("left",w);
		jQuery("#ajax_upload_dialog .imgcutR,.imgcutL").height(parseInt(pich)+2*h);
		jQuery("#ajax_upload_dialog .imgcutR,.imgcutL").width(w);
	    jQuery("#ajax_upload_dialog .imgsizer").slider({value:50});
	   	bkwin("#ajax_upload_dialog");
	})
};
//上传进度条
var timer = null;
function startStatusCheck(url,divId,upload){
	jQuery("#status").show();
	if(upload != null&&jQuery(upload).val() == "") {
		alert("请选择图片！");
		jQuery("#status").hide();
		return false;
	}
	
	if(jQuery("#submitButton").size()!=0)
		jQuery("#submitButton").attr("disabled",true);
	if(jQuery("#btnSave").size()!=0)
		jQuery("#btnSave").attr("disabled",true);
	loadInfo(url,divId);
	return true;
}
function loadInfo(url,divId){
	jQuery("#"+divId).load(url,{c:divId},function(){if(jQuery("#ajax_upload_dialog").size()!=0)bkwin("#ajax_upload_dialog");});
	timer = setTimeout("loadInfo('"+url+"','"+divId+"')",1000);
};
//载入上传的图片
function imageLoad(picName,picUrl,pich,picw,h,w){
	var dg=jQuery("#ajax_upload_dialog");
	dg.find(".boximg").remove();
	imageSrc = picName;
	img = jQuery('<img id ="newImage" src="'+picUrl+'" class="boximg" style="visibility:hidden"/>');
	try{
	jQuery("#btnSubmitFM").attr("disabled",false);
	}catch(err){}
	var load=bkwin(
		'<div style="text-align:center; font-size:12px; color:#F09;font-family: Verdana;">载入中...LOADING</div>',
		{draggable : false,resizable : false,width:360,height:150}
	)
	img[0].onload=function(){
    	jQuery(this).css({visibility:""});
    	bkwin.close(load);
    	var images = new Image();
    	images.onload = function(){
    		if(images.width<picw/3||images.height<pich/3){
    			alert("上传图片尺寸过小!!!");
    			return;
    		}
    		dg.find(".imgcutbox").prepend(img);
			init_photo_box(dg,pich,picw,h,w,images.width,images.height);
			jQuery("#newImage").css("width",images.width);
			jQuery("#newImage").css("top",(pich+h*2-images.height)/2);
			jQuery("#newImage").css("left",(picw+w*2-images.width)/2);
			zoom('#ajax_upload_dialog',0.1);
			clearTimeout(timer);
    	}
		images.src = this.src;
	}
	jQuery("#status").hide();
	bkwin("#ajax_upload_dialog");
    jQuery("#picUp").val("");
} 
//增加头像上传预览
function docrops(zoompic,picInfo,flag){
	var cropLink ;
	var imgSrc = imageSrc.slice(imageSrc.lastIndexOf("/")+1);
	if(imgSrc=="sample.jpg"){
		alert("请上传图片");
	}else{
		jQuery("#"+zoompic+"str").show();
		var times = picInfo[0];
		var x1 = parseInt(picInfo[1]);
		var y1 = parseInt(picInfo[2]);
		var x2 = parseInt(picInfo[3]);
		var y2 = parseInt(picInfo[4]);
		if(flag){
			cropLink = "/imgprocess/facecrop.php?"+"imgSrc="+imgSrc+"&newwidth="+document.getElementById('newImage').width+"&x1="+x1+"&y1="+y1+"&x2="+x2+"&y2="+y2+"&times="+times+"&random="+Math.random()+"&flag=register";
		}else{
			cropLink = "/imgprocess/facecrop.php?"+"imgSrc="+imgSrc+"&newwidth="+document.getElementById('newImage').width+"&x1="+x1+"&y1="+y1+"&x2="+x2+"&y2="+y2+"&times="+times+"&random="+Math.random();
		}
	}
	jQuery("#"+zoompic).attr("src",cropLink);
	setTimeout(function(){jQuery("#"+zoompic+"str").hide();}, 1000);//调用一个函数,允许带常量参数	
}
//弹出层上传图片保存
function saveImage(picInfo,url,callBackFun,newwidth,picname) {
	var imgSrc = imageSrc;//
	var times = picInfo[0];
	var x1 = parseInt(picInfo[1]);
	var y1 = parseInt(picInfo[2]);
	var x2 = parseInt(picInfo[3]);
	var y2 = parseInt(picInfo[4]);
	jQuery.ajax({
		url:url,
		type:"get",
		data:"feed=add&imgSrc="+imgSrc+"&x1="+x1+"&y1="+y1+"&x2="+x2+"&y2="+y2+"&times="+times+"&picname="+picname+"&newwidth="+newwidth +"&random="+Math.random(),
		complete :callBackFun
	});
}

//bbs翻页
function changeBbsFanyeClass(objId,style){
	document.getElementById(objId).childNodes[0].className=style;
}


function escapeHTML(obj) {
    var div = document.createElement('div');
    var text = document.createTextNode(obj);
    div.appendChild(text);
    return div.innerHTML;
  }

   	function unescapeHTML(obj) {
    var div = document.createElement('div');
    div.innerHTML = obj.replace(/<\/?[^>]+>/gi, '');
    return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
  }
  /*  
  	 封面上传图片层点取消
  */
function closePicUploadDialog(){
	bkwin.load_close();
	clearTimeout(timer);
}
//bbs视频加载
function loadBbsVideo(index){
	document.getElementById(index).innerHTML = "视频加载中.....";
	var time=index+1+"000";
	setTimeout(function(){ document.getElementById(index).style.display="none"; },time);
}
/* 
	跳转MOKO  FB年度月度火热Fb,默认城市为北京
*/
function showMokoFb(){
	self.location = "/fb/fbHotList.php?fbCity="+encodeURI("北京");
}
/* 
	全选复选框
*/
function selectAll(obj,name){
	//obj:全选复选框对象
	//name:复选框对象
	var allCheckBox = document.getElementsByName(name);
	if(allCheckBox.length>0){
		for(var i=0;i<allCheckBox.length;i++){
			if(obj.checked==true)
				allCheckBox[i].checked=true;
			else
				allCheckBox[i].checked=false;	
		}
	}
}
/*
	判断文本模块是否为空
*/

function checkTextModualValue(){
	var isReturn = false
	jQuery("textarea[name='postItem']").each(function(i){
		if(jQuery(this).val()=="")
			isReturn = true;
	});
	if(isReturn){
		alert("怎么也要写些东西哟～");
	}
	return isReturn;
}