//<pre style="display:inline">Start:SkusListMgr<hr>
//=== unit:/TC/TC.js ===

if(false)
function TC(DUMMY){};
TC={}

//=== end unit:/TC/TC.js ===<hr>//=== unit:/TC/TC.SKUs.js ===

if(false)
TC.SKUs=function(DUMMY){};
TC.SKUs=GameCatalog.Game.All.BySku;
TC.SKUs.All=GameCatalog.Game.All;
TC.SKUs.extendDataFromSKU=function(oTarget,sku,useSafeExtend){
if(oTarget.sku)sku=oTarget.sku;
Claim.isNumber(parseInt(sku),'TC.SKUs.extendDataFromSKU(...) - the sku of the game to enhance from should be provided ither as a property "sku" on the provided oTarget, or as a second parameter');
var oGame=this[sku];
if(!oGame)
return null;
if(useSafeExtend)return Object.safeExtend(oTarget,oGame);
return Object.extend(oTarget,oGame);}


//=== end unit:/TC/TC.SKUs.js ===<hr>//=== unit:/TC/TC.Tags.js ===

if(GameCatalog.Tag){
TC.Tags=GameCatalog.Tag.All;}


//=== end unit:/TC/TC.Tags.js ===<hr>//=== unit:/_infra/Array.js ===

if(false){
Array=function(DUMMY){};}
Array.prototype.cut=function(iStart,iCount){
var iEnd=undefined;
if(iStart==undefined)iStart=0;
iEnd=(iCount==undefined)?this.length:iStart+iCount;
return this.slice(iStart,iEnd);}
Array.prototype.page=function(iPage,iItemsInPage){
return this.cut(iPage*iItemsInPage,iItemsInPage);}


//=== end unit:/_infra/Array.js ===<hr>//=== unit:/_infra/ClientTools/Log4Js.js ===

if(false){
Log4Js=function(DUMMY){};}
Log4Js.pop=function(conf){
if(!conf||typeof(conf)!='object'){
conf={anchorsByName:{"*":["t1"],Claim:["t2"]},targetByAnchor:{t1:new Log4Js.PopupTarget(Log4Js.ALL,"log4js-%U-%T",true),t2:new Log4Js.PopupTarget(Log4Js.FATAL,"log4js-%U-%T",true)}};}
Cookies.set("log4js.config",conf,{});
this.fromConfig(conf);}
Log4Js.add=function(sClassName,enLEVEL){
Claim.isString(sClassName,"Log4Js.add(sClassName, enLEVEL) - sClassName must be a string");
Claim.isString(enLEVEL,"Log4Js.add(sClassName, enLEVEL) - enLEVEL must Log Level ALL, DEBUG, WARN, ...");
var iLevel=this[enLEVEL.toUpperCase()];
Claim.isNumber(iLevel,"Log4Js.add(sClassName, enLEVEL) - Log4Js."+enLEVEL+" is not a valid warn-level");
Claim.check(iLevel>=0&&iLevel<=6,"0 <= iLevel <= 6","Log4Js.add(sClassName, enLEVEL) - Log4Js[enLEVEL must be between 0 to 6");
var conf=this.toConfig();
conf.targetByAnchor.newAnchor=new Log4Js.PopupTarget(iLevel,"log4js-%U-%T",true)
conf.anchorsByName[sClassName]=["newAnchor"];
this.pop(conf);}
Log4Js.clear=function(sClassName){
Claim.isString(sClassName,"Log4Js.clear(sClassName) - sClassName must be a string");
var conf=this.toConfig();
delete conf.anchorsByName[sClassName];
this.pop(conf);}
Log4Js.stop=function(){
var conf={anchorsByName:{"*":["t1"]},targetByAnchor:{t1:new Log4Js.PopupTarget(Log4Js.NONE,"log4js-%U-%T",true)}};
Cookies.set("log4js.config",conf,{});
this.fromConfig(conf);}


//=== end unit:/_infra/ClientTools/Log4Js.js ===<hr>//=== unit:/_infra/Object.js ===

if(false){
Object=function(DUMMY){};}
Object.clone=function(obj){
return this.extend({},obj);}
Object.safeExtend=function(destination,source){
if(!destination)destination={};
for(property in source){
if(undefined===destination[property])
destination[property]=source[property];}
return destination;}
Object.serialize=function(value){
var arrObjs=[];
function ser(v){
switch(typeof(v)){
case 'NaN':return "NaN";
case 'undefined':return "undefined";
case 'boolean':return(v).toString();
case 'number':return(isFinite(v))?(v).toString():"\"Infinity\"";
case 'string':return "\"" + v.replace(/\"/g,"\\\"") + "\"";
case 'function':return "{function}";}
if(v==null)return "null";
if(v instanceof Date)return "new Date("+v.getTime()+")";
if(v instanceof Array){
var i,arr=[];
if(window.GameCatalog){
if(GameCatalog.TagSkuLinks&&v.byWeight==GameCatalog.TagSkuLinks.prototype.byWeight)
return "[GameCatalog.TagSkuLinks,length: "+v.length+"]";
if(GameCatalog.SkuTagLinks&&v.byWeight==GameCatalog.SkuTagLinks.prototype.byWeight)
return "[GameCatalog.SkuTagLinks,length: "+v.length+"]";}
for(i=0;i<v.length;i++)
arr[arr.length]=ser(v[i]);
return "["+arr.toString()+"]";}
if(arrObjs.indexOf(v)!=-1){
return "\"*ref" + (  (v.id)? "-id:" + v.id : (  (v.name) ? "-name:" + v.name : ":" + v.toString()  )   ) + "\"";}
arrObjs[arrObjs.length]=v;
if(v.parentNode&&v.attributes&&(v.children||v.childNodes)&&v.tagName){
var i,e={tagName:v.tagName,parent:v.parentNode.tagName,innerHTML:"\"" + v.innerHTML.replace(/"/g,"\\\"").replace(/</g, "&lt;") + "\"" /*>&lt/g, "&amp;lt;") + "\""/*leave this comment*/};
for(i=0;i<v.attributes.length;i++)
if(v.attributes[i].value&&v.attributes[i].value!="null")
e[v.attributes[i].name]=v.attributes[i].value;
return ser(e);}
var each,arr=[];
try{
for(each in v){
if(null !==v[each])
arr[arr.length]=each+":"+ser(v[each]);}
return "{"+arr.toString()+"}";}catch(ex){
return "\"-error in serializing:" + ex.message + "-\""}}
return ser(value);}
Object.getAttribute=function(object,attribute,log){
var value=object[attribute];
if('function'==typeof(value)){
if(log instanceof Log4Js.Logger)log.debug("Object.getAttribute - Attribute ["+attribute+"] is a function. Assuming it to be a getter.");
try{
value=value.apply(object);}catch(ex){
if(log instanceof Log4Js.Logger)log.error("Object.getAttribute - Attribute ["+attribute+"] getter failed: "+Object.serialize(ex));
throw ex;}}
if(log){
if(null==value)log.warn("Object.getAttribute - Attribute ["+attribute+"] returned null");
else log.info("Object.getAttribute - Attribute ["+attribute+"] returned value: ["+Object.serialize(value)+"]");}
return value;}


//=== end unit:/_infra/Object.js ===<hr>//=== unit:/_infra/String.js ===

if(false){
String=function(DUMMY){};}
String.empty=String.Empty="";
String.prototype.populateTemplate=function(oMapping){
Claim.isObject(oMapping,"String.populateTemplate(..,oMapping,..)");
var sTemplate,placeholder,replacement;
sTemplate=String(this);
for(placeholder in oMapping){
if(sTemplate.indexOf(placeholder)==-1)
continue;
replacement=Object.getAttribute(oMapping,placeholder);
sTemplate=sTemplate.replace(new RegExp(placeholder,"g"),replacement);}
return sTemplate;}
String.prototype.beutifySerialization=function(){
var out=[],indent="",i,arr=this.split("");
for(i=0;i<arr.length;i++){
switch(arr[i]){
case "{":
indent+="\t";
out[out.length]="\n"+indent;
out[out.length]=arr[i]+"\t";
break;
case "}":
out[out.length]="\n"+indent;
out[out.length]=arr[i]+"\t";
indent=indent.substr(1);
break;
case "[":
indent+="\t";
out[out.length]="\n"+indent;
out[out.length]=arr[i]+"\t";
break;
case "]":
out[out.length]="\n"+indent;
out[out.length]=arr[i]+"\t";
indent=indent.substr(1);
break;
case ",":
out[out.length]="\n"+indent;
out[out.length]=arr[i]+"\t";
break;
default:
out[out.length]=arr[i];}}
return out.join("");}
String.prototype.bindTemplate=function(oMapping,oData,oLog){
Claim.isObject(oMapping,"String.bindTemplate(..,oMapping,..)");
Claim.isObject(oData,"String.bindTemplate(..,oData)");
var oDataSource=('object'==typeof(oData.dataItem))?oData.dataItem:oData;
var sTemplate,placehoder,attribute,replacment;
var log=(oLog&&oLog instanceof Log4Js.Logger)?oLog:new Log4Js.Logger("String.bindTemplate");
sTemplate=this.toString();
for(placehoder in oMapping){
if(this.indexOf(placehoder)==-1){
log.debug("in bindTemplate(...) - placeholder '"+placehoder+"' is not found in bound template");
continue;}
attribute=oMapping[placehoder];
if(undefined==attribute||null==attribute){
log.warn("in bindTemplate(...) oMapping dictionary specifies a placeholder without providing its data-attribute name: "+placehoder);
continue;}
switch(typeof(attribute)){
case 'function':
try{
replacement=attribute(oData,log);}catch(ex){
log.error("String.bindTemplate - Error in mapping-handler for "+placehoder+" : "+attribute.toString());
throw ex;}
break;
case 'string':
replacement=Object.getAttribute(oData,attribute,log);
if(null==replacement){
log.warn("in bindTemplate(...) oMapping dictionary specifies a property that does not exist on the provided oDataSource, or does not return a value. Placehoder: "+placehoder+", using the name of the attribute as constant: "+attribute);
replacement=attribute;}
break;
default:
log.debug("in bindTemplate(...) oMapping dictionary specifies a mapping constant ["+attribute+"] for placeholder ["+placehoder+"]");
replacement=String(attribute);}
sTemplate=sTemplate.replace(new RegExp(placehoder,"g"),replacement);}
return sTemplate;}
String.prototype.trim=function(){
var iStart=-1,iEnd=this.length;
while(this.charAt(++iStart)==' ');
while(this.charAt(--iEnd)==' ');
if(iStart==iEnd&&this.charAt(iStart)!=' ')return this.substr(iStart,1);
return this.substring(iStart,iEnd+1);}
String.prototype.leftPad=function(c,iLength){
s=this.toString();
while(s.length<iLength)s=c+s;
return s;}


//=== end unit:/_infra/String.js ===<hr>//=== unit:/_infra/ClientTools/Class.js ===

if(false){
Class=function(DUMMY){};}
Class.create=function(parent){
var fConstr=function(){
var arrCtors=[];
var fConstructor=this.constructor;
do{
if('function'==typeof(fConstructor.prototype.initialize))
arrCtors[arrCtors.length]=fConstructor.prototype.initialize;
fConstructor=fConstructor.parentConstructor;}
while(typeof(fConstructor)=='function');
for(var i=arrCtors.length;i-->0;){
arrCtors[i].apply(this,arguments);}}
if(parent){
return Class.linkInheritance(parent,fConstr);}
return fConstr;}
Class.linkInheritance=function(parent,subclass){
if(typeof(parent)=='string')
parent=eval(parent);
Claim.check(typeof(parent)=='object'||typeof(parent)=='function',"'parent' is a function or an object","Class.linkInheritance(parent)")
Claim.isFunction(subclass,"Class.linkInheritance(subclass)");
subclass=Object.extend(subclass,parent);
delete subclass.AsPrototype;
subclass.parentConstructor=parent;
subclass.prototype=Class.AsPrototype(parent);
subclass.prototype.constructor=subclass;
return subclass;}
Class.AsPrototype=function(fClass){
switch(typeof(fClass)){
case 'string':
if(window[fClass]!=null&&window[fClass]===eval(fClass)){
if(typeof(eval(fClass))!='function')throw new Error("'"+fClass+"' does not evaluates to a valid class");
return Class.AsPrototype(eval(fClass));}
case 'function':
var oProto;
if(fClass===Object)return{};
if(typeof(fClass.AsPrototype)=='function'){
oProto=fClass.AsPrototype();
if(typeof(oProto)!='object')throw new Error("provided class implements.AsPrototype() but it did not return an instance.");}
else{
try{
oProto=new fClass();}
catch(ex){
throw new Error("Class.AsPrototype(fClass) Failed to instantiate 'fClass' with default constructor. \n\nError message: "+ex.message);}}
return oProto;
case 'object':
return Object.extend({},fClass);
default:
throw new Error("A prototype can be extracted only from one of the followings: \n\t- an object instance \n\t- a valid constractor function \n\t- a string evaluates to ither one of the above");}}
Class.enhancePrototype=function(fClass,oInterface){
Claim.check(typeof(fClass)=='function',"Class.enhancePrototype(fClass,oInterface) - fClass","fClass must be a function");
Claim.check(oInterface&&typeof(oInterface)=='object',"Class.enhancePrototype(fClass,oInterface) - oInterface","oInterface must be an object");
return Object.extend(fClass.prototype,oInterface);}
Class.enhanceSingleton=function(oSingleton,oInterface){
Claim.check(oTargetClass&&typeof(oTargetClass)=='object'||typeof(oTargetClass)=='function',"Class.enhance(oSingleton)","oTargetClass must be a function");
Claim.check(oInterface&&typeof(oInterface)=='object',"Class.enhancePrototype(fClass,oInterface) - oInterface","oInterface must be an object");
return Object.extend(oSingleton,oInterface);}
Class.enhance=function(fClass){
var oInterface;
for(var i=1;i<arguments.length;i++){
oInterface=arguments[i];
try{fClass=this.enhanceSingleton(fClass,oInterface);}catch(ex){}
try{fClass.prototype=this.enhancePrototype(fClass,oInterface);}catch(ex){}}
return fClass;}


//=== end unit:/_infra/ClientTools/Class.js ===<hr>//=== unit:/_infra/ClientTools/Claim.js ===

if(false){
Claim=function(DUMMY){};}
Claim.isFunction=function(object,comment){
Claim.check(typeof(object)=='function',"isFunction("+Claim.valueType(object)+")",comment)}
Claim.isLiveObject=function(object,comment){
Claim.check(null !=object&&typeof(object)=='object',"isLiveObject("+object+")",comment)}


//=== end unit:/_infra/ClientTools/Claim.js ===<hr>//=== unit:/_infra/ClientTools/Element.js ===

if(false){
Element=function(DUMMY){};}
if(!Element.setText)
Element.setText=function(e,sText){
var tag=e.tagName.toUpperCase();
switch(tag){
case "INPUT":
case "TEXTAREA":
e.value=sText;
break;
case "SELECT":
e.value=sText;
break;
default:
try{
e.innerHTML=sText;}
catch(ex){
try{
if(typeof e.innerText=='undefined')
e.textContent=sText;
else
e.innerText=sText;}
catch(ex){
this.log.error("Element.setText: failed to set to element the text: "+sText);}}}}
Element.getText=function(oElement){
switch(oElement.tagName){
case "INPUT":
if(oElement.type=="checkbox")
return(oElement.checked)?oElement.value:"";
case "TEXTAREA":
case "SELECT":
strTemplate=oElement.value;
break;
default:
strTemplate=oElement.innerHTML;}}


//=== end unit:/_infra/ClientTools/Element.js ===<hr>//=== unit:/IEventDispatcher.js ===

if(false)
function IEventDispatcher(DUMMY){};
IEventDispatcher={};
IEventDispatcher.dispatch=function(sEventName){
Claim.isString(sEventName,"IEventDispatcher.dispatch(sEventName, ...) - sEventName must be a string");
var fEventHandler=this[sEventName];
var isHandlerStack='object'==typeof(fEventHandler)&&fEventHandler.constructor==Array;
if('function'!=typeof(fEventHandler)&&!isHandlerStack){
if(this.log instanceof Log4Js.Logger)this.log.info("Dispatch: Event "+sEventName+" is not implemented.");
return;}
var args=[];
for(var i=1;i<arguments.length;i++){
args[i-1]=arguments[i];}
if(isHandlerStack){
this.log.info("detected handlers stack for event: "+sEventName);
for(var i=0;i<fEventHandler.length;i++){
this.dispatchHandler(sEventName,fEventHandler[i],args);}
return;}
return this.dispatchHandler(sEventName,fEventHandler,args);}
IEventDispatcher.dispatchHandler=function(sEventName,fEventHandler,args){
try{
var retVal=fEventHandler.apply(this,args);
if(this.log instanceof Log4Js.Logger)this.log.info("after event "+sEventName+": "+Object.serialize(args)+". returned value: "+retVal);
return retVal;}
catch(ex){
if(this.log instanceof Log4Js.Logger)this.log.error("event "+sEventName+" failed:"+Object.serialize(ex));
if(this.ignoreEventErrors==true)return;
throw ex;}}
IEventDispatcher.attachEvent=function(sEventName,fHandler){
Claim.isString(sEventName,"IEventDispatcher.attachEvent(sEventName,..) - sEventName is expected to be a string representing the event name");
Claim.isFunction(fHandler,"IEventDispatcher.attachEvent(...,fHandler) - fHandler is expected to be the event handler function");
var oEvent=this[sEventName];
if(oEvent===undefined||oEvent===null){
this[sEventName]=fHandler;
return;}
switch(typeof(oEvent)){
case 'function':
oEvent=this[sEventName]=[this[sEventName]];
case 'object':
if(oEvent instanceof Array){
this[sEventName][this[sEventName].length]=fHandler;
return;}
default:
sEventName+=" is not an event, but: "+Object.serialize(oEvent);
this.log.error(sEventName);
throw new Error(sEventName);}}


//=== end unit:/IEventDispatcher.js ===<hr>//=== unit:/TC/Controls/TC.Controls.js ===

if(false)
TC.Controls=function(DUMMY){};
TC.Controls={}
TC.Controls.tagRegExpFinder=function(sTagName){
return new RegExp("\<"+sTagName+"\>([\\w\\W]*)\<\/"+sTagName+"\>","gi");}
TC.Controls.getInnerTag=function(sHTMLString,sInnerTag){
try{
return this.tagRegExpFinder(sInnerTag).exec(sHTMLString)[1];}
catch(ex){
return null;}}


//=== end unit:/TC/Controls/TC.Controls.js ===<hr>//=== unit:/TC/Controls/TC.Controls.Repeater.js ===

Claim.isFunction(String.prototype.bindTemplate,"String.prototype.bindTemplate is required for TC.Controls.Repeater");
TC.Controls.Repeater=Class.create();
Class.enhance(TC.Controls.Repeater,IEventDispatcher);
TC.Controls.Repeater.defaultParseTags={header:"header",item:"item",alternateItem:"alternate",seperator:"seperator",footer:"footer",noData:"noData"};
TC.Controls.Repeater.prototype.initialize=function(sTemplateString,oLog,oParseTags){
this.log=(oLog&&oLog instanceof Log4Js.Logger)?oLog:new Log4Js.Logger("Repeater");
Claim.isString(sTemplateString,"sTemplateString is expected to be the template HTML string");
this.templateString=sTemplateString;
this.parseTags=Object.clone(this.constructor.defaultParseTags);
if(oParseTags)
this.parseTags=Object.extend(this.parseTags,oParseTags);
oParseTags=this.parseTags;
this.dispatch("onInit",oParseTags);
this.templates={};
var each;
for(each in oParseTags){
this.templates[each]=TC.Controls.getInnerTag(this.templateString,oParseTags[each])||"";
this.log.debug(each+"-template:"+this.templates[each].replace(/</g,"&lt;"));}
this.dispatch("onLoad");}
TC.Controls.Repeater.prototype.dataBind=function(oDataSource,oItemMapping,oOuterMappings){
if(oDataSource)this.dataSource=oDataSource;
if(oItemMapping)this.bindMapping=oItemMapping;
Claim.isLiveObject(this.bindMapping,"Mapping must be an object. Ither provide it as a first argument, or set the property: rpt.mapping");
Claim.isArray(this.dataSource,"DataSource must be an array. Ither provide it as a second argument, or set the property: rpt.dataSource");
var i,item,iIndex,sBoundItem,arrBoundItems=[];
this.dispatch("onDataBind",this.dataSource);
for(i=0;i<oDataSource.length;i++){
iIndex=arrBoundItems.length;
item={dataItemIndex:i,itemIndex:iIndex,itemNumber:iIndex+1,dataItem:Object.clone(oDataSource[i]),mapping:Object.clone(this.bindMapping),template:(this.templates.alternateItem&&iIndex%2)?this.templates.alternateItem:this.templates.item,skipItem:false}
this.dispatch("onItemDataBind",item);
sBoundItem=this.itemDataBind(item);
this.dispatch("onItemDataBound",item);
if(true==item.skipItem)
continue;
arrBoundItems[arrBoundItems.length]=sBoundItem;}
this.content={items:arrBoundItems,toString:function(){
return this.header+((this.items.length)?
this.items.join(this.seperator):this.noData)+this.footer;}}
for(each in this.templates){
if(each=="item"||each=="alternateItem")
continue;
item={itemType:each,mapping:Object.clone(this.bindOuterMapping),template:this.templates[each],skipItem:false,data:this.dataSource}
this.dispatch("onItem",item);
sBoundItem=item.template.bindTemplate(item.mapping,item.data,this.log);
if(true==item.skipItem)
continue;
this.content[each]=sBoundItem;}
if(0==this.content.items.length){
this.dispatch("onNoDataFound",this.content);}
this.dispatch("onDataBound",this.content);
return this.content;}
TC.Controls.Repeater.prototype.itemDataBind=function(item,sBoundTemplate){
var sBoundItem,oItemMapping,oData,log,placehoder,attribute,replacment;
log=this.log;
if(sBoundTemplate==null)sBoundTemplate=item.template;
Claim.isString(sBoundTemplate,"Repeater.itemDataBind(...) - not provided template.");
oItemMapping=item.mapping;
for(placehoder in oItemMapping){
if(item.template.indexOf(placehoder)==-1){
log.debug("in Repeater.itemDataBind(...) - placeholder ["+placehoder+"] is not found in bound template");
continue;}
attribute=oItemMapping[placehoder];
if(attribute==null||attribute===undefined){
log.warn("in Repeater.itemDataBind(...) mapping dictionary specifies a placeholder without providing its data-attribute name: "+placehoder);
continue;}
switch(typeof(attribute)){
case 'function':
log.debug("Placeholder ["+placehoder+"] is detected as Mapping-handler");
try{
replacement=attribute.call(item,item.dataItem||item.dataSource,log);}catch(ex){
log.error("Repeater.itemDataBind - Error in mapping-handler for "+placehoder+" : "+attribute.toString());
throw ex;}
break;
case 'string':
if(item.dataItem){
log.debug("Repeater.itemDataBind(...) searching attribute ["+attribute+"] on the item.dataItem");
replacement=Object.getAttribute(item.dataItem,attribute,log);}
if(null==replacement){
log.debug("Repeater.itemDataBind(...) searching attribute ["+attribute+"] on item");
replacement=Object.getAttribute(item,attribute,log);}
if(null==replacement){
log.warn("Repeater.itemDataBind(...) mapping dictionary specifies a property that does not exist on the provided data-source or repeater-item. Placehoder: ["+placehoder+"]. Assuming a mapping constant: ["+attribute+"]");
replacement=attribute;}
break;
default:
replacement=String(attribute);}
sBoundTemplate=sBoundTemplate.replace(new RegExp(placehoder,"g"),replacement);}
return sBoundTemplate;}
TC.Controls.Repeater.prototype.render=function(oTargetElement,oDataSource,oItemMapping,oOuterMapping){
this.log.debug("Repeater - rendering");
if(!this.content||oItemMapping&&oDataSource)
this.content=this.dataBind(oDataSource,oItemMapping,oOuterMapping);
this.targetElement=oTargetElement;
this.dispatch("onRender",this.content);
var strHTML=this.content.toString();
if(!oTargetElement)
return strHTML;
if(oTargetElement){
if(oTargetElement.write===document.write){
oTargetElement.write(strHTML);}else{
Element.setText(oTargetElement,strHTML);}}
this.dispatch("onRenderComplete");
this.log.info("Repeater - render complete");
return strHTML;}


//=== end unit:/TC/Controls/TC.Controls.Repeater.js ===<hr>//=== unit:/TC/Controls/TC.Controls.TagsList.js ===

//=== end unit:/TC/Controls/TC.Controls.TagsList.js ===<hr>//=== unit:/TC/Controls/TC.Controls.SkusList.js ===

TC.Controls.SkusList=Class.create();
TC.Controls.SkusList.prototype.settings={}
TC.Controls.SkusList.prototype.data=null;
TC.Controls.SkusList.prototype.initialize=function(strTemplate,oItemMapping,oSettings,skusSource){
this.log=new Log4Js.Logger("TC.Controls.SkusList");
Claim.isString(strTemplate,"TC.Controls.SkusList(..,strTemplate,..) is expected to be a string describing a HTML tempaltes for the operating repeater");
Claim.isObject(oItemMapping," TC.Controls.SkusList(..,oItemMapping,..) is expected to be an object, which is the place-holder mapping in the template");
this.repeater=new TC.Controls.Repeater(strTemplate,this.log);
this.repeater.boss=this;
this.itemMapping=oItemMapping;
this.log.debug("TagsList constructor : adopted mapping: "+Object.serialize(this.itemMapping));
this.settings=Object.extend(Object.clone(this.settings),oSettings);
this.log.debug("SkusList constructor : adopted settings : "+Object.serialize(this.settings));
this.log.debug("SkusList constructor : settings skusSource.");
if(skusSource)this.setListedSkus(skusSource);}
TC.Controls.SkusList.prototype.setListedSkus=function(skusSource){
var skus=skusSource;
switch(typeof(skus)){
case "undefined":
break;
case "string":
this.log.debug("TC.setListedSkus was called with skuSource as string, expected to be internal name of a tag: "+skusSource);
Claim.isObject(TC.Tags,"TC.Controls.SkusList.setListedSkus(string) is called without including TC.Tags");
skus=TC.Tags.dictionary[skus];
Claim.isObject(skus,"TC.setListedSkus(skusSource) - when provided a string, the string must be an internal name of a tag that exists in the catalog on the client. skusSource: "+skusSource);
case "object":
if(skus instanceof Array){
this.log.debug("SkusList.setListedSkus called with array of "+skus.length+" elements");}
else{
Claim.isArray(skus.skuLinks,"TC.Controls.SkusList.setListedSkus(skusSource) - when skusSource is provided as Object - it must be an instance of GameCatalog.Tag or a clone of such an object");
this.log.debug("SkusList called with GameCatalog.Tag object as source of skus. Tag: "+skus.name);
skus=skus.skuLinks.byWeight().collect(function(skuLink){return Object.clone(skuLink.sku);});}
break;
default:
throw new Error("TC.Controls.SkusList.setListedSkus(skusSource) - illegal parameter: "+typeof(skusSource)+"("+skusSource+")");}
Claim.isArray(skus,"SkusList.setListedSkus(..) must be provided an array of Tags as a data-source. The source can be ither a tag object, an internal-name of a Tag that exist in the catalog on the client, or an explicit array of Tags.");
return this.data=skus;}
TC.Controls.SkusList.prototype.render=function(oTarget){
Claim.isArray(this.data,"TC.Controls.SkusList.render(..) is called without a data-source");
var arrSkus=this.data.cut(this.settings.startFromSkuIndex,this.settings.maxShownSkus);
this.repeater.content=null;
return this.repeater.render(oTarget,arrSkus,this.itemMapping);}


//=== end unit:/TC/Controls/TC.Controls.SkusList.js ===<hr>//=== unit:/TC/Controls/TC.Controls.PagingBar.js ===

TC.Controls.PagingBar=Class.create();
Class.enhance(TC.Controls.PagingBar,IEventDispatcher);
TC.Controls.PagingBar.prototype.settings={lastPageIndex:0,maxPagesInBar:Infinity,activePageLinkCSS:"pageLinkOn",pageLinkCSS:"pageLink"};
TC.Controls.PagingBar.prototype.itemMapping={CURRENT_PAGE_INDEX:"pageIndex",CURRENT_PAGE_NUMBER:"pageNumber",CURRENT_PAGE_LINK_CSS:"pageLinkCSS"};
TC.Controls.PagingBar.prototype.barMapping={FIRST_BAR_INDEX:"firstBarIndex",FIRST_BAR_NUMBER:"firstBarNumber",NEXT_BAR_INDEX:"nextBarIndex",NEXT_BAR_NUMBER:"nextBarNumber",PREV_BAR_INDEX:"prevBarIndex",PREV_BAR_NUMBER:"prevBarNumber",LAST_BAR_INDEX:"lastBarIndex",LAST_BAR_NUMBER:"lastBarNumber",FIRST_PAGE_INDEX:"firstPageIndex",FIRST_PAGE_NUMBER:"firstPageNumber",NEXT_PAGE_INDEX:"nextPageIndex",NEXT_PAGE_NUMBER:"nextPageNumber",PREV_PAGE_INDEX:"prevPageIndex",PREV_PAGE_NUMBER:"prevPageNumber",LAST_PAGE_INDEX:"lastPageIndex",LAST_PAGE_NUMBER:"lastPageNumber",FIRST_CURRENTBAR_PAGE_INDEX:"firstCurrentBarPageIndex",FIRST_CURRENTBAR_PAGE_NUMBER:"firstCurrentBarPageNumber",LAST_CURRENTBAR_PAGE_INDEX:"lastCurrentBarPageIndex",LAST_CURRENTBAR_PAGE_NUMBER:"lastCurrentBarPageNumber",FIRST_NEXTBAR_INDEX:"firstNextBarPageIndex",FIRST_NEXTBAR_NUMBER:"firstNextBarPageNumber",LAST_NEXTBAR_INDEX:"lastNextBarPageIndex",LAST_NEXTBAR_NUMBER:"lastNextBarPageNumber",FIRST_PREVBAR_INDEX:"firstPrevBarPageIndex",FIRST_PREVBAR_NUMBER:"firstPrevBarPageNumber",LAST_PREVBAR_INDEX:"lastPrevBarPageIndex",LAST_PREVBAR_NUMBER:"lastPrevBarPageNumber"};
TC.Controls.PagingBar.prototype.parseTags={toStart:"toStart",rewind:"rewind",back:"back",forward:"forward",fastForward:"fastForward",toEnd:"toEnd"};
TC.Controls.PagingBar.prototype.activePageIndex=0;
TC.Controls.PagingBar.prototype.activeBarIndex=0;
TC.Controls.PagingBar.prototype.set=function(oSettings){
this.settings=Object.extend(this.settings,oSettings);}
TC.Controls.PagingBar.prototype.initialize=function(sTemplate,oSettings,oItemMapping,oBarMapping){
Claim.isString(sTemplate,"TC.Controls.PagingBar(sTemplate,..) - sTemplate must be a string, expected to be HTML string describing the template for the repeater")
this.log=new Log4Js.Logger("PagingBar");
if(oSettings)this.set(oSettings);
this.itemMapping=Object.safeExtend(oItemMapping||{},this.itemMapping);
this.barMapping=Object.safeExtend(oBarMapping||{},this.barMapping);
sTemplate=sTemplate.populateTemplate({JS_PAGING_CALLBACK:this.settings.pagingCallBack});
this.repeater=new TC.Controls.Repeater(sTemplate,this.log,this.parseTags);
this.repeater.boss=this;
this.repeater.bindMapping=this.itemMapping;
this.repeater.onDataBound=function(content){
if(this.boss.lastPageIndex()==0){
content.header=content.footer=String.empty;
content.items=[""];
return;}
content.header=content.header.bindTemplate(this.boss.barMapping,this.boss);
if(content.items.length>2&&this.boss.activePageIndex!=this.boss.firstPageIndex())
content.header+=this.templates.toStart.bindTemplate(this.boss.barMapping,this.boss);
if(this.boss.settings.maxPagesInBar!=Infinity&&this.boss.activePageIndex>=this.boss.settings.maxPagesInBar)
content.header+=this.templates.rewind.bindTemplate(this.boss.barMapping,this.boss);
if(this.boss.activePageIndex>0)
content.header+=this.templates.back.bindTemplate(this.boss.barMapping,this.boss);
content.footer=content.footer.bindTemplate(this.boss.barMapping,this.boss);
if(content.items.length>2&&this.boss.activePageIndex!=this.boss.lastPageIndex())
content.footer=this.templates.toEnd.bindTemplate(this.boss.barMapping,this.boss)+content.footer;
if(this.boss.activeBarIndex<parseInt(this.boss.lastPageNumber()/this.boss.settings.maxPagesInBar))
content.footer=this.templates.fastForward.bindTemplate(this.boss.barMapping,this.boss)+content.footer;
if(this.boss.activePageIndex<this.boss.lastPageIndex())
content.footer=this.templates.forward.bindTemplate(this.boss.barMapping,this.boss)+content.footer;
this.boss.dispatch("onDataBound",this.content);}
this.HTML=String.Empty;}
TC.Controls.PagingBar.prototype.firstPageIndex=function(){
return 0}
TC.Controls.PagingBar.prototype.firstPageNumber=function(){
return this.firstPageIndex()+1;}
TC.Controls.PagingBar.prototype.nextPageIndex=function(){
return(this.activePageIndex<this.lastPageIndex())?this.activePageIndex+1:this.activePageIndex}
TC.Controls.PagingBar.prototype.nextPageNumber=function(){
return this.nextPageIndex()+1;}
TC.Controls.PagingBar.prototype.prevPageIndex=function(){
return(this.activePageIndex>0)?this.activePageIndex-1:0}
TC.Controls.PagingBar.prototype.prevPageNumber=function(){
return this.prevPageIndex()+1;}
TC.Controls.PagingBar.prototype.lastPageIndex=function(){
return this.settings.lastPageIndex;}
TC.Controls.PagingBar.prototype.lastPageNumber=function(){
return this.lastPageIndex()+1}
TC.Controls.PagingBar.prototype.firstBarIndex=function(){
return 0}
TC.Controls.PagingBar.prototype.firstBarNumber=function(){
return this.firstBarIndex()+1;}
TC.Controls.PagingBar.prototype.nextBarIndex=function(){
return(this.activeBarIndex<this.lastBarIndex())?this.activeBarIndex+1:this.activeBarIndex}
TC.Controls.PagingBar.prototype.nextBarNumber=function(){
return this.nextBarIndex()+1;}
TC.Controls.PagingBar.prototype.prevBarIndex=function(){
return(this.activeBarIndex>0)?this.activeBarIndex-1:0}
TC.Controls.PagingBar.prototype.prevBarNumber=function(){
return this.prevBarIndex()+1;}
TC.Controls.PagingBar.prototype.lastBarIndex=function(){
return Math.floor(this.lastPageIndex()/this.settings.maxPagesInBar);}
TC.Controls.PagingBar.prototype.lastBarNumber=function(){
return this.lastBarIndex()+1}
TC.Controls.PagingBar.prototype.firstCurrentBarPageIndex=function(){
return this.activeBarIndex*this.settings.maxPagesInBar}
TC.Controls.PagingBar.prototype.firstCurrentBarPageNumber=function(){
return this.firstCurrentBarPageIndex()+1}
TC.Controls.PagingBar.prototype.lastCurrentBarPageIndex=function(){
return this.lastCurrentBarPageNumber()-1}
TC.Controls.PagingBar.prototype.lastCurrentBarPageNumber=function(){
return Math.min(this.lastPageNumber(),this.firstCurrentBarPageIndex()+this.settings.maxPagesInBar)}
TC.Controls.PagingBar.prototype.firstPrevBarPageIndex=function(){
return this.prevBarIndex()*this.settings.maxPagesInBar}
TC.Controls.PagingBar.prototype.firstPrevBarPageNumber=function(){
return this.firstPrevBarPageIndex()+1}
TC.Controls.PagingBar.prototype.lastPrevBarPageIndex=function(){
return this.lastPrevBarPageNumber()-1}
TC.Controls.PagingBar.prototype.lastPrevBarPageNumber=function(){
return Math.min(this.lastPageNumber(),this.firstPrevBarPageIndex()+this.settings.maxPagesInBar)}
TC.Controls.PagingBar.prototype.firstNextBarPageIndex=function(){
return this.nextBarIndex()*this.settings.maxPagesInBar}
TC.Controls.PagingBar.prototype.firstNextBarPageNumber=function(){
return this.firstNextBarPageIndex()+1}
TC.Controls.PagingBar.prototype.lastNextBarPageIndex=function(){
return this.lastNextBarPageNumber()-1}
TC.Controls.PagingBar.prototype.lastNextBarPageNumber=function(){
return Math.min(this.lastPageNumber(),this.firstNextBarPageIndex()+this.settings.maxPagesInBar)}
TC.Controls.PagingBar.prototype.getBindingDataSource=function(){
var iStartPageIndex=this.firstCurrentBarPageIndex();
var iMaxPageNumber=this.lastCurrentBarPageNumber();
var i,arr=[];
for(i=iStartPageIndex;i<iMaxPageNumber;i++){
arr[arr.length]={pageIndex:i,pageNumber:i+1,pageLinkCSS:(this.activePageIndex==i)?this.settings.activePageLinkCSS:this.settings.pageLinkCSS}}
return arr;}
TC.Controls.PagingBar.prototype.setTotalPagesCount=function(iPagesCount){
if(iPagesCount<1)iPagesCount=1;
this.settings.lastPageIndex=iPagesCount-1;
return iPagesCount;}
TC.Controls.PagingBar.prototype.updateActivePage=function(iActivePage){
if(iActivePage===undefined)iActivePage=0;
Claim.isNumber(iActivePage,"PagingBar.updateActivePage(iActivePage) - when provided, iActivePage must be a posetive number");
Claim.isTrue(iActivePage>=0,"PagingBar.updateActivePage(iActivePage) - when provided, iActivePage must be a posetive number, expected to be the index of the active page");
this.activePageIndex=Math.min(this.lastPageIndex(),iActivePage);
this.activeBarIndex=Math.floor(this.activePageIndex/this.settings.maxPagesInBar);
var arrPagesDataSource=this.getBindingDataSource();
return this.HTML=this.repeater.render($(this.settings.targetContainer),arrPagesDataSource,this.itemMapping);}


//=== end unit:/TC/Controls/TC.Controls.PagingBar.js ===<hr>//=== unit:/Mgr/SkuListMgr.js ===

SkuListMgr=Class.create();
SkuListMgr=Class.enhance(SkuListMgr,IEventDispatcher);
SkuListMgr.prototype.settings={targetContainer:"divSkuList"}
SkuListMgr.prototype.set=function(oSettings){
this.settings=Object.extend(this.settings,oSettings);}
SkuListMgr.prototype.addSettings=SkuListMgr.prototype.set;
SkuListMgr.prototype.skuItemMapping={GAME_NAME:"name",GAME_PAGE_URL:"gamePageURL",CATEGORY_NAME:"categoryLocalizedName",GAME_IMAGE_URL:function(item){
var s=item.thumbnail130x75;
if(s.toLowerCase().indexOf("/general")==-1)
return s.replace("games/thumbnails_med_2/","games/thumbnails_med_2/general/");
return s;},GAME_EXE_URL:"downloadURL",GAME_DESCRIPTION:"twoThirdsDesc",SKU_NUMBER:"sku",BUY_URL:"buyURL",NEW_GAME_IMAGE:"",LOCALIZED_GAME_IMAGE:""}
SkuListMgr.prototype.skuTagsItemMapping={TAG_NAME:"name",TAG_PAGE_URL:"tagPageURL",TAG_GAMES_COUNT:"count"}
SkuListMgr.prototype.skuListMapping={GAME_COUNT:function(mgr){return mgr.skus.length}}
SkuListMgr.prototype.initialize=function(sMgrJsID){
this.id=sMgrJsID;
this.log=new Log4Js.Logger(this.id);
this.settings=Object.clone(this.settings);
this.skuItemMapping=Object.clone(this.skuItemMapping);
this.skuTagsItemMapping=Object.clone(this.skuTagsItemMapping);
this.skuListMapping=Object.clone(this.skuListMapping);
setTimeout("Claim.isObject("+this.id+", 'new SkuListMgr(sMgrJsID) - sMgrJsID must be the name of the created instance. Provided sMgrJsID : "+sMgrJsID+"');",50);}
SkuListMgr.prototype.initSkuList=function(oSettings,sTemplate,oItemMapping,oListMapping,sImagesPath){
this.log.debug(this.id+".initSkuList(..) started");
Claim.isString(sTemplate,this.id+".initSkuList(sTemplateContainerID,...) must be a string. Expected to be HTML template string for the used repeater");
Claim.isObject(oSettings,this.id+".initSkuList(oSettings,...) - must be an object, expected to be a settings dictionary.");
if(oItemMapping)Claim.isObject(oItemMapping,this.id+".initSkuList(..,oItemMapping,..) when provided - must be a mapping dictionary object, correlating with the provided template");
if(oListMapping)Claim.isObject(oListMapping,this.id+".initSkuList(..,oListMapping) when provided - must be a mapping dictionary object, correlating with the provided template");
this.settings=Object.extend(this.settings,oSettings);
this.targetContainer=$(this.settings.targetContainer);
Claim.isObject(this.targetContainer,this.id+".initSkuList(...) - cannot find target DOM container. The target container should be ither named 'divSkuList' after the settings default, or provided entry in the oSettings dictionary that points to a live DOM container. Provided id : "+this.settings.targetContainer);
this.skuItemMapping=Object.extend(this.skuItemMapping,oItemMapping);
this.skuListMapping=Object.extend(this.skuListMapping,oListMapping);
this.list=new TC.Controls.SkusList(sTemplate,this.skuItemMapping,{maxShownTags:this.settings.maxShownTags});
this.list.boss=this;
this.list.repeater.onNoDataFound=
function(){
this.content.noData=this.content.noData.bindTemplate(this.boss.boss.skuListMapping,this.boss.boss);}
this.list.repeater.onDataBound=
function(){
this.content.header=this.content.header.bindTemplate(this.boss.boss.skuListMapping,this.boss.boss);
this.content.footer=this.content.footer.bindTemplate(this.boss.boss.skuListMapping,this.boss.boss);}
this.dispatch("onInitSkuList",this.list);
this.log.debug(this.id+".initSkuList(..) complete");}
SkuListMgr.prototype.initSkuTagList=function(oSettings,sTemplate,oSkuTagsMapping){
Claim.isObject(oSettings,"TBD1");
Claim.isString(sTemplate,"TBD2");
this.skuItemMapping.SKU_TAGS_LIST=
new Function("oSku",this.id+".skuTagsList.setListedTags( oSku );\n"+
"return "+this.id+".skuTagsList.render();");
if(this.list)
this.list.mapping.SKU_TAGS_LIST=this.skuItemMapping.SKU_TAGS_LIST;
this.skuTagsItemMapping=Object.extend(this.skuTagsItemMapping,oSkuTagsMapping);
this.skuTagsList=new TC.Controls.TagsList(sTemplate,this.skuTagsItemMapping,oSettings);
this.dispatch("onInitSkuTagList",this.skuTagsList);}
SkuListMgr.prototype.initPagingBar=function(oSettings,sTemplate){
if(!oSettings.pagingCallBack)
oSettings.pagingCallBack=this.settings.pagingCallBack;
this.pagingBar=new TC.Controls.PagingBar(sTemplate,oSettings);
this.skuListMapping.PAGING_BAR=function(mgr){return mgr.pagingBar.HTML}
this.dispatch("onInitPagingBar",this.pagingBar);}
SkuListMgr.prototype.setDataSource=function(arrSkus){
if(this.pagingBar){
var iLastPageNumber=Math.ceil(arrSkus.length/this.settings.gamesPerPage);
this.pagingBar.setTotalPagesCount(iLastPageNumber);}
this.dispatch("onDataSourceSet",arrSkus);
return this.skus=arrSkus;}
SkuListMgr.prototype.showPage=function(iPageIndex){
if(undefined===iPageIndex)iPageIndex=0;
Claim.isNumber(iPageIndex,this.id+".showPage(iPageIndex) - when provided iPageIndex is expected to be a number - the index of the page to render");
var data;
if(this.settings.gamesPerPage){
data=this.skus.cut(iPageIndex*this.settings.gamesPerPage,this.settings.gamesPerPage);
this.log.info("showing: page "+iPageIndex+" with "+data.length+" from "+this.skus.length+" results.");}
else{
data=this.skus;
this.log.info("showing: list with "+data.length+" results.");}
this.list.setListedSkus(data);
if(this.pagingBar){
this.pagingBar.updateActivePage(iPageIndex);}
this.list.render(this.targetContainer);}

//=== end unit:/Mgr/SkuListMgr.js ===<hr>//End:SkusListMgr</pre>