
/*
微博关注接口
uid： 被关注的说客id

*/
weibo_guangzhu = function(uid,sayName)

{

	if(typeof(sayName)!="undefined")
	{
		if (!confirm('您确认要关注“'+ sayName +'”的移动微博吗？')){return;};
	}


	publicAjaxFunction("weiboFollowing",{"ITACK_ID":uid,"TYPE":"1"},function(data, textStatus){
	
		if(data.status==0)
		{
			if(typeof(sayName)!="undefined")
			{ 
				alert("您已成功关注 "+ sayName +"！"); 
			}
			else
			{	  
				alert("您已成功关注该移动微博！"); 
			}
		}
		else
		{
			alert(data.errMsg);
		}
	})

}

/*
微博转发接口
fid 被转发的博客id
txt 转发时附带的内容
*/

weibo_zhuanfa=function(fid,txt,callBack)
{

	if (!txt)
	{
		txt="";
	}
	publicAjaxFunction(
	"weiboforward",
	{
		"mid":parseInt(fid), //需要转发的feed_id
		"content":txt,
		"iscomment":1	//是否在转发的同时回复，0不回复，1回复 
	},
	function(data, textStatus){
	
		if(typeof(callBack)=="function")
		{
		callBack(data);
		}
		else
		{
			if(data.status==0)
			{
				alert("转发成功");
			}
			else
			{
				alert(data.errMsg);
			}
		}
		
	})

}



/*
微博发表接口
txt发表的说客内容
*/

weibo_sendItalk = function(txt,id,type,callBack)
{
	if(txt.length<1)
	{
		alert("请填写你要发表的微博内容");
		return;
	}
	if(JHshStrLen(txt)>280)
	{		
		alert("发表失败，内容不能超过140个字");
		return;
	}
	if(isNaN(type))type=0;
	publicAjaxFunction("weiboItalkSend",{"text":encodeURIComponent(txt),"id":id,"type":parseInt(type)},function(data, textStatus){
		var flag = data.status;
		
		
		if(typeof(callBack)=="function")
		{
		callBack(data);
		}
		else
		{
			if(flag==0)
			{
				alert("发表成功!");
			}
			else
			{
				alert(data.errMsg);
			}
		}
	})

}



/*
微博发表接口
txt发表的说客内容
*/

weibo_sendImgItalk = function(txt,img,callBack)
{
	if(txt.length<1)
	{
		alert("请填写你要发表的微博内容");
		return;
	}
	if(JHshStrLen(txt)>280)
	{		
		alert("发表失败，内容不能超过140个字");
		return;
	}
	if(typeof(img)=="undefined")img="";
	publicAjaxFunction("weiboItalkSendPic",{"text":encodeURIComponent(txt),pic:img},function(data, textStatus){
		var flag = data.status;
		callBack(data)
		/*
		if(flag==0)
		{
			alert("发表成功");
		}
		else
		{
			alert(data.errMsg);
		}
		*/
	})

}


/*
评论话题发表接口
txt发表的说客内容
*/

weibo_sendComment = function(topic,txt,img,callBack,typeid,code,url,id)
{
	if(txt.length<1)
	{
		alert("请填写你要发表的微博内容");
		return;
	}
	if(JHshStrLen(txt)>280)
	{		
		alert("发表失败，内容不能超过140个字");
		return;
	}
	if(typeof(img)=="undefined")img="";
	if(typeof(id)=="undefined")id="0";
	if(typeof(typeid)=="undefined")typeid=0;
	if(typeof(code)=="undefined")code="";
	if(typeof(url)=="undefined")url="";
	if(id=="undefined")id="0";
	publicAjaxFunction("SetComment",{"topic":encodeURIComponent(topic),"text":encodeURIComponent(txt),"pic":img,"toptype":parseInt(typeid),"code":encodeURIComponent(code),"thisurl":encodeURIComponent(url),"id":id},function(data, textStatus){
		var flag = data.status;
		if(typeof(callBack)=="function")
		{
		callBack(data);
		}
		else
		{
			if(flag==0)
			{
				alert("发表成功！");
			}
			else
			{
				alert(data.errMsg);
			}
		}
	})

}



function JHshStrLen(sString)  
{  
	var sStr,iCount,i,strTemp ;  
	  
	iCount = 0 ;  
	sStr = sString.split("");  
	for (i = 0 ; i < sStr.length ; i ++)  
	{  
		strTemp = escape(sStr[i]);  
		if (strTemp.indexOf("%u",0) == -1)
		{  
		iCount = iCount + 1 ;  
		}  
		else  
		{  
		iCount = iCount + 2 ;  
		}  
	}  
	return iCount ;  
}  


/*

type:类型	1 活动，2 商品，3商家，4优惠券
email: 对方邮箱地址
title：邮件主题
content：发送内容

*/

share_email = function(type,email,title,content)
{
	publicAjaxFunction("ShareWithEmail",{
	   "type":type,
	   "ToAddress":email,
	   "Subject":title,
	   "Body":content
	} ,function(data, textStatus){
			alert(data.errMsg);	
	})

}



share_sms = function(m,content)
{
	publicAjaxFunction("SendMsg",{
		"MobileNo":m,
		"Content":content
	} ,function(data, textStatus){
			alert(data.errMsg);	
	})

}


/*复制到剪贴板*/
productDetailSetClipboard = function(txt){
	if(!setClipboard(txt)){
		alert("您所用的浏览器不支持此功能，请在地址栏上复制");
	}else{
		alert("此页面的链接已经被复制到剪贴板，您可以粘贴到QQ或电子邮件等进行分享。");
	}
}





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;
}



function replaceHtml(str)   {
        str = str.replace(/<\/?[^>]+>/gi,'');
		return str;
}









//弹窗方法
var isIe=(document.all)?true:false;
function setSelectState(state)
{
	var objl=document.getElementsByTagName('select');
	for(var i=0;i<objl.length;i++)
	{
		objl[i].style.visibility=state;
	}
}
function showMsgBox(divID,wWidth,wHeight)
{
	var bWidth= parseInt(document.documentElement.scrollWidth);
	var bHeight=parseInt(document.documentElement.scrollHeight);
	var sWidth= parseInt((document.documentElement.scrollWidth - wWidth) / 2);
	var sHeight=parseInt(document.documentElement.scrollTop + (document.documentElement.clientHeight-wHeight) / 2);
	if(isIe){
		setSelectState('hidden');
	}
	var back=document.createElement("div");
	back.id="back";
	var styleStr="top:0px;left:0px;position:absolute;z-index:120;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;";
	styleStr+=(isIe)?"filter:alpha(opacity=70);":"opacity:0.7;";
	back.style.cssText=styleStr;
	back.innerHTML="<div style=width:"+bWidth+"px;height:"+bHeight+"px;></div>";
	if(!document.getElementById('back'))
	document.body.appendChild(back);
	var mesW=document.getElementById(divID);
    document.body.appendChild(mesW);
	styleStr="left:"+sWidth+"px;top:"+sHeight+"px;width:"+wWidth+"px;position:absolute;z-index:200;display:block;";
	mesW.style.cssText=styleStr;
}
function showBackground(obj,endInt)
{
	obj.filters.alpha.opacity+=1;
	if(obj.filters.alpha.opacity<endInt)
	{
		setTimeout(function(){showBackground(obj,endInt)},8);
	}
}
function closeWindow(Obj)
{
	if(document.getElementById('back')!=null)
	{
		document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
	}
	
	document.getElementById(Obj).style.display="none";
	
	if(isIe){
		setSelectState('');
	}
}





feelUBB = function(str)
{

var tmp=str;
if(tmp==""){return tmp}
var json = {list:[{re:"微笑",u:"http://fs0.139js.com/file/wid58.jpg"},
{re:"可爱",u:"http://fs0.139js.com/file/Sfd58.jpg"},
{re:"色",u:"http://fs0.139js.com/file/ffd58.jpg"},
{re:"酷",u:"http://fs0.139js.com/file/Dfd58.jpg"},
{re:"无辜",u:"http://fs0.139js.com/file/gfd58.jpg"},
{re:"害羞",u:"http://fs0.139js.com/file/zid58.jpg"},
{re:"呲牙",u:"http://fs0.139js.com/file/ePd58.jpg"},
{re:"大哭",u:"http://fs0.139js.com/file/sid58.jpg"},
{re:"吃惊",u:"http://fs0.139js.com/file/kPd58.jpg"},
{re:"闭嘴",u:"http://fs0.139js.com/file/CPd58.jpg"},
{re:"发怒",u:"http://fs0.139js.com/file/zPd58.jpg"},
{re:"调皮",u:"http://fs0.139js.com/file/nPd58.jpg"},
{re:"奸笑",u:"http://fs0.139js.com/file/Xfd58.jpg"},
{re:"坏笑",u:"http://fs0.139js.com/file/Cfd58.jpg"},
{re:"得意",u:"http://fs0.139js.com/file/LPd58.jpg"},
{re:"大笑",u:"http://fs0.139js.com/file/cPd58.jpg"},
{re:"亲亲",u:"http://fs0.139js.com/file/zfd58.jpg"},
{re:"汗",u:"http://fs0.139js.com/file/8fd58.jpg"},
{re:"晕",u:"http://fs0.139js.com/file/Zfd58.jpg"},
{re:"囧",u:"http://fs0.139js.com/file/Jfd58.jpg"},
{re:"衰",u:"http://fs0.139js.com/file/lfd58.jpg"},
{re:"鄙视",u:"http://fs0.139js.com/file/tPd58.jpg"},
{re:"抓狂",u:"http://fs0.139js.com/file/afd58.jpg"},
{re:"吐",u:"http://fs0.139js.com/file/Afd58.jpg"},
{re:"咒骂",u:"http://fs0.139js.com/file/Nfd58.jpg"},
{re:"羡慕",u:"http://fs0.139js.com/file/Ofd58.jpg"},
{re:"嫉妒",u:"http://fs0.139js.com/file/kfd58.jpg"},
{re:"恨",u:"http://fs0.139js.com/file/0fd58.jpg"},
{re:"v5",u:"http://fs0.139js.com/file/9Pd58.jpg"},
{re:"给力",u:"http://fs0.139js.com/file/rPd58.jpg"},
{re:"顶",u:"http://fs0.139js.com/file/ewd58.jpg"},
{re:"赞",u:"http://fs0.139js.com/file/vwd58.jpg"},
{re:"心",u:"http://fs0.139js.com/file/tYd58.jpg"},
{re:"花束",u:"http://fs0.139js.com/file/vYd58.jpg"},
{re:"示爱",u:"http://fs0.139js.com/file/JYd58.jpg"},
{re:"炸弹",u:"http://fs0.139js.com/file/Mwd58.jpg"},
{re:"寂寞",u:"http://fs0.139js.com/file/efd58.jpg"},
{re:"浮云",u:"http://fs0.139js.com/file/2Pd58.jpg"},
{re:"冷",u:"http://fs0.139js.com/file/jwd58.jpg"},
{re:"狂汗",u:"http://fs0.139js.com/file/7fd58.jpg"},
{re:"狂晕",u:"http://fs0.139js.com/file/jfd58.jpg"},
{re:"戒指",u:"http://fs0.139js.com/file/FYd58.jpg"},
{re:"黑丝带",u:"http://fs0.139js.com/file/aYd58.jpg"},
{re:"伤不起",u:"http://fs0.139js.com/file/2Yd58.jpg"},
{re:"党徽",u:"http://fs0.139js.com/file/EyBX8.jpg"},
{re:"90周年",u:"http://fs0.139js.com/file/cOBX8.jpg"},
{re:"龙舟",u:"http://fs0.139js.com/file/xSAt8.jpg"},
{re:"粽子",u:"http://fs0.139js.com/file/zqc98.jpg"},
{re:"棒棒糖",u:"http://fs0.139js.com/file/08o98.jpg"},
{re:"康乃馨",u:"http://fs0.139js.com/file/Odc58.jpg"},
{re:"喝茶",u:"http://fs0.139js.com/file/sSc58.jpg"},
{re:"鱼",u:"http://fs0.139js.com/file/xHd58.jpg"},
{re:"雨",u:"http://fs0.139js.com/file/uPd58.jpg"},
{re:"妇女节",u:"http://fs0.139js.com/file/CAd58.jpg"},
{re:"公主",u:"http://fs0.139js.com/file/RAd58.jpg"},
{re:"箭",u:"http://fs0.139js.com/file/yAd58.jpg"},
{re:"蛋糕",u:"http://fs0.139js.com/file/EYd58.jpg"},
{re:"囧囧",u:"http://fs0.139js.com/file/bwd58.jpg"},
{re:"回家",u:"http://fs0.139js.com/file/YAd58.jpg"},
{re:"票",u:"http://fs0.139js.com/file/AAd58.jpg"},
{re:"鞭炮",u:"http://fs0.139js.com/file/HAd58.jpg"},
{re:"福",u:"http://fs0.139js.com/file/qPd58.jpg"},
{re:"红包",u:"http://fs0.139js.com/file/hAd58.jpg"},
{re:"子弹飞",u:"http://fs0.139js.com/file/mfd58.jpg"},
{re:"灯",u:"http://fs0.139js.com/file/iYd58.jpg"},
{re:"元宵",u:"http://fs0.139js.com/file/cYd58.jpg"}]}

	

	for(var i=0;i<json.list.length;i++)
	{

		eval("var re=/(\\\["+ json.list[i].re +"\\\])/gi;");
		tmp = tmp.replace(re,"<img  alt=\""+json.list[i].re +"\"  title=\""+json.list[i].re +"\" src=\"" +json.list[i].u+ "\">") 
	}

	return tmp;
 }


//提示内容，fid，uid,发表内容,项目,资源
show_shareWb = function(note,fid,uid,con,ftype,id)
{

//var fid="";		//微博id
//var uid = "";	//说客id
//var content = "";	//内容
//var ftype="";	 //项目
//var id="";	//资源id

	var url = "/st10086/share139.html"
	url +='?ftype='+ ftype +'&id='+ id +'&content='+encodeURIComponent(con);

	if(note!="")
	{
		if (confirm(note))
		{
			window.open(url,"_blank")
		}
	}
	else
	{
		window.open(url,"_blank")
	}
   	return false;
}


/*
show_shareDiv = function(title,note,content)
{


var t = (title==""?'':title);
 
var arr = [];
arr.push('<div class="popWin win400" id="com_shareDiv">');
arr.push('  <div class="popWin-hd"><strong>'+ t +'</strong><a href="javascript:close_shareDiv();" class="btn-close"></a></div>');
arr.push('  <div class="popWin-bd">');
arr.push('  <p>'+ note +'</p>');
arr.push('<form action="" class="fm_share">');
arr.push('<p><label for=""><input type="checkbox" checked="checked" disabled="disabled"/><span>分享到移动微博</span></label><!--<label for=""><input type="checkbox" checked="checked"  /><span>分享到新浪微博</span></label>--></p>');
arr.push('<textarea name="" id="" class="txtArea-share">'+ content +'</textarea>');
arr.push('</form>  ');
arr.push('<p class="btn-box"><a href="javascript:shareDivWeiBo();" class="btn-1 size-2"><span> 确 认 </span></a></p>');
arr.push('  </div>');
arr.push('</div>');

var div=document.createElement("div");
  div.innerHTML=arr.join('');
  document.body.appendChild(div);
  function showMsgBox("com_shareDiv",400,279) ;


}

close_shareDiv()
{
	closeWindow("com_shareDiv");
}
*/

