
function plog(s)
{if(typeof console!="undefined"&&typeof console.debug!="undefined")
{console.log(s);}else
{Sys.Debug.trace(s);}}
if(typeof jQuery!="undefined"){jQuery(function(){if(typeof(Menu_Hack)=="undefined")
{Menu_Hack=1;if(typeof(Menu_HideItems)!="undefined")
{var oldMenu_HideItems=Menu_HideItems;if(oldMenu_HideItems)
{Menu_HideItems=function(items)
{if(!items||((typeof(items.tagName)=="undefined")&&(items instanceof Event)))
{items=__rootMenuItem;}
if(items&&items.rows&&items.rows.length==0)
{items.insertRow(0);}
return oldMenu_HideItems(items);}}}
if(typeof(Menu_Unhover)!="undefined")
{var oldMenu_Unhover=Menu_Unhover;if(oldMenu_Unhover)
{Menu_Unhover=function(item)
{var imgs=item.getElementsByTagName("img");for(var i=0;i<imgs.length;i++)
{var img=imgs[i];img.src=img.src.replace("-Hot","-Cold");}
return oldMenu_Unhover(item);}}}
if(typeof(Menu_HoverStatic)!="undefined")
{var oldMenu_HoverStatic=Menu_HoverStatic;if(oldMenu_HoverStatic)
{Menu_HoverStatic=function(item)
{var imgs=item.getElementsByTagName("img");for(var i=0;i<imgs.length;i++)
{var img=imgs[i];img.src=img.src.replace("-Cold","-Hot");}
return oldMenu_HoverStatic(item);}}}}});}
function getIsChildOf(parent,child)
{if(parent!=null)
{if(parent.contains!=undefined)
{return parent.contains(child);}
else
{while(child!=null)
{if(child==parent)
{return true;}
else
{child=child.parentNode;}}}}
return false;}
String.Format=function()
{if(arguments.length==0)
return"";var str=arguments[0];for(var i=1;i<arguments.length;i++)
{var re=new RegExp('\\{'+(i-1)+'\\}','gm');str=str.replace(re,arguments[i]);}
return str;}
String.prototype.Ellipse=function(maxLength)
{if(this.length>maxLength)
{return this.substr(0,maxLength-3)+'...';}
else
{return this.trim();}};var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');function LZ(x){return(x<0||x>9?"":"0")+x}
function formatDate(date,format){format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getYear()+"";var M=date.getMonth()+1;var d=date.getDate();var E=date.getDay();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;var value=new Object();if(y.length<4){y=""+(y-0+1900);}
value["y"]=""+y;value["yyyy"]=y;value["yy"]=y.substring(2,4);value["M"]=M;value["MM"]=LZ(M);value["MMM"]=MONTH_NAMES[M-1];value["NNN"]=MONTH_NAMES[M+11];value["d"]=d;value["dd"]=LZ(d);value["E"]=DAY_NAMES[E+7];value["EE"]=DAY_NAMES[E];value["H"]=H;value["HH"]=LZ(H);if(H==0){value["h"]=12;}
else if(H>12){value["h"]=H-12;}
else{value["h"]=H;}
value["hh"]=LZ(value["h"]);if(H>11){value["K"]=H-12;}else{value["K"]=H;}
value["k"]=H+1;value["KK"]=LZ(value["K"]);value["kk"]=LZ(value["k"]);if(H>11){value["a"]="PM";}
else{value["a"]="AM";}
value["m"]=m;value["mm"]=LZ(m);value["s"]=s;value["ss"]=LZ(s);while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}
if(value[token]!=null){result=result+value[token];}
else{result=result+token;}}
return result;}
function FilterOnEventTarget(ev,targetTagName)
{ev=ev||window.event;var target=ev.target||ev.srcElement;return target!=null&&target.tagName==targetTagName;}
(function()
{var table="00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";crc32=function(str,crc)
{if(crc==window.undefined)crc=0;var n=0;var x=0;crc=crc^(-1);for(var i=0,iTop=str.length;i<iTop;i++)
{n=(crc^str.charCodeAt(i))&0xFF;x="0x"+table.substr(n*9,8);x=parseInt(x);crc=(crc>>>8)^x;}
return crc^(-1);};})();function updateQuerySelect(options)
{$('.queryOption').click(function()
{var thisElem=$(this);if(!thisElem.hasClass('queryOptionSelected'))
{$(options.CurrentValueSelector).val('#'+this.id);$(".queryOption").removeClass('queryOptionSelected');thisElem.addClass('queryOptionSelected');if($('.querySelectContainer:visible').length>0)
{$('.querySelectContainer').animate({height:"hide"},"fast",function(){$(thisElem.attr('targetUI')).animate({height:"show"},"normal",null);});}
else
{$(thisElem.attr('targetUI')).animate({height:"show"},"normal",null);}}});$($(options.CurrentValueSelector).val()).click();}
function picassoGetElementByID(id,frame,doc)
{if(id!="")
{if(doc==undefined||doc==null)
{doc=document;}
if(frame!=undefined&&frame!=null)
{var iframe=picassoGetElementByID(frame);if(iframe!=null)
{doc=(iframe.contentWindow||iframe.contentDocument);if(doc.document)
{doc=doc.document;}}}
if(doc.getElementById!=null)
{return doc.getElementById(id);}
else if(doc.all!=null)
{return doc.all[id];}
else if(doc.layers!=null)
{return doc.layers[id];}}
return null;}
function PicassoGetNextSiblingElement(element)
{while(element!=null)
{element=element.nextSibling;if(element==null)
{break;}
if(element.nodeName=="#text")
{continue;}
else
{return element;}}
return null;}
function PicassoGetFirstChildElement(element)
{if(element!=null)
{var child=element.firstChild;while(child)
{if(child.nodeName=="#text")
{child=child.nextSibling;}
else
{return child;}}}
return null;}
function height(element)
{return parseInt(element.offsetHeight);}
function getWindowHeight()
{var height=0;if(typeof(window.innerHeight)=='number')
{height=window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight)
{height=document.documentElement.clientHeight;}
else if(document.body&&document.body.clientHeight)
{height=document.body.clientHeight;}
return parseInt(height);}
(function(window,undefined){var jQuery=function(selector,context){return new jQuery.fn.init(selector,context);},_jQuery=window.jQuery,_$=window.$,document=window.document,rootjQuery,quickExpr=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/,rnotwhite=/\S/,rtrim=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,userAgent=navigator.userAgent,browserMatch,readyBound=false,readyList=[],DOMContentLoaded,toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,push=Array.prototype.push,slice=Array.prototype.slice,indexOf=Array.prototype.indexOf;jQuery.fn=jQuery.prototype={init:function(selector,context){var match,elem,ret,doc;if(!selector){return this;}
if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this;}
if(typeof selector==="string"){match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1]){doc=(context?context.ownerDocument||context:document);ret=rsingleTag.exec(selector);if(ret){if(jQuery.isPlainObject(context)){selector=[document.createElement(ret[1])];jQuery.fn.attr.call(selector,context,true);}else{selector=[doc.createElement(ret[1])];}}else{ret=buildFragment([match[1]],[doc]);selector=(ret.cacheable?ret.fragment.cloneNode(true):ret.fragment).childNodes;}}else{elem=document.getElementById(match[2]);if(elem){if(elem.id!==match[2]){return rootjQuery.find(selector);}
this.length=1;this[0]=elem;}
this.context=document;this.selector=selector;return this;}}else if(!context&&/^\w+$/.test(selector)){this.selector=selector;this.context=document;selector=document.getElementsByTagName(selector);}else if(!context||context.jquery){return(context||rootjQuery).find(selector);}else{return jQuery(context).find(selector);}}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector);}
if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context;}
return jQuery.isArray(selector)?this.setArray(selector):jQuery.makeArray(selector,this);},selector:"",jquery:"1.4",length:0,size:function(){return this.length;},toArray:function(){return slice.call(this,0);},get:function(num){return num==null?this.toArray():(num<0?this.slice(num)[0]:this[num]);},pushStack:function(elems,name,selector){var ret=jQuery(elems||null);ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector;}else if(name){ret.selector=this.selector+"."+name+"("+selector+")";}
return ret;},setArray:function(elems){this.length=0;push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},ready:function(fn){jQuery.bindReady();if(jQuery.isReady){fn.call(document,jQuery);}else if(readyList){readyList.push(fn);}
return this;},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1);},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},slice:function(){return this.pushStack(slice.apply(this,arguments),"slice",slice.call(arguments).join(","));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},end:function(){return this.prevObject||jQuery(null);},push:push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options,name,src,copy;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!jQuery.isFunction(target)){target={};}
if(length===i){target=this;--i;}
for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue;}
if(deep&&copy&&(jQuery.isPlainObject(copy)||jQuery.isArray(copy))){var clone=src&&(jQuery.isPlainObject(src)||jQuery.isArray(src))?src:jQuery.isArray(copy)?[]:{};target[name]=jQuery.extend(deep,clone,copy);}else if(copy!==undefined){target[name]=copy;}}}}
return target;};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep){window.jQuery=_jQuery;}
return jQuery;},isReady:false,ready:function(){if(!jQuery.isReady){if(!document.body){return setTimeout(jQuery.ready,13);}
jQuery.isReady=true;if(readyList){var fn,i=0;while((fn=readyList[i++])){fn.call(document,jQuery);}
readyList=null;}
if(jQuery.fn.triggerHandler){jQuery(document).triggerHandler("ready");}}},bindReady:function(){if(readyBound){return;}
readyBound=true;if(document.readyState==="complete"){return jQuery.ready();}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",DOMContentLoaded,false);window.addEventListener("load",jQuery.ready,false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",DOMContentLoaded);window.attachEvent("onload",jQuery.ready);var toplevel=false;try{toplevel=window.frameElement==null;}catch(e){}
if(document.documentElement.doScroll&&toplevel){doScrollCheck();}}},isFunction:function(obj){return toString.call(obj)==="[object Function]";},isArray:function(obj){return toString.call(obj)==="[object Array]";},isPlainObject:function(obj){if(!obj||toString.call(obj)!=="[object Object]"||obj.nodeType||obj.setInterval){return false;}
if(obj.constructor&&!hasOwnProperty.call(obj,"constructor")&&!hasOwnProperty.call(obj.constructor.prototype,"isPrototypeOf")){return false;}
var key;for(key in obj){}
return key===undefined||hasOwnProperty.call(obj,key);},isEmptyObject:function(obj){for(var name in obj){return false;}
return true;},noop:function(){},globalEval:function(data){if(data&&rnotwhite.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.support.scriptEval){script.appendChild(document.createTextNode(data));}else{script.text=data;}
head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()===name.toUpperCase();},each:function(object,callback,args){var name,i=0,length=object.length,isObj=length===undefined||jQuery.isFunction(object);if(args){if(isObj){for(name in object){if(callback.apply(object[name],args)===false){break;}}}else{for(;i<length;){if(callback.apply(object[i++],args)===false){break;}}}}else{if(isObj){for(name in object){if(callback.call(object[name],name,object[name])===false){break;}}}else{for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}}
return object;},trim:function(text){return(text||"").replace(rtrim,"");},makeArray:function(array,results){var ret=results||[];if(array!=null){if(array.length==null||typeof array==="string"||jQuery.isFunction(array)||(typeof array!=="function"&&array.setInterval)){push.call(ret,array);}else{jQuery.merge(ret,array);}}
return ret;},inArray:function(elem,array){if(array.indexOf){return array.indexOf(elem);}
for(var i=0,length=array.length;i<length;i++){if(array[i]===elem){return i;}}
return-1;},merge:function(first,second){var i=first.length,j=0;if(typeof second.length==="number"){for(var l=second.length;j<l;j++){first[i++]=second[j];}}else{while(second[j]!==undefined){first[i++]=second[j++];}}
first.length=i;return first;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++){if(!inv!==!callback(elems[i],i)){ret.push(elems[i]);}}
return ret;},map:function(elems,callback,arg){var ret=[],value;for(var i=0,length=elems.length;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret[ret.length]=value;}}
return ret.concat.apply([],ret);},guid:1,proxy:function(fn,proxy,thisObject){if(arguments.length===2){if(typeof proxy==="string"){thisObject=fn;fn=thisObject[proxy];proxy=undefined;}else if(proxy&&!jQuery.isFunction(proxy)){thisObject=proxy;proxy=undefined;}}
if(!proxy&&fn){proxy=function(){return fn.apply(thisObject||this,arguments);};}
if(fn){proxy.guid=fn.guid=fn.guid||proxy.guid||jQuery.guid++;}
return proxy;},uaMatch:function(ua){var ret={browser:""};ua=ua.toLowerCase();if(/webkit/.test(ua)){ret={browser:"webkit",version:/webkit[\/ ]([\w.]+)/};}else if(/opera/.test(ua)){ret={browser:"opera",version:/version/.test(ua)?/version[\/ ]([\w.]+)/:/opera[\/ ]([\w.]+)/};}else if(/msie/.test(ua)){ret={browser:"msie",version:/msie ([\w.]+)/};}else if(/mozilla/.test(ua)&&!/compatible/.test(ua)){ret={browser:"mozilla",version:/rv:([\w.]+)/};}
ret.version=(ret.version&&ret.version.exec(ua)||[0,"0"])[1];return ret;},browser:{}});browserMatch=jQuery.uaMatch(userAgent);if(browserMatch.browser){jQuery.browser[browserMatch.browser]=true;jQuery.browser.version=browserMatch.version;}
if(jQuery.browser.webkit){jQuery.browser.safari=true;}
if(indexOf){jQuery.inArray=function(elem,array){return indexOf.call(array,elem);};}
rootjQuery=jQuery(document);if(document.addEventListener){DOMContentLoaded=function(){document.removeEventListener("DOMContentLoaded",DOMContentLoaded,false);jQuery.ready();};}else if(document.attachEvent){DOMContentLoaded=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",DOMContentLoaded);jQuery.ready();}};}
function doScrollCheck(){if(jQuery.isReady){return;}
try{document.documentElement.doScroll("left");}catch(error){setTimeout(doScrollCheck,1);return;}
jQuery.ready();}
if(indexOf){jQuery.inArray=function(elem,array){return indexOf.call(array,elem);};}
function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"});}else{jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");}
if(elem.parentNode){elem.parentNode.removeChild(elem);}}
function access(elems,key,value,exec,fn,pass){var length=elems.length;if(typeof key==="object"){for(var k in key){access(elems,k,key[k],exec,fn,value);}
return elems;}
if(value!==undefined){exec=!pass&&exec&&jQuery.isFunction(value);for(var i=0;i<length;i++){fn(elems[i],key,exec?value.call(elems[i],i,fn(elems[i],key)):value,pass);}
return elems;}
return length?fn(elems[0],key):null;}
function now(){return(new Date).getTime();}
(function(){jQuery.support={};var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+now();div.style.display="none";div.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return;}
jQuery.support={leadingWhitespace:div.firstChild.nodeType===3,tbody:!div.getElementsByTagName("tbody").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:/^0.55$/.test(a.style.opacity),cssFloat:!!a.style.cssFloat,checkOn:div.getElementsByTagName("input")[0].value==="on",optSelected:document.createElement("select").appendChild(document.createElement("option")).selected,scriptEval:false,noCloneEvent:true,boxModel:null};script.type="text/javascript";try{script.appendChild(document.createTextNode("window."+id+"=1;"));}catch(e){}
root.insertBefore(script,root.firstChild);if(window[id]){jQuery.support.scriptEval=true;delete window[id];}
root.removeChild(script);if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function click(){jQuery.support.noCloneEvent=false;div.detachEvent("onclick",click);});div.cloneNode(true).fireEvent("onclick");}
jQuery(function(){var div=document.createElement("div");div.style.width=div.style.paddingLeft="1px";document.body.appendChild(div);jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;document.body.removeChild(div).style.display='none';div=null;});var eventSupported=function(eventName){var el=document.createElement("div");eventName="on"+eventName;var isSupported=(eventName in el);if(!isSupported){el.setAttribute(eventName,"return;");isSupported=typeof el[eventName]==="function";}
el=null;return isSupported;};jQuery.support.submitBubbles=eventSupported("submit");jQuery.support.changeBubbles=eventSupported("change");root=script=div=all=a=null;})();jQuery.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var expando="jQuery"+now(),uuid=0,windowData={};var emptyObject={};jQuery.extend({cache:{},expando:expando,noData:{"embed":true,"object":true,"applet":true},data:function(elem,name,data){if(elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()]){return;}
elem=elem==window?windowData:elem;var id=elem[expando],cache=jQuery.cache,thisCache;if(!name&&!id){return null;}
if(!id){id=++uuid;}
if(typeof name==="object"){elem[expando]=id;thisCache=cache[id]=jQuery.extend(true,{},name);}else if(cache[id]){thisCache=cache[id];}else if(typeof data==="undefined"){thisCache=emptyObject;}else{thisCache=cache[id]={};}
if(data!==undefined){elem[expando]=id;thisCache[name]=data;}
return typeof name==="string"?thisCache[name]:thisCache;},removeData:function(elem,name){if(elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()]){return;}
elem=elem==window?windowData:elem;var id=elem[expando],cache=jQuery.cache,thisCache=cache[id];if(name){if(thisCache){delete thisCache[name];if(jQuery.isEmptyObject(thisCache)){jQuery.removeData(elem);}}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute){elem.removeAttribute(expando);}}
delete cache[id];}}});jQuery.fn.extend({data:function(key,value){if(typeof key==="undefined"&&this.length){return jQuery.data(this[0]);}else if(typeof key==="object"){return this.each(function(){jQuery.data(this,key);});}
var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length){data=jQuery.data(this[0],key);}
return data===undefined&&parts[1]?this.data(parts[0]):data;}else{return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});}});jQuery.extend({queue:function(elem,type,data){if(!elem){return;}
type=(type||"fx")+"queue";var q=jQuery.data(elem,type);if(!data){return q||[];}
if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data));}else{q.push(data);}
return q;},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),fn=queue.shift();if(fn==="inprogress"){fn=queue.shift();}
if(fn){if(type==="fx"){queue.unshift("inprogress");}
fn.call(elem,function(){jQuery.dequeue(elem,type);});}}});jQuery.fn.extend({queue:function(type,data){if(typeof type!=="string"){data=type;type="fx";}
if(data===undefined){return jQuery.queue(this[0],type);}
return this.each(function(i,elem){var queue=jQuery.queue(this,type,data);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type);}});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});},delay:function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(){var elem=this;setTimeout(function(){jQuery.dequeue(elem,type);},time);});},clearQueue:function(type){return this.queue(type||"fx",[]);}});var rclass=/[\n\t]/g,rspace=/\s+/,rreturn=/\r/g,rspecialurl=/href|src|style/,rtype=/(button|input)/i,rfocusable=/(button|input|object|select|textarea)/i,rclickable=/^(a|area)$/i,rradiocheck=/radio|checkbox/;jQuery.fn.extend({attr:function(name,value){return access(this,name,value,true,jQuery.attr);},removeAttr:function(name,fn){return this.each(function(){jQuery.attr(this,name,"");if(this.nodeType===1){this.removeAttribute(name);}});},addClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.addClass(value.call(this,i,self.attr("class")));});}
if(value&&typeof value==="string"){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1){if(!elem.className){elem.className=value;}else{var className=" "+elem.className+" ";for(var c=0,cl=classNames.length;c<cl;c++){if(className.indexOf(" "+classNames[c]+" ")<0){elem.className+=" "+classNames[c];}}}}}}
return this;},removeClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.removeClass(value.call(this,i,self.attr("class")));});}
if((value&&typeof value==="string")||value===undefined){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1&&elem.className){if(value){var className=(" "+elem.className+" ").replace(rclass," ");for(var c=0,cl=classNames.length;c<cl;c++){className=className.replace(" "+classNames[c]+" "," ");}
elem.className=className.substring(1,className.length-1);}else{elem.className="";}}}}
return this;},toggleClass:function(value,stateVal){var type=typeof value,isBool=typeof stateVal==="boolean";if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.toggleClass(value.call(this,i,self.attr("class"),stateVal),stateVal);});}
return this.each(function(){if(type==="string"){var className,i=0,self=jQuery(this),state=stateVal,classNames=value.split(rspace);while((className=classNames[i++])){state=isBool?state:!self.hasClass(className);self[state?"addClass":"removeClass"](className);}}else if(type==="undefined"||type==="boolean"){if(this.className){jQuery.data(this,"__className__",this.className);}
this.className=this.className||value===false?"":jQuery.data(this,"__className__")||"";}});},hasClass:function(selector){var className=" "+selector+" ";for(var i=0,l=this.length;i<l;i++){if((" "+this[i].className+" ").replace(rclass," ").indexOf(className)>-1){return true;}}
return false;},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,"option")){return(elem.attributes.value||{}).specified?elem.value:elem.text;}
if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type==="select-one";if(index<0){return null;}
for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery(option).val();if(one){return value;}
values.push(value);}}
return values;}
if(rradiocheck.test(elem.type)&&!jQuery.support.checkOn){return elem.getAttribute("value")===null?"on":elem.value;}
return(elem.value||"").replace(rreturn,"");}
return undefined;}
var isFunction=jQuery.isFunction(value);return this.each(function(i){var self=jQuery(this),val=value;if(this.nodeType!==1){return;}
if(isFunction){val=value.call(this,i,self.val());}
if(typeof val==="number"){val+="";}
if(jQuery.isArray(val)&&rradiocheck.test(this.type)){this.checked=jQuery.inArray(self.val(),val)>=0;}else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(val);jQuery("option",this).each(function(){this.selected=jQuery.inArray(jQuery(this).val(),values)>=0;});if(!values.length){this.selectedIndex=-1;}}else{this.value=val;}});}});jQuery.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(elem,name,value,pass){if(!elem||elem.nodeType===3||elem.nodeType===8){return undefined;}
if(pass&&name in jQuery.attrFn){return jQuery(elem)[name](value);}
var notxml=elem.nodeType!==1||!jQuery.isXMLDoc(elem),set=value!==undefined;name=notxml&&jQuery.props[name]||name;if(elem.nodeType===1){var special=rspecialurl.test(name);if(name==="selected"&&!jQuery.support.optSelected){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex;}}}
if(name in elem&&notxml&&!special){if(set){if(name==="type"&&rtype.test(elem.nodeName)&&elem.parentNode){throw"type property can't be changed";}
elem[name]=value;}
if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name)){return elem.getAttributeNode(name).nodeValue;}
if(name==="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?attributeNode.value:rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:undefined;}
return elem[name];}
if(!jQuery.support.style&&notxml&&name==="style"){if(set){elem.style.cssText=""+value;}
return elem.style.cssText;}
if(set){elem.setAttribute(name,""+value);}
var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}
return jQuery.style(elem,name,value);}});var fcleanup=function(nm){return nm.replace(/[^\w\s\.\|`]/g,function(ch){return"\\"+ch;});};jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType===3||elem.nodeType===8){return;}
if(elem.setInterval&&(elem!==window&&!elem.frameElement)){elem=window;}
if(!handler.guid){handler.guid=jQuery.guid++;}
if(data!==undefined){var fn=handler;handler=jQuery.proxy(fn);handler.data=data;}
var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle"),eventHandle;if(!handle){eventHandle=function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(eventHandle.elem,arguments):undefined;};handle=jQuery.data(elem,"handle",eventHandle);}
if(!handle){return;}
handle.elem=elem;types=types.split(/\s+/);var type,i=0;while((type=types[i++])){var namespaces=type.split(".");type=namespaces.shift();handler.type=namespaces.slice(0).sort().join(".");var handlers=events[type],special=this.special[type]||{};if(!handlers){handlers=events[type]={};if(!special.setup||special.setup.call(elem,data,namespaces,handler)===false){if(elem.addEventListener){elem.addEventListener(type,handle,false);}else if(elem.attachEvent){elem.attachEvent("on"+type,handle);}}}
if(special.add){var modifiedHandler=special.add.call(elem,handler,data,namespaces,handlers);if(modifiedHandler&&jQuery.isFunction(modifiedHandler)){modifiedHandler.guid=modifiedHandler.guid||handler.guid;handler=modifiedHandler;}}
handlers[handler.guid]=handler;this.global[type]=true;}
elem=null;},global:{},remove:function(elem,types,handler){if(elem.nodeType===3||elem.nodeType===8){return;}
var events=jQuery.data(elem,"events"),ret,type,fn;if(events){if(types===undefined||(typeof types==="string"&&types.charAt(0)===".")){for(type in events){this.remove(elem,type+(types||""));}}else{if(types.type){handler=types.handler;types=types.type;}
types=types.split(/\s+/);var i=0;while((type=types[i++])){var namespaces=type.split(".");type=namespaces.shift();var all=!namespaces.length,cleaned=jQuery.map(namespaces.slice(0).sort(),fcleanup),namespace=new RegExp("(^|\\.)"+cleaned.join("\\.(?:.*\\.)?")+"(\\.|$)"),special=this.special[type]||{};if(events[type]){if(handler){fn=events[type][handler.guid];delete events[type][handler.guid];}else{for(var handle in events[type]){if(all||namespace.test(events[type][handle].type)){delete events[type][handle];}}}
if(special.remove){special.remove.call(elem,namespaces,fn);}
for(ret in events[type]){break;}
if(!ret){if(!special.teardown||special.teardown.call(elem,namespaces)===false){if(elem.removeEventListener){elem.removeEventListener(type,jQuery.data(elem,"handle"),false);}else if(elem.detachEvent){elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}}
ret=null;delete events[type];}}}}
for(ret in events){break;}
if(!ret){var handle=jQuery.data(elem,"handle");if(handle){handle.elem=null;}
jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(event,data,elem){var type=event.type||event,bubbling=arguments[3];if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);event.exclusive=true;}
if(!elem){event.stopPropagation();if(this.global[type]){jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type]){jQuery.event.trigger(event,data,this.handle.elem);}});}}
if(!elem||elem.nodeType===3||elem.nodeType===8){return undefined;}
event.result=undefined;event.target=elem;data=jQuery.makeArray(data);data.unshift(event);}
event.currentTarget=elem;var handle=jQuery.data(elem,"handle");if(handle){handle.apply(elem,data);}
var nativeFn,nativeHandler;try{if(!(elem&&elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()])){nativeFn=elem[type];nativeHandler=elem["on"+type];}}catch(e){}
var isClick=jQuery.nodeName(elem,"a")&&type==="click";if(!bubbling&&nativeFn&&!event.isDefaultPrevented()&&!isClick){this.triggered=true;try{elem[type]();}catch(e){}}else if(nativeHandler&&elem["on"+type].apply(elem,data)===false){event.result=false;}
this.triggered=false;if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;if(parent){jQuery.event.trigger(event,data,parent,true);}}},handle:function(event){var all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);event.currentTarget=this;var namespaces=event.type.split(".");event.type=namespaces.shift();all=!namespaces.length&&!event.exclusive;var namespace=new RegExp("(^|\\.)"+namespaces.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||namespace.test(handler.type)){event.handler=handler;event.data=handler.data;var ret=handler.apply(this,arguments);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}
if(event.isImmediatePropagationStopped()){break;}}}
return event.result;},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando]){return event;}
var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop];}
if(!event.target){event.target=event.srcElement||document;}
if(event.target.nodeType===3){event.target=event.target.parentNode;}
if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement;}
if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);}
if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode)){event.which=event.charCode||event.keyCode;}
if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey;}
if(!event.which&&event.button!==undefined){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));}
return event;},guid:1E8,proxy:jQuery.proxy,special:{ready:{setup:jQuery.bindReady,teardown:jQuery.noop},live:{add:function(proxy,data,namespaces,live){jQuery.extend(proxy,data||{});proxy.guid+=data.selector+data.live;jQuery.event.add(this,data.live,liveHandler,data);},remove:function(namespaces){if(namespaces.length){var remove=0,name=new RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type)){remove++;}});if(remove<1){jQuery.event.remove(this,namespaces[0],liveHandler);}}},special:{}},beforeunload:{setup:function(data,namespaces,fn){if(this.setInterval){this.onbeforeunload=fn;}
return false;},teardown:function(namespaces,fn){if(this.onbeforeunload===fn){this.onbeforeunload=null;}}}}};jQuery.Event=function(src){if(!this.preventDefault){return new jQuery.Event(src);}
if(src&&src.type){this.originalEvent=src;this.type=src.type;}else{this.type=src;}
this.timeStamp=now();this[expando]=true;};function returnFalse(){return false;}
function returnTrue(){return true;}
jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.preventDefault){e.preventDefault();}
e.returnValue=false;},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.stopPropagation){e.stopPropagation();}
e.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation();},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;while(parent&&parent!==this){try{parent=parent.parentNode;}catch(e){break;}}
if(parent!==this){event.type=event.data;jQuery.event.handle.apply(this,arguments);}},delegate=function(event){event.type=event.data;jQuery.event.handle.apply(this,arguments);};jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(orig,fix){jQuery.event.special[orig]={setup:function(data){jQuery.event.add(this,fix,data&&data.selector?delegate:withinElement,orig);},teardown:function(data){jQuery.event.remove(this,fix,data&&data.selector?delegate:withinElement);}};});if(!jQuery.support.submitBubbles){jQuery.event.special.submit={setup:function(data,namespaces,fn){if(this.nodeName.toLowerCase()!=="form"){jQuery.event.add(this,"click.specialSubmit."+fn.guid,function(e){var elem=e.target,type=elem.type;if((type==="submit"||type==="image")&&jQuery(elem).closest("form").length){return trigger("submit",this,arguments);}});jQuery.event.add(this,"keypress.specialSubmit."+fn.guid,function(e){var elem=e.target,type=elem.type;if((type==="text"||type==="password")&&jQuery(elem).closest("form").length&&e.keyCode===13){return trigger("submit",this,arguments);}});}else{return false;}},remove:function(namespaces,fn){jQuery.event.remove(this,"click.specialSubmit"+(fn?"."+fn.guid:""));jQuery.event.remove(this,"keypress.specialSubmit"+(fn?"."+fn.guid:""));}};}
if(!jQuery.support.changeBubbles){var formElems=/textarea|input|select/i;function getVal(elem){var type=elem.type,val=elem.value;if(type==="radio"||type==="checkbox"){val=elem.checked;}else if(type==="select-multiple"){val=elem.selectedIndex>-1?jQuery.map(elem.options,function(elem){return elem.selected;}).join("-"):"";}else if(elem.nodeName.toLowerCase()==="select"){val=elem.selectedIndex;}
return val;}
function testChange(e){var elem=e.target,data,val;if(!formElems.test(elem.nodeName)||elem.readOnly){return;}
data=jQuery.data(elem,"_change_data");val=getVal(elem);if(val===data){return;}
if(e.type!=="focusout"||elem.type!=="radio"){jQuery.data(elem,"_change_data",val);}
if(elem.type!=="select"&&(data!=null||val)){e.type="change";return jQuery.event.trigger(e,arguments[1],this);}}
jQuery.event.special.change={filters:{focusout:testChange,click:function(e){var elem=e.target,type=elem.type;if(type==="radio"||type==="checkbox"||elem.nodeName.toLowerCase()==="select"){return testChange.call(this,e);}},keydown:function(e){var elem=e.target,type=elem.type;if((e.keyCode===13&&elem.nodeName.toLowerCase()!=="textarea")||(e.keyCode===32&&(type==="checkbox"||type==="radio"))||type==="select-multiple"){return testChange.call(this,e);}},beforeactivate:function(e){var elem=e.target;if(elem.nodeName.toLowerCase()==="input"&&elem.type==="radio"){jQuery.data(elem,"_change_data",getVal(elem));}}},setup:function(data,namespaces,fn){for(var type in changeFilters){jQuery.event.add(this,type+".specialChange."+fn.guid,changeFilters[type]);}
return formElems.test(this.nodeName);},remove:function(namespaces,fn){for(var type in changeFilters){jQuery.event.remove(this,type+".specialChange"+(fn?"."+fn.guid:""),changeFilters[type]);}
return formElems.test(this.nodeName);}};var changeFilters=jQuery.event.special.change.filters;}
function trigger(type,elem,args){args[0].type=type;return jQuery.event.handle.apply(elem,args);}
if(document.addEventListener){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){jQuery.event.special[fix]={setup:function(){this.addEventListener(orig,handler,true);},teardown:function(){this.removeEventListener(orig,handler,true);}};function handler(e){e=jQuery.event.fix(e);e.type=fix;return jQuery.event.handle.call(this,e);}});}
jQuery.each(["bind","one"],function(i,name){jQuery.fn[name]=function(type,data,fn){if(typeof type==="object"){for(var key in type){this[name](key,data,type[key],fn);}
return this;}
if(jQuery.isFunction(data)){thisObject=fn;fn=data;data=undefined;}
var handler=name==="one"?jQuery.proxy(fn,function(event){jQuery(this).unbind(event,handler);return fn.apply(this,arguments);}):fn;return type==="unload"&&name!=="one"?this.one(type,data,fn,thisObject):this.each(function(){jQuery.event.add(this,type,handler,data);});};});jQuery.fn.extend({unbind:function(type,fn){if(typeof type==="object"&&!type.preventDefault){for(var key in type){this.unbind(key,type[key]);}
return this;}
return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);event.preventDefault();event.stopPropagation();jQuery.event.trigger(event,data,this[0]);return event.result;}},toggle:function(fn){var args=arguments,i=1;while(i<args.length){jQuery.proxy(fn,args[i++]);}
return this.click(jQuery.proxy(fn,function(event){var lastToggle=(jQuery.data(this,"lastToggle"+fn.guid)||0)%i;jQuery.data(this,"lastToggle"+fn.guid,lastToggle+1);event.preventDefault();return args[lastToggle].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver);},live:function(type,data,fn){if(jQuery.isFunction(data)){fn=data;data=undefined;}
jQuery(this.context).bind(liveConvert(type,this.selector),{data:data,selector:this.selector,live:type},fn);return this;},die:function(type,fn){jQuery(this.context).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);return this;}});function liveHandler(event){var stop=true,elems=[],selectors=[],args=arguments,related,match,fn,elem,j,i,data,live=jQuery.extend({},jQuery.data(this,"events").live);for(j in live){fn=live[j];if(fn.live===event.type||fn.altLive&&jQuery.inArray(event.type,fn.altLive)>-1){data=fn.data;if(!(data.beforeFilter&&data.beforeFilter[event.type]&&!data.beforeFilter[event.type](event))){selectors.push(fn.selector);}}else{delete live[j];}}
match=jQuery(event.target).closest(selectors,event.currentTarget);for(i=0,l=match.length;i<l;i++){for(j in live){fn=live[j];elem=match[i].elem;related=null;if(match[i].selector===fn.selector){if(fn.live==="mouseenter"||fn.live==="mouseleave"){related=jQuery(event.relatedTarget).closest(fn.selector)[0];}
if(!related||related!==elem){elems.push({elem:elem,fn:fn});}}}}
for(i=0,l=elems.length;i<l;i++){match=elems[i];event.currentTarget=match.elem;event.data=match.fn.data;if(match.fn.apply(match.elem,args)===false){stop=false;break;}}
return stop;}
function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"&")].join(".");}
jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup error").split(" "),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};if(jQuery.attrFn){jQuery.attrFn[name]=true;}});if(window.attachEvent&&!window.addEventListener){window.attachEvent("onunload",function(){for(var id in jQuery.cache){if(jQuery.cache[id].handle){try{jQuery.event.remove(jQuery.cache[id].handle.elem);}catch(e){}}}});}
(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true;[0,0].sort(function(){baseHasDuplicate=false;return 0;});var Sizzle=function(selector,context,results,seed){results=results||[];var origContext=context=context||document;if(context.nodeType!==1&&context.nodeType!==9){return[];}
if(!selector||typeof selector!=="string"){return results;}
var parts=[],m,set,checkSet,extra,prune=true,contextXML=isXML(context),soFar=selector;while((chunker.exec(""),m=chunker.exec(soFar))!==null){soFar=m[3];parts.push(m[1]);if(m[2]){extra=m[3];break;}}
if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context);}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]){selector+=parts.shift();}
set=posProcess(selector,set);}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){var ret=Sizzle.find(parts.shift(),context,contextXML);context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0];}
if(context){var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;if(parts.length>0){checkSet=makeArray(set);}else{prune=false;}
while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur="";}else{pop=parts.pop();}
if(pop==null){pop=context;}
Expr.relative[cur](checkSet,pop,contextXML);}}else{checkSet=parts=[];}}
if(!checkSet){checkSet=set;}
if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector);}
if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet);}else if(context&&context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i]);}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i]);}}}}else{makeArray(checkSet,results);}
if(extra){Sizzle(extra,origContext,results,seed);Sizzle.uniqueSort(results);}
return results;};Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1);}}}}
return results;};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set);};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[];}
for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.leftMatch[type].exec(expr))){var left=match[1];match.splice(1,1);if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break;}}}}
if(!set){set=context.getElementsByTagName("*");}
return{set:set,expr:expr};};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.leftMatch[type].exec(expr))!=null&&match[2]){var filter=Expr.filter[type],found,item,left=match[1];anyFound=false;match.splice(1,1);if(left.substr(left.length-1)==="\\"){continue;}
if(curLoop===result){result=[];}
if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true;}else if(match===true){continue;}}
if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true;}else{curLoop[i]=false;}}else if(pass){result.push(item);anyFound=true;}}}}
if(found!==undefined){if(!inplace){curLoop=result;}
expr=expr.replace(Expr.match[type],"");if(!anyFound){return[];}
break;}}}
if(expr===old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr;}else{break;}}
old=expr;}
return curLoop;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href");}},relative:{"+":function(checkSet,part){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag){part=part.toLowerCase();}
for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}
checkSet[i]=isPartStrNotTag||elem&&elem.nodeName.toLowerCase()===part?elem||false:elem===part;}}
if(isPartStrNotTag){Sizzle.filter(part,checkSet,true);}},">":function(checkSet,part){var isPartStr=typeof part==="string";if(isPartStr&&!/\W/.test(part)){part=part.toLowerCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName.toLowerCase()===part?parent:false;}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part;}}
if(isPartStr){Sizzle.filter(part,checkSet,true);}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!/\W/.test(part)){var nodeCheck=part=part.toLowerCase();checkFn=dirNodeCheck;}
checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML);},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!/\W/.test(part)){var nodeCheck=part=part.toLowerCase();checkFn=dirNodeCheck;}
checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML);}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[];}},NAME:function(match,context){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i]);}}
return ret.length===0?null:ret;}},TAG:function(match,context){return context.getElementsByTagName(match[1]);}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";if(isXML){return match;}
for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").replace(/[\t\n]/g," ").indexOf(match)>=0)){if(!inplace){result.push(elem);}}else if(inplace){curLoop[i]=false;}}}
return false;},ID:function(match){return match[1].replace(/\\/g,"");},TAG:function(match,curLoop){return match[1].toLowerCase();},CHILD:function(match){if(match[1]==="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]==="even"&&"2n"||match[2]==="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0;}
match[0]=done++;return match;},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name];}
if(match[2]==="~="){match[4]=" "+match[4]+" ";}
return match;},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop);}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret);}
return false;}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true;}
return match;},POS:function(match){match.unshift(true);return match;}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden";},disabled:function(elem){return elem.disabled===true;},checked:function(elem){return elem.checked===true;},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true;},parent:function(elem){return!!elem.firstChild;},empty:function(elem){return!elem.firstChild;},has:function(elem,i,match){return!!Sizzle(match[3],elem).length;},header:function(elem){return/h\d/i.test(elem.nodeName);},text:function(elem){return"text"===elem.type;},radio:function(elem){return"radio"===elem.type;},checkbox:function(elem){return"checkbox"===elem.type;},file:function(elem){return"file"===elem.type;},password:function(elem){return"password"===elem.type;},submit:function(elem){return"submit"===elem.type;},image:function(elem){return"image"===elem.type;},reset:function(elem){return"reset"===elem.type;},button:function(elem){return"button"===elem.type||elem.nodeName.toLowerCase()==="button";},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName);}},setFilters:{first:function(elem,i){return i===0;},last:function(elem,i,match,array){return i===array.length-1;},even:function(elem,i){return i%2===0;},odd:function(elem,i){return i%2===1;},lt:function(elem,i,match){return i<match[3]-0;},gt:function(elem,i,match){return i>match[3]-0;},nth:function(elem,i,match){return match[3]-0===i;},eq:function(elem,i,match){return match[3]-0===i;}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array);}else if(name==="contains"){return(elem.textContent||elem.innerText||getText([elem])||"").indexOf(match[3])>=0;}else if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false;}}
return true;}else{throw"Syntax error, unrecognized expression: "+name;}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case'only':case'first':while((node=node.previousSibling)){if(node.nodeType===1){return false;}}
if(type==="first"){return true;}
node=elem;case'last':while((node=node.nextSibling)){if(node.nodeType===1){return false;}}
return true;case'nth':var first=match[2],last=match[3];if(first===1&&last===0){return true;}
var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count;}}
parent.sizcache=doneName;}
var diff=elem.nodeIndex-last;if(first===0){return diff===0;}else{return(diff%first===0&&diff/first>=0);}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match;},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName.toLowerCase()===match;},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1;},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!==check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false;},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array);}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source.replace(/\\(\d+)/g,function(all,num){return"\\"+(num-0+1);}));}
var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);if(results){results.push.apply(results,array);return results;}
return array;};try{Array.prototype.slice.call(document.documentElement.childNodes,0);}catch(e){makeArray=function(array,results){var ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array);}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i]);}}else{for(var i=0;array[i];i++){ret.push(array[i]);}}}
return ret;};}
var sortOrder;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){if(!a.compareDocumentPosition||!b.compareDocumentPosition){if(a==b){hasDuplicate=true;}
return a.compareDocumentPosition?-1:1;}
var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;if(ret===0){hasDuplicate=true;}
return ret;};}else if("sourceIndex"in document.documentElement){sortOrder=function(a,b){if(!a.sourceIndex||!b.sourceIndex){if(a==b){hasDuplicate=true;}
return a.sourceIndex?-1:1;}
var ret=a.sourceIndex-b.sourceIndex;if(ret===0){hasDuplicate=true;}
return ret;};}else if(document.createRange){sortOrder=function(a,b){if(!a.ownerDocument||!b.ownerDocument){if(a==b){hasDuplicate=true;}
return a.ownerDocument?-1:1;}
var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();aRange.setStart(a,0);aRange.setEnd(a,0);bRange.setStart(b,0);bRange.setEnd(b,0);var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);if(ret===0){hasDuplicate=true;}
return ret;};}
function getText(elems){var ret="",elem;for(var i=0;elems[i];i++){elem=elems[i];if(elem.nodeType===3||elem.nodeType===4){ret+=elem.nodeValue;}else if(elem.nodeType!==8){ret+=getText(elem.childNodes);}}
return ret;}
(function(){var form=document.createElement("div"),id="script"+(new Date).getTime();form.innerHTML="<a name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[];}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match;};}
root.removeChild(form);root=form=null;})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i]);}}
results=tmp;}
return results;};}
div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2);};}
div=null;})();if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return;}
Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra);}catch(e){}}
return oldSizzle(query,context,extra,seed);};for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop];}
div=null;})();}
(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(!div.getElementsByClassName||div.getElementsByClassName("e").length===0){return;}
div.lastChild.className="e";if(div.getElementsByClassName("e").length===1){return;}
Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1]);}};div=null;})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(elem.nodeName.toLowerCase()===cur){match=elem;break;}
elem=elem[dir];}
checkSet[i]=match;}}}
function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(typeof cur!=="string"){if(elem===cur){match=true;break;}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break;}}
elem=elem[dir];}
checkSet[i]=match;}}}
var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16;}:function(a,b){return a!==b&&(a.contains?a.contains(b):true);};var isXML=function(elem){var documentElement=(elem?elem.ownerDocument||elem:0).documentElement;return documentElement?documentElement.nodeName!=="HTML":false;};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"");}
selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet);}
return Sizzle.filter(later,tmpSet);};jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;jQuery.unique=Sizzle.uniqueSort;jQuery.getText=getText;jQuery.isXMLDoc=isXML;jQuery.contains=contains;return;window.Sizzle=Sizzle;})();var runtil=/Until$/,rparentsprev=/^(?:parents|prevUntil|prevAll)/,rmultiselector=/,/,slice=Array.prototype.slice;var winnow=function(elements,qualifier,keep){if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){return!!qualifier.call(elem,i,elem)===keep;});}else if(qualifier.nodeType){return jQuery.grep(elements,function(elem,i){return(elem===qualifier)===keep;});}else if(typeof qualifier==="string"){var filtered=jQuery.grep(elements,function(elem){return elem.nodeType===1;});if(isSimple.test(qualifier)){return jQuery.filter(qualifier,filtered,!keep);}else{qualifier=jQuery.filter(qualifier,elements);}}
return jQuery.grep(elements,function(elem,i){return(jQuery.inArray(elem,qualifier)>=0)===keep;});};jQuery.fn.extend({find:function(selector){var ret=this.pushStack("","find",selector),length=0;for(var i=0,l=this.length;i<l;i++){length=ret.length;jQuery.find(selector,this[i],ret);if(i>0){for(var n=length;n<ret.length;n++){for(var r=0;r<length;r++){if(ret[r]===ret[n]){ret.splice(n--,1);break;}}}}}
return ret;},has:function(target){var targets=jQuery(target);return this.filter(function(){for(var i=0,l=targets.length;i<l;i++){if(jQuery.contains(this,targets[i])){return true;}}});},not:function(selector){return this.pushStack(winnow(this,selector,false),"not",selector);},filter:function(selector){return this.pushStack(winnow(this,selector,true),"filter",selector);},is:function(selector){return!!selector&&jQuery.filter(selector,this).length>0;},closest:function(selectors,context){if(jQuery.isArray(selectors)){var ret=[],cur=this[0],match,matches={},selector;if(cur&&selectors.length){for(var i=0,l=selectors.length;i<l;i++){selector=selectors[i];if(!matches[selector]){matches[selector]=jQuery.expr.match.POS.test(selector)?jQuery(selector,context||this.context):selector;}}
while(cur&&cur.ownerDocument&&cur!==context){for(selector in matches){match=matches[selector];if(match.jquery?match.index(cur)>-1:jQuery(cur).is(match)){ret.push({selector:selector,elem:cur});delete matches[selector];}}
cur=cur.parentNode;}}
return ret;}
var pos=jQuery.expr.match.POS.test(selectors)?jQuery(selectors,context||this.context):null;return this.map(function(i,cur){while(cur&&cur.ownerDocument&&cur!==context){if(pos?pos.index(cur)>-1:jQuery(cur).is(selectors)){return cur;}
cur=cur.parentNode;}
return null;});},index:function(elem){if(!elem||typeof elem==="string"){return jQuery.inArray(this[0],elem?jQuery(elem):this.parent().children());}
return jQuery.inArray(elem.jquery?elem[0]:elem,this);},add:function(selector,context){var set=typeof selector==="string"?jQuery(selector,context||this.context):jQuery.makeArray(selector),all=jQuery.merge(this.get(),set);return this.pushStack(isDisconnected(set[0])||isDisconnected(all[0])?all:jQuery.unique(all));},andSelf:function(){return this.add(this.prevObject);}});function isDisconnected(node){return!node||!node.parentNode||node.parentNode.nodeType===11;}
jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null;},parents:function(elem){return jQuery.dir(elem,"parentNode");},parentsUntil:function(elem,i,until){return jQuery.dir(elem,"parentNode",until);},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},nextUntil:function(elem,i,until){return jQuery.dir(elem,"nextSibling",until);},prevUntil:function(elem,i,until){return jQuery.dir(elem,"previousSibling",until);},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until);if(!runtil.test(name)){selector=until;}
if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret);}
ret=this.length>1?jQuery.unique(ret):ret;if((this.length>1||rmultiselector.test(selector))&&rparentsprev.test(name)){ret=ret.reverse();}
return this.pushStack(ret,name,slice.call(arguments).join(","));};});jQuery.extend({filter:function(expr,elems,not){if(not){expr=":not("+expr+")";}
return jQuery.find.matches(expr,elems);},dir:function(elem,dir,until){var matched=[],cur=elem[dir];while(cur&&cur.nodeType!==9&&(until===undefined||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur);}
cur=cur[dir];}
return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType===1&&++num===result){break;}}
return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n);}}
return r;}});var rinlinejQuery=/ jQuery\d+="(?:\d+|null)"/g,rleadingWhitespace=/^\s+/,rxhtmlTag=/(<([\w:]+)[^>]*?)\/>/g,rselfClosing=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,rtagName=/<([\w:]+)/,rtbody=/<tbody/i,rhtml=/<|&\w+;/,fcloseTag=function(all,front,tag){return rselfClosing.test(tag)?all:front+"></"+tag+">";},wrapMap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;if(!jQuery.support.htmlSerialize){wrapMap._default=[1,"div<div>","</div>"];}
jQuery.fn.extend({text:function(text){if(jQuery.isFunction(text)){return this.each(function(i){var self=jQuery(this);return self.text(text.call(this,i,self.text()));});}
if(typeof text!=="object"&&text!==undefined){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));}
return jQuery.getText(this);},wrapAll:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i));});}
if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0]);}
wrap.map(function(){var elem=this;while(elem.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild;}
return elem;}).append(this);}
return this;},wrapInner:function(html){return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html);}else{self.append(html);}});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes);}}).end();},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.appendChild(elem);}});},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.insertBefore(elem,this.firstChild);}});},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this);});}else if(arguments.length){var set=jQuery(arguments[0]);set.push.apply(set,this.toArray());return this.pushStack(set,"before",arguments);}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});}else if(arguments.length){var set=this.pushStack(this,"after",arguments);set.push.apply(set,jQuery(arguments[0]).toArray());return set;}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML,ownerDocument=this.ownerDocument;if(!html){var div=ownerDocument.createElement("div");div.appendChild(this.cloneNode(true));html=div.innerHTML;}
return jQuery.clean([html.replace(rinlinejQuery,"").replace(rleadingWhitespace,"")],ownerDocument)[0];}else{return this.cloneNode(true);}});if(events===true){cloneCopyEvent(this,ret);cloneCopyEvent(this.find("*"),ret.find("*"));}
return ret;},html:function(value){if(value===undefined){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(rinlinejQuery,""):null;}else if(typeof value==="string"&&!/<script/i.test(value)&&(jQuery.support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){try{for(var i=0,l=this.length;i<l;i++){if(this[i].nodeType===1){cleanData(this[i].getElementsByTagName("*"));this[i].innerHTML=value;}}}catch(e){this.empty().append(value);}}else if(jQuery.isFunction(value)){this.each(function(i){var self=jQuery(this),old=self.html();self.empty().append(function(){return value.call(this,i,old);});});}else{this.empty().append(value);}
return this;},replaceWith:function(value){if(this[0]&&this[0].parentNode){if(!jQuery.isFunction(value)){value=jQuery(value).detach();}
return this.each(function(){var next=this.nextSibling,parent=this.parentNode;jQuery(this).remove();if(next){jQuery(next).before(value);}else{jQuery(parent).append(value);}});}else{return this.pushStack(jQuery(jQuery.isFunction(value)?value():value),"replaceWith",value);}},detach:function(selector){return this.remove(selector,true);},domManip:function(args,table,callback){var results,first,value=args[0],scripts=[];if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);args[0]=value.call(this,i,table?self.html():undefined);return self.domManip(args,table,callback);});}
if(this[0]){if(args[0]&&args[0].parentNode&&args[0].parentNode.nodeType===11){results={fragment:args[0].parentNode};}else{results=buildFragment(args,this,scripts);}
first=results.fragment.firstChild;if(first){table=table&&jQuery.nodeName(first,"tr");for(var i=0,l=this.length;i<l;i++){callback.call(table?root(this[i],first):this[i],results.cacheable||this.length>1||i>0?results.fragment.cloneNode(true):results.fragment);}}
if(scripts){jQuery.each(scripts,evalScript);}}
return this;function root(elem,cur){return jQuery.nodeName(elem,"table")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem;}}});function cloneCopyEvent(orig,ret){var i=0;ret.each(function(){if(this.nodeName!==(orig[i]&&orig[i].nodeName)){return;}
var oldData=jQuery.data(orig[i++]),curData=jQuery.data(this,oldData),events=oldData&&oldData.events;if(events){delete curData.handle;curData.events={};for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data);}}}});}
function buildFragment(args,nodes,scripts){var fragment,cacheable,cached,cacheresults,doc;if(args.length===1&&typeof args[0]==="string"&&args[0].length<512&&args[0].indexOf("<option")<0){cacheable=true;cacheresults=jQuery.fragments[args[0]];if(cacheresults){if(cacheresults!==1){fragment=cacheresults;}
cached=true;}}
if(!fragment){doc=(nodes&&nodes[0]?nodes[0].ownerDocument||nodes[0]:document);fragment=doc.createDocumentFragment();jQuery.clean(args,doc,fragment,scripts);}
if(cacheable){jQuery.fragments[args[0]]=cacheresults?fragment:1;}
return{fragment:fragment,cacheable:cacheable};}
jQuery.fragments={};jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector);for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery.fn[original].apply(jQuery(insert[i]),elems);ret=ret.concat(elems);}
return this.pushStack(ret,name,insert.selector);};});jQuery.each({remove:function(selector,keepData){if(!selector||jQuery.filter(selector,[this]).length){if(!keepData&&this.nodeType===1){cleanData(this.getElementsByTagName("*"));cleanData([this]);}
if(this.parentNode){this.parentNode.removeChild(this);}}},empty:function(){if(this.nodeType===1){cleanData(this.getElementsByTagName("*"));}
while(this.firstChild){this.removeChild(this.firstChild);}}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.extend({clean:function(elems,context,fragment,scripts){context=context||document;if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;}
var ret=[];jQuery.each(elems,function(i,elem){if(typeof elem==="number"){elem+="";}
if(!elem){return;}
if(typeof elem==="string"&&!rhtml.test(elem)){elem=context.createTextNode(elem);}else if(typeof elem==="string"){elem=elem.replace(rxhtmlTag,fcloseTag);var tag=(rtagName.exec(elem)||["",""])[1].toLowerCase(),wrap=wrapMap[tag]||wrapMap._default,depth=wrap[0],div=context.createElement("div");div.innerHTML=wrap[1]+elem+wrap[2];while(depth--){div=div.lastChild;}
if(!jQuery.support.tbody){var hasBody=rtbody.test(elem),tbody=tag==="table"&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]==="<table>"&&!hasBody?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j]);}}}
if(!jQuery.support.leadingWhitespace&&rleadingWhitespace.test(elem)){div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]),div.firstChild);}
elem=jQuery.makeArray(div.childNodes);}
if(elem.nodeType){ret.push(elem);}else{ret=jQuery.merge(ret,elem);}});if(fragment){for(var i=0;ret[i];i++){if(scripts&&jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i]);}else{if(ret[i].nodeType===1){ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))));}
fragment.appendChild(ret[i]);}}}
return ret;}});function cleanData(elems){for(var i=0,elem,id;(elem=elems[i])!=null;i++){if(!jQuery.noData[elem.nodeName.toLowerCase()]&&(id=elem[expando])){delete jQuery.cache[id];}}}
var rexclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,ralpha=/alpha\([^)]*\)/,ropacity=/opacity=([^)]*)/,rfloat=/float/i,rdashAlpha=/-([a-z])/ig,rupper=/([A-Z])/g,rnumpx=/^-?\d+(?:px)?$/i,rnum=/^-?\d/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssWidth=["Left","Right"],cssHeight=["Top","Bottom"],getComputedStyle=document.defaultView&&document.defaultView.getComputedStyle,styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat",fcamelCase=function(all,letter){return letter.toUpperCase();};jQuery.fn.css=function(name,value){return access(this,name,value,true,function(elem,name,value){if(value===undefined){return jQuery.curCSS(elem,name);}
if(typeof value==="number"&&!rexclude.test(name)){value+="px";}
jQuery.style(elem,name,value);});};jQuery.extend({style:function(elem,name,value){if(!elem||elem.nodeType===3||elem.nodeType===8){return undefined;}
if((name==="width"||name==="height")&&parseFloat(value)<0){value=undefined;}
var style=elem.style||elem,set=value!==undefined;if(!jQuery.support.opacity&&name==="opacity"){if(set){style.zoom=1;var opacity=parseInt(value,10)+""==="NaN"?"":"alpha(opacity="+value*100+")";var filter=style.filter||jQuery.curCSS(elem,"filter")||"";style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):opacity;}
return style.filter&&style.filter.indexOf("opacity=")>=0?(parseFloat(ropacity.exec(style.filter)[1])/100)+"":"";}
if(rfloat.test(name)){name=styleFloat;}
name=name.replace(rdashAlpha,fcamelCase);if(set){style[name]=value;}
return style[name];},css:function(elem,name,force,extra){if(name==="width"||name==="height"){var val,props=cssShow,which=name==="width"?cssWidth:cssHeight;function getWH(){val=name==="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border"){return;}
jQuery.each(which,function(){if(!extra){val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;}
if(extra==="margin"){val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0;}else{val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;}});}
if(elem.offsetWidth!==0){getWH();}else{jQuery.swap(elem,props,getWH);}
return Math.max(0,Math.round(val));}
return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style,filter;if(!jQuery.support.opacity&&name==="opacity"&&elem.currentStyle){ret=ropacity.test(elem.currentStyle.filter||"")?(parseFloat(RegExp.$1)/100)+"":"";return ret===""?"1":ret;}
if(rfloat.test(name)){name=styleFloat;}
if(!force&&style&&style[name]){ret=style[name];}else if(getComputedStyle){if(rfloat.test(name)){name="float";}
name=name.replace(rupper,"-$1").toLowerCase();var defaultView=elem.ownerDocument.defaultView;if(!defaultView){return null;}
var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle){ret=computedStyle.getPropertyValue(name);}
if(name==="opacity"&&ret===""){ret="1";}}else if(elem.currentStyle){var camelCase=name.replace(rdashAlpha,fcamelCase);ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!rnumpx.test(ret)&&rnum.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=camelCase==="fontSize"?"1em":(ret||0);ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}
return ret;},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
callback.call(elem);for(var name in options){elem.style[name]=old[name];}}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.hidden=function(elem){var width=elem.offsetWidth,height=elem.offsetHeight,skip=elem.nodeName.toLowerCase()==="tr";return width===0&&height===0&&!skip?true:width>0&&height>0&&!skip?false:jQuery.curCSS(elem,"display")==="none";};jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem);};}
var jsc=now(),rscript=/<script(.|\s)*?\/script>/gi,rselectTextarea=/select|textarea/i,rinput=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,jsre=/=\?(&|$)/,rquery=/\?/,rts=/(\?|&)_=.*?(&|$)/,rurl=/^(\w+:)?\/\/([^\/?#]+)/,r20=/%20/g;jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!=="string"){return this._load(url);}else if(!this.length){return this;}
var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}
var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=null;}else if(typeof params==="object"){params=jQuery.param(params,jQuery.ajaxSettings.traditional);type="POST";}}
jQuery.ajax({url:url,type:type,dataType:"html",data:params,context:this,complete:function(res,status){if(status==="success"||status==="notmodified"){this.html(selector?jQuery("<div />").append(res.responseText.replace(rscript,"")).find(selector):res.responseText);}
if(callback){this.each(callback,[res.responseText,status,res]);}}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||rselectTextarea.test(this.nodeName)||rinput.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=null;}
return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data={};}
return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:window.XMLHttpRequest&&(window.location.protocol!=="file:"||!window.ActiveXObject)?function(){return new window.XMLHttpRequest();}:function(){try{return new window.ActiveXObject("Microsoft.XMLHTTP");}catch(e){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(origSettings){var s=jQuery.extend(true,{},jQuery.ajaxSettings,origSettings);var jsonp,status,data,callbackContext=s.context||s,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional);}
if(s.dataType==="jsonp"){if(type==="GET"){if(!jsre.test(s.url)){s.url+=(rquery.test(s.url)?"&":"?")+(s.jsonp||"callback")+"=?";}}else if(!s.data||!jsre.test(s.data)){s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";}
s.dataType="json";}
if(s.dataType==="json"&&(s.data&&jsre.test(s.data)||jsre.test(s.url))){jsonp=s.jsonpCallback||("jsonp"+jsc++);if(s.data){s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");}
s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=window[jsonp]||function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}
if(head){head.removeChild(script);}};}
if(s.dataType==="script"&&s.cache===null){s.cache=false;}
if(s.cache===false&&type==="GET"){var ts=now();var ret=s.url.replace(rts,"$1_="+ts+"$2");s.url=ret+((ret===s.url)?(rquery.test(s.url)?"&":"?")+"_="+ts:"");}
if(s.data&&type==="GET"){s.url+=(rquery.test(s.url)?"&":"?")+s.data;}
if(s.global&&!jQuery.active++){jQuery.event.trigger("ajaxStart");}
var parts=rurl.exec(s.url),remote=parts&&(parts[1]&&parts[1]!==location.protocol||parts[2]!==location.host);if(s.dataType==="script"&&type==="GET"&&remote){var head=document.getElementsByTagName("head")[0]||document.documentElement;var script=document.createElement("script");script.src=s.url;if(s.scriptCharset){script.charset=s.scriptCharset;}
if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){done=true;success();complete();script.onload=script.onreadystatechange=null;if(head&&script.parentNode){head.removeChild(script);}}};}
head.insertBefore(script,head.firstChild);return undefined;}
var requestDone=false;var xhr=s.xhr();if(!xhr){return;}
if(s.username){xhr.open(type,s.url,s.async,s.username,s.password);}else{xhr.open(type,s.url,s.async);}
try{if(s.data||origSettings&&origSettings.contentType){xhr.setRequestHeader("Content-Type",s.contentType);}
if(s.ifModified){if(jQuery.lastModified[s.url]){xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]);}
if(jQuery.etag[s.url]){xhr.setRequestHeader("If-None-Match",jQuery.etag[s.url]);}}
if(!remote){xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");}
xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}
if(s.beforeSend&&s.beforeSend.call(callbackContext,xhr,s)===false){if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop");}
xhr.abort();return false;}
if(s.global){trigger("ajaxSend",[xhr,s]);}
var onreadystatechange=xhr.onreadystatechange=function(isTimeout){if(!xhr||xhr.readyState===0){if(!requestDone){complete();}
requestDone=true;if(xhr){xhr.onreadystatechange=jQuery.noop;}}else if(!requestDone&&xhr&&(xhr.readyState===4||isTimeout==="timeout")){requestDone=true;xhr.onreadystatechange=jQuery.noop;status=isTimeout==="timeout"?"timeout":!jQuery.httpSuccess(xhr)?"error":s.ifModified&&jQuery.httpNotModified(xhr,s.url)?"notmodified":"success";if(status==="success"){try{data=jQuery.httpData(xhr,s.dataType,s);}catch(e){status="parsererror";}}
if(status==="success"||status==="notmodified"){if(!jsonp){success();}}else{jQuery.handleError(s,xhr,status);}
complete();if(isTimeout==="timeout"){xhr.abort();}
if(s.async){xhr=null;}}};try{var oldAbort=xhr.abort;xhr.abort=function(){if(xhr){oldAbort.call(xhr);if(xhr){xhr.readyState=0;}}
onreadystatechange();};}catch(e){}
if(s.async&&s.timeout>0){setTimeout(function(){if(xhr&&!requestDone){onreadystatechange("timeout");}},s.timeout);}
try{xhr.send(type==="POST"||type==="PUT"||type==="DELETE"?s.data:null);}catch(e){jQuery.handleError(s,xhr,null,e);complete();}
if(!s.async){onreadystatechange();}
function success(){if(s.success){s.success.call(callbackContext,data,status,xhr);}
if(s.global){trigger("ajaxSuccess",[xhr,s]);}}
function complete(){if(s.complete){s.complete.call(callbackContext,xhr,status);}
if(s.global){trigger("ajaxComplete",[xhr,s]);}
if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop");}}
function trigger(type,args){(s.context?jQuery(s.context):jQuery.event).trigger(type,args);}
return xhr;},handleError:function(s,xhr,status,e){if(s.error){s.error.call(s.context||window,xhr,status,e);}
if(s.global){(s.context?jQuery(s.context):jQuery.event).trigger("ajaxError",[xhr,s,e]);}},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol==="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status===304||xhr.status===1223||xhr.status===0;}catch(e){}
return false;},httpNotModified:function(xhr,url){var lastModified=xhr.getResponseHeader("Last-Modified"),etag=xhr.getResponseHeader("Etag");if(lastModified){jQuery.lastModified[url]=lastModified;}
if(etag){jQuery.etag[url]=etag;}
return xhr.status===304||xhr.status===0;},httpData:function(xhr,type,s){var ct=xhr.getResponseHeader("content-type")||"",xml=type==="xml"||!type&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.nodeName==="parsererror"){throw"parsererror";}
if(s&&s.dataFilter){data=s.dataFilter(data,type);}
if(typeof data==="string"){if(type==="json"||!type&&ct.indexOf("json")>=0){if(/^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){if(window.JSON&&window.JSON.parse){data=window.JSON.parse(data);}else{data=(new Function("return "+data))();}}else{throw"Invalid JSON: "+data;}}else if(type==="script"||!type&&ct.indexOf("javascript")>=0){jQuery.globalEval(data);}}
return data;},param:function(a,traditional){var s=[];if(traditional===undefined){traditional=jQuery.ajaxSettings.traditional;}
function add(key,value){value=jQuery.isFunction(value)?value():value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value);}
if(jQuery.isArray(a)||a.jquery){jQuery.each(a,function(){add(this.name,this.value);});}else{jQuery.each(a,function buildParams(prefix,obj){if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional){add(prefix,v);}else{buildParams(prefix+"["+(typeof v==="object"||jQuery.isArray(v)?i:"")+"]",v);}});}else if(!traditional&&obj!=null&&typeof obj==="object"){jQuery.each(obj,function(k,v){buildParams(prefix+"["+k+"]",v);});}else{add(prefix,obj);}});}
return s.join("&").replace(r20,"+");}});var elemdisplay={},rfxtypes=/toggle|show|hide/,rfxnum=/^([+-]=)?([\d+-.]+)(.*)$/,timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];jQuery.fn.extend({show:function(speed,callback){if(speed!=null){return this.animate(genFx("show",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");this[i].style.display=old||"";if(jQuery.css(this[i],"display")==="none"){var nodeName=this[i].nodeName,display;if(elemdisplay[nodeName]){display=elemdisplay[nodeName];}else{var elem=jQuery("<"+nodeName+" />").appendTo("body");display=elem.css("display");if(display==="none"){display="block";}
elem.remove();elemdisplay[nodeName]=display;}
jQuery.data(this[i],"olddisplay",display);}}
for(var j=0,k=this.length;j<k;j++){this[j].style.display=jQuery.data(this[j],"olddisplay")||"";}
return this;}},hide:function(speed,callback){if(speed!=null){return this.animate(genFx("hide",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");if(!old&&old!=="none"){jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"));}}
for(var j=0,k=this.length;j<k;j++){this[j].style.display="none";}
return this;}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";if(jQuery.isFunction(fn)&&jQuery.isFunction(fn2)){this._toggle.apply(this,arguments);}else if(fn==null||bool){this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]();});}else{this.animate(genFx("toggle",3),fn,fn2);}
return this;},fadeTo:function(speed,to,callback){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);if(jQuery.isEmptyObject(prop)){return this.each(optall.complete);}
return this[optall.queue===false?"each":"queue"](function(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType===1&&jQuery(this).is(":hidden"),self=this;for(p in prop){var name=p.replace(rdashAlpha,fcamelCase);if(p!==name){prop[name]=prop[p];delete prop[p];p=name;}
if(prop[p]==="hide"&&hidden||prop[p]==="show"&&!hidden){return opt.complete.call(this);}
if((p==="height"||p==="width")&&this.style){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}
if(jQuery.isArray(prop[p])){(opt.specialEasing=opt.specialEasing||{})[p]=prop[p][1];prop[p]=prop[p][0];}}
if(opt.overflow!=null){this.style.overflow="hidden";}
opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(rfxtypes.test(val)){e[val==="toggle"?hidden?"show":"hide":val](prop);}else{var parts=rfxnum.exec(val),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!=="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}
if(parts[1]){end=((parts[1]==="-="?-1:1)*end)+start;}
e.custom(start,end,unit);}else{e.custom(start,val,"");}}});return true;});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue){this.queue([]);}
this.each(function(){for(var i=timers.length-1;i>=0;i--){if(timers[i].elem===this){if(gotoEnd){timers[i](true);}
timers.splice(i,1);}}});if(!gotoEnd){this.dequeue();}
return this;}});jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback);};});jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false){jQuery(this).dequeue();}
if(jQuery.isFunction(opt.old)){opt.old.call(this);}};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig){options.orig={};}}});jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this);}
(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block";}},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop];}
var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;var self=this;function t(gotoEnd){return self.step(gotoEnd);}
t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(jQuery.fx.tick,13);}},show:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now(),done=true;if(gotoEnd||t>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var i in this.options.curAnim){if(this.options.curAnim[i]!==true){done=false;}}
if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;var old=jQuery.data(this.elem,"olddisplay");this.elem.style.display=old?old:this.options.display;if(jQuery.css(this.elem,"display")==="none"){this.elem.style.display="block";}}
if(this.options.hide){jQuery(this.elem).hide();}
if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.style(this.elem,p,this.options.orig[p]);}}
this.options.complete.call(this.elem);}
return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;var specialEasing=this.options.specialEasing&&this.options.specialEasing[this.prop];var defaultEasing=this.options.easing||(jQuery.easing.swing?"swing":"linear");this.pos=jQuery.easing[specialEasing||defaultEasing](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}
return true;}};jQuery.extend(jQuery.fx,{tick:function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++){if(!timers[i]()){timers.splice(i--,1);}}
if(!timers.length){jQuery.fx.stop();}},stop:function(){clearInterval(timerId);timerId=null;},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.style(fx.elem,"opacity",fx.now);},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=(fx.prop==="width"||fx.prop==="height"?Math.max(0,fx.now):fx.now)+fx.unit;}else{fx.elem[fx.prop]=fx.now;}}}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};}
function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type;});return obj;}
if("getBoundingClientRect"in document.documentElement){jQuery.fn.offset=function(options){var elem=this[0];if(!elem||!elem.ownerDocument){return null;}
if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
var box=elem.getBoundingClientRect(),doc=elem.ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.support.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.support.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;return{top:top,left:left};};}else{jQuery.fn.offset=function(options){var elem=this[0];if(!elem||!elem.ownerDocument){return null;}
if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
jQuery.offset.initialize();var offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle,top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){break;}
computedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle;top-=elem.scrollTop;left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop;left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.nodeName))){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevOffsetParent=offsetParent,offsetParent=elem.offsetParent;}
if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevComputedStyle=computedStyle;}
if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop;left+=body.offsetLeft;}
if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop);left+=Math.max(docElem.scrollLeft,body.scrollLeft);}
return{top:top,left:left};};}
jQuery.offset={initialize:function(){var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,bodyMarginTop=parseFloat(jQuery.curCSS(body,"marginTop",true))||0,html="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";jQuery.extend(container.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild;checkDiv=innerDiv.firstChild;td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);checkDiv.style.position="fixed",checkDiv.style.top="20px";this.supportsFixedPosition=(checkDiv.offsetTop===20||checkDiv.offsetTop===15);checkDiv.style.position=checkDiv.style.top="";innerDiv.style.overflow="hidden",innerDiv.style.position="relative";this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(body.offsetTop!==bodyMarginTop);body.removeChild(container);body=container=innerDiv=checkDiv=table=td=null;jQuery.offset.initialize=jQuery.noop;},bodyOffset:function(body){var top=body.offsetTop,left=body.offsetLeft;jQuery.offset.initialize();if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseFloat(jQuery.curCSS(body,"marginTop",true))||0;left+=parseFloat(jQuery.curCSS(body,"marginLeft",true))||0;}
return{top:top,left:left};},setOffset:function(elem,options,i){if(/static/.test(jQuery.curCSS(elem,"position"))){elem.style.position="relative";}
var curElem=jQuery(elem),curOffset=curElem.offset(),curTop=parseInt(jQuery.curCSS(elem,"top",true),10)||0,curLeft=parseInt(jQuery.curCSS(elem,"left",true),10)||0;if(jQuery.isFunction(options)){options=options.call(elem,i,curOffset);}
var props={top:(options.top-curOffset.top)+curTop,left:(options.left-curOffset.left)+curLeft};if("using"in options){options.using.call(elem,props);}else{curElem.css(props);}}};jQuery.fn.extend({position:function(){if(!this[0]){return null;}
var elem=this[0],offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].nodeName)?{top:0,left:0}:offsetParent.offset();offset.top-=parseFloat(jQuery.curCSS(elem,"marginTop",true))||0;offset.left-=parseFloat(jQuery.curCSS(elem,"marginLeft",true))||0;parentOffset.top+=parseFloat(jQuery.curCSS(offsetParent[0],"borderTopWidth",true))||0;parentOffset.left+=parseFloat(jQuery.curCSS(offsetParent[0],"borderLeftWidth",true))||0;return{top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent||document.body;while(offsetParent&&(!/^body|html$/i.test(offsetParent.nodeName)&&jQuery.css(offsetParent,"position")==="static")){offsetParent=offsetParent.offsetParent;}
return offsetParent;});}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;jQuery.fn[method]=function(val){var elem=this[0],win;if(!elem){return null;}
if(val!==undefined){return this.each(function(){win=getWindow(this);if(win){win.scrollTo(!i?val:jQuery(win).scrollLeft(),i?val:jQuery(win).scrollTop());}else{this[method]=val;}});}else{win=getWindow(elem);return win?("pageXOffset"in win)?win[i?"pageYOffset":"pageXOffset"]:jQuery.support.boxModel&&win.document.documentElement[method]||win.document.body[method]:elem[method];}};});function getWindow(elem){return("scrollTo"in elem&&elem.document)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false;}
jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],type,false,"padding"):null;};jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],type,false,margin?"margin":"border"):null;};jQuery.fn[type]=function(size){var elem=this[0];if(!elem){return size==null?null:this;}
return("scrollTo"in elem&&elem.document)?elem.document.compatMode==="CSS1Compat"&&elem.document.documentElement["client"+name]||elem.document.body["client"+name]:(elem.nodeType===9)?Math.max(elem.documentElement["client"+name],elem.body["scroll"+name],elem.documentElement["scroll"+name],elem.body["offset"+name],elem.documentElement["offset"+name]):size===undefined?jQuery.css(elem,type):this.css(type,typeof size==="string"?size:size+"px");};});window.jQuery=window.$=jQuery;})(window);var activeObject=null;var siteMasterPages=null;var sitePages=null;var siteFiles=null;var siteImages=null;var siteClasses=null;var siteEditorClasses=null;var siteIDs=null;var stylesheetRules=null;var styleSetFuncs=new Array();var styleClearFuncs=new Array();var currentSelectedClass="";var styleTreeState=null;var imageTreeState=null;var mediaTreeState=null;var fileTreeState=null;var pageTreeState=null;var masterpageTreeState=null;var emailTreeState=null;var pageHTreeState=null;var libraryItemTreeState=null;var databaseTabLoaded=false;var assetsTabLoaded=false;var stylesheetTabLoaded=false;var formsTabLoaded=false;var cssNeedsInitialization=true;if(typeof(treeState)!="undefined")
{styleTreeState=new treeState();imageTreeState=new treeState();mediaTreeState=new treeState();fileTreeState=new treeState();pageTreeState=new treeState();masterpageTreeState=new treeState();emailTreeState=new treeState();pageHTreeState=new treeState();libraryItemTreeState=new treeState();}
var pageMenuPopupPageID=null;var pageMenuPopupPageName=null;var $pageMenuPopupElem=null;var stylesheetMenuPopupID=null;var currentCopiedItemID="";var currentCopiedItemBrowserID="";var isPicassoStudio=window.location.pathname.toLowerCase().indexOf('studio.aspx')>=0;var currentSelectedItemID="";var currentSelectedItemBrowserID="";var currentSelectedItemType="";var stylesheetPropertyID="";var ua=navigator.userAgent.toLowerCase();var isIE=((ua.indexOf("msie")!=-1)&&(ua.indexOf("opera")==-1)&&(ua.indexOf("webtv")==-1));var g_EditorInFocusID=null;var property_openNodes=[];var property_closedNodes=[];var css_closeNodes=[];var g_LastBorder="";var g_LastBorder_Right="";var g_LastBorder_Left="";var g_LastBorder_Top="";var g_LastBorder_Bottom="";var kTargetLockBorder="1px solid #f9a4ab";var kPanelHeaderTargetLockBackgroundColor="#f9e7e5";var kUnselectedBorder="1px solid #B5CAE1";var kSelectedBorder="";var kDropTargetHoverBorder="3px dashed red";var kDropContainerHoverBorder="1px double #64ADF8";var kDragMouseMoveThreshhold=8;var kDragMouseMoveThreshholdSqr=kDragMouseMoveThreshhold*kDragMouseMoveThreshhold;var kGuidEmpty="0000-0000-0000";var g_DropTargetLockID=null;var kSelectionHandleZIndex=1001;var g_TimeOutErrorCode=1;var last_mouseDownPosition=null;var clamparea=null;var picassoIdleTimeoutMilliseconds=60000*30;var picassoIdleTimeoutID=null;function TogglePropertySectionVisbility(element)
{var image=element.firstChild;var div=PicassoGetNextSiblingElement(element);while(image&&image.nodeName!='IMG')
{image=PicassoGetNextSiblingElement(image);}
while(div&&div.nodeName!='DIV')
{div=PicassoGetNextSiblingElement(div);}
if(div!=null)
{if(div.style.display=="")
{div.style.display="none";if(image!=null)
{image.src="/SMSystem/Images/Triangles/TriangleCollapsed.png";}}
else
{div.style.display="";if(image!=null)
{image.src="/SMSystem/Images/Triangles/TriangleExpanded.png";}}}}
function ToggleElementVisibility(elementID)
{var div=picassoGetElementByID(elementID);if(div!=null)
{if(div.style.display=="")
{div.style.display="none";}
else
{div.style.display="";}}}
function inStudio()
{var picassoEditor=picassoGetElementByID("picassoEditor");return(picassoEditor.className!=null&&picassoEditor.className.indexOf("picassoEditor")!=-1);}
function OnFailed(error)
{alert(error.message);}
function OnTimeOutDialog()
{ShowDialog({title:"Session Timeout",innerTitle:"Your session has expired and you have been logged out.",icon:"/SMSystem/Images/Icons/timer.png",noCloseButton:true,noXButton:true,okButtonText:"Login",zindex:9999999,acceptCB:function(){window.location="/login.aspx";}});}
function OnErrorMsgDialog(errorMsg)
{ShowDialog({title:"Error",innerTitle:errorMsg,icon:"/SMSystem/Images/Icons/exclamation.png",noCloseButton:true,noXButton:true,noOKkButton:true,okButtonText:"Close"});}
function OnPicassoEditorAJAXCallFailed(error)
{var stackTrace=error.get_stackTrace();var message=error.get_message();var statusCode=error.get_statusCode();var exceptionType=error.get_exceptionType();var timedout=error.get_timedOut();var item=picassoGetElementByID("InternalErrorMessage");var errorDialog=Sys.Application.findComponent("InternalErrorPopupModalPopupExtender");if(message.indexOf('KeepAlive')>=0)
{return;}
if(item!=null&&errorDialog!=null)
{ShowDialog({title:"Oops!",innerTitle:"Oops, there was an error! Please try again in a few seconds.",icon:"/SMSystem/Images/Icons/exclamation.png",noCloseButton:true,noXButton:true,noOKkButton:true,okButtonText:"OK",zindex:100001});}
else
{ShowDialog({title:"Oops!",innerTitle:"Oops, there was an error! Please try again in a few seconds.",icon:"/SMSystem/Images/Icons/exclamation.png",noCloseButton:true,noXButton:true,noOKkButton:true,okButtonText:"OK",zindex:100001});}}
function Studio_InitializeStartTips()
{if((typeof(starttips_enabled)!="undefined")&&(starttips_enabled!=null)&&(starttips_enabled==true))
{var editPageIDCtrl=picassoGetElementByID("currentPageID");if(editPageIDCtrl==null||editPageIDCtrl.value=="")
{setTimeout("starttip('studio-welcome')",1000);}}}
function ShowError(errorString)
{var errorDialog=Sys.Application.findComponent("InternalErrorPopupModalPopupExtender");var item=picassoGetElementByID("InternalErrorMessage");if(item!=null&&errorDialog!=null)
{item.innerHTML=errorString;errorDialog.show();}
else
{alert(errorString);}}
function OnRenameBlur(elem)
{var elemparent=elem.parentNode;if(elemparent.parentNode.tagName=="BODY")
{return;}
var li_span=$(elemparent).prev();var selectedLI=li_span.parents('li:first');$(elem).parent().hide();li_span.show();var newtext="";var pagetreeid=selectedLI.attr('treeobjectid');var oldname=selectedLI.attr('nodename');var isExtensionRename=selectedLI.attr('extensionrename')!==undefined;if(typeof pagetreeid!="undefined"&&pagetreeid!="")
{var isStyleitem=selectedLI.attr('class').indexOf('styleitemIcon')!=-1;newtext=$(elem).val().trim().replace(/[^\w_-]+$/g,'');if(isExtensionRename)
{newtext+=$(elemparent).children('span.ext').html().trim();$(elemparent).children('span.ext').html('');}
if(!isStyleitem)
{newtext=newtext.replace(/[^a-zA-Z0-9\. _-]/g,'');}}
if(newtext!=""&&newtext!=oldname)
{var propertyName="Name";if(isStyleitem)
{propertyName="SelectorString";stylesheetRules[pagetreeid].SelectorName=newtext;$('#selectedStyleSheetElement_Test input.StylesheetTextBox').val(newtext);}
PicassoWebServices.ManageSite.RenameProperty(pagetreeid,propertyName,newtext,OnPicassoEditorAJAXCallCompleted);if(isExtensionRename)
$('span.nodetitle',li_span).html(newtext);else
$('span.nodetitle',li_span).html(newtext.Ellipse(16));selectedLI.attr('nodename',newtext).attr('title',newtext);$(elem).attr('prevname',newtext);}
else
{$('span.nodetitle',li_span).html($(elem).attr('prevname'));}}
function OnPicassoSystemIdleTimeout()
{PicassoWebServices.ManageSite.LogoutCurrentUser(OnTimeOutDialog);}
function SetPicassoSystemIdleTimeout()
{if(picassoIdleTimeoutID!=null)
{clearTimeout(picassoIdleTimeoutID);}
picassoIdleTimeoutID=setTimeout(OnPicassoSystemIdleTimeout,picassoIdleTimeoutMilliseconds);}
function OnPicassoEditorPropertiesUpdateAJAXCallCompleted(result)
{OnPicassoEditorAJAXCallCompleted(result);}
function OnPicassoEditorAJAXCallCompleted(result)
{if(result.SessionTimeout!=null)
{picassoIdleTimeoutMilliseconds=eval(result.SessionTimeout);}
SetPicassoSystemIdleTimeout();if(result.ErrorCode==g_TimeOutErrorCode)
{ShowDialog({title:"Oops!",innerTitle:"Oops, the request timed out! Please try again in a few seconds.",icon:"/SMSystem/Images/Icons/exclamation.png",noCloseButton:true,noXButton:true,noOKkButton:true,okButtonText:"OK",zindex:100001});return;}
if(result.Errors!=null&&result.Errors.length!=0)
{var errors="<h3>Sitemasher.com Internal Error</h3>";for(var error=0;error<result.Errors.length;error++)
{var details=result.Errors[error];errors+=String.Format("<p>{0}</p><p>{1}</p>",details.Message,details.StackTrace);}
ShowError(errors);}
if(result.UserResponseError!=null&&result.UserResponseError!="")
{var ueArray=result.UserResponseError.split(',');if(ueArray[0]=="NameConflict")
{var itemID=ueArray[1];var parentID=ueArray[2];var position=ueArray[3];ShowDialog({title:"File already exists!",innerTitle:"<p>A file of the same name already exists in this folder, do you want to overwrite it?</p>",icon:"/SMSystem/Images/Dashboard/Content/delete.png",acceptCB:function()
{PicassoWebServices.ManageSite.MoveTreeItemOverwrite(itemID,parentID,position,true,OnPicassoEditorAJAXCallCompleted);},cancelCB:function()
{PicassoWebServices.ManageSite.MoveTreeItemCancel(OnPicassoEditorAJAXCallCompleted);}});}
else if(ueArray[0]=="EditableContent")
{var itemID=ueArray[1];ShowDialog({title:"Removing Editable Content",innerTitle:"<p>One or more of your site pages contain content in this editable area, so if you disable the Editable Contents property, the content will be erased. Are you sure you want to continue?</p>",icon:"/SMSystem/Images/Dashboard/Content/delete.png",acceptCB:function()
{PicassoWebServices.ManageSite.EnableEditableContent(itemID,OnPicassoEditorAJAXCallCompleted);},cancelCB:function()
{}});}
else if(ueArray[0]=="RenameConflict")
{ShowDialog({title:"Rename Conflict",innerTitle:"<p>An item with the same name already exists in this folder.</p>",icon:"/SMSystem/Images/Dashboard/Content/view.png",noOKButton:true,closeButtonText:"Close"});var guid=ueArray[1];var oldname=ueArray[2];$('#id'+guid.replace(/-/g,'')+'_tree').attr('nodename',oldname).attr('title',oldname).find('span').html(oldname);$('#renameContainer').children('span').html('');}}
if(result.CurrentItemHelpID!="")
{if(typeof(contexthelp_show)=='function')
{contexthelp_show(result.CurrentItemHelpID);}}
if(result.PageThumbnailsHtml)
{UpdatePageThumbnails(result.PageThumbnailsHtml)}
if(result.CurrentPageThumbnailHtml)
{UpdateCurrentPageThumbnail(result.CurrentPageThumbnailHtml,result.CurrentPageThumbnailID);}
if(result.StyleRulesDictionary)
{stylesheetRules=result.StyleRulesDictionary;}
if(result.IDs!=null)
{siteIDs=result.IDs;siteIDs.sort();}
if(result.Classes!=null)
{siteClasses=result.Classes;siteClasses.sort();}
if(result.EditorClasses!=null)
{siteEditorClasses=result.EditorClasses;siteEditorClasses.sort();}
if(result.Rules!=null)
{if(cssNeedsInitialization)
{cssNeedsInitialization=false;UpdateEditorStylesheetRules(result.Rules);}
else if(result.CssChanged)
{UpdateEditorStylesheetRules(result.Rules);}}
if(result.Pages!=null)
{sitePages=result.Pages;populateSelectList("urlSelectPage",sitePages);if(typeof GetHTMLEditor=="function")
{var htmleditor=GetHTMLEditor();if(htmleditor!=null)
{var imagestr="";for(index=0;index<sitePages.length;index++)
{imagestr+=sitePages[index].Key+"|"+sitePages[index].Value.FriendlyUrl+";";}
htmleditor.set_sitemasher_pages(imagestr);}}}
if(result.Files!=null)
{siteFiles=result.Files;if(typeof GetHTMLEditor=="function")
{var htmleditor=GetHTMLEditor();if(htmleditor!=null)
{var imagestr="";for(index=0;index<siteFiles.length;index++)
{imagestr+=siteFiles[index].Key+"|"+siteFiles[index].Value.FriendlyUrl+";";}
htmleditor.set_sitemasher_files(imagestr);}}}
if(result.Images!=null)
{siteImages=result.Images;if(typeof GetHTMLEditor=="function")
{var htmleditor=GetHTMLEditor();if(htmleditor!=null)
{var imagestr="";for(index=0;index<siteImages.length;index++)
{imagestr+=siteImages[index].Key+"|"+siteImages[index].Value.FriendlyUrl+";";}
htmleditor.set_sitemasher_images(imagestr);}}}
if(result.MasterPages!=null)
{UpdateMasterPages(result.MasterPages);}
if(isPicassoStudio&&result.CustomCSSHtml!=null&&result.CustomCSSHtml!="")
{UpdateCustomCSS(result.CustomCSSHtml);var jq_parent=$('#customcssInternal div.picassorhscategoriescontainer_open');if(jq_parent.length>0)
{var parent_a=jq_parent.find('a').get(0);CollapsePropertiesHeadersContainers(jq_parent.get(0),parent_a,false);}}
if(isPicassoStudio&&result.SmartTagHtml!="")
{UpdateSmartTagWindow(result.SmartTagHtml);if(siteClasses!=null)
{$('#smartTagIdPanel').find('select.siteClasses').each(function()
{populateSelectList(this.id,siteClasses);$(this).val(this.getAttribute('currentValue'));});}
if(siteIDs!=null)
{$('#smartTagIdPanel').find('select.siteIDs').each(function()
{populateSelectList(this.id,siteIDs);$(this).val(this.getAttribute('currentValue'));});}}
if(isPicassoStudio&&result.WidgetsHTML!="")
{$("#WidgetsContainer").html(result.WidgetsHTML);}
if(isPicassoStudio&&result.SiteExtensionsHTML!="")
{$("#siteExtensionList").html(result.SiteExtensionsHTML);}
if(result.StylesheetData!=null)
{UpdateStylesheetWindow(result.StylesheetData);}
if(result.StyleItemUpdates!=null)
{for(index=0;index<result.StyleItemUpdates.length;index++)
{var upd=result.StyleItemUpdates[index];var itemid=stylesheetRules[upd.ItemID];if(itemid.StyleList==null)
break;var foundStyle=false;for(var i=0;i<itemid.StyleList.length;i++)
{if(itemid.StyleList[i].Key==upd.PropertyName)
{foundStyle=true;itemid.StyleList[i].Value=upd.PropertyValue;break;}}
if(foundStyle==false&&upd.PropertyValue!='')
{itemid.StyleList.push({"Key":upd.PropertyName,"Value":upd.PropertyValue});}
var selectorText=itemid.SelectorName;var stylesheet=GetStylesheet();if(stylesheet!=null)
{var selector_entries=selectorText.split(",");var entriesLength=selector_entries.length;for(var r=0;r<entriesLength;r++)
{var rule=GetStylesheetRule(stylesheet,selector_entries[r].trim());if(rule!=null&&rule.style!=null)
{var jspropname=toCamelCase(upd.PropertyName);rule.style[jspropname]=upd.PropertyValue;}}}
var outstyle=updateStyleRule($(itemid).get(0));updateVisualCSSEditorSummary(outstyle);}}
if(result.ContentMapHtml!="")
{UpdateContentMap(result.ContentMapHtml);}
if(result.StyleHtml!="")
{UpdateStyleWindow(result.StyleHtml);}
if(result.PropertiesHtml!="")
{UpdatePropertiesWindow(result.PropertiesHtml);}
if(result.EventsHtml!=null&&result.EventsHtml!="")
{UpdateEventsWindow(result.EventsHtml);}
if(result.ImageTreeData!=null)
{UpdateImagesWindow(result.ImageTreeData);}
if(result.MediaTreeData!=null)
{UpdateMediaWindow(result.MediaTreeData);}
if(result.FileTreeData!=null)
{UpdateFilesWindow(result.FileTreeData);}
if(result.ContentItemsHtml!="")
{UpdateContentItems(result.ContentItemsHtml);}
if(result.DatabaseObjectsHtml!="")
{UpdateDatabaseObjects(result.DatabaseObjectsHtml,result.CurrentItemID);SelectDatabaseObjectFromID_ClientOnly(result.CurrentItemID);}
if(result.DatabaseRecordsHtml!="")
{UpdateDatabaseRecords(result.DatabaseRecordsHtml);}
if(result.QueryObjectsHtml!="")
{UpdateQueryObjects(result.QueryObjectsHtml,result.CurrentItemID);SelectQueryObjectFromID_ClientOnly(result.CurrentItemID);}
if(result.DatabaseObjectHtml!="")
{UpdateDatabaseObject(result.DatabaseObjectHtml);}
if(result.DatabaseNewFieldHtml!="")
{UpdateNewFieldHtml(result.DatabaseNewFieldHtml);}
if(result.WorkflowObjectsHtml!="")
{UpdateWorkflowObjects(result.WorkflowObjectsHtml);}
if(result.WorkflowObjectHtml!="")
{UpdateWorkflowObject(result.WorkflowObjectHtml);}
if(result.EditorHtml!="")
{UpdateEditorWindow(result.EditorHtml);}
if(result.CurrentItemSelectionPathHtml)
{UpdateSelectionPath(result.CurrentItemSelectionPathHtml);}
if(result.FriendlySelectorHtml!=null&&result.FriendlySelectorHtml!="")
{$("#menuSelectorList").remove();$('#subitemSelectorPlaceholder').html(result.FriendlySelectorHtml);$("#menuSelectorList").change(onSubItemSelectorChanged);}
if(result.ExecuteScript_Select!=null&&result.ExecuteScript_Select!="")
{eval(result.ExecuteScript_Select);}
if(result.CurrentItemHtml!=""&&result.CurrentItemBrowserID!="")
{if(result.RenderTargetID!="")
{UpdateEditorItem(result.RenderTargetID,result.CurrentItemHtml);}
else
{UpdateEditorItem(result.CurrentItemBrowserID,result.CurrentItemHtml);}}
if(result.FormsHtml!="")
{UpdateEditorForms(result.FormsHtml);}
if(result.PageID!="")
{var editPageNameCtrl=picassoGetElementByID("studioDialogContainer_currentPageName");var editPageIDCtrl=picassoGetElementByID("currentPageID");var editPageTypeCtrl=picassoGetElementByID("currentPageType");var editPageURLCtrl=picassoGetElementByID("currentPageURL");if(editPageURLCtrl!=null)
{editPageURLCtrl.value=result.PageURL;}
if(editPageNameCtrl!=null)
{editPageNameCtrl.innerHTML=result.PageName;}
if(editPageIDCtrl!=null)
{if(result.PageID.indexOf(kGuidEmpty)!=-1)
{$('#pageHierarchyArea,#pageHierarchyWrapper').hide();$('#createHyperLinkTrigger').hide();}
else
{$('#pageHierarchyArea').show();$('#createHyperLinkTrigger').show();}
editPageIDCtrl.value=result.PageID;}
if(editPageTypeCtrl!=null)
{editPageTypeCtrl.value=result.PageType;}}
if(result.PageState!=null&&result.PageState!="")
{var pageid=$('#currentPageID').val();if(typeof pageid=="string")
{var $pagetreeid=$('#id'+pageid.replace(/-/g,'')+'_pageitem');if($pagetreeid[0])
{var classstr=$pagetreeid.attr('class');var classes=classstr.split(' ');if(classes&&classes.length>1)
{for(i in classes)
{if(classes[i].indexOf('state')!=-1)
{$pagetreeid.attr('class',classstr.replace(classes[i],result.PageState));break;}}}}}}
if(result.SiteMapHtml!="")
{UpdateSitemap(result.SiteMapHtml);}
if(isPicassoStudio&&result.PageHierarchyData!=null)
{UpdatePageHierarchy(result.PageHierarchyData);}
if(result.LastActionParam.indexOf("ApplyCSS")!=-1)
{var styleinfo=result.LastActionParam.split(",");if(styleinfo.length==2)
{var styles=stylesheetRules[styleinfo[1]];if(styles)
{var outstyle=updateStyleRule(styles);updateVisualCSSEditor(outstyle);}}}
if(result.LastActionParam.indexOf("TreeOp")!=-1)
{var treeargs=result.LastActionParam.split(",");if(treeargs[1]=='Delete')
{var objid=treeargs[2];var itemtype=treeargs[3];if(objid&&itemtype)
{var treeparentid=imageTreeState;if(itemtype=='PicassoAssetFileRef')
{treeparentid=fileTreeState;}
else if(itemtype=='PicassoAssetMediaRef')
{treeparentid=mediaTreeState;}
else if(itemtype=='PicassoStylesheetItem'||itemtype=='PicassoStylesheetGroup'||itemtype=='PicassoStyleItem')
{treeparentid=styleTreeState;}
var treeid=treeparentid.treeselector+' li[treeobjectid='+objid+']';treeparentid.unselectAll();if(treeparentid.activateNode(treeid))
{$(treeparentid.treeselector).get(0).delNode();}}}}
if(result.CurrentItemID!="")
{if(result.LastActionParam!="SelectItem"&&result.LastActionParam!="SetStyle")
{setSelectedObject(result.CurrentItemID,result.CurrentItemBrowserID,result.CurrentItemType);if(result.CurrentItemType!="")
{picassoItemSelection.doSelect(result.CurrentItemID,result.CurrentItemType,false);}}
if(result.LastActionParam=="SetStyle")
{var picassoStyle=getStyleFromSelection()||"";updateVisualCSSEditorSummary(picassoStyle);}
else if(result.LastActionParam=="ClearStyle")
{populateItemVisibleStyle();}
if(result.LastActionParam.indexOf('UpdateProperty')!=-1)
{var props=result.LastActionParam.split(',');if(props.length>1&&props[1]=="Name")
{var selectedItem=getSelectedObject();if(selectedItem==null)
{selectedItem=picassoGetElementByID('pageDesignContents');}
var itemname=selectedItem.getAttribute('itemname');if(itemname&&itemname!="")
{$('#pageHTree li[treeobjectid='+result.CurrentItemID+']>span .nodetitle').html(itemname);}}}
hideSelectionHandles();showSelectionHandles();}
if(result.ItemWizardUrl!=null&&result.ItemWizardUrl!="")
{var wizardUrl=result.ItemWizardUrl;if(wizardUrl.indexOf('javascript:',0)==0)
{eval(wizardUrl);}
else
{startModalDialog(wizardUrl);}}
if(result.LastWarning!=null&&result.LastWarning!="")
{OnErrorMsgDialog(result.LastWarning);}
if(result.ScriptEvents!=null)
{for(var i=0;i<result.ScriptEvents.length;i++)
{eval(result.ScriptEvents[i]);}}
if(result.ResponseScripts!=null&&result.ResponseScripts.length>0){for(var i=0;i<result.ResponseScripts.length;i++){eval(result.ResponseScripts[i]);}}
if(typeof(picassoHideInTransitionPage)=='function')
{picassoHideInTransitionPage();}}
function ensureImages(cb)
{if(siteImages==null)
{PicassoWebServices.ManageSite.UpdateSiteLinks_Images(function(result)
{OnPicassoEditorAJAXCallCompleted(result);cb();});}
else
{cb();}}
function ensureFiles(cb)
{if(siteFiles==null)
{PicassoWebServices.ManageSite.UpdateSiteLinks_Files(function(result)
{OnPicassoEditorAJAXCallCompleted(result);cb();});}
else
{cb();}}
function ensureAssets(cb)
{if(siteFiles==null&&siteImages==null)
{PicassoWebServices.ManageSite.UpdateSiteLinks(function(result)
{OnPicassoEditorAJAXCallCompleted(result);cb();});return;}
else if(siteFiles==null)
{ensureFiles(cb);}
else if(siteImages==null)
{ensureImages(cb);}
else
{cb();}}
function getStyleFromSelection()
{var selObj=getSelectedObject();if(selObj==null)
{var subpart=$('#pagePartSelectList').val();if(subpart=='body')
{selObj=picassoGetElementByID("pageBodyID");}
else
{selObj=picassoGetElementByID("pageDesignContents");}}
if(selObj!=null)
{return selObj.getAttribute("picasso-style");}
return"";}
function toCamelCase(name)
{var camelCase=name.replace(/\-(\w)/g,function(all,letter)
{return letter.toUpperCase();});return camelCase;}
function UpdateWorkflowObjects(html)
{var workflowObjectsInternal=picassoGetElementByID("workflowObjectsInternal");if(workflowObjectsInternal!=null)
{workflowObjectsInternal.innerHTML=html;}}
function UpdateWorkflowObject(html)
{var workflowObjectInternal=picassoGetElementByID("workflowObjectInternal");if(workflowObjectInternal!=null)
{workflowObjectInternal.innerHTML=html;}}
function UpdateDatabaseObjects(html)
{var databaseObjectsInternal=picassoGetElementByID("databaseObjectsInternal");if(databaseObjectsInternal!=null)
{databaseObjectsInternal.innerHTML=html;if($('#databaseObjectsUL li').length==0){$('#noListPanel').show();}
else
{$('#noListPanel').hide();}}
setTimeout('picassoLists.refreshCurrentView();',50);}
function UpdateQueryObjects(html)
{var queryObjectsInternal=picassoGetElementByID("queryObjectsInternal");if(queryObjectsInternal!=null)
{queryObjectsInternal.innerHTML=html;}}
function UpdateDatabaseObject(html)
{var databaseObjectInternal=picassoGetElementByID("databaseObjectInternal");if(databaseObjectInternal!=null)
{databaseObjectInternal.innerHTML=html;}}
function UpdateDatabaseRecords(html)
{var databaseObjectInternal=picassoGetElementByID("contentTabBody");if(databaseObjectInternal!=null)
{databaseObjectInternal.innerHTML=html;}}
function UpdatePageThumbnails(html)
{var pageThumbnails=picassoGetElementByID("pageThumbnailsInternal");if(pageThumbnails!=null)
{pageThumbnails.innerHTML=html;}}
function UpdateCurrentPageThumbnail(html,id)
{var pageThumbnail=picassoGetElementByID(id);if(pageThumbnail!=null)
{var newItem=document.createElement("DIV");var parent=pageThumbnail.parentNode;newItem.innerHTML=html;parent.replaceChild(newItem.firstChild,pageThumbnail);}}
function UpdateContentItems(contentItems)
{var contentItemsInternal=picassoGetElementByID("contentItemsInternal");if(contentItemsInternal!=null)
{contentItemsInternal.innerHTML=contentItems;}}
function UpdateMediaWindow(treeData)
{var mediaItemsInternal=picassoGetElementByID("mediaItemsInternal");if(mediaItemsInternal)
{$('#renameContainer').appendTo('body').hide();$('#mediaTree').remove();createTreeFromJSON(treeData,$('#mediaItemsInternal').html('').get(0),null);mediaTreeState.init('#mediaTree',{allowDragInRoot:true,afterClick:function(selectedLI)
{imageTreeState.unselectAll();fileTreeState.unselectAll();}});}}
function UpdateFilesWindow(treeData)
{var filesItemsInternal=picassoGetElementByID("filesItemsInternal");if(filesItemsInternal)
{$('#renameContainer').appendTo('body').hide();$('#fileTree').remove();createTreeFromJSON(treeData,$('#filesItemsInternal').html('').get(0),null);fileTreeState.init('#fileTree',{allowDragInRoot:true,afterClick:function(selectedLI)
{imageTreeState.unselectAll();mediaTreeState.unselectAll();}});}}
function EditTextAsset(objectid)
{var url=String.Format('Editors/HtmlWidgetEditor.aspx?HTML=True&ItemID={0}',objectid);startModalDialog(url);}
function UpdateImagesWindow(treeData)
{var toolboxItemsInternal=picassoGetElementByID("toolboxItemsInternal");if(toolboxItemsInternal)
{$('#renameContainer').appendTo('body').hide();$('#imageTree').remove();createTreeFromJSON(treeData,$('#toolboxItemsInternal').html('').get(0),null);imageTreeState.init('#imageTree',{allowDragInRoot:true,afterClick:function(selectedLI)
{mediaTreeState.unselectAll();fileTreeState.unselectAll();},afterAjax:function(expandedUL)
{$('li.imageIcon>span',expandedUL).hover(function(){createShowImage(this)},killImage);}});function createShowImage(elem)
{var imgsrc=$(elem).nextAll('.imageloader').attr('imgsrc').replace('Type=Image','Type=Thumbnail');$('#imageViewer').html("<img src='"+imgsrc+"' />").fadeIn();}
function killImage()
{$('#imageViewer').hide().html('');}
$('#imageTree li.imageIcon>span').hover(function(){createShowImage(this)},killImage);}}
function UpdateSelectionPath(selectionPathHtml)
{var $selPath=$('#workareadContainer').find('.currentItemSelectionPath:visible');if($selPath.length==0)
return;$selPath.html(selectionPathHtml);var bcul=$selPath.find('ul');var lastbc=$('li.selectionPathItem:last',bcul);if(lastbc.length==0)
return;var farright=lastbc.offset().left-bcul.offset().left+lastbc.width()+16;var winwidth=$selPath.width();if(farright>winwidth)
{var moveleft=farright-winwidth;bcul.css({'left':-moveleft});}}
function UpdateContentMap(contentMapHtml)
{var contentMapInternal=picassoGetElementByID("contentMapInternal");if(contentMapInternal!=null)
{contentMapInternal.innerHTML=contentMapHtml;}}
function UpdateEditorItem(itemBrowserID,itemHtml)
{var item=picassoGetElementByID(itemBrowserID);if(item!=null)
{var newItem=document.createElement("DIV");var parent=item.parentNode;newItem.innerHTML=itemHtml;parent.replaceChild(newItem.firstChild,item);InitializeDragDrop();refreshTargetLockStyle();setTimeout(function(){builderproxylayer.init();},0);}
else
{setTimeout(function(){builderproxylayer.init();},0);}}
function UpdateSitemap(html)
{var item=picassoGetElementByID("siteMapInternal");if(item!=null)
{$('#renameContainer').appendTo('body').hide();$('#sitePageTree').remove();$('#masterPageTree').remove();$('#emailsTree').remove();$('#libraryItemsTree').remove();item.innerHTML=html;pageTreeState.init('#sitePageTree',{allowDragInRoot:false,docToFolderConvert:true,getRenameStartText:function(selectedLI)
{return selectedLI.attr('nodename');},afterClick:function(selectedLI)
{masterpageTreeState.unselectAll();emailTreeState.unselectAll();libraryItemTreeState.unselectAll();},afterMove:function(childid,parentid,position)
{PicassoWebServices.ManageSite.MovePageTreeItem(childid,parentid,position,OnPicassoEditorAJAXCallCompleted);},selectActive:function(rootUL)
{var pageid=$('#currentPageID').val();if(typeof pageid=="string")
{var treeid='#sitePageTree li[treeobjectid='+pageid+']';if(pageTreeState.activateNode(treeid))
{if(masterpageTreeState.activenodes.length>0)
masterpageTreeState.unselectAll();if(emailTreeState.activenodes.length>0)
emailTreeState.unselectAll();if(libraryItemTreeState.activenodes.length>0)
libraryItemTreeState.unselectAll();}}},allowMove:function(destLI,sourceLI)
{var srcType=sourceLI.attr('nodetype');var destType=destLI.attr('nodetype');return(srcType==destType||destType=="PageRootFolder");}});masterpageTreeState.init('#masterPageTree',{drag:false,allowDragInRoot:false,docToFolderConvert:false,getRenameStartText:function(selectedLI)
{return selectedLI.attr('nodename');},afterClick:function(selectedLI)
{pageTreeState.unselectAll();emailTreeState.unselectAll();libraryItemTreeState.unselectAll();},selectActive:function(rootUL)
{var pageid=$('#currentPageID').val();if(typeof pageid=="string")
{var treeid='#masterPageTree li[treeobjectid='+pageid+']';if(masterpageTreeState.activateNode(treeid))
{if(pageTreeState.activenodes.length>0)
pageTreeState.unselectAll();if(emailTreeState.activenodes.length>0)
emailTreeState.unselectAll();if(libraryItemTreeState.activenodes.length>0)
libraryItemTreeState.unselectAll();}}},afterMove:function(childid,parentid,position)
{PicassoWebServices.ManageSite.MovePageTreeItem(childid,parentid,position,OnPicassoEditorAJAXCallCompleted);},allowMove:function(destLI,sourceLI)
{var srcType=sourceLI.attr('nodetype');var destType=destLI.attr('nodetype');return(srcType==destType);}});emailTreeState.init('#emailsTree',{allowDragInRoot:false,docToFolderConvert:true,getRenameStartText:function(selectedLI)
{return selectedLI.attr('nodename');},afterClick:function(selectedLI)
{pageTreeState.unselectAll();masterpageTreeState.unselectAll();libraryItemTreeState.unselectAll();},afterMove:function(childid,parentid,position)
{},selectActive:function(rootUL)
{var pageid=$('#currentPageID').val();if(typeof pageid=="string")
{var treeid='#emailsTree li[treeobjectid='+pageid+']';if(emailTreeState.activateNode(treeid))
{if(pageTreeState.activenodes.length>0)
pageTreeState.unselectAll();if(masterpageTreeState.activenodes.length>0)
masterpageTreeState.unselectAll();if(libraryItemTreeState.activenodes.length>0)
libraryItemTreeState.unselectAll();}}},allowMove:function(destLI,sourceLI)
{var srcType=sourceLI.attr('nodetype');var destType=destLI.attr('nodetype');return(srcType==destType);}});libraryItemTreeState.init('#libraryItemsTree',{allowDragInRoot:true,docToFolderConvert:true,getRenameStartText:function(selectedLI)
{return selectedLI.attr('nodename');},afterClick:function(selectedLI)
{pageTreeState.unselectAll();masterpageTreeState.unselectAll();emailTreeState.unselectAll();},afterMove:function(childid,parentid,position)
{},selectActive:function(rootUL)
{var pageid=$('#currentPageID').val();if(typeof pageid=="string")
{var treeid='#libraryItemsTree li[treeobjectid='+pageid+']';if(libraryItemTreeState.activateNode(treeid))
{if(pageTreeState.activenodes.length>0)
pageTreeState.unselectAll();if(masterpageTreeState.activenodes.length>0)
masterpageTreeState.unselectAll();if(emailTreeState.activenodes.length>0)
emailTreeState.unselectAll();}}},allowMove:function(destLI,sourceLI)
{return false;}});}}
function UpdateSiteDesigner(html)
{var item=picassoGetElementByID("siteDesignerInternal");if(item!=null)
{item.innerHTML=html;}}
function UpdatePageHierarchy(treeData){var $pageHier=$('#domTreeInternal');if($pageHier.length==0){return;}
$('#pageHTree').remove();createTreeFromJSON(treeData,$pageHier.html('').get(0),null);var page_elementscope=$('#pageDesignContents').attr("elementscope");var allowDragging=true;pageHTreeState.init('#pageHTree',{drag:allowDragging,allowDragInRoot:true,afterMove:function(childid,parentid,position)
{PicassoWebServices.ManageSite.MoveTreeItem(childid,parentid,position,OnPicassoEditorAJAXCallCompleted);},selectActive:function(rootUL)
{var itemID=currentSelectedItemID;if(typeof itemID=="string"&&itemID!="")
{pageHTreeState.unselectAll();pageHTreeState.activateNode('#pageHTree li[treeobjectid='+itemID+']');}
else
{pageTreeState.activateNode('#pageHTree ul li:first[treeobjectid]');}},afterContextMenu:function(selectedLI,event)
{SelectObjectFromDomID(selectedLI.attr('treebrowserid'));setTimeout(function(){showContextMenuAtMouse(event,true)},50);},allowMove:function(destLI,sourceLI)
{var editorDropTarget;if(destLI.attr('nodetype')=='PicassoPage')
{editorDropTarget="#pageDesignContents";}
else
{editorDropTarget="#"+destLI.attr('treebrowserid');}
editorDropTarget=$(editorDropTarget).attr('editorDropTarget');if(!editorDropTarget||editorDropTarget=="")
{return false;}
var droptargettype="#"+sourceLI.attr('treebrowserid');droptargettype=$(droptargettype).attr('droptargettype');var supportedTargets=editorDropTarget.split(",");for(var trgt=0;trgt<supportedTargets.length;trgt++)
{if(supportedTargets[trgt]==droptargettype)
{return true;}}
return false;}});}
function UpdateMasterPages(masterPages)
{if(masterPages!=null)
{siteMasterPages=masterPages;}}
function UpdateEditorForms(html)
{var item=picassoGetElementByID("formsInternal");if(item!=null)
{item.innerHTML=html;}}
function UpdateEditorWindow(html)
{var editorWindow=picassoGetElementByID("pageEditorContents");if(editorWindow!=null)
{plog("editorWindow != null");editorWindow.innerHTML=html;setTimeout(function(){builderproxylayer.init();},0);var $bodyArea=$("#pageBodyID");if($bodyArea.length>0)
{var $pageDesignContents=$('#pageDesignContents');var topdiff=$pageDesignContents.offset().top-$bodyArea.offset().top;var pageHeight=$pageDesignContents.height()+topdiff;if(pageHeight>$bodyArea.height())
{$bodyArea.height(pageHeight);}
InitializeDragDrop();var isPageActive=true;if($pageDesignContents.attr('elementscope')=="Shared")
{var editableItems=$pageDesignContents.find('div[picasso-editable-content], div[elementscope=Replaced]').length;if(editableItems==0)
{$pageDesignContents.append("<div id='emptySitePagePlaceholder' class='pagePlaceHolder'>This page is based on a master page that currently has no editable areas. To modify the page, you must first return to the master page and mark objects as editable. See <a class='studioLink' onclick=\"javascript:window.open('/Help/sitemasher_help_CSH.html#prop_editable', '', 'scrollbars=1, status=1, toolbar=1, resizable=1, width=1260, height=800');\">Using the Editable Contents property</a> for more information.</div>");isPageActive=false;}}
if(sitePages!=null&&sitePages.length==0&&siteMasterPages!=null&&siteMasterPages.length==0)
{isPageActive=false;}
if(isPageActive)
{$('#editPagePanel').show();if($.browser.msie)
{$pageDesignContents.css('border',kUnselectedBorder);}
else
{$pageDesignContents.css('outline',kUnselectedBorder);}}
else
{$('#editPagePanel').hide();}
refreshTargetLockStyle();}}}
function UpdateStylesheetWindow(treeData)
{$('#renameContainer').appendTo('body').hide();$('#stylesheetTree').remove();createTreeFromJSON(treeData,$('#stylesheetRulesInternal').html('').get(0),null);styleTreeState.init('#stylesheetTree',{getRenameStartText:function(selectedLI)
{if(selectedLI.attr('nodetype')=="PicassoStyleItem")
{return stylesheetRules[selectedLI.attr('treeobjectid')].SelectorName;}
return"";},allowMove:function(destLI,sourceLI)
{var srcType=sourceLI.attr('nodetype');var destType=destLI.attr('nodetype');if(srcType=="PicassoStylesheetItem")
{return false;}
return true;}});}
function GetStylesheetRule(stylesheetNode,selector)
{var rules=stylesheetNode.rules?stylesheetNode.rules:stylesheetNode.cssRules;for(var index=0;index<rules.length;index++)
{var checkSel=rules[index].selectorText.replace('#pageEditorStylesheetContainer ','').toLowerCase();if(checkSel==selector.toLowerCase())
{return rules[index];}}
return null;}
function GetStylesheet()
{if(document.styleSheets)
{var stylesheet=null;if(isIE)
{stylesheet=document.styleSheets["picassoEditorContentsStyle"];}
else
{stylesheet=picassoGetElementByID("picassoEditorContentsStyle");if(stylesheet!=null&&stylesheet.sheet!=null)
{stylesheet=stylesheet.sheet;}}
if(stylesheet!=undefined&&stylesheet!=null)
{return stylesheet;}}
return null;}
function UpdateEditorStylesheetRules(rules)
{var stylesheet=GetStylesheet()
if(stylesheet==null)
return;if(typeof(stylesheet.cssText)!="undefined")
{var css="";var rulesLength=rules.length;for(var index=0;index<rulesLength;index++)
{var raw_rule=rules[index].Key.replace(/^\s*body/i,".pseudoBody").replace(/^\s*html/i,".pseudoHtml");var decl=rules[index].Value;{var rule_entries=raw_rule.split(",");var entriesLength=rule_entries.length;for(var r=0;r<entriesLength;r++)
{css+="#pageEditorStylesheetContainer "+rule_entries[r]+"{"+decl+"}";}}}
stylesheet.cssText=css;}
else
{if(stylesheet.rules)
{while(stylesheet.rules.length>0)
{stylesheet.removeRule(0);}}
else if(stylesheet.cssRules)
{while(stylesheet.cssRules.length>0)
{stylesheet.deleteRule(0);}}
for(var index=0;index<rules.length;index++)
{var raw_rule=rules[index].Key.replace(/^\s*body/i,".pseudoBody").replace(/^\s*html/i,".pseudoHtml");var decl=rules[index].Value;{if(stylesheet.insertRule)
{var rule_entries=raw_rule.split(",");for(var r=0;r<rule_entries.length;r++)
{var rule=String.Format("#pageEditorStylesheetContainer {0}",rule_entries[r]);try
{stylesheet.insertRule(rule+"{"+decl+"}",stylesheet.cssRules.length);}
catch(ex)
{}}}
else if(stylesheet.addRule)
{var rule_entries=raw_rule.split(",");for(var r=0;r<rule_entries.length;r++)
{var rule=String.Format("#pageEditorStylesheetContainer {0}",rule_entries[r]);try
{stylesheet.addRule(rule,decl);}
catch(exception)
{}}}}}}}
function UpdateStyleWindow(html)
{var stylePanel=picassoGetElementByID("stylePanelInternal");if(stylePanel!=null)
{stylePanelInternal.innerHTML=html;}}
function UpdateCustomCSS(html)
{$('#customcssInternal').html(html).show();}
function UpdateSmartTagWindow(html)
{var smartTagPanel=picassoGetElementByID("smartTagPanelInternal");if(smartTagPanel==null)
{smartTagPanel=picassoGetElementByID("smartTagPanelInternal",null,this.parent.document);}
if(smartTagPanel!=null)
{smartTagPanel.innerHTML=html;RestoreRHSPropertiesHeadersNodeState();InitializeDragDrop();}}
function UpdatePropertiesWindow(html)
{var propertiesTagPanel=picassoGetElementByID("propertiesPanelInternal");if(propertiesTagPanel!=null)
{propertiesTagPanel.innerHTML=html;}}
function UpdateEventsWindow(html)
{var eventsPanelInternal=picassoGetElementByID("eventsPanelInternal");if(eventsPanelInternal!=null)
{eventsPanelInternal.innerHTML=html;}}
function createDatabaseObject(name,desc)
{if(name!=null&&name!="")
{PicassoWebServices.ManageSite.CreateDatabaseObjectItem(name,desc,OnPicassoEditorAJAXCallCompleted);}}
function selectContentContainer(itemID)
{PicassoWebServices.ManageSite.SelectContentContainer(itemID,OnPicassoEditorAJAXCallCompleted);}
function createContentList()
{var contentListName=picassoGetElementByID("contentListName");var contentListType=picassoGetElementByID("contentListType");if(contentListName!=null&&contentListName.value!=""&&contentListType!=null)
{var contentListSelectedValue=contentListType.options[contentListType.selectedIndex].value;PicassoWebServices.ManageSite.CreateContentListItem(contentListName.value,contentListSelectedValue,OnPicassoEditorAJAXCallCompleted);}}
function CreateNewContentItem()
{var newContentItemText=picassoGetElementByID("newContentItemText");var value="";if(newContentItemText!=null&&newContentItemText.value!="")
{value=newContentItemText.value;}
PicassoWebServices.ManageSite.CreateNewContentItem(value,OnPicassoEditorAJAXCallCompleted);}
function createStyleRule(selector)
{var parentid=styleTreeState.getSelectedParentID();if(parentid!=""&&selector!=null)
{var sel_str=selector.trim();if(sel_str!="")
{PicassoWebServices.ManageSite.CreateStyleRule(sel_str,parentid,OnPicassoEditorAJAXCallCompleted);}}}
function createStyleGroup()
{var parentid=styleTreeState.getSelectedParentID();if(parentid!="")
{PicassoWebServices.ManageSite.InsertStyleGroup(parentid,OnPicassoEditorAJAXCallCompleted);}}
function createStylesheet()
{PicassoWebServices.ManageSite.CreateStylesheet(OnPicassoEditorAJAXCallCompleted);}
function selectFolder(elem,objectID)
{SelectItemFromItemID(objectID,"","PicassoFolder");}
function selectStyleRule(objectID)
{picassoItemSelection.doSelect(objectID,"PicassoStyleItem",true);}
function selectStyleFolder(objectID)
{picassoItemSelection.doSelect(objectID,"PicassoStylesheetGroup",true);}
function selectStylesheet(objectID)
{picassoItemSelection.doSelect(objectID,"PicassoStylesheetItem",true);}
function selectStylesheetFile(objectID)
{picassoItemSelection.doSelect(objectID,"PicassoAssetFileRef",true);}
var kAcceptableStylePreviewProperties=["color","font","text","line-","vertical-align","spacing","background","padding","margin","border"];function isAcceptablePreviewStyle(style)
{for(var i=0;i<kAcceptableStylePreviewProperties.length;i++)
{if(style.indexOf(kAcceptableStylePreviewProperties[i])>=0)
{return true;}}
return false;}
function hideStylePreviewArea()
{$('#stylesheet_editinfo').hide();$('#stylesheet_visualarea').hide();$('#stylesheet_info').hide();}
function showStylePreviewArea()
{$('#stylesheet_visualarea').show();$('#stylesheet_editinfo').hide();$('#stylesheet_info').hide();}
function updateStyleRule(styles)
{if(styles!=null&&styles.StyleList!=null)
{var outstyle="";var selectedOutstyle="";for(var i=0;i<styles.StyleList.length;i++)
{var property=styles.StyleList[i].Key;var value=styles.StyleList[i].Value;if(property!=null&&value!=null&&value!='')
{var parsedValue=value;if(parsedValue.search(/url/i)!=-1&&parsedValue.search(/\?/)!=-1)
{var friendlyname=parsedValue.split("?");var remainingText=parsedValue.split(")");if(parsedValue.search(/url/i)!=-1&&friendlyname.length>0)
parsedValue=friendlyname[0]+')'+remainingText[1];}
var newstyle=property+":"+parsedValue+";\n";var newUnparsedStyle=property+":"+value+";\n";outstyle+=newstyle;if(isAcceptablePreviewStyle(newstyle))
{selectedOutstyle+=newUnparsedStyle;}}}
$('#selectedStyleSheetElement_Test select:first').get(0).selectedIndex=0;$('#csspropertychoices').hide();$('#stylesheetPropertyEditor input.csseditimg').hide();$('#selectedStyleSheetElement_Test textarea').val(outstyle);showStylePreviewArea();var stylepreview=picassoGetElementByID();$("#selectedStylePreview").attr('style',selectedOutstyle);ShowVisualCSS(true);return outstyle;}
return"";}
function CssName_OnChange(elem)
{var choicedropdown=picassoGetElementByID('csspropertychoices');if(elem!=null&&elem.selectedIndex>0)
{var selectedOption=elem.options[elem.selectedIndex];var choices=selectedOption.getAttribute('prop-enum');if(choices!=null)
{choices=choices.split(':');if(choices.length>0)
{if(choicedropdown!=null)
{choicedropdown.options.length=0;for(i=0;i<choices.length;++i)
{choicedropdown.options[i]=new Option(choices[i],choices[i]);}
choicedropdown.style.display='block';$('#stylesheetPropertyEditor input').show();return;}}}}
choicedropdown.style.display='none';$('#stylesheetPropertyEditor input').hide();}
function InsertStylePropertyText()
{var lasttext=$('#selectedStyleSheetElement_Test textarea').val();var styleprop=$('#selectedStyleSheetElement_Test select:first').val();var stylechoice=$('#csspropertychoices').val();if(styleprop!=""&&stylechoice!="")
{lasttext=lasttext.replace(/\s+$/g,'');if(lasttext.length>0)
{lasttext=lasttext+"\n";}
var lasttext=lasttext+styleprop+":"+stylechoice+";";$('#selectedStyleSheetElement_Test textarea').val(lasttext);}}
function ApplyCSSToStyle()
{if(stylesheetPropertyID!="")
{cssSelectorInput.renameClick();var text=$('#selectedStyleSheetElement_Test textarea').val();checkBrokenLinksCSS(text,function()
{PicassoWebServices.ManageSite.ApplyCSSToStyle(stylesheetPropertyID,text,"",OnPicassoEditorAJAXCallCompleted);});}}
picassoItemSelection={selectHandlers:{PicassoStyleItem:function(itemID,clientSelect)
{var styles=stylesheetRules[itemID];if(styles!=null)
{currentSelectedClass="";var outstyle=updateStyleRule(styles);var full_selector=styles.SelectorName;$('#selectedStyleSheetElement_Test input.StylesheetTextBox').val(full_selector);stylesheetPropertyID=itemID;$("#rightSidePropertyPanelBody").css('top','26px');$('#customcssInternal').hide();updateVisualCSSEditor(outstyle);if(!clientSelect)
{if(styleTreeState!=null)
{styleTreeState.unselectAll();styleTreeState.activateNode('#stylesheetTree li[treeobjectid='+itemID+']');}}
else
{SelectItemFromItemID(itemID,"","PicassoStyleItem");}}},PicassoStylesheetGroup:function(itemID,clientSelect)
{hideStylePreviewArea();ShowVisualCSS(false);if(!clientSelect)
{if(styleTreeState!=null)
{styleTreeState.unselectAll();styleTreeState.activateNode('#stylesheetTree li[treeobjectid='+itemID+']');}}
else
{SelectItemFromItemID(itemID,"","PicassoStylesheetGroup");}},PicassoStylesheetItem:function(itemID,clientSelect)
{hideStylePreviewArea();$('#stylesheet_editinfo').show();ShowVisualCSS(false);if(!clientSelect)
{if(styleTreeState!=null)
{styleTreeState.unselectAll();styleTreeState.activateNode('#stylesheetTree li[treeobjectid='+itemID+']');}}
else
{SelectItemFromItemID(itemID,"","PicassoStylesheetItem");}},PicassoAssetFileRef:function(itemID,clientSelect)
{if(picassoStudio.currentWorkAreaName=="stylesheetarea")
{hideStylePreviewArea();$('#stylesheet_editinfo').show();ShowVisualCSS(false);if(!clientSelect)
{if(styleTreeState!=null)
{styleTreeState.unselectAll();styleTreeState.activateNode('#stylesheetTree li[treeobjectid='+itemID+']');}}
else
{SelectItemFromItemID(itemID,"","PicassoAssetFileRef");}}
else
{ShowVisualCSS(false);if(!clientSelect)
{if(fileTreeState!=null)
{fileTreeState.unselectAll();fileTreeState.activateNode('#fileTree li[treeobjectid='+itemID+']');}}
else
{SelectItemFromItemID(itemID,"","PicassoAssetFileRef");}}},PicassoDataGroup:function(itemID,clientSelect)
{if(!clientSelect)
{SelectDatabaseObjectFromID_ClientOnly(itemID);}
else
{SelectDatabaseObjectFromID(itemID);}},PicassoDataSourceFilter:function(itemID,clientSelect)
{if(!clientSelect)
{SelectQueryObjectFromID_ClientOnly(itemID);}
else
{SelectQueryObjectFromID(itemID);}},PicassoAssetImageRef:function(itemID,clientSelect)
{ShowVisualCSS(false);if(!clientSelect)
{if(imageTreeState!=null)
{imageTreeState.unselectAll();imageTreeState.activateNode('#imageTree li[treeobjectid='+itemID+']');}}
else
{SelectItemFromItemID(itemID,"","PicassoAssetImageRef");}},PicassoAssetMediaRef:function(itemID,clientSelect)
{ShowVisualCSS(false);if(!clientSelect)
{if(mediaTreeState!=null)
{mediaTreeState.unselectAll();mediaTreeState.activateNode('#mediaTree li[treeobjectid='+itemID+']');}}
else
{SelectItemFromItemID(itemID,"","PicassoAssetMediaRef");}}},doSelect:function(itemID,itemType,clientSelect)
{var sHandler=picassoItemSelection.selectHandlers[itemType];if(sHandler)
{sHandler(itemID,clientSelect);return true;}
return false;}}
function AddMouseHandlers()
{document.onmousemove=picassoMouseMove;document.onmousedown=picassoMouseDown;document.onmouseup=picassoMouseUp;document.ondblclick=picassoMouseDoubleClick;document.oncontextmenu=OnBrowserContextMenu;document.onkeydown=picassoKeyDown;document.onkeyup=picassoKeyUp;}
function KillMouseHandlers()
{document.onmousemove=null;document.onmousedown=null;document.onmouseup=function(ev){ev=ev||window.event;var target=ev.target||ev.srcElement;PicassoPopup.HandleMouseUp(target);}
document.ondblclick=null;document.oncontextmenu=null;document.onkeydown=null;document.onkeyup=null;}
function InitializeDragDrop()
{var pageDesignContents=picassoGetElementByID("pageDesignContents");if(pageDesignContents!=null)
{dropTargets=new Array();dragItems=new Array();if(pageDesignContents.getAttribute('editorDropTarget'))
{dropTargets.push(pageDesignContents);}
RecursiveFindDropTargets(pageDesignContents);showSelectionHandles();}
if(dragHelper!=null)
{dragHelper.style.display='none';}
currentDragObject=null;currentDragObjectInsertBeforeItem=null;currentResizeObject=null;currentDropTarget=null;}
function RecursiveFindDropTargets(element)
{$(element).find('[itemid]').each(function(v,vv)
{dragItems.push(vv);var editorDropTarget=vv.getAttribute("editorDropTarget");if(editorDropTarget!=null)
{dropTargets.push(vv);}});}
var currentMouseDown=false;var lastMouseDown=false;var mouseOffset=null;var currentResizeObject=null;var resizePrevBorder=null;var dragdropPrevBorder=null;var currentDragContainerPosition={x:0,y:0};var currentDragObjectInsertBeforeItem=null;var currentDragObject=null;var currentDropTarget=null;var dragHelper=null;var dropTargets=null;var dragItems=null;var previewHelper=null;Number.prototype.NaN0=function(){return isNaN(this)?0:this;}
function PicassoClientResizeObject()
{this.el=null;this.elPicasso=null;this.dir="";this.grabx=null;this.graby=null;this.width=null;this.height=null;this.left=null;this.top=null;}
function getDirection(ev,el)
{var xPos,yPos,offset,dir;dir="";if(el.getAttribute("itemID")!=null)
{xPos=ev.offsetX;yPos=ev.offsetY;offset=8;if(yPos<offset)
dir+="n";else if(yPos>el.offsetHeight-offset)
dir+="s";if(xPos<offset)
dir+="w";else if(xPos>el.offsetWidth-offset)
dir+="e";}
return dir;}
function picassoResizeObject(ev)
{var el,xPos,yPos,str,xMin,yMin;xMin=8;yMin=8;if(currentResizeObject!=null)
{var pageEditorContainer=picassoGetElementByID("pageEditorContainer");var mousePos=mouseCoords(ev);var x=mousePos.x-currentDragContainerPosition.x;var y=mousePos.y-currentDragContainerPosition.y;var xDiff=0;var yDiff=0;var bHeightAlreadyResized=false;currentResizeObject.el.style.cursor=currentResizeObject.dir+"-resize";if(currentResizeObject.dir.indexOf("e")!=-1)
{var width=Math.max(xMin,currentResizeObject.width+ev.clientX+xDiff-currentResizeObject.grabx);currentResizeObject.el.style.width=width+"px";if(ev.shiftKey)
{currentResizeObject.el.style.height=width*currentResizeObject.height/currentResizeObject.width+"px";bHeightAlreadyResized=true;}}
if(currentResizeObject.dir.indexOf("s")!=-1&&bHeightAlreadyResized==false)
{var height=Math.max(yMin,currentResizeObject.height+ev.clientY+yDiff-currentResizeObject.graby);currentResizeObject.el.style.height=height+"px";if(ev.shiftKey)
{currentResizeObject.el.style.width=height*currentResizeObject.width/currentResizeObject.height+"px";bHeightAlreadyResized=true;}}
if(currentResizeObject.dir.indexOf("w")!=-1)
{var left=Math.min(currentResizeObject.left+ev.clientX+xDiff-currentResizeObject.grabx,currentResizeObject.left+currentResizeObject.width-xMin);var width=Math.max(xMin,currentResizeObject.width-ev.clientX-xDiff+currentResizeObject.grabx);currentResizeObject.el.style.left=left+"px";currentResizeObject.el.style.width=width+"px";}
if(currentResizeObject.dir.indexOf("n")!=-1)
{var top=Math.min(currentResizeObject.top+ev.clientY+yDiff-currentResizeObject.graby,currentResizeObject.top+currentResizeObject.height-yMin);var height=Math.max(yMin,currentResizeObject.height-ev.clientY-yDiff+currentResizeObject.graby);currentResizeObject.el.style.top=top+"px";currentResizeObject.el.style.height=height+"px";}}}
function getReal(el,type,value)
{temp=el;while((temp!=null)&&(temp.tagName!="BODY"))
{if(eval("temp."+type)==value)
{el=temp;return el;}
temp=temp.parentNode;}
return el;}
function picassoKeyDown(ev)
{ev=ev||window.event;var target=ev.target||ev.srcElement;var pageDesignContents=picassoGetElementByID("pageDesignContents");var selectedObject=getSelectedObject();var key=ev.keyCode;var cancelEvent=false;if(handleTreeKeyPress(key))
{ev.returnValue=false;ev.cancelBubble=true;return false;}
if(selectedObject!=null&&isEditorInFocus())
{var moveoffset=ev.shiftKey?10:1;var kPaddingOffset=0;var parentNode=getSelectedObjectParent();switch(target.tagName)
{case"INPUT":case"SELECT":case"TEXTAREA":{}
break;default:{switch(key)
{case 8:{cancelEvent=true;}
break;case 37:{hideSmartTag();if(selectedObject.offsetLeft>0)
{selectedObject.style.left=selectedObject.offsetLeft-moveoffset+kPaddingOffset+"px";}
cancelEvent=true;}
break;case 39:{hideSmartTag();if(selectedObject.offsetLeft+selectedObject.offsetWidth<parentNode.offsetWidth)
{selectedObject.style.left=selectedObject.offsetLeft+moveoffset+kPaddingOffset+"px";}
cancelEvent=true;}
break;case 38:{hideSmartTag();if(selectedObject.offsetTop>0)
{selectedObject.style.top=selectedObject.offsetTop-moveoffset+kPaddingOffset+"px";}
cancelEvent=true;}
break;case 40:{hideSmartTag();if(selectedObject.offsetTop+selectedObject.offsetHeight<parentNode.offsetHeight)
{selectedObject.style.top=selectedObject.offsetTop+moveoffset+kPaddingOffset+"px";}
cancelEvent=true;}
break;case 90:{if(ev.ctrlKey)
{siteManagerLinearUndo();cancelEvent=true;}}
break;case 89:{if(ev.ctrlKey)
{siteManagerLinearRedo();cancelEvent=true;}}
break;}}
break;}}
if(!cancelEvent&&isEditorInFocus())
{switch(target.tagName)
{case"INPUT":case"SELECT":case"TEXTAREA":{}
break;default:{switch(key)
{case 8:{cancelEvent=true;}
break;case 86:{if(ev.ctrlKey)
{pasteItem();cancelEvent=true;}}
break;case 88:{if(ev.ctrlKey)
{cutItem();cancelEvent=true;}}
break;case 46:{handleDeleteKey();cancelEvent=true;}
break;case 67:{if(ev.ctrlKey)
{copyItem();cancelEvent=true;}}
break;}}}}
if(cancelEvent)
{ev.returnValue=false;ev.cancelBubble=true;return false;}
else
{return true;}}
function handleDeleteKey()
{var contextid=picassoStudio.currentWorkAreaID;if(contextid=="pagesWorkareaPanel"&&$("#sitePreviewFrame").length==0)
{deleteItem(true);}
else if(contextid=="stylesheetWorkareaPanel")
{var activeli=styleTreeState.getSelectedLI();if(activeli.size()>0)
{deleteItem(true,activeli.attr('treeobjectid'),"Are you sure you want to delete this stylesheet item?");}}
else if(contextid=="siteListsPanel")
{}}
function copyItem()
{setClipBoardObjectFromSelection();}
function cutItem()
{var currPageID=picassoGetElementByID("currentPageID");var currObjectID=getSelectedObjectItemID();if(currPageID!=null&&currPageID.value==currObjectID)
{alert("Pages cannot be cut!");return;}
setClipBoardObjectFromSelection();deleteItem(false)}
function createLibraryItemFromSelection()
{PicassoWebServices.ManageSite.CreateLibraryItemFromSelection(getSelectedObjectItemID(),OnPicassoEditorAJAXCallCompleted);}
function pasteItem()
{var itemID=getClipBoardObjectID();if(itemID!=null&&itemID!="")
{var containerID=null
var clipObj=getClipBoardObject();var containerID=getSelectedObjectItemID();PicassoWebServices.ManageSite.PasteItem(itemID,containerID,OnPicassoEditorAJAXCallCompleted);}}
function duplicatePage(pageID)
{PicassoWebServices.ManageSite.PasteItem(pageID,"",OnPicassoEditorAJAXCallCompleted);}
function picassoKeyUp(ev)
{ev=ev||window.event;var target=ev.target||ev.srcElement;var selectedObject=getSelectedObject();var key=ev.keyCode;var cancelEvent=false;if(checkTreeKeyPress(key))
{ev.returnValue=false;ev.cancelBubble=true;return false;}
if(selectedObject!=null&&isEditorInFocus())
{switch(target.tagName)
{case"INPUT":case"SELECT":case"TEXTAREA":{}
break;default:{switch(key)
{case 37:case 39:case 38:case 40:{var itemID=getSelectedObjectItemID();var parentNode=getSelectedObjectParent();var containerID=parentNode.getAttribute("itemID");var parentNodePos=getPositionalObject(parentNode);var parentItemHeight=parentNodePos.offsetHeight;var parentItemWidth=parentNodePos.offsetWidth;PicassoWebServices.ManageSite.MoveItem(itemID,containerID,"",selectedObject.offsetLeft,selectedObject.offsetTop,"","",parentItemWidth,parentItemHeight,"px","px",OnPicassoEditorAJAXCallCompleted);cancelEvent=true;}
break;}}
break;}}
if(cancelEvent)
{ev.returnValue=false;ev.cancelBubble=true;return false;}
else
{return true;}}
function picassoPageResize()
{showSelectionHandles();tooltip_removeall();initializePageDesignerClampArea();FixupScrollbars();builderproxylayer.init();}
function initializePageDesignerClampArea()
{clamparea=null;var clamptoarea=$('div.pageDesignerBody');if(clamptoarea.length>0)
{var bodyoffset=clamptoarea.offset();var bodywidth=clamptoarea.width();clamparea={left:bodyoffset.left,right:bodyoffset.left+bodywidth-20,top:bodyoffset.top};}}
function initializeEditorClampArea()
{clamparea=null;var clamptoarea=$('#ctl00_wizardContentPanel');if(clamptoarea.length>0)
{var bodyoffset=clamptoarea.offset();var bodywidth=clamptoarea.width();clamparea={left:bodyoffset.left+20,right:bodyoffset.left+bodywidth-20,top:bodyoffset.top};}}
function doItemCommand(command,argument,validateGrp,postbacktrigger)
{if(typeof window.event!="undefined")
{window.event.returnValue=false;window.event.cancelBubble=true;}
return false;}
function createDragHelper()
{var pageEditorContainer=picassoGetElementByID("pageDesignerBodyID");dragHelper=document.createElement('DIV');dragHelper.style.cssText='position:absolute;display:none; z-index: 999;';pageEditorContainer.appendChild(dragHelper);return dragHelper;}
function picassoBeginResizeElementEvent(ev)
{ev=ev||window.event;var target=ev.target||ev.srcElement;var resizeDirection=target.resizeDirection;var picassoObject=getSelectedObject();if(picassoObject!=null)
{var disableResize=picassoObject.getAttribute("editorResizeDisabled");if(disableResize==null)
{currentResizeObject=new PicassoClientResizeObject();var positionalObj=getPositionalObject(picassoObject);currentResizeObject.el=positionalObj;currentResizeObject.elPicasso=picassoObject;currentResizeObject.dir=resizeDirection;currentResizeObject.grabx=ev.clientX;currentResizeObject.graby=ev.clientY;currentResizeObject.width=positionalObj.offsetWidth;currentResizeObject.height=positionalObj.offsetHeight;currentResizeObject.left=positionalObj.offsetLeft;currentResizeObject.top=positionalObj.offsetTop;hideSelectionHandles();hideSmartTag();resizePrevBorder=picassoObject.style.border;$(picassoObject).css('border','1px dashed blue');contexthelp_show(String.Format("resize-{0}",resizeDirection));}
ev.cancelBubble=true;return false;}
else
{currentResizeObject=null;}}
function getParentContainerItem(element,seek_parent)
{if(element.rowSpan!=null)
{return element.parentNode;}
if(seek_parent==true)
{element=getPicassoParentTarget(element);if(element==null)
{return null;}}
return element;}
function removePanelHeader(element,seek_parent)
{var existingItem=picassoGetElementByID("itemSelectionHeader");if(existingItem!=null)
{existingItem.parentNode.removeChild(existingItem);}}
function selectFromChildElements(button)
{var currentElement=getSelectedObject();var selectList=recursiveFindChildElements(currentElement);var div=document.createElement("DIV");div.className="selectChildElementMenu";button.parentNode.appendChild(div);if(selectList!="")
{div.innerHTML=selectList;}
else
{div.innerHTML="No children";}}
function recursiveFindChildElements(element)
{var nodes="";for(var i=0;i<element.childNodes.length;i++)
{var child=element.childNodes[i];if(child.getAttribute!=undefined)
{var id=child.id;var itemID=child.getAttribute("itemID");var name=child.getAttribute("itemname");if(itemID!=null&&name!=null)
{nodes+=String.Format("<li><a href='javascript:void(0);' onclick='javascript:SelectItemFromItemID(\"{0}\", \"{1}\");'>{2}</a></li>",itemID,id,name);}
if(child.childNodes.length!=0)
{var children=recursiveFindChildElements(child);if(children!="")
{nodes+=String.Format("<li>{0}</li>",children);}}}}
if(nodes!="")
{return String.Format("<ul>{0}</ul>",nodes);}
else
{return"";}}
function selectParentElement(button)
{var currentElement=getSelectedObject();if(currentElement!=null)
{var parentElement=getParentContainerItem(currentElement.parentNode,true);if(parentElement!=null)
{var itemID=parentElement.getAttribute("itemID");SelectItemFromItemID(itemID,parentElement.id);}}}
function elementHasParent(element)
{var parentContainerItem=getParentContainerItem(element.parentNode,true);if(parentContainerItem!=null&&parentContainerItem.id!="pageDesignContents")
{if(element.rowSpan!=null)
{return true;}
if(parentContainerItem!=element.parentNode)
{return true;}}
return false;}
function elementHasChildren(element)
{return recursiveFindChildElements(element)!="";}
function createPanelHeader(element,seek_parent)
{if(element==null)
return;if(element.id=="pageDesignContents")
{return;}
if(picassoContentEditor&&picassoContentEditor.isEditorEnabled())
{return;}
var selectedObject=getSelectedObject();var postype=element.getAttribute("containerLayoutMode");var elementScope=element.getAttribute("elementscope");var elementName=element.getAttribute("itemname");var selectionHandlesContainerContainer=picassoGetElementByID("pageEditorContainer");var smartTagContainerPosition=getPosition(selectionHandlesContainerContainer);var selectionHandlesContainer=picassoGetElementByID("selectionHandlesContainer");var selectedObjectPosition=getPosition(element);selectedObjectPosition.x-=smartTagContainerPosition.x;selectedObjectPosition.y-=smartTagContainerPosition.y;var height=20;var top=selectedObjectPosition.y-height;var left=selectedObjectPosition.x;var width=element.offsetWidth;if(width>15)
{var newItem=document.createElement("DIV");var isMiniMode=(width<130);var isTinyMode=(width<60);newItem.id="itemSelectionHeader";newItem.className="modtitle";newItem.selectItemElement=element;var innerTxt="";if(isPicassoStudio)
{if(!isTinyMode)
{if(elementHasParent(element))
{innerTxt+="<a class='selectBox selectParentBox' onclick=\"javascript:selectParentElement(this);\" href='javascript:void(0)' title='Select Parent Element'></a>";}
else
{innerTxt+="<a class='selectBox selectParentBoxDisabled'></a>";}}
if(!isTinyMode&&!isMiniMode)
{if(elementHasChildren(element))
{innerTxt+="<a class='selectBox selectChildBox' onclick=\"javascript:selectFromChildElements(this);\" href='javascript:void(0)' title='Select from Children Elements'></a>";}
else
{innerTxt+="<a class='selectBox selectChildBoxDisabled'></a>";}}}
if(isPicassoStudio&&element.getAttribute("elementscope")=="Local")
{innerTxt+="<a class='delbox' onclick=\"deleteItem(true,'"+element.getAttribute("itemID")+"'); return false;\" href='javascript:void(0)' title='Delete'></a>";}
var disableDrag=null;if(selectedObject!=null)
{disableDrag=selectedObject.getAttribute("editorDragDisabled");if(selectedObject.getAttribute("editorControlURL")!=null)
{if(isMiniMode)
{innerTxt+="<a class='propbox' onclick='activateCurrentObject(); return false;' href='javascript:void(0);' title='Edit'></a>";}
else
{innerTxt+="<a class='propbox_large' onclick='activateCurrentObject(); return false;' href='javascript:void(0);' title='Edit'></a>";}}
if(selectedObject.getAttribute("picasso-editable-content")!=null&&selectedObject.getAttribute("picasso-editable-content-type")!="plain")
{var itemID=selectedObject.getAttribute("itemID");var url="startModalDialogWithItemID(\"Editors/HTMLWidgetEditor.aspx\");"
if(isMiniMode)
{innerTxt+="<a class='htmlbox' onclick='"+url+"; return false;' href='javascript:void(0);' title='Edit HTML'></a>";}
else
{innerTxt+="<a class='htmlbox_large' onclick='"+url+";return false;' href='javascript:void(0);' title='Edit HTML'></a>";}}
if(selectedObject.getAttribute("picasso-data-bindable")!=null)
{var itemID=selectedObject.getAttribute("picasso-data-bindable-id");if(itemID==null||itemID=="")
{itemID=selectedObject.getAttribute("itemID");}
var url=String.Format("picassoLists.createDataFilter(\"{0}\");",itemID);if(isMiniMode)
{innerTxt+="<a class='filterbox' onclick='"+url+"; return false;' href='javascript:void(0);' title='Edit Query'></a>";}
else
{innerTxt+="<a class='filterbox_large' onclick='"+url+";return false;' href='javascript:void(0);' title='Edit Query'></a>";}}
if(selectedObject.getAttribute("repeater-item")!=null)
{innerTxt+="<a style='float:right;' onclick='StartDataLinkDialog(); return false;' href='javascript:void(0);' title='Add Data Link'><img style='width:12px;height:12px;margin:4px;' src='/SMSystem/Images/icons/lightning.png?version=2009.9856' /></a>";}}
if(isPicassoStudio)
{innerTxt+="<a id='contextMenuLinker' class='panelheader_actions' onclick='showContextMenuAtMouse(event); return false;' href='javascript:void(0);' title='Context Menu'></a>";var dtAttrib=element.getAttribute("editorDropTarget");if(dtAttrib!=null&&dtAttrib.indexOf('EditorFormDropTarget')<0)
{var lockClass="dropTargetLock";if(g_DropTargetLockID!=null&&g_DropTargetLockID==element.id)
{lockClass="dropTargetUnlock";newItem.style.backgroundColor=kPanelHeaderTargetLockBackgroundColor;}
innerTxt+="<a id='targetLockIcon' class='"+lockClass+"' onclick='setTargetLock(this); return false;' href='javascript:void(0);' title='Drop Target Lock'></a>";}}
innerTxt+="<div style='clear:both;'/>";newItem.style.left=left+"px";newItem.style.width=width+"px";newItem.style.top=top+"px";newItem.style.height=height+"px";newItem.style.position="absolute";if(disableDrag!=null)
{newItem.style.cursor='default';}
var existingItem=picassoGetElementByID("itemSelectionHeader");if(existingItem!=null)
{existingItem.parentNode.removeChild(existingItem);}
selectionHandlesContainer.appendChild(newItem);newItem.innerHTML=innerTxt;for(var newi=0;newi<newItem.childNodes.length;newi++)
{var child=newItem.childNodes[newi];if(child.id=="panelHeader_scope"||child.id=="panelHeader_name")
{child.selectItemElement=element;}}}}
function onContextMenuCommand(commandstr)
{PicassoWebServices.ManageSite.OnContextMenuCommand(getSelectedObjectItemID(),commandstr,OnPicassoEditorAJAXCallCompleted);}
function addContextMenuItem(container,name,id,command)
{var cmd=document.createElement("DIV");cmd.id=id;cmd.className="pagePopupItem";var cmd_a=document.createElement("A");cmd.appendChild(cmd_a);container.get(0).appendChild(cmd);cmd_a.innerHTML=name;cmd_a.onclick=function()
{if(typeof(command)=="string")
{if(command.indexOf("javascript:")==0)
{eval(command);}
else
{onContextMenuCommand(command);}}
else
{command();}
container.hide();};}
function updateTargetLockStyle()
{if(g_DropTargetLockID!=null)
{var sb=picassoGetElementByID(g_DropTargetLockID);var prx=$(sb).data('proxy');if(prx!=null)
{prx.css('outline',kTargetLockBorder);}}}
function refreshTargetLockStyle()
{if(g_DropTargetLockID!=null)
{setTimeout('updateTargetLockStyle();',0);}}
function clearDropTarget()
{if(g_DropTargetLockID==null)
{return;}
var pItem=picassoGetElementByID(g_DropTargetLockID+"selectionBlock");if(pItem!=null)
{pItem.style.outline=kUnselectedBorder;}
g_DropTargetLockID=null;}
function setTargetLock(iconElement)
{var newLock=iconElement.parentNode.selectItemElement;if(g_DropTargetLockID!=null&&g_DropTargetLockID==newLock.id)
{clearDropTarget();iconElement.className="dropTargetLock";iconElement.parentNode.style.backgroundColor="";}
else
{clearDropTarget();g_DropTargetLockID=newLock.id;iconElement.className="dropTargetUnlock";iconElement.parentNode.style.backgroundColor=kPanelHeaderTargetLockBackgroundColor;}}
function addContextMenuSeparator(container)
{var cmd=document.createElement("DIV");cmd.className="pagePopupItemSeparator";container.get(0).appendChild(cmd);}
function showContextMenuAtMouse(ev,bOutsideEditor,selectedItem)
{var editorContainer=picassoGetElementByID("pageEditorContainer");if(editorContainer!=null)
{var mousePosition=mouseCoords(ev);var editorPos=getPosition(editorContainer);if(typeof(editorPos)!='undefined')
{mousePosition.x-=editorPos.x;mousePosition.y-=editorPos.y;}
if(bOutsideEditor!=true)
{mousePosition.x=Math.max(0,mousePosition.x);mousePosition.y=Math.max(0,mousePosition.y);}
if(typeof(selectedItem)!="undefined")
{showContextMenuWithSelectedItem(selectedItem,mousePosition.x,mousePosition.y);}
else
{var contextMenuLinker=document.getElementById("contextMenuLinker");showContextMenu(contextMenuLinker,mousePosition.x,mousePosition.y);}}}
function showContextMenu(menuLink,left,top)
{var currItem=menuLink.parentNode.selectItemElement;if(left==null||top==null)
{var pos=getStudioPosition(menuLink);left=pos.x;top=pos.y+$(menuLink).height();}
showContextMenuWithSelectedItem(currItem,left,top);}
function showContextMenuWithSelectedItem(currItem,left,top)
{var container=$('#contextMenuPopup');if(container!=null)
{var containerNode=container.get(0);while(containerNode.childNodes.length>0)
{containerNode.removeChild(containerNode.childNodes[0]);}
containerNode.style.top=top+"px";containerNode.style.left=left+"px";containerNode.style.position="absolute";if(typeof(currItem)!="undefined")
{if(currItem.getAttribute("editorControlURL")!=null)
{addContextMenuItem(container,"Edit","contextMenuEdit",activateCurrentObject);}
if(currItem.getAttribute("picasso-editable-content")!=null&&currItem.getAttribute("picasso-editable-content-type")!="plain")
{addContextMenuItem(container,"Edit HTML","contextMenuEdit",function(){startModalDialogWithItemID("Editors/HTMLWidgetEditor.aspx");});}
if(currItem.getAttribute("picasso-data-bindable")!=null)
{var itemID=currItem.getAttribute("picasso-data-bindable-id");if(itemID==null||itemID=="")
{itemID=currItem.getAttribute("itemID");}
addContextMenuItem(container,"Edit Query","contextMenuEdit",function(){picassoLists.createDataFilter(itemID)});}}
addContextMenuItem(container,"Publish","contextMenuPublish",publishItemChanges);addContextMenuItem(container,"History","contextMenuHistory",showElementHistory);addContextMenuSeparator(container);addContextMenuItem(container,"Delete","contextMenuDelete",handleDeleteKey);addContextMenuItem(container,"Cut","contextMenuCut",cutItem);addContextMenuItem(container,"Copy","contextMenuCopy",copyItem);addContextMenuItem(container,"Paste","contextMenuPaste",pasteItem);if(typeof(currItem)!="undefined")
{var cmds=currItem.getAttribute("contextMenuCommands");if(cmds!=null)
{addContextMenuSeparator(container);var cmdPairList=cmds.split("##");for(var i=0;i<cmdPairList.length;i++)
{var cmdPair=cmdPairList[i].split("$$");if(cmdPair.length==2)
{addContextMenuItem(container,cmdPair[0],"contextMenuCmd_"+i,cmdPair[1]);}}}}
if(currItem.getAttribute("nolib")==null)
{addContextMenuSeparator(container);addContextMenuItem(container,"Create Library Item","contextMenuLibraryItem",createLibraryItemFromSelection);addContextMenuItem(container,"Create Extension","contextMenuWidget",createWidgetWithSelection);}
_gPopupActive=true;container.show();}}
function toggleAutoheight(guidid,currentAH)
{var newmode="True"
if(currentAH=="true")
{newmode="False";}
PicassoWebServices.ManageSite.UpdateProperty(guidid,"AutoHeight",newmode,OnPicassoEditorAJAXCallCompleted);}
function checkTargetForHeader(obj)
{if(obj!=null)
{var sobj=obj;while(sobj!=null)
{if(sobj.getAttribute==undefined)
{break;}
else
{if(typeof(sobj.selectItemElement)!="undefined")
return sobj.selectItemElement;sobj=sobj.parentNode;}}}
return obj;}
function picassoMouseDown(ev)
{ev=ev||window.event;var button=ev.button;if(ev.which!=undefined)
{button=ev.which;}
currentResizeObject=null;currentDragObject=null;currentDragObjectInsertBeforeItem=null;currentDropTarget=null;last_mouseDownPosition=mouseCoords(ev);currentDragContainerPosition=getScrollPosition(picassoGetElementByID("pageDesignerBodyID"));if(button==1)
{var target=ev.target||ev.srcElement;if(activeObject!=null&&activeObject.id!=target.id&&!getIsChildOf(picassoGetElementByID("renameContainer"),target)&&typeof activeObject.blur=="function")
{activeObject.blur();activeObject=null;}
if($(target).parents('.simpleTree').length>0)
{g_activeTree=$(target).parents('.simpleTree');}
else
{g_activeTree=undefined;}
if(typeof PicassoPopup!="undefined"&&PicassoPopup.HandleMouseDown(target))
{return false;}
if(placeItemPopup.isChildOf(target))
{return false;}
if(getIsChildOf(picassoGetElementByID("pageHierarchyWrapper"),target))
{return false;}
if(getIsChildOf(picassoGetElementByID("contextMenuPopup"),target))
{return false;}
var picassoObject=getPicassoDragObject(target);if(isPosInScrollArea(picassoObject,last_mouseDownPosition))
{return false;}
var picassoHelpID=tooltip_getHelpIDFromTarget(target);if(picassoHelpID!=""&&isEditorInFocus())
{contexthelp_show(picassoHelpID);}
currentMouseDown=true;lastMouseDown=false;if(picassoObject!=null)
{var itemID=picassoObject.getAttribute("itemID");if(itemID!=null)
{var disableDrag=picassoObject.getAttribute("editorDragDisabled");if(disableDrag==null)
{currentDragObject=picassoObject;if(picassoObject.parentNode!=null)
{currentDragObject.setAttribute('parentNodeLastID',picassoObject.parentNode.id);}}}
else
{var itemtype=picassoObject.getAttribute("createitemtype");if(itemtype!=null&&itemtype!="")
{currentDragObject=picassoObject;}}
$('#pageEditorContainer').trigger('onitemselected');}
var pageEditorContainer=picassoGetElementByID("pageEditorContainer");var picassoHeaderContainer=picassoGetElementByID("picassoHeader");var picassoBodyContainer=picassoGetElementByID("picassoBody");if(getIsChildOf(picassoBodyContainer,target)||getIsChildOf(picassoHeaderContainer,target)||getIsChildOf(pageEditorContainer,target)||currentDragObject!=null||currentResizeObject!=null)
{hidePopups();}
if(currentDragObject!=null||currentResizeObject!=null)
{return false;}}
return true;}
function picassoMouseDoubleClick(ev)
{ev=ev||window.event;var target=ev.target||ev.srcElement;target=checkTargetForHeader(target);var picassoObject=getPicassoDragObject(target);if(picassoObject!=null)
{SelectItemFromItemID(picassoObject.getAttribute("itemID"),picassoObject.id,picassoObject.getAttribute("itemToolbarID"));activateCurrentObject();}}
function SelectObjectFromDomID(itemID)
{var jq_elem=$('#'+itemID);SelectItemFromItemID(jq_elem.attr("itemID"),jq_elem.attr("id"),jq_elem.attr("itemToolbarID"));}
function getItemTree_OnComplete(result)
{placeItemPopup.ajaxInProgress=false;if(result!=null)
{$('#pageHTree2').remove();if(typeof pageHTreeState2=="undefined")
{pageHTreeState2=new treeState();}
var treeoptions={showChildrenOnFilter:true,hideActionMenu:true,nodeFilter:function(node)
{var desiredDropTarget=placeItemPopup.selectedItemNode.getAttribute('droptargettype');var supported=false;if(desiredDropTarget&&node.ExtraClasses!=null&&node.ExtraClasses!="")
{var supportedTargets=node.ExtraClasses.split("_");for(var trgt=1;trgt<supportedTargets.length;trgt++)
{if(supportedTargets[trgt]==desiredDropTarget)
{supported=true;break;}}}
return supported;}};createTreeFromJSON(result,$('#placementTreeView').html('').get(0),treeoptions);if($('#pageHTree2 li.root li').length==0)
{placeItemPopup.showEmpty();}
else
{pageHTreeState2.init('#pageHTree2',{drag:false,allowDragInRoot:true,selectActive:function(rootUL)
{pageHTreeState2.activateNode('#pageHTree2 ul li:first[treeobjectid]');}});}
var $pip=$('#placeItemPopup');var $inner_pip=$('#placementTreeView');$inner_pip.css('height','');var bottom=$pip.height()+$pip.offset().top+30;var docheight=$(window).height();if(bottom>docheight)
{var diff=bottom-docheight;var inner_height=$inner_pip.height();inner_height=inner_height-diff;if(inner_height<40)
{inner_height=40;}
$inner_pip.height(inner_height);}}
else
{placeItemPopup.showEmpty();}}
function picassoMouseUp(ev){ev=ev||window.event;var target=ev.target||ev.srcElement;if(getIsChildOf(picassoGetElementByID("contextMenuPopup"),target))
{return false;}
if(getIsChildOf(picassoGetElementByID("pageHierarchyWrapper"),target))
{return false;}
if(getIsChildOf(picassoGetElementByID("selectionPathPanel"),target))
{return false;}
var picassoObject=getPicassoDragObject(target);if((currentDragObject==null&&currentResizeObject==null)&&isPosInScrollArea(picassoObject,last_mouseDownPosition))
{return false;}
var button=ev.button;if(ev.which!=undefined)
{button=ev.which;}
if(typeof PicassoPopup!="undefined"&&PicassoPopup.HandleMouseUp(target))
{return false;}
if(typeof visualCSSEditor!="undefined"&&visualCSSEditor)
{if(visualCSSEditor.isAddNewClassModeEnabled()&&!getIsChildOf(picassoGetElementByID("classAddEditArea"),target))
CancelClassEdit();if(visualCSSEditor.isAddNewIDModeEnabled()&&!getIsChildOf(picassoGetElementByID("IDAddEditArea"),target))
CancelIDEdit();}
if(target!=null&&target.className.indexOf("pagePopupItem")<0)
{hideContentMenu();}
document.body.style.cursor='';var lastmousepos=last_mouseDownPosition;last_mouseDownPosition=null;currentMouseDown=false;if(target!=null&&target.className.indexOf('toolboxItem')>=0)
{if(lastmousepos!=null)
{var mousePosition=mouseCoords(ev);var distx=lastmousepos.x-mousePosition.x;var disty=lastmousepos.y-mousePosition.y;if((distx*distx+disty*disty)<8*8)
{placeItemPopup.select(target);return false;}}}
if(picassoObject==null)
{var selectionHandles=picassoGetElementByID("selectionHandles");if(getIsChildOf(selectionHandles,target))
{picassoObject=getSelectedObject();}}
if(button!=1)
{if(picassoObject!=null)
{SelectItemFromItemID(picassoObject.getAttribute("itemID"),picassoObject.id,picassoObject.getAttribute("itemToolbarID"));if($.browser.msie)
{showContextMenuAtMouse(ev);}
else
{setTimeout(function(){showContextMenuAtMouse(ev)},50);}}}
else
{if(currentResizeObject!=null)
{currentResizeObject.width=$(currentResizeObject.el).width();currentResizeObject.height=$(currentResizeObject.el).height();currentResizeObject.top=currentResizeObject.el.offsetTop;currentResizeObject.left=currentResizeObject.el.offsetLeft;OnResizeCallback(currentResizeObject);currentResizeObject=null;}
else if(currentDragObject!=null)
{var mousePosition=mouseCoords(ev);if(currentDropTarget!=null)
{var dropTargetPosition=getScrollPosition(currentDropTarget);var dragItemHelperPosition=getScrollPosition(dragHelper);var offsetX=dragItemHelperPosition.x-dropTargetPosition.x;var offsetY=dragItemHelperPosition.y-dropTargetPosition.y;{setStudioBorder(currentDropTarget,kUnselectedBorder);}
if(getIsMoving(currentDragObject)&&currentDragObject.style.position!='absolute')
{var dragObjectPosition=getScrollPosition(currentDragObject);var newposx=-currentDragContainerPosition.x+(dragObjectPosition.x);var newposy=-currentDragContainerPosition.y+(dragObjectPosition.y);$(dragHelper).animate({"top":newposy+"px","left":newposx+"px"},'slow');}
OnDropCallback(currentDragObject,currentDropTarget,currentDragObjectInsertBeforeItem,offsetX,offsetY);}
else
{{if(dragdropPrevBorder!=null)
{if($.browser.msie)
{currentDragObject.style.border=dragdropPrevBorder;}
else
{currentDragObject.style.outline=dragdropPrevBorder;}}
if(dragHelper!=null&&dragHelper.innerHTML!="")
{dragHelper.innerHTML="";dragHelper.style.display="none";PicassoWebServices.ManageSite.RefreshPage(OnPicassoEditorAJAXCallCompleted);}
SelectItemFromItemID(currentDragObject.getAttribute("itemID"),currentDragObject.id,currentDragObject.getAttribute("itemToolbarID"));}}
currentDragObject=null;dragdropPrevBorder=null;}
else if(picassoObject!=null)
{SelectItemFromItemID(picassoObject.getAttribute("itemID"),picassoObject.id,picassoObject.getAttribute("itemToolbarID"));}
else if(getIsChildOf(picassoGetElementByID("pageDesignerBodyID"),target)&&!getIsChildOf(picassoGetElementByID("selectionHandlesContainer"),target))
{var currentPageIDField=picassoGetElementByID("currentPageID");var currentPageType=picassoGetElementByID("currentPageType");if(currentPageIDField!=null&&currentPageType!=null)
{var currentPageID=currentPageIDField.value;SelectItemFromItemID(currentPageID,"",currentPageType.value);hideSelectionHandles();}}}
refreshTargetLockStyle();return true;}
function picassoGetContainer(picassoObject)
{if(picassoObject!=undefined&&picassoObject!=null&&picassoObject.parentNode!=null)
{return picassoObject.parentNode.parentNode;}
return null;}
function startMouseMove(ev)
{mouseOffset=getMouseOffset(currentDragObject,ev);hideSelectionHandles();showToolbar(null);if(dragHelper==null)
{dragHelper=createDragHelper();}
dragHelper.innerHTML="";var dragVisualID=currentDragObject.getAttribute("dragitemvisual");var dragVisualNode=null;if(dragVisualID!=null)
{CacheImageAsset(currentDragObject);dragVisualNode=picassoGetElementByID(dragVisualID);}
if(dragVisualNode==null)
{dragVisualNode=currentDragObject;}
if(!getIsMoving(currentDragObject))
{currentDragObject=currentDragObject.cloneNode(true);}
var cloneNode=dragVisualNode.cloneNode(true);var cloneNodeWidth=cloneNode.style.width;var cloneNodeHeight=cloneNode.style.height;if(cloneNodeWidth==""||cloneNodeWidth.indexOf("%")>0)
{cloneNode.style.width=dragVisualNode.offsetWidth+"px";}
if(cloneNodeHeight==""||cloneNodeHeight.indexOf("%")>0)
{cloneNode.style.height=dragVisualNode.offsetHeight+"px";}
cloneNode.style.position='relative';cloneNode.style.top="0px";cloneNode.style.left="0px";cloneNode.style.display="";if(parseInt(cloneNode.style.width)==0)
{cloneNode.style.width="100px";}
if(parseInt(cloneNode.style.height)==0)
{cloneNode.style.height="20px";}
dragHelper.appendChild(cloneNode);createPanelHeader(cloneNode,true);if(getIsMoving(currentDragObject))
{var objcontainer=picassoGetContainer(currentDragObject);if(objcontainer!=null)
{var autoheight_enabled=objcontainer.getAttribute("picasso-autoheight");if(autoheight_enabled)
{var height2=parseInt($(objcontainer).height());{$(objcontainer).css('height',height2);}}}
currentDragObject.style.display='none';removePanelHeader(currentDragObject);}
if(dropTargets==null)
return false;dragHelper.style.display='block';contexthelp_show("dragPicassoItem");for(var i=0;i<dropTargets.length;i++)
{if(dropTargets[i].id=="pageDesignContents")
{var fullpageElem=document.getElementById("pageDesignerBodyID");var pos=getScrollPosition(dropTargets[i]);var fullpos=getScrollPosition(fullpageElem);dropTargets[i].setAttribute('startWidth',parseInt(dropTargets[i].offsetWidth));dropTargets[i].setAttribute('startHeight',parseInt(fullpageElem.offsetHeight));dropTargets[i].setAttribute('startLeft',pos.x);dropTargets[i].setAttribute('startTop',fullpos.y);}
else
{with(dropTargets[i])
{var pos=getScrollPosition(dropTargets[i]);setAttribute('startWidth',parseInt(offsetWidth));setAttribute('startHeight',parseInt(offsetHeight));setAttribute('startLeft',pos.x);setAttribute('startTop',pos.y);}}}
for(var i=0;i<dragItems.length;i++)
{with(dragItems[i])
{var pos=getScrollPosition(dragItems[i]);setAttribute('startWidth',parseInt(offsetWidth));setAttribute('startHeight',parseInt(offsetHeight));setAttribute('startLeft',pos.x);setAttribute('startTop',pos.y);}}}
function setStudioBorder(obj,borderStr)
{if(obj==null)
{return;}
var sb=obj;if(sb!=null)
{{$(sb).css('outline',borderStr).show();}}
else
{}}
function findPlaceHolder(elem)
{if(elem.id=="pageDesignContents")
{return $("> div.pagePlaceHolder",elem).get(0);}
return $("> div div.panelPlaceHolder",elem).get(0);}
function removeDropTargetDecoration(dropTarget,dragObject)
{setStudioBorder(dropTarget,kUnselectedBorder);if(dragObject.style.position!='absolute'&&dropTarget.getAttribute('itemtoolbarid')!='PicassoTableContainerItem')
{if($(dropTarget).css('padding-bottom')=='20px')
{$(dropTarget).css('padding-bottom','');}
if($(dropTarget).css('padding-top')=='20px')
{$(dropTarget).css('padding-top','');}}
var ph=findPlaceHolder(dropTarget);if(ph!=null)
$(ph).show();removePanelHeader(dropTarget);}
function picassoMouseMove(ev)
{ev=ev||window.event;var target=ev.target||ev.srcElement;var cancelBubble=false;var tooltipdelay=500;var picassoHelpID=tooltip_getHelpIDFromTarget(target);if(picassoHelpID=="templateDescription")
{tooltipdelay=50;}
tooltip_onmousemove(ev,tooltipdelay,clamparea);if(currentResizeObject!=null)
{picassoResizeObject(ev);cancelBubble=true;}
else if(currentMouseDown&&currentDragObject)
{var xDiff=0;var yDiff=0;var mousePosition=mouseCoords(ev);if(last_mouseDownPosition!=null)
{var distx=last_mouseDownPosition.x-mousePosition.x;var disty=last_mouseDownPosition.y-mousePosition.y;if((distx*distx+disty*disty)<kDragMouseMoveThreshholdSqr)
{return false;}}
if(!lastMouseDown)
{startMouseMove(ev);}
if(dragHelper!=null)
{var xPos=mousePosition.x-mouseOffset.x-currentDragContainerPosition.x;var yPos=mousePosition.y-mouseOffset.y-currentDragContainerPosition.y;document.body.style.cursor='move';dragHelper.style.position='absolute';dragHelper.style.top=yPos+"px";dragHelper.style.left=xPos+"px";if(getIsMoving(currentDragObject))
{$(dragHelper).css('opacity',0.6);}
var newDropTarget=null;var desiredDropTarget=currentDragObject.getAttribute("droptargettype");if(dropTargets==null)
return false;for(var i=0;i<dropTargets.length;i++)
{var dt=dropTargets[i];if(g_DropTargetLockID!=null&&g_DropTargetLockID!=dt.id)
{continue;}
var supported=false;var dtAttrib=dt.getAttribute("editorDropTarget");if(dtAttrib!=null)
{var supportedTargets=dtAttrib.split(",");for(var trgt=0;trgt<supportedTargets.length;trgt++)
{if(supportedTargets[trgt]==desiredDropTarget)
{supported=true;break;}}}
if(supported)
{if((parseInt(dt.getAttribute('startLeft'))<mousePosition.x)&&(parseInt(dt.getAttribute('startTop'))<mousePosition.y)&&((parseInt(dt.getAttribute('startLeft'))+parseInt(dt.getAttribute('startWidth')))>mousePosition.x)&&((parseInt(dt.getAttribute('startTop'))+parseInt(dt.getAttribute('startHeight')))>mousePosition.y))
{newDropTarget=dt;}}}
var bShouldCreateNewHeader=false;if(currentDropTarget!=newDropTarget)
{if(currentDropTarget!=null)
{removeDropTargetDecoration(currentDropTarget,currentDragObject);}
if(newDropTarget!=null)
{setStudioBorder(newDropTarget,kDropContainerHoverBorder);if(currentDragObject.style.position!='absolute')
{if($(newDropTarget).css('padding-bottom')=='0px')
{$(newDropTarget).css('padding-bottom','20px');}
if($(newDropTarget).css('padding-top')=='0px')
{$(newDropTarget).css('padding-top','20px');}}
var ph=findPlaceHolder(newDropTarget)
if(ph!=null)
$(ph).hide();bShouldCreateNewHeader=true;}}
currentDropTarget=newDropTarget;if(currentDropTarget!=null)
{currentDragObjectInsertBeforeItem=null;var dropTargetChildContainer=currentDropTarget;var table_reorder=null;var isCellDropTarget=currentDropTarget.rowSpan!=null;if(currentDropTarget.id!="pageDesignContents"&&!isCellDropTarget)
{dropTargetChildContainer=PicassoGetFirstChildElement(currentDropTarget);if(dropTargetChildContainer==null)
{dropTargetChildContainer=currentDropTarget;}}
if(dropTargetChildContainer!=null&&dropTargetChildContainer.rows!=null)
{if(dropTargetChildContainer.rows.length>0&&dropTargetChildContainer.rows[0].cells.length>0)
{var tdContainingTable=dropTargetChildContainer.rows[0].cells[0];if(tdContainingTable!=null&&tdContainingTable.childNodes!=null)
{if(tdContainingTable.childNodes.length>0&&tdContainingTable.childNodes[0].rows!=null)
{if(tdContainingTable.childNodes[0].rows.length>0&&tdContainingTable.childNodes[0].rows[0].getAttribute("itemID")!=null)
{table_reorder=tdContainingTable.childNodes[0];}}
else if(tdContainingTable.childNodes[0].tagName=="FIELDSET")
{dropTargetChildContainer=tdContainingTable.childNodes[0].childNodes[1];}
else if(tdContainingTable.childNodes[0].tagName=="UL")
{dropTargetChildContainer=tdContainingTable.childNodes[0];}}}}
if(table_reorder!=null)
{var lowestAfter=999999;for(i=0;i<table_reorder.rows.length;i++)
{var currentSibling=table_reorder.rows[i];if(currentSibling!=currentDragObject)
{var startTop=parseInt(currentSibling.getAttribute('startTop'));var startHeight=parseInt(currentSibling.getAttribute('startHeight'));var posY=startTop+startHeight/2;if(mousePosition.y<posY&&posY<lowestAfter)
{lowestAfter=posY;currentDragObjectInsertBeforeItem=currentSibling;}}}
if(currentDragObject.cells!=null)
{if(currentDragObject.cells.length>0)
{currentDragObject.cells[0].style.border=kDropTargetHoverBorder;}
if(currentDragObject.cells.length>1)
{currentDragObject.cells[1].style.border=kDropTargetHoverBorder;}}}
else
{for(var i=dropTargetChildContainer.childNodes.length-1;i>=0;i--)
{var currentSibling=dropTargetChildContainer.childNodes[i];if(currentSibling.nodeName!='#text'&&currentSibling!=currentDragObject)
{var startLeft=parseInt(currentSibling.getAttribute('startLeft'));var startTop=parseInt(currentSibling.getAttribute('startTop'));var startHeight=parseInt(currentSibling.getAttribute('startHeight'));if(currentSibling.style.styleFloat=="left"&&currentDragObject.style.styleFloat=="left")
{if(mousePosition.x<startLeft+30)
{currentDragObjectInsertBeforeItem=currentSibling;}}
else if(mousePosition.y<startTop+startHeight/2)
{currentDragObjectInsertBeforeItem=currentSibling;}}}}
var isCellObjTarget=dropTargetChildContainer!=null&&dropTargetChildContainer.rowSpan!=null;if(isCellObjTarget==false)
{var iterCell=dropTargetChildContainer;while(iterCell.parentNode!=null)
{iterCell=iterCell.parentNode;if(iterCell!=null&&iterCell.rowSpan!=null)
{isCellObjTarget=true;break;}}}
var reOrdering=false;var lastParentID=currentDragObject.getAttribute('parentNodeLastID');if(dropTargetChildContainer!=null&&lastParentID!=null)
{reOrdering=lastParentID==dropTargetChildContainer.id;}
var showProxyObject=!getIsMoving(currentDragObject)&&currentDropTarget.getAttribute("containerLayoutMode")=="Flow";showProxyObject=showProxyObject||currentDragObject.style.position=='relative'||table_reorder!=null
showProxyObject=showProxyObject&&(!isCellObjTarget||reOrdering);if(showProxyObject)
{if(currentDragObjectInsertBeforeItem)
{if(currentDragObjectInsertBeforeItem!=currentDragObject.nextSibling)
{if(table_reorder!=null)
{if(currentDragObjectInsertBeforeItem.tagName=='TR'&&currentDragObject.tagName!='TR')
{table_reorder.tBodies[0].insertBefore(wrapObjectInTR(currentDragObject),currentDragObjectInsertBeforeItem);}
else
{table_reorder.tBodies[0].insertBefore(currentDragObject,currentDragObjectInsertBeforeItem);}}
else
{if(dropTargetChildContainer.tagName=='TABLE')
{dropTargetChildContainer.insertBefore(wrapObjectInTR(currentDragObject),currentDragObjectInsertBeforeItem);}
else
{dropTargetChildContainer.insertBefore(currentDragObject,currentDragObjectInsertBeforeItem);}}}}
else
{if((currentDragObject.nextSibling)||(currentDragObject.parentNode!=dropTargetChildContainer))
{if(table_reorder!=null)
{if(currentDragObject.tagName!='TR')
{table_reorder.tBodies[0].appendChild(wrapObjectInTR(currentDragObject));}
else
{table_reorder.tBodies[0].appendChild(currentDragObject);}}
else
{if(dropTargetChildContainer.tagName=='TABLE')
{dropTargetChildContainer.appendChild(wrapObjectInTR(currentDragObject));}
else
{dropTargetChildContainer.appendChild(currentDragObject);}}}}
if(currentDragObject.style.position!='absolute');{currentDragObject.style.display='';if(dragdropPrevBorder==null)
{if($.browser.msie)
{dragdropPrevBorder=currentDragObject.style.border;currentDragObject.style.border=kDropTargetHoverBorder;}
else
{dragdropPrevBorder=currentDragObject.style.outline;currentDragObject.style.outline=kDropTargetHoverBorder;}}}}
else
{currentDragObject.style.display='none';}
if(bShouldCreateNewHeader)
{createPanelHeader(currentDropTarget);}}
else
{if(currentDragObject!=null)
{currentDragObject.style.display='none';document.body.style.cursor='not-allowed';}}}
cancelBubble=true;}
lastMouseDown=currentMouseDown;return!cancelBubble;}
function wrapObjectInTR(element)
{$("#dragDropRow").remove();var tr=document.createElement('TR');var td=document.createElement('TD');tr.id="dragDropRow";tr.appendChild(td);td.appendChild(element);td.colSpan=2;return tr;}
function getIsMoving(object)
{if(object==null||object.getAttribute("itemID")==null)
{return false;}
else
{return true;}}
function getScrollPosition(e)
{var left=0;var top=0;try
{while(e!=null&&e.offsetParent)
{left+=e.offsetLeft-e.scrollLeft+(e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);top+=e.offsetTop-e.scrollTop+(e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);e=e.offsetParent;}
left+=e.offsetLeft-e.scrollLeft+(e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);top+=e.offsetTop-e.scrollTop+(e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);}
catch(e)
{}
return{x:left,y:top};}
function getPosition(e)
{var left=0;var top=0;while(e.offsetParent)
{left+=e.offsetLeft+(e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);top+=e.offsetTop+(e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);e=e.offsetParent;}
left+=e.offsetLeft+(e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);top+=e.offsetTop+(e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);return{x:left,y:top};}
function getStudioPosition(e)
{var p=getPosition(e);var cnt=picassoGetElementByID("pageEditorContainer");if(cnt!=null)
{var cntPosition=getPosition(cnt);p.x-=cntPosition.x;p.y-=cntPosition.y;}
return p;}
function mouseCoords(ev)
{if(ev==null)
{ev=window.event;}
if(ev.pageX||ev.pageY)
{return{x:ev.pageX,y:ev.pageY};}
else
{return{x:ev.clientX+document.body.scrollLeft-document.body.clientLeft,y:ev.clientY+document.body.scrollTop-document.body.clientTop};}}
function getWindowSize()
{var width=0,height=0;if(typeof(window.innerWidth)=='number')
{width=window.innerWidth;height=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
{width=document.documentElement.clientWidth;height=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
{width=document.body.clientWidth;height=document.body.clientHeight;}
return{width:width,height:height};}
function writeHistory(object,message)
{if(!object||!object.parentNode||!object.parentNode.getAttribute)return;if(object.createItemType!=undefined)
{Sys.Debug.trace(message+", "+object.createItemType);}
else
{Sys.Debug.trace(message+", "+object.itemID);}}
function getMouseOffset(target,ev)
{ev=ev||window.event;var itemID=target.getAttribute("itemID");if(itemID!=""&&itemID!=null)
{var docPos=getScrollPosition(target);var mousePos=mouseCoords(ev);var x=mousePos.x-docPos.x;var y=mousePos.y-docPos.y;if(x<0)x=0;else if(x>target.offsetWidth)x=target.offsetWidth;if(y<0)y=0;else if(y>target.offsetHeight)y=target.offsetHeight;return{x:x,y:y};}
else
{return{x:target.offsetWidth/2,y:target.offsetHeight/2};}}
function getPicassoEditorObject(obj)
{while(obj!=null)
{if(obj.getAttribute==undefined)
{break;}
else
{var itemID=obj.getAttribute("itemID");if(itemID!=null)
{return obj;}
else if(obj.id=="pageDesignContents")
{return obj;}
obj=obj.parentNode;}}
return null;}
function isPosInScrollArea(obj,mousepos)
{if(mousepos==null)
{return false;}
if(obj&&obj.clientHeight&&obj.offsetHeight)
{var off;if(obj.clientHeight<=(obj.offsetHeight-16))
{off=off||$(obj).offset();var inY=mousepos.y-off.top;if(inY>=(obj.offsetHeight-16))
{return true;}}
if(obj.clientWidth<=(obj.offsetWidth-16))
{off=off||$(obj).offset();var inX=mousepos.x-off.left;if(inX>=(obj.offsetWidth-16))
{return true;}}}
return false;}
function getPicassoDragObject(obj)
{if(obj==null)
{return null;}
if(obj.getAttribute==undefined)
{return null;}
if(obj.className.indexOf("ce_blocker")!=-1)
{return picassoGetElementByID(obj.getAttribute('refitem'));}
var selectItemElement=obj.selectItemElement;if(selectItemElement!=undefined)
{return selectItemElement;}
while(obj!=null)
{if(obj.getAttribute==undefined)
{break;}
else
{var itemID=obj.getAttribute("itemID");var editorSelectTarget=obj.getAttribute("editorSelectTarget");var DragObj=obj.getAttribute("createItemType");if(itemID!=null&&editorSelectTarget!=null)
{return obj;}
else if(DragObj!=null)
{return obj;}
obj=obj.parentNode;}}
return null;}
function getPicassoDropTarget(obj)
{while(obj!=null)
{if(obj.getAttribute==undefined)
{break;}
else
{if(obj.getAttribute("editorDropTarget")!=null)
{return obj;}
obj=obj.parentNode;}}}
function getPicassoParentTarget(obj)
{while(obj!=null)
{if(obj.getAttribute==undefined)
{break;}
else
{if(obj.getAttribute("editorDropTarget")!=null)
{return obj;}
if(obj.getAttribute("isContainer")!=null)
{return obj;}
obj=obj.parentNode;}}}
function getPicassoHelpTargetObject(obj)
{while(obj!=null)
{if(obj.getAttribute==undefined)
{break;}
else
{var helpID=obj.getAttribute("helpID")
if(helpID!=null)
{return obj;}
obj=obj.parentNode;if(obj.className=='pageDesignerBody')
{break;}}}
return null;}
function OnResizeCallback(currentResizeObject)
{var parentNode=getPicassoEditorObject(currentResizeObject.elPicasso.parentNode);var parentNodePos=getPicassoEditorObject(currentResizeObject.el.parentNode);var itemID=currentResizeObject.elPicasso.getAttribute("itemID");var containerID=parentNode.getAttribute("itemID");var parentItemHeight=parentNodePos.offsetHeight;var parentItemWidth=parentNodePos.offsetWidth;var insertBeforeID="";currentResizeObject.elPicasso.style.border=resizePrevBorder;PicassoWebServices.ManageSite.MoveItem(itemID,containerID,insertBeforeID,currentResizeObject.left,currentResizeObject.top,currentResizeObject.width,currentResizeObject.height,parentItemWidth,parentItemHeight,"","",OnPicassoEditorAJAXCallCompleted);}
function OnDropCallback(dragObj,dropObj,nextSiblingObj,itemPositionX,itemPositionY)
{var containerID='';var itemID='';var parentItemHeight='';var parentItemWidth='';var insertBeforeID="";if(dropObj!=null)
{itemID=dragObj.getAttribute("itemID");containerID=dropObj.getAttribute("itemID");parentItemHeight=dropObj.offsetHeight;parentItemWidth=dropObj.offsetWidth;}
if(itemPositionX==undefined)
{itemPositionX='';itemPositionY='';}
if(nextSiblingObj!=null)
{insertBeforeID=nextSiblingObj.getAttribute("itemID");}
if(dragHelper!=null)
{dragHelper.innerHTML="";dragHelper.style.display="none";}
if(itemID==null||itemID=="")
{var itemType=dragObj.getAttribute("createItemType");var itemArgument=dragObj.getAttribute("dragitemargument");var pageID=picassoGetElementByID("currentPageID").value;if(containerID==null)
{containerID=pageID;}
PicassoWebServices.ManageSite.DropItem(itemType,itemArgument,containerID,insertBeforeID,itemPositionX,itemPositionY,parentItemWidth,parentItemHeight,OnPicassoEditorAJAXCallCompleted);removeDropTargetDecoration(dropObj,dragObj);$(dragObj).remove();}
else
{PicassoWebServices.ManageSite.MoveItem(itemID,containerID,insertBeforeID,itemPositionX,itemPositionY,"","",parentItemWidth,parentItemHeight,"","",OnPicassoEditorAJAXCallCompleted);}}
function showModuleCreatedMsg(widgetName)
{ShowDialog({title:"Extension Created",innerTitle:"<p>Your extension has been successfully created and added to your site.</p>",icon:"/SMSystem/Images/Dashboard/Content/View.png",noOKButton:true,closeButtonText:"Close"});}
function addModuleToSite(moduleID)
{PicassoWebServices.ManageSite.DropItem("widgettype",moduleID,"","",0,0,0,0,OnPicassoEditorAJAXCallCompleted);}
function createContentBlockHere(guidParentID)
{if(getSelectedObjectItemID()!=guidParentID)
{setSelectedObject(guidParentID);}
PicassoWebServices.ManageSite.DropItem("PicassoContentBlockItem, PicassoObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",'',guidParentID,'','0','0','0','0',OnPicassoEditorAJAXCallCompleted);}
function insertNewItem(itemType)
{var itemArgument="";var insertBeforeID="";var container=getSelectedObject();var containerID=getSelectedObjectItemID();var parentHeight=container?container.offsetHeight:0;var parentWidth=container?container.offsetWidth:0;PicassoWebServices.ManageSite.CreateItem(itemType,itemArgument,containerID,insertBeforeID,0,0,parentWidth,parentHeight,OnPicassoEditorAJAXCallCompleted);}
function createSelectionHandle(x,y,resizeDirection,disableResize,disableDrag)
{var left=x-5;var top=y-5;var element=document.createElement("div");var selectionHandleClass="";if(disableResize&&disableDrag)
{selectionHandleClass="selectionOnlyHandles";}
else if(disableResize)
{selectionHandleClass="moveOnlyHandles";}
else
{selectionHandleClass="fullSelectionHandles";}
element.className=selectionHandleClass;element.id=resizeDirection+"_"+selectionHandleClass;element.style.position="absolute";element.style.left=left+"px";element.style.top=top+"px";element.style.zIndex=kSelectionHandleZIndex;element.style.display="";if(!disableResize)
{element.style.cursor=resizeDirection+"-resize";element.onmousedown=picassoBeginResizeElementEvent;element.resizeDirection=resizeDirection;}
return element;}
function getPositionalObject(picassoObject)
{if(picassoObject.getAttribute('itemtoolbarid')=='PicassoTableContainerItem')
{for(var ii=0;ii<picassoObject.childNodes.length;++ii)
{if(picassoObject.childNodes[ii].rows!=null)
{return picassoObject.childNodes[ii];}}}
return picassoObject;}
function showSelectionHandles()
{if(picassoContentEditor&&picassoContentEditor.isEditorEnabled())
{return;}
var selectedObject=getSelectedObject();var selectionHandlesContainerContainer=picassoGetElementByID("pageEditorContainer");var selectionHandlesContainer=picassoGetElementByID("selectionHandlesContainer");if(selectedObject!=null&&selectionHandlesContainerContainer!=null&&selectionHandlesContainer!=null)
{var editorSelectTarget=selectedObject.getAttribute("editorSelectTarget");if(selectedObject.cells==null&&editorSelectTarget==null)
{hideSelectionHandles();return;}
var positionalObject=getPositionalObject(selectedObject);var disableResize=selectedObject.getAttribute("editorResizeDisabled");var disableDrag=selectedObject.getAttribute("editorDragDisabled");var selectedObjectPosition=getPosition(positionalObject);var smartTagContainerPosition=getPosition(selectionHandlesContainerContainer);var autoheight_enabled=selectedObject.getAttribute("picasso-autoheight");selectedObjectPosition.x-=smartTagContainerPosition.x;selectedObjectPosition.y-=smartTagContainerPosition.y;hideSelectionHandles();var left=selectedObjectPosition.x;var right=selectedObjectPosition.x+positionalObject.offsetWidth;var top=selectedObjectPosition.y;var bottom=selectedObjectPosition.y+positionalObject.offsetHeight;var bIsDisableByAutoHeight=false;if((autoheight_enabled=="true")||disableResize)
{bIsDisableByAutoHeight=true;}
var bIsDisabledByAbs=(selectedObject.style.position!='absolute');selectionHandlesContainer.appendChild(createSelectionHandle(right+3,(top+bottom)/2,'e',disableResize,disableDrag),0);selectionHandlesContainer.appendChild(createSelectionHandle((left+right)/2,bottom+3,'s',bIsDisableByAutoHeight,disableDrag),0);selectionHandlesContainer.appendChild(createSelectionHandle(right+3,bottom+3,'se',bIsDisableByAutoHeight,disableDrag),0);selectionHandlesContainer.appendChild(createSelectionHandle(left+3,(top+bottom)/2,'w',disableResize||bIsDisabledByAbs,disableDrag),0);selectionHandlesContainer.appendChild(createSelectionHandle(left+3,top+3,'nw',bIsDisableByAutoHeight||bIsDisabledByAbs,disableDrag),0);selectionHandlesContainer.appendChild(createSelectionHandle(right+3,top+3,'ne',bIsDisableByAutoHeight||bIsDisabledByAbs,disableDrag),0);selectionHandlesContainer.appendChild(createSelectionHandle((left+right)/2,top+3,'n',bIsDisableByAutoHeight||bIsDisabledByAbs,disableDrag),0);selectionHandlesContainer.appendChild(createSelectionHandle(left+3,bottom+3,'sw',bIsDisableByAutoHeight||bIsDisabledByAbs,disableDrag),0);createPanelHeader(selectedObject,false);}}
function hideSelectionHandles()
{var selectionHandlesContainer=picassoGetElementByID("selectionHandlesContainer");if(selectionHandlesContainer!=null)
{selectionHandlesContainer.innerHTML="";}}
function OpenPageScriptEditor(isHead)
{var pageid=$('#currentPageID').val();var url=String.Format('Editors/HtmlWidgetEditor.aspx?HTML=True&ItemID={0}',pageid);if(isHead)
{url=url+"&OwnerArgument=head";}
startModalDialog(url);}
function OpenEmailEditor()
{startModalDialogWithItemID("Wizards/EmailWizard.aspx");}
function activateCurrentObject()
{var ev=null;var selectedObject=getSelectedObject();if(selectedObject==null)
{return;}
{var editorControlURL=selectedObject.getAttribute("editorControlURL");if(editorControlURL!=null)
{if(editorControlURL.indexOf('javascript:',0)==0)
{eval(editorControlURL);}
else
{startModalDialogWithItemID(editorControlURL);}}
else
{showSmartTag(selectedObject);}}}
function showSmartTag(selectedObject)
{return;var ev=null;var itemID=selectedObject.getAttribute("itemID");var smartTagPanel=picassoGetElementByID("smartTagPanel");if(selectedObject!=null&&smartTagPanel!=null)
{var smartTagContainer=picassoGetElementByID("pageEditorContainer");var selectedObjectPosition=getPosition(selectedObject);var smartTagContainerPosition=getPosition(smartTagContainer);var windowSize=getWindowSize();selectedObjectPosition.x-=smartTagContainerPosition.x;selectedObjectPosition.y-=smartTagContainerPosition.y;showSelectionHandles();if(ev==null)
{var smartTagPanelX=selectedObjectPosition.x-5;var smartTagPanelY=selectedObjectPosition.y-5;smartTagPanel.style.display="";smartTagPanel.style.left=smartTagPanelX+"px";smartTagPanel.style.top=smartTagPanelY+"px";}
else
{var mousePosition=mouseCoords(window.event);smartTagPanel.style.left=mousePosition.x-smartTagContainerPosition.x;smartTagPanel.style.top=mousePosition.y-smartTagContainerPosition.y;}}}
function hideSmartTag()
{return;var smartTagPanel=picassoGetElementByID("smartTagPanel");if(smartTagPanel!=null)
{smartTagPanel.style.display="none";}}
function hideContentMenu()
{$('#contextMenuPopup').hide();}
function hidePopups()
{$('#imageViewer').hide().html('');if(_gPopupActive==true)
{hideContentMenu();$('#colorpicker').hide();_gPopupActive=false;}}
function RefreshPropertiesForSelectedItem()
{var currentItemID=getSelectedObjectItemID();PicassoWebServices.ManageSite.RefreshItemProperties(currentItemID,OnPicassoEditorAJAXCallCompleted);}
function CreateDatabaseField(fieldGroupID,fieldName,fieldType,fieldReq,fieldDesc,foreignList)
{if(fieldGroupID!=null&&fieldName!=null&&fieldType!=null&&fieldReq!=null&&fieldDesc!=null)
{PicassoWebServices.ManageSite.CreateDatabaseField(fieldGroupID.value,fieldName.value,fieldType.options[fieldType.selectedIndex].value,fieldReq.checked,fieldDesc.value,"",foreignList==null?"":$(foreignList).val(),OnPicassoEditorAJAXCallCompleted);}}
function CreateWorkflowItem()
{var fieldGroupID=picassoGetElementByID("PicassoWorkflowObject_siteDataFieldGroupID");var fieldName=picassoGetElementByID("PicassoWorkflowObject_siteDataFieldName");var fieldType=picassoGetElementByID("PicassoWorkflowObject_siteDataFieldType");if(fieldGroupID!=null&&fieldName!=null&&fieldType!=null)
{PicassoWebServices.ManageSite.CreateWorkflowItem(fieldGroupID.value,fieldName.value,fieldType.options[fieldType.selectedIndex].value,OnPicassoEditorAJAXCallCompleted);}}
function SelectDatabaseFieldFromID(itemID)
{PicassoWebServices.ManageSite.SelectDatabaseFieldFromID(itemID,OnPicassoEditorAJAXCallCompleted);}
function ChangeItemOrder(itemID,direction)
{PicassoWebServices.ManageSite.ChangeItemOrder(itemID,direction,OnPicassoEditorAJAXCallCompleted);}
function SelectQueryObjectFromID_ClientOnly(itemID)
{var db_iFrame=picassoGetElementByID("dataInputIFrame");if(db_iFrame==undefined||db_iFrame==null)
{return;}
if($('#elementConfigurationPropertiesTab_tab').is(':hidden'))
{$('#elementConfigurationPropertiesTab_tab').show();$('#elementConfigurationPropertiesTab .rightSidePropertyPanelPropertiesBody').show();}
$("#queryObjectsUL li.selectedTableRow,#databaseObjectsUL li.selectedTableRow").removeClass('selectedTableRow');$('#queryObjectsUL li[dbid='+itemID+']').attr('class','selectedTableRow');}
function SelectDatabaseObjectFromID_ClientOnly(itemID)
{var db_iFrame=picassoGetElementByID("dataInputIFrame");if(db_iFrame==undefined||db_iFrame==null)
{return;}
if($('#elementConfigurationPropertiesTab_tab').is(':hidden'))
{$('#elementConfigurationPropertiesTab_tab').show();$('#elementConfigurationPropertiesTab .rightSidePropertyPanelPropertiesBody').show();}
$("#queryObjectsUL li.selectedTableRow,#databaseObjectsUL li.selectedTableRow").removeClass('selectedTableRow');$('#databaseObjectsUL li[dbid='+itemID+']').attr('class','selectedTableRow');}
function SelectQueryObjectFromID(itemID)
{PicassoWebServices.ManageSite.SelectQueryObjectFromID(itemID,OnPicassoEditorAJAXCallCompleted);SelectQueryObjectFromID_ClientOnly(itemID);}
function SelectDatabaseObjectFromID(itemID)
{PicassoWebServices.ManageSite.SelectDatabaseObjectFromID(itemID,OnPicassoEditorAJAXCallCompleted);SelectDatabaseObjectFromID_ClientOnly(itemID);}
function SelectBlogObjectFromID(itemID)
{PicassoWebServices.ManageSite.SelectBlogObjectFromID(itemID,OnPicassoEditorAJAXCallCompleted);}
function SelectItemFromItemID(itemID,itemBrowserID,itemType)
{if(itemID!=null&&itemBrowserID!=null)
{var currentItemID=getSelectedObjectItemID();if(itemType=="PicassoPage"||itemType=="PicassoEmail")
{var curpageid=$('#currentPageID').val();if(curpageid!=currentItemID)
{$('#currentPageID').val(itemID);setSelectedObject(itemID,"",itemType);SelectPage(itemID);}
return;}
setSelectedObject(itemID,itemBrowserID,itemType);showSelectionHandles();hideSmartTag();if(isPicassoStudio)
{if(currentItemID!=itemID)
{RefreshPropertiesForSelectedItem();}}}}
function getSelectedObjectParent()
{return getPicassoEditorObject(getSelectedObject().parentNode);}
function getSelectedObject()
{return picassoGetElementByID(currentSelectedItemBrowserID);}
function showCurrentItemToolbar()
{var currentObject=getSelectedObject();if(currentObject!=null)
{var toolbarID=currentObject.getAttribute("itemToolbarID");showToolbar(toolbarID);}
else
{showToolbar(null);}}
function showToolbar(toolbarID)
{$('#toolbarContainer').children().hide();if(toolbarID!=null&&toolbarID!="")
{$('#'+toolbarID).show();}}
function updateStyleOnSelection(itemBrowserID)
{}
function saveBorder(property,value)
{if(property=="outline")
{g_LastBorder=value;}
if(property=="outline-left")
{g_LastBorder_Left=value;}
if(property=="outline-right")
{g_LastBorder_Right=value;}
if(property=="outline-top")
{g_LastBorder_Top=value;}
if(property=="outline-bottom")
{g_LastBorder_Bottom=value;}}
function resetLastBorder()
{g_LastBorder="";g_LastBorder_Right="";g_LastBorder_Left="";g_LastBorder_Top="";g_LastBorder_Bottom="";}
function restoreBorder(last_obj)
{if(g_LastBorder!="")
last_obj.style.outline=g_LastBorder;if(g_LastBorder_Top!="")
last_obj.style.outlineTop=g_LastBorder_Top;if(g_LastBorder_Bottom!="")
last_obj.style.outlineBottom=g_LastBorder_Bottom;if(g_LastBorder_Left!="")
last_obj.style.outlineLeft=g_LastBorder_Left;if(g_LastBorder_Right!="")
last_obj.style.outlineRight=g_LastBorder_Right;if(last_obj.rowSpan!=null)
{last_obj.style.outline="1px dotted black";}
refreshTargetLockStyle();}
function setSelectedObject(itemID,itemBrowserID,itemType)
{if(picassoContentEditor&&picassoContentEditor.isEditorEnabled())
{return;}
var currentObject=getSelectedObject();$("#dataLinkTrigger").hide();if(itemID!=currentSelectedItemID)
{if(typeof visualCSSEditor!="undefined")
{visualCSSEditor.lastClassMode=null;}
$('#removeHyperLinkTrigger').hide();if(currentObject!=null&&currentObject.id!=null)
{var last_obj=picassoGetElementByID(currentObject.id);if(last_obj!=null)
{restoreBorder(last_obj);removePanelHeader(last_obj,true);}}
resetLastBorder();showToolbar(null);if(itemBrowserID!="")
{var obj=picassoGetElementByID(itemBrowserID);if(obj!=null)
{var toolbarID=obj.getAttribute("itemToolbarID");showToolbar(toolbarID);var picassoUrl=obj.getAttribute("picasso-url");if(picassoUrl!=null&&picassoUrl!="")
{$('#removeHyperLinkTrigger').show();}
var elementScope=obj.getAttribute("elementscope");ShowVisualCSS(elementScope==null||elementScope=="Local");if(pageHTreeState!=null)
{pageHTreeState.unselectAll();pageHTreeState.activateNode('#pageHTree li[treeobjectid='+itemID+']');}}}
else
{if($('#currentPageID').val()==itemID)
{var elementScope=$('#pageDesignContents').attr("elementscope");var isLocalPage=(elementScope==null||elementScope=="Local");ShowVisualCSS(isLocalPage);if(isLocalPage)
showToolbar(itemType);if(pageHTreeState!=null)
{pageHTreeState.unselectAll();pageHTreeState.activateNode('#pageHTree li[treeobjectid='+itemID+']');}
if(pageTreeState!=null)
{pageTreeState.unselectAll();pageTreeState.activateNode('#sitePageTree li[treeobjectid='+itemID+']');}}}}
populateSelectList("classNameList",siteClasses);populateSelectList("IDNameList",siteIDs);var styleSelName=picassoGetElementByID("styleSelectedItemName");if(itemBrowserID!="")
{var obj=picassoGetElementByID(itemBrowserID);if(obj!=null)
{var itemname=obj.getAttribute("itemname");if(obj.rowSpan!=null||obj.cells!=null)
{obj.style.outline=kUnselectedBorder;}
if(styleSelName!=null)
{styleSelName.innerHTML=itemname;}
var elementScope=obj.getAttribute("elementscope");if(typeof(visualCSSEditor)!="undefined"&&(elementScope==null||elementScope=="Local"))
{var newclassmode="inline";var bfoundclass=visualCSSEditor.setEditModeClass(obj.className);var item_picassoid=obj.getAttribute('itemid').replace(/-/g,'');var item_id=obj.id;if(item_id.indexOf(item_picassoid)>=0)
{item_id="";}
var bfoundid=visualCSSEditor.setEditModeID(item_id);if(bfoundclass&&(visualCSSEditor.lastClassMode=="class"||visualCSSEditor.lastClassMode==null))
{newclassmode="class";}
else if(visualCSSEditor.lastClassMode=="id")
{newclassmode="id";}
visualCSSEditor.initClassEditMode(newclassmode,obj);}}
else
{if(styleSelName!=null)
{styleSelName.innerHTML="Site";}
if(typeof(visualCSSEditor)!="undefined")
{visualCSSEditor.setEditModeClass("");visualCSSEditor.setEditModeID("");visualCSSEditor.initClassEditMode('inline');}}}
else
{if($('#currentPageID').val()==itemID)
{if(styleSelName!=null)
{var editPageNameCtrl=picassoGetElementByID("studioDialogContainer_currentPageName");if(editPageNameCtrl!=null)
{styleSelName.innerHTML=editPageNameCtrl.innerHTML;}}
var pageDesignContents=picassoGetElementByID("pageDesignContents");if(pageDesignContents!=null&&typeof(visualCSSEditor)!="undefined")
{var elementScope=$(pageDesignContents).attr("elementscope");if(elementScope==null||elementScope=="Local")
{var class_name="";var pageStyleObject=pageDesignContents;if($('#pagePartSelectList').val()=="body")
{pageStyleObject=picassoGetElementByID("pageBodyID");class_name=pageStyleObject.getAttribute("picasso-class");}
else
{class_name=pageStyleObject.parentNode.getAttribute("picasso-class");}
var newclassmode="inline";var bfoundclass=visualCSSEditor.setEditModeClass(class_name);if(visualCSSEditor.lastClassMode=="class"&&bfoundclass)
{newclassmode="class";}
if(visualCSSEditor.lastClassMode=="id")
{newclassmode="id";}
visualCSSEditor.initClassEditMode(newclassmode,pageStyleObject);}}}}
currentSelectedItemID=itemID;currentSelectedItemBrowserID=itemBrowserID;currentSelectedItemType=itemType;if(obj!=null&&obj.getAttribute("repeater-item")!=null)
{$("#dataLinkTrigger").show();}
if(itemBrowserID!="")
{createPanelHeader(obj,true);}}
function getSelectedObjectItemID()
{return currentSelectedItemID;}
function getSelectedObjectItemType()
{return currentSelectedItemType;}
function setClipBoardObjectFromSelection()
{currentCopiedItemID=currentSelectedItemID
currentCopiedItemBrowserID=currentSelectedItemBrowserID}
function getClipBoardObjectID()
{return currentCopiedItemID}
function getClipBoardObject()
{return picassoGetElementByID(currentCopiedItemBrowserID);}
function showFullProperties()
{hideSmartTag();RefreshPropertiesForSelectedItem();}
function registerCSSClearFunction(func)
{styleClearFuncs.push(func);}
function clearCSSProperties()
{for(func in styleClearFuncs)
{styleClearFuncs[func]();}}
function updateVisualCSSEditor(newstyle)
{if(clearCSSProperties!=undefined)
{clearCSSProperties();}
var newstyle=newstyle==null?null:newstyle.replace(/\n/g,"");var display="";if(newstyle!=undefined&&newstyle!=null&&newstyle!="")
{var styles=newstyle.split(";");for(var style=0;style<styles.length;style++)
{var stylestr=styles[style];var iColon=stylestr.indexOf(':');if(iColon!=null)
{var pair=[stylestr.substr(0,iColon),stylestr.substr(iColon+1,stylestr.length)]
var property=pair[0];if(property&&property!="")
{var value=pair[1].replace(/^\s+/g,"");if(property!="filter"&&typeof styleSetFuncs[property]=="function")
{styleSetFuncs[property](value);}
display+=String.Format("{0}:{1};\n",property,value);saveBorder(property,value);}}}}
$('#style-css-summary-box').val(display);}
function updateVisualCSSEditorSummary(newstyle)
{if(newstyle!=undefined&&newstyle!=null)
{var display="";if(newstyle!="")
{var styles=newstyle.split(";");for(var style=0;style<styles.length;style++)
{var stylestr=styles[style];var iColon=stylestr.indexOf(':');if(iColon!=null)
{var pair=[stylestr.substr(0,iColon),stylestr.substr(iColon+1,stylestr.length)]
var property=pair[0].trim();if(property&&property!="")
{var value=pair[1].trim();display+=String.Format("{0}:{1};\n",property,value);}}}}
$('#style-css-summary-box').val(display);}}
function populateItemVisibleStyle()
{var selObj=visualCSSEditor.selectedElem;if(selObj!=null)
{var picassoStyle=selObj.getAttribute("picasso-style");updateVisualCSSEditor(picassoStyle);}}
function SetEditorFocus(focus_id)
{g_EditorInFocusID=focus_id;}
function showCommonProperties()
{RefreshPropertiesForSelectedItem();}
function selectedSizeToContainer()
{PicassoWebServices.ManageSite.SizeToContainer(OnPicassoEditorAJAXCallCompleted);}
function isEditorInFocus()
{return g_EditorInFocusID==null;}
function populateSelectList(selectListID,keyValuePair,frame)
{var select=picassoGetElementByID(selectListID,frame);if(select!=null&&keyValuePair!=null)
{select.options.length=0;select.options[0]=new Option("Not Set","");for(index=1;index<keyValuePair.length+1;index++)
{select.options[index]=new Option(keyValuePair[index-1].Key,keyValuePair[index-1].Value);}}}
function setSelectValue(select,value)
{for(index=0;index<select.length;index++)
{if(select.options[index].value==value)
{select.selectedIndex=index;return;}}}
function UpdateSiteLinks()
{PicassoWebServices.ManageSite.UpdateSiteLinks(OnPicassoEditorAJAXCallCompleted);}
function UpdateSiteLinks_Images()
{PicassoWebServices.ManageSite.UpdateSiteLinks_Images(OnPicassoEditorAJAXCallCompleted);}
function UpdateSiteLinks_Files()
{PicassoWebServices.ManageSite.UpdateSiteLinks_Files(OnPicassoEditorAJAXCallCompleted);}
function closePropertyItemHelp()
{var panel=picassoGetElementByID("selectedItemHelpPanel");panel.style.display='none';}
function propertyHelp(object,propertyHelp)
{var panel=picassoGetElementByID("selectedItemHelpPanel");var span=picassoGetElementByID("propertyItemHelpText");var position=getPosition(object);span.innerHTML=propertyHelp;panel.style.left=(position.x)+'px';panel.style.top=(position.y+object.offsetHeight)+'px';panel.style.display='block';}
function propertyUpdated(itemID,propertyName,value)
{SaveRHSPropertiesHeadersNodeState();PicassoWebServices.ManageSite.UpdateProperty(itemID,propertyName,value,OnPicassoEditorPropertiesUpdateAJAXCallCompleted);}
function propertyValueUnitUpdated(itemID,propertyName,value,unitType)
{var num=parseFloat(value);if((num+"").length!=value.length)
{propertyUpdated(itemID,propertyName,value);}
else
{propertyUpdated(itemID,propertyName,value+unitType);}}
function propertyUnitUpdated(itemID,propertyName,value,unitType)
{if(unitType=="")
{propertyUpdated(itemID,propertyName,"");}
else
{propertyUpdated(itemID,propertyName,value);}}
function DoBulkDelete(itemType)
{var dlgstr='Editors/BulkDelete.aspx?view='+itemType;startModalDialog(dlgstr);}
function propertyListAdd(element,itemID,propertyName)
{if(propertyName=="PageScripts")
{startModalDialog("Editors/PageScriptsEditor.aspx",function(val)
{if(val&&val!="")
{PicassoWebServices.ManageSite.UpdatePropertyListAdd(itemID,propertyName,val,OnPicassoEditorPropertiesUpdateAJAXCallCompleted);}});}
else
{$(element).parent().next().slideDown();}}
function propertyListAddOK(element)
{var $parentpanel=$(element).parents('div.propertyListEditPanel:first');var propertyName=$parentpanel.attr('propertyName');var itemID=$parentpanel.attr('propertyID');var val=$parentpanel.find('.propListValField').val();if(val&&val!="")
{PicassoWebServices.ManageSite.UpdatePropertyListAdd(itemID,propertyName,val,OnPicassoEditorPropertiesUpdateAJAXCallCompleted);}
$parentpanel.find('.propertyListEditArea').hide();}
function propertyListAddCancel(element)
{var $parentpanel=$(element).parents('div.propertyListEditPanel:first');$parentpanel.find('.propertyListEditArea').hide();}
function propertyListRemove(element,itemID,propertyName)
{var ddl=$(element).parent().prev().get(0);if(ddl&&ddl.selectedIndex>=0)
{PicassoWebServices.ManageSite.UpdatePropertyListRemove(itemID,propertyName,ddl.selectedIndex,OnPicassoEditorPropertiesUpdateAJAXCallCompleted);}}
function propertyListClear(element,itemID,propertyName)
{PicassoWebServices.ManageSite.UpdatePropertyListClear(itemID,propertyName,OnPicassoEditorPropertiesUpdateAJAXCallCompleted);}
function propertyListUp(element,itemID,propertyName){var ddl=$(element).parent().prev().get(0);if(ddl&&ddl.selectedIndex>=0){PicassoWebServices.ManageSite.UpdatePropertyListUp(itemID,propertyName,ddl.selectedIndex,OnPicassoEditorPropertiesUpdateAJAXCallCompleted);}}
function propertyListDown(element,itemID,propertyName){var ddl=$(element).parent().prev().get(0);if(ddl&&ddl.selectedIndex>=0){PicassoWebServices.ManageSite.UpdatePropertyListDown(itemID,propertyName,ddl.selectedIndex,OnPicassoEditorPropertiesUpdateAJAXCallCompleted);}}
function SelectPage(pageID)
{hideSmartTag();hideSelectionHandles();g_DropTargetLockID=null;PicassoWebServices.ManageSite.EditPage(pageID,OnPicassoEditorAJAXCallCompleted);}
function EditPage(element,pageID,friendlyURL)
{if(window.sitePreviewFrame&&friendlyURL!=undefined)
{$('#workareadContainer .workarea').hide();$('#pagesWorkareaPanel').show();$('#workspaceToolbarContainer .workingAreaToolbar').hide();$('#pagesToolbarPanel').show();$('#databaseObjectsUL li.selectedTableRow').attr('class','');$("#sitePreviewFrame").attr("src",friendlyURL);return;}
var editPageIDCtrl=picassoGetElementByID("currentPageID");if(editPageIDCtrl.value!=pageID)
{SelectPage(pageID);}}
function DeleteCurrentPage()
{ConfirmDelete("Are you sure you want to delete this page?",function()
{var editPageIDCtrl=picassoGetElementByID("currentPageID");PicassoWebServices.ManageSite.DeletePage(editPageIDCtrl.value,OnPicassoEditorAJAXCallCompleted);});}
function CacheImageAsset(element)
{var dragitemvisual=element.getAttribute('dragitemvisual');if(dragitemvisual!=null)
{var dragitem=picassoGetElementByID(dragitemvisual);if(dragitem!=null)
{var itemsrc=dragitem.getAttribute('imgsrc')
if(itemsrc!=null&&itemsrc!="")
{$(dragitem).html('').append("<img src='"+itemsrc+"' />");}}}}
function EditAsset(element)
{CacheImageAsset(element);var $p=$(element).parent();var objectID=$p.attr('treeobjectid');if(objectID&&objectID!=null)
{var assetType=$p.attr('nodetype');picassoItemSelection.doSelect(objectID,assetType,true);}}
function OnBrowserContextMenu()
{return false;}
function addNewPage(pageNameElementID)
{startModalDialog("Wizards/PageWizard.aspx");}
function addNewChildMasterPage(pageID,pageName)
{var navigationPage="";if(pageID==null)
{var currentPageIDField=picassoGetElementByID("currentPageID");pageID=currentPageIDField.value;}
if(pageName==null)
{var editPageNameCtrl=picassoGetElementByID("studioDialogContainer_currentPageName");pageName=editPageNameCtrl.innerHTML;}
PicassoWebServices.ManageSite.CreatePage("Untitled","",navigationPage,pageID,OnPicassoEditorAJAXCallCompleted);}
function convertToMaster(pageID)
{if(pageID==null)
{var currentPageIDField=picassoGetElementByID("currentPageID");pageID=currentPageIDField.value;}
var treeid="#id"+pageID.replace(/-/g,'')+"_pageitem";if($('#sitePageTree '+treeid).children('ul').length>0)
{ShowDialog({title:"Conversion Error!",innerTitle:"<p>You can't convert this site page to a master page until you remove all of its child (or sub) pages.</p>",icon:"/SMSystem/Images/Dashboard/Content/delete.png",noOKButton:true,closeButtonText:"Close"});return;}
PicassoWebServices.ManageSite.ProcessPage(pageID,"MakeMaster",OnPicassoEditorAJAXCallCompleted);}
function createNestedMaster(pageID)
{if(pageID==null)
{var currentPageIDField=picassoGetElementByID("currentPageID");pageID=currentPageIDField.value;}
PicassoWebServices.ManageSite.CreatePageEx("Nested Master","","",pageID,true,OnPicassoEditorAJAXCallCompleted);}
function swapMaster(pageID)
{}
function convertToSitePage(pageID)
{if(pageID==null)
{var currentPageIDField=picassoGetElementByID("currentPageID");pageID=currentPageIDField.value;}
var treeid="#id"+pageID.replace(/-/g,'')+"_pageitem";if($('#masterPageTree '+treeid).children('ul').length>0)
{ShowDialog({title:"Conversion Error!",innerTitle:"<p>You can?t convert this master page to a site page until you remove all of the master pages that are based on it.</p>",icon:"/SMSystem/Images/Dashboard/Content/delete.png",noOKButton:true,closeButtonText:"Close"});return;}
PicassoWebServices.ManageSite.ProcessPage(pageID,"MakeSitePage",OnPicassoEditorAJAXCallCompleted);}
function addNewMasterpage()
{startModalDialog("Wizards/PageWizard.aspx");}
function addNewEmail()
{startModalDialog("Wizards/EmailWizard.aspx");}
function addLibraryItem()
{PicassoWebServices.ManageSite.CreateLibraryItem(OnPicassoEditorAJAXCallCompleted);}
function addPrebuiltPage(url)
{startModalDialog(url);}
function addManagedCodePage()
{startModalDialog("CodePageCreator.aspx");}
function CreateSnapshot()
{PicassoWebServices.ManageSite.CreateSnapshot();}
function PublishingNotAllowedMessage()
{ShowDialog({title:"Publish Not Allowed",innerTitle:"<p>Publishing is not allowed in guest mode.</p>",icon:"/SMSystem/Images/Dashboard/Content/View.png",noOKButton:true,closeButtonText:"Close"});}
function OpenPublishSiteWizard(bBasic)
{function onFailure(sender,e)
{PublishingNotAllowedMessage();}
function onIsAnonymous(sender,e)
{if(sender)
{PublishingNotAllowedMessage();}
else
{if(bBasic=="True")
{startModalDialog("Wizards/PublishSiteWizard.aspx?focus=0");}
else
{startModalDialog("Wizards/PublishSiteWizard.aspx?focus=1");}}}
PicassoWebServices.ManageSite.IsAnonymous(onIsAnonymous,onFailure);}
function OpenPublishChangesWizard(){function onFailure(sender,e)
{PublishingNotAllowedMessage();}
function onIsAnonymous(sender,e)
{if(sender){PublishingNotAllowedMessage();}
else
{startModalDialog("Editors/PublishChanges.aspx");}}
PicassoWebServices.ManageSite.IsAnonymous(onIsAnonymous,onFailure);}
function importSiteAssets(updateType)
{var qryString="";if(typeof(updateType)!='undefined'&&updateType!=null)
{qryString="?updateType="+updateType;}
startModalDialog("Wizards/ImportWizard2.aspx"+qryString);}
function selectContentList()
{startModalDialogWithItemID("Wizards/ContentListWizard.aspx");}
function importSite()
{startModalDialog("Wizards/SiteImport.aspx");}
function styleItem()
{var styleDialog=Sys.Application.findComponent("stylePopupModalPopupExtender");styleDialog.show();_gPopupActive=true;}
function siteManagerLinearUndo()
{PicassoWebServices.ManageSite.LinearUndo("Studio",OnPicassoEditorAJAXCallCompleted);}
function siteManagerLinearRedo()
{PicassoWebServices.ManageSite.LinearRedo("Studio",OnPicassoEditorAJAXCallCompleted);}
function clearProduction()
{if(confirm('Are you sure you want to clear the current production checkpoint?  The latest version of your site will become the production site'))
{PicassoWebServices.ManageSite.ClearProduction(OnPicassoEditorAJAXCallCompleted);}}
function getDeleteMessage(objectID)
{if(objectID!=null)
{objectID=getSelectedObjectItemID();}}
function deleteUrlItem(objectID)
{}
function deleteItem(bShouldAsk,objectID,customMsg,extraCallback)
{var canDeleteCheckID=currentSelectedItemBrowserID;if(objectID!=null)
{canDeleteCheckID="id"+objectID.replace(/-/g,"");}
var delObj=picassoGetElementByID(canDeleteCheckID);if(delObj!=null)
{var elementscope=delObj.getAttribute('elementscope');if(elementscope&&elementscope!="Local")
{return;}}
function myResult(result){if(result){var msg="";var pages="";if(result.DeletedItemNamesInContentContainersList!=null){msg='Are you sure you want to delete this item? This item has the following references made to it and could visually affect these referenced objects:<br><br>';for(var index=0;index<result.DeletedItemNamesInContentContainersList.length;index++){var pageArray=result.DeletedItemNamesInContentContainersList[index].split(',');pages+="<b>"+pageArray[1]+"</b> found in <b>"+pageArray[0]+"</b> <BR>";if(index>3){var remaining=result.DeletedItemNamesInContentContainersList.length-index;pages+="<i>...and "+remaining+" more</i>";break;}}
msg+=pages;}
else{msg='Are you sure you want to delete this item?';if(typeof customMsg=="string"&&customMsg!="")
msg=customMsg;}
ConfirmDelete(msg,doDelete);}}
function doDelete()
{hideSmartTag();hideSelectionHandles();var droptargetcheck=currentSelectedItemBrowserID;if(objectID!=null&&objectID!="")
{droptargetcheck="id"+objectID.replace(/-/g,"");}
if(droptargetcheck==g_DropTargetLockID)
{g_DropTargetLockID=null;}
currentSelectedItemID="";currentSelectedItemBrowserID="";currentSelectedItemType="";if(objectID!=null)
{PicassoWebServices.ManageSite.DeleteItem(objectID,OnPicassoEditorAJAXCallCompleted);}
else
{PicassoWebServices.ManageSite.DeleteCurrentItem(OnPicassoEditorAJAXCallCompleted);}
if(typeof extraCallback=="function")
{extraCallback();}}
if(!bShouldAsk)
{doDelete();return;}
if(objectID!=null&&objectID!="")
{PicassoWebServices.ManageSite.GetContentItemNamesFromLinkObjectID(objectID,myResult);}
else
{PicassoWebServices.ManageSite.GetContentItemNamesFromLinkObjectID(currentSelectedItemID,myResult);}}
function deleteImage(bShouldAsk,objectID)
{deleteItem(true,objectID,'Are you sure you want to delete this asset object(s)?');hideSmartTag();hideSelectionHandles();}
function createAssetFile(fileExt){PicassoWebServices.ManageSite.CreateAssetFile(fileExt,OnPicassoEditorAJAXCallCompleted);}
function checkBrokenLinksCSS(css,extraCallback)
{PicassoWebServices.ManageSite.CheckForBrokenLinksCSS(css,function(result)
{checkBrokenLinksResult(extraCallback,result);});hideSmartTag();hideSelectionHandles();}
function checkBrokenLinksHTML(html,extraCallback)
{PicassoWebServices.ManageSite.CheckForBrokenLinksHtml(html,function(result)
{checkBrokenLinksResult(extraCallback,result);});hideSmartTag();hideSelectionHandles();}
function checkBrokenLinksResult(extraCallback,result)
{if(result!=null)
{if(result.length>0)
{var message="The following assets could not be found:<BR>";for(var key in result)
{message+="- "+result[key]+"<BR>";}
message+="<BR>Do you want to continue?"
ShowDialog({title:"Broken Links detected",innerTitle:message,icon:"/SMSystem/Images/Icons/exclamation.png",okButtonText:"OK",closeButtonText:"Cancel",acceptCB:function()
{confirmSaveHtml(extraCallback)}});return;}
if(typeof extraCallback=="function")
{extraCallback();}}}
function confirmSaveHtml(extraCallback)
{if(typeof extraCallback=="function")
{extraCallback();}}
function confirmDeleteUser()
{if(!confirm('Are you sure you want to remove this user?'))
return false;else
return true;}
function confirmResetPassword()
{if(!confirm('Are you sure you want to reset this users password?'))
return false;else
return true;}
function stretchElement(element)
{if(element!=null)
{var minimumHeight=300;var paddingHeight=10;var windowHeight=getWindowHeight()-paddingHeight;var elementPosition=getPosition(element);var elementHeight=windowHeight-elementPosition.y;if(elementHeight<minimumHeight)
elementHeight=minimumHeight;element.style.height=elementHeight+'px';element.style.overflow="auto";}}
function highlightImage(element)
{element.className="toolboxItemHighlight";}
function unhighlightImage(element)
{element.className="toolboxItem";}
function showElementHistory()
{ShowHistoryDialog(getSelectedObjectItemID());}
function ShowPageToolboxMenu(element,enable)
{for(i=0;i<element.childNodes.length;i++)
{var child=element.childNodes[i];if(child.className=="pageDropDown"||child.className=="pageDropDownHighlight")
{if(enable)
{child.style.display="block";}
else
{child.style.display="none";}}}}
function DisableTooltips(bShow)
{mouseOnToolTip=false;tooltip_hide(50);var html=$('#GPS_EnableTooltips').html();if(typeof tooltips_enabled!="undefined"&&tooltips_enabled===true)
{tooltips_enabled=false;PicassoWebServices.ManageSite.ToggleTooltips(false);}
else
{tooltips_enabled=true;PicassoWebServices.ManageSite.ToggleTooltips(true);}
if(bShow)
{ShowDialog({title:"Disable Tooltips",innerTitle:"<p>You can turn tooltips on again by selecting <strong>Show Tooltips</strong> in the upper-right <strong>Help</strong> menu.</p>",icon:"/SMSystem/Images/Icons/exclamation.png",noXButton:true,noCloseButton:true,okButtonText:"Ok"});}}
function IsEscapekey(ev)
{ev=ev||window.event;var key=ev.keyCode;return(key==27);}
function IsEnterkey(ev)
{ev=ev||window.event;var key=ev.keyCode;return(key==13||key==3);}
function HandleEnterkey(ev,element)
{if(IsEnterkey(ev))
{if(element.blur)
{try{element.blur();}
catch(ex){}}
return false;}
return true;}
function HandleEnterKey_Wizard(event)
{if(IsEnterkey(event))
{$('.applyButton').click();}
else if(IsEscapekey(event))
{$('.cancelButton').click();}}
function publishChanges()
{function onFailure(sender,e)
{PublishingNotAllowedMessage();}
function onIsAnonymous(sender,e)
{if(sender)
{PublishingNotAllowedMessage();}
else
{startModalDialog("/Editors/PublishChanges.aspx");}}
PicassoWebServices.ManageSite.IsAnonymous(onIsAnonymous,onFailure);}
function publishItemChanges()
{function onFailure(sender,e)
{PublishingNotAllowedMessage();}
function onIsAnonymous(sender,e)
{if(sender)
{PublishingNotAllowedMessage();}
else
{startModalDialogWithItemID("/Editors/PublishChanges.aspx");}}
PicassoWebServices.ManageSite.IsAnonymous(onIsAnonymous,onFailure);}
function publishItemChangesItemID(itemID)
{function onFailure(sender,e)
{PublishingNotAllowedMessage();}
function onIsAnonymous(sender,e)
{if(sender)
{PublishingNotAllowedMessage();}
else
{startModalDialog("/Editors/PublishChanges.aspx?itemID="+itemID);}}
PicassoWebServices.ManageSite.IsAnonymous(onIsAnonymous,onFailure);}
function ClearAllCSSConfirm()
{function ClearAllCSS()
{var folderid=stylesheetMenuPopupID;if(folderid!=null&&folderid!="")
{PicassoWebServices.ManageSite.ClearCSSStyles(folderid,OnPicassoEditorAJAXCallCompleted);}}
ShowDialog({title:"Clear CSS Styles?",innerTitle:"Are you sure you want to delete all your css styles?",icon:"/SMSystem/Images/Buttons/deleteItem-Cold.png",acceptCB:ClearAllCSS});return false;}
function ConfirmDelete(msg,acceptFunc)
{ShowDialog({title:"Delete?",innerTitle:msg,icon:"/SMSystem/Images/Icons/exclamation.png",acceptCB:acceptFunc});}
function AlertDialog(msg)
{ShowDialog({title:"Alert",innerTitle:msg,icon:"/SMSystem/Images/Buttons/deleteItem-Cold.png"});}
function ShowVisualCSS(enable)
{if(enable)
{$('#elementConfigurationStyleTab_tab').show();$('#rightSidePropertyPanelBodyTop,#rightSidePropertyPanelBody').show();}
else
{var cfgtab=picassoGetElementByID("elementConfigurationPropertiesTab_tab");if(cfgtab!=null)
{if($('#elementConfigurationPropertiesTab_tab').is(':visible'))
{PicassoActivateTab(cfgtab,"elementConfigurationTabPanel","elementConfigurationTabContainer");}
$('#elementConfigurationStyleTab_tab').hide();$('#rightSidePropertyPanelBodyTop,#rightSidePropertyPanelBody').hide();}}}
var tabInfo={tabs:{pageDesigner:{selectionID:"",browserID:"",itemType:"",withselection:function(){},noselection:function(){}},stylesheetDesigner:{selectionID:"",browserID:"",itemType:"",withselection:function(){},noselection:function()
{ShowVisualCSS(false);}},databaseDesigner:{selectionID:"",browserID:"",itemType:"",withselection:function(){ShowVisualCSS(false);},noselection:function()
{$('#elementConfigurationPropertiesTab_tab').hide();$('#elementConfigurationPropertiesTab .rightSidePropertyPanelPropertiesBody').hide();ShowVisualCSS(false);}}},changeTab:function(newtabid,lasttabid)
{var lasttab_name=$('#'+lasttabid).attr('tabbodyid');var lasttabobj=tabInfo.tabs[lasttab_name];lasttabobj.selectionID=getSelectedObjectItemID();lasttabobj.browserID=currentSelectedItemBrowserID;lasttabobj.itemType=currentSelectedItemType;var newtabobj=tabInfo.tabs[newtabid];var lastSelId=newtabobj.selectionID;var lastitemtype=newtabobj.itemType;if(lastSelId!="")
{if(!picassoItemSelection.doSelect(lastSelId,lastitemtype,true))
{SelectItemFromItemID(lastSelId,newtabobj.browserID,newtabobj.itemType);}}
else
{ResetSelection();newtabobj.noselection();}}}
function OnFormsTabActivated(tabid,lasttabid)
{if(!formsTabLoaded)
{PicassoWebServices.ManageSite.UpdateForms(OnPicassoEditorAJAXCallCompleted);formsTabLoaded=true;}
OnTabChange("forms");}
function OnTabChange(tabType)
{if(tabType=="database")
{$('#undoCopyToolbar').hide();}
else
{$('#undoCopyToolbar').show();}}
function ResetSelection()
{hideSelectionHandles();setSelectedObject("","","");UpdateSelectionPath("");}
function SaveRHSPropertiesHeadersNodeState()
{property_openNodes=[];property_closedNodes=[];$('#basicPropertiesContainer .picassorhscategoriescontainer_closed').each(function(){property_openNodes.push(this.id);});$('#basicPropertiesContainer .picassorhscategoriescontainer_open').each(function(){property_closedNodes.push(this.id);});css_closeNodes=[];$('#customcssInternal .picassorhscategoriescontainer_open').each(function(){css_closeNodes.push(this.id);});}
function RestoreRHSPropertiesHeadersNodeState()
{for(i=0;i<property_openNodes.length;++i)
{var t=property_openNodes[i];var parentelem=$('#'+t);if(parentelem.length>0){var elem=parentelem.find('a').get(0);CollapsePropertiesHeadersContainers(parentelem.get(0),elem,false);}}
for(i=0;i<property_closedNodes.length;++i)
{var t=property_closedNodes[i];var parentelem=$('#'+t);if(parentelem.length>0){var elem=parentelem.find('a').get(0);ExpandPropertiesHeadersContainers(parentelem.get(0),elem);}}
for(i=0;i<css_closeNodes.length;++i)
{var t=css_closeNodes[i];var parentelem=$('#'+t);if(parentelem.length>0){var elem=parentelem.find('a').get(0);ExpandPropertiesHeadersContainers(parentelem.get(0),elem);}}}
function TogglePropertiesHeadersContainers(elem)
{var jqobj=$(elem);var parentelem=jqobj.parent().parent();if(jqobj.attr('class').indexOf('closed')>0)
{ExpandPropertiesHeadersContainers(parentelem.get(0),elem);}
else
{CollapsePropertiesHeadersContainers(parentelem.get(0),elem,true);}
SaveRHSPropertiesHeadersNodeState();}
function CollapsePropertiesHeadersContainers(parentelem,elem,bAnimate)
{if(bAnimate)
{$(parentelem).animate({height:'22px'},0);}
else
{$(parentelem).height('22px');}
$(parentelem).removeClass('picassorhscategoriescontainer_open').addClass('picassorhscategoriescontainer_closed');elem.className="picassoRHSHeader_closed";}
function ExpandPropertiesHeadersContainers(parentelem,elem)
{$(parentelem).css({height:''});$(parentelem).removeClass('picassorhscategoriescontainer_closed').addClass('picassorhscategoriescontainer_open');elem.className="picassoRHSHeader_open";}
function editCurrentPageFromPreview()
{var pageTemplatePreviewIframe=picassoGetElementByID("pageTemplatePreviewIframe");var url=pageTemplatePreviewIframe.src;closeSitePreview();}
function getStyleIDFromGUID(itemID)
{return"id"+itemID.replace(/-/g,"")+"_styles";}
function saveStyleProperty2(styleName,stylePropertyField)
{var selectedItemID=null;if(currentSelectedClass!="")
{selectedItemID=currentSelectedClass;}
else
{selectedItemID=getSelectedObjectItemID();}
if(selectedItemID!=null)
{if($('#currentPageID').val()==selectedItemID)
{var subpart=$('#pagePartSelectList').val();PicassoWebServices.ManageSite.SetStylePagePropertyValue(styleName,stylePropertyField,selectedItemID,subpart,OnPicassoEditorAJAXCallCompleted);}
else
{PicassoWebServices.ManageSite.SetStylePropertyValue(styleName,stylePropertyField,selectedItemID,OnPicassoEditorAJAXCallCompleted);}}}
function applyStyleProperties()
{var selectedItemID=null;if(currentSelectedClass!="")
{selectedItemID=currentSelectedClass;}
else
{selectedItemID=getSelectedObjectItemID();}
if(selectedItemID!=null)
{var cssString=$('#style-css-summary-box').val();if($('#currentPageID').val()==selectedItemID)
{var subpart=$('#pagePartSelectList').val();PicassoWebServices.ManageSite.ApplyCSSToStyle(selectedItemID,cssString,subpart,OnPicassoEditorAJAXCallCompleted);}
else
{PicassoWebServices.ManageSite.ApplyCSSToStyle(selectedItemID,cssString,"",OnPicassoEditorAJAXCallCompleted);}}}
function clearStyleProperties()
{var selectedItemID=null;if(currentSelectedClass!="")
{selectedItemID=currentSelectedClass;}
else
{selectedItemID=getSelectedObjectItemID();}
if(selectedItemID!=null)
{$('#style-css-summary-box').val('');if($('#currentPageID').val()==selectedItemID)
{var subpart=$('#pagePartSelectList').val();PicassoWebServices.ManageSite.ClearPageStyleProperties(selectedItemID,subpart,OnPicassoEditorAJAXCallCompleted);}
else
{PicassoWebServices.ManageSite.ClearStyleProperties(selectedItemID,OnPicassoEditorAJAXCallCompleted);}}}
function highlightSelectors(selector,subselector)
{selector=selector.replace(':hover','').replace(':active','').replace(':link','').replace(':visited','');$(selector).each(function()
{if(subselector)
{$(this).find(subselector).each(function(){highlightElement(this);});}
else
{highlightElement(this);}})}
function highlightElement(element)
{var parentAnchor='#picasso_main';var parentOffset=$(parentAnchor).offset();var zoffset=$(element).offset();var ztop=zoffset.top-parentOffset.top-1;var zleft=zoffset.left-parentOffset.left-1;var zheight=$(element).get(0).offsetHeight;var zwidth=$(element).get(0).offsetWidth;if($.browser.msie)
{$("<div></div>").appendTo(parentAnchor).css({border:'2px solid #ee0000',zIndex:"90000",width:zwidth,height:zheight,position:'absolute',top:ztop+"px",left:zleft+"px"}).addClass('ztempHighlight');}
else
{$("<div></div>").appendTo(parentAnchor).css({outline:'2px solid #ee0000',zIndex:"90000",width:zwidth,height:zheight,position:'absolute',top:ztop+"px",left:zleft+"px"}).addClass('ztempHighlight');}
setTimeout(function(){$(parentAnchor+' .ztempHighlight').fadeOut(500,function(){$(this).remove();})},1000);}
function getHelpWindow(picassoItemName)
{var helpName=tooltips[picassoItemName.toLowerCase()];window.open('/Help/sitemasher_help_CSH.html#'+helpName,'','scrollbars=1, status=1, toolbar=1, resizable=1, width=1260, height=800');}
var placeItemPopup={selectedItemNode:null,ajaxInProgress:false,isChildOf:function(target)
{if(getIsChildOf(picassoGetElementByID("placeItemPopup"),target))
{return true;}
if(placeItemPopup.selectedItemNode!=null)
{placeItemPopup.close();placeItemPopup.selectedItemNode=null;}
return false;},select:function(target)
{if($('#currentPageID').val().indexOf(kGuidEmpty)==-1&&$('#emptySitePagePlaceholder').length==0)
{{placeItemPopup.selectedItemNode=target;$('#placeItemPopup .placeItemView').show();$('#placeItemPopup .placeItemViewEmpty').hide();$('#placeItemPopup').show();placeItemPopup.ajaxInProgress=true;PicassoWebServices.ManageSite.GetPageItemHierarchy(getItemTree_OnComplete);}}},showEmpty:function()
{$('#placeItemPopup .placeItemView').hide();$('#placeItemPopup .placeItemViewEmpty').show();},close:function()
{$('#placeItemPopup').hide();},accept:function()
{placeItemPopup.close();if(typeof pageHTreeState2!="undefined")
{var activeli=pageHTreeState2.getSelectedLI();if(placeItemPopup.selectedItemNode!=null&&activeli!=null)
{var itemType=placeItemPopup.selectedItemNode.getAttribute("createItemType");var itemArgument=placeItemPopup.selectedItemNode.getAttribute("dragitemargument");PicassoWebServices.ManageSite.DropItem(itemType,itemArgument,activeli.attr('treeobjectid'),'','0','0','0','0',OnPicassoEditorAJAXCallCompleted);}}
placeItemPopup.selectedItemNode=null;return false;},cancel:function()
{placeItemPopup.close();return false;}}
function editArticleHTML(event,itemID)
{var url=String.Format('Editors/HtmlWidgetEditor.aspx?HTML=True&ItemID={0}',itemID);startModalDialog(url);if(event.stopPropagation)
event.stopPropagation();event.cancelBubble=true;}
function editStylesheetCSS()
{var activeli=styleTreeState.getSelectedLI();if(activeli.size()>0)
{var ssid=activeli.attr('treeobjectid');if(activeli.attr('nodetype')!='PicassoStylesheetItem')
{ssid=activeli.parents('[nodetype=PicassoStylesheetItem]:first').attr('treeobjectid');}
if(ssid)
{var url=String.Format('Editors/HtmlWidgetEditor.aspx?ItemID={0}',ssid);startModalDialog(url);}}
else
{ShowDialog({title:"No Stylesheet Selected",innerTitle:"<p>Please select a style item on the left hand side to be able to use the stylesheet text editor.</p>",icon:"/SMSystem/Images/Icons/exclamation.png",noXButton:true,noCloseButton:true,okButtonText:"Ok"});}}
function updateDomainStatus(domainStatus)
{var image='SMSystem/Images/Icons/alert.png';if(domainStatus.indexOf('Manage')>=0)
{image='SMSystem/Images/Icons/check.png';}
$('#goLiveManagedDomainsStatusIcon').attr('src',image);$('#goLiveManagedDomainsStatus').html(domainStatus);}
function StartDataLinkDialog()
{startModalDialogWithItemID("Wizards/DataLinkWizard.aspx");}
function createWidget()
{var itemID=getSelectedObjectItemID();if(itemID==null||itemID==''||itemID=='00000000-0000-0000-0000-000000000000')
{OnErrorMsgDialog("There are no items on your site for an extension to be created from.");return;}
startModalDialogWithItemID("Wizards/CreateWidget.aspx");}
function createWidgetWithSelection()
{var itemID=getSelectedObjectItemID();if(itemID&&itemID!="")
{startModalDialog("Wizards/CreateWidget.aspx?ItemID="+itemID+"&fromSelection=true");}}
function configureWidget()
{startModalDialog("Wizards/CreateWidget.aspx?extensionid="+$('#currentSiteID').val());}
function closeItemWizard(isNewItem,closeCommand,itemID)
{closeModalDialog();if(isNewItem&&isNewItem=="True"||closeCommand)
{if(isPicassoStudio)
{if(closeCommand=="Everything")
{PicassoWebServices.ManageSite.UpdateEverything(false,true,OnPicassoEditorAJAXCallCompleted);}
else if(closeCommand.indexOf("WidgetEdited")==0)
{var wvars=closeCommand.split(":");if(wvars.length>1)
{$('#currentSiteName2').attr('title',wvars[1]).html(wvars[1].Ellipse(19));}
PicassoWebServices.ManageSite.UpdateEditorWindow(OnPicassoEditorAJAXCallCompleted);}
else if(closeCommand.indexOf("Database")==0)
{var wvars=closeCommand.split(":");if(wvars.length>1)
{PicassoWebServices.ManageSite.UpdateDatabase(function(results)
{OnPicassoEditorAJAXCallCompleted(results);var dbid=wvars[1];picassoLists.selectQueryObjectFromID($('#queryObjectsUL li[dbid='+dbid+']').get(0),dbid,'PicassoDataSourceFilter',false);});}}
else if(closeCommand=="Files")
{PicassoWebServices.ManageSite.UpdateFiles(OnPicassoEditorAJAXCallCompleted);}
else if(closeCommand=="Images")
{PicassoWebServices.ManageSite.UpdateImages(OnPicassoEditorAJAXCallCompleted);}
else if(isNewItem=="True"&&closeCommand=="Cancel")
{if(dragHelper&&dragHelper!=null)
{dragHelper.innerHTML='';}}
else
{if(itemID&&itemID!="")
{PicassoWebServices.ManageSite.OnEditComplete(itemID,closeCommand,OnPicassoEditorAJAXCallCompleted);}
else if(closeCommand!=""&&closeCommand!="Accept")
{PicassoWebServices.ManageSite.OnRedrawStudio(closeCommand,OnPicassoEditorAJAXCallCompleted);}
else
{PicassoWebServices.ManageSite.UpdateEditorWindow(OnPicassoEditorAJAXCallCompleted);}}}}}
if(typeof cache_debug!="undefined")
{var lastcachesize=0;function cachesize()
{var i=0;for(var c in jQuery.cache)
{i=i+1;}
return i;}
function cachedump()
{var i=0;for(var c in jQuery.cache)
{if(i>lastcachesize)
{if(jQuery.cache[c].handle!=undefined)
{plog(jQuery.cache[c].handle.elem);}}
i=i+1;}
if(i>lastcachesize)
lastcachesize=i;}
$(function()
{$(document).click(function()
{cachedump();});})}