//合并 js/user/layer.js   js/common/util.js   js/common/ajax.js   js/common/search2.js 
//     js/common/urlGB2312.js   js/user/authen_layout.js  js/common/URLCookie.js
//    
  

//--------------  js/user/layer.js----------------------
function menuFix() {
    var sfEl = document.getElementsByTagName("ul")
    for (var a=0; a<sfEl.length; a++){
    sfEls=sfEl[a].getElementsByTagName("li")
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
        this.className+=(this.className.length>0? " ": "") + "sfhover";
        }
        sfEls[i].onMouseDown=function() {
        this.className+=(this.className.length>0? " ": "") + "sfhover";
        }
        sfEls[i].onMouseUp=function() {
        this.className+=(this.className.length>0? " ": "") + "sfhover";
        }
        sfEls[i].onmouseout=function() {
        this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");
        }
    }
    }
}
window.onload=menuFix;

//-------------js/common/util.js--------------------------


/**
*常用方法
*/
var _logMessage="";
var _DOMDocument = ["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"];

onerror=_handleErr;
/**
*记录错误日志
*/
function _handleErr(msg,url,l)
{
_logMessage+="Error: " + msg + "\n";
_logMessage+="URL: " + url + "\n";
_logMessage+="Line: " + l + "\n";
return false;//浏览器下脚不显示，设为true
}

/* *
 * 判断浏览器
 * usage : new Browser().IE7(IE6，Maxthon，Firefox); return boolean
 * 属性：IE7，IE6，Maxthon，Firefox 。类型：boolean
 */
function Browser()
{
   this.getClassName = function()
   {
      return "Browser";
   }
   this.innerCheckBrowser();
   this.getBrowser=function()
   {
    if(this.IE6){return "IE6";}
    else if(this.IE7){return "IE7";}
    else if(this.Maxthon){return "Maxthon";}
    else if(this.Firefox){return "Firefox";}
    else {return "Unknown"};
   }
}


Browser.prototype.IE7 = false;
Browser.prototype.IE6 = false;
Browser.prototype.Maxthon = false;
Browser.prototype.Firefox = false;

/**
*内部调用
*/
Browser.prototype.innerCheckBrowser=function()
{

   if(navigator.appName.indexOf("Internet Explorer") != - 1 && navigator.userAgent.indexOf("Maxthon") == - 1)
   {
     if(window.XMLHttpRequest)
      {
         this.IE7 = true;
      }
      else
      {
         this.IE6 = true;
      }
   }
   else if(navigator.userAgent.indexOf("Maxthon") != - 1)
   {
      this.Maxthon = true;
   }
   else if(navigator.userAgent.indexOf("Firefox") != - 1)
   {
      this.Firefox = true;
   }
}

Browser.prototype.toString=function()
{
return "navigator.userAgent："+navigator.userAgent+"\nnavigator.appName："+navigator.appName;
}

/**
*new Select(object/selectId);
*@param: select 可以为id（String型），也可以为object
*/
function Select(select)
{
  this.getClassName=function(){return "Select";}
  this.selectObj=select;
  this.loadFirst=true;
  if(typeof(select)=='string')
  {
   this.selectObj=document.getElementById(select);
  }
  this.checkSelect();
}

/**
*s使此value项被选中
*@param: value  value
*/
Select.prototype.setSelected=function(value)
{
  for(var i=0;i<this.selectObj.options.length;i++)
  {
    if(this.selectObj.options[i].value==value)
    {
      this.selectObj.options[i].selected=true;
      break;
    }
  }
}


/**
*内部调用
*/
Select.prototype.checkSelect=function()
{
 if(typeof(this.selectObj)!="object")
 {
   _throwErr("checkSelect(obj)","创建的select对象不存在!") ;
 }
}

Select.prototype.isLoadFirst=function(load)
{
 this.loadFirst=load;
}
/**
*@param:jMap JHashMap对象
*/
Select.prototype.mapToSelect=function(jMap)
{
    var firstValue=null;
    var firstText=null;
    if(jMap == null)
        return;
    if(jMap.constructor != JHashMap)
        return;
    if(this.selectObj.options.length>0){
    firstValue=this.selectObj.options[0].value;
    firstText=this.selectObj.options[0].text;
    }
    var arrValue  = jMap.keySet();
    var arrText= jMap.values();
    if(arrText==null)
    {
    return;
    }
    this.removeAll();
    if(firstText!==null&&this.loadFirst){
    this.addOption(firstText,firstValue);
    }
    for(var i=0;i<arrText.length;i++)
     { 
       this.addOption(arrText[i],arrValue[i]);
     }
}


/**
*把xml节点属性值解析到select表单中
*@param:xml  xml的路径或者xml字符串或者xml对象
*@param:nodesXPath  包含需要解析的属性的节点的xpath路径
*@param:valueAttribute   要解析到select表单中作为value的属性名
*@param:textAttribute    要解析到select表单中作为text的属性名
*/
Select.prototype.xmlToSelect=function(xml,nodesXPath,valueAttribute,textAttribute)
{
   var xmldom=new XmlDom();
   xmldom.inputXml(xml);
   var xmlMap=xmldom.xmlToMap(nodesXPath,valueAttribute,textAttribute);
   this.mapToSelect(xmlMap,this.selectObj);
}



/**
*动态删除select中的所有options
*/
Select.prototype.removeAll=function(){
this.selectObj.options.length=0; 
}

/**
*动态删除select中的某一项option
*/
Select.prototype.remove=function(index){
this.selectObj.options.remove(indx); 
}

/**
*动态添加select中的项option
*/
Select.prototype.addOption=function(text,value){
this.selectObj.options.add(new Option(text,value)); 
}

/**
*动态添加select中的项option
*@param:text
*@param:value
*/
Select.prototype.getValue=function()
{
return this.selectObj.options[this.selectObj.selectedIndex].value;
}

/**
*得到select的text(显示文本)
*/
Select.prototype.getText=function()
{
return this.selectObj.options[this.selectObj.selectedIndex].text;
}



/**
*xmlDom 类
*/
function XmlDom()
{
 this.creatDom();
}


XmlDom.prototype._xmlDom=null;



/**
*创建DOM对象
*/
XmlDom.prototype.creatDom=function()
{
 this._xmlDom = this.getActiveXObject(_DOMDocument);
 if(this._xmlDom == null){
    _throwErr("creatDom():","不能正确创建DOM对象");
 }
   if(!document.all)     
  {   
    if( document.implementation.hasFeature("XPath", "3.0") )
      {
       // prototying the XMLDocument
       XMLDocument.prototype.selectNodes = function(cXPathString, xNode)
      {
          if(!xNode ){ xNode = this; } 
          var oNSResolver = this.createNSResolver(this.documentElement)
          var aItems = this.evaluate(cXPathString, xNode, oNSResolver, 
                       XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
          var aResult = [];
          for( var i = 0; i < aItems.snapshotLength; i++)
         {
             aResult[i] =  aItems.snapshotItem(i);
          }
          return aResult;
       }

       // prototying the Element
       Element.prototype.selectNodes = function(cXPathString)
      {
          if(this.ownerDocument.selectNodes)
          {
             return this.ownerDocument.selectNodes(cXPathString, this);
          }
          else{throw "For XML Elements Only";}
       }
    }

    // check for XPath implementation
    if( document.implementation.hasFeature("XPath", "3.0") )
    {
       // prototying the XMLDocument
       XMLDocument.prototype.selectSingleNode = function(cXPathString, xNode)
       {
          if( !xNode ){ xNode = this; } 
          var xItems = this.selectNodes(cXPathString, xNode);
          if( xItems.length > 0 )
          {
             return xItems[0];
          }
          else
          {
             return null;
          }
       }
       // prototying the Element
       Element.prototype.selectSingleNode = function(cXPathString)
      {    
          if(this.ownerDocument.selectSingleNode)
         {
             return this.ownerDocument.selectSingleNode(cXPathString, this);
          }
          else{throw "For XML Elements Only";}
       }
    }
}
}




/**
*载入xml
*@param: argSource
         xml字符串或者对象或者xml路径
*/
XmlDom.prototype.inputXml=function(argSource)
{
	var vTempSource = "";
	try
	{
		switch(typeof(argSource))
		{
			case "string":
				if(argSource.search(/\./) != -1 && argSource.search(/\</) == -1)
				{
					if(argSource.search(/\+/) != -1)
						argSource = eval(argSource);										  		  
				  	this._xmlDom.async = false;			  		  
					this._xmlDom.load(argSource);
					break;
				}
				if(argSource.startWith("<"))
				{
					argSource = argSource.replace(/xmlns:fo=\"\"/g,"");	
					try{				      
					this._xmlDom.loadXML(argSource);
					    }
                  catch(e){
                  var oParser = new DOMParser();
                  this._xmlDom = oParser.parseFromString(argSource,"text/xml");
                  }
					break;
				}
				try
				{
					argSource = argSource.replace(/xmlns:fo=\"\"/g,"");
					this._xmlDom = eval(argSource);//xml data island
				}
				 catch(e)
				 {	
				   				
				  }
				break;	  
			case "object":
				if(argSource.xml) 
			    vTempSource = argSource.xml;
				vTempSource = vTempSource.replace(/xmlns:fo=\"\"/g,"");			      
				this._xmlDom.loadXML(vTempSource);//xml document object
				break;
			case "undefined":
				this._xmlDom = this._xmlDom.createDocumentFragment();
				break;
			default:
				this._xmlDom = null;					  
		}
	}
	catch(err)
	{
		this._xmlDom = null; 
		 _throwErr("inputXml(argSource):","给出的xml字符串或者路径有问题!");
	}
	return this._xmlDom;
}

/**
*firefox中没有取节点的text的方法
*/
XmlDom.prototype.getText=function(oNode) {
     var sText = "";
     if(!document.all)
     {
     for (var i = 0; i < oNode.childNodes.length; i++) {
        if (oNode.childNodes[i].hasChildNodes()) {
            sText += getText(oNode.childNodes[i]);
        } else {
            sText += oNode.childNodes[i].nodeValue;
        }
       }
     }
     else
     {
      return oNode.text
     }
     return sText;
}



/**
*得到xmlDocument对象
*/
XmlDom.prototype.getActiveXObject=function(axarray) {
  var returnValue; 
  if(!document.all)
  {
  return document.implementation.createDocument("", "", null);
  } 
  for (var i = 0; i < axarray.length; i++) {
    try {
      returnValue = new ActiveXObject(axarray[i]);
      break;
    }catch (ex) {}
  }
  return returnValue;
}


/**
*@param:keyname   node的属性名
*@param:valueName node的属性名
*/
XmlDom.prototype.xmlToMap=function(nodesXpath,keyName,valueName)
{
  var xmlMap = new JHashMap();
  var nodes=this._xmlDom.selectNodes(nodesXpath);
  if(nodes==null){ return null;}
  for(var i=0;i<nodes.length;i++)
  {

   var key= this.getAttribute(nodes[i],keyName);
   var value=this.getAttribute(nodes[i],valueName);
   xmlMap.put(key,value);
  }

  return xmlMap;
}


/**
*根据浏览器的不同，可能会有不同的地方
*/
XmlDom.prototype.getAttribute=function(node,attribute)
{
  return node.getAttribute(attribute);
}




/**
*checkBox类
*/
function CheckBox(checkbox)
{
  this.getClassName=function(){return "CheckBox";}
  this.checkboxObj=checkbox;
  if(typeof(checkbox)=='string')
  {
   this.checkboxObj=document.getElementById(checkbox);
  }
}


/**
*checkBox全选
*@param:childObjs  被全选的checkbox对象数组
*/
CheckBox.prototype.selectAll=function(childObjs){
  	if( this.checkboxObj.checked){
  		this.setCheckboxStatus(childObjs,true);
  	}else{
  		this.setCheckboxStatus(childObjs,false);
  	}
  }


/**
* 全选时有多个“全选框”的情况适用，也适用于一个“全选框”的情况
*@param:parentObj  "全选"checkbox
*@param:SiblingObjs  全选列表中的其他checkbox数组
*/
CheckBox.prototype.selectAllCheckBox=function(parentObjs,childObjs){
	if(this.checkboxObj.checked){
		if(parentObjs != null && parentObjs.length>0){
			this.setCheckboxStatus(parentObjs,true);
		}
		this.setCheckboxStatus(childObjs,true);
	}else{
		if(parentObjs != null && parentObjs.length>0){
			this.setCheckboxStatus(parentObjs,false);
		}
		this.setCheckboxStatus(childObjs,false);
	}
}



 
/**
*内部调用
*/
CheckBox.prototype.setCheckboxStatus=function(childObjs,value){

  	if(typeof(childObjs) != "object") return;
	for(var i = 0;i<childObjs.length;i++){
  		childObjs[i].checked = value;
  	}
  }
  
  
  
/**
*当被全选的列表中有所变化时，“全选”checkbox变化
*@param:parentObj  "全选"checkbox
*@param:SiblingObjs  全选列表中的其他checkbox数组
*/
CheckBox.prototype.setCheckboxAllStatus=function(parentObj,SiblingObjs)
  {
	 var selectAll=true;
	 if(!this.checkboxObj.checked)
	  {
       selectAll=false;
	  }
	 else
	  {
          for(var i = 0;i<SiblingObjs.length;i++)
	  {
  		  if(SiblingObjs[i].checked == false)
		  {
			selectAll=false;
			break;
		  }
	  }
  	}
  	if(typeof(parentObj.length)=="number")
  {
	for(var i = 0;i<parentObj.length;i++){
  	    parentObj[i].checked = selectAll;
    }
  }
 else
 {
   parentObj.checked = selectAll;
  }
	
  }


/**
*判断字符串的结尾字符串
*@param:str 
*@return  boolean
*/
String.prototype.endWith=function(str){
 if(str==null||str==""||this.length==0||str.length>this.length)
  return false;
 if(this.substring(this.length-str.length)==str)
  return true;
 else
  return false;
 return true;
}

/**
*判断字符串的开始字符串
*@param:str 
*@return  boolean
*/
String.prototype.startWith=function(str){
 if(str==null||str==""||this.length==0||str.length>this.length)
  return false;
 if(this.substr(0,str.length)==str)
  return true;
 else
  return false;
 return true;
}



/**
 *清除html标记
 *@param:s  要处理的字符串
 */
function  clearHtml(s)
{
var s = clearNull(s);
s = s.replace(/(<)/g, "&lt;");
s = s.replace(/(>)/g, "&gt;");
s = s.replace(/(\")/g, " & quot; ");
s = s.replace(/(')/g, "&#039;");
s = s.replace(/( )/g, "&nbsp;");
return s;
}



/**
 * 参数值进行编码
 *@param:str  要编码的字符串
 */
function urlEncode(str)
{
var ret;
ret = encodeURI(str);
ret = ret.replace("&", "%26");
ret = urlencode_plug(ret);
return ret;
}
/**
*内部调用
*/
function urlencode_plug(str)
{
if ('' != str)
{
   var st, i, chr;
   st = '';
   for (i = 0; i < str.length; i ++ )
   {
      chr = str.charCodeAt(i);
      if(chr == 0x2B)
      {
         st = st.concat("%2B");
      }
      else
      {
         st = st.concat(String.fromCharCode(chr));
      }
   }
   return(st);
}
else
{
   return('');
}
}




/**
 * 记录日志
 *@param:functionName 函数名的字符串
 *@param:message  错误信息
 */
function log(functionName, message)
{
try
{
   _logMessage = _logMessage + "\n" + "函数名称:" + functionName;
   _logMessage = _logMessage + "\n" + "错误信息:" + message;
}
catch(e){}
}




/**
 * 显示错误日志
 *浏览器中输入javascript:error();
 */
function error()
{
if(_logMessage =="")
{
   alert("No error message");
}
else
{
   alert(_logMessage);
}
}

////////////////////////////////////////////////////////

/**
 * HashMap version 3.0
 * HashMap构造函数
*/
function JHashMap()
{
    this.length = 0;
    this.prefix = "karen";
}
/**
 * 向HashMap中添加键值对
 */
JHashMap.prototype.put = function (key, value)
{
    this[this.prefix + key] = value;
    this.length ++;
}
/**
 * 从HashMap中获取value值
 */
JHashMap.prototype.get = function(key)
{
    return typeof this[this.prefix + key] == "undefined" 
            ? null : this[this.prefix + key];
}
/**
 * 从HashMap中获取所有key的集合，以数组形式返回
 */
JHashMap.prototype.keySet = function()
{
    var arrKeySet = new Array();
    var index = 0;
    for(var strKey in this)
    {
        if(strKey.substring(0,this.prefix.length) == this.prefix)
            arrKeySet[index ++] = strKey.substring(this.prefix.length);
    }

    return arrKeySet.length == 0 ? null : arrKeySet;
}
/**
 * 从HashMap中获取value的集合，以数组形式返回
 */
JHashMap.prototype.values = function()
{
    var arrValues = new Array();
    var index = 0;
    for(var strKey in this)
    {
        if(strKey.substring(0,this.prefix.length) == this.prefix)
            arrValues[index ++] = this[strKey];

    }
    return arrValues.length == 0 ? null : arrValues;
}
/**
 * 获取HashMap的value值数量
 */
JHashMap.prototype.size = function()
{
    return this.length;
}
/**
 * 删除指定的值
 */
JHashMap.prototype.remove = function(key)
{
    delete this[this.prefix + key];
    this.length --;
}
/**
 * 清空HashMap
 */
JHashMap.prototype.clear = function()
{
    for(var strKey in this)
    {
        if(strKey.substring(0,this.prefix.length) == this.prefix)
            delete this[strKey];   
    }
    this.length = 0;
}
/**
 * 判断HashMap是否为空
 */
JHashMap.prototype.isEmpty = function()
{
    return this.length == 0;
}
/**
 * 判断HashMap是否存在某个key
 */
JHashMap.prototype.containsKey = function(key)
{
    for(var strKey in this)
    {
       if(strKey == this.prefix + key)
          return true;  
    }
    return false;
}
/**
 * 判断HashMap是否存在某个value
 */
JHashMap.prototype.containsValue = function(value)
{
    for(var strKey in this)
    {
       if(this[strKey] == value)
          return true;  
    }
    return false;
}
/**
 * 把一个HashMap的值加入到另一个HashMap中，参数必须是HashMap
 */
JHashMap.prototype.putAll = function(map)
{
    if(map == null)
        return;
    if(map.constructor != JHashMap)
        return;
    var arrKey = map.keySet();
    var arrValue = map.values();
    for(var i in arrKey)
       this.put(arrKey[i],arrValue[i]);
}


/**
*toString
*/
JHashMap.prototype.toString = function()
{
    var str = "";
    for(var strKey in this)
    {
        if(strKey.substring(0,this.prefix.length) == this.prefix)
              str += strKey.substring(this.prefix.length) 
                  + " : " + this[strKey] + "\r\n";
    }
    return str;
}


function _throwErr(functionName,message)
{
if(document.all)
{
throw new Error(functionName+":"+message);
}
else
{
log(functionName,message);
}

}

function getPosition(obj){  
	var left = 0;  
	var top  = 0;  
	while (obj.offsetParent){  
		left += obj.offsetLeft; 
		top += obj.offsetTop;  
	    obj = obj.offsetParent;  
	}  
	left += obj.offsetLeft;  
	top += obj.offsetTop;
	return {x:left, y:top};  
} 

//图片居中显示
function ZoomImage(imgD,h,w){
	var image = new Image();
	image.src = imgD.src;
	var iwidth = image.width; 
	var iheight = image.height; 
	
	if(iwidth < w && iheight < h){
		imgD.width = iwidth;
		imgD.height = iheight;
	}else{
		//判断比例因子
		if (iwidth/iheight > w/h){
			imgD.width = w;
			imgD.height = iheight * w / iwidth;
		}else{
			imgD.height = h;
			imgD.width = iwidth * h / iheight;
		}
	}
	if(imgD.width <= 0) imgD.width = w;
	if(imgD.height <= 0) imgD.height = h;
}



//--------------------------js/common/ajax.js--------------------------


/**
*Ajax
*/
function Ajax()
{
this.getClassName=function(){return "Ajax";}
this._XMLHttpReq=this._createXMLHttpRequest();
}

  
Ajax.prototype._ExecuseResponseFunc=null;
Ajax.prototype.url=null;
Ajax.prototype.parameters=null;
Ajax.prototype._XMLHttpReq=null;
Ajax.prototype.isWorking=false;


/**
*返回response，如有异常，则返回null
*/
Ajax.prototype.getResponse=function(){

if(this._XMLHttpReq!=null&&this._XMLHttpReq.readyState == 4&&this._XMLHttpReq.status == 200)
   {
     return this._XMLHttpReq.responseText;
   }
else{
   return null;
  }
}
   



/**
* 判断浏览器，创建XMLHttpRequest对象
*/
Ajax.prototype._createXMLHttpRequest=function()
{

  if(this._XMLHttpReq==null)
  {
   try{
      if(window.XMLHttpRequest)
       {
      // 直接使用XMLHttpRequest函数来创建XMLHttpRequest对象
      this._XMLHttpReq = new XMLHttpRequest();
        }
         // 对于IE浏览器
     else if (window.ActiveXObject)
     {
      try
      {
         // 使用AcitveXObject函数创建浏览器
         this._XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch (e)
      {
         // 如果出现异常，再次尝试以如下方式创建_XMLHttpRequest对象
         try
         {
            this._XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch (e)
         {
         }
      }
   }
   }
   catch(e){_throwErr("_createXMLHttpRequest():","不能创建XMLHttpRequest对象"); }
   }
   
   return this._XMLHttpReq;
}


/**
*@parameters:{parameterName:parameterValue,parameterName:parameterValue},
               或者为参数字符串，形如：key1=***&key2=***
*Get请求时，如果已经拼接在url中，则给null
*/
Ajax.prototype._sendRequest=function(method, url, parameters, execuseResponseFunction)
{
if(!this.isWorking){
try{
   this.isWorking=true;
   this.url=url;
   this._ExecuseResponseFunc=execuseResponseFunction;
   var _ajaxObj=this;
   var paramString="";
   if(parameters!=null&&typeof(parameters)!="string")
   {   
    for(var param in parameters)
    {
     paramString=paramString+(paramString=="" ? '' : '&')+param+'='+(parameters[param]==null ? "":parameters[param]);
    }
   }
   else
   {
   paramString=(parameters==null?"":parameters);
   }
   paramString=paramString+(paramString=="" ? '' : '&')+'mrtype=1';//参数添加mrtype=1
   this.parameters=paramString;
   if(method.toLowerCase() == "post")
   {
      this._XMLHttpReq.open(method, url, true);
      this._XMLHttpReq.onreadystatechange = function(){_ajaxObj._execuseResponse();}
      this._XMLHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
      this._XMLHttpReq.send(paramString);
     
   }
   else
   {
     paramString!="" ? (url += (url.match(/\?/) ? '&' : '?') + paramString):"";
     this._XMLHttpReq.open(method, url, true);
     this._XMLHttpReq.onreadystatechange = function(){_ajaxObj._execuseResponse();}
     this._XMLHttpReq.send(paramString);
      }
    }catch(e)
    {
     alert(e.message);
    }
    finally{ }
   }
}


/**
*调用回调函数，回调函数无参数
*/
Ajax.prototype._execuseResponse=function()
{
if (this._XMLHttpReq.readyState == 4)
{

       this.isWorking=false;  
   // 判断对象状态
   if (this._XMLHttpReq.status == 200&&this._ExecuseResponseFunc!=null)
   {
      // 信息已经成功返回，开始处理信息
     this._ExecuseResponseFunc(this._XMLHttpReq.responseText);
   }
   else
   {
   _throwErr("_execuseResponse()","服务器返回结果异常!请检查url和服务器端");
   }
}
}

/**
*发送get请求,回调函数可以访问getResponse()
*@param:url 发送请求的地址
*@param:parameters 发送请求的参数map:{parameterName,parameterValue,parameterName,parameterValue,...}
                      或者为参数字符串，形如：key1=***&key2=***
*@param:execuseResponseFunc 回调函数
*/
Ajax.prototype.sendGetRequest=function(url,paramters,execuseResponseFunc)
{
this._sendRequest("get", url, paramters, execuseResponseFunc);
}


/**
*发送post请求,回调函数可以访问getResponse()
*@param:url 发送请求的地址
*@param:parameters 发送请求的参数map:{parameterName,parameterValue,parameterName,parameterValue,...}
                      或者为参数字符串，形如：key1=***&key2=***
*@param:execuseResponseFunc 回调函数
*/
Ajax.prototype.sendPostRequest=function(url, parameters, execuseResponseFunc)
{
this._sendRequest("post", url, parameters, execuseResponseFunc);
}

Ajax.prototype.toString=function()
{
 return "[parameters of Ajax:"+this.parameters+",url of Ajax:"+this.url+",xmlHttpRequest of Ajax:"
        +this._XMLHttpReq+",response:"+this.getResponse()+"]";
}

//  js/common/search2.js


   var  seatchUrl = "http://search.makepolo.com/sp/";

   function changeStyle(flag) {
       
      
       var ele1 = document.getElementById("tb_head1") ;
	   var ele2 = document.getElementById("tb_head2") ;
	   var ele3 = document.getElementById("tb_head3") ;
	   ele1.className="normaltab_head";
	   ele2.className="normaltab_head";
	   ele3.className="normaltab_head";
       switch (flag) {
	       case 1:
		      ele1.className="hovertab_head";
			  //seatchUrl = "http://search.makepolo.com/s/sp.html?q=";
		      seatchUrl = "http://search.makepolo.com/sp/";
		      document.getElementById('searchType').value=1;
			  break;
		   case 2:
		      ele2.className="hovertab_head";
			  //seatchUrl = "http://search.makepolo.com/s/sc.html?q=";
		      seatchUrl = "http://search.makepolo.com/sc/";
		      document.getElementById('searchType').value=2;
			  break;
		   case 3:
		      ele3.className="hovertab_head";
			  //seatchUrl = "http://search.makepolo.com/s/sq.html?q=";
		      seatchUrl = "http://search.makepolo.com/sq/";
		      document.getElementById('searchType').value=3;
			  break;
	    }
   }
   
   function search() {
       if (document.getElementById("input_01").value == "") {
         document.getElementById("input_01").focus();
         return false;
       }
      var keyword = document.getElementById("input_01").value;
	  window.open(seatchUrl+UrlEncodeGB2312(keyword)+"/");
	  //window.open(seatchUrl+keyword+"&class=");
	  
   }
   
    function clean() {
      var context = document.getElementById("input_01");
      if (context.value == "请输入您要查询的内容")
          context.value="";
      else
          context.focus();
   }
   
   function oo(obj){
      if (obj == "reg_div")
         return parent.document.getElementById(obj);
      else
  	     return typeof(obj)=="string"?document.getElementById(obj):obj
   }


   function hideLayer() {
  	 oo("reg_div").style.display='none';
   }

   function allt(id,e){
       _enterSubmit(e);
       setTimeout("doSearchRelatedKeywords()",10);
   }
   
   function _enterSubmit(e){
    	if(e.keyCode == 13){
    	 search();
    	}
	}

   function doSearchRelatedKeywords() {
		e=oo("input_01");
		var et=e.offsetTop;
		var el=e.offsetLeft;
		while(e=e.offsetParent){
			et+=e.offsetTop;
			el+=e.offsetLeft;
        }
        var parentBodyLeft=parent.document.body.offsetLeft;
		oo("reg_div").style.left=(el+parentBodyLeft) + "px";
		oo("reg_div").style.top=(et+25) + "px"; 
		searchRelatedKeywords(oo("input_01").value);
	}



	function processRelatedKeywords(keywordsHTML) {
		  oo("reg_div").innerHTML=keywordsHTML;
		  oo("reg_div").style.display='';
	}


	function bllt(id) {
		  oo("input_01").value=oo(id).innerHTML
		  oo("reg_div").style.display='none';
	}
	
	

	//    js/common/urlGB2312.js


	function UrlEncodeGB2312(szInput)
{
	var wch,x,uch="",szRet="";
	var strSpecial = " #$%'()*+,/:;<=>?@[\\]^`{|}~%&.";
	//转换特殊的字符&没有包含在里面因为是参数连接符号
	for (x=0; x<szInput.length; x++){
	   wch=vbChar(szInput.charAt(x));
	     if (!(wch & 0xFF80)){
	       if (szRet==32)szRet +="+";
	       else if(strSpecial.indexOf(szInput.charAt(x))>=0)
	                szRet += "%25" + wch.toString(16);
	       else szRet += szInput.charAt(x);
	     }
	     else{
	       uch = "%" + (wch>>8 ).toString(16) + 
	         "%" + (wch & 0xFF).toString(16);
	       szRet += uch; 
	     } 
	}
	
	return(szRet.toUpperCase());
}

//-------------------js/user/authen_layout.js----------------------



    		      function bllt(id) {
                	  var subtext = window.frames['ifrm'].document.getElementById("input_01");
                	  subtext.value = oo(id).innerHTML;
					  reg_div.style.display='none';
					  search();
					  
                  }
                 function search() {
                    
				       if (window.frames['ifrm'].document.getElementById("input_01").value == "") {
				         window.frames['ifrm'].document.getElementById("input_01").focus();
				         return false;
				       }
                 	   var type=window.frames['ifrm'].document.getElementById('searchType').value;
                 	   var keyword = window.frames['ifrm'].document.getElementById("input_01").value;
                 	  
                 	   if(type=="1"){
                 	       location.href="http://search.makepolo.com/sp/"+UrlEncodeGB2312(keyword)+"/"
                 	   	}else if(type=="2"){
                 	   		location.href="http://search.makepolo.com/sc/"+UrlEncodeGB2312(keyword)+"/"
                 	  	}else {
                 	   		location.href="http://search.makepolo.com/sq/"+UrlEncodeGB2312(keyword)+"/"
                 	   	}
				       
				       
				   }
    	
    	
    	
             function  changeHerf() {
            
    	    var d = document.getElementsByTagName("a");
    		for (var i=0;i<d.length;i++) {
    			d[i].href="#";
				d[i].onclick="";
				d[i].target="";
    		}
    		
         }
        
         function    pagedomain(){
       
         	document.domain="makepolo.com";
         }



//----------------------js/common/URLCookie.js-----------------------------------------

function setCookie(sName,sValue,oExpires,sPath,sDomain,bSecure)
{
		var sCookie = sName + "=" + encodeURIComponent(sValue);
		if(oExpires)
			{
				sCookie += "; expires=" + oExpires.toGMTString();
			}
		if(sPath)
			{
				sCookie += "; path=" + sPath;
			}
		if(sDomain)
			{
				sCookie += "; domain=" + sDomain;
			}
		if(bSecure)
			{
				sCookie += "; secue";
			}
		document.cookie=sCookie;
}
var curUrl = window.location.href;

setCookie("curUrl",curUrl);
function getCookie(sName){		
		var sRE = "(?:; )?" + sName + "=([^;]*);?";
		var oRE = new RegExp(sRE);
		if(oRE.test(document.cookie))
			{
				return decodeURIComponent(RegExp["$1"]);
			}
		else
			{	
				return null;
			}
	}
	
	
	 /** 设为首页 */
         
        function setMakepoloHomepage() { 
	if (document.all) {
		document.body.style.behavior = "url(#default#homepage)";
		document.body.setHomePage("http://china.makepolo.com");
	} else {
		if (window.sidebar) {
			if (window.netscape) {
				try {
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				}
				catch (e) {
					alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
				}
			}
			var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref("browser.startup.homepage", "http://china.makepolo.com");
		}
	}
}


/** 添加到收藏夹 */

function AddFavorite(sURL, sTitle)
{

    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
/** 浮动留言窗口用 js 黄页和产品页有 */

function User_FlyMessageOnline(corpid,productId,type)
{

document.getElementById("receiverId").value=productId;
document.getElementById("receiverType").value=type;
document.getElementById("receiverCorpid").value=corpid;

}