﻿
var version="Reallusion.UpdateCode.V250";namespace(version);Reallusion.UpdateCode.V250={importJS:function(src,look_for,onload){var s=document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('src',src);if(onload)this.wait_for_script_load(look_for,onload);if(!this.IsHaveObjectOrNameSpace(look_for)){var head=document.getElementsByTagName('head')[0];if(head)head.appendChild(s);else document.body.appendChild(s);}},IsHaveObjectOrNameSpace:function(ObjectName){var SubName=ObjectName.split(".");var TotalName=SubName[0];for(var i=1;i<=SubName.length;i++){if(eval("typeof "+TotalName)=='undefined'){return false;}
TotalName=TotalName+"."+SubName[i];}
return true;},wait_for_script_load:function(look_for,callback){var obj=this;var interval=setInterval(function(){if(obj.IsHaveObjectOrNameSpace(look_for)){clearInterval(interval);callback();}},50);},pageWidth:function(){return window.innerWidth!=null?window.innerWidth:document.documentElement&&document.documentElement.clientWidth?document.documentElement.clientWidth:document.body!=null?document.body.clientWidth:null;},pageHeight:function(){return window.innerHeight!=null?window.innerHeight:document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body!=null?document.body.clientHeight:null;},UpdateEmbedCode:function(WidgetID,WidgetInfo,Path){if(eval("typeof "+"Widget"+WidgetID+"_Init")!='undefined'){eval("Widget"+WidgetID+"_Init();");}
var $WidgetObject=$("#T"+WidgetID);var $WidgetDiv=$("#WidgetDiv"+WidgetID);var $WidgetDivChild=$("#WidgetDiv"+WidgetID).children();if($WidgetObject.length==0){return;}
var widgetPositionBottom="";var widgetPositionRight="";if($WidgetObject!='undefined'){var WidgetInfo=eval('('+WidgetInfo+')');cont=$WidgetObject.html();if(WidgetInfo.Height!=undefined){$WidgetObject.width(WidgetInfo.Width);$WidgetObject.height(WidgetInfo.Height);cont=cont.replace(/width="([\d])+"/i,"width=\""+WidgetInfo.Width+"\"");cont=cont.replace(/height="([\d])+"/i,"height=\""+WidgetInfo.Height+"\"");}
if(WidgetInfo.IsPopup){this.importJS(Path+"popup.js","Reallusion.Popup.V250");document._PopupSrc=Path;}
eval("IsDrag"+WidgetID+"=false;");var PositionStyle="";if(WidgetInfo.IsDrag){eval("IsDrag"+WidgetID+"=true;");this.importJS(Path+"ajax.js","Reallusion.Ajax.V250",function(){$WidgetDivChild.mousedown(function(event){Reallusion.Ajax.V250.startdrag(this,event);});});var widgetTop=$WidgetDivChild.css("top");var widgetLeft=$WidgetDivChild.css("left");if(WidgetInfo.IsPinned){if(WidgetInfo.Height!=undefined){var pageWidth=this.pageWidth();var pageHeight=this.pageHeight();var CurrentTop=$WidgetDiv.offset().top;var CurrentLeft=$WidgetDiv.offset().left;if(CurrentTop+(WidgetInfo.Height)>pageHeight){widgetPositionBottom="60%";}
if(CurrentLeft+(WidgetInfo.Width)>pageWidth){widgetPositionRight="60%";}}
$WidgetDiv.attr("style","position:fixed;z-index:9999990;");}
else{$WidgetDiv.css("position","relative");}
$WidgetDivChild.attr("style","position:absolute;left:"+widgetLeft+";top:"+widgetTop+";");}
else{$WidgetDiv.removeAttr("onmousedown");$WidgetDiv.css("position","static");$WidgetDivChild.css("position","static");}
if(WidgetInfo.IsTransparent){var Wmode="transparent";if($("#T"+WidgetID+" > param[name$='wmode']").val()!=Wmode){cont=cont.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")opaque('|")\s*\/?\>/i,"<param name='wmode' value='"+Wmode+"' />");cont=cont.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i,"<param name='wmode' value='"+Wmode+"' />");cont=cont.replace(/wmode\s*=\s*('|")opaque('|")/i,"wmode='"+Wmode+"'");cont=cont.replace(/wmode\s*=\s*('|")window('|")/i,"wmode='"+Wmode+"'");}}
else if(WidgetInfo.IsDrag){var Wmode="opaque";if($("#T"+WidgetID+" > param[name$='wmode']").val()!=Wmode){cont=cont.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")transparent('|")\s*\/?\>/i,"<param name='wmode' value='"+Wmode+"' />");cont=cont.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i,"<param name='wmode' value='"+Wmode+"' />");cont=cont.replace(/wmode\s*=\s*('|")transparent('|")/i,"wmode='"+Wmode+"'");cont=cont.replace(/wmode\s*=\s*('|")window('|")/i,"wmode='"+Wmode+"'");}}
else{var Wmode="window";if($("#T"+WidgetID+" > param[name$='wmode']").val()!=Wmode){cont=cont.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")transparent('|")\s*\/?\>/i,"<param name='wmode' value='"+Wmode+"' />");cont=cont.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")opaque('|")\s*\/?\>/i,"<param name='wmode' value='"+Wmode+"' />");cont=cont.replace(/wmode\s*=\s*('|")transparent('|")/i,"wmode='"+Wmode+"'");cont=cont.replace(/wmode\s*=\s*('|")opaque('|")/i,"wmode='"+Wmode+"'");}}
cont=cont.replace(/.xml/g,".xml?rid="+new Date().getTime());$WidgetObject.replaceWith(cont);if(widgetPositionBottom!=''){$WidgetDiv.animate({'bottom':widgetPositionBottom},1500);}
if(widgetPositionRight!=''){$WidgetDiv.animate({'right':widgetPositionRight},1500);}
if(eval("typeof "+"Widget"+WidgetID+"_InitComplete")!='undefined'){eval("Widget"+WidgetID+"_InitComplete();");}}}}
function namespace(ns){var parent=window;if(!window.hasOwnProperty)
window.hasOwnProperty=function(p){return typeof(window[p])!='undefined'};var arNs=ns.split('.');do{var nowNs=arNs.shift();if(!parent.hasOwnProperty(nowNs)){parent[nowNs]={};}
parent=parent[nowNs];}while(arNs.length>0)
return eval("("+ns+")");}
