/*----------------------------------------------------------------------------\
|                       CECWEB 查询系统业务操作脚本 v1.0                       |
|-----------------------------------------------------------------------------|
| 2006-03-04~2006-03-10 created CECWEB查询操作SOA客户端基本函数     |
|                                                                             |
|-----------------------------------------------------------------------------|
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| This  software is  available under the  three different licenses  mentioned |
| below.  To use this software you must chose, and qualify, for one of those. |
\----------------------------------------------------------------------------*/

/*
 *以下为全局变量
 *  注：全局变量只出现在本JS文件及HTML页面中
 *  tree.getSelected()   ----   即当前选中的分类
 */

var TreeAction = "javascript:void(0);"; //默认的树节点操作
var notree = false;
var call = new WS.Call('/cecws/services/ClassQueryWS');  //WebService 调用服务名
var nsuri = 'http://webservices.query.cecp.com';         //CECWEB 查询的 namespace

//以下为查询配置信息，不随查询操作发生变化
var QueryConfig =
{
  Products_per_Page	: 20,	//每页产品数量
  Header_per_Records	: 20	//每多少行增加一个记录头
};

/*
 * jsPClassTree class
 */
function jsPClassTree(sText, sAction, sBehavior, sIcon, sOpenIcon, sGBID)
{
  this.base = WebFXTree;
  this.base(sText, sAction, sBehavior, sIcon, sOpenIcon);
  this.GBID = sGBID;
  this.dataGot        = false;		//数据是否被从服务器端获取到本地
  this.dataGetting	= false;
}

jsPClassTree.prototype = new WebFXTree;

/*
 * jsPClassItem class
 * 	<ProductClass ClassId="1" ClassName= ClassNo="" ParentId="" ProductsCount="" ChildCount="" PanelCount="" GBIds=""
 * GBNames="" AllPanelCount="" AllProductCount="" ManufacturerCount="" />
 */
function jsPClassItem(sClassName, sAction, eParent, sIcon, sOpenIcon,
 sClassId, sClassNo, sParentId, sProductsCount, sChildCount, sPanelCount, sGBIDs,
 sGBNames, sAllPanelCount, sAllProductCount, sManufacturerCount)
{
  this.base = WebFXTreeItem;
  this.className		= sClassName;		//分类名称
  this.classId		= sClassId;		//分类id
  this.classNo		= sClassNo;		//分类编号
  this.parentid		= sParentId;		//父分类id
  this.productsCount	= sProductsCount;	//关联产品数量
  this.childCount		= sChildCount;		//儿子分类数量
  this.panelCount		= sPanelCount;		//关联模板数量
  this.GBIDs		= sGBIDs;		//关联国标分类id列表
  this.GBNames		= sGBNames;		//关联国际分类名称列表
  this.allPanelCount	= sAllPanelCount;	//所有子孙关联特性模板数量
  this.allProductCount	= sAllProductCount;	//所有子孙关联产品数量
  this.manufacturerCount	= sManufacturerCount;	//关联厂商数量

  this.base(this.GBName + "[" + (this.panelCount|"0") + "/" + (this.allPanelCount|"0") + "]", sAction, eParent, sIcon, sOpenIcon);


  this.dataGot            = false;		//数据是否被从服务器端获取到本地
  this.dataGetting	= false;		//是否在正从服务器获取数据

  if (this.childCount > 0)
  {
    this.add(new jsPClassItem('从服务器端获取子分类'));
  }

  this.click = function() {
  };

  this.showDetail		= function()
  {
    Panels.init();
    getPclassPanelsByProductClassId(this.classId);
    $("nav-main").style.visibility = "hidden";
    $("CurrentPClassInfo").innerHTML =
    "<table border=\"1\" bgcolor=\"#ecf6fc\"><caption>当前选中产品分类信息</caption>" +
    "<tr><td width=\"30%\">分类ID</td><td width=\"15%\">" + this.classId + "</td>" +
    "<td width=\"30%\">分类代码</td><td width=\"15%\">" + this.classNo + "</td></tr>" +
    "<tr><td>分类名称</td><td colspan='3'>" + this.className + "</td></tr>" +
    "</table>";
    $("nav-main").style.visibility = "visible";
  };

  this.showSummary	= function()
  {
    Panels.init();
    getPclassPanelsByProductClassId(this.classId);
    $("nav-main").style.visibility = "hidden";
    $("CurrentPClassInfo").innerHTML =
    '&nbsp;当前分类:' +
    '<span title="分类ID">' + this.classId + '</span> | ' +
    '<span title="分类代码">' + this.classNo + '</span> | ' +
    '<span title="分类名称">' + this.className + '</span> | ' +
    '<span title="关联产品数量">' + this.productsCount + '</span> | ' +
    '<span title="特性模板数量">' + this.panelCount + '</span>' +
    '<br><span><input type="checkbox" id="allclass" value="1" onclick="setsearchconstrant(this)">在所有分类中查询<input type="checkbox" id="childrenclass" value="0">在当前分类的子分类中查询</span>';
    $("nav-main").style.visibility = "visible";
  };

  this.select = function() {
    this.showSummary();
    document.getElementById(this.id + '-anchor').focus();
  };

  this.expand = function()
  {
    if (!this.dataGetting)
    {
      if (! this.dataGot)
      {
        getSubProductClasses(this); //从服务器取得子分类内容
      }
      else
      {
        this.doExpand();
        document.getElementById(this.id + '-plus').src = this.minusIcon;
      }
    }
  };

  this.collapse = function(b)
  {
    if (!this.dataGetting)
    {
      if (! this.dataGot)
      {
        getSubProductClasses(this); //从服务器取得子分类内容
      }
      else
      {
        if (!b) { this.focus(); }
        this.doCollapse();
        document.getElementById(this.id + '-plus').src = this.plusIcon;
      }
    }
  };
}

jsPClassItem.prototype = new WebFXTreeItem;


/*
 * jsGBClassItem class
<GBClasses>
  <GBClass GBID="" ClassId="1" GParentID="" GBName="" GBEName="" GBNO="" FullPath=""
  ClassName= ClassNo="" ManufacturerCount="" ProductsCount="" ChildCount=""
  PanelCount="" AllPanelCount="" AllProductCount=""/>
</GBClasses>
 */
function jsGBClassItem(sGBName, sAction, eParent, sIcon, sOpenIcon,
 sGBID, sGParentID, sGBEName, sGBNO, sFullPath, sClassId, sClassNo,
 sClassName, sProductsCount, sChildCount, sPanelCount, sAllPanelCount,
 sAllProductCount, sManufacturerCount)
{
  this.base = WebFXTreeItem;
  this.GBName		= sGBName;		//国标分类名称
  this.GBID		= sGBID;		//国标分类id
  this.GBIDs		= sGBID;		//国标分类id
  this.GParentID		= sGParentID;		//国标父分类id
  this.GBEName		= sGBEName;		//国标分类英文名称
  this.GBNO		= sGBNO;		//国标分类编号
  this.FullPath		= sFullPath;		//国际分类路陉
  this.ClassId		= sClassId;		//自分类id
  this.ClassNo		= sClassNo;		//自分类编号
  this.ClassName		= sClassName;		//自分类编号
  this.ProductsCount	= sProductsCount;	//关联产品数量
  this.ChildCount		= sChildCount;		//儿子分类数量
  this.PanelCount		= sPanelCount;		//关联模板数量
  this.AllPanelCount	= sAllPanelCount;	//所有子孙关联特性模板数量
  this.AllProductCount	= sAllProductCount;	//所有子孙关联产品数量
  this.ManufacturerCount	= sManufacturerCount;	//关联厂商数量

//	this.base(this.GBName + "[" + (this.PanelCount|"0") + "/" + (this.AllPanelCount|"0") + "]", sAction, eParent, sIcon, sOpenIcon);
  this.base(this.GBName + "[" + (this.ProductsCount|"0") + "/" + (this.AllProductCount|"0") + "]", sAction, eParent, sIcon, sOpenIcon);


  this.dataGot            = false;		//数据是否被从服务器端获取到本地
  this.dataGetting	= false;		//是否在正从服务器获取数据

  if ((notree == false) && (this.ChildCount > 0))
  {
    this.add(new jsGBClassItem('从服务器端获取子分类'));
  }

  this.click = function() {
    this.select();
  };

  this.showDetail		= function()
  {
    Panels.init();
    getPclassPanelsByGBClassIds(this.GBIDs);
    $("nav-main").style.visibility = "hidden";
    $("CurrentPClassInfo").innerHTML =
    "<table border=\"1\" bgcolor=\"#ecf6fc\"><caption>当前选中产品分类信息</caption>" +
    "<tr><td width=\"30%\">分类ID</td><td width=\"15%\">" + this.GBID + "</td>" +
    "<td width=\"30%\">分类代码</td><td width=\"15%\">" + this.GBNO + "</td></tr>" +
    "<tr><td>分类名称</td><td colspan='3'>" + this.GBName + "</td></tr>" +
    "</table>";
    $("nav-main").style.visibility = "visible";
  };

  this.showSummary	= function()
  {
    Panels.init();
    $('hPanelContent').innerHTML = "";
    getPclassPanelsByGBClassIds(this.GBIDs);
    $("nav-main").style.visibility = "hidden";
    $("CurrentPClassInfo").innerHTML =
    '&nbsp;当前分类:' +
    '<span title="分类ID">' + this.GBID + '</span> | ' +
    '<span title="分类代码">' + this.GBNO + '</span> | ' +
    '<span title="分类名称">' + this.GBName + '</span> | ' +
    '<span title="关联产品数量">' + this.ProductsCount + '</span> | ' +
    '<span title="特性模板数量">' + this.PanelCount + '</span>' +
    '<br><span><input type="checkbox" id="allclass" value="1" onclick="setsearchconstrant(this)">在所有分类中查询<input type="checkbox" id="childrenclass" value="1">在当前分类的子分类中查询</span>';
    $("nav-main").style.visibility = "visible";
  };



  this.select = function() {
    this.showSummary();
    document.getElementById(this.id + '-anchor').focus();
  };

  this.expand = function()
  {
    if (!this.dataGetting)
    {
      if (! this.dataGot)
      {
        getSubGBClasses(this); //从服务器取得子分类内容
      }
      else
      {
        this.doExpand();
        document.getElementById(this.id + '-plus').src = this.minusIcon;
      }
    }
  };

  this.collapse = function(b)
  {
    if (!this.dataGetting)
    {
      if (! this.dataGot)
      {
        getSubGBClasses(this); //从服务器取得子分类内容
      }
      else
      {
        if (!b) { this.focus(); }
        this.doCollapse();
        document.getElementById(this.id + '-plus').src = this.plusIcon;
      }
    }
  };
}

jsGBClassItem.prototype = new WebFXTreeItem;

/*
 * 将一个DOMNode节点形式的国标子分类插入到一个树节点上
 * Ptree     ----  jsPClassItem
 * subclass  ----  DOM Node 格式 的国标分类信息节点
function jsGBClassItem(sGBName, sAction, eParent, sIcon, sOpenIcon,
 sGBID, sGParentID, sGBEName, sGBNO, sFullPath, sClassId, sClassNo,
 sClassName, sProductsCount, sChildCount, sPanelCount, sAllPanelCount,
 sAllProductCount, sManufacturerCount)
 */
function insertGBClass(Ptree, subclass)
{
    var node = new jsGBClassItem(
      subclass.getAttribute("GBName"),
      TreeAction,
      "",
      "",
      "",
      subclass.getAttribute("GBID"),
      subclass.getAttribute("GParentID"),
      subclass.getAttribute("GBEName"),
      subclass.getAttribute("GBNO"),
      subclass.getAttribute("FullPath"),
      subclass.getAttribute("ClassId"),
      "", //subclass.getAttribute("ClassNo"),
      "", //subclass.getAttribute("ClassName"),
      "", //subclass.getAttribute("ProductsCount"),
      subclass.getAttribute("ChildCount"),
      "", //subclass.getAttribute("PanelCount"),
      "", //subclass.getAttribute("AllPanelCount"),
      "" //subclass.getAttribute("AllProductCount")
      //subclass.getAttribute("ManufacturerCount")
    )
  Ptree.add(node);
}

/*
 * 得到顶级国标分类,并将得到的元素，放到树tree上
 */
function getTopLevelGBClasses()
{
  var qn_op = new WS.QName('getTopLevelGBClasses',nsuri);
  var qn_op_resp = new WS.QName('getTopLevelGBClassesReturn',nsuri);
  call.invoke_rpc(
    qn_op,
    new Array(), //无参数
    null,
    function(call,envelope)
    {
  //$('soap').innerHTML = argument[2];
  var xmlDoc = XmlDocument.create();
  xmlDoc.async = false;
  xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());  //.replace('UTF-8','GBK')
  var allClasses = xmlDoc.documentElement.selectSingleNode("//GBClasses");
  var subclass;
  for(var i=0; i < allClasses.childNodes.length; i++)
  {
    subclass = allClasses.childNodes[i];
    insertGBClass(tree, subclass);
  }
  //tree.indent();
    }
  );
}


/*
 * 根据传入的产品分类节点获得该分类的子分类，并动态插到树中
 */
function getSubGBClasses(Ptree)
{
  $("hPanelMenu").innerHTML = "当前产品分类没有关联参数模板";
  $("hPanelContent").innerHTML = "请选择上面的参数模板";
  Ptree.dataGetting = true;
  var qn_op = new WS.QName('getSubGBClasses',nsuri);
  var qn_op_resp = new WS.QName('getSubGBClassesReturn',nsuri);
  call.invoke_rpc(
    qn_op,
    new Array(
        {name:'classid',value:Ptree.GBID} //查询的参数 父分类Id
    ),null,
    function(call,envelope)
    {
  var xmlDoc = XmlDocument.create();
  xmlDoc.async = false;
  xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value()); //.replace('UTF-8','GBK'))
  var allClasses = xmlDoc.documentElement.selectSingleNode("//GBClasses");
  var subclass;
  for(var i=0; i < allClasses.childNodes.length; i++)
  {
    subclass = allClasses.childNodes(i);
    insertGBClass(Ptree, subclass); //插入节点，但不立刻刷新
  }
  Ptree.indent();
  Ptree.getFirst().remove(); //删除预放入的一个假节点
  Ptree.dataGot = true;
  Ptree.dataGetting = false;
  Ptree.expand();
    }
  );
}



/*
 * 将一个DOMNode节点形式的子分类插入到一个树节点上
 * Ptree     ----  jsPClassItem
 * subclass  ----  DOM Node 格式 的分类信息节点
 * bNoIndent ----  是否不立刻刷新 true|false
 */
function insertProductClass(Ptree, subclass, bNoIndent)
{
  Ptree.add(
    new jsPClassItem(
      subclass.getAttribute("ClassName"),
      TreeAction,
      "",
      "",
      "",
      subclass.getAttribute("ClassId"),
      subclass.getAttribute("ClassNo"),
      subclass.getAttribute("ParentId"),
      subclass.getAttribute("ProductsCount"),
      subclass.getAttribute("ChildCount"),
      subclass.getAttribute("PanelCount"),
      subclass.getAttribute("GBIds"),
      subclass.getAttribute("GBNames"),
      subclass.getAttribute("AllPanelCount"),
      subclass.getAttribute("AllProductCount"),
      subclass.getAttribute("ManufacturerCount")
    ),bNoIndent
  );
}



/*
 * 得到顶级分类,并将得到的元素，放到树tree上
 */
function getTopLevelProductClasses()
{
  var qn_op = new WS.QName('getTopLevelProductClasses',nsuri);
  var qn_op_resp = new WS.QName('getTopLevelProductClassesReturn',nsuri);
  call.invoke_rpc(
    qn_op,
    new Array(), //无参数
    null,
    function(call,envelope)
    {
  var xmlDoc = XmlDocument.create();
  xmlDoc.async = false;
  xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());  //.replace('UTF-8','GBK')
  var allClasses = xmlDoc.documentElement.selectSingleNode("//ProductClasses");
  var subclass;
  for(var i=0; i < allClasses.childNodes.length; i++)
  {
    subclass = allClasses.childNodes[i];
    insertProductClass(tree, subclass);
  }
  //$('soap').innerHTML = argument[2];
  //tree.indent();
    }
  );
}


/*
 * 根据传入的产品分类节点获得该分类的子分类，并动态插到树中
 */
function getSubProductClasses(Ptree)
{
  Ptree.dataGetting = true;
  var qn_op = new WS.QName('getSubProductClasses',nsuri);
  var qn_op_resp = new WS.QName('getSubProductClassesReturn',nsuri);
  call.invoke_rpc(
    qn_op,
    new Array(
        {name:'classid',value:Ptree.classId} //查询的参数 父分类Id
    ),null,
    function(call,envelope)
    {
  var xmlDoc = XmlDocument.create();
  xmlDoc.async = false;
  xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value()); //.replace('UTF-8','GBK'))
  var allClasses = xmlDoc.documentElement.selectSingleNode("//ProductClasses");
  var subclass;
  for(var i=0; i < allClasses.childNodes.length; i++)
  {
    subclass = allClasses.childNodes(i);
    insertProductClass(Ptree, subclass, true); //插入节点，但不立刻刷新
  }
  Ptree.indent();
  Ptree.getFirst().remove(); //删除预放入的一个假节点
  Ptree.dataGot = true;
  Ptree.dataGetting = false;
  Ptree.expand();
    }
  );
}


/*---------------------------------------------------------------------------------------------------------------
 产品对象类及产品集合类定义
 从服务器端获得数据库客户端并显示到页面
---------------------------------------------------------------------------------------------------------------*/
/*
 * 产品列表对象类
 * <products start="" count="" page="" end="Y|N" total="">
 *	<product ProductID="" ManufacturerName="" ProductName="" Model=""
 *	SimilarModel="" Standard="" Certificate="" Description="" KeyWords=""
 *	EncapsulatStyle="" ProducingArea="" TemperatureLow="" TemperatureHeigh="" CreateTime="" UpdateTime="" />
 * </products>
 */
function Product(sProductID, sManufacturerID, sManufacturerName, sProductName, sModel, sSimilarModel, sStandard,
sCertificate, sDescription, sEncapsulatStyle, sProducingArea,  sTemperatureLow, sTemperatureHeigh,
sBrandWords, sPrice, sIsPiece, sForUse, sEncapsulatSize, sReplaceModel, sPDFID,
sPanelid,
sPara1,sPara2,sPara3,sPara4,sPara5,sPara6,sPara7,sPara8,sPara9,sPara10,
sPara11,sPara12,sPara13,sPara14,sPara15,sPara16,sPara17,sPara18,sPara19,sPara20,
sPara21,sPara22,sPara23,sPara24,sPara25,sPara26,sPara27,sPara28,sPara29,sPara30,
// 08-03-11
sPara31,sPara32,sPara33,sPara34,sPara35,sPara36,sPara37,sPara38,sPara39,sPara40
 )
{
  this.base 		= WebFXTreeItem;		//基于树型结构
  this.ProductID		= sProductID;
  this.ManufacturerID = sManufacturerID;
  this.ManufacturerName	= sManufacturerName;
  this.ProductName	= sProductName;
  this.Model		= sModel;
   this.SimilarModel	= sSimilarModel;
   this.Standard		= sStandard;
   this.Certificate	= sCertificate;
   this.Description	= sDescription;
   this.EncapsulatStyle	= sEncapsulatStyle;
   this.ProducingArea	= sProducingArea;
   this.TemperatureLow	= sTemperatureLow;
   this.TemperatureHeigh	= sTemperatureHeigh;
  this.BrandWords = sBrandWords;
  this.Price = sPrice;
  this.IsPiece = sIsPiece;
  this.ForUse = sForUse;
   this.EncapsulatSize	= sEncapsulatSize;
  this.ReplaceModel = sReplaceModel;
  this.PDFID = sPDFID;

  this.params		= [];

  this.para1		= sPara1;
  this.para2		= sPara2;
  this.para3		= sPara3;
  this.para4		= sPara4;
  this.para5		= sPara5;
  this.para6		= sPara6;
  this.para7		= sPara7;
  this.para8		= sPara8;
  this.para9		= sPara9;
  this.para10		= sPara10;
  this.para11		= sPara11;
  this.para12		= sPara12;
  this.para13		= sPara13;
  this.para14		= sPara14;
  this.para15		= sPara15;
  this.para16		= sPara16;
  this.para17		= sPara17;
  this.para18		= sPara18;
  this.para19		= sPara19;
  this.para20		= sPara20;
  this.para21		= sPara21;
  this.para22		= sPara22;
  this.para23		= sPara23;
  this.para24		= sPara24;
  this.para25		= sPara25;
  this.para26		= sPara26;
  this.para27		= sPara27;
  this.para28		= sPara28;
  this.para29		= sPara29;
  this.para30		= sPara30;
// 08-03-11
  this.para31		= sPara31;
  this.para32		= sPara32;
  this.para33		= sPara33;
  this.para34		= sPara34;
  this.para35		= sPara35;
  this.para36		= sPara36;
  this.para37		= sPara37;
  this.para38		= sPara38;
  this.para39		= sPara39;
  this.para40		= sPara40;
  this.panelid    = sPanelid;
    this.selected   = false; //未选择
   this.notified		= false;	//是否发布到页面

  this.base(this.ProductName);

  this.parent		= null;

   this.toString		= function ()  //输出概要信息
   {
    var desc = ""
    var temp = ""
    if ((!this.TemperatureLow || this.TemperatureLow.length == 0) && (!this.TemperatureHeigh || this.TemperatureHeigh.length == 0))
    {temp = "不详";
    }

    if ((this.TemperatureLow.length > 0) && (!this.TemperatureHeigh || this.TemperatureHeigh.length == 0))
    {temp = "高于" + this.TemperatureLow + "℃";
    }

    if ((this.TemperatureHeigh.length >0) && (!this.TemperatureLow || this.TemperatureLow.length ==0))
    {temp = "低于" + this.TemperatureHeigh + "℃";
    }

    if ((this.TemperatureLow.length > 0) && (this.TemperatureHeigh.length > 0))
    {temp = this.TemperatureLow + "℃～" + this.TemperatureHeigh + "℃";
    }

    if (!this.Description || this.Description.length ==0)
    {desc = "<tr height=\"20\"><td colspan=\"7\">特点：未提供</td></tr>"
    }else
    {desc = "<tr height=\"20\"><td colspan=\"7\">特点：" + this.Description + "</td></tr>"
    }

     var str =
    "<tr height=\"20\"" + (this.IsOdd?"class=\"odd\"":"") + " id=\"" + Products.trprefix + this.ProductID + "\">" +
       "<td rowspan=\"2\" scope=\"row\" align=\"center\"><input type=\"checkbox\" id=\"pchk_" + this.ProductID + "\" name=\"productscheckbox\" value=\"1\" onclick=\"flashcontrastbutton('" + this.ProductID + "')\"/><br><input type=\"button\" id=\"contrastbutton_" + this.ProductID + "\" name=\"contrast\" onclick=\"javascript:showProductDetailPage(Products.getPids(),Panels.currentpanelid)\" value=\"比较\" disabled=\"true\"/></td>" +
     "<td bgcolor=\"#efefef\">" + this.Model + "</td>" +
     "<td bgcolor=\"#efefef\"><a href=\"#\" onclick=showProductDetailPage(\"'"+this.ProductID+"'\",'" + this.panelid + "')>" + this.ProductName + "</a></td>" +
//        "<td bgcolor=\"#efefef\"><a href=javascript:showManuDetail(" + this.ManufacturerID + ")>" + this.ManufacturerName + "</a></td>" +
      "<td bgcolor=\"#efefef\">" + this.Certificate + "</td>" +
      "<td bgcolor=\"#efefef\">" + this.EncapsulatStyle + "</td>" +
      "<td bgcolor=\"#efefef\">" + temp + "</td>" +
      "<td bgcolor=\"#efefef\">" + this.ProducingArea + "</td>" +
	  "<td bgcolor=\"#efefef\" align=\"center\"><a href=\"/html/dialog_1.htm\" target=\"_blank\">在线询价</a>" + "</td>" +
       "<td rowspan=\"2\" scope=\"row\" aligh=\"center\"><center><input type=\"checkBox\" id=\"add"+ this.ProductID +"\" onclick=\"addOrder(this.checked,'"+ this.ProductID +"','"+ this.ManufacturerID +"','"+ this.ManufacturerName + "','"+this.ProductName+"','"+ this.Model + "')\"/><br><a href=\"javascript:showShopping()\">询价</a></center></td>" +
        "</tr>"  +	desc;
      return str;


   };

 	//显示详细信息
 	this.showDetail		= function()
 	{
 		this.getProductById();
 		var str =
 		"<table>" +
 		"<tr><td align=\"right\" width=\"100\">产品ID</td><td>" + this.ProductID + "</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">产品名称</td><td>" + this.ProductName + "</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">产品型号</td><td>" + this.Model + "</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">相近型号</td><td>" + this.SimilarModel + "</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">生产厂商</td><td>" + "<a href=\"/html/dialog_1.htm\" target=\"_blank\">在线询价</a>" + "</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">产地</td><td>" + this.ProducingArea + "</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">标准</td><td>" + this.Standard + "</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">认证</td><td>" + this.Certificate + "</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">包装方式</td><td>" + this.EncapsulatStyle + "</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">工作温度</td><td>" + this.TemperatureLow + "℃～" + this.TemperatureHeigh + "℃</td></tr>" +
 		"<tr><td align=\"right\" width=\"100\">说明</td><td>" + this.Description + "</td></tr>" +
 		this.params2string() +
 		"</table>";
 		return str;
 	};

 	this.params2string	= function()
 	{
		var str	= "";
		var i;
		for(var i=0; i < this.params.length; i++)
		{
			str = str + this.params[i].toString();
		}
		return str;
 	};

 	this.notify		= function()
 	{
 		this.notified	= true;
 	};
 	this.getProductById	= function()
 	{
		var qn_op = new WS.QName('getProductById',nsuri);
		var qn_op_resp = new WS.QName('getProductByIdReturn',nsuri);
		call.invoke_rpc(
			qn_op,
			new Array(
			{name:'ProductId',value:this.ProductId} //查询的参数 父分类Id
			),null,
			function(call,envelope)
			{
//				$('soap').innerHTML = arguments[2];
				var xmlDoc = XmlDocument.create();
				xmlDoc.async = false;
				xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value()); //.replace('UTF-8','GBK'))
				var allClasses = xmlDoc.documentElement.selectSingleNode("//Products");
				var subclass;
				for(var i=0; i < allClasses.childNodes.length; i++)
				{
					subclass = allClasses.childNodes(i);
					//insertProductClass(Ptree, subclass, true); //插入节点，但不立刻刷新
				}
			}
		);
 	};
}

Product.prototype = new WebFXTreeItem;


/*
 * 产品列表对象类
 * <products start="" count="" page="" end="Y|N" total="">
 *	<product ProductID="" ManufacturerName="" ProductName="" Model=""
 *	SimilarModel="" Standard="" Certificate="" Description="" KeyWords=""
 *	EncapsulatStyle="" ProducingArea="" TemperatureLow="" TemperatureHeigh=""
 *	CreateTime="" UpdateTime="" ProductClass="" GBClass=""/>
 * </products>
 */
var Products	=
{
	id		: "_products",
	listid		: "_products_list",
	pageno		: 1,	//页号
	count		: 0,	//记录总数
	total		: 0,
	startrecord	: 0,	//起始记录
	end		: "Y",
	trprefix	: "product_item_",
	distilling	: false,	//是否正在提取数据
	tmpwhere	: "",		//临时执行的条件
	swhere		: "",
	sorderby	: "",
	className	: "",
	products	: [],
	getPids     : function()
	{
	    var pids = "";
	    var p,j;
	    j = 0;
		for (var i=0; i < this.products.length; i++)
		{
		    p = this.products[i];
			if (p.selected)
			{
    		    if (j > 0) pids = pids + ",";
				pids = pids + "'" + p.ProductID + "'";
    			j = j*1.0 + 1*1.0;
			}
		}
	    return pids;
	},
	getPidcount     : function()
	{
	    var pidcnt = 0;
	    var p;
		for (var i=0; i < this.products.length; i++)
		{
		    p = this.products[i];
			if (p.selected)
			{
				pidcnt = pidcnt*1.0 + 1*1.0;
			}
		}
	    return pidcnt;
	},
	notified	: false,
	timer		: null,
	getCondition	: function ()
	{
		var condition =
			'<query name="getProducts">' +
			'<pagination start="' + ((this.pageno - 1) * QueryConfig.Products_per_Page ) + '" count="' + QueryConfig.Products_per_Page + '" />' +
			'<table name="Products">' +
			'<where>'+
			this.swhere +
			'</where>';
		if (this.sorderby.length > 0)
		{
			condition = condition +
			'<orderby>' +
			this.sorderby +
			'</orderby>';
		}
		condition = condition + "</table></query>";
		return condition;
	},		//根据当前页数、是指目前页面已经执行成功的查询条件
	/*
	 * 将一个DOMNode节点形式的产品插入到产品树中
	 * 2006.03.08 created
	 * 2006.03.11 将原来的function insertProduct(subclass, bNoIndent)改为Products.insert()
	 */
	insert		: function (subclass)
	{
		this.products[this.products.length] = new Product(
			subclass.getAttribute("ProductID"),
			subclass.getAttribute("ManufacturerID"),
			subclass.getAttribute("ManufacturerName"),
			subclass.getAttribute("ProductName"),
			subclass.getAttribute("Model"),
			subclass.getAttribute("SimilarModel"),
			subclass.getAttribute("Standard"),
			subclass.getAttribute("Certificate"),
			subclass.getAttribute("Description"),
			subclass.getAttribute("EncapsulatStyle"),
			subclass.getAttribute("ProducingArea"),
			subclass.getAttribute("TemperatureLow"),
			subclass.getAttribute("TemperatureHeigh"),
			subclass.getAttribute("BrandWords"),
			subclass.getAttribute("Price"),
			subclass.getAttribute("IsPiece"),
			subclass.getAttribute("ForUse"),
			subclass.getAttribute("EncapsulatSize"),
			subclass.getAttribute("ReplaceModel"),
			subclass.getAttribute("PDFID"),
			subclass.getAttribute("PanelKind")
		);
	},
	insertDetail	: function (subclass)
	{
		this.products[this.products.length] = new Product(
			subclass.getAttribute("ProductID"),
			subclass.getAttribute("ManufacturerID"),
			subclass.getAttribute("ManufacturerName"),
			subclass.getAttribute("ProductName"),
			subclass.getAttribute("Model"),
			subclass.getAttribute("SimilarModel"),
			subclass.getAttribute("Standard"),
			subclass.getAttribute("Certificate"),
			subclass.getAttribute("Description"),
			subclass.getAttribute("EncapsulatStyle"),
			subclass.getAttribute("ProducingArea"),
			subclass.getAttribute("TemperatureLow"),
			subclass.getAttribute("TemperatureHeigh"),
			subclass.getAttribute("BrandWords"),
			subclass.getAttribute("Price"),
			subclass.getAttribute("IsPiece"),
			subclass.getAttribute("ForUse"),
			subclass.getAttribute("EncapsulatSize"),
			subclass.getAttribute("ReplaceModel"),
			subclass.getAttribute("PDFID"),
			subclass.getAttribute("PanelKind"),

			subclass.getAttribute("Para1"),
			subclass.getAttribute("Para2"),
			subclass.getAttribute("Para3"),
			subclass.getAttribute("Para4"),
			subclass.getAttribute("Para5"),
			subclass.getAttribute("Para6"),
			subclass.getAttribute("Para7"),
			subclass.getAttribute("Para8"),
			subclass.getAttribute("Para9"),
			subclass.getAttribute("Para10"),
			subclass.getAttribute("Para11"),
			subclass.getAttribute("Para12"),
			subclass.getAttribute("Para13"),
			subclass.getAttribute("Para14"),
			subclass.getAttribute("Para15"),
			subclass.getAttribute("Para16"),
			subclass.getAttribute("Para17"),
			subclass.getAttribute("Para18"),
			subclass.getAttribute("Para19"),
			subclass.getAttribute("Para20"),
			subclass.getAttribute("Para21"),
			subclass.getAttribute("Para22"),
			subclass.getAttribute("Para23"),
			subclass.getAttribute("Para24"),
			subclass.getAttribute("Para25"),
			subclass.getAttribute("Para26"),
			subclass.getAttribute("Para27"),
			subclass.getAttribute("Para28"),
			subclass.getAttribute("Para29"),
			subclass.getAttribute("Para30"),
// 08-03-11
			subclass.getAttribute("Para31"),
			subclass.getAttribute("Para32"),
			subclass.getAttribute("Para33"),
			subclass.getAttribute("Para34"),
			subclass.getAttribute("Para35"),
			subclass.getAttribute("Para36"),
			subclass.getAttribute("Para37"),
			subclass.getAttribute("Para38"),
			subclass.getAttribute("Para39"),
			subclass.getAttribute("Para40")			
		);
	},
	init	: function()
	{
		this.products		= [];
		this.pageno		= 1;
		this.count		= 0;
		this.startrecord	= 0;
		this.end		= "N";
	},
	firstPage	: function ()
	{
		waitDiv();
		if (this.pageno != 1) { this.pageno = 1; }
		this.search();
	},
	prevPage	: function ()
	{
		waitDiv();
		if (this.pageno > 1) { this.pageno = this.pageno * 1.0 - 1.0 * 1; }
		this.search();
	},
	nextPage	: function ()
	{
		waitDiv();
		if (this.end !="Y")
		{
			this.pageno = this.pageno * 1.0 + 1.0 * 1;
		}
		this.search();
	},
	lastPage	: function ()
	{
		waitDiv();
		if (this.end !="Y")
		{
			this.pageno = Math.ceil(this.total / QueryConfig.Products_per_Page);
		}

		this.search();
	},

	gotoPage	:function() //added by leeking on 20060810
	{
		var gotoPageTxt = window.document.getElementById("gotoPageTxtId");
		var gotoPageNum = gotoPageTxt.value;
		if(!gotoPageNum.match(/^[1-9][0-9]*$/)){
					alert("请输入正确的页码！");
					return;
				}
				else if(gotoPageNum>Math.ceil(this.total / QueryConfig.Products_per_Page) ){
					alert("请输入正确的页码！");
					return;
				}
				else if(gotoPageNum<1){
					alert("请输入正确的页码！");
					return;
				}
		waitDiv();
		this.pageno = gotoPageNum;
		this.search();
	}
	,

	notify	: function()
	{
		var p;
		for (p in this.products)
		{
			if (! p.notified)
			{
				//this.
			}
		}
		this.notified	= true;
	},
	find		: function(pid)
	{
		var i;
		for(var i=0; i < this.products.length; i++)
		{
			if (this.products[i].ProductID == pid)
			{
				return this.products[i];
			}
		}
	},
	//add by lee 10-11			'<th width="60">????</th>' +
	header 		:
	  '<tr>' +
	    '<th width="40">比较</th>' +
	    '<th width="120" scope="col">产品型号</th>' +
		'<th width="220" scope="col">产品名称</th>' +
	    '<th width="120" scope="col">认证</th>' +
	    '<th width="60" scope="col">包装</th>' +
	    '<th width="110" scope="col">工作温度</th>' +
	    '<th width="60" scope="col">产地</th>' +
	    '<th width="60" scope="col">在线询价</th>' +
	    '<th width="60" scope="col">离线询价</th>' +
		'</tr>',
	toString	: function()
	{
		var str = '<table width="810" border="1" cellspacing="0" cellpadding="0">' +
		  this.list2string() +
		'</table>';

		var pagination = '<table width="810" border="0"><tr bgcolor="#3366af"><td align="left" valign="middle"><font color="#ffffff">&nbsp;&nbsp;★ 点击复选框可对同类产品进行比较</font></td><td align="right" valign="middle"><font color="#ffffff">' +
		    '共 ' + this.total + '条&nbsp;&nbsp;' + this.pageno + '/' + Math.ceil(this.total / QueryConfig.Products_per_Page) + '页 ' +
		    '</font>&nbsp;&nbsp;' + ((this.pageno > 1) ? '<a href="#" onclick="javascript:Products.firstPage();"><font color="#ffffff">第一页</font></a>' : '<font color="#ffffff"> 第一页</font>') +
		    '&nbsp;&nbsp;' + ((this.pageno > 1) ? '<a href="#" onclick="javascript:Products.prevPage();"><font color="#ffffff">前一页</font></a>' : ' <font color="#ffffff">前一页</font>') +
		    '&nbsp;&nbsp;' + ((this.end != "Y") ? '<a href="#" onclick="javascript:Products.nextPage();"><font color="#ffffff">后一页</font></a>' : ' <font color="#ffffff">后一页</font>') +
		    '&nbsp;&nbsp;' + ((this.end != "Y") ? '<a href="#" onclick="javascript:Products.lastPage();"><font color="#ffffff">最后一页</font></a>' : ' <font color="#ffffff">最后一页</font>') + 
			'&nbsp;&nbsp;<font color="#ffffff">转到：</font>'+'<input id="gotoPageTxtId" name="gotoPageTxt" type="text" size="4"/>&nbsp;<a href="#" onclick="javascript:Products.gotoPage();"><font color="#ffffff">Go</font></a>' +  //added by leeking
			'</td><tr></table>';

		return  '<table width="810" border="1"><tr><td align="center" bgcolor="#ddeeff"><strong>电子元器件产品查询结果</strong></td><tr></table><br>' + str + pagination;
	},
	list2string	: function()
	{
		var str	= "";
		var i;
		for(var i=0; i < this.products.length; i++)
		{
			if ((i % QueryConfig.Header_per_Records) == 0) str = str + this.header;
			str = str + this.products[i].toString();
		}
		return str;
	},
	show		: function()
	{
		if (this.distilling)
		{
			this.timer	= setTimeout("Products.show()",50);
		}
		else
		{
			clearTimeout(this.timer);
			$('contents').innerHTML	= this.toString();
		}
	},
	/*
	 * 根据查询条件获得当前选中分类中的元件列表
	 * 2006.03.07 created
	 * 2006.03.11 由独立的外部方法searchProducts(condition)改为Products.search();
<?xml version="1.0" encoding="UTF-8"?>
<products count="2" end="Y" page="1" start="1" total="3">
<product Certificate="" CreateTime="Fri Jan 06 09:32:21 CST 2006" Description="" EncapsulatStyle="" KeyWords="" ManufacturerName="&#x5317;&#x4EAC;&#x9A6C;&#x53EF;&#x5C3C;&#x901A;&#x4FE1;&#x6280;&#x672F;&#x6709;&#x9650;&#x516C;&#x53F8;" Model="aa" PanelKind="" ProducingArea="aa" ProductID="4400000015" ProductName="aaa" SimilarModel="" Standard="" TemperatureHeigh="0.0" TemperatureLow="0.0" UpdateTime=""/>
</products>

	 * 	 * 返回格式
	 * <products start="" count="" page="" end="Y|N" total="">
	 *	<product ProductID="" ManufacturerName="" ProductName="" Model=""
	 *	SimilarModel="" Standard="" Certificate="" Description="" KeyWords=""
	 *	EncapsulatStyle="" ProducingArea="" TemperatureLow="" TemperatureHeigh="" CreateTime="" UpdateTime="" />
	 * </products>
	 *
	 */
	search		: function()
	{
		if (this.distilling) { return; }
		this.distilling	= true;
		var qn_op = new WS.QName('searchProducts',nsuri);
		var qn_op_resp = new WS.QName('searchProductsReturn',nsuri);
		call.invoke_rpc
		(
			qn_op,
			new Array(
				{name:'condition',value:this.getCondition()}
			),null,
			function(call,envelope)
			{
				var xmlDoc = XmlDocument.create();
				xmlDoc.async = false;
				xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());
				var allClasses = xmlDoc.documentElement.selectSingleNode("//products");
				var i;
				Products.start	= allClasses.getAttribute("start");
				Products.count	= allClasses.getAttribute("count");
				Products.pageno	= allClasses.getAttribute("page")*1.0 + 1.0*1;//modified by zhou
				Products.total	= allClasses.getAttribute("total");
				Products.end	= allClasses.getAttribute("end");
				Products.products = [];
				for(var i=0; i < allClasses.childNodes.length; i++)
				{
					Products.insert(allClasses.childNodes(i)); //插入节点
				}
				Products.distilling	= false;
				$('contents').innerHTML	= Products.toString();
				
				//add by lee 09-13	异步数据到达后隐藏数据显示层;				
				document.getElementById("alertDiv").style.visibility = "hidden";
				//end	
			}
		);
	},
	searchinnewpage		: function(pcond)
	{
		var f	= $('productlistform');
		f.condition.value	= pcond;
		//alert("f.condition.value : " + f.condition.value);
		f.submit();
	},
	//根据id列表，获得产品的详细信息，包含
	getProductByIds		: function(pids)
	{
		var qn_op	= new WS.QName('getProductByIds',nsuri);
		var qn_op_resp	= new WS.QName('getProductByIdsReturn',nsuri);
		call.invoke_rpc
		(
			qn_op,
			new Array(
				{name:'productId',value:pids}
			),null,
			function(call,envelope)
			{
//				$('soap').innerHTML = arguments[2];
				var xmlDoc = XmlDocument.create();
				xmlDoc.async = false;
				xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());
				var allClasses = xmlDoc.documentElement.selectSingleNode("//products");
				var i;
				Products.products = [];
				for(var i=0; i < allClasses.childNodes.length; i++)
				{
					Products.insertDetail(allClasses.childNodes(i)); //插入节点
				}
				var pcstr = '<p align="center"><b>电子元器件产品详细信息与特性比较</p></b><br><table id="pdtdetltable" width="980">'; //border="1" cellspacing="0" cellpadding="0"
				pcstr = pcstr + "<tr><td align=left colspan=\"100\" bgcolor=\"#ddeeff\"><strong>产品基本信息</strong></td></tr>";
                pcstr = pcstr + "<tr><td align=right width=100>产品型号</td>" + Products.getModelValues("Model", "td") + "</tr>";
				pcstr = pcstr + "<tr><td align=right width=100>产品名称</td>" + Products.getValuesByProperty("ProductName","","td") + "</tr>";
				//pcstr = pcstr + "<tr><td align=right width=100>生产厂商</td>" + "<td><a href=\"/html/dialog_1.htm\" target=\"_blank\">在线询价</a></td>" + "</tr>";
                pcstr = pcstr + "<tr><td align=right width=100>生产厂商</td>" + Products.getPropertyValuesWithLink("ManufacturerName","", "td") + "</tr>";
                pcstr = pcstr + "<tr><td align=right width=100>商标文字</td>" + Products.getValuesByProperty("BrandWords","", "td") + "</tr>";
				pcstr = pcstr + "<tr><td align=right width=100>技术标准</td>" + Products.getValuesByProperty("Standard","", "td") + "</tr>";
                pcstr = pcstr + "<tr><td align=right width=100>认证信息</td>" + Products.getValuesByProperty("Certificate","", "td") + "</tr>";
                pcstr = pcstr + "<tr><td align=right width=100>产　　地</td>" + Products.getValuesByProperty("ProducingArea","", "td") + "</tr>";
                pcstr = pcstr + "<tr><td align=right width=100>参考价格</td>" + Products.getValuesByProperty("Price","", "td") + "</tr>";
                pcstr = pcstr + "<tr><td align=right width=100>包装方式</td>" + Products.getValuesByProperty("EncapsulatStyle","", "td") + "</tr>";
                pcstr = pcstr + "<tr><td align=right width=100>封装代码</td>" + Products.getValuesByProperty("EncapsulatSize","", "td") + "</tr>";
                pcstr = pcstr + "<tr><td align=right width=100>是否片式</td>" + Products.getValuesByProperty("IsPiece","", "td") + "</tr>";
				pcstr = pcstr + "<tr><td align=right width=100>产品特点</td>" + Products.getValuesByProperty("Description","", "td") + "</tr>";
				pcstr = pcstr + "<tr><td align=right width=100>产品用途</td>" + Products.getValuesByProperty("ForUse","", "td") + "</tr>";
				pcstr = pcstr + "<tr><td align=left colspan=\"100\" bgcolor=\"#ddeeff\"><strong>产品特性参数</strong></td></tr>";
                pcstr = pcstr + "<tr><td align=right width=100>最低工作温度</td>" + Products.getValuesByProperty("TemperatureLow","℃", "td") + "</tr>";
                pcstr = pcstr + "<tr><td align=right width=100>最高工作温度</td>" + Products.getValuesByProperty("TemperatureHeigh","℃", "td") + "</tr>";

                if (panelid != "")
                {
					var param = "";
                    for (var i=0; i< Panels.currentpanel.params.length; i++)
                    {
							pcstr = pcstr + "<tr><td align=right width=100>" + Panels.currentpanel.params[i].ParameterName + "</td>" + Products.getValuesByProperty("para" + Panels.currentpanel.params[i].ShowOrder,"","td") + "</tr>";
					}
                }

				pcstr = pcstr + "<tr><td align=left colspan=\"100\" bgcolor=\"#ddeeff\"><strong>增值服务</strong></td></tr>";
				pcstr = pcstr + "<tr><td align=right width=100>产品样本下载</td>" + Products.getPropertyValuesWithLink("PDFID","", "td") + "</tr>";
				pcstr = pcstr + "<tr><td align=right width=100>离线询价</td>" + Products.getValuesForShopping("td") +"</tr>";

				pcstr = pcstr + "</table>";
				$('contents').innerHTML	= pcstr;
			}
		);
	},
//remodified by lee 10-19 replace 10-11	
	getValuesForShopping	: function(tag){
			var str = "";temp = "";
		    var p;
			var tempPidTag = "ProductID";
			var tempMidTag = "ManufacturerID";
			var tempPnameTag = "ProductName";
			var tempPmodelTag = "Model";
			var tempMnameTag = "ManufacturerName";		
			var tempPid = "a";
			var tempMid = "a";
			var tempPname = "";
			var tempPmodel = "";
			var tempMname = "";	
	        for (var i=0; i< Products.products.length; i++)
	        {       	
	            p = Products.products[i];      
				if(tempPidTag in p){tempPid = eval("p."+tempPidTag);}
				if(tempMidTag in p){ tempMid = eval("p."+tempMidTag);}
				if(tempPnameTag in p){ tempPname = eval("p."+tempPnameTag);}
				if(tempPmodelTag in p){ tempPmodel = eval("p."+tempPmodelTag);}
				//if(tempMnameTag in p){ tempMname = eval("p."+tempMnameTag);}
				if(tempMnameTag in p){ tempMname = "";}
				str = str + "<" + tag + " width=\"" + 880/Products.products.length + "\">";
						temp = "<a href=javascript:addOrder(\"add\",\""+tempPid+"\",\""+tempMid+"\",\""+ tempMname +"\",\""+tempPname +"\") >加入询价单中</a></td>";
				str = str + temp ;				
				str = str + "</" + tag + ">";
	
	        }
		    return str;
	},
//end	10-19
	getValuesByProperty    : function(prop, addon, tag)
	{
	    var str    = "";
	    var p; prpv = ""; 
		var q; qrpv ="";
        for (var i=0; i< Products.products.length; i++)
        {
            p = Products.products[i];

			str = str + "<" + tag + " width=\"" + 880/Products.products.length + "\">";
// 08-03-11
			if (prop in p) 
            {
				prpv = eval("p." + prop);
				if (prpv.length > 0)
				{
					str = str + prpv + addon;
				}
				else{
					str = str + "<font color=\"#000000\">---</font>";
				}
				
            }
			else
			{
				str = str + "<font color=\"#000000\">---</font>";
			}

			if (str.length > 0)
			{
				str = str + "</" + tag + ">";
			}

        }
	    return str;
	},

	getModelValues    : function(prop, tag)
	{
	    var str    = "";
	    var p;
        for (var i=0; i< Products.products.length; i++)
        {
            p = Products.products[i];
 //modified by lee 10-19    for the value of Model cannot be fully display in javascript. 
 //								marked an id in it just for retrives all the Model values;      
            str = str + "<" + tag + " id ='"+eval("p.ProductID")+"' width=\"" + 880/Products.products.length + "\">";
 //end 10-19
            if (prop in p && p.Model.length > 0)
            {
                str = str + eval("p.Model") ;
            }
            if (p.SimilarModel.length > 0)
            {
                str = str + "," + eval("p.SimilarModel");
            }
            if (p.ReplaceModel.length > 0)
            {
                str = str + "," + eval("p.ReplaceModel");
            }

            str = str + "</" + tag + ">";
        }
	    return str;
	},

	getPropertyValuesWithLink    : function(prop, link, tag)
	{
	    var str    = "";
	    var p; prpv = "";
        for (var i=0; i< Products.products.length; i++)
        {
            p = Products.products[i];
            str = str + "<" + tag + " width=\"" + 880/Products.products.length + "\">";
            if (prop in p)
            {
				prpv = eval("p." + prop);
				if (prpv.length > 0)
				{
					if (prop=="PDFID")
					{
						str = str + "<a href=\"/cecdata/PDFs/" + eval("p.ManufacturerID") + "/" + prpv + "\">PDF下载</a>";
					}else
					{if (prop=="ManufacturerName")
						{
							//str = str + "<a href=\"javascript:showManuDetail(" + eval("p.ManufacturerID") + ")\">" + prpv + "</a>";
							str = str + "<a href=\"/html/dialog_1.htm\" target=\"_blank\">在线询价</a>";
						}
					}
				}
				else{
					str = str + "<font color=\"#000000\">---</font>";
				}
            }
			else
			{
				str = str + "<font color=\"#000000\">---</font>";
			}

			if (str.length > 0)
			{
				str = str + "</" + tag + ">";
			}

        }
	    return str;
	}

}

/*---------------------------------------------------------------------------------------------------------------
 * 产品对象类及产品集合类定义 结束
 * <?xml version="1.0" encoding="UTF-8"?>
 * <products count="1" end="Y" page="1" start="1" total="1">
 * <product Certificate="" CreateTime="Wed Aug 24 10:22:48 CST 2005" Description="&#x5BBD;&#x5BB9;&#x91CF;,&#x5C0F;&#x5C3A;&#x5BF8;,&#x65E0;&#x6781;&#x6027;,&#x5728;&#x5C0F;&#x578B;&#x5316;&#x5B89;&#x88C5;&#x65B9;&#x9762;&#x53EF;&#x4EE5;&#x66FF;&#x4EE3;&#x7535;&#x89E3;&#x7535;&#x5BB9;&#x5668;,&#x5185;&#x85CF;&#x5F0F;&#x7535;&#x6781;&#x5177;&#x6709;&#x66F4;&#x9AD8;&#x53EF;&#x9760;&#x6027;,&#x73AF;&#x6C27;&#x6811;&#x8102;&#x5305;&#x5C01;,&#x5177;&#x6709;&#x826F;&#x597D;&#x8010;&#x6F6E;&#x6E7F;&#x6027;,&#x8010;&#x710A;&#x6027;&#x548C;&#x8010;&#x6EB6;&#x5242;&#x6027;" EncapsulatStyle="&#x76D2;&#x88C5;" KeyWords="" ManufacturerName="&#x9999;&#x6E2F;&#x7535;&#x963B;&#x5236;&#x9020;&#x5382;&#x4E1C;&#x839E;&#x5382;" Model="HC-49S" PanelKind="" Para1="" Para10="" Para11="" Para12="" Para13="" Para14="" Para15="" Para16="" Para17="" Para18="" Para19="" Para2="" Para20="" Para21="" Para22="" Para23="" Para24="" Para25="" Para26="" Para27="" Para28="" Para29="" Para3="" Para310="" Para4="" Para5="" Para6="" Para7="" Para8="" Para9="" ProducingArea="&#x4E0A;&#x6D77;&#x5E02;" ProductID="0200001431" ProductName="&#x6676;&#x4F53;&#x8C10;&#x632F;&#x5668;" SimilarModel="" Standard="" TemperatureHeigh="50.0" TemperatureLow="0.0" UpdateTime=""/>
 * </products>
---------------------------------------------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------------------------------------------
 * 单位类、单位集合类定义开始  	//sid ---- select控件的名称与id
 * <ParameterUnits>
 * <ParameterUnit Code="DIANL" Conversion="1.0" IsStandard="是" KindName="电流" Name="安培" ShowOrder="25" Symbol="A" UnitId="1"/>
 * </ParameterUnits>
---------------------------------------------------------------------------------------------------------------*/
var Units	=
{
	units		: [],
	dataGot		: false,
	insert		: function(subclass)
	{
		this.units[this.units.length] = new Unit(
			subclass.getAttribute("UnitId"),
			subclass.getAttribute("Name"),
			subclass.getAttribute("Code"),
			subclass.getAttribute("Symbol"),
			subclass.getAttribute("ShowOrder"),
			subclass.getAttribute("KindName"),
			subclass.getAttribute("IsStandard"),
			subclass.getAttribute("Conversion"),
			subclass.getAttribute("RootUnit")
		);
	},
	find		: function(uid)
	{
		var i;
		for(var i=0; i < this.units.length; i++)
		{
			if (this.units[i].equalsbyid(uid))
			{
				return this.units[i];
			}
		}
		return null;
	},
	toSelect	: function(sid, dfltid, rootunitid)
	{
		var str = '<select id="' + sid + '">';
		var i;
		var j = 0;
		for(var i=0; i < this.units.length; i++)
		{
			if ( (rootunitid == undefined) || (this.units[i].RootUnit == rootunitid))
			{
				str = str + ('<option value="' + this.units[i].UnitID + '"');
				if (this.units[i].UnitID == dfltid)
				{
					str	= str + (' selected="selected"');
				}
				str	= str + ('>');
				str	= str + (this.units[i].Name);
				str	= str + ('</option>');
				j ++;
			}
		}
		str	= str + '</select>';
		if (j == 0) { str = ""; }
		return str;
	},
	/*
	 * <units>
	 *	<unit UnitID="" Name="" Code="" ConditionSymbol="" ShowOrder="" KindName="" IsStandard="" Conversion="" RootUnit="" />
	 * </units>
	 * <ParameterUnits>
	 * 	<ParameterUnit Code="DIANL" Conversion="1.0" IsStandard="是" KindName="电流" Name="安培" ShowOrder="25" Symbol="A" UnitId="1"/>
	 * </ParameterUnits>
	 */
	getParameterUnits	: function()
	{
		var qn_op = new WS.QName('getParameterUnits',nsuri);
		var qn_op_resp = new WS.QName('getParameterUnitsReturn',nsuri);
		call.invoke_rpc
		(
			qn_op,
			new Array(
			),null,
			function(call,envelope)
			{
				//$('contents').innerHTML = arguments[2];
				var xmlDoc = XmlDocument.create();
				xmlDoc.async = false;
				xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());
				var allClasses = xmlDoc.documentElement.selectSingleNode("//ParameterUnits");
				var i;
				var subclass;
				for(var i=0; i < allClasses.childNodes.length; i++)
				{
					subclass = allClasses.childNodes(i);
					Units.insert(subclass); //插入节点
					Units.dataGot = true;
				}
			}
		);
	}
}


/***************************************************************************************************************
name="getTopLevelProductClasses">
单位类
<units>
	<unit UnitID="" Name="" Code="" ConditionSymbol="" ShowOrder="" KindName="" IsStandard="" Conversion="" RootUnit="" />
</units>
***************************************************************************************************************/
function Unit(sUnitID, sName, sCode, sConditionSymbol, sShowOrder, sKindName, sIsStandard, sConversion, sRootUnit)
{
	this.UnitID		= sUnitID;
	this.Name		= sName;
	this.Code		= sCode;
	this.ConditionSymbol	= sConditionSymbol;
	this.ShowOrder		= sShowOrder;
	this.KindName		= sKindName;
	this.IsStandard		= sIsStandard;
	this.Conversion		= sConversion;
	this.RootUnit		= sRootUnit;
	this.equalsbyid		= function(uid)
	{
		return this.UnitID == uid;
	};
}

/*---------------------------------------------------------------------------------------------------------------
 单位类、单位集合类定义 结束
* ---------------------------------------------------------------------------------------------------------------*/


/*---------------------------------------------------------------------------------------------------------------
 产品参数模板对象类及参数模板集合类定义
---------------------------------------------------------------------------------------------------------------*/
/*
 * 产品参数模板对象类
 * 2006.03.09 created
 * 2006.03.12 modified by
 * <pclasspanels>
 *	<pclasspanel gbid="" panelkind="" panelname=""/>
 * <pclasspanels>
 */
function Panel(spanelkind,spanelname,sgbid)
{
	this.panelkind		= spanelkind;
	this.gbid		= sgbid;
	this.panelname		= spanelname;

 	this.params		= [];
 	this.dataGot		= false;

	this.cond		= "";

 	this.toString		= function ()  //输出概要信息
 	{
 		var str = 'Panel:' + this.panelname;
  		return str;
 	};

	/*
	 * 获得模板参数详细信息
	 * 2006.03.15 created
	 * <pclasspanel panelkind="">
	 *	<parameter ParameterID="" ParameterName="" KindCode="" FieldSize="" ParameterDescribe="" EnableSearch="Y|N" ShowOrder="1" RootUnit="" />
	 * <pclasspanels>
	 */
 	this.showParams		= function(noshow)
 	{
		if (!this.dataGot)
		{
			var qn_op = new WS.QName('getPclassParametersByPanelId',nsuri);
			var qn_op_resp = new WS.QName('getPclassParametersByPanelIdReturn',nsuri);
			var pid = "" + Panels.currentpanel.panelkind + "";
			call.invoke_rpc
			(
				qn_op,
				new Array
				(
					{name:'panelid',value:pid}
				),null,
				function(call,envelope)
				{
					var xmlDoc = XmlDocument.create();
					xmlDoc.async = false;
					xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());
//					$('soap').innerHTML = arguments[2]
					var allClasses = xmlDoc.documentElement.selectSingleNode("//PclassParameters");
					Panels.addParams(allClasses);
					if ((noshow == null) ||(! noshow))
					{
					    $('hPanelContent').innerHTML	= Panels.currentpanel.paramlist();
					}
					Panels.currentpanel.dataGot = true;
				}
			);
		}
		else
		{
			if ((noshow == null) ||(! noshow))
			{
			    $('hPanelContent').innerHTML	= Panels.currentpanel.paramlist();
			}
		}
 	};
// 08-03-17 	
 this.showParams2		= function(noshow)
 	{
 	
		if (!this.dataGot)
		{
			var qn_op = new WS.QName('getPclassParametersByPanelIdIgnoreYN',nsuri);
			var qn_op_resp = new WS.QName('getPclassParametersByPanelIdIgnoreYNReturn',nsuri);
					
			var pid = "" + Panels.currentpanel.panelkind + "";
					
			call.invoke_rpc
			(
				qn_op,
				new Array
				(
					{name:'panelid',value:pid}
				),null,
				function(call,envelope)
				{
					var xmlDoc = XmlDocument.create();
					xmlDoc.async = false;
					xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());
//					$('soap').innerHTML = arguments[2]
					var allClasses = xmlDoc.documentElement.selectSingleNode("//PclassParameters");
					Panels.addParams(allClasses);
					if ((noshow == null) ||(! noshow))
					{
					    $('hPanelContent').innerHTML	= Panels.currentpanel.paramlist();
					}	
					Panels.currentpanel.dataGot = true;
				 
					 	
					 Products.init();	//恢复查询状态
					 Products.getProductByIds(pids);
					 	
				}
			);
		}
		else
		{
			if ((noshow == null) ||(! noshow))
			{
			    $('hPanelContent').innerHTML	= Panels.currentpanel.paramlist();
			}
		}
 	};
	//显示参数查询，这儿是比较复杂的地方
	//根据参数、单位的不同列出不同的查询条件，并根据用户输入动态变化
	//这儿列出单位
 	this.params2string	= function()
 	{
		var str	= '<select id="params" onchange="javascript:Panels.paramchange(' + this.panelkind + ')">';
		var i;
		for(var i=0; i < this.params.length; i++)
		{
			str = str + '<option value="' + this.params[i].ParameterID + '">' + this.params[i].ParameterName + '</option>';
		}
		str	= str + '<select>';
		str	= str + Panels.logicaloperator;
		return str;
 	};

 	this.paramlist		= function()
 	{
		var str	= '<table>';
		for(var i=0; i < this.params.length; i++)
		{
			str = str + this.params[i].toString();
		}

		str = str + '<tr><td colspan="2" align="center"><input type="button" id="h_panelparams_search" onclick="javascript:Panels.currentpanel.searchproduct();" value="查询"></td></tr>';
		str = str + '</table>';
		return str;
 	};

	/*
	 *<parameter EnableSearch="Y" FieldSize="10" KindCode="N" ParamenterID="3963" ParameterDescribe="" ParameterName="堵转电流" RootUnit="1" ShowOrder="2"/><
	 */
 	this.addParam		= function(subclass)
 	{
		this.params[this.params.length] = new Parameter
		(
			subclass.getAttribute("ParamenterID"),
			subclass.getAttribute("ParameterName"),
			subclass.getAttribute("KindCode"),
			subclass.getAttribute("FieldSize"),
			subclass.getAttribute("ParameterDescribe"),
			subclass.getAttribute("EnableSearch"),
			subclass.getAttribute("ShowOrder"),
			subclass.getAttribute("RootUnit")
		);
 	};
	this.insert = function (pcond, logic)
	{
		if (pcond.length > 0)
		{
			if (this.cond.length > 0) this.cond = this.cond + logic;
			this.cond = this.cond + pcond;
		}
	};

	this.insertAnd = function (pcond)	{	this.insert(pcond, ' AND ');	} //追加“与”条件

 	//生成查询条件并执行查询Panels.currentpanel.searchproduct()
 	this.searchproduct	= function()
 	{
		this.cond = "";
		var str	= '';
		for(var i=0; i < this.params.length; i++)
		{
			if (this.params[i].EnableSearch == 'Y')
			{
				this.insertAnd(this.params[i].getCond());
			}
		}
		this.cond = restrictClass(this.cond);
//add by lee 11-08
		var con="";
		var model = document.getElementById('Model').value;
		var certificate = document.getElementById('Certificate').value;
		var standard = document.getElementById('Standard').value;
		var temperature = document.getElementById('Temperature').value;
		var manuName = document.getElementById('ManufacturerName').value;
		var productArea = document.getElementById('ProducingArea').value;
		var encapsulateStyle =  document.getElementById('EncapsulatStyle').value;
		var encapsulateSize = document.getElementById('EncapsulatSize').value;
		if(model!=""){
			con = "model like '"+model+"%' and ";
		}
		if(certificate!=""){
			con = con + " Certificate like '%"+certificate+"%' and ";
		}
		if(standard!=""){
			con = con + " Standard like '%"+standard+"%' and ";
		}
		
		if(temperature!=""){
			con = con + " temperatureLow <= "+ temperature+" and temperatureHeigh >= "+ temperature +" and ";
		}
		if(manuName!=""){
			con = con + " ManufacturerName like '%"+manuName+"%' and ";
		}
		if(productArea!=""){
			con = con + " ProducingArea like '%"+productArea+"%' and ";
		}
		if(encapsulateStyle!=""){
			con = con + " encapsulateStyle like '%"+encapsulateStyle+"%' and ";
		}
		if(encapsulateSize!=""){
			con = con + " encapsulateSize = '"+encapsulateSize+"' and ";
		}
		con = con.replace(/</g,"&lt;").replace(/>/g,"&gt;");
		this.cond = con + this.cond;
//end	
		Products.searchinnewpage(this.cond);
        /*
		Products.init();	//恢复查询状态
		Products.swhere		= this.cond;
		Products.search();
		*/
 	};
}

/*
 * 产品参数信息
 * 2006.03.12 modified by
 * <pclasspanel panelkind="">
 *	<parameter ParameterID=""  ParameterName="" KindCode="" FieldSize="" ParameterDescribe="" EnableSearch="Y|N" ShowOrder="1" RootUnit="" />
 * <pclasspanels>
 */
function Parameter(sParameterID, sParameterName, sKindCode, sFieldSize,
 sParameterDescribe, sEnableSearch, sShowOrder, sRootUnit)
{
	this.ParameterID	= sParameterID;
	this.ParameterName	= sParameterName;
	this.KindCode		= sKindCode;
 	this.FieldSize		= sFieldSize;
 	this.ParameterDescribe	= sParameterDescribe;
 	this.EnableSearch	= sEnableSearch;
 	this.ShowOrder		= sShowOrder;
 	this.RootUnit		= sRootUnit;

	this.parent		= null;

	this.getCond		= function()
	{
		var lt;
		var pcond = "";
		if (this.EnableSearch == 'Y')
		{
			var value = $(Panels.paramprefix + this.ParameterID).value.replace(/[ ]*$/,'');  //取得输入的条件值
			if (value.length > 0)
			{
				switch (this.KindCode)
				{
				case 'N':	//数值Lvalue/Hvalue
					//转换为标准单位
					var tempval = $(Panels.paramunitprefix + this.ParameterID);
					if (tempval != null)
					{
					value = value * Units.find(tempval.value).Conversion * 1.0;
					value = value.toFixed(15);
					}

	//				value = value * Units.find($(Panels.paramunitprefix + this.ParameterID).value).Conversion * 1.0;

					lt = $(Panels.paralogicprefix + this.ParameterID).value;
					switch(lt)
					{
					case "equals":
						pcond =	" exists (select 0 from productsparameter pp where pp.ProductID=p.ProductID" +
							" and pp.ParameterID=" + this.ParameterID +
							" and (Lvalue <= " + value + " and Hvalue >= " + value + 
							" or Lvalue = " + value + " or Hvalue = " + value + "))";
						break;
					case "greatandequals"://所查询器件的参数大于条件值
						pcond =	" exists (select 0 from productsparameter pp where pp.ProductID=p.ProductID" +
							" and pp.ParameterID=" + this.ParameterID +
							" and Lvalue >= " + value + ")";
						break;
					case "lessandequals":
						pcond =	" exists (select 0 from productsparameter pp where pp.ProductID=p.ProductID" +
							" and pp.ParameterID=" + this.ParameterID +
							" and Hvalue <= " + value + ") ";
						break;
					}
					break;
				case 'W':	//多值CharString
	// 08-03-20				
					value = value.replace("%","\\\\%");
					value = value.replace("'","\\\\'");
					pcond = " exists (select 0 from productsparameter pp where pp.ProductID=p.ProductID" +
						" and pp.ParameterID=" + this.ParameterID +
						" and CharString like '%" + value + "%')";
					break;
				case 'B':	//逻辑值CharString 是/否
					pcond = " exists (select 0 from productsparameter pp where pp.ProductID=p.ProductID" +
						" and pp.ParameterID=" + this.ParameterID +
						" and CharString = '" + value + "')";
					break;
				default:
					break;
				}
			}
			pcond = pcond.replace(/</g,"&lt;").replace(/>/g,"&gt;");
		}

		return pcond;

	};



 	this.toString		= function()
 	{
		var str = "";
		if (this.EnableSearch == 'Y')
		{
			str	= str + '<tr><td>' + this.ParameterName + '</td><td>';
			switch (this.KindCode)
			{
			case 'N':	//数值Lvalue/Hvalue
				str	= str + Panels.logicaloperator(this.ParameterID);
				str	= str + '<input type="text" id="' + Panels.paramprefix + this.ParameterID + '" value="" title="数值条件">';
				str	= str + Units.toSelect(Panels.paramunitprefix + this.ParameterID, this.RootUnit, this.RootUnit);
//				str 	= str + this.ParameterDescribe
				break;
			case 'W':	//多值CharString
				str	= str + " 包含 ";
				str	= str + '<input type="text" id="' + Panels.paramprefix + this.ParameterID + '" value="" title="文字条件">'; // + this.ParameterDescribe;
				break;
			case 'B':	//逻辑值CharString 是/否
				str	= str + '<select id="' + Panels.paramprefix + this.ParameterID + '">' +
					'<option value="">请选择</option>' +
					'<option value="是">是</option>' +
					'<option value="否">否</option>' +
					'</select>';
				break;
			default:
				break;
			}
			str	= str + '</td></tr>';
		}
		return str;
 	};
}

/*
 * 参数模板列表对象类
 * 2006.03.10 created
 * <pclasspanels>
 *	<pclasspanel gbid="" panelkind="" panelname=""/>
 * <pclasspanels>
 */
var Panels	=
{
	panelprefix	: "panel_",	//模板前缀
	panels		: [],
	paramprefix	: "param_",	//参数前缀
	paramunitprefix	: "pu_",	//参数单位前缀
	paralogicprefix	: "paralogic_",	//关系操作符前缀
	currentpanel	: null,		//当前模板
	currentpanelid      : "",
	logicaloperator	: function(pid)
	{
		var str = '<select id="' + this.paralogicprefix + pid + '">' +
		'<option value="equals">等于</option>' +
		'<option value="greatandequals">大于等于</option>' +
		'<option value="lessandequals">小于等于</option>' +
		'</select>';
		return str;
	},
	add		: function (subclass)
	{
	    var len = this.panels.length;
	    if (!Panels.find(subclass.getAttribute("gbid")))
	    {
    		this.panels[len] = new Panel(
    			subclass.getAttribute("panelkind"),
    			subclass.getAttribute("panelname"),
    			subclass.getAttribute("gbid")
    		);
	    }
	},
	init		: function()
	{
		this.panels		= [];
	},
	find		: function(pid)
	{
		var i;
		for(var i=0; i < this.panels.length; i++)
		{
			if (this.panels[i].panelkind == pid)
			{
				return this.panels[i];
			}
		}
		return null;
	},
	menu		: function()
	{
		var str = '<ul>';
		for(var i=0; i < this.panels.length; i++)
		{
			str = str + '<li id="' + this.panelprefix + this.panels[i].panelkind +
			'"><a href="#" onclick="javascript:Panels.changepanel(\'' + this.panels[i].panelkind + '\')">' +
			this.panels[i].panelname + '</a></li>';
		}
		str = str + '</ul>';
		return str;
	},
	addParams	: function(allParams)
	{
		if (null == this.currentpanel)
		{
			alert('没有找到当前参数模板。');
			return;
		}
		for(var i=0; i < allParams.childNodes.length; i++)
		{
			this.currentpanel.addParam(allParams.childNodes(i)); //插入节点
		}
	},
	paramchange	: function(pid)		//参数改变，用于。。。中
	{
		return true;
	},
	changepanel	: function(pid)		//
	{
		this.currentpanel = Panels.find(pid);
		if (this.currentpanel != null)	this.currentpanel.showParams();
	}
}


/*---------------------------------------------------------------------------------------------------------------
 产品对象类及产品集合类定义 结束
---------------------------------------------------------------------------------------------------------------*/

/*
 * 根据传入的国标分类节点获得参数模板，并动态更新显示
 * 2006.03.09 created
 */
function getPclassPanelsByGBClassIds(gbids)
{
  var qn_op = new WS.QName('getPclassPanelsByGBClassIds',nsuri);
  var qn_op_resp = new WS.QName('getPclassPanelsByGBClassIdsReturn',nsuri);

  call.invoke_rpc(
    qn_op,
    new Array(
    	{name:'gbids',value:gbids}
    ),null,
    function(call,envelope)
    {
	var xmlDoc = XmlDocument.create();
	xmlDoc.async = false;
	xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());
	var allClasses = xmlDoc.documentElement.selectSingleNode("//PclassPanels");
//	$('soap').innerHTML = arguments[2];
	for(var i=0; i < allClasses.childNodes.length; i++)
	{
		Panels.add(allClasses.childNodes(i)); //插入节点
	}
	if ($('hPanelMenu')) $('hPanelMenu').innerHTML	= Panels.menu();
    }
  );
}

/*
 * 根据传入的国标分类节点获得参数模板，并动态更新显示
 * 2006.03.09 created
 */
function getPclassPanelsAssociateGBClassAndSub(gbid)
{
  var qn_op = new WS.QName('getPclassPanelsAssociateGBClassAndSub',nsuri);
  var qn_op_resp = new WS.QName('getPclassPanelsAssociateGBClassAndSubReturn',nsuri);

  call.invoke_rpc(
    qn_op,
    new Array(
      {name:'gbid',value:gbid}
    ),null,
    function(call,envelope)
    {
      var xmlDoc = XmlDocument.create();
      xmlDoc.async = false;
      xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());
      var allClasses = xmlDoc.documentElement.selectSingleNode("//pclasspanels");
      for(var i=0; i < allClasses.childNodes.length; i++)
      {
        Panels.add(allClasses.childNodes(i)); //插入节点
      }
  // 07-11-21 注释见文件 gb_adv_query.vm 中的getPclassPanelsAssociateGBClassAndSub(gbid);调用后;    
      PcAdv.showChildren();
    }
  );
}

/*
 * 根据传入的产品分类节点获得该分类的参数模板，并动态更新显示
 */
function getPclassPanelsByProductClassId(classid)
{
  var qn_op = new WS.QName('getPclassPanelsByProductClassId',nsuri);
  var qn_op_resp = new WS.QName('getPclassPanelsByProductClassIdReturn',nsuri);

  call.invoke_rpc(
    qn_op,
    new Array(
      {name:'classid',value:classid}
    ),null,
    function(call,envelope)
    {
  var xmlDoc = XmlDocument.create();
  xmlDoc.async = false;
  xmlDoc.loadXML(envelope.get_body().get_all_children()[0].get_all_children()[0].get_value());
  var allClasses = xmlDoc.documentElement.selectSingleNode("//pclasspanels");
//	$('soap').innerHTML = arguments[2];
  var subclass;
  for(var i=0; i < allClasses.childNodes.length; i++)
  {
    Panels.add(allClasses.childNodes(i)); //插入节点
  }
  if ($('hPanelMenu')) $('hPanelMenu').innerHTML	= Panels.menu();

    }
  );
}


//获得当前选中的分类的GBIDs列表，以逗号分隔
function getCurrentGBIDs()
{
    return tree.getSelected().GBIDs;
}

function restrictClass(cond)
{
    var gbcond = "";
    //<span><input type="checkbox" id="allclass" value="1" onclick="setsearchconstrant(this)">在所有分类中查询<input type="checkbox" id="childrenclass" value="1">在当前分类的子分类中查询</span>';
    if ((tree.getSelected()== null) || $("allclass").checked)
    {
    }
    else
    {
        if ($('childrenclass').checked)
        {
            if (getCurrentGBIDs().replace(/[ ]*$/,"").length > 0)
            {
                gbcond = " parantgbid=[" + getCurrentGBIDs() + "]";
            }
        }
        else
        {
            if (getCurrentGBIDs().replace(/[ ]*$/,"").length > 0)
            {
                gbcond = " GBID in (" + getCurrentGBIDs() + ")";
            }
        }
    }
    if (Panels.currentpanel != null)
    {
        if (gbcond.length >0)
        {
            gbcond = "panelkind = '" + Panels.currentpanel.panelkind + "' AND " + gbcond;
        }
        else
        {
 //modified by lee 09-01       
        	if(PcAdv.pregbid=="")
        	{
        		gbcond = "panelkind = '" + Panels.currentpanel.panelkind + "'";
        	}
        	else
        	{
//            	gbcond = "panelkind = " + Panels.currentpanel.panelkind ;
				gbcond = "panelkind = '" + Panels.currentpanel.panelkind + "' AND gbid in (select gbid from pclassandgb where fullpath LIKE CONCAT((select fullpath from pclassandgb where gbid = "+PcAdv.pregbid+"),'%')) ";
            }
  //end
        }
    }

    if (cond.length > 0 )
    {
        if (gbcond.length >0)
        {
//            gbcond = "(" + cond + ") AND " + gbcond;
			   gbcond = gbcond + " AND (" + cond + ")";
        }
        else
        {
            gbcond = cond;
        }
    }
//	alert(tree.getSelected());
    return gbcond;
}

function showObject(obj)
{
	var msg = "propertys:\n";
	var p;
	var b;
	for (p in obj)
	{
	   b = "obj." + p + "";
	   msg = msg + p + ":" + eval(b) + "\n";
	}
	return msg;
}


/*
 * 根据产品ID显示产品信息
 */
function showProductInfo(pid)
{
	var p = Products.find(pid);
	if (p != null)
	{
		$('leftbuttombox').innerHTML	= p.showDetail();
	}
}

/*
 * 根据产品ID显示产品信息
 */
function showProductDetailPage(pid,panelid)
{
	var f	= $('productdetailform');
	f.pids.value	= pid;
	f.panelid.value    = panelid;
	f.submit();
}

//如果选中某个分类，只有相同panelkind的才能进行对比
//只选中某分类时，只能进行查看详细信息
function flashcontrastbutton(pid)
{
	//add by lee :start	这里表示限制比较的条数,Products.getPidcount()>=限定的条数;
	var opValue = $('contrastbutton_'+pid).value;
	var opCheck = $("pchk_"+pid);

	if(Products.getPidcount()>=6 && opValue=="比较" &&opCheck.checked==true){
		alert("同时进行比较的产品最多不能超过6个！");
		opCheck.checked=false;
		return ;
	}
	//end

	var cp = Products.find(pid);
	cp.selected = !cp.selected;
	Panels.currentpanelid = cp.panelid;
	var p;
	for (var i=0; i < Products.products.length ; i++)
	{
	    p = Products.products[i];

	    $("pchk_"+p.ProductID).disabled = (p.panelid != cp.panelid);
		$('contrastbutton_'+p.ProductID).disabled = (p.panelid != cp.panelid);
	    //p.selected = ((p.panelid == cp.panelid) && p.selected);
	}
	if (Products.getPidcount() == 0)
	{
//	    $('contrastbutton').disabled = true;
		for (var i=0; i < Products.products.length ; i++)
		{
			p = Products.products[i];
		    $("pchk_"+p.ProductID).disabled = false
			$('contrastbutton_'+p.ProductID).disabled = true;
		}
	}
	else
	{
		for (var i=0; i < Products.products.length ; i++)
		{
			p = Products.products[i];
//		    $('contrastbutton').disabled = false;
			$('contrastbutton_'+p.ProductID).disabled = false;
		}
	}
	if (Products.getPidcount() == 1)
	{
		for (var i=0; i < Products.products.length ; i++)
		{
			p = Products.products[i];
//		    $('contrastbutton').value = "详细";
			$('contrastbutton_'+p.ProductID).value = "详细";
		}
	}
	else
	{
		for (var i=0; i < Products.products.length ; i++)
		{
			p = Products.products[i];
//		    $('contrastbutton').value = "比较";
			$('contrastbutton_'+p.ProductID).value = "比较";
		}
	}
}

function setsearchconstrant()
{
    $("childrenclass").disabled = $("allclass").checked;
}
