﻿ jQuery!=null&&jQuery!=""?jQuery:$;

function subPl(t){//t zan wei yong
	var urlsub="/product/execmessage.do"; 
	var options = {	type: "POST",url: urlsub,data: jQuery("#messageForm").formToArray(),dataType: "html",success: function(data) {eval(data);
	if(status=="true"){
		jQuery("#tinfo2").show();jQuery("#tinfo").hide();
		jQuery('#plcount').html(parseInt(jQuery('#plcount').text())+1);
		jQuery("#messageForm").clearForm();
		window.main.location.reload();
	}else{jQuery("#tinfo2").show();jQuery("#tinfo").hide();}
	},
	error: function() {
		alert("操作失败,可能原因服务器忙,请稍后在试...");
		jQuery("#tinfo2").show();jQuery("#tinfo").hide();
	}
	};
	jQuery('#messageForm').ajaxSubmit(options);
}

//tou
function _subSubt(id,info,classType,jQNo){
jQuery(id).show();
jQuery(id).html("<div id=\"infos001\" style=\"position:absolute;background-color:#eeeeee; FILTER:alpha(opacity=80);z-index:1; width:0px; height:100%; text-align:center; visibility:hidden;\"><span style=\"border:2px solid #009933;color:#FF6600;position:relative; top:200px; left:10px; width:300px; height:50px; text-align:center; line-height:50px;backgroud:#33FF00;padding:10px 0 0 0;display:block; \"><img src=\"images/common/indicator.gif\" />"+info+"....</span></div>");
setTimeout(function(){
	if (jQuery(id).html().indexOf("数据提交中")!=-1||jQuery(id).html().indexOf(info)!=-1){
	jQuery(id).html("<img src=\"/pics/li_err.gif\" alt=\"loading\" width=\"16\" height=\"16\" align=\"absmiddle\" />&nbsp;&nbsp;<span style=\"color:#FF0000\">非常抱歉，服务器连接超时，请重新刷新页面！<a href=\"\" onclick=\"gotoP(window.location.toString(),1);return false;\">[立即刷新]</a>");	
	return false;
	}},300000);
}
function s(){document.all.infos001.style.width=document.body.clientWidth;document.all.infos001.style.zIndex=3; document.all.infos001.style.visibility="visible"; } 
function e(){ document.all.infos001.style.visibility="hidden"; }
//添加提交信息
function _subSub(id,info,classType,jQNo){
jQuery(id).show();
jQuery(id).html("<img src=\"/pics/loading.gif\" alt=\"loading\" width=\"16\" height=\"16\" align=\"absmiddle\" />&nbsp;&nbsp;"+info+"......");
setTimeout(function(){
	if (jQuery(id).html().indexOf("数据提交中")!=-1||jQuery(id).html().indexOf(info)!=-1){
	jQuery(id).html("<img src=\"/pics/li_err.gif\" alt=\"loading\" width=\"16\" height=\"16\" align=\"absmiddle\" />&nbsp;&nbsp;<span style=\"color:#FF0000\">非常抱歉，服务器连接超时，请重新刷新页面！<a href=\"\" onclick=\"gotoP(window.location.toString(),1);return false;\">[立即刷新]</a>");	
	return false;
	}},30000);
}

function _loadSub(id){
jQuery(id).show();
jQuery(id).html("<img src=\"/pics/loading.gif\" alt=\"loading\" width=\"16\" height=\"16\" align=\"absmiddle\" />&nbsp;&nbsp;数据加载中......");	
setTimeout(function(){
	if (jQuery(id).html().indexOf("数据加载中")!=-1){
	jQuery(id).html("<img src=\"/pics/li_err.gif\" alt=\"loading\" width=\"16\" height=\"16\" align=\"absmiddle\" />&nbsp;&nbsp;<span class=\"red\">非常抱歉，服务器连接超时，请重新刷新页面！<a href=\"#\" onclick=\"gotoP(window.location.toString(),1);return false;\">[立即刷新]</a>");	
	return false;
	}
},30000);
}

function gotoP(LocationUrl,type) {
   if(typeof type=="undefined")
   top.window.location.replace(LocationUrl);
   else
   self.window.location.replace(LocationUrl);
}
function gotoPcn(url){
  var turl=encodeURI(url);
  top.window.location.replace(turl);
}
//form post axjx submit  //subform id  flg 做其他
function submitform(formid,action,reurl,flg,c,infoid,infohtml,f){//
	var options = {
	type: "POST",
	url: action,
	data: jQuery(formid).formToArray(),
	dataType: "html",
	success: function(data) {
	eval(data);
	if(status=="true"){
		jQuery(formid).clearForm();
		if(reurl!=null&&reurl.length>0){gotoP(reurl,"0");}
		if(flg=="resave"){
			jQuery("#setcontent").html(c);$("#asknow").show();
			jQuery(infoid).html("<input class=\"tj_2\"  id=\"subask\" type=\"button\" value=\"提交回答\" style=\"color:#b2cfe7;\" title=\"您已经参与了回答\" />");
		}
		if(flg=="reset"){jQuery(infoid).html(infohtml);
			if(infoid=="#subinfobu"){jQuery("#tmpbu").html(""+c);jQuery("#tmpbu").show();jQuery("#buspan").fadeOut(500);}
			if(infoid=="#subinfoxuan"){jQuery("#askScore1").html(parseInt(f)+parseInt(c));jQuery("#xuanspan").fadeOut(500)}
			if(infoid=="#subinfoclose"){jQuery("#closespan").fadeOut(500);}
		}
	}else{
		if(flg=="save"){$("#subinfo2").hide();$("#subinfo").show();}
		if(flg=="resave"){
		jQuery(infoid).html("<input class=\"tj_2\"  id=\"subask\" type=\"button\" value=\"提交回答\" style=\"color:#b2cfe7\"  title=\"您已经参与了回答\"/>");
		}
		if(flg=="reset"){
			jQuery(infoid).html(infohtml);
			if(infoid=="#subinfobu"){jQuery("#buspan").hide();}
			if(infoid=="#subinfoxuan"){jQuery("#xuanspan").hide()}
			if(infoid=="#subinfoclose"){jQuery("#closespan").hide();}
		}
	}
	},
	error: function() {
		alert("操作失败,可能原因服务器忙,请稍后在试...");
	}
	};
	jQuery(formid).ajaxSubmit(options);
}
//采纳问题
function subAllc(strurl,fid,sid,u,ru){
	 if($.trim($("#reokinfo").val()).length==0){
	  alert("还是对最佳答案评论一下吧!");
	  return false;
	  }
	  _subSub("#pzj","数据提交中");
		$.ajax({type: "POST",url: strurl,  
			data: "askQuestionVO.id="+fid+"&sid="+sid+"&subtype=04&askQuestionVO.userid="+u+"&okreinfo="+$("#reokinfo").val()+"&ruid="+ru, 
			success: function(msg){ 
				eval(msg);
				if(status=="true"){gotoP(window.location.toString(),"0")}else{}
				},
			error: function(){
			alert("操作失败"); } 
			}); 
		return false;
	}
	//支持最佳
	function reok(strurl,sid){
 		$.ajax({type: "POST",url: strurl,data: "sid="+sid, 
			success: function(msg){ 
			eval(msg);
			if(status=="true"){
			var s=parseInt(jQuery("#second").html())+1;	
		 jQuery("#oksecond").html("<a title=\"您已参与支持,谢谢!\">　　谢谢参与<u>(<b id=\"second\">"+s+"</b>)</u></a>");
			}else{}},error: function(){alert("操作失败,服务器忙"); } }); 
		return false;
	}
