var shopoon={};
shopoon.shoppingBoxes=new Array();
shopoon.shoppingBox=function(name,flagOP,width,height,src,parentId){
this.name=name;
this.flagOP=flagOP;
this.width=width;
this.height=height;
this.src=src;
this.parentId=parentId;
this.init();
shopoon.shoppingBoxes.push(this);
};
shopoon.shoppingBox.prototype={
init:function(){this.expand=false;if(this.height > 250)this.expand=true;},
writeIframe:function(){
var RN = new Date();
var RNS = RN.getDate();
if(this.src.indexOf('?')>-1){this.src += '&r='+RNS;}else{this.src += '?r='+RNS;}
return "<iframe name=\"shopoon\" src=\""+this.src+"\" width=\""+this.width+"\" height=\""+this.height+"\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\"></iframe>";
},
loadIframe:function(){if(top.frames["shopoon"]){try{top.frames["shopoon"].location.href=this.src;}catch(e){}}},
setID:function(flag){this.flag=flag;this.src=this.src.replace(/FLAGREP/gi,this.flag);},
setBRAND:function(brdId){this.brdId=brdId;if(this.brdId!=''){this.src=this.src+'?brand_id='+this.brdId;}},
toString:function(){return "shoppingBox Object";}
};
shopoon.shoppingBox.getByName=function(name){
for(var i=0;shopoon.shoppingBoxes[i];i++){if(shopoon.shoppingBoxes[i].name==name){return shopoon.shoppingBoxes[i];}}
return false;
};
var mainShoppingBox;
if(!shopoon.shoppingBox.getByName("mainShoppingBox")){
mainShoppingBox=new shopoon.shoppingBox("mainShoppingBox","shopoon",0,0,"http://static1.shopoon.fr/catalog/generated_boxes/511/box.html","shoppingBox");
}
function WriteShoppingBox(id,width,height,brdId){
if(mainShoppingBox.parentId!=undefined && mainShoppingBox.parentId!=""){
mainShoppingBox.setBRAND(brdId);
mainShoppingBox.setID(id);
mainShoppingBox.width=width;
mainShoppingBox.height=height;
if(document.getElementById(mainShoppingBox.parentId)){
document.getElementById(mainShoppingBox.parentId).innerHTML=mainShoppingBox.writeIframe();
mainShoppingBox.loadIframe();
}else{
document.write(mainShoppingBox.writeIframe());
mainShoppingBox.loadIframe();
}
}else{
document.write(mainShoppingBox.writeIframe());
mainShoppingBox.loadIframe();
}
}
if(typeof window.box_brand_id == 'undefined')
window.box_brand_id = '';
WriteShoppingBox("511",670,400,window.box_brand_id);
