//<!--
// \include\lib\_global\_ui\_ex\ads.js@@\main\5 

function EbayAdManager()
{if(!this.objType)
this.objType="EbayAdManager";this.randomKey=(new Date()).getTime();this.ads=new Array;this.register=ebRegisterAd;}
function ebRegisterAd(pAd)
{if(pAd)
{var iL=this.ads.length;pAd.setAdLayerId(iL);this.ads[iL]=pAd;}}
function EbayAd(pParent,pName,pCfg,pMgr,pRandomNum)
{if(!this.objType)
this.objType="EbayAd";this.base=EbayBaseControl;this.base(pParent,pName);this.globals=initAdGlobals();this.adUrl="";this.adLinkUrl="";this.adImageUrl="";this.config=pCfg||(new EbayAdConfig(pName));this.toHTML=ebAdHTML;this.layerId="ad_"+this.name;this.setAdLayerId=ebSetAdLayerId;this.setCountryGlobals=null;this.setCountryLocals=null;if(typeof(pMgr)=="undefined"||pMgr==null)
pMgr=new EbayAdManager();this.manager=pMgr;this.ord=pRandomNum||pMgr.randomKey;if(document.layers)
pMgr.register(this);}
window.EbayAd=EbayAd;function ebSetAdLayerId(pId)
{this.layerId="ad_"+this.name+pId;}
function EbayAdConfig(pName)
{if(!this.objType)
this.objType="EbayAdConfig";this.base=EbayConfig;this.base(pName);this.tile=1;this.width=0;this.height=0;this.ifWidth=0;this.ifHeight=0;this.DARTSite="";this.DARTSiteAll="";this.zones=new Array;this.categories=new Array;this.params=new Array;this.sets=new Array;this.addParam=EbayAddAdParam;this.addSet=EbayAddAdSet;this.getAdParamString=ebAdParamString;this.zoneEncode=ebZoneEncode;}
window.EbayAdConfig=EbayAdConfig;function EbayAdTableConfig(pName)
{if(!this.objType)
this.objType="EbayAdTableConfig";this.base=EbayAdConfig;this.base(pName);this.ncount=1;this.orientation="";this.rows=0;this.cellspacing=0;this.sizes="";}
function ebZoneEncode(pName)
{var rs="",c;for(var i=0;i<pName.length;i++)
{c=pName.charAt(i);if(c==' ')
rs+="_";else if(c=='&')
rs+="and";else if(c!=',')
rs+=c;}
return rs.toLowerCase();}
function EbayAdGlobals()
{this.sitePrefix="ebay.us";this.setHost=EbaySetAdHost;this.setSitePrefix=EbaySitePrefix;this.resetGlobals=EbayResetGlobals;this.isHTTPS=false;if(document.location.protocol=="https:")
this.isHTTPS=true;this.setHost("ebay.dou"+"blec"+"lic"+"k.net/");this.resetGlobals();}
function EbayResetGlobals()
{var ho=this.host,sP=this.sitePrefix;this.iframeUrl=ho+"adi/"+sP;this.layerUrl=ho+"adl/"+sP;this.linkUrl=ho+"jump/"+sP;this.imageUrl=ho+"ad/"+sP;}
function EbaySetAdHost(pHost)
{this.host=pHost;if(pHost.substring(pHost.length-1,pHost.length)!="/")
this.host=pHost+"/";var h=this.host,hs="htt"+"ps://",hp="htt"+"p://";if(h.substr(0,7)==hp)
{if(this.isHTTPS)
h=hs+h.substr(7,h.length)}
else
{if(this.isHTTPS)
h=hs+h;else
h=hp+h;}
this.host=h;}
function EbaySitePrefix(pSitePre)
{this.sitePrefix=pSitePre;this.resetGlobals();}
function EbayAddAdParam(pKey,pValue)
{if(pKey.length>0)
this.params[pKey.toLowerCase()]=pValue.toLowerCase();}
function EbayAddAdSet(pKey,pValue)
{aTemp=new Array(pValue.toLowerCase());if(pKey.length>0)
{if(this.sets[pKey]==null)
{this.sets[pKey]=aTemp;}
else
{this.sets[pKey][this.sets[pKey].length]=pValue.toLowerCase();}}}
var adGlobals=null;function initAdGlobals()
{if(adGlobals)
return adGlobals;else
{adGlobals=new EbayAdGlobals();return adGlobals;}}
function ebAdParamString(pGb,pOrd)
{var sData="",sZones="",sCats="",ret;with(this)
{var adt=objType.is("EbayAdTableConfig");DARTSite=DARTSite.toLowerCase();if(pGb)
DARTSiteAll=pGb.sitePrefix+"."+DARTSite;for(var i=0;i<zones.length;i++)
{if(sZones.length>0)
sZones+="/";sZones+=zoneEncode(zones[i].toLowerCase());}
if(sZones.length>0)
sZones=sZones+";"
for(var i=0;i<categories.length;i++)
{if(categories[i].length>0)
sCats+="cat="+categories[i]+";";}
if(adt)
{sData+="tn="+ncount+";";if(orientation)
sData+="to="+orientation+";";if(rows)
sData+="tr="+rows+";";if(cellspacing)
sData+="tsw="+cellspacing+";";}
else
{if(tile)
sData+="tile="+tile+";";if(ifWidth<width)
ifWidth=width;if(ifHeight<height)
ifHeight=height;}
for(var k in params)
{if(params[k].length>0)
sData+=k+"="+params[k]+";";}
for(var k in sets)
{for(var i=0;i<sets[k].length;i++)
{if(sets[k][i].length>0)
sData+=k+"="+sets[k][i]+";";}}
if(adt)
{if(sizes.indexOf(',')!=-1)
sData+="szs="+sizes+";";else
sData+="sz="+sizes+";";}
else
sData+="sz="+width+"x"+height+";";sData+="ord="+pOrd+";"
ret="."+DARTSite+(sZones?("/"+sZones):"")+(sCats?sCats:"")+sData;}
return ret;}
function ebAdHTML()
{if(this.setCountryGlobals)
{this.setCountryGlobals(this.globals);this.globals.resetGlobals();}
if(this.setCountryLocals)
this.setCountryLocals(this.config);var cfg=this.config;var gb=this.globals;var adt=cfg.objType.is("EbayAdTableConfig");var adParams=cfg.getAdParamString(gb,this.ord);var sAdLUrl=""
var sAdIFUrl="",sAdImgUrl="",sAdLinkUrl="";sAdLUrl=gb.layerUrl+adParams;sAdIFUrl=gb.iframeUrl+adParams;sAdLinkUrl=gb.linkUrl+adParams;sAdImgUrl=gb.imageUrl+adParams;var rs="";if(document.layers)
{this.adUrl=sAdLUrl;rs='<ILAYER id="'+this.layerId+'" visibility="hidden" width="';rs+=cfg.ifWidth+'" height="'+cfg.ifHeight+'"></ILAYER>';}
else
{this.adUrl=sAdIFUrl;this.adLinkUrl=sAdLinkUrl;this.adImageUrl=sAdImgUrl;rs='<IFRAME FRAMEBORDER="no" BORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no"';rs+=' ID="'+this.name+'"';rs+=' SRC="'+sAdIFUrl+'"';rs+=' WIDTH="'+cfg.ifWidth+'" HEIGHT="'+cfg.ifHeight+'"';rs+='>';if(!adt)
{rs+='<A HREF="'+sAdLinkUrl+'">';rs+='<IMG SRC="'+sAdImgUrl+'" border="0" height="'+cfg.height+'" width="'+cfg.width+'">';rs+='</A>';}
rs+='</IFRAME>';}
return rs;}

// \include\lib\_global\features\ads\adWrapper.js@@\main\8 

var oAdManager=new EbayAdManager();var defDARTSite="general";var defAdZone="overview";var defMaxCatLevels=6;var defMainAdWidth=468;var defMainAdHeight=60;var defSideAdWidth=120;var defSideAdHeight=60;var adload;function writeAd(pDARTSite,pZone,pTile,pW,pH,pIFW,pIFH,pCustomParams,pCustomSets)
{if(pZone.length==0)
pZone="home";var cfg1=getCustomAdConfig(pDARTSite,[pZone],pTile,pW,pH,pIFW,pIFH,pCustomParams,pCustomSets);var h=getStandardAdHTML(cfg1);document.write(h);}
function getCustomAdConfig(pDARTSite,pZone,pTile,pW,pH,pIFW,pIFH,pCustomParams,pCustomSets)
{var cfg=getStandardAdConfig("generic",pDARTSite,pZone,pTile,pW,pH,pIFW,pIFH);setCustomAdParam(cfg,pCustomParams);if(typeof(pCustomSets)=="string")
pCustomSets=pCustomSets.parseSets();setCustomAdSet(cfg,pCustomSets);return cfg;}
function writeHomepageAd(pDARTSite,pZone,pTile,pW,pH,pIFW,pIFH)
{var cfg1=getStandardAdConfig("homePage",pDARTSite,[pZone],pTile,pW,pH,pIFW,pIFH);var h=getStandardAdHTML(cfg1);document.write(h);}
function writeAdTable(pCfg,pCustomParams,pCustomSets)
{if(typeof(pCfg)=="undefined"||!pCfg.objType.is("EbayAdTableConfig"))
return;var c=pCfg;setCustomAdParam(c,pCustomParams);if(typeof(pCustomSets)=="string")
pCustomSets=pCustomSets.parseSets();setCustomAdSet(c,pCustomSets);var h=getStandardAdHTML(c);document.write(h);}
function writeSearchAd(pKeyword,pHideLinkAds,pCustomParams,pMainW,pMainH,pSide1W,pSide1H,pSide2W,pSide2H)
{pMainW=pMainW||defMainAdWidth;pMainH=pMainH||defMainAdHeight;pSide1W=pSide1W||defSideAdWidth;pSide1H=pSide1H||defSideAdHeight;pSide2W=pSide2W||defSideAdWidth;pSide2H=pSide2H||defSideAdHeight;pKeyword=pKeyword||keyword;var c;var adsizes;if(pHideLinkAds)
c=getStandardAdTableConfig("search_adt","search",["keywords"],1,[pMainW+"x"+pMainH]);else
c=getStandardAdTableConfig("search_adt","search",["keywords"],3,[pMainW+"x"+pMainH,pSide1W+"x"+pSide1H,pSide2W+"x"+pSide2H],"h",0,10);if(!setCatNumbers(c))
c.addParam("cat","0");c.addParam("kw",pKeyword);setCustomAdParam(c,pCustomParams);var h=getSearchListingAdHTML(c);document.write(h);}
function setCustomAdParam(pCfg,pParams)
{if(typeof(pParams)=="string")
pParams=[pParams];if(pParams&&pParams.length>0)
{for(var i=0;i<pParams.length;i++)
{if(typeof(pParams[i])!='undefined')
{if(pParams[i].indexOf("=")!=-1)
{var tmp=pParams[i].split("=");pCfg.addParam(tmp[0],tmp[1]);}}}}}
function setCustomAdSet(pCfg,pParams)
{if(typeof(pParams)=="string")
pParams=[pParams];if(pParams)
{for(i in pParams)
{for(var j=0;j<=pParams[i].length;j++)
{if(typeof(pParams[i][j])!='undefined')
{pCfg.addSet(i,pParams[i][j]);}}}}}
function writeListingAd(pHideLinkAds,pCustomParams)
{var DARTSite=defDARTSite;if(typeof(category_level0)!="undefined"&&category_level0.length>0&&category_level0!="0")
DARTSite=category_level0;else if(typeof(cat0_name)!="undefined"&&cat0_name.length>0)
DARTSite=cat0_name;if(DARTSite=="ebay_motors"||DARTSite.toLowerCase()=="ebay motors")
DARTSite="motors";DARTSite=DARTSite.substring(0,23);var adZones=[defAdZone];if(typeof(cat1_name)!="undefined"&&cat1_name.length>0)
adZones=[cat1_name];var c;if(DARTSite!="6000"&&DARTSite!="motors"&&pHideLinkAds!=true)
{c=getStandardAdTableConfig("listings_adt",DARTSite,adZones,3,[defMainAdWidth+"x"+defMainAdHeight,defSideAdWidth+"x"+defSideAdHeight,defSideAdWidth+"x"+defSideAdHeight],"h",0,10);}
else
c=getStandardAdTableConfig("listings_adt",DARTSite,adZones,1,[defMainAdWidth+"x"+defMainAdHeight]);if(!setCatNumbers(c))
c.addParam("cat","0");setCustomAdParam(c,pCustomParams);var h=getSearchListingAdHTML(c);document.write(h);}
function getStandardAdConfig(pName,pDARTSite,pZones,pTile,pW,pH,pIW,pIH)
{var c=new EbayAdConfig(pName);c.tile=pTile;c.width=pW;c.height=pH;c.ifWidth=pIW||pW;c.ifHeight=pIH||pH;c.DARTSite=new String(pDARTSite);c.zones=pZones;setCatNumbers(c);if(typeof(ebSelCBObj)!="undefined"&&ebSelCBObj!=null)
{var cb=ebSelCBObj.name.toLowerCase();if(cb!="ebay")
c.addParam("!category",cb);}
c.addParam("dcopt","ist");return c;}
function getStandardAdTableConfig(pName,pDARTSite,pZone,pNumberofAds,pSizes,pOrientation,pRows,pCellSpacing,pIFW,pIFH)
{var c=new EbayAdTableConfig(pName);c.ncount=pNumberofAds;c.orientation=pOrientation?pOrientation:"";c.rows=pRows?pRows:0;c.cellspacing=pCellSpacing?pCellSpacing:0;c.ifWidth=pIFW?pIFW:0;c.ifHeight=pIFH?pIFH:0;setAdsTableSize(c,pSizes);setAdsTableIFSize(c,pSizes);c.DARTSite=new String(pDARTSite);c.zones=pZone;if(typeof(ebSelCBObj)!="undefined"&&ebSelCBObj!=null)
{var cb=ebSelCBObj.name.toLowerCase();if(cb!="ebay")
c.addParam("!category",cb);}
return c;}
function setAdsTableSize(pCfg,pSizes)
{if(typeof(pSizes)!="undefined")
{var sStr="";var i=0;for(;i<pSizes.length-1;i++)
sStr+=pSizes[i]+",";sStr+=pSizes[i];pCfg.sizes=sStr;}}
function setAdsTableIFSize(pCfg,pSizes)
{if(pCfg.rows>1)return;if(typeof(pSizes)!="undefined")
{var x=y=w=h=l=0;var horizontal=true;var a;l=pSizes.length;if(pCfg.orientation.is('v'))horizontal=false;for(var i=0;i<l;i++)
{a=pSizes[i].split("x");x=parseInt(a[0]);y=parseInt(a[1]);if(horizontal)
{w+=x;h=(y>h)?y:h;}
else
{w=(x>h)?x:w;h+=y;}}
var pad=parseInt(pCfg.cellspacing)*(l?l-1:l)
if(horizontal)
w+=pad;else
h+=pad
pCfg.ifWidth=(w>pCfg.ifWidth)?w:pCfg.ifWidth;pCfg.ifHeight=(h>pCfg.ifHeight)?h:pCfg.ifHeight;}}
function getStandardAdHTML(pCfg)
{var eAd1=new EbayAd(ebay,pCfg.name,pCfg,oAdManager);eAd1.setCountryGlobals=setAdCountryGlobals;eAd1.setCountryLocals=setAdCountryLocals;return eAd1.toHTML();}
function getSearchListingAd(pType,pCfg)
{var eAd=new EbayAd(ebay,pType,pCfg,oAdManager);eAd.setCountryGlobals=setAdCountryGlobals;eAd.setCountryLocals=setAdCountryLocals;return eAd;}
function getSearchListingAdHTML(pCfg)
{if(typeof(pCfg)=="undefined")
return"";var h=getStandardAdHTML(pCfg);var pa=ebay.oGlobals.oEnvironment.sPicsDir;var sIm;if(pa)
sIm='src="'+pa+'x.gif" ';else
sIm='src="'+includeHost+'/aw/pics/x.gif" ';var h2='<table width="100%" border="0" cellspacing="0" cellpadding="5"><img '+sIm;h2+='width="1" height="18" border="0"><tr><td></td></tr><tr><td>'+h+'</td></tr></table>';return h2;}
function setCatNumbers(pCfg)
{var cs=true,isAdded=false;var aCats=new Array();if(typeof(defMaxCatLevels)!="undefined")
{for(var i=0;i<defMaxCatLevels&&(cs!="0");i++)
{if(eval("typeof(category_level"+i+")!=\"undefined\""))
{cs=eval("category_level"+i);aCats[i]=cs;isAdded=true;}
else
{aCats[i]="";}}
pCfg.categories=aCats;}
return isAdded;}
function createAdStr(pW,pH,pTile,pIFWidth,pIFHeight)
{if(slOut.length>0)
{var tmp=slOut.split("/");if(tmp[0]=="motors"||tmp[0]=="ebaymotors")
tmp[0]="6000";writeAd(tmp[0]?tmp[0]:"",tmp[1]?tmp[1]:"",pTile,pW,pH,pIFWidth,pIFHeight,[]);}
return"";}
if(typeof(catIndexCatName)!="undefined")
{slStr="catindex";if(catIndexCatName=="")
catIndexCatName="general";slOut=catIndexCatName;if(catIndexCatName.indexOf("/")==-1)
slOut+="/home";adload=true;}

// \include\lib\us\features\ads\adlocals.js@@\main\1 

function setAdCountryGlobals(pGlobals)
{pGlobals.sitePrefix="ebay.us";}
function setAdCountryLocals(pCfg)
{}
//-->