/*
 *  Shanghai  Zhiwen Software Co,LTD.
 *  上海智问软件技术有限公司
 */
var INPUT_AREA_TEXT_ID = "inputBox";
var REPLY_AREA_ID = "displayPanel";
var JQUERY_REPLY_AREA_ID = "#displayPanel";
var COMPANY_ID = "companyId";
var COMPANY_CODE = "companyCode";
var COMPANY_NICK_NAME= "companyNickName";
var CLIENT_UID = "client_uid";
var CLIENT_USER_NAME = "client_user_name";
var ie = (navigator.appVersion.indexOf("MSIE")!=-1);//IE
var ff = (navigator.userAgent.indexOf("Firefox")!=-1);//Firefox
var SEND_BUTTON_ID="sendButton"
var ROBOT_PROMPT_MESSAGE = "对方正在输入消息";
var DELAY_TIME_POLLY_MESSAGE=1000
var DIV_JUANLIAN_A=0;
var DIV_JUANLIAN_B=1;
var TAB_INTERVAL_CHANGE;
/////////////////////////////////////
function qsupportGetValue(name)
{
	return	document.forms[0].elements[name].value;
}
function qsupportSetValue(name,value)
{
	return	document.forms[0].elements[name].value = value;
}
function composeQsupportInfo()
{
	var argObj = new QsupportInfo();
	argObj.setCompanyId(qsupportGetValue(COMPANY_ID));
	argObj.setCompanyCode(qsupportGetValue(COMPANY_CODE));
	argObj.set("context_id",qsupportGetValue("context_id"));
	argObj.set("FaqType",qsupportGetValue("FaqType"));
	argObj.set("EventCode",qsupportGetValue("EventCode"));
	argObj.set("context_product_id",qsupportGetValue("context_product_id"));
	argObj.set("context_name",qsupportGetValue("context_name"));
	argObj.set("context_type",qsupportGetValue("context_type"));
	argObj.set("context_levelcode",qsupportGetValue("context_levelcode"));
	argObj.set("page_id",qsupportGetValue("page_id"));
	argObj.set("isMonitor",  qsupportGetValue("isMonitor"));
	argObj.set("pic_url",qsupportGetValue("pic_url"));
	argObj.set(COMPANY_NICK_NAME,qsupportGetValue(COMPANY_NICK_NAME));
	return argObj;
}

function addInputStyleToInfo(argObj) {
	argObj.set("font-family",qsupportGetValue("font-family"));
	argObj.set("font-weight",qsupportGetValue("font-weight"));
	argObj.set("font-size",qsupportGetValue("font-size"));
	argObj.set("font-style",qsupportGetValue("font-style"));
	argObj.set("color",qsupportGetValue("color"));
	argObj.set("text-decoration",qsupportGetValue("text-decoration"));
	return argObj;
}
///////////////////////////////////

var UIConfig = {
	defaultReplyHeight : 100
}
//var timeInterval;
var divBackground=["white","#F5F5F5"]; 
var divBackgroundIndex = -1;

var inputPannel = 0; //0:text 1:html
var loading = 0; //0:not loading 1:loading
var feaching = 0;//0:not feaching 1:feaching

var qsupport = new Qsupport();

var targetType = 0; //0:pannel 1:user message box

if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){
  HTMLElement.prototype.insertAdjacentElement = function(where, parsedNode) {
		switch (where) {
			case 'beforeBegin' :
				this.parentNode.insertBefore(parsedNode, this)
				break;
			case 'afterBegin' :
				this.insertBefore(parsedNode, this.firstChild);
				break;
			case 'beforeEnd' :
				this.appendChild(parsedNode);
				break;
			case 'afterEnd' :
				if (this.nextSibling)
					this.parentNode.insertBefore(parsedNode, this.nextSibling);
				else
					this.parentNode.appendChild(parsedNode);
				break;
		}
	}
	HTMLElement.prototype.insertAdjacentHTML = function(where, htmlStr) {
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where, parsedHTML)
	}
	HTMLElement.prototype.insertAdjacentText = function(where, txtStr) {
		var parsedText = document.createTextNode(txtStr)
		this.insertAdjacentElement(where, parsedText)
	}
};
function Qsupport(form) {
	this.form = form;
	this.fetching = false;	//use to indentify the data is fetching
	this.processing = false;// use to indentify customer service is typing or deal with the message
	this.checkingMessageBox = false;
	this.sendToMessageBox = false;
	var self = this;
	//this.uiController = new UIController();
}
function UIController() {

}

Qsupport.prototype.replyMessage = function(message) {
	if (loading == 1) {
		return;
	}
	loading = 1;
    var argObj = composeQsupportInfo();
    argObj.setMessage(message);
	this.showInput(argObj);

}

Qsupport.prototype.showInput = function(argObj) {
	var ui = new JQueryUIController();
	var service = new qsupportAjaxService();
	var instance = this;
	addInputStyleToInfo(argObj);
	
	service.setAction("webRobotAjaxAction");
	service.setMethod("showInput");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{
				ui.showMessageInReply(reQsupportInfo);
				instance.showReply(argObj);
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
	
	 			loading = 0;
	 			ui.unBlockInputPannel("");
	 			ui.focusInput();
	 		}
	});
}

Qsupport.prototype.showReply = function(argObj) {
	var ui = new JQueryUIController();
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("replyMessage");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{  
		 ui.writeToDispalyPanel(reQsupportInfo);
		 loading = 0;
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{

	 			loading = 0;
	 			ui.unBlockInputPannel("");
	 			ui.focusInput();
	 		}
	});
}

Qsupport.prototype.greeting = function() {

	var cmd = {command: "hello"};
	var argObj = composeQsupportInfo();
	argObj.setMessage(JSON.stringify(cmd));
	argObj.setUseage('1');
	var instance=this;
	var askContent=qsupportGetValue("askContent");
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("greeting");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{  
		
		       qsupportSetValue(COMPANY_NICK_NAME,reQsupportInfo.get(COMPANY_NICK_NAME));
		       $("#company_nick_nameTD").html(reQsupportInfo.get(COMPANY_NICK_NAME));
		       var relationRobotPageInfo=reQsupportInfo.get("relationRobotPageInfo");
		       var relationRobotPageInfoObject;
		       if(relationRobotPageInfo != null && relationRobotPageInfo != undefined && relationRobotPageInfo != ""){
		    	   relationRobotPageInfoObject = eval('('+relationRobotPageInfo+')');
		    	   if(relationRobotPageInfoObject != null && relationRobotPageInfoObject != undefined){
		    		     if(relationRobotPageInfoObject.status_desc != null && relationRobotPageInfoObject.status_desc != undefined && relationRobotPageInfoObject.status_desc !=""){
		    		    	 $("#company_cust_supportTD").html(relationRobotPageInfoObject.status_desc);
		    		     }else{
		    		    	 $("#company_cust_supportTD").html(reQsupportInfo.get("statusDesc"));
		    		     }
		    	   }else{
		    		    $("#company_cust_supportTD").html(reQsupportInfo.get("statusDesc"));
		    	   }
		    	}else{
		    	   	$("#company_cust_supportTD").html(reQsupportInfo.get("statusDesc"));
		       }
				new JQueryUIController().showMessageInReply(reQsupportInfo);
				
				uiController.unBlockInputPannel($("#focusInputBoxContent").val());
                $("#inputBox").css({
					     "color":"#666666"
				 });
				var relationImages=reQsupportInfo.get("relationImages");
	            if(relationImages!=null&&relationImages!=""){
					var relationImagesObject=eval('('+relationImages+')');
				    if(relationImagesObject.length>=1){
				    	 
					       $("#relationPlantMapImage").attr("src",contextPath+relationImagesObject[0].picFileName);
				           instance.showImageManager(relationImagesObject[0].id);
				         
				       }
                    xthtagWidget.setPicUrlInfo(relationImages);
				 }
				xthtagWidget.preloadImages();
				var topFaq = eval( "("+ reQsupportInfo.get("TopFaq") +")" );
				instance.showTopFaq(topFaq,relationRobotPageInfoObject,reQsupportInfo.get("relationRobotFaqType"));
				if(askContent != undefined && askContent!= null && askContent != ""){
					askContent = toDBC(Trim(askContent));//全角半角转换
					instance.replyMessage(askContent);
				}
	     },
	 	onFailure:
	 		function(xml,eType,e)
	 		{
				uiController.unBlockInputPannel("");
	 		}
	});

}
Qsupport.prototype.greetingSpace=function(){
	
	var cmd = {command: "hello"};
	var argObj = composeQsupportInfo();
	argObj.setMessage(JSON.stringify(cmd));
	argObj.setUseage('1');
	var askContent=qsupportGetValue("askContent");
	var instance=this;
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("greeting");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{  
		        
		    	qsupportSetValue(COMPANY_NICK_NAME,reQsupportInfo.get(COMPANY_NICK_NAME));
				$("#company_nick_nameTD").html(reQsupportInfo.get(COMPANY_NICK_NAME));
				var relationRobotPageInfo=reQsupportInfo.get("relationRobotPageInfo");
			       var relationRobotPageInfoObject;
			       if(relationRobotPageInfo != null && relationRobotPageInfo != undefined && relationRobotPageInfo != ""){
			    	   relationRobotPageInfoObject = eval('('+relationRobotPageInfo+')');
			    	   if(relationRobotPageInfoObject != null && relationRobotPageInfoObject != undefined){
			    		     if(relationRobotPageInfoObject.status_desc != null && relationRobotPageInfoObject.status_desc != undefined && relationRobotPageInfoObject.status_desc !=""){
			    		    	 $("#company_cust_supportTD").html(relationRobotPageInfoObject.status_desc);
			    		     }else{
			    		    	 $("#company_cust_supportTD").html(reQsupportInfo.get("statusDesc"));
			    		     }
			    		     if(relationRobotPageInfoObject.tab_url != null && relationRobotPageInfoObject.tab_url != undefined && relationRobotPageInfoObject.tab_url !=""){
			    		    	 document.getElementById("right_h").src=relationRobotPageInfoObject.tab_url;
			    		     }else{
			    		    	 document.getElementById("right_h").src=reQsupportInfo.get("mainWebSite");
			    		     }
			    	   }else{
			    		    document.getElementById("right_h").src=reQsupportInfo.get("mainWebSite");
			    		    $("#company_cust_supportTD").html(reQsupportInfo.get("statusDesc"));
			    	   }
			    	}else{
			    		document.getElementById("right_h").src=reQsupportInfo.get("mainWebSite");
			    	   	$("#company_cust_supportTD").html(reQsupportInfo.get("statusDesc"));
			       }
				new JQueryUIController().showMessageInReply(reQsupportInfo);
			    uiController.unBlockInputPannel($("#focusInputBoxContent").val());
				$("#inputBox").css({
					     "color":"#666666"
				 });
				xthtagWidget.preloadImages();
				if(reQsupportInfo.get("TopFaq") != undefined && reQsupportInfo.get("TopFaq") !=null && reQsupportInfo.get("TopFaq") != ""){
			    	var topFaq = eval( "("+ reQsupportInfo.get("TopFaq") +")" );
			    	if(topFaq.length > 0){
				       instance.showTopFaq(topFaq,relationRobotPageInfoObject,reQsupportInfo.get("relationRobotFaqType"));
			    	}
				}
				if(askContent !=undefined && askContent!= null && askContent != ""){
					askContent = toDBC(Trim(askContent));//全角半角转换
					instance.replyMessage(askContent);
				}
				if(qsupportGetValue(COMPANY_ID) != 4){
					TAB_INTERVAL_CHANGE=  setInterval(function(){
		            	
		                     if(document.getElementById("monitordiv0").style.display=="block"){
		                          
		                    	     changeTab2(1);
		                         }else{
		                        	 
		                        	 changeTab2(0);
		                         }
		               },10000);
	    		
				}
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
				uiController.unBlockInputPannel("");
	 		}
	});
	
}
Qsupport.prototype.greetingSpace2=function(){
	
	var cmd = {command: "hello"};
	var argObj = composeQsupportInfo();
	argObj.setMessage(JSON.stringify(cmd));
	argObj.setUseage('1');
	var askContent=qsupportGetValue("askContent");
	var instance=this;
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("greeting");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{  
		       
		    	qsupportSetValue(COMPANY_NICK_NAME,reQsupportInfo.get(COMPANY_NICK_NAME));
				$("#company_nick_nameTD").html(reQsupportInfo.get(COMPANY_NICK_NAME));
				var relationRobotPageInfo=reQsupportInfo.get("relationRobotPageInfo");
			       var relationRobotPageInfoObject;
			       if(relationRobotPageInfo != null && relationRobotPageInfo != undefined && relationRobotPageInfo != ""){
			    	   relationRobotPageInfoObject = eval('('+relationRobotPageInfo+')');
			    	   if(relationRobotPageInfoObject != null && relationRobotPageInfoObject != undefined){
			    		     if(relationRobotPageInfoObject.status_desc != null && relationRobotPageInfoObject.status_desc != undefined && relationRobotPageInfoObject.status_desc !=""){
			    		    	 $("#company_cust_supportTD").html(relationRobotPageInfoObject.status_desc);
			    		     }else{
			    		    	 $("#company_cust_supportTD").html(reQsupportInfo.get("statusDesc"));
			    		     }
			    		     if(relationRobotPageInfoObject.tab_url != null && relationRobotPageInfoObject.tab_url != undefined && relationRobotPageInfoObject.tab_url !=""){
			    		    	 document.getElementById("right_h").src=relationRobotPageInfoObject.tab_url;
			    		     }else{
			    		    	 document.getElementById("right_h").src=reQsupportInfo.get("mainWebSite");
			    		     }
			    	   }else{
			    		    $("#company_cust_supportTD").html(reQsupportInfo.get("statusDesc"));
			    		    document.getElementById("right_h").src=reQsupportInfo.get("mainWebSite");
			    	   }
			    	}else{
			    	   	$("#company_cust_supportTD").html(reQsupportInfo.get("statusDesc"));
			    	   	document.getElementById("right_h").src=reQsupportInfo.get("mainWebSite");
			       }
				new JQueryUIController().showMessageInReply(reQsupportInfo);
			    uiController.unBlockInputPannel($("#focusInputBoxContent").val());
				$("#inputBox").css({
					     "color":"#666666"
				 });
				xthtagWidget.preloadImages();
				if(reQsupportInfo.get("TopFaq") != undefined && reQsupportInfo.get("TopFaq") !=null && reQsupportInfo.get("TopFaq") != ""){
			    	var topFaq = eval( "("+ reQsupportInfo.get("TopFaq") +")" );
			    	if(topFaq.length > 0){
				       instance.showTopFaq(topFaq,relationRobotPageInfoObject,reQsupportInfo.get("relationRobotFaqType"));
			    	}
				}
				if(askContent !=undefined && askContent!= null && askContent != ""){
					askContent = toDBC(Trim(askContent));//全角半角转换
					instance.replyMessage(askContent);
				}
				
				
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
				uiController.unBlockInputPannel("");
	 		}
	});
	
}
Qsupport.prototype.showImageManager=function(id){
	var argObj=composeQsupportInfo();
    argObj.set("pic_id",id);
    var service = new qsupportAjaxService();
	  service.setAction("webRobotAjaxAction");
	  service.setMethod("popImageManager");
	  service.service(argObj,{
		  
		  onSuccess:
			  function(reQsupportInfo){
		        var picMapList=reQsupportInfo.get("picMapList");
		     
		        var areaHtml="";
		        //var  offset=xthtagWidget.getOffset(document.getElementById("relationPlantMapImage"));
			    var  offset=$("#containTDx").offset();
		        var isIe6=false;
		        if(navigator.appName == "Microsoft Internet Explorer"){
	        	    if(navigator.appVersion.match(/6./i)=="6."){
	        	    	 
	        	    	 isIe6=true;
	        	     }
	        	}
		      if(picMapList!=undefined&&picMapList!=null&&picMapList!=""){
		        	   var picMapObject=eval('('+picMapList+')');
		        	   var consoleHeight=parseInt($("#consolePicHeight").val(),10);
			           var consoleWidth=parseInt($("#consolePicWidth").val(),10);
			           var bigHeight=parseInt($("#consolePicBigHeight").val(),10);
					   var bigWidth=parseInt($("#consolePicBigWidth").val(),10);
			          
		        	   for(var i=0;i<picMapObject.length;i++){
		        		  var coordsString=picMapObject[i].coords;
					       var coords=coordsString.split(","); 
					       var left=(parseInt(coords[0],10)*bigWidth)/consoleWidth;
					       var top=(parseInt(coords[1],10)*bigHeight)/consoleHeight;
					       var right=(parseInt(coords[2],10)*bigWidth)/consoleWidth;
					       var bottom=(parseInt(coords[3],10)*bigHeight)/consoleHeight;
					       var width=right-left;
					       var height=bottom-top;
					       coordsString=left+","+top+","+right+","+bottom;
					      
					      $("<div  onmouseout=\"xthtagWidget.mouseOutClass('"+picMapObject[i].id+"');\" style=\"cursor:pointer\"  title=\""+picMapObject[i].remark+"\"  onclick=\"xthtagWidget.listRelationFaq('"+picMapObject[i].faq_id+"','"+picMapObject[i].title+"','"+picMapObject[i].id+"');\" onmouseover=\"xthtagWidget.mouseOverClass('"+picMapObject[i].id+"','"+picMapObject[i].title+"');\"></div>")
       	                     .attr("id","area_big_image_show_"+picMapObject[i].id)
       	                     //.appendTo("body")
       	                     .appendTo("#monitordivx10")
       	                     .css({"display":"",
       	                	     "top":(top+offset.top-((ff)?0:1))+"px",
       	                	     "left":(left+offset.left+((ff)?0:1))+"px",
       	                	     "width":(width+4)+"px",
       	                	      "height":(height+4)+"px",
       	                	     "z-index":"18",
       	                	    "position":"absolute"});
					    
				           if(isIe6==true){
				        	   $("#area_big_image_show_"+picMapObject[i].id).addClass("area_pic_IE6_div");
				           }else{
				        	   
				        	   $("#area_big_image_show_"+picMapObject[i].id).addClass("area_pic_div");
				        	   
				           }
		        	   }
				       xthtagWidget._setPicMapObject(picMapList);
				     
		                     $("#hand_Point_Div").css({
		                    	 "left":parseInt($("#containTDx").offset().left)+$("#containTDx").width()/2,
		                    	 "top":parseInt($("#containTDx").offset().top)+$("#containTDx").height()/2,
		                    	 "visibility":"visible"
		                       });
		                     setTimeout(function(){
		                    	   $("#hand_Point_Div").css("visibility","hidden");
		                     },7000);
				       }
		        
	       },
	       onFailure:
		 		function(xml,eType,e)
		 		{
		 		}
		  
	  });
	
	
}
Qsupport.prototype.showImageManagerClose=function(id){
	  
    var argObj=composeQsupportInfo();
    argObj.set("pic_id",id);
    var service = new qsupportAjaxService();
	  service.setAction("webRobotAjaxAction");
	  service.setMethod("popImageManager");
	  service.service(argObj,{
		  
		  onSuccess:
			  function(reQsupportInfo){
		        var picMapList=reQsupportInfo.get("picMapList");
		        xthtagWidget._setPicMapObject(picMapList);
		    },
	       onFailure:
		 		function(xml,eType,e)
		 		{
		 		}
		  
	  });
	
	
}
Qsupport.prototype.showAnnouncement=function(){
	
	var argObj = composeQsupportInfo();
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("getAnnouncementList");
	service.service(argObj,{
		onSuccess:
			function(reQsupportInfo)
			{ 
		       var announcement=reQsupportInfo.get("announcementList");
				
		       if(announcement!=undefined&&announcement!=null&&announcement!=""){
		    	   var announcementObject=eval('('+announcement+')');
		    	   var announceHtml="";
		    	   for(var i=0;i<announcementObject.length;i++){
		    		   if(announcementObject[i].is_url=="0"){
		    		  
		    			   announceHtml+="<div class=\"txt12 txt_white line_height3\"><span class=\"blue2\">【"+announcementObject[i].announce_type+"】</span>";  
		    			   announceHtml+=""+announcementObject[i].title+"<br/>&nbsp;&nbsp;&nbsp;";

		    			   var  content=announcementObject[i].content;
		    		
		    			   if(content!=""){
		    				   
		    				  if(ie){
				    			   if(content.length>55){
					    				   if(content.length>110){
					    					   content=content.substring(0,98);
					    					  
					    				   }
				    				   announceHtml+=content.substring(0,55)+"<br/>&nbsp;&nbsp;&nbsp;";
				    				   announceHtml+=content.substring(55,content.length);
				    				   announceHtml+=".....";
				    				   
				    				   
				    			   }else{
				    				   
				    				   announceHtml+=announcementObject[i].content+"<br/>&nbsp;&nbsp;&nbsp;";
				    				 
				    			   }
		    				     }else{
		    			    	  if(content.length>27){
				    				   if(content.length>60){
				    					   content=content.substring(0,54);
				    					  
				    				   }
			    				   announceHtml+=content.substring(0,27)+"<br/>&nbsp;&nbsp;&nbsp;";
			    				   announceHtml+=content.substring(27,content.length);
			    				   announceHtml+=".....";
			    				   
			    				   
				    			   }else{
				    				   
				    				   announceHtml+=announcementObject[i].content+"<br/>&nbsp;&nbsp;&nbsp;";
				    				 
				    			   }
		    			    	  
		    			    	  
		    			      }
		    			   }else{
		    				   announceHtml+="<br/>&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;   ";
		    				   
		    			   }
		    			   
		      	
		    			   announceHtml+="</div>";
		    			 
		    		   }else if(announcementObject[i].is_url=="1"){
		    			   announceHtml+="<div class=\"txt12 txt_white line_height3\"><span class=\"blue2\">【"+announcementObject[i].announce_type+"】</span>";
		    			   announceHtml+="<a href=\""+announcementObject[i].url+"\" target=\"_blank\">"+announcementObject[i].title+"</a><br/>&nbsp;&nbsp;&nbsp;"
		    			   var  content=announcementObject[i].content;
		    			   if(content!=""){
		    				   	   announceHtml+="<a href=\""+announcementObject[i].url+"\" target=\"_blank\">";
		    				   	  if(ie){
					    			   if(content.length>55){
							    				   if(content.length>106){
							    					   content=content.substring(0,98)+"......";
							    				   }
							    				   
							    				   announceHtml=announceHtml+content.substring(0,55)+"<br/>&nbsp;&nbsp;&nbsp;";
							    				   announceHtml=announceHtml+content.substring(55,content.length);
							    				   announceHtml=announceHtml+"</a>"
							    					 
					    				   
					    				   
					    			   }else{
					    				   
					    				     announceHtml+=announcementObject[i].content+"</a><br/>&nbsp;&nbsp;&nbsp;";
					    				  
					    			   }
		    				   	  }else{
		    				   		 if(content.length>27){
					    				   if(content.length>60){
					    					   content=content.substring(0,54);
					    					  
					    				   }
				    				   announceHtml+=content.substring(0,27)+"<br/>&nbsp;&nbsp;&nbsp;";
				    				   announceHtml+=content.substring(27,content.length);
				    				   announceHtml+=".....";
				    				   
				    				   
					    			   }else{
					    				   
					    				   announceHtml+=announcementObject[i].content+"<br/>&nbsp;&nbsp;&nbsp;";
					    				 
					    			   }
			    			    	  
		    				   		   
		    				   	   }
		    			   }else{
		    				   
		    				   announceHtml+="<br/>&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;";
		    				   
		    			   }

		    			   announceHtml+="</div>";
		    		   }
		    		   
		    	   }
		    	   $("#scrollAnnouncementDiv").html(announceHtml);
		    	   $('#scrollAnnouncementDiv').jdNewsScroll();
		       }
				
			},
		
		
		onFailure:
	 		function(xml,eType,e)
	 		{
				uiController.unBlockInputPannel("announcementList");
	 		}
		
	});
	
	
}

Qsupport.prototype.showTopFaq=function(topFaq,relationRobotPageInfoObject,faq_type){
	 var hotTopicsHtml = "<table border='0' class='TopFaqTable'>";
	//greeting中显示前三条FAQ
	 var topThreeFaqHtml="<div class='hot_bg'><b>热点问题：</b></div>";
	 topThreeFaqHtml+="<div style='padding-left:15px;width:100%;'>";
	 topThreeFaqHtml+="<table  width=\"100%\" border=\"0\" style=\"border-collapse: collapse;\">";
	 
	 var topfaqFlag = "TopFaq";
	 var topThreeFaqFlag="TopThreeFaq";
	 var flag=true;
	 var topThreeMiddleResult="";
	 var faqTypeValue=(qsupportGetValue("FaqType") == null ||  qsupportGetValue("FaqType") == undefined || qsupportGetValue("FaqType") == "" );
	 
	 if(faqTypeValue){
		if(relationRobotPageInfoObject != null && relationRobotPageInfoObject != undefined){
			   if(relationRobotPageInfoObject.faq_type != null && relationRobotPageInfoObject.faq_type != undefined && relationRobotPageInfoObject.faq_type != ""){
			    	qsupportSetValue("FaqType",relationRobotPageInfoObject.faq_type);
			    	flag =false;
			    	faqTypeValue=false;
			   }
		 }
	 }
	 if(topFaq.length>10){
	     topFaq.length=10;
	 }
	 for(var i=0;i<topFaq.length;i++){  //greeting中显示前三条FAQ
		if(i<3 && flag){
			topThreeMiddleResult += "<tr><td class='topThreeFaqItemTD' id='topFaqThreeItemTD" + i + "'><table width=\"100%\" border=\"0\" style=\"border-collapse: collapse;\"><tr id='topFaqThreeTR" + i + "' class='topThreeFaqTRClass' ";
			if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
				topThreeMiddleResult += " onmouseover='qsupport.hoverTopFaq2(\"topFaqThreeTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\",\"topThreeFaqTD\")' onmouseout='qsupport.hoverEnd2(\"topFaqThreeTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\",\"topThreeFaqTD\")'";
			}else{
				topThreeMiddleResult += " onmouseover='qsupport.hoverTopFaq(\"topFaqThreeTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\",\"topThreeFaqTD\")' onmouseout='qsupport.hoverEnd(\"topFaqThreeTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\",\"topThreeFaqTD\")'";
			}
			topThreeMiddleResult += " onclick=\"qsupport.selectHotTopic2('";
			topThreeMiddleResult += escape(topFaq[i].key);
			topThreeMiddleResult += "','"
			topThreeMiddleResult += topThreeFaqFlag+i;
			topThreeMiddleResult += "','"
			topThreeMiddleResult += topFaq[i].comment;
			topThreeMiddleResult += "','"
			topThreeMiddleResult += i;
			topThreeMiddleResult += "');\" >";
			topThreeMiddleResult += "<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class='xiala_tpic_td'> ";
			if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
				
				topThreeMiddleResult += "<img src='"+cacheImageArray[3].src+"' border='0' class='xiala_tpic' />"
			}else{
		
				topThreeMiddleResult += "<img src='"+cacheImageArray[3].src+"' class=\"topThreeFaqLineImageClass xiala_tpic\" border='0' id=\"topFaq_Three_line_image"+i+"\"/>"
			}
			topThreeMiddleResult += "";
			if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){

				topThreeMiddleResult += "</td><td align='left'><span class='xiala_title' id='topThreeFaqTD" + i + "' >"; 

				topThreeMiddleResult += "<a href='" + topFaq[i].comment + "' target='_blank' class='hotlink'>";
				topThreeMiddleResult += topFaq[i].key;
				topThreeMiddleResult += "</a>";
			}else{

				topThreeMiddleResult += "</td><td align='left'><span class='xiala_title' id='topThreeFaqTD" + i + "' "; 

				topThreeMiddleResult += ">";
				topThreeMiddleResult += topFaq[i].key;
				topThreeMiddleResult += "";
			}
			topThreeMiddleResult += "</span></td>";
			topThreeMiddleResult += "<td width='20' align='right'>";
			if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
				
			}else{
			
				topThreeMiddleResult += "<img src='"+cacheImageArray[2].src+"' class='topThreeFaqImgs' id='topThreeFaqImg" + i + "' border='0'/>"
			}
			topThreeMiddleResult += "</td>";
			topThreeMiddleResult += "</tr></table></td></tr>";
			topThreeMiddleResult += "<tr id='" + topThreeFaqFlag+i + "' class='TOPThreeFaqClass' >";
			topThreeMiddleResult += "<td><div class='topFaqContext2' style=\"color:black;\" >" + topFaq[i].text + "<br>";
			
			topThreeMiddleResult+="<span  id=\"statisy_content_top_Three_faq_"+i+"\" style=\"font-weight:bold;\">您对回答满意吗?&nbsp;&nbsp;";
			topThreeMiddleResult+="<span class=\"blue_iframe bb\">";
			topThreeMiddleResult+="<a href=\"javascript:void(0);\" class=\"statisfy_hand_yes\"  onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_Three_faq_"+i+"','1');\"></a>";
			topThreeMiddleResult+="&nbsp;&nbsp;<a href=\"javascript:void(0);\"  onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_Three_faq_"+i+"','1');\">顶，解决啦</a>";
			topThreeMiddleResult+="&nbsp;&nbsp;<a href=\"javascript:void(0);\"  class=\"statisfy_hand_no\"  onclick=\"xthtagWidget.noStatisfyUpdate('top_Three_faq_"+i+"');\"></a>";
			topThreeMiddleResult+="&nbsp;&nbsp;<a href=\"javascript:void(0);\"   onclick=\"xthtagWidget.noStatisfyUpdate('top_Three_faq_"+i+"');\">踩，不满意</a>";
			topThreeMiddleResult+="</span></span>";
			topThreeMiddleResult+="<span id=\"statisy_content_div_top_Three_faq_"+i+"\" style=\"display:none;\">";
			topThreeMiddleResult+="<span id=\"no_statisy_content_div_top_Three_faq_"+i+"\"><font style=\"font-weight:bold;text-decoration:underline;\">请选择不满意的原因，帮助小二进步</font><br/>";
			topThreeMiddleResult+="<input type=\"radio\" name=\"statisy_content_radiotop_Three_faq_"+i+"\" onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_Three_faq_"+i+"','0');\"/>答案对我没帮助";
			topThreeMiddleResult+="<input type=\"radio\" name=\"statisy_content_radiotop_Three_faq_"+i+"\" onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_Three_faq_"+i+"','2');\"/>功能有待改善";
			topThreeMiddleResult+="<span style=\"display:inline-block;\">";
			topThreeMiddleResult+="<input type=\"radio\" name=\"statisy_content_radiotop_Three_faq_"+i+"\" onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_Three_faq_"+i+"','3');\"/>太复杂，不想看";
			topThreeMiddleResult+="<input type=\"radio\" name=\"statisy_content_radiotop_Three_faq_"+i+"\" onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_Three_faq_"+i+"','4');\"/>不是我想问的";
			topThreeMiddleResult+="</span></span></span>";
			topThreeMiddleResult+="</div></td></tr>";
			topThreeMiddleResult += "</table></td></tr>"
		}
		//greeting中显示前三条FAQ
		hotTopicsHtml += "<tr><td class='topFaqItemTD' id='topFaqItemTD" + i + "'><table class='topFaqItemTable'><tr id='topFaqTR" + i + "' class='topFaqTRClass' ";
		if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
			hotTopicsHtml += " onmouseover='qsupport.hoverTopFaq2(\"topFaqTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\",\"topFaqTD\")' onmouseout='qsupport.hoverEnd2(\"topFaqTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\",\"topFaqTD\")'";
		}else{
			hotTopicsHtml += " onmouseover='qsupport.hoverTopFaq(\"topFaqTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\",\"topFaqTD\")' onmouseout='qsupport.hoverEnd(\"topFaqTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\",\"topFaqTD\")'";
		}
		hotTopicsHtml += " onclick=\"qsupport.selectHotTopic('";
		hotTopicsHtml += escape(topFaq[i].key);
		hotTopicsHtml += "','"
		hotTopicsHtml += topfaqFlag+i;
		hotTopicsHtml += "','"
		hotTopicsHtml += topFaq[i].comment;
		hotTopicsHtml += "','"
		hotTopicsHtml += i;
		hotTopicsHtml += "');\" >";

		hotTopicsHtml += "<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class='xiala_tpic_td'> ";
		if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
			
			hotTopicsHtml += "<img src='"+cacheImageArray[3].src+"' border='0' class='xiala_tpic' />"
		}else{
	
			hotTopicsHtml += "<img src='"+cacheImageArray[3].src+"' class=\"topFaqLineImageClass xiala_tpic\" border='0' id=\"topFaq_line_image"+i+"\"/>"
		}
		hotTopicsHtml += "";

		if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
			hotTopicsHtml += "</td><td align='left'><span class='xiala_title'  id='topFaqTD" + i + "' >"; 
			hotTopicsHtml += "<a href='" + topFaq[i].comment + "' target='_blank' class='hotlink'>";
			hotTopicsHtml += topFaq[i].key;
			hotTopicsHtml += "</a>";
		}else{
			hotTopicsHtml += "</td><td align='left'><span class='xiala_title'  id='topFaqTD" + i + "' "; 
			hotTopicsHtml += ">";
			hotTopicsHtml += topFaq[i].key;
		}
		
		hotTopicsHtml += "</span></td>";
		hotTopicsHtml += "<td width='20' align='right'>";
		if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
			
		}else{
		
			hotTopicsHtml += "<img src='"+cacheImageArray[2].src+"' class='topFaqImgs' id='topFaqImg" + i + "' border='0'/>"
		}
		hotTopicsHtml += "</td>";
		hotTopicsHtml += "</tr></table></td></tr>";
		hotTopicsHtml += "<tr id='" + topfaqFlag+i + "' class='TOPFaqClass' >";
		hotTopicsHtml += "<td colSpan=\"3\" style='padding:0px;margin:0px;'><div class='topFaqContext'>" + topFaq[i].text + "<br>";
	   
	    hotTopicsHtml+="<span  id=\"statisy_content_top_faq_"+i+"\" style=\"font-weight:bold;\">您对回答满意吗?&nbsp;&nbsp;";
	    hotTopicsHtml+="<span class=\"blue_iframe bb\">";
	    hotTopicsHtml+="<a href=\"javascript:void(0);\" class=\"statisfy_hand_yes\"  onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_faq_"+i+"','1');\"></a>";
	    hotTopicsHtml+="&nbsp;&nbsp;<a href=\"javascript:void(0);\"   onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_faq_"+i+"','1');\">顶，解决啦</a>";
	    hotTopicsHtml+="&nbsp;&nbsp;<a href=\"javascript:void(0);\" class=\"statisfy_hand_no\"  onclick=\"xthtagWidget.noStatisfyUpdate('top_faq_"+i+"');\"></a>";
	    hotTopicsHtml+="&nbsp;&nbsp;<a href=\"javascript:void(0);\" onclick=\"xthtagWidget.noStatisfyUpdate('top_faq_"+i+"');\">踩，不满意</a>";
	    hotTopicsHtml+="</span></span>";
	    hotTopicsHtml+="<span id=\"statisy_content_div_top_faq_"+i+"\" style=\"display:none;\">";
	    hotTopicsHtml+="<span id=\"no_statisy_content_div_top_faq_"+i+"\"><font style=\"font-weight:bold;text-decoration:underline;\">请选择不满意的原因，帮助小二进步</font><br/>";
	    hotTopicsHtml+="<input type=\"radio\" name=\"statisy_content_radiotop_faq_"+i+"\" onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_faq_"+i+"','0');\"/>答案对我没帮助";
	    hotTopicsHtml+="<input type=\"radio\" name=\"statisy_content_radiotop_faq_"+i+"\" onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_faq_"+i+"','2');\"/>功能有待改善";
	    hotTopicsHtml+="<span style=\"display:inline-block;\">";
	    hotTopicsHtml+="<input type=\"radio\" name=\"statisy_content_radiotop_faq_"+i+"\" onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_faq_"+i+"','3');\"/>太复杂，不想看";
	    hotTopicsHtml+="<input type=\"radio\" name=\"statisy_content_radiotop_faq_"+i+"\" onclick=\"xthtagWidget.statisfyUpdateOther('"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].key)+"','"+encodeURIComponent(topFaq[i].text)+"','top_faq_"+i+"','4');\"/>不是我想问的";
	    hotTopicsHtml+="</span></span></span>";
	    hotTopicsHtml+="</div></td></tr>";
		hotTopicsHtml += "</table></td></tr>"
	}
	hotTopicsHtml += "</table>";
	topThreeFaqHtml +=topThreeMiddleResult;
	topThreeFaqHtml += "</table></div>";
	if(topFaq.length > 0){
		if(qsupportGetValue(COMPANY_ID) != 4){
			$("#td0").html(hotTopicsHtml);
			if(faqTypeValue){
		      $(JQUERY_REPLY_AREA_ID).append(topThreeFaqHtml);
			}
		}
	}
	
}
/*
Qsupport.prototype.fetchLastFaq = function() {
	var cmd = {command: "hello"};
	var argObj = composeQsupportInfo();
	argObj.setMessage(JSON.stringify(cmd));
	argObj.setUseage('1');
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("lastFaqInfo");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{
		       
		        if(reQsupportInfo.get("LastFaq") != null &&reQsupportInfo.get("LastFaq")!=""){
		        	var hotTopicsHtml = "<table  border='0' style=\"width:100%;\">";
		        	var topFaq = eval( "("+ reQsupportInfo.get("LastFaq") +")" );
		        	var topfaqFlag = "LastFaq";
		        	if(topFaq.length>0){
						for(var i=0;i<topFaq.length;i++)
						{
							if(topFaq[i] == null){
								continue;
							}
							hotTopicsHtml += "<tr><td class='lastFaqItemTD' id='lastFaqItemTD" + i + "'><table class='lastFaqItemTable'><tr id='lastFaqTR" + i + "' class='lastFaqTRClass' ";
							if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
								hotTopicsHtml += " onmouseover='qsupport.hoverLastFaq2(\"lastFaqTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\")' onmouseout='qsupport.hoverLastEnd2(\"lastFaqTR" + i + "\")'";
							}else{
								hotTopicsHtml += " onmouseover='qsupport.hoverLastFaq(\"lastFaqTR" + i + "\", \"" + topFaq[i].comment +"\", \"" + i +"\")' onmouseout='qsupport.hoverLastEnd(\"lastFaqTR" + i + "\")'";
							}
							hotTopicsHtml += " onclick=\"qsupport.selectLastTopic('";
							hotTopicsHtml += escape(topFaq[i].key);
							hotTopicsHtml += "','"
							hotTopicsHtml += topfaqFlag+i;
							hotTopicsHtml += "','"
							hotTopicsHtml += topFaq[i].comment;
							hotTopicsHtml += "','"
							hotTopicsHtml += i;
							hotTopicsHtml += "');\" ";
							hotTopicsHtml += ">";
							hotTopicsHtml += "<td style='width:40px;'  align='right' class='lastFaqTitleImg'>";
							if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
								hotTopicsHtml += "<image src='"+cacheImageArray[3].src+"' border='0'/>"
							}else{
								hotTopicsHtml += "<image src='"+cacheImageArray[3].src+"' id=\"fetch_last_faq_img"+i+"\" class=\"fetchLastFaqClass\" border='0'/>"
							}
							hotTopicsHtml += "</td>";
							if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
								hotTopicsHtml += "<td style='width:98%;padding-right:15px;' id='lastFaqTD" + i + "' >";
								hotTopicsHtml += "<a href='" + topFaq[i].comment + "' target='_blank' class='hotlink'>";
								hotTopicsHtml += topFaq[i].key;
								hotTopicsHtml += "</a>";
							}else{
								hotTopicsHtml += "<td style='width:98%;' id='lastFaqTD" + i + "'> ";
								hotTopicsHtml += topFaq[i].key;
							}
							
							hotTopicsHtml +=  "</td>";
							hotTopicsHtml += "<td style='width:20px;' >";
							if(topFaq[i].comment != null && topFaq[i].comment != undefined && topFaq[i].comment != ""){
								hotTopicsHtml += "&nbsp;"
							}else{
							
								hotTopicsHtml += "<image src='"+cacheImageArray[2].src+"' class='lastFaqImgs' id='lastFaqImg" + i + "' border='0'/>"
							}
							hotTopicsHtml += "</td>";
							hotTopicsHtml += "</tr>";
							hotTopicsHtml += "<tr id='" + topfaqFlag+i + "' class='LastFaqClass' style=\"display:none;\" >";
							hotTopicsHtml += "<td colSpan=\"3\"  style='padding:0px;margin:0px;'><span class='lastFaqContext'>" + topFaq[i].text + "</span></td></tr>"
							hotTopicsHtml += "</table></td></tr>"
								
						  }
						hotTopicsHtml += "</table>";
			        	
						$("#td1").html(hotTopicsHtml);
						}
		        	
		        }
				
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
				uiController.unBlockInputPannel("");
	 		}
	});

}

*/
Qsupport.prototype.forwardRobot = function(companyId){
	var url = contextPath + "/all/aliqzg/index.jsp?id=" + companyId;
	var userID = qsupportGetValue(CLIENT_USER_NAME);
	if(userID != '' && userID.indexOf("Guest")<0){
		url += '&userId=' + userID;
	}
	window.location.href=url;
}


Qsupport.prototype.fetchCompanyInfo = function() {
	var cmd = {command: "hello"};
	var argObj = composeQsupportInfo();
	argObj.setMessage(JSON.stringify(cmd));
	argObj.setUseage('1');
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("companyInfo");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{
		      
				if(reQsupportInfo.get("CompanyInfo") == null || reQsupportInfo.get("CompanyInfo") == ""){
					return;
				}
				var topFaq = eval( "("+ reQsupportInfo.get("CompanyInfo") +")" );
				var hotTopicsHtml = "<table  border='0' style=\"width:100%;border-collapse: collapse;\">";
				var curcompID = qsupportGetValue(COMPANY_ID);
				
				var topfaqFlag = "CompanyInfo";
				for(var i=0;i<topFaq.length;i++)
				{
					if(topFaq[i] == null){
						continue;
					}
					var company_id = topFaq[i].key;
					if(company_id == curcompID) continue;
					hotTopicsHtml += "<tr>";
					hotTopicsHtml += "<td colSpan=\"3\"><a href='#' onclick='qsupport.forwardRobot(\"" + company_id + "\")'>" + topFaq[i].text + "</a></td>" +
							"</tr>"
				}
				hotTopicsHtml += "</table>";
				$("#td2").html(hotTopicsHtml);
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
				uiController.unBlockInputPannel("");
	 		}
	});

}


Qsupport.prototype.selectHotTopic = function(topic, divid, url, index) {
	var dis = $("#" + divid).css("display");
	if(url != null && url != undefined && url != ""){
		
	}else{
		$(".TOPFaqClass").hide();
		$(".topFaqTRClass").removeClass("topFaqTRSelect");
		$(".topFaqItemTD").removeClass("topFaqItemTDSelect");
		$(".topFaqImgs").attr('src', cacheImageArray[2].src);
		
		$(".topFaqLineImageClass").attr('src', cacheImageArray[3].src);
	
		if( dis== 'none'){
			
			$("#topFaqTR" + index).addClass("topFaqTRSelect");
			$("#topFaqImg" + index).attr('src', cacheImageArray[1].src);
			$("#topFaq_line_image"+index).attr('src',cacheImageArray[0].src);
			$("#topFaqItemTD" + index).addClass('topFaqItemTDSelect');
			$("#" + divid).show();
           if(qsupportGetValue(COMPANY_ID) == 2){
				
				xthtagWidget.closeLeftPartTd()
			}
		}else{
           
			$("#" + divid).hide();
			 if(qsupportGetValue(COMPANY_ID) == 2){
					
					xthtagWidget.openLeftPartTd()
		 }
		}
	}
}
Qsupport.prototype.selectHotTopic2 =function(topic, divid, url, index){
	
	var dis = $("#" + divid).css("display");
	if(url != null && url != undefined && url != ""){
		
	}else{
		$(".TOPThreeFaqClass").hide();
		$(".topThreeFaqTRClass").removeClass("topFaqTRSelect");
		$(".topThreeFaqItemTD").removeClass("topFaqItemTDSelect");
		$(".topThreeFaqImgs").attr('src', cacheImageArray[2].src);
		
		$(".topThreeFaqLineImageClass").attr('src', cacheImageArray[3].src);
	
		if( dis== 'none'){
			
			$("#topFaqThreeTR" + index).addClass("topFaqTRSelect");
			$("#topThreeFaqImg" + index).attr('src', cacheImageArray[1].src);
			$("#topFaq_Three_line_image"+index).attr('src',cacheImageArray[0].src);
			$("#topFaqThreeItemTD" + index).addClass('topFaqItemTDSelect');
			$("#" + divid).show();
			if(qsupportGetValue(COMPANY_ID) == 2){
				
				xthtagWidget.closeLeftPartTd()
			}
		}else{
			
			$("#" + divid).hide();
           if(qsupportGetValue(COMPANY_ID) == 2){
				
				xthtagWidget.openLeftPartTd()
			}
		}
	}
	
}
Qsupport.prototype.hoverTopFaq = function(divid, comment, i,topTd){
	$("#" + divid).addClass("topFaqTRHover");
	if(comment != null && comment != undefined && comment != ""){
		$("#"+topTd+ i).addClass("topFaqTDHover");
	}
	
}
Qsupport.prototype.hoverEnd = function(divid, comment, i,topTd){
	$("#" + divid).removeClass("topFaqTRHover");
	if(comment != null && comment != undefined && comment != ""){
		$("#"+topTd+ i).removeClass("topFaqTDHover");
	}
}
Qsupport.prototype.hoverLastFaq = function(divid, comment, i){
	$("#" + divid).addClass("lastFaqTRHover");
	if(comment != null && comment != undefined && comment != ""){
		$("#lastFaqTD" + i).addClass("lastFaqTDHover");
	}
}
Qsupport.prototype.hoverLastEnd = function(divid, comment, i){
	$("#" + divid).removeClass("lastFaqTRHover");
	if(comment != null && comment != undefined && comment != ""){
		$("#topFaqTD" + i).addClass("lastFaqTDHover");
	}
}
Qsupport.prototype.hoverTopFaq2 = function(divid, comment, i,topTd){
	if(comment != null && comment != undefined && comment != ""){
		$("#"+topTd + i).css("topFaqTDHover");
	}
}
Qsupport.prototype.hoverEnd2 = function(divid, comment, i,topTd){
	
	if(comment != null && comment != undefined && comment != ""){
		$("#"+topTd + i).removeClass("topFaqTDHover");
	}
}
Qsupport.prototype.hoverLastFaq2 = function(divid, comment, i){
	if(comment != null && comment != undefined && comment != ""){
		$("#lastFaqTD" + i).addClass("lastFaqTDHover");
	}
}
Qsupport.prototype.hoverLastEnd2 = function(divid, comment, i){
	if(comment != null && comment != undefined && comment != ""){
		$("#lastFaqTD" + i).removeClass("lastFaqTDHover");
	}
}
Qsupport.prototype.selectLastTopic = function(topic, divid, url, index) {
	var dis = $("#" + divid).css("display");
	
	if(url != null && url != undefined && url != ""){
		//document.window.open(url, "AliRobot_LastFaq");
	}else{
		$(".LastFaqClass").hide();
		$(".lastFaqTRClass").removeClass("lastFaqTRSelect");
		$(".lastFaqItemTD").removeClass("lastFaqItemTDSelect");
		$(".lastFaqImgs").attr('src',  cacheImageArray[2].src);
		$(".fetchLastFaqClass").attr('src', cacheImageArray[3].src);
		if(dis == 'none'){
			$("#" + divid).show();
			$("#lastFaqTR" + index).addClass("lastFaqTRSelect");
			$("#lastFaqImg" + index).attr('src', cacheImageArray[1].src);
			$("#lastFaqItemTD" + index).addClass('lastFaqItemTDSelect');
			$("#fetch_last_faq_img"+index).attr('src',cacheImageArray[0].src);
		}else{
			$("#" + divid).hide();
		}
	}
	
}

Qsupport.prototype.pollReplyMessage = function() {
	//suggestFunClose();
	if( feaching == 1 )
	{
		return;
	}
	feaching = 1;
	var instance=this;
	var cmd = {command: "userListen"};
	var argObj = composeQsupportInfo();
	argObj.setMessage(JSON.stringify(cmd));
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("pollReplyMessage");
	service.service2(argObj,
	{
		onSuccess:
			function(reQsupportInfoArray)
			
			{   
			   var i=0
		       for(i=0;i<reQsupportInfoArray.length;i++){
		    	   if(reQsupportInfoArray[i].get("messageInReply")!=""&&reQsupportInfoArray[i].get("messageInReply")!=null
		    			   &&reQsupportInfoArray[i].get("command")!="TIME_OUT"){
		    		   
		    		   new JQueryUIController().showMessageInReply(reQsupportInfoArray[i]);
				        
		    	   }
		    	  if(reQsupportInfoArray[i].get("command")=="HANG_UP"){
		    		   
		    		  
		    		  suggestionFunctionOpen2();
		    		  $("#isMonitor").val("0");
		    		  $("#enabledInputBox").css("display","none");
		    	   }
                 if(reQsupportInfoArray[i].get("command")=="TIME_OUT"){
		    		   
                	    suggestionFunctionOpen2();
                	    $("#isMonitor").val("0");
                		$("#enabledInputBox").css("display","none");
                	    
		    	   }
			   }
			   
				feaching=0;
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
	 			clearTimeout(pollReplyMessageTimerId);
	 			feaching=0;
	 		}
	});

}

Qsupport.prototype.showInputBeforeCommand = function(command,input) {
	var ui = new JQueryUIController();
	var service = new qsupportAjaxService();
	var instance = this;
	var argObj = composeQsupportInfo();
	addInputStyleToInfo(argObj);
	argObj.setMessage(input);
	service.setAction("webRobotAjaxAction");
	service.setMethod("showInput");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{
				ui.showMessageInReply(reQsupportInfo); 
				instance.sendCommand(command);
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
	 	//		window.alert("fail");
	 		}
	});
}

Qsupport.prototype.sendCommand = function(command,useage) {
	
	uiController.blockInputPannel($("#inputBox").val());
	
	if (command == undefined) {
		command = {};
	}
	var argObj = composeQsupportInfo();
	argObj.setMessage("");
	argObj.setCommand(command);
	if(useage!=undefined && useage!="")
	{
		argObj.setUseage(useage);
	}
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("sendCommand");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{
				new JQueryUIController().showMessageInReply(reQsupportInfo);
				uiController.unBlockInputPannel($("#inputBox").val());
				uiController.focusInput();
				if($("#changeApplicationId").val()=="0"){
				   loading = 0;
				   uiController.unBlockInputPannel("");
				}
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
	 //			window.alert("fail");
				uiController.unBlockInputPannel($("#inputBox").val());
				uiController.focusInput();
				if($("#changeApplicationId").val()=="0"){
					   loading = 0;
					   uiController.unBlockInputPannel("");
					}
	 		}
	});
	
}

Qsupport.prototype.flower = function(node, id) {
	var cmd = {command: "flower", param: ""};
	var paramArray = new Array();
	var option = {"key": "id", "text": id};
	paramArray.push(option);
	cmd.param = paramArray;
	this.faqComments(JSON.stringify(cmd));
	node.parentNode.style.display ="none";
}
Qsupport.prototype.egg = function(node,id) {
	var cmd = {command: "egg", param: ""};
	var paramArray = new Array();
	var option = {"key": "id", "text": id};
	paramArray.push(option);
	cmd.param = paramArray;
	//write by lijin.shi
	this.faqComments(JSON.stringify(cmd));
	node.parentNode.style.display ="none";
}
Qsupport.prototype.faqComments = function(command) {	
	if (command == undefined) {
		command = {};
	}
//	IFR_WINDOW = window.frames[REPLY_AREA_ID];
	var argObj = composeQsupportInfo();
	argObj.setCommand(command);
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("faqComments");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{
				alert(reQsupportInfo.get("faqCommentResult"));
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
	 	//		window.alert("fail");
	 		}
	});
}

Qsupport.prototype.addFeedBack = function(question,title,realname,account_content,contact_content,email) {	
	
	var argObj = composeQsupportInfo();
	argObj.set("user_question",question);
	argObj.set("user_title",title);
	argObj.set("user_realname",realname);
	argObj.set("account_content",account_content);
	argObj.set("contact_content",contact_content);
	argObj.set("user_email",email);
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("addFeedBack");
	service.service(argObj,
	{
		onSuccess:
			function(reQsupportInfo)
			{
		        xthtagWidget.hiddenFeedBack();
				alert("1、建议提交成功！需求建议恕不一一回复，敬请谅解。若您的问题紧急，请拨打淘宝客服热线。\n\n2、感谢您对淘宝的关心，我们会定期整理会员建议，改善产品体验！");
				
			},
	 	onFailure:
	 		function(xml,eType,e)
	 		{
	 		}
	});
}
Qsupport.prototype.statisfyUpdate=function(inputQuestion,faqQuestion,answer,satisfied,contentId){
	
	var argObj = composeQsupportInfo();
	argObj.set("inputQuestion",inputQuestion);
	argObj.set("faqQuestion",faqQuestion);
	argObj.set("answer",answer);
	argObj.set("satisfied",satisfied);
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("statisfyUpdate");
	service.service(argObj,{
		
		onSuccess:
			  function(reQsupportInfo){
		          
		       
		           if(satisfied=="1"){
		               $("#statisy_content_"+contentId).html('<font style="font-weight:bold;">感谢您的反馈，小二会继续努力的！</font>');
		           }else{
		        	   $("#statisy_content_div_table_"+contentId).remove();
		        	   $("#no_statisy_content_div_"+contentId).html('<font style="font-weight:bold;">感谢您的反馈，小二会继续努力的！</font>'); 
		        	}
		           
		          return;
		          
	        },
	    onFailure:
	    	function(xml,eType,e)
	 		{
	 		}
      });
}
Qsupport.prototype.searchTeachQcTop=function(user_id,teach_start_id){
	var argObj = composeQsupportInfo();
	argObj.set("user_id",user_id);
	argObj.set("start",teach_start_id);
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("searchTeachQcTop");
	service.service(argObj,{
		
		onSuccess:
			  function(reQsupportInfo){
		          var qcSumbit= reQsupportInfo.get("qcTopSubmit");
		          var qcShowCount= reQsupportInfo.get("not_Show_Count");
		          var qcAdoptCount= reQsupportInfo.get("adopt_Count");
		          $(teach_iframe.window.document.getElementById("qcTopSubmitSpan")).html(reQsupportInfo.get("qcTopSubmit"));
		          $(teach_iframe.window.document.getElementById("qcTopNoPassSpan")).html((parseInt(qcShowCount) +  parseInt(qcSumbit))*(-1) );
		          $(teach_iframe.window.document.getElementById("qcTopPassSpan")).html(parseInt(qcAdoptCount) + parseInt(qcSumbit));
		          var topQcTopList=reQsupportInfo.get("teachQcTopList");
		          var topQcTopListObject;
		          var teach_iframe_result="";
		          var qcLength=0;
		          var start=teach_iframe.window.document.getElementById("teach_start_id").value;
		          teach_iframe.window.document.getElementById("searchTaobaoAjaxLoader").style.display="none";
                  var top_qc_button_trObject=teach_iframe.window.document.getElementById("top_qc_button_tr");
				  var topQcButtonForwardObject=teach_iframe.window.document.getElementById("top_qc_button_forward_td");
				  var topQcButtonNextObject=teach_iframe.window.document.getElementById("top_qc_button_next_td");
		          if(user_id != ""){
		        	 
		        	    if(topQcTopList != null &&   topQcTopList != undefined  && topQcTopList != ""){
		        	    	topQcTopListObject=eval('('+topQcTopList+')');
		        	    	if(topQcTopListObject.length > 0){
		        	    		qcLength=topQcTopListObject.length;
		        	    		if(topQcTopListObject[0].tq_count != "0"){
			        	    		teach_iframe_result+="<tr>";
		        	    			 teach_iframe_result+="<td width=\"12%\" height=\"24\" valign=\"middle\" class=\"teacher_blue_line\"><div class=\"teacher_top123 teachertxt_white bb\">"+topQcTopListObject[0].order_index+"</div></td>";
		        	    			 teach_iframe_result+="<td height=\"24\" valign=\"middle\" class=\"teacher_blue_line\">"+topQcTopListObject[0].user_name+"</td>";
		        	    			 teach_iframe_result+="<td width=\"29%\" height=\"24\" align=\"right\" valign=\"middle\" class=\"teacher_blue_line\">"+topQcTopListObject[0].tq_count+"</td>";
		        	    			 teach_iframe_result+="</tr>";
		        	    		}else{
		        	    			
		        	    			teach_iframe_result="<tr><td class=\"blue bb\">您的排名在200名以外!</tr>";
		        	    		}
		        	    	}else{
		        	    		teach_iframe_result="<tr><td class=\"blue bb\">您的排名在200名以外!</tr>";
		        	    	}
		        	    }else{
		        	    	
		        	    	teach_iframe_result="<tr><td class=\"blue bb\">您的排名在200名以外!</tr>";
		        	    }
		        	    
		          }else{
		        	  if(topQcTopList != null &&   topQcTopList != undefined  && topQcTopList != ""){
		        	    	topQcTopListObject=eval('('+topQcTopList+')');
		        	    	if(topQcTopListObject.length > 0){
		        	    		 qcLength=topQcTopListObject.length;
		        	    		 for(var i=0;i<topQcTopListObject.length;i++){
		        	    			 if(topQcTopListObject[i].tq_count != "0"){
			        	    			 teach_iframe_result+="<tr>";
			        	    			 teach_iframe_result+="<td width=\"12%\" height=\"24\" valign=\"middle\" class=\"teacher_blue_line\">";
			        	    			 if(i<3 && start == "0"){
			        	    			   teach_iframe_result+="<div class=\"teacher_top123 teachertxt_white bb\">";
			        	    			 }else{
			        	    				 teach_iframe_result+="<div class=\"teacher_top teachertxt_white bb\">"; 
			        	    			}
			        	    			 teach_iframe_result+=""+topQcTopListObject[i].order_index+"</div></td>";
			        	    			 teach_iframe_result+="<td height=\"24\" valign=\"middle\" class=\"teacher_blue_line\">"+topQcTopListObject[i].user_name+"</td>";
			        	    			 teach_iframe_result+="<td width=\"29%\" height=\"24\" align=\"right\" valign=\"middle\" class=\"teacher_blue_line bb\">"+topQcTopListObject[i].tq_count+"</td>";
			        	    			 teach_iframe_result+="</tr>";
		        	    			 }   
		        	    		}
		        	    		
		        	    	}else{
		        	    		
		        	    		teach_iframe_result="<tr><td class=\"blue bb\">风云排行暂未揭晓!</td></tr>";
		        	    	}
		        	    }else{
		        	    	
		        	    	teach_iframe_result="<tr><td class=\"blue bb\">风云排行暂未揭晓!</td></tr>";
		        	    }
		         }
		     
			 var topQcPageInfo=reQsupportInfo.get("teachQcPageInfo");
		     if(topQcPageInfo != ""){
		          var topQcPageObject=eval('('+topQcPageInfo+')');	 
		    	  if(topQcPageObject.hasPrev == "false" && topQcPageObject.hasNext == "false"){
		    		      top_qc_button_trObject.style.display="none";
						  topQcButtonForwardObject.style.display="none";
						  topQcButtonNextObject.style.display="none";
		    	  }
		    	  if(topQcPageObject.hasPrev == "true" &&  topQcPageObject.hasNext == "false"){
	    		      top_qc_button_trObject.style.display="";
					  topQcButtonForwardObject.style.display="";
					  topQcButtonNextObject.style.display="none";
	    	      }
		    	  if(topQcPageObject.hasPrev == "false" &&  topQcPageObject.hasNext == "true"){
	    		      top_qc_button_trObject.style.display="";
					  topQcButtonForwardObject.style.display="none";
					  topQcButtonNextObject.style.display="";
	    	      }
		    	  if(topQcPageObject.hasPrev == "true" &&  topQcPageObject.hasNext == "true"){
	    		      top_qc_button_trObject.style.display="";
					  topQcButtonForwardObject.style.display="";
					  topQcButtonNextObject.style.display="";
	    	      }
		     }else{
		    	 top_qc_button_trObject.style.display="none";
				  topQcButtonForwardObject.style.display="none";
				  topQcButtonNextObject.style.display="none";
		     }
		     var teachDocumentObject=teach_iframe.window.document.getElementById("qcTopContent");
		     $(teachDocumentObject).html(teach_iframe_result);
		    
		   },
	    onFailure:
	    	function(xml,eType,e)
	 		{
	 		}
      });
	
	
}
Qsupport.prototype.searchTeachQuestionTop=function(user_id,teach_start_id){
	var argObj = composeQsupportInfo();
	argObj.set("user_id",user_id);
	argObj.set("start",teach_start_id);
	var service = new qsupportAjaxService();
	service.setAction("webRobotAjaxAction");
	service.setMethod("searchTeachQuestionTop");
	service.service(argObj,{
		
		onSuccess:
			  function(reQsupportInfo){
		      var teachQeustionTopList=reQsupportInfo.get("teachQuestionTopList");
		     
		      var teachQeustionTopListObject;
	          var teach_iframe_result="";
	          var tQLength=0;
	          var start=teach_iframe.window.document.getElementById("teach_start_id").value;
	          teach_iframe.window.document.getElementById("searchTaobaoAjaxLoader").style.display="none";
	          var top_qc_button_trObject=teach_iframe.window.document.getElementById("top_qc_button_table");
			  var topQcButtonForwardObject=teach_iframe.window.document.getElementById("top_qc_button_forward_td");
			  var topQcButtonNextObject=teach_iframe.window.document.getElementById("top_qc_button_next_td");
			  if(teachQeustionTopList != null &&   teachQeustionTopList != undefined  && teachQeustionTopList != ""){
	        		  teachQeustionTopListObject=eval('('+teachQeustionTopList+')');
	        		  tQLength=teachQeustionTopListObject.length;
	        	    	if(tQLength > 0){
	        	    		for(var i=0;i<tQLength;i++){
	        	    			if(teachQeustionTopListObject[i].tq_order != "99999999"){
		        	    			/* teach_iframe_result+="<tr><td valign=\"middle\" bgcolor=\"#FFFFFF\" class=\"content_01\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr>";
		        	    			 teach_iframe_result+="<td width=\"22%\" valign=\"middle\" class=\"txt10\">"+teachQeustionTopListObject[i].insert_time+"</td>";
		        	    			 teach_iframe_result+="<td width=\"23%\" valign=\"top\">"+teachQeustionTopListObject[i].user_id+"</td>";
		        	    			 teach_iframe_result+="<td width=\"12%\" valign=\"top\">";
		        	    			 if(teachQeustionTopListObject[i].status == "0"){
		        	    				 teach_iframe_result+="待审核";
		        	    			 }else if(teachQeustionTopListObject[i].status == "1"){
		        	    				 teach_iframe_result+="不采纳";
		        	    			 }else if(teachQeustionTopListObject[i].status == "2"){
		        	    				 teach_iframe_result+="已采纳";
		        	    			 }
		        	    			 teach_iframe_result+="</td>";
		        	    			 teach_iframe_result+="<td width=\"25%\" valign=\"top\" class=\"red\"><img src=\"images/award.gif\" width=\"16\" height=\"16\" align=\"absmiddle\">排行第"+teachQeustionTopListObject[i].tq_order+"名</td>";
		        	    			 teach_iframe_result+="<td width=\"18%\" valign=\"top\" class=\"red\">积分"+teachQeustionTopListObject[i].tq_count+"分</td>";
		        	    			 teach_iframe_result+="</tr></table></td></tr>";
		        	    			 teach_iframe_result+="<tr><td valign=\"top\" bgcolor=\"#FFFFFF\" class=\"content_02 blue\">-----"+teachQeustionTopListObject[i].question+"</td></tr>";
		        	    			 teach_iframe_result+="<tr><td height=\"30\" valign=\"top\" bgcolor=\"#FFFFFF\" class=\"content_03\">-----"+teachQeustionTopListObject[i].answer+"</td></tr>";
		        	    		*/
	        	    				 teach_iframe_result+="<tr><td valign=\"middle\" bgcolor=\"#FFFFFF\" class=\"content_01\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr>";
		        	    			 teach_iframe_result+="<td width=\"30%\" valign=\"middle\" class=\"txt10\">"+teachQeustionTopListObject[i].insert_time+"</td>";
		        	    			 teach_iframe_result+="<td width=\"45%\" valign=\"top\" ><img src=\"images/award.gif\" style=\"cursor:pointer;\" width=\"16\" height=\"16\" title=\"排行第"+teachQeustionTopListObject[i].tq_order+"名   积分"+teachQeustionTopListObject[i].tq_count+"分\" align=\"absmiddle\"><span title=\"排行第"+teachQeustionTopListObject[i].tq_order+"名   积分"+teachQeustionTopListObject[i].tq_count+"分\" >"+teachQeustionTopListObject[i].user_id+"</span></td>";
		        	    			  teach_iframe_result+="<td width=\"25%\" valign=\"top\">";
		        	    			 if(teachQeustionTopListObject[i].status == "0"){
		        	    				 teach_iframe_result+="待审核";
		        	    			 }else if(teachQeustionTopListObject[i].status == "1"){
		        	    				 teach_iframe_result+="不采纳";
		        	    			 }else if(teachQeustionTopListObject[i].status == "2"){
		        	    				 teach_iframe_result+="已采纳";
		        	    			 }
		        	    			 teach_iframe_result+="</td>";
		        	    			 teach_iframe_result+="</tr></table></td></tr>";
		        	    			 teach_iframe_result+="<tr><td valign=\"top\" bgcolor=\"#FFFFFF\" class=\"content_02 blue\">-----"+teachQeustionTopListObject[i].question+"</td></tr>";
		        	    			 teach_iframe_result+="<tr><td height=\"30\" valign=\"top\" bgcolor=\"#FFFFFF\" class=\"content_03\">-----"+teachQeustionTopListObject[i].answer+"</td></tr>";
		        	    
	        	    			}
	        	    	    }
	        	    	}else{
	        	    		  top_qc_button_trObject.style.display="none";
							  topQcButtonForwardObject.style.display="none";
							  topQcButtonNextObject.style.display="none";
	        	    		teach_iframe_result="<tr><td align=\"center\" class=\"blue bb\">您搜索的教案内容为空!</td></tr>";
	        	    	}
	        	 }else{
	        		    top_qc_button_trObject.style.display="none";
					    topQcButtonForwardObject.style.display="none";
					    topQcButtonNextObject.style.display="none";
	        	    	teach_iframe_result="<tr><td align=\"center\" class=\"blue bb\">您搜索的教案内容为空!</td></tr>";
	        	  }
		     var topQcPageInfo=reQsupportInfo.get("teachQuestionPageInfo");
		     if(topQcPageInfo != ""){
			          var topQcPageObject=eval('('+topQcPageInfo+')');	 
			    	  if(topQcPageObject.hasPrev == "false" && topQcPageObject.hasNext == "false"){
			    		      top_qc_button_trObject.style.display="none";
							  topQcButtonForwardObject.style.display="none";
							  topQcButtonNextObject.style.display="none";
			    	  }
			    	  if(topQcPageObject.hasPrev == "true" &&  topQcPageObject.hasNext == "false"){
		  		      top_qc_button_trObject.style.display="";
						  topQcButtonForwardObject.style.display="";
						  topQcButtonNextObject.style.display="none";
		  	      }
			    	  if(topQcPageObject.hasPrev == "false" &&  topQcPageObject.hasNext == "true"){
		  		      top_qc_button_trObject.style.display="";
						  topQcButtonForwardObject.style.display="none";
						  topQcButtonNextObject.style.display="";
		  	      }
			    	  if(topQcPageObject.hasPrev == "true" &&  topQcPageObject.hasNext == "true"){
		  		      top_qc_button_trObject.style.display="";
						  topQcButtonForwardObject.style.display="";
						  topQcButtonNextObject.style.display="";
		  	      }
		     }else{
		    	 top_qc_button_trObject.style.display="none";
				  topQcButtonForwardObject.style.display="none";
				  topQcButtonNextObject.style.display="none";
		     }
	        var teachDocumentObject=teach_iframe.window.document.getElementById("teachQuestionContentTable");
	        $(teachDocumentObject).html(teach_iframe_result);
		   },
	    onFailure:
	    	function(xml,eType,e)
	 		{
			   $(teachDocumentObject).html("<tr><td align=\"center\" class=\"blue bb\">您搜索的教案内容为空!</td></tr>");
	 		}
      });
	
	
}
Qsupport.prototype.changeApplication=function(company_id,content_id,text){
   
	qsupportSetValue(COMPANY_ID,company_id);
	$("#changeApplicationId").val("1");
	$("#app_switch_span_"+content_id).html("<span style=\"font-weight:bold;\">您已经选择咨询<font style=\"color:#ff7a4e\">“"+text+"”</font>问题，请在下方输入问题！</span>");
	suggestionFunctionOpen();
	$("#suggestion_switch").hide();
}
Qsupport.prototype.upToChangeCompanyCommand=function(isNew){
	$("#changeApplicationId").val("0");
	suggestFunClose2();
    
	var cmd={command:"applicationSwitch",param:""};
	
	var paramArray = new Array();
	var option = {"key":"isNew","text":isNew};
	paramArray.push(option);
	cmd.param = paramArray;
	this.sendCommand(JSON.stringify(cmd));
}

///////////////////
JQueryUIController.prototype.focusInput = function(){
	if(document.getElementById(INPUT_AREA_TEXT_ID).style.display != 'none') {
		document.getElementById(INPUT_AREA_TEXT_ID).focus();
	}  else {
		if(inputPannel == 0) {
			document.getElementById(INPUT_AREA_TEXT_ID).style.display = 'block';
			document.getElementById(INPUT_AREA_TEXT_ID).focus();
		}
	}
}
JQueryUIController.prototype.copyToReply = function(){
	if(document.getElementById(INPUT_AREA_HTML_ID) != null
		|| document.getElementById(INPUT_AREA_HTML_ID) != undefined
		|| document.getElementById(INPUT_AREA_HTML_ID).style.display =='block') {
		var choice = document.getElementById(INPUT_AREA_HTML_ID).contentWindow.document.all("choice");
		if(document.getElementById(INPUT_AREA_HTML_ID).contentWindow.document.all("choice") != undefined) {
			for(var i=0;i<choice.length;i++) {
				document.getElementById(INPUT_AREA_HTML_ID).contentWindow.document.all("choice")[i].disabled="true";
			}
			if(i == 1) {
				document.getElementById(INPUT_AREA_HTML_ID).contentWindow.document.all("choice").disabled="true";
			}
			var html = document.getElementById(INPUT_AREA_HTML_ID).contentWindow.document.documentElement.innerHTML;
			IFR_WINDOW.document.write(html.split(SPILIT_COMMENT)[0]);
		}
	}
}

/***08.11.11***/
JQueryUIController.prototype.writeToDispalyPanel=function(data) {
	if (data != null && data != "") {
		var messageInReply = data.get("messageInReply");
		if (messageInReply != null && messageInReply != "") {
			$(JQUERY_REPLY_AREA_ID).append(messageInReply);
			this.scrollReplyForNoTab();
		}
		var messageInHintBar = data.get("messageInHintBar");
		if (messageInHintBar != null && messageInHintBar != "") {
			$("#sequoia_hintBar_content").html(messageInHintBar);
		}
		else
		{
			$("#sequoia_hintBar_content").html("");
		}
	}
	this.unBlockInputPannel("");
	this.focusInput();
	return;
}

JQueryUIController.prototype.showMessageInReply=function(data) {
	if (data != null && data != "") {
		var messageInReply = data.get("messageInReply");
		
		if (messageInReply != null && messageInReply != "") {

			$(JQUERY_REPLY_AREA_ID).append(messageInReply);
			this.scrollReplyForNoTab();
		}
	}
	return;
}
/***08.11.11***/
JQueryUIController.prototype.blockInputPannel=function(msg) {
	document.getElementById(INPUT_AREA_TEXT_ID).value = msg;
	$("#sequoia_robot_prompt_message").html(ROBOT_PROMPT_MESSAGE);
	$("#sequoia_hintBar_content").html("");
	if(ie) {
		document.getElementById(INPUT_AREA_TEXT_ID).disabled = true;
	} else {
		document.getElementById(INPUT_AREA_TEXT_ID).readOnly = true;
	}
	
}
JQueryUIController.prototype.unBlockInputPannel=function(msg) {
	if(ie) {
		document.getElementById(INPUT_AREA_TEXT_ID).disabled = false;
	} else {
		document.getElementById(INPUT_AREA_TEXT_ID).readOnly = false;
	}
	document.getElementById(INPUT_AREA_TEXT_ID).value = msg;
	$("#sequoia_robot_prompt_message").html("");
}

function JQueryUIController(){
	this.currentProcessTab = "";
}

JQueryUIController.prototype.scrollReply = function(iframe){
	if(iframe != undefined) {
		iframe.document.body.scrollTop = iframe.document.body.scrollTop + 62000;
	}
}

JQueryUIController.prototype.focusInput = function(){
	if(document.getElementById(INPUT_AREA_TEXT_ID).style.display != 'none') {
		//document.getElementById(INPUT_AREA_TEXT_ID).blur();
		document.getElementById(INPUT_AREA_TEXT_ID).focus();
		document.getElementById(INPUT_AREA_TEXT_ID).blur();
		document.getElementById(INPUT_AREA_TEXT_ID).focus();
		
	}  else {
		if(inputPannel == 0) {
			document.getElementById(INPUT_AREA_TEXT_ID).style.display = 'block';
			//document.getElementById(INPUT_AREA_TEXT_ID).blur();
			document.getElementById(INPUT_AREA_TEXT_ID).focus();
			document.getElementById(INPUT_AREA_TEXT_ID).blur();
			document.getElementById(INPUT_AREA_TEXT_ID).focus();
		}
	}
}

JQueryUIController.prototype.getDivBackgroud = function() {
	return divBackground[divBackgroundIndex];
}
JQueryUIController.prototype.getNextDivBackgroud = function() {
	if( ++divBackgroundIndex >= divBackground.length) {
		divBackgroundIndex =0;
	} 
	return divBackground[divBackgroundIndex];
}

/*
JQueryUIController.prototype.scrollReplyForNoTab = function() {
	setTimeout('_qsupport_scrollReplyForNoTab()',500);
}

function _qsupport_scrollReplyForNoTab() {
	document.getElementById(REPLY_AREA_ID).scrollTop = document.getElementById(REPLY_AREA_ID).scrollHeight;
}*/

var CURRENT_HEIGHT=0;
var NEXT_SCROLL_TOP=0;
var CURRENT_SCROLL_TOP=0;
JQueryUIController.prototype.scrollReplyForNoTab = function() {
  CURRENT_SCROLL_TOP=document.getElementById(REPLY_AREA_ID).scrollTop;
  document.getElementById(REPLY_AREA_ID).scrollTop=NEXT_SCROLL_TOP;
  setTimeout('_qsupport_scrollReplyForNoTab()',500);
}

function _qsupport_scrollReplyForNoTab() {
  CURRENT_HEIGHT=document.getElementById(REPLY_AREA_ID).scrollHeight-CURRENT_SCROLL_TOP;
  NEXT_SCROLL_TOP=CURRENT_SCROLL_TOP+CURRENT_HEIGHT;  
  if(NEXT_SCROLL_TOP>0){
    NEXT_SCROLL_TOP=eval(NEXT_SCROLL_TOP-48);
     }
}



Qsupport.prototype.popImageManager=function(pic_id){
	  
	    var argObj=composeQsupportInfo();
	    argObj.set("pic_id",pic_id);
	    var service = new qsupportAjaxService();
		  service.setAction("webRobotAjaxAction");
		  service.setMethod("popImageManager");
		  service.service(argObj,{
			  
			  onSuccess:
				  function(reQsupportInfo){
			        var picMapList=reQsupportInfo.get("picMapList");
			        var coords;
			        var area_id;
			        var picMapObject=eval('('+picMapList+')');
			        document.getElementById("planetmap").innerHTML="";
			        var areaHtml="";
			        var picMapArray=new Array();
			        for(var i=0;i<picMapObject.length;i++){
			        	 var consoleHeight=parseInt($("#consolePicHeight").val(),10);
			             var consoleWidth=parseInt($("#consolePicWidth").val(),10);
			             var bigHeight=parseInt($("#bicPicHeight").val(),10);
			             var bigWidth=parseInt($("#bigPicWidth").val(),10);
			             var coordsString=picMapObject[i].coords;
				         var coords=coordsString.split(","); 
				         
				         var left=(parseInt(coords[0],10)*bigWidth)/consoleWidth;
				         
				         var top=(parseInt(coords[1],10)*bigHeight)/consoleHeight;
				         var right=(parseInt(coords[2],10)*bigWidth)/consoleWidth;
				         var bottom=(parseInt(coords[3],10)*bigHeight)/consoleHeight;
				         var width=right-left;
				     	 var height=bottom-top;
				          coordsString=left+","+top+","+right+","+bottom;
				        
			        	//areaHtml+="<area  id=\"areaMap"+picMapObject[i].id+"\" coords=\""+coordsString+"\" shape=\"rect\" href=\"#\" title=\""+picMapObject[i].remark+"\" onmouseout=\"xthtagWidget.mouseoutArea('"+picMapObject[i].id+"','"+picMapObject[i].coords+"')\"  onclick=\"xthtagWidget.listRelationFaq('"+picMapObject[i].faq_id+"','"+picMapObject[i].title+"');\" onmouseover=\"xthtagWidget.mouseoverArea('"+picMapObject[i].coords+"','"+picMapObject[i].id+"')\"/>";
			        	areaHtml+="<area  id=\"areaMap"+picMapObject[i].id+"\" coords=\""+coordsString+"\" shape=\"rect\"  />";
			        	var  offset=xthtagWidget.getOffset(document.getElementById("relationPlantMapImage"));
			        	$("<div class=\"area_big_image_show_class\" onmouseout=\"xthtagWidget.mouseOutClass('"+picMapObject[i].id+"');\" style=\"cursor:pointer\"  title=\""+picMapObject[i].remark+"\"  onclick=\"xthtagWidget.listRelationFaq('"+picMapObject[i].faq_id+"','"+picMapObject[i].title+"','"+picMapObject[i].id+"');\" onmouseover=\"xthtagWidget.mouseOverClass('"+picMapObject[i].id+"','"+picMapObject[i].title+"');\"></div>")
			        	                .attr("id","area_big_image_show_"+picMapObject[i].id)
			        	                .appendTo("body")
			        	                .addClass("area_pic_div")
			        	                .css({"visibility":"visible",
			        	                	  "top":top+offset.y,
			        	                	  "left":left+offset.x,
			        	                	  "width":width,
			        	                	  "height":height,
			        	                	  "z-index":"18",
			        	                	  "position":"absolute"});
			        	picMapArray[i]=picMapObject[i].id;            
			      
			        	
			        
			       }
			        document.getElementById("planetmap").innerHTML=areaHtml;
			        xthtagWidget._setPicMapArray(picMapArray);
			        xthtagWidget._setPicMapObject(picMapList);
		        },
		       onFailure:
			 		function(xml,eType,e)
			 		{
			 		}
			  
		  });
	}


Qsupport.prototype.listRelationFaq=function(faq_id,map_id){
	
	    var argObj=composeQsupportInfo();
	     argObj.set("faq_id",faq_id);
	     var service = new qsupportAjaxService();
		 service.setAction("webRobotAjaxAction");
		 service.setMethod("listRelationFaq");
	     service.service(argObj,{
			  
			  onSuccess:
				  function(reQsupportInfo){
	    	        
			        var faqVOList=reQsupportInfo.get("faqVOList");

			         xthtagWidget.showDymRelationFaq(map_id,faqVOList);
			   
			       
			       
		        },
		       onFailure:
			 		function(xml,eType,e)
			 		{
			 		}
			  
		  });
}
Qsupport.prototype.areaPivClick=function(mapId){
	
	   var argObj=composeQsupportInfo();
	   argObj.set("map_id",mapId);
	   var service = new qsupportAjaxService();
	   service.setAction("webRobotAjaxAction");
	   service.setMethod("areaPivClick");
	   service.service(argObj,{
			  
			  onSuccess:
				  function(reQsupportInfo){
	    	       
		        },
		       onFailure:
			 		function(xml,eType,e)
			 		{
			 		}
			  
		  });
}

Qsupport.prototype.selectMaxFaq=function(divid,index){
	  	        var dis = $("#max_Faq_" + divid).css("display");
	  		
	  		    
	  			$(".TOPFaqClass").hide();
	  			$(".topFaqTRClass").removeClass("topFaqTRSelect");
	  			$(".topFaqItemTD").removeClass("topFaqItemTDSelect");
	  			$(".topFaqImgs").attr('src', 'images/flex1.gif');
	  			$(".relationFaqDianLineImage").attr('src', 'images/dian_line.gif');
	  		//	$("#relation_dian_line_image"+index).attr('src', 'images/dian_line.gif');
	  		
	  			
	  			if(dis == 'none'){
	  				$("#max_Faq_" + divid).show();
	  				$("#maxFaqTR" + index).addClass("topFaqTRSelect");
	  				$("#maxFaqImg" + index).attr('src', 'images/flex2.gif');
	  				$("#relation_dian_line_image"+index).attr('src', 'images/dian_line_x.gif');
	  				$("#maxFaqItemTD" + index).addClass('topFaqItemTDSelect');
	  				//$("#max_Faq_"+index).addClass('topFaqTRSelectAnswer');
	  			}else{
	  				$("#max_Faq_" + divid).hide();
	  			}
	  		
	  		
	  	}
Qsupport.prototype.hoverMaxFaq=function(divid){
	  	
	  	$("#" + divid).addClass("topFaqTRHover");

	  }
Qsupport.prototype.hoverMaxFaqEnd=function(divid){
	      $("#" + divid).removeClass("topFaqTRHover");
	   
	  }

Qsupport.prototype.disableDiagnoseBaseButton=function(diaend){
	$(".diagnoseBackButton").css("display", "none");
	if(!diaend){
		$(".diagnoseBackButton:last").show();
	}
}

