
 function getAjax(){
  var ajax=false; 
  try { 
   ajax = new ActiveXObject("Msxml2.XMLHTTP"); 
  } catch (e) { 
   try { 
    ajax = new ActiveXObject("Microsoft.XMLHTTP"); 
   } catch (E) { 
    ajax = false; 
   } 
  }
  if (!ajax && typeof XMLHttpRequest!='undefined') { 
   ajax = new XMLHttpRequest(); 
      if (ajax.overrideMimeType) 
			 {
       ajax.overrideMimeType('text/xml');
	   }
  } 
  return ajax;
 }
 
 function show_text(serverPage,objID){
  var serverPage;	 
  var objdiary = document.getElementById(objID);
//  serverPage +="?"+Math.random();
  serverPage=HtmlDecode(serverPage);
  var ajaxFri = getAjax();   
  ajaxFri.open("POST", serverPage, true); 
  ajaxFri.onreadystatechange = function() { 
   if (ajaxFri.readyState == 4 && ajaxFri.status == 200) { 
    var text = ajaxFri.responseText; 
    if(text!=0){
     objdiary.innerHTML=text;
    }
   } 
  } 
    ajaxFri.send(null); 
 }
 
//用js进行html编码

function   HtmlEncode(text){  
	  return   text.replace(/&/g,'&amp').replace(/\"/g,'&quot;').replace(/</g,'&lt;').replace(/>/g,'&gt;');  
}
function   HtmlDecode(text){  
	  return   text.replace(/&amp;/g,'&').replace(/&quot;/g,'\"').replace(/&lt;/g,'<').replace(/&gt;/g,'>');  
}

function SubmitAddCart(form_Obj){
	temp_Arr = SubmitAddCart.arguments
	temp_Len = temp_Arr.length
	var i = 1
	while(i < temp_Len){
		obj = document.forms[form_Obj].elements[temp_Arr[i]];
		temp_Value=JsTrim(obj.value)
		if(temp_Value == ''){
			obj.value=temp_Value;
			obj.focus();
			alert("Please enter \""+temp_Arr[i+1]+"\"!\nIt will help us to double check the compatibility for you.\nThank you!")
			return false;
		}
		i=i+2
	}
}
function JsTrim(str){
	str = str.replace(/(^\s*|\s*$)/g,"");
	return str;
}

function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
		window.onload = func;
	}else{
		window.onload = function()
		{
			if (oldonload){
				oldonload();
			}
			func();
		}
	}
}
function rightBottomAd(){
	var divEl = document.createElement("div"); //创建一个div元素
	//设置div的ID SRC 属性
	divEl.setAttribute("id","live_chat");
	var galleryEl = document.getElementById("footer"); //得到要插入的元素
	galleryEl.appendChild(divEl); //将ingEl节点插入到galleryEl节点的前面
	document.getElementById("live_chat").innerHTML='<link href="https://chatserver.comm100.com/css/comm100_livechatbutton.css" rel="stylesheet" type="text/css"/><a href="http://www.comm100.com/livechat" target="_blank" onclick="comm100_130345.openChatWindow(event,1767,-1);return false;"><img style="border:0px" id="comm100_ButtonImage" src="https://chatserver.comm100.com/BBS.aspx?siteId=130345&amp;planId=1767&amp;partnerId=-1"></img></a>';
	js_include('https://chatserver.comm100.com/js/LiveChat.js?siteId=130345&amp;planId=1767&amp;partnerId=-1');
	live_chat_float();
} 

function js_include($script){
var script = document.createElement('script');
script.src = $script;
script.type = 'text/javascript';
var head = document.getElementsByTagName('head').item(0);
head.appendChild(script);
}

function live_chat_float(){
var abc = document.getElementById("comm100_ButtonImage"); 
abc.style.top = document.documentElement.scrollTop+document.body.scrollTop+document.documentElement.clientHeight-97+"px";
setTimeout(function(){live_chat_float();},50); 
}
addLoadEvent(rightBottomAd)
//window.onload=rightBottomAd;
