/*
 * Ext JS Library 3.0+
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license, iGlue library Copyright(c) 2007-2009 In4 Ltd. 
 */
Ext.ns("iGlue");iGlue.Site=new in4.base.App({initMainView:function(){this.viewPort=new in4.base.Component({id:"iglueSite",container:Ext.getBody(),width:"100%",height:"100%",elCls:"mainBg",listeners:{init:{fn:function(a){Ext.DomHelper.append(Ext.getBody(),{tag:"div",id:"logo",style:"position:absolute; top: 20px; left: 20px; width:126px;height: 41px; background: url(res/iglue/images/iglue_logo_beta.png);"});var b=Ext.DomHelper.insertFirst(Ext.get("iglueSite"),{tag:"div",id:"main-tools",style:"position:absolute; top:5px; right: 5px; width: 310px;",html:'<div style="height: 25px;"><div style="width: 100px; float:right;" id="languageSelect"></div><div style="line-height: 22px; vertical-align: middle; text-align: right; width: 200px;" id="loginLink"></div></div>'},true);this.langCombo=new in4.base.form.Combo({listCls:"dark-dropdown",defaultText:"",displayField:"name",valueField:"shortName",initialSelection:{id:this.lm.actual,name:this.lm.language},width:"100%",height:20,id:"lselector",autoHeight:false,container:b.child("#languageSelect"),mode:"local",scroll:false,rowTpl:"plain",data:this.lm.locales,listeners:{select:{scope:this,fn:function(d,e,c){this.lm.setLocale(d)}}}});Ext.DomHelper.insertFirst(Ext.get("iglueSite"),{tag:"img",id:"center-image",style:"position:absolute; top: 0px; left: "+((Ext.getBody().getWidth()-904)/2)+"px; width:904;height: 80px; ",src:"res/iglue/images/center-image.png"})},scope:this}},items:[{id:"mainv",gtype:"splitter",width:"100%",height:"100%",closed:true,enabled:false,collapsable:true,regionCfg:{sizeLR:"right"},listeners:{toggle:{fn:function(b,a){in4.base.all.tabbar.activeTab.sidebarActive=a}}},setSideBar:function(a){if(this.closed!=!a){this.toggleCollapse()}},items:[{gtype:"component",id:"center",region:"left",height:"100%",width:"100%",resizable:false,items:[]},{gtype:"component",id:"east",region:"right",width:350,minWidth:350,maxWidth:500,style:"padding-top: 10px;padding-right: 10px;",portal:true,resizable:false,scroll:true,wrapStyle:"padding-right: 10px;",listeners:{init:{fn:function(a){Ext.DomHelper.append(a.el,{tag:"div",cls:"i-let-upper-grad"})}}}}]},{gtype:"maintab",id:"tabbar",width:"100%",height:42,scrollButton:true,viewPort:"center",style:"padding-left: 178px",listeners:{activetabchange:{fn:function(d,b,a){if(a&&b.sidebarActive!=a.sidebarActive){this.container.items[0].setSideBar(b.sidebarActive)}}}}}]})},moduleLoadHandler:function(b,c,a){if(b=="search"&&this.initMainView!=Ext.emptyFn){in4.modules.search.app=this;in4.modules.search.init("center")}else{if(b=="info"&&this.initMainView!=Ext.emptyFn){in4.base.modules.info.app=this;in4.base.modules.info.init("center");if(a){in4.base.modules.info.activate(c)}}else{if(b=="east"&&this.initMainView!=Ext.emptyFn){in4.modules.east.app=this;in4.modules.east.init(c.entityId,c.discriminator.match(/(?:<span class="(?:iglue-hitname" alternate="[^"]*"|iglue-name")[^>]*>([^<]*)<\/span>)/)[1])}else{if(b=="auth"&&this.initMainView!=Ext.emptyFn){in4.modules.auth.app=this;in4.modules.auth.init("center")}else{if(b=="hierarchyeditor"&&this.initMainView!=Ext.emptyFn){in4.modules.hierarchyeditor.app=this;in4.modules.hierarchyeditor.init("center");if(a){in4.modules.hierarchyeditor.activate()}}else{if(b=="language"&&this.initMainView!=Ext.emptyFn){in4.modules.language.app=this;in4.modules.language.init("center");if(a){in4.modules.language.activate()}}else{if(b=="similator"&&this.initMainView!=Ext.emptyFn){in4.modules.similator.app=this;in4.modules.similator.init("center");if(a){in4.modules.similator.activate()}}else{if(b=="gemini"&&this.initMainView!=Ext.emptyFn){in4.modules.gemini.app=this;in4.modules.gemini.init("center");if(a){in4.modules.gemini.activate()}}else{if(b=="schemaeditor"&&this.initMainView!=Ext.emptyFn){in4.modules.schemaeditor.app=this;in4.modules.schemaeditor.init("center");if(a){in4.modules.schemaeditor.activate()}}}}}}}}}}},showWindow:function(a){this.infoWindow=new iGlue.Site.HowToUse({container:Ext.getBody()});this.infoWindow.setActive(a)}});iGlue.Site.HowToUse=Ext.extend(in4.base.Panel,{mode:"window",disposeOnHide:true,gtype:"auth",height:675,width:944,elCls:"auth-window",boxCls:"a-pan",bodyCls:"auth-window-body",initComponent:function(){this.isModal={overlay:Ext.getBody()};this.rendered={};this.tpls={};this.tpls.searchtouse=(new Ext.XTemplate('<div><img class="modal-close i-link" src="res/iglue/images/auth/close.png" style="float: right;padding-right:24px;" />','<div style="width: 854px;height:545px; margin-left: 20px; margin-right: 20px;">','<object width="854" height="510">','<param name="movie" value="http://www.youtube.com/v/LGmUBfccPsg&hl=en_US&fs=1&rel=0&color1=0x234900&color2=0x4e9e00"></param>','<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>','<embed src="http://www.youtube.com/v/LGmUBfccPsg&hl=en_US&fs=1&rel=0&color1=0xc1c1c1&color2=0xf3f3f3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="854" height="510"></embed>',"</object>","</div>",'<div class="field-set-main" style="margin-right: 20px;"><div class="field-set-tl"><div class="field-set-tr"><div class="field-set-tc"></div></div></div>','<div class="field-set-ml"><div class="field-set-mr"><div class="field-set-mc">','<span style="color:#77A600;">How to Search</span>',' | <span class="how-to-datasheet" style="cursor:pointer;cursor:hand;">How to use Datasheet</span>',' | <span class="wikify-the-web" style="cursor:pointer;cursor:hand;">Why we need iGlue?</span>',' | <span class="auto-annotate" style="cursor:pointer;cursor:hand;">Automatic annotation & IceCube</span>',' | <span class="hand-annotate" style="cursor:pointer;cursor:hand;">Hand annotation</span>',"</div></div></div>",'<div class="field-set-bl"><div class="field-set-br"><div class="field-set-bc"></div></div></div></div></div>',{msg:msg}));this.tpls.datasheettouse=(new Ext.XTemplate('<div><img class="modal-close i-link" src="res/iglue/images/auth/close.png" style="float: right;padding-right:24px;" />','<div style="width: 854px;height:545px; margin-left: 20px; margin-right: 20px;">','<object width="854" height="510">','<param name="movie" value="http://www.youtube.com/v/yxQmY4P5dEs&hl=en_US&fs=1&rel=0&color1=0x234900&color2=0x4e9e00"></param>','<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>','<embed src="http://www.youtube.com/v/yxQmY4P5dEs&hl=en_US&fs=1&rel=0&color1=0xc1c1c1&color2=0xf3f3f3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="854" height="510"></embed>',"</object>","</div>",'<div class="field-set-main" style="margin-right: 20px;"><div class="field-set-tl"><div class="field-set-tr"><div class="field-set-tc"></div></div></div>','<div class="field-set-ml"><div class="field-set-mr"><div class="field-set-mc">','<span class="how-to-search" style="cursor:pointer;cursor:hand;">How to Search</span>',' | <span style="color:#77A600;">How to use Datasheet</span>',' | <span class="wikify-the-web" style="cursor:pointer;cursor:hand;">Why we need iGlue?</span>',' | <span class="auto-annotate" style="cursor:pointer;cursor:hand;">Automatic annotation & IceCube</span>',' | <span class="hand-annotate" style="cursor:pointer;cursor:hand;">Hand annotation</span>',"</div></div></div>",'<div class="field-set-bl"><div class="field-set-br"><div class="field-set-bc"></div></div></div></div></div>',{msg:msg}));this.tpls.wikifytheweb=(new Ext.XTemplate('<div><img class="modal-close i-link" src="res/iglue/images/auth/close.png" style="float: right;padding-right:24px;" />','<div style="width: 854px;height:545px; margin-left: 20px; margin-right: 20px;">','<object width="854" height="510">','<param name="movie" value="http://www.youtube.com/v/wgRQayvgtXY&hl=en_US&fs=1&rel=0&color1=0x234900&color2=0x4e9e00"></param>','<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>','<embed src="http://www.youtube.com/v/wgRQayvgtXY&hl=en_US&fs=1&rel=0&color1=0xc1c1c1&color2=0xf3f3f3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="854" height="510"></embed>',"</object>","</div>",'<div class="field-set-main" style="margin-right: 20px;"><div class="field-set-tl"><div class="field-set-tr"><div class="field-set-tc"></div></div></div>','<div class="field-set-ml"><div class="field-set-mr"><div class="field-set-mc">','<span class="how-to-search" style="cursor:pointer;cursor:hand;">How to Search</span>',' | <span class="how-to-datasheet" style="cursor:pointer;cursor:hand;">How to use Datasheet</span>',' | <span style="color:#77A600;">Why we need iGlue?</span>',' | <span class="auto-annotate" style="cursor:pointer;cursor:hand;">Automatic annotation & IceCube</span>',' | <span class="hand-annotate" style="cursor:pointer;cursor:hand;">Hand annotation</span>',"</div></div></div>",'<div class="field-set-bl"><div class="field-set-br"><div class="field-set-bc"></div></div></div></div></div>',{msg:msg}));this.tpls.autoannotate=(new Ext.XTemplate('<div><img class="modal-close i-link" src="res/iglue/images/auth/close.png" style="float: right;padding-right:24px;" />','<div style="width: 854px;height:545px; margin-left: 20px; margin-right: 20px;">','<object width="854" height="510">','<param name="movie" value="http://www.youtube.com/v/3NpE5-mupxg&hl=en_US&fs=1&rel=0&color1=0x234900&color2=0x4e9e00"></param>','<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>','<embed src="http://www.youtube.com/v/3NpE5-mupxg&hl=en_US&fs=1&rel=0&color1=0xc1c1c1&color2=0xf3f3f3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="854" height="510"></embed>',"</object>","</div>",'<div class="field-set-main" style="margin-right: 20px;"><div class="field-set-tl"><div class="field-set-tr"><div class="field-set-tc"></div></div></div>','<div class="field-set-ml"><div class="field-set-mr"><div class="field-set-mc">','<span class="how-to-search" style="cursor:pointer;cursor:hand;">How to Search</span>',' | <span class="how-to-datasheet" style="cursor:pointer;cursor:hand;">How to use Datasheet</span>',' | <span class="wikify-the-web" style="cursor:pointer;cursor:hand;">Why we need iGlue?</span>',' | <span style="color:#77A600;">Automatic annotation & IceCube</span>',' | <span class="hand-annotate" style="cursor:pointer;cursor:hand;">Hand annotation</span>',"</div></div></div>",'<div class="field-set-bl"><div class="field-set-br"><div class="field-set-bc"></div></div></div></div></div>',{msg:msg}));this.tpls.handannotate=(new Ext.XTemplate('<div><img class="modal-close i-link" src="res/iglue/images/auth/close.png" style="float: right;padding-right:24px;" />','<div style="width: 854px;height:545px; margin-left: 20px; margin-right: 20px;">','<object width="854" height="510">','<param name="movie" value="http://www.youtube.com/v/lGmqguswb9k&hl=en_US&fs=1&rel=0&color1=0x234900&color2=0x4e9e00"></param>','<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>','<embed src="http://www.youtube.com/v/lGmqguswb9k&hl=en_US&fs=1&rel=0&color1=0xc1c1c1&color2=0xf3f3f3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="854" height="510"></embed>',"</object>","</div>",'<div class="field-set-main" style="margin-right: 20px;"><div class="field-set-tl"><div class="field-set-tr"><div class="field-set-tc"></div></div></div>','<div class="field-set-ml"><div class="field-set-mr"><div class="field-set-mc">','<span class="how-to-search" style="cursor:pointer;cursor:hand;">How to Search</span>',' | <span class="how-to-datasheet" style="cursor:pointer;cursor:hand;">How to use Datasheet</span>',' | <span class="wikify-the-web" style="cursor:pointer;cursor:hand;">Why we need iGlue?</span>',' | <span class="auto-annotate" style="cursor:pointer;cursor:hand;">Automatic annotation & IceCube</span>',' | <span style="color:#77A600;">Hand annotation</span>',"</div></div></div>",'<div class="field-set-bl"><div class="field-set-br"><div class="field-set-bc"></div></div></div></div></div>',{msg:msg}));iGlue.Site.HowToUse.superclass.initComponent.call(this);this.bodyEl.on("click",this.onBodyClick,this)},renderTab:function(a){if(this.rendered[a]||!this.tpls[a]){return}this.rendered[a]=this.tpls[a].append(this.bodyEl,{},true)},setActive:function(a){if(this.rendered[this.actTab]){this.rendered[this.actTab].addClass("i-nullheight")}if(this.rendered[a]){this.rendered[a].removeClass("i-nullheight")}else{if(this.tpls[a]){this.renderTab(a)}else{throw Ext.Error("Invalid view")}}this.actTab=a;this.resize(this,this.width,this.height);var c=Ext.getBody().getSize();var b=this.el.getSize();this.el.dom.style.left=(c.width-b.width)/2+"px";this.el.dom.style.top=(c.height-b.height)/2+"px";this.el.dom.style.position="absolute"},onBodyClick:function(c,b){var a=Ext.get(b);if(a.hasClass("how-to-search")){this.setActive("searchtouse")}else{if(a.hasClass("how-to-datasheet")){this.setActive("datasheettouse")}else{if(a.hasClass("wikify-the-web")){this.setActive("wikifytheweb")}else{if(a.hasClass("auto-annotate")){this.setActive("autoannotate")}else{if(a.hasClass("hand-annotate")){this.setActive("handannotate")}}}}}if(a.hasClass("modal-close")){this.hide()}}});
