////////////////////////////////////////////// 
//         SoundOutTheBox sphereMenu        // 
//  Copyright © SoundOutTheBox 2012-2013    // 
//           License-CC-BY-NC-ND            // 
////////////////////////////////////////////// 
(function(f){f.widget("mui.sphereMenu",{options:{publicVariables:{Name:{value:"no name",type:"StringData",dynamic:!1},Left:{value:0,type:"IntegerData",dynamic:!1},Top:{value:0,type:"IntegerData",dynamic:!1},Width:{value:400,type:"IntegerData",dynamic:!1},Height:{value:400,type:"IntegerData",dynamic:!1},Items:{value:"item1;item2;item3;item4;item5;item6;item7;item8;item9;item10;item11;item12;item13;item14",type:"StringData",dynamic:!1},Separator:{value:";",type:"StringData",dynamic:!1},TextColor:{value:"000,000,127",
type:"StringData",subtype:"Color",dynamic:!1},TextFont:{value:"Tahoma, 24",type:"StringData",subtype:"Font",dynamic:!1},ItemName:{value:"",type:"StringData",dynamic:!0},ItemIndex:{value:0,type:"IntegerData",dynamic:!0},Visible:{value:["no","yes"],type:"EnumData",defaultvalue:"yes",write:!0,dynamic:!0}},privateVariables:{pageNumber:0,motifType:0,userScreen:0,aArray:null,font:null},config:{main:"sphereMenu.js",description:"sphereMenu displays an item list as a rotative sphere.",author:"SoundOutTheBox",
version:"1.0.0.0.Final",dependencies:["./js/jquery.tagsphere.min.js","./js/jquery.mousewheel.min.js"],widgetID:"68986692686f9967999833926669926371696e9b6a38666269656a6a716f696c",widgetPackages:["666b6a69926e6b976d6b6692669c6364716a66686e3163986e93946d9e666c6b"]}},_create:function(){this.options.privateVariables.font=new goFont},_init:function(){},_destroy:function(){},_setOption:function(){f.Widget.prototype._setOption.apply(this,arguments)},_render:function(){var b=this,a=b.options.publicVariables,c=b.options.privateVariables,d=b.element,g=a.Top.value,l=a.Height.value,
h=a.Left.value,m=a.Width.value,e=a.TextColor.value,j=a.Items.value,n=a.Separator.value;console.log("_render()  object="+a.Name.value);d.disableSelection();d.css({position:"absolute",left:h+"px",top:g+"px",width:m+"px",height:l+"px",zIndex:10});d.addClass("dynamicObject");var k=f("<div/>");k.css({position:"relative",left:h+"px",top:g+"px",width:m+"px",height:l+"px"});k.appendTo(d);c.aArray=[];d=f("<ul/>");d.appendTo(k);e=e.substr(0,6);e=e.slice(0,4)+e.slice(5,e.len);e=e.slice(0,2)+e.slice(3,e.len);
j=j.split(n);n=j.length;for(g=0;g<n;g++){h=f("<li/>");h.appendTo(d);var i=f('<a style="color:'+e+'" rel="'+g%4+'">'+j[g]+" </a>");i.css({fontFamily:c.font._name,fontStyle:c.font._italic===!1?"normal":"italic",fontWeight:c.font._bold===!1?"normal":"bold",textDecoration:c.font._underline!==!1?"underline":c.font._strikeOut===!1?"none":"line-through"});i.appendTo(h);c.aArray[g]=i;i.hover(function(){document.body.style.cursor="pointer"},function(){document.body.style.cursor="default"});i.click(function(){b.setLastClicked(f(this))})}f(k).tagcloud({centrex:m/
2,centrey:l/2.5,init_motion_x:10,init_motion_y:10,min_font_size:c.font._height/1.8,max_font_size:c.font._height,font_units:"pt"});b.setVisible(a.Visible.value)},setLastClicked:function(b){for(var a=this.options.privateVariables.aArray,c=a.length,d=0;d<c;d++)if(a[d][0]===b[0])this.options.publicVariables.ItemName.value=b[0].text,this.options.publicVariables.ItemIndex.value=d+1,this._trigger("propertyChange",null,Object({name:this.options.publicVariables.Name.value+".ItemName",property:"ItemName",value:this.options.publicVariables.ItemName.value})),
this._trigger("propertyChange",null,Object({name:this.options.publicVariables.Name.value+".ItemIndex",property:"ItemIndex",value:this.options.publicVariables.ItemIndex.value}))},setVisible:function(b){var a=this.options.publicVariables,c=this.element;if(b!==a.Visible.value)a.Visible.value=b;a.Visible.value!=="no"?UTIL.setOpacity(c,1):UTIL.setOpacity(c,0)},readFromXML:function(b){var a=this.options.publicVariables,c=this.options.privateVariables,b=f(b);a.Name.value=UTIL.getStringAttr(b,"Name",a.Name.value);
a.Items.value=UTIL.getStringAttr(b,"Items",a.Items.value);a.Separator.value=UTIL.getStringAttr(b,"Separator",a.Separator.value);a.TextColor.value=UTIL.getColorAttr(b,"TextColor",a.TextColor.value);a.TextFont.value=UTIL.getStringAttr(b,"TextFont",a.TextFont.value);a.ItemName.value=UTIL.getStringAttr(b,"ItemName",a.ItemName.value);a.ItemIndex.value=UTIL.getIntAttr(b,"ItemIndex",a.ItemIndex.value);a.Visible.value=UTIL.getStringAttr(b,"Visible",a.Visible.value);c.font.readFromText(a.TextFont.value);UTIL.readPositionFromXML(b,
a)},onPropertyChange:function(b,a){switch(b){case "Visible":this.setVisible(a)}},onReleaseCapture:function(){}})})(jQuery);
