
if(typeof(Adknowledge)=="undefined"||!Adknowledge)
{Adknowledge={};}
Adknowledge.AdFeed=function()
{this._url="http://social.bidsystem.com/integratedAd.aspx?";this._numAds=0;this._adsJson=null;this._timeout=30000;this._channel='';this._callback=null;this._callbackArg=null;}
Adknowledge.AdFeed.prototype={get_numAds:function()
{return this._numAds;},get_ads:function()
{return this._adsJson;},retrieve:function(n,publisherId,applicationId,platformId,channel,callback,callbackArg)
{var self=this;this._channel=channel;this._callback=callback;this._callbackArg=callbackArg;jQuery.ajax({type:"GET",url:this._url,data:{'adsRequested':n,'channel':this._channel,'pid':publisherId,'appId':applicationId,'plid':platformId,'adSize':'integrated'},dataType:"jsonp",success:function(data){self._onFeedLoaded.call(self,data);},error:function(data){self._onFeedError.call(self,data,responseStatus);},complete:function(){self._onComplete.call(self);},timeout:this._timeout});},_onFeedLoaded:function(data,responseStatus)
{this._adsJson=data;this._numAds=data.length;},_onFeedError:function(request,status,error)
{this._adsJson=[];this._numAds=0;},_onComplete:function()
{if(this._callback!=null)
{this._callback(this,this._callbackArg);}}};Adknowledge.IntegratedAd=function(idSuffix)
{this._idSuffix=idSuffix;this._ad=null;this._autoLink=true;this._js=null;}
Adknowledge.IntegratedAd.prototype={addRegex:function()
{jQuery.expr[':'].regex=function(elem,index,match)
{var matchParams=match[3].split(','),validLabels=/^(data|css):/,attr={method:matchParams[0].match(validLabels)?matchParams[0].split(':')[0]:'attr',property:matchParams.shift().replace(validLabels,'')},regexFlags='ig',regex=new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''),regexFlags);return regex.test(jQuery(elem)[attr.method](attr.property));}},include_js_special:function(file,publisherId,applicationId,platformId)
{var self=this;var html_doc=document.getElementsByTagName('head')[0];this._js=document.createElement('script');this._js.setAttribute('type','text/javascript');this._js.setAttribute('src',file);html_doc.appendChild(this._js);this._js.onreadystatechange=function(){Adknowledge.IntegratedAd.RenderAll(publisherId,applicationId,platformId);}
this._js.onload=function(){Adknowledge.IntegratedAd.RenderAll(publisherId,applicationId,platformId);}
return false;},get_ad:function()
{return this._ad;},set_ad:function(value)
{this._ad=value;},get_autoLink:function()
{return this._autoLink;},set_autoLink:function(value)
{this._autoLink=value;},render:function()
{var title=jQuery(':regex(id,'+Adknowledge.IntegratedAd.ID_PREFIX+Adknowledge.IntegratedAd.ID_TITLE+this._idSuffix+')');var description=jQuery(':regex(id,'+Adknowledge.IntegratedAd.ID_PREFIX+Adknowledge.IntegratedAd.ID_DESCRIPTION+this._idSuffix+')');var product=jQuery(':regex(id,'+Adknowledge.IntegratedAd.ID_PREFIX+Adknowledge.IntegratedAd.ID_PRODUCT+this._idSuffix+')');var callToAction=jQuery(':regex(id,'+Adknowledge.IntegratedAd.ID_PREFIX+Adknowledge.IntegratedAd.ID_CALL+this._idSuffix+')');var click=jQuery(':regex(id,'+Adknowledge.IntegratedAd.ID_PREFIX+Adknowledge.IntegratedAd.ID_CLICK+this._idSuffix+')');var icon=jQuery(':regex(id,'+Adknowledge.IntegratedAd.ID_PREFIX+Adknowledge.IntegratedAd.ID_ICON+this._idSuffix+')');var pixel=jQuery(':regex(id,'+Adknowledge.IntegratedAd.ID_PREFIX+Adknowledge.IntegratedAd.ID_PIXEL+this._idSuffix+')');var currencyAmount=jQuery(':regex(id,'+Adknowledge.IntegratedAd.ID_PREFIX+Adknowledge.IntegratedAd.ID_CURRENCY_AMOUNT+this._idSuffix+')');var currencyName=jQuery(':regex(id,'+Adknowledge.IntegratedAd.ID_PREFIX+Adknowledge.IntegratedAd.ID_CURRENCY_NAME+this._idSuffix+')');if(this._ad!=null)
{title.empty().append(this._ad.title);description.empty().append(this._ad.description);product.empty().append(this._ad.productName);callToAction.empty().append(this._ad.callToAction);click.empty().append(this._ad.clickUrl);currencyAmount.empty().append(this._ad.currencyAmount);currencyName.empty().append(this._ad.currencyName);icon.attr('src',this._ad.iconUrl);if(pixel.size()<=0)
{jQuery(document.body).append('<img src="'+this._ad.pixelUrl+'" height="1" width="1" />');}
else
{pixel.attr('src',this._ad.pixelUrl);}
if(this._autoLink===true)
{var clickScript='<a href="javascript:window.top.location.href=\''+this._ad.clickUrl+'\';"></a>';title.wrapInner(clickScript);description.wrapInner(clickScript);product.wrapInner(clickScript);callToAction.wrapInner(clickScript);icon.wrap(clickScript);}}
else
{title.hide();description.hide();product.hide();callToAction.hide();click.hide();currencyAmount.hide();currencyName.hide();icon.hide();}}};Adknowledge.IntegratedAd.DEBUG=false;Adknowledge.IntegratedAd.ID_PREFIX='_adk-';Adknowledge.IntegratedAd.ID_TITLE='title-';Adknowledge.IntegratedAd.ID_DESCRIPTION='description-';Adknowledge.IntegratedAd.ID_PRODUCT='product-';Adknowledge.IntegratedAd.ID_CALL='callToAction-';Adknowledge.IntegratedAd.ID_CLICK='click-';Adknowledge.IntegratedAd.ID_ICON='icon-';Adknowledge.IntegratedAd.ID_PIXEL='pixel-';Adknowledge.IntegratedAd.ID_CURRENCY_AMOUNT='currencyAmount-';Adknowledge.IntegratedAd.ID_CURRENCY_NAME='currencyName-';Adknowledge.IntegratedAd.RenderAll=function(publisherId,applicationId,platformId)
{if(typeof(jQuery)=="undefined"||!jQuery)
{ia=new Adknowledge.IntegratedAd();ia.include_js_special('http://icons.cubics.com/script/jquery-1.3.2.min.js',publisherId,applicationId,platformId);}else{ia=new Adknowledge.IntegratedAd();ia.addRegex();var adNames=[];var ads=[];var regex=/^\_adk-(\w*)-(.*)$/ig;var elements=jQuery(':regex(id,^'+Adknowledge.IntegratedAd.ID_PREFIX+'('+Adknowledge.IntegratedAd.ID_TITLE+'|'+Adknowledge.IntegratedAd.ID_PRODUCT+').*$)');elements.each(function(i,e)
{regex.lastIndex=0;var idMatch=regex.exec(e.id);if(idMatch&&idMatch.length>=3)
{var exists=false;for(var a=0;a<adNames.length&&!exists;a++)
{if(adNames[a]==idMatch[2])
{exists=true;}}
if(!exists)
{adNames[adNames.length]=idMatch[2];}}
idMatch=null;});for(var a=0;a<adNames.length;a++)
{var feed=new Adknowledge.AdFeed();var suffix=adNames[a];ads[a]=new Adknowledge.IntegratedAd(adNames[a]);var channel=window.location.pathname.substring(window.location.pathname.lastIndexOf('/')+1)+' - '+adNames[a];var callback=function(f,i)
{if(f.get_numAds()>0)
{ads[i].set_ad(f.get_ads()[0]);}
ads[i].render();};feed.retrieve(1,publisherId,applicationId,platformId,channel,callback,a);}}};