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.entity_id;
this.entity_name;
this.mod;
this.init();
shopoon.shoppingBoxes.push(this);};
//Méthodes publiques
shopoon.shoppingBox.prototype =
{
init: function()
{
this.expand = false;
//if(this.height > 250)
//this.expand = true;
},
writeIframe: function()
{
return "<iframe name=\"shopoon-blogs\" src=\""+this.src+"\" width=\""+this.width+"\" height=\""+this.height+"\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\"></iframe>";
},
loadIframe: function()
{
	top.frames["shopoon-blogs"].location.href=this.src;
},
setEntity: function(id, name)
{
this.entity_id = id;
this.entity_name = escape(name);
this.src = this.src.replace(/ENTID/, this.entity_id);
this.src = this.src.replace(/ENTNAME/, this.entity_name);
},
toString: function()
{
return "shoppingBox Object";
}
};
//Méthodes statiques
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;
};
if(!shopoon.shoppingBox.getByName("mainShoppingBox"))
{
var mainShoppingBox = new shopoon.shoppingBox("mainShoppingBox", "blogs", 298,445, "http://box.shopoon.fr/purefans/v3/ShopBox.aspx?mod=site&css=purefans_site&entity_id=ENTID&entity_name=ENTNAME#"+escape(document.location.href), "shoppingBox");
}

function writeShoppingBox(entity_id, entity_name)
{
mainShoppingBox.setEntity(entity_id,entity_name);
if(mainShoppingBox.parentId != undefined && mainShoppingBox.parentId != "")
{
    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();
}
}