﻿var expandState = 0;
var oldPosition = 0;
var basketOrgTop = 200; //比较栏与屏幕上方的距离
var basketUpTop = 200; //产品比较篮上方突出的距离, 默认是宽屏的数值
var ie = document.all ? 1 : 0;
var ns = document.layers ? 1 : 0;
var firstStep = 20;
var autoIndentTime = 10; //自动回缩的时间，单位:秒
var timeoutProcess;
var timeoutProcessCounter;

var initWidth;
var initLeft;

function showBox() {
	if (expandState == 0) {
		if (ie) {
			if (isRight()) {
				rightIncrease(firstStep);
			} else {
				leftIncrease(firstStep);
			}
		}
		expandState = 1;
	}
}

function hideBox() {
	if (expandState == 1) {
		if (ie) {
			if (isRight()) {
				rightDecrease(firstStep);
			} else {
				leftDecrease(firstStep);
			}
		}
		expandState = 0;
	}
}

function showBoxManual() {
	if (expandState == 0) {
        showBox();
    }

    if (timeoutProcess != null) {
        clearTimeout(timeoutProcess);
    }

    timeoutProcessCounter = autoIndentTime;
    timeoutProcess = setTimeout("hideBoxInSeconds()", 1000);
}

function selectProduct(productId, productName, checkValue) {
    if (!ie) return;

	document.getElementById("basket").style.visibility = 'visible';

//    if (checkValue == true) {
//        document.c.id.value = productId;
//        document.c.name.value = productName;
//        document.c.method.value = "a";
//        document.c.submit();
//    }
//    if (checkValue == false) {
//        document.c.id.value = productId;
//        document.c.name.value = productName;
//        document.c.method.value = "r";
//        document.c.submit();
//    }

    if (expandState == 0) {
        showBox();
    }

    if (timeoutProcess != null) {
        clearTimeout(timeoutProcess);
    }

    timeoutProcessCounter = autoIndentTime;
    timeoutProcess = setTimeout("hideBoxInSeconds()", 1000);
}

function hideBoxInSeconds() {
    timeoutProcessCounter--;

    if (timeoutProcessCounter >= 0) 
        timeoutProcess = setTimeout("hideBoxInSeconds()", 1000);
    else 
        hideBox();
}

function flow() {
		var scrollPos;
		var cHeight;
		
		if (typeof window.pageYOffset != 'undefined') {//ns专有属性
		   	scrollPos = window.pageYOffset;
		   	cHeight=document.documentElement.clientHeight;

		}
		else if (typeof document.compatMode != 'undefined' &&
			document.compatMode != 'BackCompat') {
		   	scrollPos = document.documentElement.scrollTop;
		   	cHeight=document.documentElement.clientHeight;
		}
		else if (typeof document.body != 'undefined') {
		   	scrollPos = document.body.scrollTop;//ie
		   	cHeight=document.body.clientHeight;
		}
		var a = scrollPos;
		
		if(a!=oldPosition){ //设定滚动后的垂直位置
			document.getElementById("basket").style.top       = (a + basketOrgTop - basketUpTop) + 'px';
			document.getElementById("basket_show").style.top  = (a + basketOrgTop - basketUpTop) + 'px';
			document.getElementById("basket_close").style.top = (a + basketOrgTop) + 'px';						
			oldPosition = a;
		}
}

function init(w,l,v){
	var windowHeight = window.screen.height;
	basketUpTop = windowHeight > 1000 ? 0 : 200; //普通屏幕产品比较篮中出，宽屏出现位置提上避免看不全

   	if(isRight()){
		while(w>0){
			w = (w-v) < 0 ? 0 : (w-v);
			l = (l+v)> (initLeft+initWidth)?(initLeft+initWidth):(l+v);
		}
//		try
//		{	
		document.getElementById("basket_show").style.width=w+"px";
		document.getElementById("basket_show").style.left=l+"px";

//		}catch(e){}
	}else{
		document.getElementById("basket_show").style.width="0px";
	}
	document.getElementById("basket_close").style.display = "";		
	document.getElementById("basket_show").style.overflow = "hidden";

	//设定初始垂直位置
	document.getElementById("basket").style.top       = (basketOrgTop - basketUpTop) + 'px';
	document.getElementById("basket_show").style.top  = (basketOrgTop - basketUpTop) + 'px';
	document.getElementById("basket_close").style.top = basketOrgTop + 'px';	

	window.setInterval("flow()",10);
}

function rightIncrease(v){
	var w = document.getElementById("basket_show").offsetWidth-2 ;
	var l = document.getElementById("basket_show").offsetLeft ;
	var step = (w+v) > initWidth ? initWidth : (w+v);
	var step2 = (l-v) < initLeft? initLeft : (l-v);
	document.getElementById("basket_show").style.width=step+"px";
	document.getElementById("basket_show").style.left=step2+"px";
	if(step>0){
		document.getElementById("basket_close").style.visibility = 'hidden';
		document.getElementById("basket_show").style.visibility  = 'visible';
	}
	if(step < initWidth){
		setTimeout('rightIncrease('+v+')',10);
	}
}

function leftIncrease(v){
	var w = document.getElementById("basket_show").offsetWidth-2 ;
	var step = (w+v) > initWidth ? initWidth : (w+v);
	document.getElementById("basket_show").style.width=step+"px";
	if(step>0){
		document.getElementById("basket_close").style.visibility = 'hidden';
		document.getElementById("basket_show").style.visibility  = 'visible';
	}
	if(step < initWidth){
		setTimeout('leftIncrease('+v+')',10);
	}
}

function rightDecrease(v){
	var w = document.getElementById("basket_show").offsetWidth-2 ;
	var l = document.getElementById("basket_show").offsetLeft ;
	var step = (w-v) < 0 ? 0 : (w-v);
	var step2 = (l+v)> (initLeft+initWidth)?(initLeft+initWidth):(l+v);
	document.getElementById("basket_show").style.width=step+"px";
	document.getElementById("basket_show").style.left=step2+"px";
	if(step > 0){
		setTimeout('rightDecrease('+v+')',10);
	} else {
		document.getElementById("basket_close").style.visibility = 'visible';
		document.getElementById("basket_show").style.visibility  = 'hidden';
	}
}

function leftDecrease(v){
	var w = document.getElementById("basket_show").offsetWidth-2 ;
	var step = (w-v) < 0 ? 0 : (w-v);
	document.getElementById("basket_show").style.width=step+"px";
	if(step > 0){
		setTimeout('leftDecrease('+v+')',10);
	} else {
		document.getElementById("basket_close").style.visibility = 'visible';
		document.getElementById("basket_show").style.visibility  = 'hidden';
	}
}

function isRight(){
	return initLeft > document.getElementById("basket").offsetWidth/2;
}




    if (ie) { //比较栏只能在IE下显示
	    document.write('	<div style="position:relative"><div id="basket" style="visibility:hidden">');
	    document.write('		<div id="basket_close" onclick="showBoxManual()"></div>');
	    document.write('		<div id="basket_show" >');
	    document.write('			<div id="basket_top" onclick="hideBox()"></div>');
	    document.writeln("<div id=\"basket_list\">");
        document.writeln("<table width=\"179\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
        document.writeln("	<tr>");
        document.writeln("");
        document.writeln("		<td width=\"179\" align=\"center\" valign=\"middle\">");
        document.writeln("		<\/td>");
        document.writeln("		<td width=\"20\" valign=\"middle\" height=\"10\" align=\"center\"><\/td>");
        //document.writeln("			<a href=\"javascript:;\" onClick=\"PerformScroll(-18);displayStatusMsg(\'Scroll Up\');return document.returnValue\" ");
        //document.writeln("onMouseOut=\"CeaseScroll();\"><img src=\"/b2b/images/basket_up.jpg\" alt=\"往上\" width=\"5\" border=0 align=\"absmiddle\" hegiht=\"3\" \/><\/a>");
        document.writeln("	<\/tr>");
        document.writeln("	<tr>");
        document.writeln("	<td valign=\"top\" class=\"con1\">");
        document.writeln("    <div id=\"divContainer\">");
        document.writeln("");
        document.writeln("		<div id=\"divContent\">");
        document.writeln("		<\/div>");
        document.writeln("		<\/div>");
        document.writeln("	<\/td>");
        document.writeln("	  <td height=\"350\">&nbsp;<\/td>");
        document.writeln("	<\/tr>");
        document.writeln("");
        document.writeln("	<tr>");
        document.writeln("		<td align=\"right\" valign=\"middle\">");
        document.writeln("			<a href=\"javascript:Empty();\"  title=\"点击型号名移除产品,点击图片查看产品详细资料\"><img src=\"/b2b/images/prod_pic13.gif\" align=\"absmiddle\" \/><\/a><img  class=\"bt\" onClick=\"javascript:CompareCheck()\" style=\"cursor:pointer;\" src=\"/b2b/images/prod_pic14.gif\" alt=\"注意，最多比较5个产品！\" align=\"middle\" \/> ");
        document.writeln("		<\/td>");
        document.writeln("		<td valign=\"middle\" height=\"20\" align=\"center\">");
        //document.writeln("			<a href=\"javascript:;\" onClick=\"PerformScroll(18);displayStatusMsg(\'Scroll Down\');return document.returnValue\" ");
        //document.writeln("onMouseOut=\"CeaseScroll();\"><img src=\"/b2b/images/baskettop_down.jpg\" border=0 alt=\"往下\"  width=\"5\" hegiht=\"3\" \/><\/a>");
        document.writeln("		<\/td>");
        document.writeln("	<\/tr>");
        document.writeln("<\/table>");
        document.writeln("<\/div>")
	    document.write('		</div>');
	    document.write('	</div></div>');

	    initWidth = document.getElementById("basket_show").offsetWidth-2 ;
	    initLeft = document.getElementById("basket_show").offsetLeft;
	    init(initWidth,initLeft,firstStep);
    }


// unicode 编码程序
function BasketEncodeCookie(InputString)
{
	var strRtn="";
	for (var i=InputString.length-1;i>=0;i--)
	{
		strRtn+=InputString.charCodeAt(i);
		if (i) strRtn+="a"; // 用 a 作分隔符
	}
	return strRtn;
}

// unicode 解码程序
function BasketDecodeCookie(InputString)
{
	var strArr;
	var strRtn="";

	strArr=InputString.split("a");

	for (var i=strArr.length-1;i>=0;i--)
		strRtn+=String.fromCharCode(eval(strArr[i]));

	return strRtn;
}

// 读 Cookie
function BasketGetCookie(name)
{
	var strArg=name+"=";
	var nArgLen=strArg.length;
	var nCookieLen=document.cookie.length;
	var nEnd;
	var i=0;
	var j;

	while (i<nCookieLen)
	{
		j=i+nArgLen;
		if (document.cookie.substring(i,j)==strArg)
		{
			nEnd=document.cookie.indexOf (";",j);
			if (nEnd==-1) nEnd=document.cookie.length;
			return BasketDecodeCookie(unescape(document.cookie.substring(j,nEnd)));
		}
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}

// 写 Cookie
function BasketSetCookie(name,value,expires)
{
	var exp = new Date();
	exp.setTime(exp.getTime()+expires*60*60*1000);
	document.cookie=name+"="+escape(BasketEncodeCookie(value))+";expires="+exp.toGMTString();
}

// 判断 Cookie 是否存在并写产品对比 Cookie
function BasketCheckSetCookieValue(name,value,expires)
{
	var nameCookieValue = BasketGetCookie(name);
	if ((nameCookieValue == "") || (nameCookieValue == null))
	{
		var exp = new Date();
		exp.setTime(exp.getTime()+expires*60*60*1000);
		document.cookie=name+"="+escape(BasketEncodeCookie(value))+";expires="+exp.toGMTString();
	}
	else
	{
		if (nameCookieValue.indexOf(value) == -1)
		{
			var arrCookies = nameCookieValue.split("；");
			var ValueNum = arrCookies.length;
			if (ValueNum > 5)
			{
				nameCookieValue = "";
				for (loop=0; loop < 5; loop++)
				{
					nameCookieValue += arrCookies[loop] + "；";
				}
				nameCookieValue = nameCookieValue.substring(0,nameCookieValue.length - 1);
			}

			var exp = new Date();
			exp.setTime(exp.getTime()+expires*60*60*1000);
			document.cookie=name+"="+escape(BasketEncodeCookie(value+"；"+nameCookieValue))+";expires="+exp.toGMTString();
		}
	}
}

function hide()
{
//  obj=document.getElementById("CompareBasket");
//  obj.style.display='none';
}

function show()
{
//  obj=document.getElementById("CompareBasket");
//  obj.style.display='block';
}

function Empty()
{
	BasketSetCookie("POP_SubCategory","",24);
	BasketSetCookie("POP_CompareProducts","",24);
	redraw();
}

// 判断选择的产品和以前选择的产品是否同类同类产品
function CheckCategoryChange(SubCategory)
{
	var SubCategorySN = BasketGetCookie("POP_SubCategory");
	if ((SubCategory == null) || (SubCategory == ""))
	{
		BasketSetCookie("POP_SubCategory",SubCategory,24);
	}
	else
	{
		if (SubCategory != SubCategorySN)
		{
			BasketSetCookie("POP_SubCategory",SubCategory,24);
			BasketSetCookie("POP_CompareProducts","",24);
		}
	}
}

function AddCompareProduct(ProductSN,ProductName,ProductLink,ProductImg,SubCategory)
{
	CheckCategoryChange(SubCategory);
	var CompareProducts = BasketGetCookie("POP_CompareProducts");
	if ((CompareProducts != "") && (CompareProducts != null))
	{
		var arrCookies = CompareProducts.split("；");
		if (arrCookies.length < 5)
		{
			if (("；"+CompareProducts).indexOf("；"+ProductSN+"|") != -1)
			{
				alert("（" + ProductName + "）已经被选择了！");
			}
			else
			{
				BasketCheckSetCookieValue("POP_CompareProducts",ProductSN + "|" + ProductName + "|" + ProductLink + "|" + ProductImg,24);
			}
		}
		else
		{
			alert("对不起！您只能选择五款同类产品进行比较。");
		}
	}
	else
	{
		BasketCheckSetCookieValue("POP_CompareProducts",ProductSN + "|" + ProductName + "|" + ProductLink + "|" + ProductImg,24);
	}
	redraw();
	//ShowLayer();
	showBoxManual()
}

function DelProduct(ProductSN)
{
	var nameCookieValue = BasketGetCookie("POP_CompareProducts");
	if ((nameCookieValue != null) && (nameCookieValue != ""))
	{
		if (nameCookieValue.indexOf(ProductSN+"|") > -1)
		{
			var arrCookies = nameCookieValue.split("；");
			var ValueNum = arrCookies.length;
			nameCookieValue = "";
			for (i=0; i < ValueNum; i++)
			{
				if (arrCookies[i].indexOf(ProductSN) == -1)
				{
					nameCookieValue += arrCookies[i] + "；";
				}
			}
			nameCookieValue = nameCookieValue.substring(0,nameCookieValue.length - 1);
			BasketSetCookie("POP_CompareProducts",nameCookieValue,24);
		}
		redraw();
	}
}

function redraw()
{
	//FixPosition();
	var CompareProducts = BasketGetCookie("POP_CompareProducts");
	if (CompareProducts == null)
	{
		CompareProducts = "";
	}
	var arrCookies = CompareProducts.split("；");
	var CompareTable = "";//"<table width='100%' border='0' cellpadding='1' cellspacing='1' bgcolor='#92BCDC' style='font-size:12px'>"
		//+ "<tr>"
		//+ "<td height='22' align='center' bgcolor='#E8F5FD'><b style='font-size:12px; color:red'>产品对比篮</b></td>"
		//+ "</tr>"
		//+ "<tr>"
		//+ "<td align='center' bgcolor='#E8F5FD'>";
	
		for (i = 0; i < arrCookies.length; i++)
		{
			if ((arrCookies[i] != "") && (arrCookies[i] != null))
			{
				if (arrCookies[i].indexOf("|") >= 0)
				{
					var ProductInfo = arrCookies[i].split("|");
					if (ProductInfo.length = 4)
					{
						var ProductSN = ProductInfo[0];
						var ProductName = ProductInfo[1];
						var ProductLink = ProductInfo[2];
						var ProductImg = ProductInfo[3];
						if (ProductSN == null)
						{
							ProductSN = "";
						}
						if (ProductName == null)
						{
							ProductName = "";
						}
						if (ProductLink == null)
						{
							ProductLink = "";
						}
						if (ProductImg == null)
						{
							ProductImg = "";
						}
						if ((ProductName != "") && (ProductSN != "") && (ProductLink != "") && (ProductImg != ""))
						{
						
							CompareTable = CompareTable + ""
								+ "<table class=\"cell\" align=\"center\" width=\"179\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
								+ "<tr>"
								+ "<td width=\"80\" align=\"center\" rowspan=\"2\" align=\"center\"><a href='" + ProductLink + "' target='_blank'><img src='" + ProductImg + "' width='60' style='border:1px solid #CBCDE1' height='60' border='0' alt='" + ProductName + "'></a></td>"
								+ "<td width=\"90\" align=\"left\" valign=\"top\"  style=\"LEFT: 0px; WORD-WRAP: break-word\">" + ProductName + "</td>"
								+ "</tr>"
								+ "<tr><td align=\"left\" valign=\"top\"><a style=\"cursor:pointer\" onClick=DelProduct('" + ProductSN + "')>删除</a></td></tr>"
								+ "</table>"
								//+ "<table width='80' align='center' border='0' cellpadding='0' cellspacing='0'>"
								//+ "<tr>"
								//+ "<td height='2'></td>"
								//+ "</tr>"
								//+ "</table>"
								//+ "<input type='button' name='Product" + i + "' value='" + ProductName + "' style='border:1px solid; border-color:#92BCDC; background-color:white; height:22px; width:111px; cursor:hand; color:black; font-size:12px' onClick=DelProduct('" + ProductSN + "');>"
								+ "</table>";
						}
					}
				}
			}
		}
//	CompareTable = CompareTable + "<table width='100%' border='0' cellpadding='0' cellspacing='0' style='font-size:12px'>"
//		+ "<tr>"
//		+ "<td height='25' align='center' valign='bottom'><a onClick='Empty()' style='color:blue;cursor: hand'>清空</a>&nbsp;&nbsp;&nbsp;<a onClick='HideLayer()' style='color:blue;cursor: hand'>隐藏</a></td>"
//		+ "</tr>"
//		+ "</table>"
//		+ "</td>"
//		+ "</tr>"
//		+ "<tr>"
//		+ "<td align='center' bgcolor='#E8F5FD'><input type='button' value='产品对比' class='button1' name='CompareBtn' style='cursor:hand; width:80px; font-size:12px' onClick=CompareCheck()></td>"
//		+ "</tr>"
//		+ "</table>";
	document.getElementById('divContent').innerHTML = CompareTable;
}

function IsNumber(inputVal)
{
	var inputStr = inputVal.toString();
	var i = 0;
	for (i =0; i<inputStr.length; i++)
	{
		var oneChar = inputStr.charAt(i)
		if (oneChar < "0" || oneChar> "9")
		{
			return false;
		}
	}
	return true;
}

function CompareCheck()
{
	var URL = "/b2b/product/product_compare.aspx";
	var CompareProductsValue = BasketGetCookie("POP_CompareProducts");
	if ((CompareProductsValue != "") && (CompareProductsValue != null))
	{
		var arrValues = CompareProductsValue.split("；");
		var ValuesNum = arrValues.length;
		if (ValuesNum < 2)
		{
			alert ('请至少选择两款同类别产品进行对比！');
			return;
		}
		else
		{
			var isTwo = false;
			if (ValuesNum == 2)//2款产品比较跳转至PK页
			{
				isTwo = true;
			}
			var SubCategorySN = BasketGetCookie("POP_SubCategory");
			if ((SubCategorySN != "") && (SubCategorySN != null))
			{
				if (IsNumber(SubCategorySN))
				{
					var QueryString = "Category=" + SubCategorySN;
//					if (isTwo)
//					{
//						QueryString = "";
//					}
					for (i = 0; i < ValuesNum; i++)
					{
						var ProductInfo = arrValues[i].split("|");
						if (IsNumber(ProductInfo[0]))
						{
//							if (isTwo)
//							{
//								QueryString += ProductInfo[0];
//								if (i == 0)
//								{
//									QueryString += "_";
//								}
//							}
//							else
//							{
								QueryString += "&Product" + i + "=" + ProductInfo[0];
//							}
						}
					}
//					if (isTwo)
//					{
//						//window.open('http://product.pcpop.com/pk/' + QueryString + '.html');
//					}
//					else
//					{
//						window.open(URL + "?" + QueryString);
//					}
					window.open(URL + "?" + QueryString);
				}
			}
		}
	}
}

redraw();

function HideLayer()
{
	BasketSetCookie("POP_HiddenCompare","Hide",24);
	hide();
}

function ShowLayer()
{
	BasketSetCookie("POP_HiddenCompare","Show",24);
	show();
}

if ((BasketGetCookie("POP_HiddenCompare") == "Hide") || (BasketGetCookie("POP_CompareProducts") == "") || (BasketGetCookie("POP_CompareProducts") == null))
{
	HideLayer();
}
else
{
	ShowLayer();
}
<!--
function verifyCompatibleBrowser(){
    this.ver=navigator.appVersion
    this.dom=document.getElementById?1:0
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
    return this
}
bw=new verifyCompatibleBrowser()

var speed=100
var loop, timer

function ConstructObject(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
    this.up=MoveAreaUp;this.down=MoveAreaDown;
    this.MoveArea=MoveArea; this.x; this.y;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}
function MoveArea(x,y){
    this.x=x;this.y=y
    this.css.left=this.x
    this.css.top=this.y
}
function MoveAreaDown(move){
	if(this.y>-this.scrollHeight+objContainer.clipHeight-30){
    this.MoveArea(0,this.y-move)
    if(loop) setTimeout(this.obj+".down("+move+")",speed)
	}
}
function MoveAreaUp(move){
	if(this.y<0){
    this.MoveArea(0,this.y-move)
    if(loop) setTimeout(this.obj+".up("+move+")",speed)
	}
}
function PerformScroll(speed){
	if(initialised){
		loop=true;
		if(speed>0) objScroller.down(speed)
		else objScroller.up(speed)
	}
}
function CeaseScroll(){
    loop=false
    if(timer) clearTimeout(timer)
}
var initialised;
function InitialiseScrollableArea(){
    objContainer=new ConstructObject('divContainer')
    objScroller=new ConstructObject('divContent','divContainer')
    objScroller.MoveArea(0,0)
    objContainer.css.visibility='visible'
    initialised=true;
}
function displayStatusMsg(msgStr) {
  status=msgStr;
  document.returnValue = true;
}
function preloadImages() {
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
function swapImgRestore() {
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}
function swapImage() {
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
var docEle = function() {
  return window.parent.document.getElementById(arguments[0]) || false;
}
function alertChangeSmallType() {
  alert('您选择了不同类型的产品，请先清空现在比较篮里的产品，然后再选择新产品!');
}
//-->