
function MVMRemoteController(id){
this.id=id;this._init(true);}
MVMRemoteController.prototype.id="MVMRemoteController";MVMRemoteController.prototype.communicationUrl="";MVMRemoteController.prototype.communicationFrameElement=undefined;MVMRemoteController.prototype.isListening=true;MVMRemoteController.prototype.remoteActionThread=undefined;MVMRemoteController.prototype.actionListenerUrl="";MVMRemoteController.prototype.domainServer=undefined;MVMRemoteController.prototype.attributes=undefined;MVMRemoteController.prototype.lastAction=undefined;
MVMRemoteController.prototype._init=function(isRealInit){
if(isRealInit){
if(location.href.toString().match(new RegExp("\.([^\/]*)\/"))!=undefined){this.domainServer=location.href.toString().match(new RegExp("\.([^\/]*)\/"))[1];}
this.attributes=MVMRemoteProperties;
this.communicationUrl=this.attributes.init.actionCallUrl;this._generate();
this._checkForRemoteAction();}}
MVMRemoteController.prototype._generate=function(){
var content="";
content+="<iframe"+" id='"+this.id+"CommunicationFrame'"+" style='display:none'"+" src=''"+"></iframe>";
document.write(content);
this.communicationFrameElement=document.getElementById(this.id+"CommunicationFrame");}
MVMRemoteController.prototype._remoteHandshake=function(){
this.call("Remote.registerRemote('"+location.href.split("#")[0]+"')");}
MVMRemoteController.prototype.throwRemoteEvent=function(eventKey){
this.call("Remote.throwEvent('"+eventKey+"')");}
MVMRemoteController.prototype._setSessionFlag=function(){
document.cookie="MVMModelTag_isInit=true";
this._remoteHandshake();}
MVMRemoteController.prototype.isInUse=function(){
if(document.cookie.indexOf("MVMModelTag_isInit")>=0){return true;}else{return false;}}
MVMRemoteController.prototype.tryOn=function(param1,param2,param3){
this.call("Model.tryOnExternalItems('"+param1+"',"+(param2!=""?"'"+param2+"'" : "undefined")+","+(param3!=""?"'"+param3+"'" : "undefined")+")");}
MVMRemoteController.prototype.onRemoteCall=function(action,parameters){}
MVMRemoteController.prototype._checkForRemoteAction=function(){
if(this.isListening){
if(location.href.indexOf("#mvmaction=")>0){
var remoteAction=decodeURIComponent(location.href.match(/#mvmaction=(.*)/)[1]).split("|");location.href=location.href.match(/(.*)#mvmaction=/)[1]+"#_mvm";
this.onRemoteCall(remoteAction[0],(remoteAction[1]!=undefined?remoteAction[1] : undefined));}
this.remoteActionThread=setTimeout(this.id+"._checkForRemoteAction()",1500);
}else{this.remoteActionThread=undefined;}}
MVMRemoteController.prototype.call=function(action){
if(!this.isInUse()){this._setSessionFlag();}
this.communicationFrameElement.src=this.communicationUrl+"?action="+encodeURIComponent(action)+"&rnd="+Math.random();}
var MVMRemote=new MVMRemoteController("MVMRemote");
function MVMTagController(id){
this.id=id;this.init(true);}
MVMTagController.prototype.id="MVMTagController";MVMTagController.prototype.siteUrl="";MVMTagController.prototype.splashUrl="";MVMTagController.prototype.state="closed";MVMTagController.prototype.top=undefined;MVMTagController.prototype.left=undefined;MVMTagController.prototype.width=undefined;MVMTagController.prototype.height=undefined;MVMTagController.prototype.siteFrameElement=undefined;MVMTagController.prototype.siteDivElement=undefined;MVMTagController.prototype.attributes=undefined;MVMTagController.prototype.isFloating=false;MVMTagController.prototype.frameLoadCount=0;
MVMTagController.prototype.init=function(isRealInit){
if(isRealInit){
if(location.href.toString().match(new RegExp("\.([^\/]*)\/"))!=undefined){this.domainServer=location.href.toString().match(new RegExp("\.([^\/]*)\/"))[1];}
this.attributes=MVMRemoteProperties;
if(this.attributes["frameLayout"]["isFloating"]!=undefined){this.isFloating=this.attributes["frameLayout"]["isFloating"];}
if(this.attributes["frameLayout"]["compactWidth"]==undefined){this.attributes["frameLayout"]["compactWidth"]=this.attributes["frameLayout"]["internalWidth"];}
if(this.attributes["frameLayout"]["compactHeight"]==undefined){this.attributes["frameLayout"]["compactHeight"]=this.attributes["frameLayout"]["internalHeight"];}
if(document.documentElement.attachEvent){window.attachEvent('onresize',MVMTagControllerStaticOnResize);}else{window.addEventListener('resize',MVMTagControllerStaticOnResize,false);}
if(document.documentElement.attachEvent){window.attachEvent('onload',MVMTagControllerStaticOnLoad);}else{window.addEventListener('load',MVMTagControllerStaticOnLoad,false);}
if(document.getElementById(this.id+"Div")!=undefined){document.getElementById(this.id+"Div").style.display="none";}
this.generate();}}
MVMTagController.prototype.generate=function(){
var content="";
var isDisplaySplash=(MVMRemote.isInUse()||(this.attributes.init.splashUrl==""||this.attributes.init.splashUrl==undefined)?false : true);
this.width=this.attributes["frameLayout"]["compactWidth"];this.height=this.attributes["frameLayout"]["compactHeight"];
content+="<div id='"+this.id+"PositionDiv' style='position:relative;width:"+this.width+"px;height:"+this.height+"px;'>";
content+="<div id='"+this.id+"SiteDiv'"+" style='position:absolute;width:"+this.width+"px;height:"+this.height+"px;overflow:hidden'"+">";
content+="<iframe id='"+this.id+"SiteFrame'"+" onload='"+this.id+"._onFrameLoad()'"+" style='position:absolute;background-color:white;border:0px;"+" left:"+(-this.attributes["frameLayout"]["internalLeft"])+"px;"+" top:"+(-this.attributes["frameLayout"]["internalTop"])+"px;"+" width:"+this.attributes["frameLayout"]["internalWidth"]+"px;"+" height:"+this.attributes["frameLayout"]["internalHeight"]+"px;"+" '"+" frameborder='0' scrolling='no'"+" src='"+(isDisplaySplash?this._appendQueryParametersToUrl(this.attributes.init.splashUrl): this._appendQueryParametersToUrl(this.attributes.init.siteUrl))+"'"+"></iframe>";
content+="</div>";
content+="</div>";
document.write(content);
if(!isDisplaySplash){MVMRemote._setSessionFlag();}
this.siteFrameElement=document.getElementById(this.id+"SiteFrame");this.siteDivElement=document.getElementById(this.id+"SiteDiv");}
MVMTagController.prototype.openAndClose=function(buttonObjectReference){
if(this.state=="closed"){if(buttonObjectReference.getAttribute("onOpen")!=undefined){eval(buttonObjectReference.getAttribute("onOpen"));}this.expand();
}else if(this.state=="open"){if(buttonObjectReference.getAttribute("onClose")!=undefined){eval(buttonObjectReference.getAttribute("onClose"));}this.collapse();}}
MVMTagController.prototype.expand=function(){
if(this.isFloating){this.state="open";
this.left=this._getAbsLeft(document.getElementById(this.id+"PositionDiv"));this.top=this._getAbsTop(document.getElementById(this.id+"PositionDiv"));
var contentLeft=(-this.attributes.frameLayout.internalLeft);var contentTop=(-this.attributes.frameLayout.internalTop);
var containerLeft=this.left;var containerTop=this.top;
if(this.attributes.frameLayout.deltaLeft<0){contentLeft=(-this.attributes.frameLayout.internalLeft)-this.attributes.frameLayout.deltaLeft;containerLeft=this.left+this.attributes.frameLayout.deltaLeft;}
if(this.attributes.frameLayout.deltaTop<0){contentTop=(-this.attributes.frameLayout.internalTop)-this.attributes.frameLayout.deltaTop;containerTop=this.top+this.attributes.frameLayout.deltaTop;}
this.siteFrameElement.style.left="0px";this.siteFrameElement.style.top="0px";this.siteFrameElement.style.width=this.attributes.frameLayout.internalWidth+"px";this.siteFrameElement.style.height=this.attributes.frameLayout.internalHeight+"px";
this.siteFrameElement.style.border="0px";
this.siteDivElement.style.left=(containerLeft)+"px";this.siteDivElement.style.top=(containerTop)+"px";this.siteDivElement.style.width=(this.width+this.attributes.frameLayout.deltaWidth)+"px";this.siteDivElement.style.height=(this.height+this.attributes.frameLayout.deltaHeight)+"px";
MVMRemote.throwRemoteEvent("EVENT_IFRAME_EXPAND");}}
MVMTagController.prototype.collapse=function(){
if(this.isFloating){this.state="closed";
this.siteDivElement.style.left=this._getAbsLeft(document.getElementById(this.id+"PositionDiv"))+"px";this.siteDivElement.style.top=this._getAbsTop(document.getElementById(this.id+"PositionDiv"))+"px";this.siteDivElement.style.width=this.attributes["frameLayout"]["compactWidth"]+"px";this.siteDivElement.style.height=this.attributes["frameLayout"]["compactHeight"]+"px";
this.siteFrameElement.style.left=(-this.attributes.frameLayout.internalLeft)+"px";this.siteFrameElement.style.top=(-this.attributes.frameLayout.internalTop)+"px";this.siteFrameElement.style.width=(this.attributes["frameLayout"]["compactWidth"]+this.attributes.frameLayout.internalLeft)+"px";this.siteFrameElement.style.height=(this.attributes["frameLayout"]["compactHeight"]+this.attributes.frameLayout.internalTop)+"px";
this.left=this._getAbsLeft(document.getElementById(this.id+"PositionDiv"));this.top=this._getAbsTop(document.getElementById(this.id+"PositionDiv"));
MVMRemote.throwRemoteEvent("EVENT_IFRAME_COLLAPSE");}}
MVMTagController.prototype.tryOn=function(param1,param2,param3){
MVMRemote.tryOn(param1,param2,param3);}
MVMTagController.prototype._appendQueryParametersToUrl=function(url){
var parameters="";
for(var key in this.attributes.skinParameters){parameters+=(parameters==""?"?":"&")+key+"="+this.attributes.skinParameters[key];}
return url+parameters;}
MVMTagController.prototype.call=function(action){
MVMRemote.call(action);}
MVMTagController.prototype._floatSiteFrame=function(){
if(this.isFloating){
this.siteDivElement.style.zIndex=999;this.siteDivElement.style.left=this._getAbsLeft(document.getElementById(this.id+"PositionDiv"))+"px";this.siteDivElement.style.top=this._getAbsTop(document.getElementById(this.id+"PositionDiv"))+"px";this.siteDivElement=document.body.appendChild(this.siteDivElement);}}
MVMTagController.prototype._onFrameLoad=function(){
this.frameLoadCount++;
if(this.frameLoadCount==2){MVMRemote._setSessionFlag();}}
MVMTagController.prototype._getAbsLeft=function(pObject){
var pObject_Left=pObject.offsetLeft;while(pObject.offsetParent!=null){pObject_Left+=(pObject.offsetParent.offsetLeft-pObject.offsetParent.scrollLeft);pObject=pObject.offsetParent;}
var windowScrollLeft=0
if(typeof(window.pageYOffset)=='number'){windowScrollLeft=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){windowScrollLeft=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){windowScrollLeft=document.documentElement.scrollLeft;}
return pObject_Left+windowScrollLeft;}
MVMTagController.prototype._getAbsTop=function(pObject){
var pObject_Top=pObject.offsetTop;while(pObject.offsetParent!=null){pObject_Top+=(pObject.offsetParent.offsetTop-pObject.offsetParent.scrollTop);pObject=pObject.offsetParent;}
var windowScrollTop=0;if(typeof(window.pageYOffset)=='number'){windowScrollTop=window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){windowScrollTop=document.body.scrollTop;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){windowScrollTop=document.documentElement.scrollTop;}
return pObject_Top+windowScrollTop;}
function MVMTagControllerStaticOnResize(event){
MVMModelTag.collapse();}
function MVMTagControllerStaticOnLoad(event){
MVMModelTag._floatSiteFrame();}
var MVMModelTag=new MVMTagController("MVMModelTag");