//*****************************************************************************
// Copyright 2007 Starscale Inc.

var ibi={Const:{Version:"1.4",IncludePath:"/static/js/",AllowLog:false,AllowAssert:false},Phix:{},IncludedScripts:{},IncludeScript:function(file){if(ibi.IncludedScripts[file]){return;}
var fullPath=ibi.Const.IncludePath+file;ibi.IncludedScripts[file]=true;$('head').insert('<script type="text/javascript" src="'
+fullPath+'"/>');},Template:{templateRegEx:/%\((?:([A-Za-z0-9_]+)|([A-Za-z0-9_\.]+))\)/g,parse:function(tmpl,namespace){var getValue=function(ignored,simple,complex)
{if(simple){return namespace[simple];}
var names=complex.split(".");var nested=namespace;for(var i=0,length=names.length;i<length;++i){nested=nested[names[i]];}
return nested;}
return tmpl.replace(ibi.Template.templateRegEx,getValue);}},parseInt:function(str,radix){radix=radix||10;return parseInt(str,radix);},getUniqueId:function(){return(new Date()).getTime().toString()+Math.floor(Math.random()*10000).toString();},log:function(message){if(!ibi.Const.AllowLog)return;if(window.console){window.console.log(message);}else{if(Prototype.Browser.Opera){opera.postError(message);}
else{alert(message);}}},assertNamespace:function(namespace){var parts=namespace.split('.');if(parts[0]=='ibi'){parts.shift();}
var hash=ibi;for(var i=0;i<parts.length;++i){if(!hash[parts[i]]){hash[parts[i]]={};}
hash=hash[parts[i]];}},assert:function(variable,msg){if(ibi.Const.AllowAssert&&(variable==undefined||variable==null||variable==false)){if(msg){throw msg;}else{throw"ibi.assert fired";}}}};Prototype.JSONFilter=/^\/\*([\s\S]*)\*\/\s*$/;Element.addMethods({update:function(element,html,ignoreScripts){html=(typeof(html)=='undefined'?'':html.toString());if(ignoreScripts){$(element).innerHTML=html;}else{$(element).innerHTML=html.stripScripts();setTimeout(function(){html.evalScripts()},10);}
return element;},updateXHTML:function(element,xml,ignoreScripts){if(Prototype.Browser.IE){element.update(xml,ignoreScripts);return element;}
else{try{var parser=new DOMParser();var content=ignoreScripts?xml:xml.stripScripts();var domSegment=parser.parseFromString(content,'application\/xhtml+xml');domSegment=document.importNode(domSegment.documentElement,true);while(element.firstChild){element.removeChild(element.firstChild);}
element.appendChild(domSegment);if(!ignoreScripts){setTimeout(function(){xml.evalScripts();},10);}
return element;}catch(e){element.update(xml,ignoreScripts);return element;}}}});if(window.Droppables){Droppables.clear=function(){this.drops.clear();};Droppables.size=function(){return this.drops.size();}}
