/*from file */

/*
FILE: jquery/jquery-1_4_2_min
FILE: microtemplate/Template
FILE: ria/Array
FILE: ria/Component
FILE: ria/CorneredBox
FILE: ria/GlobalEventManager
FILE: ria/Math
FILE: ria/RIA
FILE: ria/ValueObject
FILE: ria/cmd/Command
FILE: media/Media
FILE: cssruleplugin/cssRule
FILE: popupmanager/PUAlert
FILE: popupmanager/PopupManager
FILE: popupmanager/tpl/LoadingPopUp
FILE: popupmanager/tpl/ModalWindow
FILE: popupmanager/tpl/PUAlert
FILE: popupmanager/tpl/Popup
FILE: json2/json2
FILE: validation/Validation
FILE: jqueryflash/jQueryFlash
FILE: jqueryhashchange/jqueryhashchange
FILE: jquerycache/jquerycache
FILE: php_js/phpdate_namespaced_min
FILE: tinymce/jquery_tinymce
FILE: fileuploader/fileuploader
FILE: mindmap/Mindmap
FILE: markitup/jquery_markitup
FILE: prettify/core/prettify
FILE: prettify/ext/lang-css
FILE: prettify/ext/lang-sql
FILE: prettify/ext/lang-wiki
FILE: ostudios/Route
FILE: ostudios/Router
FILE: ostudios/Services
FILE: ostudios/admin/login/LoginPage
FILE: ostudios/admin/login/cmd/logincmd
FILE: ostudios/admin/login/cmd/logoutcmd
FILE: ostudios/admin/login/tpl/loginview
FILE: ostudios/admin/post/PostAdmin
FILE: ostudios/admin/post/cmd/deletePostCMD
FILE: ostudios/admin/post/cmd/getPostCMD
FILE: ostudios/admin/post/cmd/submitPostCMD
FILE: ostudios/admin/post/cmd/uploadImageViaURLCMD
FILE: ostudios/admin/post/tpl/ImagePreview
FILE: ostudios/admin/post/tpl/PostAdmin
FILE: ostudios/admin/post/tpl/PostForm
FILE: ostudios/admin/post/tpl/QuickEdit
FILE: ostudios/admin/post/tpl/success
FILE: ostudios/admin/root/OStudiosAdmin
FILE: ostudios/admin/toolbar/ToolBar
FILE: ostudios/admin/toolbar/cmd/GetPageInfoCMD
FILE: ostudios/admin/toolbar/tpl/QuickLink
FILE: ostudios/contact/Contact
FILE: ostudios/contact/cmd/ContactCMD
FILE: ostudios/post/Post
FILE: ostudios/post/cmd/GetPostDetailsCommand
FILE: ostudios/postpage/PostPage
FILE: ostudios/postpage/cmd/GetPostPageDetailsCommand
FILE: ostudios/root/OStudios
FILE: ostudios/root/cmd/LoadPageCMD
FILE: ostudios/search/Search
FILE: ostudios/search/cmd/SearchTitleCommand
FILE: ostudios/search/tpl/SearchResults
FILE: ostudios/search/tpl/SearchView
FILE: octopikidstheme/loadingview
FILE: simile/Timeline
VO FOLDER: vo
FILE (virtual): ostudios_vo_listcollectionvo
FILE (virtual): ostudios_vo_listvo
FILE (virtual): ostudios_vo_mediavo
FILE (virtual): ostudios_vo_postvo
FILE (virtual): ostudios_vo_sitevo
FILE (virtual): ostudios_vo_tagvo
FILE (virtual): ostudios_vo_uservo
*/

/*****************************
FILE: jquery/jquery-1_4_2_min    
*****************************/

/*!
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.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(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.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(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.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(g){return g.getAttribute("href")}},
relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
a:b+"></"+d+">"},F={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,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},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(a){function b(){e.success&&
e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<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>";
a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);


/*****************************
FILE: microtemplate/Template    
*****************************/



function microtemplate_Template( content )
{
	this._tmplCache = {};
	this.content = content;
}
 
microtemplate_Template.prototype.parse = function( data ) {
    var str = this.content;

    /// <summary>
    /// Client side template parser that uses &lt;#= #&gt; and &lt;# code #&gt; expressions.
    /// and # # code blocks for template expansion.
    /// NOTE: chokes on single quotes in the document in some situations
    ///       use &amp;rsquo; for literals in text and avoid any single quote
    ///       attribute delimiters.
    /// </summary>    
    /// <param name="str" type="string">The text of the template to expand</param>    
    /// <param name="data" type="var">
    /// Any data that is to be merged. Pass an object and
    /// that object's properties are visible as variables.
    /// </param>    
    /// <returns type="string" />
    var err = "";
    try {
        var func = this._tmplCache[str];
        if (!func) {
            var strFunc =
	            "var p=[],print=function(){p.push.apply(p,arguments);};" +
	                        "with(obj){p.push('" +
	
	            str.replace(/[\r\t\n]/g, " ")
	               .replace(/'(?=[^#]*#>)/g, "\t")
	               .split("'").join("\\'")
	               .split("\t").join("'")
	               .replace(/<#=(.+?)#>/g, "',$1,'")
	               .split("<#").join("');")
	               .split("#>").join("p.push('")
	               + "');}return p.join('');";

            //alert(strFunc);
            func = new Function("obj", strFunc);
            this._tmplCache[str] = func;
        }
        return func(data);
    } catch (e) { err = e.message; }
    return "< # ERROR: " + err + " # >";
}

/*****************************
FILE: ria/Array    
*****************************/



function ria_Array()
{
}

//static
ria_Array.findObj = function( array , value , prop )
{
	if ( RIA.isNull( prop ) )
		prop = "id";
		
	for ( var i=0; i< array.length; i++ ) {
		var item = array[i];
		if ( item[ prop ] == value ) {
			return item;
			break;
		}
	} 
	
	return false;//this isn't a possibility  
}

/*****************************
FILE: ria/Component    
*****************************/



function ria_Component( element )
{
	this.registerElement( element );	
}

ria_Component.prototype.registerElement = function( element )
{
	if ( !RIA.isNull( this.element ) ) {
		this.deleteElement();
	}
	
	this.element = element;	
	
	if ( element ) {
		this.jsdata = element.data('jsdata');
		this.element.data( "comp" , this );
		//should manually do this
		//this.listenToResize();
		
		//RIA.log( element.data('jsclass') );		
		var me = this;
		element.click( function( event ) {  
			var clickaction = $(event.target).attr("clickaction");
			var clickvalue = $(event.target).attr("clickvalue");
			if ( clickaction == 'submitform') {
				me.onSubmit( 
					 $(event.target).attr( 'id' )//pass in form id... 
					,event
				)
			}else{
				me.onClick( 
					 clickaction//standarize click action attribute 
					,clickvalue
					,event
				)
			}
		});
		//me = null;//causes clicks to fail
	}
}

ria_Component.prototype.listenToElementClick = function( element )
{
	var me = this;
	if ( element.element )//check for components being sent in...
		element = element.element;
	
	element.click( function( event ) { 
		var clickaction = $(event.target).attr("clickaction");
		var clickvalue = $(event.target).attr("clickvalue");
		if ( clickaction == 'submitform') {
			me.onSubmit( 
				 $(event.target).attr( 'id' )//pass in form id... 
				,event
			)
		}else{
			me.onClick( 
				 clickaction//standarize click action attribute 
				,clickvalue
				,event
			)
		}		
	});
}

ria_Component.prototype.attachAsChild = function( parentElement , style )
{
	//style='width:100%;height:100%'
	$( parentElement ).html( "<div style='" + style + "'></div>" );//
	this.registerElement( $( parentElement ).find("div") );
}


ria_Component.prototype.triggerClick = function ( clickaction , clickvalue )
{
	RIA.triggerClick( this.element , clickaction , clickvalue );	
}

//a bounce is an event traveling from a component to all of the
//components found in the DOM below that element
ria_Component.prototype.bounceEvent = function( action , value , event )
{
	var comps = this.$('*[jscomp]');
	for ( var c=0; c<comps.length; c++ ) {
		var comp = comps[c];
		$(comp).data('comp').onBounce( action , value , event );
	}
}
ria_Component.prototype.onBounce = function( action , value , event )
{
}
ria_Component.prototype.onClick = function( action , value , event )
{
}
ria_Component.prototype.onSubmit = function( formid , event )
{
}

ria_Component.prototype.$ = function( searchStr )
{
	return this.element.find( searchStr );
}

ria_Component.prototype.getComponent = function( jsclass )
{
	return RIA.getComponent( jsclass , this.element );
}

ria_Component.prototype.deleteElement = function()
{
	if ( this.element ) {
		this.clearResize();
		this.element.remove();
		this.element.data( "comp" , null );
		this.element = null;
	}	
}

ria_Component.prototype.replaceElement = function( newElementHTML )
{
	RIA.replaceComponentElement( this , newElementHTML );
}

ria_Component.prototype.getFirstParentComp = function( jsclass )
{
	var parents = this.element.parents();
	
	for ( var i=0; i<parents.length; i++ ) {
		var par = parents[i];
		var data = $(par).data();
		if ( $(par).data("jsclass") == jsclass ) {
			return $(par).data("comp");
			break;
		}
	}
	return false;
}

ria_Component.prototype.listenToResize = function(pause)
{
	this.listenToResizeWorker( this.element ,pause );
}
ria_Component.prototype.clearResize = function()
{
	this.clearResizeWorker( this.element);
}

ria_Component.prototype.listenToWindowResize = function(pause)
{
	this.listenToResizeWorker( window ,pause);
}
ria_Component.prototype.clearWindowResize = function()
{
	this.clearWindowResizeWorker( window );
}

ria_Component.prototype.listenToResizeWorker = function( ele , pause )
{
	if ( RIA.isNull(pause))
		pause = 0;
	
	var me = this;
	$(ele).resize( function() {
		//me.onResize();
		setTimeout( function() { me.onResize(); } , pause );
	});
	//kick into right size
	this.onResize();
	setTimeout( function() { me.onResize(); } , 100 );
	
}

ria_Component.prototype.clearResizeWorker = function( ele )
{
	$(ele).unbind('resize');
}


ria_Component.prototype.onResize = function()
{
}


/*****************************
FILE: ria/CorneredBox    
*****************************/





function CorneredBox (){}


CorneredBox.start = function( cssclass )
{
	var content = "<table class='<#=cssclass#>'><tr class='top'><td class='lt'>&nbsp;</td><td class='mt'>&nbsp;</td><td class='rt'>&nbsp;</td></tr><tr><td class='ml'>&nbsp;</td><td class='m'>";
	content = content.replace("<#=cssclass#>",cssclass);
	return content;
}	

CorneredBox.end = function()
{
	return "</td><td class='mr'>&nbsp;</td></tr><tr class='bottom'><td class='lb'>&nbsp;</td><td class='mb'>&nbsp;</td><td class='rb'>&nbsp;</td></tr></table>";
}



/*****************************
FILE: ria/GlobalEventManager    
*****************************/



function GlobalEventManager()
{
}

GlobalEventManager.events = {};

GlobalEventManager.addEventListener = function( eventName , func , obj )
{
   	if ( RIA.isNull( GlobalEventManager.events[eventName] ) ) {
   		GlobalEventManager.events[eventName] = [];
   	}
   	
   	for ( var i in GlobalEventManager.events[eventName] ) {
   		var evt = GlobalEventManager.events[eventName][i];
   		if ( evt.func === func 
   			&& evt.obj === obj
   		) {
   			return;//don't allow dups 			
   		}   		
   	}
   	
   	GlobalEventManager.events[eventName].push( {func:func,obj:obj} );
}


GlobalEventManager.removeEventListener = function( eventName , func , obj )
{
   	if ( RIA.isNull( GlobalEventManager.events[eventName] ) ) {
   		return
   	} 
   	
   	var newArray = [];
   	for ( var i in GlobalEventManager.events[eventName] ) {
   		if ( GlobalEventManager.events[eventName][i].func !== func ) {
   			newArray.push(GlobalEventManager.events[eventName][i]);   			
   		}   		
   	}
   	GlobalEventManager.events[eventName] = newArray;
}

GlobalEventManager.dispatchEvent = function( eventName , eventObj )
{
   	if ( RIA.isNull( GlobalEventManager.events[eventName] ) ) {
   		return;
   	} 
   	
   	for ( var i in GlobalEventManager.events[eventName] ) {
   		var evt = GlobalEventManager.events[eventName][i];
   		evt.func.call( evt.obj , eventObj );   		
   	}
}

/*****************************
FILE: ria/Math    
*****************************/



function ria_Math()
{
}

/**
 * static function
 * @param number num is the number you want rounded
 * @param number dec is the number of decimal places you want rounded to
 * @return number
 */
ria_Math.roundNumber = function (num, dec) {
	if( !ria_Math.isNumber( num ) ) {
		return num;
	}
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}

/**
* static function
* @param number n is the value you want to test
* @return boolean
*/
ria_Math.isNumber = function(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
}


/*****************************
FILE: ria/RIA    
*****************************/




function RIA()
{
}

RIA.uid = 0;

RIA.serializeJSData = function ( data ) {
	return JSON.stringify( data ).replace( "'" , "&apos;" );
}
RIA.deserializeJSData = function ( data ) {
	return JSON.parse( data );
}

RIA.preventDefault = function ( event ) {
	event.preventDefault ? event.preventDefault() : event.returnValue = false;
}

/*
 * jQuery's serializeArray returns name/value pairs which
 * is usually needed to be pushed into an id, so this is
 * a helper for that.
 * 
 * */
RIA.getFormData = function ( form ) {
	var rawData = $(form).serializeArray();

	for ( var i=0; i<rawData.length; i++ ) {
		var data = rawData[i];
		data.id = data.name;
		data.name = null;
	}
	return rawData;
}

RIA.getAssocFormData = function ( form ) {
	var rawData = $(form).serializeArray();
	var assocData = {};
	var namesArr = {};//look for multiselect content....
	for ( var i=0; i<rawData.length; i++ ) {
		var data = rawData[i];
		if ( namesArr[ data.name ] !== true ) {
			assocData[ data.name ] = data.value;
			namesArr[ data.name ] = true;
		}else{
			if ( RIA.typeOf( assocData[ data.name ] ) !== "array" ) {
				assocData[ data.name ] = [assocData[ data.name ]];
			}
			assocData[ data.name ].push( data.value );
		}
	}
	return assocData;
}


RIA.clone = function ( object , deep )
{
    if ( deep == true ) {
    	return JSON.parse(JSON.stringify( object ));
    }else{
    	var ClonedObject = function(){};
    	ClonedObject.prototype = object ;
    	return new ClonedObject;
    }   
}

/*
 * helper to capture form submissions without having to hook into submit event
 * (ie also likes to forget the submit event)
 * You can use this from within a click event...
 * It will look for the closest form and submit it....you can avoid submit buttons if you like
 */
RIA.onsubmit = function ( event )
{
 
    var target;
   	if ( event.target ) {
		target = event.target;
		$(target).blur();
    }else{
    	target = event.srcElement;//ie doesn't like you or your parents
    }
	
    var nodeName = $(target)[0].nodeName;
    if ( nodeName.toLowerCase() != "form" ) {
    	target = $(target).closest("form");    	
    }
    
    $(target).attr("clickaction","submitform");
   	$(target).trigger('click');
   	$(target).removeAttr("clickaction");//avoid submits via clicks afterward
   	
    return false;   
}
RIA.submit = RIA.onsubmit;



RIA.triggerClick = function ( target , clickaction , clickvalue )
{
	var prevClickAction = $(target).attr("clickaction");
	var prevClickValue = $(target).attr("clickvalue");
	
	$(target).attr("clickaction", clickaction );
	$(target).attr("clickvalue", clickvalue );
   	$(target).trigger('click');
	
	$(target).attr("clickaction", prevClickAction );
	$(target).attr("clickvalue", prevClickValue );	
}

RIA.onchange = function ( event )
{
	var target = $(event.target);
	RIA.triggerClick( event.target , target.attr('id') , target.val() );
}
 
/*
 * Components are designed around elements within the DOM. 
 * They can find other components instantiated within the 
 * page two ways:
 * 
 * "getFirstParentComp" will walk up the parent chain and 
 * return the first hit for that Javascript Class:
 * 
 * */
RIA.createComponents = function()
{
   	$("[jsclass]").each ( RIA.createComponentWorker );
}

RIA.createComponentWorker = function( index )
{
   	var me = $(this);
	var jsclass = me.attr("jsclass");
	
	var jsobjref = window[ jsclass ];
	if ( jsobjref ) {
		me.data( 'jsclass' , jsclass );
		me.data( 'jsdata' , jQuery.parseJSON( me.attr("jsdata") ) );
		//me.removeAttr("jsdata");
		me.attr( 'jscomp' , jsclass );			
		//get this out before the comp initializes    	
    	me.removeAttr('jsclass');//don't want duplicate components
    	me.removeAttr('jslazyclass');
    	var jsobj = new jsobjref( me );
    	//comp is added to data via component itself...	    		
	}
	//me = null;    
}


RIA.createLazyComponents = function ( element ) {
	var parents = $( element ).parents();
	parents.push( $( element ) );
	for ( var i=0; i<parents.length; i++ ) {
		var theParent = $( parents[i] );
		if ( theParent.attr("jslazyclass") ) {
			//alert(theParent.attr("jslazyclass"));
			theParent.attr("jsclass",theParent.attr("jslazyclass"));
			$( theParent ).each ( RIA.createComponentWorker );
			break;
		}
	}
}

RIA.replaceComponentElement = function ( component , newElementHTML ) {
	var origElement = component.element;
	var newElement = $( newElementHTML ).insertAfter( origElement );
	
	if( newElement.length > 1 ) {
		alert("new element HTML should be a single node (" + origElement.data('jsclass') + ")");
	}

	//push info into data of new element
	newElement.data( 'jsdata' , component.jsdata );//component should sustain jsdata 
	newElement.data( 'jsclass' , origElement.data('jsclass') );			
	//add the attribute
	newElement.attr( 'jscomp' , origElement.data('jsclass') );    	
	newElement.removeAttr('jsclass');
	newElement.removeAttr("jsdata");
	
	//recall the constructer to reinitialize listeners
	var jsobjref = window[ origElement.data('jsclass') ];
	jsobjref.call( component , newElement );
	
	origElement.data( "comp" , null );//get rid of reference to this object
	origElement.remove();
	origElement = null;
}

/*
 * "getComponent" will get the first result for a child within 
 * the component that has the Javascript object instantiated on it:
 * */
RIA.getComponent = function ( compclass , scope ) {
	var components = RIA.getComponents( compclass , scope );
	return components[0];
}

RIA.getComponents = function ( compclass , scope ) {
	var jscomps = $( scope ).find("[jscomp='" + compclass + "']");
	var jsclasses = $( scope ).find("[jsclass='" + compclass + "']");	
	
	var domArr = jQuery.merge( jscomps , jsclasses );
	var compArr = new Array();
	for ( var i=0; i<domArr.length; i++ ) {
		var domItem = $( domArr[i] );
		compArr.push( domItem.data("comp") );
	}
	return compArr;
}

RIA.log = function ( message ) {
	RIA.logHandler( message );
}
RIA.logHandler = function ( message ) {
	if ( !RIA.isNull ( window.console ) ) 
		console.log( message );
}

RIA.tryError = function ( err ) {
	RIA.error( "Try error: " + err.message );
}
RIA.error = function ( errorMessage ) {
	RIA.errorHandler( errorMessage );
}
RIA.errorHandler = function ( errorMessage ) {
	alert( "RIA:" + errorMessage );
}

/* Returns the class name of the argument or undefined if
   it's not a valid JavaScript object.
*/
RIA.getObjectClassName = function (obj) {
    if (obj && obj.constructor && obj.constructor.toString) {
        var arr = obj.constructor.toString().match(
            /function\s*(\w+)/);

        if (arr && arr.length == 2) {
            return arr[1];
        }
    }
    return undefined;
}

RIA.classArrayObjects = function ( theArray , jsclass ) {
	var newArray = [];
	for ( var i=0; i<theArray.length; i++ ) {
		newArray.push( new jsclass( theArray[i] ) );
	}
	return newArray;
}

RIA.isNull = function ( value ) {	
	if ( value === null ) {
		return true;
	}else if ( typeof( value ) == "undefined" ) {
		return true;
	}else{
		return false;
	}
}

RIA.typeOf = function (value) {
    var s = typeof value; 
    if (s === 'object') {
        if (value) {
            if (typeof value.length === 'number' &&
                !(value.propertyIsEnumerable('length')) && typeof value.splice === 'function') {
            	s = 'array';
            }
        }else{
        	s = 'null';
        }
    } 
    return s;
} 

RIA.trim = function (stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
RIA.ltrim = function (stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
RIA.rtrim = function (stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}
RIA.truncate = function ( str , len ) {
	var stringLenth = str.length;
	if ( stringLenth > len ) {
		var newStr = str.substring( 0 , len );
		return RIA.rtrim( newStr ) + "...";
	}else{
		return str;	
	}		
}








/*****************************
FILE: ria/ValueObject    
*****************************/

/*
* ValueObject
*
* root of all valueobjects
*/

function ria_valueobject(  )
{
	//this generally doesn't stand on it's own so don't do any defaultObj
}

//centralize this in case extend needs to be changed...
ria_valueobject.extend = function ( rootObj , defaultObj ) {
	if ( !RIA.isNull( rootObj ) && !RIA.isNull( defaultObj ) ) 
		jQuery.extend( rootObj , defaultObj );		
}


/*****************************
FILE: ria/cmd/Command    
*****************************/

/**
 * Base class for AJAX commands. This class should not be called directly, but extended.
 * The extending class should define the url.
 * 
 * Example usage:
 * var cmd = new mg_shell_cmd_LoginCommand();
 * cmd.execute( { username : 'test', password : 'test' }, this );
 * 
 */
function ria_cmd_Command()
{
}

/**
 * @var string A string containing the URL to which the request is sent.
 */
ria_cmd_Command.prototype.url = '';

/**
 * @var object Data to be sent to the server. It will be converted to a query string.
 */
ria_cmd_Command.prototype.data = {};

ria_cmd_Command.prototype.dataType = 'json';

/**
 * @var string Request type (eg. GET, POST)
 */
ria_cmd_Command.prototype.type = 'POST';

/**
 * @var object The object that called this command.
 */
ria_cmd_Command.prototype.scope = '';


/**
 * Triggers ajax request
 * @param object Data to be sent to the server.
 * @param object scope
 * @param boolean encodeArgs. If true, data is wrapped into a single parameter that is JSON formated 
 */
ria_cmd_Command.prototype.execute = function( data , scope , encodeArgs )
{
	if ( encodeArgs === true )
		data =  {params:RIA.serializeJSData(data)};
	
	
	if ( $.isPlainObject( data ) || $.isArray( data ) ) {
		data = $.param( data );
	}
	this.data = data;
	this.scope = scope;
	var me = this; 
	
    if( this.url == '' ) { 
    	alert( 'No url set in ' + RIA.getObjectClassName( this ) );//this.me );
    	return; 
    }
    
    this.loadingStarted();
    
	if ( this.dataType == 'jsonp' ) {
		
		$.ajax({
			 type: "GET"
			,url: this.url
			,dataType : 'jsonp'
			,data: data
			,jsonp: 'callback'
			,timeout : 10000			
			,success: function( data, textStatus, XMLHttpRequest ) {
	    		me.validateJson( data, textStatus );
			}
			,error: function( XMLHttpRequest, textStatus, errorThrown ) {
				me.failure( textStatus, errorThrown );
			}
		});
	}else{
		 $.ajax({
			 type: this.type
			,url: this.url
			,dataType : 'json'
			,data: data
			,success: function( data, textStatus, XMLHttpRequest ) {
	    		me.validateJson( data, textStatus );
			}
			,error: function( XMLHttpRequest, textStatus, errorThrown ) {
				me.failure( textStatus, errorThrown );
			}
		});	
	}
}

/*function ria_cmd_Command_jsonp_callback ( data ) {
	self.validateJson( data );
}*/
 
/*
 * Triggered each time a service starts loading 
 * */
ria_cmd_Command.prototype.loadingStarted = function()
{
 	PopupManager.showGlobalLoading();
}

/*
 * Triggered when a service is done loading regardless of success/failure
 * */
ria_cmd_Command.prototype.loadingDone = function()
{
	PopupManager.hideGlobalLoading();
}

/**
 * Validates format of json response. There must be a 'success' property.
 * Triggers the success or failure functions.
 * Example:
 * 	{"success":"true"
 *	,"name":"home/login" 
 *	,"result":{userid:'3',username:'joe',name:'billy bob'}
 *	,"error":{"id":"ERROR_NONE","details":""}
 * 	}
 * @param object parsed from JSON results
 * @param string describing the status  
 */
ria_cmd_Command.prototype.validateJson = function( results, status )
{
	var self = this;
	try {
		var successFound = false;
		$.each( results, function(name, value) {
		    if( name == 'success') {
		    	if( value == "false" || value == false ){
		    		self.failure( results.error.id, results.error );
		    		successFound = true;
		    		return;
		    	}else{
		    		self.success( results, status );
		    		successFound = true;
		    		return;
		    	}
		    }
		});
		
		//results object didn't have success property!
		if(!successFound) {
			self.failure( 'ERROR_JSON_PARSE', {} );
		}
	}catch ( err ) {
		self.failure( 'ERROR_TRY' , err );
	}	
}

/**
 * @param object parsed from JSON results
 * @param string describing the status  
 */
ria_cmd_Command.prototype.success = function( results, status )
{
	this.loadingDone();
}

/**
 * Handle errors appropriately, needs to be fleshed out!
 * @param string describing the status, some possible values (besides null) are "timeout", "error", "notmodified" and "parsererror"
 * @param object exception object, if one occurred
 */
ria_cmd_Command.prototype.failure = function( status , errorThrown )
{
	
	this.loadingDone();
	switch( status ) {
		case 'ERROR_TRY':
		case 'ERROR_NONE':
		case 'ERROR_JSON_PARSE':
		case 'timeout':
		case 'error':
		case 'notmodified':
		case 'parsererror':
		default :
			RIA.log( errorThrown );
			RIA.error( errorThrown );//"An error occurred:" + errorThrown.message );
			break;
	}	
}


/*****************************
FILE: media/Media    
*****************************/



//don't forget to put this path into the javascript path array
Media = function (){
}

Media.deliminator = "-";

Media.image = function ( path , tagparams , params , version ) {
	if ( RIA.isNull( tagparams ) )
		tagparams = [];
	if ( RIA.isNull( version ) )
		version = '';	
	
	var paramStr = "";
	for ( var paramname in tagparams ) {
		if ( paramname == "cls" ) {
			paramnamestr = "class";
		}else{
			paramnamestr = paramname;
		}
	
		paramStr += " " + paramnamestr + "='" + tagparams[ paramname ] + "'";
	}	
	
	return "<img src='" + Media.getImageURL( path , params , version ) + "' " + paramStr + " />";
}


//update to include more details about params...translated into string path...
Media.getImageURL = function ( path , params , version ) {
	if ( RIA.isNull( params ) )
		params = [];
	if ( RIA.isNull( version ) )
		version = '';
	
	var imgInfo = this.getImageInfo( path );
	var paramStr = "";
//size	
	if ( params['width'] )
		paramStr += params['width'];						
	if ( params['height'] )
		paramStr += "x" + params['height'];

//crop			
	paramStr += Media.deliminator;
	
	if ( params['cropWidth'] )
		paramStr += params['cropWidth'];						
	if ( params['cropHeight'] )
		paramStr += "x" + params['cropHeight'];
	if ( params['cropX'] )
		paramStr += "x" + params['cropX'];						
	if ( params['cropY'] )
		paramStr += "x" + params['cropY'];

//sharpen

	paramStr += Media.deliminator;
	
	if ( params['sharpen'] )
		paramStr += params['sharpen'];

//version
	
	paramStr += Media.deliminator;	
	
	
	if ( typeof( version ) != "undefined")
		paramStr += version;
	
//max sizes
	paramStr += Media.deliminator;
	
	if ( params['maxwidth'] )
		paramStr += params['maxwidth'];						
	if ( params['maxheight'] )
		paramStr += "x" + params['maxheight'];
	
//min sizes
	paramStr += Media.deliminator;
	
	if ( params['minwidth'] )
		paramStr += params['minwidth'];						
	if ( params['minheight'] )
		paramStr += "x" + params['minheight'];
		
//border....			
	paramStr += Media.deliminator;
	
	if ( params['borderColor'] )
		paramStr += params['borderColor'];
	if ( params['borderSize'] )
		paramStr += "x" + params['borderSize'];

//compression quality			
	paramStr += Media.deliminator;
	
	if ( params['quality'] )
		paramStr += params['quality'];	
	
	
	var imgURL = "/img/" + imgInfo.folder + "/" + paramStr + "/" + imgInfo.file;
		
	
	return imgURL;
}

Media.imageURL = Media.getImageURL;

Media.getImageInfo = function ( path ) {
	pathArr = path.split("/");
	file = pathArr.pop();
	return {	
		 file:file
		,folder:pathArr.join("/")					
	}
}
	


/*****************************
FILE: cssruleplugin/cssRule    
*****************************/

/* Copyright (c) 2008 Gilberto Saraiva (saraivagilberto@gmail.com || http://gsaraiva.projects.pro.br)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 2008.0.1.9 -
 * Under development and testing
 *
 * Requires: jQuery 1.2+
 *
 * Support/Site: http://gsaraiva.projects.pro.br/openprj/?page=jquerycssrule
 */

CSSRule = function( $ ){
  $.cssRule = function (Selector, Property, Value) {

    // Selector == {}
    if(typeof Selector == "object"){
      $.each(Selector, function(NewSelector, NewProperty){
        $.cssRule(NewSelector, NewProperty);
      });
      return;
    }

    // Selector == "body:background:#F99"
    if((typeof Selector == "string") && (Selector.indexOf(":") > -1)
      && (Property == undefined) && (Value == undefined)){
      Data = Selector.split("{");
      Data[1] = Data[1].replace(/\}/, "");
      $.cssRule($.trim(Data[0]), $.trim(Data[1]));
      return;
    }

    // Check for multi-selector, [ IE don't accept multi-selector on this way, we need to split ]
    if((typeof Selector == "string") && (Selector.indexOf(",") > -1)){
      Multi = Selector.split(",");
      for(x = 0; x < Multi.length; x++){
        Multi[x] = $.trim(Multi[x]);
        if(Multi[x] != "")
          $.cssRule(Multi[x], Property, Value);
      }

      return;
    }

    // Porperty == {} or []
    if(typeof Property == "object"){

      // Is {}
      if(Property.length == undefined){

        // Selector, {}
        $.each(Property, function(NewProperty, NewValue){
          $.cssRule(Selector + " " + NewProperty, NewValue);
        });

      // Is [Prop, Value]
      }else if((Property.length == 2) && (typeof Property[0] == "string") &&
        (typeof Property[1] == "string")){
        $.cssRule(Selector, Property[0], Property[1]);

      // Is array of settings
      }else{
        for(x1 = 0; x1 < Property.length; x1++){
          $.cssRule(Selector, Property[x1], Value);
        }
      }

      return;
    }

    // Parse for property at CSS Style "{property:value}"
    if((typeof Property == "string") && (Property.indexOf("{") > -1)
       && (Property.indexOf("}") > -1)){
      Property = Property.replace(/\{/, "").replace(/\}/, "");
    }

    // Check for multiple properties
    if((typeof Property == "string") && (Property.indexOf(";") > -1)){
      Multi1 = Property.split(";");
      for(x2 = 0; x2 < Multi1.length; x2++){
        $.cssRule(Selector, Multi1[x2], undefined);
      }
      return;
    }

    // Check for property:value
    if((typeof Property == "string") && (Property.indexOf(":") > -1)){
      Multi3 = Property.split(":");
      $.cssRule(Selector, Multi3[0], Multi3[1]);
      return;
    }

    //********************************************
    // Logical CssRule additions
    // Check for multiple logical properties [ "padding,margin,border:0px" ]
    if((typeof Property == "string") && (Property.indexOf(",") > -1)){
      Multi2 = Property.split(",");
      for(x3 = 0; x3 < Multi2.length; x3++){
        $.cssRule(Selector, Multi2[x3], Value);
      }
      return;
    }

    //********************************************
    // Check for Most One Style Sheet
    // jQuery.CssRule need at last one Style Sheet enabled on the page.
    styleSheetsLength = document.styleSheets.length;
    if(styleSheetsLength <= 1){
      // Append for no IE browsers
      if(!document.createStyleSheet){
        var styleSheet = (typeof document.createElementNS != undefined) ?
          document.createElementNS("http://www.w3.org/1999/xhtml", "style") :
          document.createElement("style");
        styleSheet.setAttribute("type", "text/css");
        styleSheet.setAttribute("media", "screen");
        if(styleSheetsLength == 0){
          $($("html")[0]).prepend(styleSheet);
        }
      // Append for IE
      }else{
        BaseStyle = document.getElementsByTagName("style");
        if(BaseStyle.length > 0)
          document.getElementsByTagName("style")[0].disabled = false;
        var styleSheet = document.createElement("style");
        styleSheet.setAttribute("type", "text/css");
        styleSheet.setAttribute("media", "screen");
        styleSheet.disabled = false;
        $($("html")[0]).prepend(styleSheet);
      }
    }

    if((Property == undefined) || (Value == undefined))
      return;

    Selector = $.trim(Selector);
    Property = $.trim(Property);
    Value = $.trim(Value);

    if((Property == "") || (Value == ""))
      return;

    // adjusts on property 
    if($.browser.msie){
      // for IE (@.@)^^^
      switch(Property){
        case "float": Property = "style-float"; break;
      }
    }else{
      // CSS rights
      switch(Property){
        case "float": Property = "css-float"; break;
      }
    }

    CssProperty = (Property || "").replace(/\-(\w)/g, function(m, c){ return (c.toUpperCase()); });

    for(var i = 0; i < document.styleSheets.length; i++){
      CurrentStyleSheet = document.styleSheets[i];
      Rules = (CurrentStyleSheet.cssRules || CurrentStyleSheet.rules);
      LowerSelector = Selector.toLowerCase();

      for(var i2 = 0, len = Rules.length; i2 < len; i2++){
        if(Rules[i2].selectorText && (Rules[i2].selectorText.toLowerCase() == LowerSelector)){
          if(Value != null){
            Rules[i2].style[CssProperty] = Value;
            return;
          }else{
            if(CurrentStyleSheet.deleteRule){
              CurrentStyleSheet.deleteRule(i2);
            }else if(CurrentStyleSheet.removeRule){
              CurrentStyleSheet.removeRule(i2);
            }else{
              Rules[i2].style.cssText = "";
            }
          }
        }
      }
    }

    if(Property && Value){
      for(var i = 0; i < document.styleSheets.length; i++){
        WorkerStyleSheet = document.styleSheets[i];
        if(WorkerStyleSheet.insertRule){
          Rules = (WorkerStyleSheet.cssRules || WorkerStyleSheet.rules);
          WorkerStyleSheet.insertRule(Selector + "{ " + Property + ":" + Value + "; }", Rules.length);
        }else if(WorkerStyleSheet.addRule){
          WorkerStyleSheet.addRule(Selector, Property + ":" + Value + ";", 0);
        }else{
          throw new Error("Add/insert not enabled.");
        }
      }
    }
  };
  
  $.tocssRule = function(cssText){
    matchRes = cssText.match(/(.*?)\{(.*?)\}/);
    while(matchRes){
      cssText = cssText.replace(/(.*?)\{(.*?)\}/, "");
      $.cssRule(matchRes[1], matchRes[2]);
      matchRes = cssText.match(/(.*?)\{(.*?)\}/);
    }
  }
};

CSSRule( jQuery );

/*****************************
FILE: popupmanager/PUAlert    
*****************************/

/*
 * 
 * */
function popupmanager_PUAlert ( element )
{
	ria_Component.call( this , element );

	this.content = this.jsdata.content;
	this.showOK = this.jsdata.showOK;
	this.showCancel = this.jsdata.showCancel;
	
//RIA.log( this );	
	var tpl = new popupmanager_tpl_PUAlert();
	this.element.html( tpl.parse(this) );

}

popupmanager_PUAlert.prototype = new ria_Component();
popupmanager_PUAlert.prototype.constructor = popupmanager_PUAlert;

popupmanager_PUAlert.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
		case "alert_ok" :
			break;			
		case "alert_cancel" :
			PopupManager.closePopup(  this.element );
			break;
	}
}



/*****************************
FILE: popupmanager/PopupManager    
*****************************/





function popupmanager_PopupManager ( element )
{
	ria_Component.call( this , element );
	
	PopupManager = this;//unenforced singleton
	
	this.windowIndex = 0;
	this.loadingWindow = false;
	
	this.element.addClass("popupmanagerbase");
	this.element.hide();
}

popupmanager_PopupManager.prototype = new ria_Component();
popupmanager_PopupManager.prototype.constructor = popupmanager_PopupManager;

popupmanager_PopupManager.prototype.createPopup = function( content )
{
	this.element.show();
	
	this.windowIndex++;

	var windowtpl = new popupmanager_tpl_Popup();
	this.element.append( windowtpl.parse({
		windowid:this.windowIndex
		,content:content}));

	return this.element.find("[wid='window_" + this.windowIndex + "']");
}

popupmanager_PopupManager.prototype.createModalWindow = function( content , title , showClose )
{
	if ( RIA.isNull( showClose ) )
		showClose = true;
	
	var windowtpl = new popupmanager_tpl_ModalWindow();
	return PopupManager.createPopup( windowtpl.parse({
				 cssstyle:"modalwindow"
				,content:content
				,title:title
				,showclose:showClose
			}) 
		);
		
	return popup;//
}

popupmanager_PopupManager.prototype.createModalWindowComponent = function( content , title , showClose , comp )
{
	var popup = this.createModalWindow( content , title , showClose );
	comp.attachAsChild( $( popup ).find("#modalwindowcontent") );
	return comp;
}

popupmanager_PopupManager.prototype.createModalWindowComponentTag = function( title , showClose , jsclass , jsdata )
{
	var popup = this.createModalWindow( "" , title , showClose );
	$( popup ).find("#modalwindowcontent").attr("jsclass",jsclass);
	
	if (jsdata)
		$( popup ).find("#modalwindowcontent").attr("jsdata",RIA.serializeJSData( jsdata ));
		
	RIA.createComponents();
	
	var comp = RIA.getComponent( jsclass , popup );
	return comp;
}

popupmanager_PopupManager.prototype.createPopUpComponentTag = function( jsclass , jsdata )
{
	var popup = this.createPopup( "" );
	$( popup ).find(".popupcontent").attr("jsclass",jsclass);
	
	if (jsdata)
		$( popup ).find(".popupcontent").attr("jsdata",RIA.serializeJSData( jsdata ));
		
	RIA.createComponents();
	
	var comp = RIA.getComponent( jsclass , popup );
	return comp;
}

popupmanager_PopupManager.prototype.showAlert = function( content , showOK , showCancel )
{
	if ( RIA.isNull( showOK ) )
		showOK = true;
	if ( RIA.isNull( showCancel ) )
		showCancel = true;
		
	return PopupManager.createModalWindowComponentTag( "Alert" , false , "popupmanager_PUAlert" 
		, {content:content,showOK:showOK,showCancel:showCancel} );
}

popupmanager_PopupManager.prototype.showingLoading = 0;
popupmanager_PopupManager.prototype.showGlobalLoading = function()
{
	if ( this.showingLoading <= 0 ) {
		this.loadingWindow = PopupManager.createModalWindow( "loading" , false , false );
	}
	this.showingLoading++;
}
popupmanager_PopupManager.prototype.hideGlobalLoading = function()
{
	this.showingLoading--;
	if ( this.showingLoading <= 0 ) {
		this.loadingWindow.remove();
		this.checkForAllModalsClosed();
	}
}

popupmanager_PopupManager.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
		case "closewindow" :
			PopupManager.closeWindow( event.target );
			event.stopPropagation();
			break;		
	}
}

popupmanager_PopupManager.prototype.closeWindow = function( element )
{
	if ( !RIA.isNull( $( element ).attr('wid') ) ) 
		$(element).remove();
	
	$( element ).parents().each(
		function () {
			if ( !RIA.isNull( $(this).attr('wid') ) ) 
				$(this).remove();
		}
	);
	
	this.checkForAllModalsClosed();
}
popupmanager_PopupManager.prototype.closePopup = popupmanager_PopupManager.prototype.closeWindow;

popupmanager_PopupManager.prototype.checkForAllModalsClosed = function()
{		
	if ( this.element.children().length == 0 )
		this.element.hide();				
}



/*****************************
FILE: popupmanager/tpl/LoadingPopUp    
*****************************/


popupmanager_tpl_LoadingPopUp = function () {
	
	return new microtemplate_Template( '      <div wid=\'window_loading\' style="display: table;   	position: absolute; width: 100%; height: 100%;  	top: 0px; left: 0px; z-index: 11000;  	"><div class=\'popupcontent\'><#= content #></div></div>' );	
	
}



/*****************************
FILE: popupmanager/tpl/ModalWindow    
*****************************/


popupmanager_tpl_ModalWindow = function () {
	
	return new microtemplate_Template( '            <#= CorneredBox.start( cssstyle ) #>    	<# if ( title != false && title != "" ) { #>  		<div class="modalwindowtitle"><#= title #></div>		  	<# } #>  	<# if ( showclose ) { #>  		<div class="modalwindowclose"><a href="#" onclick=\'RIA.preventDefault(event);\' clickaction="closewindow">close</a></div>  	<# } #>  	  	<# if ( showclose || (title != false && title != "") ) { #>  		<hr class="popuphr" />  	<# } #>  	  	<div class="clear"></div>  	  	<div id=\'modalwindowcontent\'><#= content #></div>      <#= CorneredBox.end() #>  ' );	
	
}



/*****************************
FILE: popupmanager/tpl/PUAlert    
*****************************/


popupmanager_tpl_PUAlert = function () {
	
	return new microtemplate_Template( '    <div class="pu_alert">  	<div class="pu_alert_content"><#= content #></div>  	  	<#  		var width = "190px";  		if ( !showOK || !showCancel ) {  			width = "85px";  		}  		  	#>  	  	  	<div class="pu_alertnav" style="width: <#= width #>">  		<# if ( showOK ) { #>  			<div clickaction="alert_ok" class="pu_button pu90">OK</div>  		<# } #>  		<# if ( showCancel ) { #>  			<div clickaction="alert_cancel" class="pu_button pu90">Cancel</div>  		<# } #>  	</div>  </div>' );	
	
}



/*****************************
FILE: popupmanager/tpl/Popup    
*****************************/


popupmanager_tpl_Popup = function () {
	
	return new microtemplate_Template( '        <table wid=\'window_<#= windowid #>\' class="popupwindow"><tr><td class=\'popupcontent\' clickaction="popupbackgroundclick"><#=   	content 	  #></td></tr></table>  ' );	
	
}



/*****************************
FILE: json2/json2    
*****************************/

/*
    http://www.JSON.org/json2.js
    2010-03-20

    Public Domain.

    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

    See http://www.JSON.org/js.html


    This code should be minified before deployment.
    See http://javascript.crockford.com/jsmin.html

    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
    NOT CONTROL.


    This file creates a global JSON object containing two methods: stringify
    and parse.

        JSON.stringify(value, replacer, space)
            value       any JavaScript value, usually an object or array.

            replacer    an optional parameter that determines how object
                        values are stringified for objects. It can be a
                        function or an array of strings.

            space       an optional parameter that specifies the indentation
                        of nested structures. If it is omitted, the text will
                        be packed without extra whitespace. If it is a number,
                        it will specify the number of spaces to indent at each
                        level. If it is a string (such as '\t' or '&nbsp;'),
                        it contains the characters used to indent at each level.

            This method produces a JSON text from a JavaScript value.

            When an object value is found, if the object contains a toJSON
            method, its toJSON method will be called and the result will be
            stringified. A toJSON method does not serialize: it returns the
            value represented by the name/value pair that should be serialized,
            or undefined if nothing should be serialized. The toJSON method
            will be passed the key associated with the value, and this will be
            bound to the value

            For example, this would serialize Dates as ISO strings.

                Date.prototype.toJSON = function (key) {
                    function f(n) {
                        // Format integers to have at least two digits.
                        return n < 10 ? '0' + n : n;
                    }

                    return this.getUTCFullYear()   + '-' +
                         f(this.getUTCMonth() + 1) + '-' +
                         f(this.getUTCDate())      + 'T' +
                         f(this.getUTCHours())     + ':' +
                         f(this.getUTCMinutes())   + ':' +
                         f(this.getUTCSeconds())   + 'Z';
                };

            You can provide an optional replacer method. It will be passed the
            key and value of each member, with this bound to the containing
            object. The value that is returned from your method will be
            serialized. If your method returns undefined, then the member will
            be excluded from the serialization.

            If the replacer parameter is an array of strings, then it will be
            used to select the members to be serialized. It filters the results
            such that only members with keys listed in the replacer array are
            stringified.

            Values that do not have JSON representations, such as undefined or
            functions, will not be serialized. Such values in objects will be
            dropped; in arrays they will be replaced with null. You can use
            a replacer function to replace those with JSON values.
            JSON.stringify(undefined) returns undefined.

            The optional space parameter produces a stringification of the
            value that is filled with line breaks and indentation to make it
            easier to read.

            If the space parameter is a non-empty string, then that string will
            be used for indentation. If the space parameter is a number, then
            the indentation will be that many spaces.

            Example:

            text = JSON.stringify(['e', {pluribus: 'unum'}]);
            // text is '["e",{"pluribus":"unum"}]'


            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'

            text = JSON.stringify([new Date()], function (key, value) {
                return this[key] instanceof Date ?
                    'Date(' + this[key] + ')' : value;
            });
            // text is '["Date(---current time---)"]'


        JSON.parse(text, reviver)
            This method parses a JSON text to produce an object or array.
            It can throw a SyntaxError exception.

            The optional reviver parameter is a function that can filter and
            transform the results. It receives each of the keys and values,
            and its return value is used instead of the original value.
            If it returns what it received, then the structure is not modified.
            If it returns undefined then the member is deleted.

            Example:

            // Parse the text. Values that look like ISO date strings will
            // be converted to Date objects.

            myData = JSON.parse(text, function (key, value) {
                var a;
                if (typeof value === 'string') {
                    a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
                    if (a) {
                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
                            +a[5], +a[6]));
                    }
                }
                return value;
            });

            myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
                var d;
                if (typeof value === 'string' &&
                        value.slice(0, 5) === 'Date(' &&
                        value.slice(-1) === ')') {
                    d = new Date(value.slice(5, -1));
                    if (d) {
                        return d;
                    }
                }
                return value;
            });


    This is a reference implementation. You are free to copy, modify, or
    redistribute.
*/

/*jslint evil: true, strict: false */

/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
    lastIndex, length, parse, prototype, push, replace, slice, stringify,
    test, toJSON, toString, valueOf
*/


// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.

if (!this.JSON) {
    this.JSON = {};
}

(function () {

    function f(n) {
        // Format integers to have at least two digits.
        return n < 10 ? '0' + n : n;
    }

    if (typeof Date.prototype.toJSON !== 'function') {

        Date.prototype.toJSON = function (key) {

            return isFinite(this.valueOf()) ?
                   this.getUTCFullYear()   + '-' +
                 f(this.getUTCMonth() + 1) + '-' +
                 f(this.getUTCDate())      + 'T' +
                 f(this.getUTCHours())     + ':' +
                 f(this.getUTCMinutes())   + ':' +
                 f(this.getUTCSeconds())   + 'Z' : null;
        };

        String.prototype.toJSON =
        Number.prototype.toJSON =
        Boolean.prototype.toJSON = function (key) {
            return this.valueOf();
        };
    }

    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        gap,
        indent,
        meta = {    // table of character substitutions
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        },
        rep;


    function quote(string) {

// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.

        escapable.lastIndex = 0;
        return escapable.test(string) ?
            '"' + string.replace(escapable, function (a) {
                var c = meta[a];
                return typeof c === 'string' ? c :
                    '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
            }) + '"' :
            '"' + string + '"';
    }


    function str(key, holder) {

// Produce a string from holder[key].

        var i,          // The loop counter.
            k,          // The member key.
            v,          // The member value.
            length,
            mind = gap,
            partial,
            value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

        if (value && typeof value === 'object' &&
                typeof value.toJSON === 'function') {
            value = value.toJSON(key);
        }

// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.

        if (typeof rep === 'function') {
            value = rep.call(holder, key, value);
        }

// What happens next depends on the value's type.

        switch (typeof value) {
        case 'string':
            return quote(value);

        case 'number':

// JSON numbers must be finite. Encode non-finite numbers as null.

            return isFinite(value) ? String(value) : 'null';

        case 'boolean':
        case 'null':

// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.

            return String(value);

// If the type is 'object', we might be dealing with an object or an array or
// null.

        case 'object':

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

            if (!value) {
                return 'null';
            }

// Make an array to hold the partial results of stringifying this object value.

            gap += indent;
            partial = [];

// Is the value an array?

            if (Object.prototype.toString.apply(value) === '[object Array]') {

// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.

                length = value.length;
                for (i = 0; i < length; i += 1) {
                    partial[i] = str(i, value) || 'null';
                }

// Join all of the elements together, separated with commas, and wrap them in
// brackets.

                v = partial.length === 0 ? '[]' :
                    gap ? '[\n' + gap +
                            partial.join(',\n' + gap) + '\n' +
                                mind + ']' :
                          '[' + partial.join(',') + ']';
                gap = mind;
                return v;
            }

// If the replacer is an array, use it to select the members to be stringified.

            if (rep && typeof rep === 'object') {
                length = rep.length;
                for (i = 0; i < length; i += 1) {
                    k = rep[i];
                    if (typeof k === 'string') {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            } else {

// Otherwise, iterate through all of the keys in the object.

                for (k in value) {
                    if (Object.hasOwnProperty.call(value, k)) {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            }

// Join all of the member texts together, separated with commas,
// and wrap them in braces.

            v = partial.length === 0 ? '{}' :
                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
                        mind + '}' : '{' + partial.join(',') + '}';
            gap = mind;
            return v;
        }
    }

// If the JSON object does not yet have a stringify method, give it one.

    if (typeof JSON.stringify !== 'function') {
        JSON.stringify = function (value, replacer, space) {

// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.

            var i;
            gap = '';
            indent = '';

// If the space parameter is a number, make an indent string containing that
// many spaces.

            if (typeof space === 'number') {
                for (i = 0; i < space; i += 1) {
                    indent += ' ';
                }

// If the space parameter is a string, it will be used as the indent string.

            } else if (typeof space === 'string') {
                indent = space;
            }

// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.

            rep = replacer;
            if (replacer && typeof replacer !== 'function' &&
                    (typeof replacer !== 'object' ||
                     typeof replacer.length !== 'number')) {
                throw new Error('JSON.stringify');
            }

// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.

            return str('', {'': value});
        };
    }


// If the JSON object does not yet have a parse method, give it one.

    if (typeof JSON.parse !== 'function') {
        JSON.parse = function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

            var j;

            function walk(holder, key) {

// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.

                var k, v, value = holder[key];
                if (value && typeof value === 'object') {
                    for (k in value) {
                        if (Object.hasOwnProperty.call(value, k)) {
                            v = walk(value, k);
                            if (v !== undefined) {
                                value[k] = v;
                            } else {
                                delete value[k];
                            }
                        }
                    }
                }
                return reviver.call(holder, key, value);
            }


// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.

            text = String(text);
            cx.lastIndex = 0;
            if (cx.test(text)) {
                text = text.replace(cx, function (a) {
                    return '\\u' +
                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
                });
            }

// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.

// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

            if (/^[\],:{}\s]*$/.
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {

// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.

                j = eval('(' + text + ')');

// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

                return typeof reviver === 'function' ?
                    walk({'': j}, '') : j;
            }

// If the text is not JSON parseable, then a SyntaxError is thrown.

            throw new SyntaxError('JSON.parse');
        };
    }
}());


/*****************************
FILE: validation/Validation    
*****************************/




function Validation()
{
}


Validation.email = function ( str ) {
	if ( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test( str ) ) {
		return true;
	}else{
		return false;
	}
}

Validation.isAbsUrl = function(s) {
	return Validation.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
}
	
Validation.isSize = function(s) {
	return Validation.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
}
	
Validation.isId = function(s) {
	return Validation.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
}
	
Validation.isEmpty = function(s) {
	return new RegExp('^\\s*$').test( s );
}
	
Validation.isNumber = function(s, d) {
	return !isNaN( s ) && ( !d || !Validation.test( s , '^-?[0-9]*\\.[0-9]*$'));
}

Validation.test = function(s, p) {
	return s == '' || new RegExp(p).test(s);
}

Validate = Validation;







/*****************************
FILE: jqueryflash/jQueryFlash    
*****************************/

/**
 * Flash (http://jquery.lukelutman.com/plugins/flash)
 * A jQuery plugin for embedding Flash movies.
 * 
 * Version 1.0
 * November 9th, 2006
 *
 * Copyright (c) 2006 Luke Lutman (http://www.lukelutman.com)
 * Dual licensed under the MIT and GPL licenses.
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.opensource.org/licenses/gpl-license.php
 * 
 * Inspired by:
 * SWFObject (http://blog.deconcept.com/swfobject/)
 * UFO (http://www.bobbyvandersluis.com/ufo/)
 * sIFR (http://www.mikeindustries.com/sifr/)
 * 
 * IMPORTANT: 
 * The packed version of jQuery breaks ActiveX control
 * activation in Internet Explorer. Use JSMin to minifiy
 * jQuery (see: http://jquery.lukelutman.com/plugins/flash#activex).
 *
 **/ 
;(function(){
	
var $$;

/**
 * 
 * @desc Replace matching elements with a flash movie.
 * @author Luke Lutman
 * @version 1.0.1
 *
 * @name flash
 * @param Hash htmlOptions Options for the embed/object tag.
 * @param Hash pluginOptions Options for detecting/updating the Flash plugin (optional).
 * @param Function replace Custom block called for each matched element if flash is installed (optional).
 * @param Function update Custom block called for each matched if flash isn't installed (optional).
 * @type jQuery
 *
 * @cat plugins/flash
 * 
 * @example $('#hello').flash({ src: 'hello.swf' });
 * @desc Embed a Flash movie.
 *
 * @example $('#hello').flash({ src: 'hello.swf' }, { version: 8 });
 * @desc Embed a Flash 8 movie.
 *
 * @example $('#hello').flash({ src: 'hello.swf' }, { expressInstall: true });
 * @desc Embed a Flash movie using Express Install if flash isn't installed.
 *
 * @example $('#hello').flash({ src: 'hello.swf' }, { update: false });
 * @desc Embed a Flash movie, don't show an update message if Flash isn't installed.
 *
**/
$$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {
	
	// Set the default block.
	var block = replace || $$.replace;
	
	// Merge the default and passed plugin options.
	pluginOptions = $$.copy($$.pluginOptions, pluginOptions);
	
	// Detect Flash.
	if(!$$.hasFlash(pluginOptions.version)) {
		// Use Express Install (if specified and Flash plugin 6,0,65 or higher is installed).
		if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) {
			// Add the necessary flashvars (merged later).
			var expressInstallOptions = {
				flashvars: {  	
					MMredirectURL: location,
					MMplayerType: 'PlugIn',
					MMdoctitle: jQuery('title').text() 
				}					
			};
		// Ask the user to update (if specified).
		} else if (pluginOptions.update) {
			// Change the block to insert the update message instead of the flash movie.
			block = update || $$.update;
		// Fail
		} else {
			// The required version of flash isn't installed.
			// Express Install is turned off, or flash 6,0,65 isn't installed.
			// Update is turned off.
			// Return without doing anything.
			return this;
		}
	}
	
	// Merge the default, express install and passed html options.
	htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions);
	
	// Invoke $block (with a copy of the merged html options) for each element.
	return this.each(function(){
		block.call(this, $$.copy(htmlOptions));
	});
	
};
/**
 *
 * @name flash.copy
 * @desc Copy an arbitrary number of objects into a new object.
 * @type Object
 * 
 * @example $$.copy({ foo: 1 }, { bar: 2 });
 * @result { foo: 1, bar: 2 };
 *
**/
$$.copy = function() {
	var options = {}, flashvars = {};
	for(var i = 0; i < arguments.length; i++) {
		var arg = arguments[i];
		if(arg == undefined) continue;
		jQuery.extend(options, arg);
		// don't clobber one flash vars object with another
		// merge them instead
		if(arg.flashvars == undefined) continue;
		jQuery.extend(flashvars, arg.flashvars);
	}
	options.flashvars = flashvars;
	return options;
};
/*
 * @name flash.hasFlash
 * @desc Check if a specific version of the Flash plugin is installed
 * @type Boolean
 *
**/
$$.hasFlash = function() {
	// look for a flag in the query string to bypass flash detection
	if(/hasFlash\=true/.test(location)) return true;
	if(/hasFlash\=false/.test(location)) return false;
	var pv = $$.hasFlash.playerVersion().match(/\d+/g);
	var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g);
	for(var i = 0; i < 3; i++) {
		pv[i] = parseInt(pv[i] || 0);
		rv[i] = parseInt(rv[i] || 0);
		// player is less than required
		if(pv[i] < rv[i]) return false;
		// player is greater than required
		if(pv[i] > rv[i]) return true;
	}
	// major version, minor version and revision match exactly
	return true;
};
/**
 *
 * @name flash.hasFlash.playerVersion
 * @desc Get the version of the installed Flash plugin.
 * @type String
 *
**/
$$.hasFlash.playerVersion = function() {
	// ie
	try {
		try {
			// avoid fp6 minor version lookup issues
			// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
			var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
			try { axo.AllowScriptAccess = 'always';	} 
			catch(e) { return '6,0,0'; }				
		} catch(e) {}
		return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
	// other browsers
	} catch(e) {
		try {
			if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
				return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
			}
		} catch(e) {}		
	}
	return '0,0,0';
};
/**
 *
 * @name flash.htmlOptions
 * @desc The default set of options for the object or embed tag.
 *
**/
$$.htmlOptions = {
	height: 240,
	flashvars: {},
	pluginspage: 'http://www.adobe.com/go/getflashplayer',
	src: '#',
	type: 'application/x-shockwave-flash',
	width: 320		
};
/**
 *
 * @name flash.pluginOptions
 * @desc The default set of options for checking/updating the flash Plugin.
 *
**/
$$.pluginOptions = {
	expressInstall: false,
	update: true,
	version: '6.0.65'
};
/**
 *
 * @name flash.replace
 * @desc The default method for replacing an element with a Flash movie.
 *
**/
$$.replace = function(htmlOptions) {
	this.innerHTML = '<div class="alt">'+this.innerHTML+'</div>';
	jQuery(this)
		.addClass('flash-replaced')
		.prepend($$.transform(htmlOptions));
};
/**
 *
 * @name flash.update
 * @desc The default method for replacing an element with an update message.
 *
**/
$$.update = function(htmlOptions) {
	var url = String(location).split('?');
	url.splice(1,0,'?hasFlash=true&');
	url = url.join('');
	var msg = '<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+url+'">Click here.</a></p>';
	this.innerHTML = '<span class="alt">'+this.innerHTML+'</span>';
	jQuery(this)
		.addClass('flash-update')
		.prepend(msg);
};
/**
 *
 * @desc Convert a hash of html options to a string of attributes, using Function.apply(). 
 * @example toAttributeString.apply(htmlOptions)
 * @result foo="bar" foo="bar"
 *
**/
function toAttributeString() {
	var s = '';
	for(var key in this)
		if(typeof this[key] != 'function')
			s += key+'="'+this[key]+'" ';
	return s;		
};
/**
 *
 * @desc Convert a hash of flashvars to a url-encoded string, using Function.apply(). 
 * @example toFlashvarsString.apply(flashvarsObject)
 * @result foo=bar&foo=bar
 *
**/
function toFlashvarsString() {
	var s = '';
	for(var key in this)
		if(typeof this[key] != 'function')
			s += key+'='+encodeURIComponent(this[key])+'&';
	return s.replace(/&$/, '');		
};
/**
 *
 * @name flash.transform
 * @desc Transform a set of html options into an embed tag.
 * @type String 
 *
 * @example $$.transform(htmlOptions)
 * @result <embed src="foo.swf" ... />
 *
 * Note: The embed tag is NOT standards-compliant, but it 
 * works in all current browsers. flash.transform can be
 * overwritten with a custom function to generate more 
 * standards-compliant markup.
 *
**/
$$.transform = function(htmlOptions) {
	htmlOptions.toString = toAttributeString;
	if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString;
	return '<embed ' + String(htmlOptions) + '/>';		
};

/**
 *
 * Flash Player 9 Fix (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
 *
**/
if (window.attachEvent) {
	window.attachEvent("onbeforeunload", function(){
		__flash_unloadHandler = function() {};
		__flash_savedUnloadHandler = function() {};
	});
}
	
})();

/*****************************
FILE: jqueryhashchange/jqueryhashchange    
*****************************/

/*
 * jQuery hashchange event - v1.3 - 7/21/2010
 * http://benalman.com/projects/jquery-hashchange-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);

/*****************************
FILE: jquerycache/jquerycache    
*****************************/

/**
 * jCache - A client cache plugin for jQuery
 * Should come in handy when data needs to be cached in client to improve performance.
 * Author: 	Phan Van An 
 *			phoenixheart@gmail.com
 *			http://www.skidvn.com
 * License : Read jQuery's license

Usage:
    1. 	Include this plugin into your web document after jQuery:
    	<script type="text/javascript" src="js/jquery.jcache.js"></script>
    2.	[OPTIONAL] Set the max cached item number, for example 20
    	$.jCache.maxSize = 20; 
    3. 	Start playing around with it:
    	- Put an item into cache: $.jCache.setItem(theKey, the Value);
    	- Retrieve an item from cache: var theValue = $.jCache.getItem(theKey);
    	- ...
 */
(function (jQuery){
	this.version = '(beta)(0.0.1)';
	
	/**
	 * The maximum items this cache should hold. 
	 * If the cache is going to be overload, oldest item will be deleted (FIFO).
	 * Since the cached object is retained inside browser's state, 
	 * a too big value on a too big web apps may affect system memory.
	 * Default is 10.
	 */
	this.maxSize = 10;
	
    /**
     * An array to keep track of the cache keys
     */
	this.keys = new Array();
	
	/**
	 * Number of currently cached items
	 */
	this.cache_length = 0;
	
	/**
	 * An associated array to contain the cached items
	 */
	this.items = new Array();
	
	/*
	 * @desc	Puts an item into the cache
	 *
	 * @param	string Key of the item
	 * @param 	string Value of the item
	 * @return	string Value of the item
	 */
	this.setItem = function(pKey, pValue)
	{
		if (typeof(pValue) != 'undefined') 
		{
			if (typeof(this.items[pKey]) == 'undefined') 
			{
				this.cache_length++;
			}

			this.keys.push(pKey);
			this.items[pKey] = pValue;
			
			if (this.cache_length > this.maxSize)
			{
				this.removeOldestItem();
			}
		}
	   
		return pValue;
	}
	
	/*
	 * @desc	Removes an item from the cache using its key
	 * @param 	string Key of the item
	 */
	this.removeItem = function(pKey)
	{
		var tmp;
		if (typeof(this.items[pKey]) != 'undefined') 
		{
			this.cache_length--;
			var tmp = this.items[pKey];
			delete this.items[pKey];
		}
	   
		return tmp;
	}

	/*
	 * @desc 	Retrieves an item from the cache by its key
	 *
	 * @param 	string Key of the item
	 * @return	string Value of the item
	 */
	this.getItem = function(pKey) 
	{
		return this.items[pKey];
	}

	/*
	 * @desc	Indicates if the cache has an item specified by its key
	 * @param 	string Key of the item
	 * @return 	boolean TRUE or FALSE
	 */
	this.hasItem = function(pKey)
	{
		return typeof(this.items[pKey]) != 'undefined';
	}
	
	/**
	 * @desc	Removes the oldest cached item from the cache
	 */
	this.removeOldestItem = function()
	{
		this.removeItem(this.keys.shift());
	}
	
	/**
	 * @desc	Clears the cache
	 * @return	Number of items cleared
	 */
	this.clear = function()
	{
		var tmp = this.cache_length;
		this.keys = new Array();
		this.cache_length = 0;
		this.items = new Array();
		return tmp;
	}
	
	jQuery.jCache = this;
	return jQuery;
})(jQuery);

/*****************************
FILE: php_js/phpdate_namespaced_min    
*****************************/

/* 
 * More info at: http://phpjs.org
 * 
 * This is version: 3.19
 * php.js is copyright 2010 Kevin van Zonneveld.
*/


// Compression: minified


(function(){if(typeof(this.PHP_JS)==="undefined"){var PHP_JS=function(cfgObj){if(!(this instanceof PHP_JS)){return new PHP_JS(cfgObj);}
this.window=cfgObj&&cfgObj.window?cfgObj.window:window;this.php_js={};this.php_js.ini={};if(cfgObj){for(var ini in cfgObj.ini){this.php_js.ini[ini]={};this.php_js.ini[ini].local_value=cfgObj.ini[ini];this.php_js.ini[ini].global_value=cfgObj.ini[ini];}}};}
var php_js_shared={};PHP_JS.prototype={constructor:PHP_JS,date:function(format,timestamp){var that=this,jsdate,f,formatChr=/\\?([a-z])/gi,formatChrCb,_pad=function(n,c){if((n=n+"").length<c){return new Array((++c)-n.length).join("0")+n;}else{return n;}},txt_words=["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur","January","February","March","April","May","June","July","August","September","October","November","December"],txt_ordin={1:"st",2:"nd",3:"rd",21:"st",22:"nd",23:"rd",31:"st"};formatChrCb=function(t,s){return f[t]?f[t]():s;};f={d:function(){return _pad(f.j(),2);},D:function(){return f.l().slice(0,3);},j:function(){return jsdate.getDate();},l:function(){return txt_words[f.w()]+'day';},N:function(){return f.w()||7;},S:function(){return txt_ordin[f.j()]||'th';},w:function(){return jsdate.getDay();},z:function(){var a=new Date(f.Y(),f.n()-1,f.j()),b=new Date(f.Y(),0,1);return Math.round((a-b)/864e5)+1;},W:function(){var a=new Date(f.Y(),f.n()-1,f.j()-f.N()+3),b=new Date(a.getFullYear(),0,4);return 1+Math.round((a-b)/864e5/7);},F:function(){return txt_words[6+f.n()];},m:function(){return _pad(f.n(),2);},M:function(){return f.F().slice(0,3);},n:function(){return jsdate.getMonth()+1;},t:function(){return(new Date(f.Y(),f.n(),0)).getDate();},L:function(){return new Date(f.Y(),1,29).getMonth()===1|0;},o:function(){var n=f.n(),W=f.W(),Y=f.Y();return Y+(n===12&&W<9?-1:n===1&&W>9);},Y:function(){return jsdate.getFullYear();},y:function(){return(f.Y()+"").slice(-2);},a:function(){return jsdate.getHours()>11?"pm":"am";},A:function(){return f.a().toUpperCase();},B:function(){var H=jsdate.getUTCHours()*36e2,i=jsdate.getUTCMinutes()*60,s=jsdate.getUTCSeconds();return _pad(Math.floor((H+i+s+36e2)/86.4)%1e3,3);},g:function(){return f.G()%12||12;},G:function(){return jsdate.getHours();},h:function(){return _pad(f.g(),2);},H:function(){return _pad(f.G(),2);},i:function(){return _pad(jsdate.getMinutes(),2);},s:function(){return _pad(jsdate.getSeconds(),2);},u:function(){return _pad(jsdate.getMilliseconds()*1000,6);},e:function(){throw'Not supported (see source code of date() for timezone on how to add support)';},I:function(){var a=new Date(f.Y(),0),c=Date.UTC(f.Y(),0),b=new Date(f.Y(),6),d=Date.UTC(f.Y(),6);return 0+((a-c)!==(b-d));},O:function(){var a=jsdate.getTimezoneOffset();return(a>0?"-":"+")+_pad(Math.abs(a/60*100),4);},P:function(){var O=f.O();return(O.substr(0,3)+":"+O.substr(3,2));},T:function(){return'UTC';},Z:function(){return-jsdate.getTimezoneOffset()*60;},c:function(){return'Y-m-d\\Th:i:sP'.replace(formatChr,formatChrCb);},r:function(){return'D, d M Y H:i:s O'.replace(formatChr,formatChrCb);},U:function(){return jsdate.getTime()/1000|0;}};this.date=function(format,timestamp){that=this;jsdate=((typeof timestamp==='undefined')?new Date():(timestamp instanceof Date)?new Date(timestamp):new Date(timestamp*1000));return format.replace(formatChr,formatChrCb);};return this.date(format,timestamp);},date_default_timezone_set:function(tz){var tal={},abbr='',i=0;this.php_js=this.php_js||{};tal=this.timezone_abbreviations_list();for(abbr in tal){for(i=0;i<tal[abbr].length;i++){if(tal[abbr][i].timezone_id===tz){this.php_js.default_timezone=tz;return true;}}}
return false;},mktime:function(){var d=new Date(),r=arguments,i=0,e=['Hours','Minutes','Seconds','Month','Date','FullYear'];for(i=0;i<e.length;i++){if(typeof r[i]==='undefined'){r[i]=d['get'+e[i]]();r[i]+=(i===3);}else{r[i]=parseInt(r[i],10);if(isNaN(r[i])){return false;}}}
r[5]+=(r[5]>=0?(r[5]<=69?2e3:(r[5]<=100?1900:0)):0);d.setFullYear(r[5],r[3]-1,r[4]);d.setHours(r[0],r[1],r[2]);return(d.getTime()/1e3>>0)-(d.getTime()<0);},strtotime:function(str,now){var i,match,s,strTmp='',parse='';strTmp=str;strTmp=strTmp.replace(/\s{2,}|^\s|\s$/g,' ');strTmp=strTmp.replace(/[\t\r\n]/g,'');if(strTmp=='now'){return(new Date()).getTime()/1000;}else if(!isNaN(parse=Date.parse(strTmp))){return(parse/1000);}else if(now){now=new Date(now*1000);}else{now=new Date();}
strTmp=strTmp.toLowerCase();var __is={day:{'sun':0,'mon':1,'tue':2,'wed':3,'thu':4,'fri':5,'sat':6},mon:{'jan':0,'feb':1,'mar':2,'apr':3,'may':4,'jun':5,'jul':6,'aug':7,'sep':8,'oct':9,'nov':10,'dec':11}};var process=function(m){var ago=(m[2]&&m[2]=='ago');var num=(num=m[0]=='last'?-1:1)*(ago?-1:1);switch(m[0]){case'last':case'next':switch(m[1].substring(0,3)){case'yea':now.setFullYear(now.getFullYear()+num);break;case'mon':now.setMonth(now.getMonth()+num);break;case'wee':now.setDate(now.getDate()+(num*7));break;case'day':now.setDate(now.getDate()+num);break;case'hou':now.setHours(now.getHours()+num);break;case'min':now.setMinutes(now.getMinutes()+num);break;case'sec':now.setSeconds(now.getSeconds()+num);break;default:var day;if(typeof(day=__is.day[m[1].substring(0,3)])!='undefined'){var diff=day-now.getDay();if(diff==0){diff=7*num;}else if(diff>0){if(m[0]=='last'){diff-=7;}}else{if(m[0]=='next'){diff+=7;}}
now.setDate(now.getDate()+diff);}}
break;default:if(/\d+/.test(m[0])){num*=parseInt(m[0],10);switch(m[1].substring(0,3)){case'yea':now.setFullYear(now.getFullYear()+num);break;case'mon':now.setMonth(now.getMonth()+num);break;case'wee':now.setDate(now.getDate()+(num*7));break;case'day':now.setDate(now.getDate()+num);break;case'hou':now.setHours(now.getHours()+num);break;case'min':now.setMinutes(now.getMinutes()+num);break;case'sec':now.setSeconds(now.getSeconds()+num);break;}}else{return false;}
break;}
return true;};match=strTmp.match(/^(\d{2,4}-\d{2}-\d{2})(?:\s(\d{1,2}:\d{2}(:\d{2})?)?(?:\.(\d+))?)?$/);if(match!=null){if(!match[2]){match[2]='00:00:00';}else if(!match[3]){match[2]+=':00';}
s=match[1].split(/-/g);for(i in __is.mon){if(__is.mon[i]==s[1]-1){s[1]=i;}}
s[0]=parseInt(s[0],10);s[0]=(s[0]>=0&&s[0]<=69)?'20'+(s[0]<10?'0'+s[0]:s[0]+''):(s[0]>=70&&s[0]<=99)?'19'+s[0]:s[0]+'';return parseInt(this.strtotime(s[2]+' '+s[1]+' '+s[0]+' '+match[2])+(match[4]?match[4]/1000:''),10);}
var regex='([+-]?\\d+\\s'+'(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?'+'|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday'+'|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday)'+'|(last|next)\\s'+'(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?'+'|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday'+'|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday))'+'(\\sago)?';match=strTmp.match(new RegExp(regex,'gi'));if(match==null){return false;}
for(i=0;i<match.length;i++){if(!process(match[i].split(' '))){return false;}}
return(now.getTime()/1000);},timezone_abbreviations_list:function(){var list={},i=0,j=0,len=0,jlen=0,indice='',curr='',currSub='',currSubPrefix='',timezone_id='',tzo=0,dst=false;try{php_js_shared;}
catch(e){php_js_shared={};}
if(!php_js_shared.tz_abbrs){php_js_shared.tz_abbrs=[[[1,14,"Porto_Acre",9],[1,14,"Eirunepe",9],[1,14,"Rio_Branco",9],[1,14,"Acre",15]],[[0,11,"Porto_Acre",9],[0,11,"Eirunepe",9],[0,11,"Rio_Branco",9],[0,11,"Acre",15]],[[1,25,"Goose_Bay",9],[1,25,"Pangnirtung",9]],[[1,22,"Halifax",9],[1,22,"Barbados",9],[1,22,"Blanc-Sablon",9],[1,22,"Glace_Bay",9],[1,22,"Goose_Bay",9],[1,22,"Martinique",9],[1,22,"Moncton",9],[1,22,"Pangnirtung",9],[1,22,"Thule",9],[1,22,"Bermuda",13],[1,22,"Atlantic",16],[1,51,"Baghdad",12]],[[0,52,"Kabul",12]],[[1,6,"Anchorage",9],[1,6,"Alaska"]],[[0,4,"Anchorage",9],[0,4,"Adak",9],[0,4,"Atka",9],[0,4,"Alaska"],[0,4,"Aleutian"]],[[1,7,"Anchorage",9],[1,7,"Juneau",9],[1,7,"Nome",9],[1,7,"Yakutat",9],[1,7,"Alaska"]],[[0,6,"Anchorage",9],[0,6,"Juneau",9],[0,6,"Nome",9],[0,6,"Yakutat",9],[0,6,"Alaska"]],[[1,57,"Aqtobe",12]],[[0,51,"Aqtobe",12],[0,54,"Aqtobe",12],[0,57,"Aqtobe",12]],[[1,59,"Almaty",12]],[[0,54,"Almaty",12],[0,57,"Almaty",12]],[[1,51,"Yerevan",12],[1,54,"Yerevan",12],[1,22,"Boa_Vista",9],[1,22,"Campo_Grande",9],[1,22,"Cuiaba",9],[1,22,"Manaus",9],[1,22,"Porto_Velho",9],[1,22,"West",15]],[[0,47,"Yerevan",12],[0,51,"Yerevan",12],[0,14,"Boa_Vista",9],[0,14,"Campo_Grande",9],[0,14,"Cuiaba",9],[0,14,"Manaus",9],[0,14,"Porto_Velho",9],[0,14,"West",15],[0,32,"Amsterdam",18]],[[1,76,"Anadyr",12],[1,79,"Anadyr",12],[1,81,"Anadyr",12]],[[0,74,"Anadyr",12],[0,76,"Anadyr",12],[0,79,"Anadyr",12]],[[0,13,"Curacao",9],[0,13,"Aruba",9]],[[1,22,"Halifax",9],[1,22,"Blanc-Sablon",9],[1,22,"Glace_Bay",9],[1,22,"Moncton",9],[1,22,"Pangnirtung",9],[1,22,"Puerto_Rico",9],[1,22,"Atlantic",16]],[[1,54,"Aqtau",12],[1,57,"Aqtau",12],[1,57,"Aqtobe",12]],[[0,51,"Aqtau",12],[0,54,"Aqtau",12],[0,54,"Aqtobe",12]],[[1,22,"Buenos_Aires",9],[1,25,"Buenos_Aires",9],[1,22,"Buenos_Aires",2],[1,22,"Catamarca",2],[1,22,"ComodRivadavia",2],[1,22,"Cordoba",2],[1,22,"Jujuy",2],[1,22,"La_Rioja",2],[1,22,"Mendoza",2],[1,22,"Rio_Gallegos",2],[1,22,"San_Juan",2],[1,22,"Tucuman",2],[1,22,"Ushuaia",2],[1,22,"Catamarca",9],[1,22,"Cordoba",9],[1,22,"Jujuy",9],[1,22,"Mendoza",9],[1,22,"Rosario",9],[1,22,"Palmer",10],[1,25,"Buenos_Aires",2],[1,25,"Catamarca",2],[1,25,"ComodRivadavia",2],[1,25,"Cordoba",2],[1,25,"Jujuy",2],[1,25,"La_Rioja",2],[1,25,"Mendoza",2],[1,25,"Rio_Gallegos",2],[1,25,"San_Juan",2],[1,25,"Tucuman",2],[1,25,"Ushuaia",2],[1,25,"Catamarca",9],[1,25,"Cordoba",9],[1,25,"Jujuy",9],[1,25,"Mendoza",9],[1,25,"Rosario",9],[1,25,"Palmer",10]],[[0,22,"Buenos_Aires",9],[0,14,"Buenos_Aires",9],[0,22,"Buenos_Aires",2],[0,22,"Catamarca",2],[0,22,"ComodRivadavia",2],[0,22,"Cordoba",2],[0,22,"Jujuy",2],[0,22,"La_Rioja",2],[0,22,"Mendoza",2],[0,22,"Rio_Gallegos",2],[0,22,"San_Juan",2],[0,22,"Tucuman",2],[0,22,"Ushuaia",2],[0,22,"Catamarca",9],[0,22,"Cordoba",9],[0,22,"Jujuy",9],[0,22,"Mendoza",9],[0,22,"Rosario",9],[0,22,"Palmer",10],[0,14,"Buenos_Aires",2],[0,14,"Catamarca",2],[0,14,"ComodRivadavia",2],[0,14,"Cordoba",2],[0,14,"Jujuy",2],[0,14,"La_Rioja",2],[0,14,"Mendoza",2],[0,14,"Rio_Gallegos",2],[0,14,"San_Juan",2],[0,14,"Tucuman",2],[0,14,"Ushuaia",2],[0,14,"Catamarca",9],[0,14,"Cordoba",9],[0,14,"Jujuy",9],[0,14,"Mendoza",9],[0,14,"Rosario",9],[0,14,"Palmer",10]],[[1,54,"Ashkhabad",12],[1,57,"Ashkhabad",12],[1,54,"Ashgabat",12],[1,57,"Ashgabat",12]],[[0,51,"Ashkhabad",12],[0,54,"Ashkhabad",12],[0,51,"Ashgabat",12],[0,54,"Ashgabat",12]],[[0,47,"Riyadh",12],[0,14,"Anguilla",9],[0,14,"Antigua",9],[0,14,"Aruba",9],[0,14,"Barbados",9],[0,14,"Blanc-Sablon",9],[0,14,"Curacao",9],[0,14,"Dominica",9],[0,14,"Glace_Bay",9],[0,14,"Goose_Bay",9],[0,14,"Grenada",9],[0,14,"Guadeloupe",9],[0,14,"Halifax",9],[0,14,"Martinique",9],[0,14,"Miquelon",9],[0,14,"Moncton",9],[0,14,"Montserrat",9],[0,14,"Pangnirtung",9],[0,14,"Port_of_Spain",9],[0,14,"Puerto_Rico",9],[0,14,"Santo_Domingo",9],[0,14,"St_Kitts",9],[0,14,"St_Lucia",9],[0,14,"St_Thomas",9],[0,14,"St_Vincent",9],[0,14,"Thule",9],[0,14,"Tortola",9],[0,14,"Virgin",9],[0,14,"Bermuda",13],[0,14,"Atlantic",16],[0,47,"Aden",12],[0,47,"Baghdad",12],[0,47,"Bahrain",12],[0,47,"Kuwait",12],[0,47,"Qatar",12]],[[1,22,"Halifax",9],[1,22,"Blanc-Sablon",9],[1,22,"Glace_Bay",9],[1,22,"Moncton",9],[1,22,"Pangnirtung",9],[1,22,"Puerto_Rico",9],[1,22,"Atlantic",16]],[[1,31,"Azores",13]],[[1,28,"Azores",13],[1,31,"Azores",13]],[[0,28,"Azores",13],[0,25,"Azores",13]],[[1,51,"Baku",12],[1,54,"Baku",12]],[[0,47,"Baku",12],[0,51,"Baku",12]],[[1,51,"Baku",12],[1,54,"Baku",12]],[[0,47,"Baku",12],[0,51,"Baku",12]],[[1,42,"London",18],[1,42,"Belfast",18],[1,42,"Gibraltar",18],[1,42,"Guernsey",18],[1,42,"Isle_of_Man",18],[1,42,"Jersey",18],[1,42,"GB"],[1,42,"GB-Eire"]],[[1,4,"Adak",9],[1,4,"Atka",9],[1,4,"Nome",9],[1,4,"Aleutian"],[0,57,"Dacca",12],[0,57,"Dhaka",12]],[[0,43,"Mogadishu"],[0,43,"Kampala"],[0,43,"Nairobi"]],[[0,46,"Nairobi"],[0,46,"Dar_es_Salaam"],[0,46,"Kampala"]],[[0,15,"Barbados",9],[0,27,"Banjul"],[0,41,"Tiraspol",18],[0,41,"Chisinau",18]],[[0,63,"Brunei",12],[0,65,"Brunei",12]],[[1,66,"Kuching",12]],[[0,63,"Kuching",12],[0,65,"Kuching",12]],[[1,19,"La_Paz",9]],[[0,14,"La_Paz",9]],[[1,25,"Sao_Paulo",9],[1,25,"Araguaina",9],[1,25,"Bahia",9],[1,25,"Belem",9],[1,25,"Fortaleza",9],[1,25,"Maceio",9],[1,25,"Recife",9],[1,25,"East",15]],[[0,22,"Sao_Paulo",9],[0,22,"Araguaina",9],[0,22,"Bahia",9],[0,22,"Belem",9],[0,22,"Fortaleza",9],[0,22,"Maceio",9],[0,22,"Recife",9],[0,22,"East",15]],[[0,35,"London",18],[1,35,"London",18],[0,2,"Adak",9],[0,2,"Atka",9],[0,2,"Nome",9],[0,2,"Midway",21],[0,2,"Pago_Pago",21],[0,2,"Samoa",21],[0,2,"Aleutian"],[0,2,"Samoa"],[0,35,"Belfast",18],[0,35,"Guernsey",18],[0,35,"Isle_of_Man",18],[0,35,"Jersey",18],[0,35,"GB"],[0,35,"GB-Eire"],[1,35,"Eire"],[1,35,"Belfast",18],[1,35,"Dublin",18],[1,35,"Gibraltar",18],[1,35,"Guernsey",18],[1,35,"Isle_of_Man",18],[1,35,"Jersey",18],[1,35,"GB"],[1,35,"GB-Eire"]],[[0,57,"Thimbu",12],[0,57,"Thimphu",12]],[[0,58,"Calcutta",12],[0,58,"Dacca",12],[0,58,"Dhaka",12],[0,58,"Rangoon",12]],[[0,28,"Canary",13]],[[1,6,"Anchorage",9],[1,6,"Alaska"]],[[0,70,"Adelaide",14],[1,47,"Gaborone"],[1,47,"Khartoum"]],[[0,4,"Anchorage",9],[0,4,"Alaska"],[0,42,"Khartoum"],[0,42,"Blantyre"],[0,42,"Gaborone"],[0,42,"Harare"],[0,42,"Kigali"],[0,42,"Lusaka"],[0,42,"Maputo"],[0,42,"Windhoek"]],[[1,6,"Anchorage",9],[1,6,"Alaska"]],[[1,14,"Rankin_Inlet",9]],[[1,11,"Chicago",9],[1,14,"Havana",9],[1,14,"Cuba"],[1,11,"Atikokan",9],[1,11,"Belize",9],[1,11,"Cambridge_Bay",9],[1,11,"Cancun",9],[1,11,"Chihuahua",9],[1,11,"Coral_Harbour",9],[1,11,"Costa_Rica",9],[1,11,"El_Salvador",9],[1,11,"Fort_Wayne",9],[1,11,"Guatemala",9],[1,11,"Indianapolis",4],[1,11,"Knox",4],[1,11,"Marengo",4],[1,11,"Petersburg",4],[1,11,"Vevay",4],[1,11,"Vincennes",4],[1,11,"Winamac",4],[1,11,"Indianapolis",9],[1,11,"Iqaluit",9],[1,11,"Louisville",6],[1,11,"Monticello",6],[1,11,"Knox_IN",9],[1,11,"Louisville",9],[1,11,"Managua",9],[1,11,"Menominee",9],[1,11,"Merida",9],[1,11,"Mexico_City",9],[1,11,"Monterrey",9],[1,11,"Center",8],[1,11,"New_Salem",8],[1,11,"Pangnirtung",9],[1,11,"Rainy_River",9],[1,11,"Rankin_Inlet",9],[1,11,"Tegucigalpa",9],[1,11,"Winnipeg",9],[1,11,"Central",16],[1,11,"CST6CDT"],[1,11,"General",20],[1,11,"Central"],[1,11,"East-Indiana"],[1,11,"Indiana-Starke"],[1,69,"Shanghai",12],[1,69,"Chongqing",12],[1,69,"Chungking",12],[1,69,"Harbin",12],[1,69,"Kashgar",12],[1,69,"Taipei",12],[1,69,"Urumqi",12],[1,69,"PRC"],[1,69,"ROC"]],[[1,47,"Berlin",18],[1,47,"CET"]],[[1,42,"Berlin",18],[1,47,"Kaliningrad",18],[1,42,"Algiers"],[1,42,"Ceuta"],[1,42,"Tripoli"],[1,42,"Tunis"],[1,42,"Longyearbyen",11],[1,42,"Jan_Mayen",13],[1,42,"CET"],[1,42,"Amsterdam",18],[1,42,"Andorra",18],[1,42,"Athens",18],[1,42,"Belgrade",18],[1,42,"Bratislava",18],[1,42,"Brussels",18],[1,42,"Budapest",18],[1,42,"Chisinau",18],[1,42,"Copenhagen",18],[1,42,"Gibraltar",18],[1,42,"Kaliningrad",18],[1,42,"Kiev",18],[1,42,"Lisbon",18],[1,42,"Ljubljana",18],[1,42,"Luxembourg",18],[1,42,"Madrid",18],[1,42,"Malta",18],[1,42,"Minsk",18],[1,42,"Monaco",18],[1,42,"Oslo",18],[1,42,"Paris",18],[1,42,"Podgorica",18],[1,42,"Prague",18],[1,42,"Riga",18],[1,42,"Rome",18],[1,42,"San_Marino",18],[1,42,"Sarajevo",18],[1,42,"Simferopol",18],[1,42,"Skopje",18],[1,42,"Sofia",18],[1,42,"Stockholm",18],[1,42,"Tallinn",18],[1,42,"Tirane",18],[1,42,"Tiraspol",18],[1,42,"Uzhgorod",18],[1,42,"Vaduz",18],[1,42,"Vatican",18],[1,42,"Vienna",18],[1,42,"Vilnius",18],[1,42,"Warsaw",18],[1,42,"Zagreb",18],[1,42,"Zaporozhye",18],[1,42,"Zurich",18],[1,42,"Libya"],[1,42,"Poland"],[1,42,"Portugal"],[1,42,"WET"]],[[0,35,"Berlin",18],[0,35,"Algiers"],[0,35,"Casablanca"],[0,35,"Ceuta"],[0,35,"Tripoli"],[0,35,"Tunis"],[0,35,"Longyearbyen",11],[0,35,"Jan_Mayen",13],[0,35,"CET"],[0,35,"Amsterdam",18],[0,35,"Andorra",18],[0,35,"Athens",18],[0,35,"Belgrade",18],[0,35,"Bratislava",18],[0,35,"Brussels",18],[0,35,"Budapest",18],[0,35,"Chisinau",18],[0,35,"Copenhagen",18],[0,35,"Gibraltar",18],[0,35,"Kaliningrad",18],[0,35,"Kiev",18],[0,35,"Lisbon",18],[0,35,"Ljubljana",18],[0,35,"Luxembourg",18],[0,35,"Madrid",18],[0,35,"Malta",18],[0,35,"Minsk",18],[0,35,"Monaco",18],[0,35,"Oslo",18],[0,35,"Paris",18],[0,35,"Podgorica",18],[0,35,"Prague",18],[0,35,"Riga",18],[0,35,"Rome",18],[0,35,"San_Marino",18],[0,35,"Sarajevo",18],[0,35,"Simferopol",18],[0,35,"Skopje",18],[0,35,"Sofia",18],[0,35,"Stockholm",18],[0,35,"Tallinn",18],[0,35,"Tirane",18],[0,35,"Tiraspol",18],[0,35,"Uzhgorod",18],[0,35,"Vaduz",18],[0,35,"Vatican",18],[0,35,"Vienna",18],[0,35,"Vilnius",18],[0,35,"Warsaw",18],[0,35,"Zagreb",18],[0,35,"Zaporozhye",18],[0,35,"Zurich",18],[0,35,"Libya"],[0,35,"Poland"],[0,35,"Portugal"],[0,35,"WET"],[0,42,"Kaliningrad",18]],[[1,28,"Scoresbysund",9]],[[0,25,"Scoresbysund",9]],[[1,80,"Chatham",21],[1,80,"NZ-CHAT"]],[[0,78,"Chatham",21],[0,78,"NZ-CHAT"]],[[0,67,"Harbin",12],[0,69,"Harbin",12]],[[1,10,"Belize",9]],[[1,72,"Choibalsan",12]],[[0,69,"Choibalsan",12]],[[0,65,"Dili",12],[0,65,"Makassar",12],[0,65,"Pontianak",12],[0,65,"Ujung_Pandang",12]],[[0,69,"Sakhalin",12]],[[1,5,"Rarotonga",21]],[[0,4,"Rarotonga",21]],[[1,22,"Santiago",9],[1,14,"Santiago",9],[1,22,"Palmer",10],[1,22,"Continental",17],[1,14,"Continental",17]],[[0,14,"Santiago",9],[0,11,"Santiago",9],[0,14,"Palmer",10],[0,14,"Continental",17],[0,11,"Continental",17]],[[1,14,"Bogota",9]],[[0,11,"Bogota",9]],[[1,11,"Chicago",9],[1,11,"Atikokan",9],[1,11,"Coral_Harbour",9],[1,11,"Fort_Wayne",9],[1,11,"Indianapolis",4],[1,11,"Knox",4],[1,11,"Marengo",4],[1,11,"Petersburg",4],[1,11,"Vevay",4],[1,11,"Vincennes",4],[1,11,"Winamac",4],[1,11,"Indianapolis",9],[1,11,"Louisville",6],[1,11,"Monticello",6],[1,11,"Knox_IN",9],[1,11,"Louisville",9],[1,11,"Menominee",9],[1,11,"Rainy_River",9],[1,11,"Rankin_Inlet",9],[1,11,"Winnipeg",9],[1,11,"Central",16],[1,11,"CST6CDT"],[1,11,"Central"],[1,11,"East-Indiana"],[1,11,"Indiana-Starke"]],[[0,9,"Chicago",9],[0,11,"Havana",9],[0,11,"Cuba"],[0,9,"Atikokan",9],[0,9,"Belize",9],[0,9,"Cambridge_Bay",9],[0,9,"Cancun",9],[0,9,"Chihuahua",9],[0,9,"Coral_Harbour",9],[0,9,"Costa_Rica",9],[0,9,"Detroit",9],[0,9,"El_Salvador",9],[0,9,"Fort_Wayne",9],[0,9,"Guatemala",9],[0,9,"Hermosillo",9],[0,9,"Indianapolis",4],[0,9,"Knox",4],[0,9,"Marengo",4],[0,9,"Petersburg",4],[0,9,"Vevay",4],[0,9,"Vincennes",4],[0,9,"Winamac",4],[0,9,"Indianapolis",9],[0,9,"Iqaluit",9],[0,9,"Louisville",6],[0,9,"Monticello",6],[0,9,"Knox_IN",9],[0,9,"Louisville",9],[0,9,"Managua",9],[0,9,"Mazatlan",9],[0,9,"Menominee",9],[0,9,"Merida",9],[0,9,"Mexico_City",9],[0,9,"Monterrey",9],[0,9,"Center",8],[0,9,"New_Salem",8],[0,9,"Pangnirtung",9],[0,9,"Rainy_River",9],[0,9,"Rankin_Inlet",9],[0,9,"Regina",9],[0,9,"Swift_Current",9],[0,9,"Tegucigalpa",9],[0,9,"Winnipeg",9],[0,9,"Central",16],[0,9,"East-Saskatchewan",16],[0,9,"Saskatchewan",16],[0,9,"CST6CDT"],[0,9,"BajaSur",20],[0,9,"General",20],[0,9,"Central"],[0,9,"East-Indiana"],[0,9,"Indiana-Starke"],[0,9,"Michigan"],[0,65,"Chongqing",12],[0,65,"Chungking",12],[0,65,"Harbin",12],[0,65,"Kashgar",12],[0,65,"Macao",12],[0,65,"Macau",12],[0,65,"Shanghai",12],[0,65,"Taipei",12],[0,65,"Urumqi",12],[0,65,"PRC"],[0,65,"ROC"],[0,70,"Jayapura",12],[0,70,"Adelaide",14],[0,70,"Broken_Hill",14],[0,70,"Darwin",14],[0,70,"North",14],[0,70,"South",14],[0,70,"Yancowinna",14],[1,73,"Adelaide",14],[1,73,"Broken_Hill",14],[1,73,"Darwin",14],[1,73,"North",14],[1,73,"South",14],[1,73,"Yancowinna",14]],[[1,28,"Cape_Verde",13]],[[0,28,"Cape_Verde",13],[0,25,"Cape_Verde",13]],[[0,68,"Eucla",14],[1,71,"Eucla",14]],[[1,11,"Chicago",9],[1,11,"Atikokan",9],[1,11,"Coral_Harbour",9],[1,11,"Fort_Wayne",9],[1,11,"Indianapolis",4],[1,11,"Knox",4],[1,11,"Marengo",4],[1,11,"Petersburg",4],[1,11,"Vevay",4],[1,11,"Vincennes",4],[1,11,"Winamac",4],[1,11,"Indianapolis",9],[1,11,"Louisville",6],[1,11,"Monticello",6],[1,11,"Knox_IN",9],[1,11,"Louisville",9],[1,11,"Menominee",9],[1,11,"Mexico_City",9],[1,11,"Rainy_River",9],[1,11,"Rankin_Inlet",9],[1,11,"Winnipeg",9],[1,11,"Central",16],[1,11,"CST6CDT"],[1,11,"General",20],[1,11,"Central"],[1,11,"East-Indiana"],[1,11,"Indiana-Starke"]],[[0,72,"Guam",21],[0,72,"Saipan",21]],[[0,57,"Dacca",12],[0,57,"Dhaka",12]],[[0,59,"Davis",10]],[[0,72,"DumontDUrville",10]],[[1,57,"Dushanbe",12],[1,59,"Dushanbe",12]],[[0,54,"Dushanbe",12],[0,57,"Dushanbe",12]],[[1,11,"EasterIsland",17],[1,9,"EasterIsland",17],[1,11,"Easter",21],[1,9,"Easter",21]],[[0,9,"EasterIsland",17],[0,8,"EasterIsland",17],[0,9,"Easter",21],[0,8,"Easter",21],[1,51,"Antananarivo",19]],[[0,47,"Khartoum"],[0,47,"Addis_Ababa"],[0,47,"Asmara"],[0,47,"Asmera"],[0,47,"Dar_es_Salaam"],[0,47,"Djibouti"],[0,47,"Kampala"],[0,47,"Mogadishu"],[0,47,"Nairobi"],[0,47,"Antananarivo",19],[0,47,"Comoro",19],[0,47,"Mayotte",19]],[[0,11,"Guayaquil",9],[0,11,"Galapagos",21]],[[1,22,"Iqaluit",9]],[[1,14,"New_York",9],[1,14,"Cancun",9],[1,14,"Detroit",9],[1,14,"Fort_Wayne",9],[1,14,"Grand_Turk",9],[1,14,"Indianapolis",4],[1,14,"Marengo",4],[1,14,"Vevay",4],[1,14,"Vincennes",4],[1,14,"Winamac",4],[1,14,"Indianapolis",9],[1,14,"Iqaluit",9],[1,14,"Jamaica",9],[1,14,"Louisville",6],[1,14,"Monticello",6],[1,14,"Louisville",9],[1,14,"Montreal",9],[1,14,"Nassau",9],[1,14,"Nipigon",9],[1,14,"Pangnirtung",9],[1,14,"Port-au-Prince",9],[1,14,"Santo_Domingo",9],[1,14,"Thunder_Bay",9],[1,14,"Toronto",9],[1,14,"Eastern",16],[1,14,"EST"],[1,14,"EST5EDT"],[1,14,"Jamaica"],[1,14,"East-Indiana"],[1,14,"Eastern"],[1,14,"Michigan"]],[[1,47,"Helsinki",18],[1,47,"Cairo"],[1,47,"Amman",12],[1,47,"Beirut",12],[1,47,"Damascus",12],[1,47,"Gaza",12],[1,47,"Istanbul",12],[1,47,"Nicosia",12],[1,47,"EET"],[1,47,"Egypt"],[1,47,"Athens",18],[1,47,"Bucharest",18],[1,47,"Chisinau",18],[1,47,"Istanbul",18],[1,47,"Kaliningrad",18],[1,47,"Kiev",18],[1,47,"Mariehamn",18],[1,47,"Minsk",18],[1,47,"Moscow",18],[1,47,"Nicosia",18],[1,47,"Riga",18],[1,47,"Simferopol",18],[1,47,"Sofia",18],[1,47,"Tallinn",18],[1,47,"Tiraspol",18],[1,47,"Uzhgorod",18],[1,47,"Vilnius",18],[1,47,"Warsaw",18],[1,47,"Zaporozhye",18],[1,47,"Poland"],[1,47,"Turkey"],[1,47,"W-SU"]],[[0,42,"Helsinki",18],[1,47,"Gaza",12],[0,42,"Cairo"],[0,42,"Tripoli"],[0,42,"Amman",12],[0,42,"Beirut",12],[0,42,"Damascus",12],[0,42,"Gaza",12],[0,42,"Istanbul",12],[0,42,"Nicosia",12],[0,42,"EET"],[0,42,"Egypt"],[0,42,"Athens",18],[0,42,"Bucharest",18],[0,42,"Chisinau",18],[0,42,"Istanbul",18],[0,42,"Kaliningrad",18],[0,42,"Kiev",18],[0,42,"Mariehamn",18],[0,42,"Minsk",18],[0,42,"Moscow",18],[0,42,"Nicosia",18],[0,42,"Riga",18],[0,42,"Simferopol",18],[0,42,"Sofia",18],[0,42,"Tallinn",18],[0,42,"Tiraspol",18],[0,42,"Uzhgorod",18],[0,42,"Vilnius",18],[0,42,"Warsaw",18],[0,42,"Zaporozhye",18],[0,42,"Libya"],[0,42,"Poland"],[0,42,"Turkey"],[0,42,"W-SU"]],[[1,31,"Scoresbysund",9]],[[0,28,"Scoresbysund",9]],[[1,13,"Santo_Domingo",9]],[[0,69,"Jayapura",12]],[[1,14,"New_York",9],[1,14,"Detroit",9],[1,14,"Iqaluit",9],[1,14,"Montreal",9],[1,14,"Nipigon",9],[1,14,"Thunder_Bay",9],[1,14,"Toronto",9],[1,14,"Eastern",16],[1,14,"EST"],[1,14,"EST5EDT"],[1,14,"Eastern"],[1,14,"Michigan"]],[[0,11,"New_York",9],[0,11,"Antigua",9],[0,11,"Atikokan",9],[0,11,"Cambridge_Bay",9],[0,11,"Cancun",9],[0,11,"Cayman",9],[0,11,"Chicago",9],[0,11,"Coral_Harbour",9],[0,11,"Detroit",9],[0,11,"Fort_Wayne",9],[0,11,"Grand_Turk",9],[0,11,"Indianapolis",4],[0,11,"Knox",4],[0,11,"Marengo",4],[0,11,"Petersburg",4],[0,11,"Vevay",4],[0,11,"Vincennes",4],[0,11,"Winamac",4],[0,11,"Indianapolis",9],[0,11,"Iqaluit",9],[0,11,"Jamaica",9],[0,11,"Louisville",6],[0,11,"Monticello",6],[0,11,"Knox_IN",9],[0,11,"Louisville",9],[0,11,"Managua",9],[0,11,"Menominee",9],[0,11,"Merida",9],[0,11,"Montreal",9],[0,11,"Nassau",9],[0,11,"Nipigon",9],[0,11,"Panama",9],[0,11,"Pangnirtung",9],[0,11,"Port-au-Prince",9],[0,11,"Rankin_Inlet",9],[0,11,"Santo_Domingo",9],[0,11,"Thunder_Bay",9],[0,11,"Toronto",9],[0,11,"Eastern",16],[0,11,"EST"],[0,11,"EST5EDT"],[0,11,"Jamaica"],[0,11,"Central"],[0,11,"East-Indiana"],[0,11,"Eastern"],[0,11,"Indiana-Starke"],[0,11,"Michigan"],[0,72,"ACT",14],[0,72,"Brisbane",14],[0,72,"Canberra",14],[0,72,"Currie",14],[0,72,"Hobart",14],[0,72,"Lindeman",14],[0,72,"Melbourne",14],[0,72,"NSW",14],[0,72,"Queensland",14],[0,72,"Sydney",14],[0,72,"Tasmania",14],[0,72,"Victoria",14],[1,74,"Melbourne",14],[1,74,"ACT",14],[1,74,"Brisbane",14],[1,74,"Canberra",14],[1,74,"Currie",14],[1,74,"Hobart",14],[1,74,"Lindeman",14],[1,74,"NSW",14],[1,74,"Queensland",14],[1,74,"Sydney",14],[1,74,"Tasmania",14],[1,74,"Victoria",14]],[[1,14,"New_York",9],[1,14,"Detroit",9],[1,14,"Iqaluit",9],[1,14,"Montreal",9],[1,14,"Nipigon",9],[1,14,"Thunder_Bay",9],[1,14,"Toronto",9],[1,14,"Eastern",16],[1,14,"EST"],[1,14,"EST5EDT"],[1,14,"Eastern"],[1,14,"Michigan"]],[[1,79,"Fiji",21]],[[0,76,"Fiji",21]],[[1,22,"Stanley",13],[1,25,"Stanley",13]],[[0,22,"Stanley",13],[0,14,"Stanley",13]],[[1,28,"Noronha",9],[1,28,"DeNoronha",15]],[[0,25,"Noronha",9],[0,25,"DeNoronha",15]],[[0,51,"Aqtau",12],[0,54,"Aqtau",12]],[[1,57,"Bishkek",12],[1,59,"Bishkek",12]],[[0,54,"Bishkek",12],[0,57,"Bishkek",12]],[[0,9,"Galapagos",21]],[[0,6,"Gambier",21]],[[0,16,"Guyana",9]],[[1,51,"Tbilisi",12],[1,54,"Tbilisi",12]],[[0,47,"Tbilisi",12],[0,51,"Tbilisi",12]],[[0,22,"Cayenne",9],[0,14,"Cayenne",9]],[[1,33,"Accra"]],[[0,31,"Abidjan"],[0,31,"Accra"],[0,31,"Bamako"],[0,31,"Banjul"],[0,31,"Bissau"],[0,31,"Conakry"],[0,31,"Dakar"],[0,31,"Freetown"],[0,31,"Malabo"],[0,31,"Monrovia"],[0,31,"Niamey"],[0,31,"Nouakchott"],[0,31,"Ouagadougou"],[0,31,"Porto-Novo"],[0,31,"Sao_Tome"],[0,31,"Timbuktu"],[0,31,"Danmarkshavn",9],[0,31,"Reykjavik",13],[0,31,"St_Helena",13],[0,31,"Eire"],[0,31,"Belfast",18],[0,31,"Dublin",18],[0,31,"Gibraltar",18],[0,31,"Guernsey",18],[0,31,"Isle_of_Man",18],[0,31,"Jersey",18],[0,31,"London",18],[0,31,"GB"],[0,31,"GB-Eire"],[0,31,"Iceland"]],[[0,51,"Dubai",12],[0,51,"Bahrain",12],[0,51,"Muscat",12],[0,51,"Qatar",12]],[[0,22,"Guyana",9],[0,16,"Guyana",9],[0,14,"Guyana",9]],[[1,6,"Adak",9],[1,6,"Atka",9],[1,6,"Aleutian"]],[[0,4,"Adak",9],[0,4,"Atka",9],[0,4,"Aleutian"]],[[1,5,"Honolulu",21],[1,5,"HST"],[1,5,"Hawaii"]],[[1,69,"Hong_Kong",12],[1,69,"Hongkong"]],[[0,65,"Hong_Kong",12],[0,65,"Hongkong"]],[[1,65,"Hovd",12]],[[0,57,"Hovd",12],[0,59,"Hovd",12]],[[1,5,"Honolulu",21],[1,5,"HST"],[1,5,"Hawaii"]],[[0,4,"Honolulu",21],[0,3,"Honolulu",21],[0,4,"HST"],[0,4,"Hawaii"],[0,3,"HST"],[0,3,"Hawaii"]],[[1,5,"Honolulu",21],[1,5,"HST"],[1,5,"Hawaii"]],[[0,59,"Bangkok",12],[0,59,"Phnom_Penh",12],[0,59,"Saigon",12],[0,59,"Vientiane",12],[0,65,"Phnom_Penh",12],[0,65,"Saigon",12],[0,65,"Vientiane",12]],[[1,51,"Jerusalem",12],[1,51,"Tel_Aviv",12],[1,51,"Israel"]],[[1,47,"Jerusalem",12],[1,47,"Gaza",12],[1,47,"Tel_Aviv",12],[1,47,"Israel"]],[[1,57,"Colombo",12]],[[0,54,"Chagos",19],[0,57,"Chagos",19]],[[1,52,"Tehran",12],[1,54,"Tehran",12],[1,52,"Iran"],[1,54,"Iran"]],[[1,65,"Irkutsk",12],[1,69,"Irkutsk",12]],[[0,59,"Irkutsk",12],[0,65,"Irkutsk",12]],[[0,49,"Tehran",12],[0,51,"Tehran",12],[0,49,"Iran"],[0,51,"Iran"]],[[1,31,"Reykjavik",13],[1,31,"Iceland"]],[[0,42,"Jerusalem",12],[0,28,"Reykjavik",13],[0,28,"Iceland"],[0,55,"Calcutta",12],[0,55,"Colombo",12],[0,55,"Dacca",12],[0,55,"Dhaka",12],[0,55,"Karachi",12],[0,55,"Katmandu",12],[0,55,"Thimbu",12],[0,55,"Thimphu",12],[1,34,"Eire"],[1,34,"Dublin",18],[1,58,"Calcutta",12],[1,58,"Colombo",12],[1,58,"Karachi",12],[0,35,"Eire"],[0,35,"Dublin",18],[1,35,"Eire"],[1,35,"Dublin",18],[0,42,"Gaza",12],[0,42,"Tel_Aviv",12],[0,42,"Israel"]],[[0,62,"Jakarta",12]],[[1,72,"Tokyo",12],[1,72,"Japan"]],[[0,69,"Tokyo",12],[0,69,"Dili",12],[0,69,"Jakarta",12],[0,69,"Kuala_Lumpur",12],[0,69,"Kuching",12],[0,69,"Makassar",12],[0,69,"Manila",12],[0,69,"Pontianak",12],[0,69,"Rangoon",12],[0,69,"Sakhalin",12],[0,69,"Singapore",12],[0,69,"Ujung_Pandang",12],[0,69,"Japan"],[0,69,"Nauru",21],[0,69,"Singapore"]],[[0,54,"Karachi",12]],[[0,54,"Kashgar",12],[0,55,"Kashgar",12]],[[1,69,"Seoul",12],[1,72,"Seoul",12],[1,69,"ROK"],[1,72,"ROK"]],[[1,57,"Bishkek",12]],[[0,54,"Bishkek",12],[0,57,"Bishkek",12]],[[1,57,"Qyzylorda",12]],[[0,51,"Qyzylorda",12],[0,54,"Qyzylorda",12],[0,57,"Qyzylorda",12]],[[0,38,"Vilnius",18]],[[0,74,"Kosrae",21],[0,76,"Kosrae",21]],[[1,59,"Krasnoyarsk",12],[1,65,"Krasnoyarsk",12]],[[0,57,"Krasnoyarsk",12],[0,59,"Krasnoyarsk",12]],[[0,65,"Seoul",12],[0,67,"Seoul",12],[0,69,"Seoul",12],[0,65,"Pyongyang",12],[0,65,"ROK"],[0,67,"Pyongyang",12],[0,67,"ROK"],[0,69,"Pyongyang",12],[0,69,"ROK"]],[[1,47,"Samara",18],[1,51,"Samara",18],[1,54,"Samara",18]],[[0,47,"Samara",18],[0,51,"Samara",18]],[[0,0,"Kwajalein",21],[0,0,"Kwajalein"]],[[0,73,"Lord_Howe",14],[1,74,"Lord_Howe",14],[1,75,"Lord_Howe",14],[0,73,"LHI",14],[1,74,"LHI",14],[1,75,"LHI",14]],[[0,4,"Kiritimati",21],[0,81,"Kiritimati",21]],[[0,57,"Colombo",12],[0,58,"Colombo",12]],[[0,59,"Chongqing",12],[0,59,"Chungking",12]],[[0,29,"Monrovia"]],[[1,45,"Riga",18]],[[1,35,"Madeira",13]],[[1,31,"Madeira",13]],[[0,28,"Madeira",13]],[[1,74,"Magadan",12],[1,76,"Magadan",12]],[[0,72,"Magadan",12],[0,74,"Magadan",12]],[[1,62,"Singapore",12],[1,62,"Kuala_Lumpur",12],[1,62,"Singapore"]],[[0,59,"Singapore",12],[0,62,"Singapore",12],[0,63,"Singapore",12],[0,59,"Kuala_Lumpur",12],[0,59,"Singapore"],[0,62,"Kuala_Lumpur",12],[0,62,"Singapore"],[0,63,"Kuala_Lumpur",12],[0,63,"Singapore"]],[[0,5,"Marquesas",21]],[[0,57,"Mawson",10]],[[1,11,"Cambridge_Bay",9],[1,11,"Yellowknife",9]],[[1,53,"Moscow",18],[1,53,"W-SU"]],[[1,9,"Denver",9],[1,9,"Boise",9],[1,9,"Cambridge_Bay",9],[1,9,"Chihuahua",9],[1,9,"Edmonton",9],[1,9,"Hermosillo",9],[1,9,"Inuvik",9],[1,9,"Mazatlan",9],[1,9,"Center",8],[1,9,"New_Salem",8],[1,9,"Phoenix",9],[1,9,"Regina",9],[1,9,"Shiprock",9],[1,9,"Swift_Current",9],[1,9,"Yellowknife",9],[1,9,"East-Saskatchewan",16],[1,9,"Mountain",16],[1,9,"Saskatchewan",16],[1,9,"BajaSur",20],[1,9,"MST"],[1,9,"MST7MDT"],[1,9,"Navajo"],[1,9,"Arizona"],[1,9,"Mountain"]],[[1,42,"MET"]],[[0,35,"MET"]],[[0,76,"Kwajalein",21],[0,76,"Kwajalein"],[0,76,"Majuro",21]],[[0,44,"Moscow",18],[0,58,"Rangoon",12],[0,64,"Makassar",12],[0,64,"Ujung_Pandang",12],[0,44,"W-SU"]],[[1,69,"Macao",12],[1,69,"Macau",12]],[[0,65,"Macao",12],[0,65,"Macau",12]],[[1,9,"Denver",9],[1,9,"Boise",9],[1,9,"Cambridge_Bay",9],[1,9,"Edmonton",9],[1,9,"Center",8],[1,9,"New_Salem",8],[1,9,"Regina",9],[1,9,"Shiprock",9],[1,9,"Swift_Current",9],[1,9,"Yellowknife",9],[1,9,"East-Saskatchewan",16],[1,9,"Mountain",16],[1,9,"Saskatchewan",16],[1,9,"MST"],[1,9,"MST7MDT"],[1,9,"Navajo"],[1,9,"Mountain"],[0,72,"Saipan",21]],[[1,51,"Moscow",18],[1,54,"Moscow",18],[1,51,"Chisinau",18],[1,51,"Kaliningrad",18],[1,51,"Kiev",18],[1,51,"Minsk",18],[1,51,"Riga",18],[1,51,"Simferopol",18],[1,51,"Tallinn",18],[1,51,"Tiraspol",18],[1,51,"Uzhgorod",18],[1,51,"Vilnius",18],[1,51,"Zaporozhye",18],[1,51,"W-SU"],[1,54,"W-SU"]],[[0,47,"Moscow",18],[0,47,"Chisinau",18],[0,47,"Kaliningrad",18],[0,47,"Kiev",18],[0,47,"Minsk",18],[0,47,"Riga",18],[0,47,"Simferopol",18],[0,47,"Tallinn",18],[0,47,"Tiraspol",18],[0,47,"Uzhgorod",18],[0,47,"Vilnius",18],[0,47,"Zaporozhye",18],[0,47,"W-SU"]],[[0,8,"Denver",9],[0,8,"Boise",9],[0,8,"Cambridge_Bay",9],[0,8,"Chihuahua",9],[0,8,"Dawson_Creek",9],[0,8,"Edmonton",9],[0,8,"Ensenada",9],[0,8,"Hermosillo",9],[0,8,"Inuvik",9],[0,8,"Mazatlan",9],[0,8,"Mexico_City",9],[0,8,"Center",8],[0,8,"New_Salem",8],[0,8,"Phoenix",9],[0,8,"Regina",9],[0,8,"Shiprock",9],[0,8,"Swift_Current",9],[0,8,"Tijuana",9],[0,8,"Yellowknife",9],[0,8,"East-Saskatchewan",16],[0,8,"Mountain",16],[0,8,"Saskatchewan",16],[0,8,"BajaNorte",20],[0,8,"BajaSur",20],[0,8,"General",20],[0,8,"MST"],[0,8,"MST7MDT"],[0,8,"Navajo"],[0,8,"Arizona"],[0,8,"Mountain"],[1,50,"Moscow",18],[1,50,"W-SU"]],[[0,51,"Mauritius",19]],[[0,54,"Maldives",19]],[[1,9,"Denver",9],[1,9,"Boise",9],[1,9,"Cambridge_Bay",9],[1,9,"Edmonton",9],[1,9,"Center",8],[1,9,"New_Salem",8],[1,9,"Phoenix",9],[1,9,"Regina",9],[1,9,"Shiprock",9],[1,9,"Swift_Current",9],[1,9,"Yellowknife",9],[1,9,"East-Saskatchewan",16],[1,9,"Mountain",16],[1,9,"Saskatchewan",16],[1,9,"MST"],[1,9,"MST7MDT"],[1,9,"Navajo"],[1,9,"Arizona"],[1,9,"Mountain"]],[[0,65,"Kuala_Lumpur",12],[0,65,"Kuching",12]],[[1,76,"Noumea",21]],[[0,74,"Noumea",21]],[[1,26,"St_Johns",9],[1,26,"Newfoundland",16]],[[1,24,"St_Johns",9],[1,23,"St_Johns",9],[1,4,"Midway",21],[1,24,"Goose_Bay",9],[1,24,"Newfoundland",16],[1,23,"Goose_Bay",9],[1,23,"Newfoundland",16]],[[0,21,"Paramaribo",9]],[[1,37,"Amsterdam",18]],[[0,33,"Amsterdam",18]],[[0,75,"Norfolk",21]],[[1,59,"Novosibirsk",12],[1,65,"Novosibirsk",12]],[[0,57,"Novosibirsk",12],[0,59,"Novosibirsk",12]],[[1,24,"St_Johns",9],[1,4,"Adak",9],[1,4,"Atka",9],[1,4,"Nome",9],[1,4,"Aleutian"],[1,24,"Goose_Bay",9],[1,24,"Newfoundland",16],[0,56,"Katmandu",12]],[[0,75,"Nauru",21],[0,76,"Nauru",21]],[[0,21,"St_Johns",9],[0,20,"St_Johns",9],[0,21,"Goose_Bay",9],[0,21,"Newfoundland",16],[0,20,"Goose_Bay",9],[0,20,"Newfoundland",16],[0,2,"Adak",9],[0,2,"Atka",9],[0,2,"Nome",9],[0,2,"Midway",21],[0,2,"Pago_Pago",21],[0,2,"Samoa",21],[0,2,"Aleutian"],[0,2,"Samoa"],[1,36,"Amsterdam",18]],[[0,2,"Niue",21],[0,1,"Niue",21]],[[1,24,"St_Johns",9],[1,4,"Adak",9],[1,4,"Atka",9],[1,4,"Nome",9],[1,4,"Aleutian"],[1,24,"Goose_Bay",9],[1,24,"Newfoundland",16]],[[1,79,"Auckland",21],[1,79,"McMurdo",10],[1,79,"South_Pole",10],[1,79,"NZ"]],[[0,75,"Auckland",21],[0,75,"NZ"]],[[0,76,"Auckland",21],[1,76,"Auckland",21],[1,77,"Auckland",21],[0,76,"McMurdo",10],[0,76,"South_Pole",10],[0,76,"NZ"],[1,76,"NZ"],[1,77,"NZ"]],[[1,57,"Omsk",12],[1,59,"Omsk",12]],[[0,54,"Omsk",12],[0,57,"Omsk",12]],[[1,54,"Oral",12]],[[0,51,"Oral",12],[0,54,"Oral",12]],[[1,9,"Inuvik",9]],[[1,8,"Los_Angeles",9],[1,8,"Boise",9],[1,8,"Dawson",9],[1,8,"Dawson_Creek",9],[1,8,"Ensenada",9],[1,8,"Inuvik",9],[1,8,"Juneau",9],[1,8,"Tijuana",9],[1,8,"Vancouver",9],[1,8,"Whitehorse",9],[1,8,"Pacific",16],[1,8,"Yukon",16],[1,8,"BajaNorte",20],[1,8,"PST8PDT"],[1,8,"Pacific"],[1,8,"Pacific-New"]],[[1,14,"Lima",9]],[[1,76,"Kamchatka",12],[1,79,"Kamchatka",12]],[[0,74,"Kamchatka",12],[0,76,"Kamchatka",12]],[[0,11,"Lima",9]],[[0,2,"Enderbury",21],[0,79,"Enderbury",21]],[[1,69,"Manila",12]],[[0,65,"Manila",12]],[[1,57,"Karachi",12]],[[0,54,"Karachi",12]],[[1,25,"Miquelon",9]],[[0,22,"Miquelon",9]],[[0,18,"Paramaribo",9],[0,17,"Paramaribo",9],[0,61,"Pontianak",12],[0,72,"DumontDUrville",10]],[[1,8,"Los_Angeles",9],[1,8,"Dawson_Creek",9],[1,8,"Ensenada",9],[1,8,"Inuvik",9],[1,8,"Juneau",9],[1,8,"Tijuana",9],[1,8,"Vancouver",9],[1,8,"Pacific",16],[1,8,"BajaNorte",20],[1,8,"PST8PDT"],[1,8,"Pacific"],[1,8,"Pacific-New"]],[[0,7,"Los_Angeles",9],[0,7,"Boise",9],[0,7,"Dawson",9],[0,7,"Dawson_Creek",9],[0,7,"Ensenada",9],[0,7,"Hermosillo",9],[0,7,"Inuvik",9],[0,7,"Juneau",9],[0,7,"Mazatlan",9],[0,7,"Tijuana",9],[0,7,"Vancouver",9],[0,7,"Whitehorse",9],[0,7,"Pacific",16],[0,7,"Yukon",16],[0,7,"BajaNorte",20],[0,7,"BajaSur",20],[0,7,"Pitcairn",21],[0,7,"PST8PDT"],[0,7,"Pacific"],[0,7,"Pacific-New"]],[[1,8,"Los_Angeles",9],[1,8,"Dawson_Creek",9],[1,8,"Ensenada",9],[1,8,"Inuvik",9],[1,8,"Juneau",9],[1,8,"Tijuana",9],[1,8,"Vancouver",9],[1,8,"Pacific",16],[1,8,"BajaNorte",20],[1,8,"PST8PDT"],[1,8,"Pacific"],[1,8,"Pacific-New"]],[[1,22,"Asuncion",9]],[[0,22,"Asuncion",9],[0,14,"Asuncion",9]],[[1,59,"Qyzylorda",12]],[[0,54,"Qyzylorda",12],[0,57,"Qyzylorda",12]],[[0,51,"Reunion",19]],[[0,39,"Riga",18]],[[0,22,"Rothera",10]],[[1,74,"Sakhalin",12],[1,76,"Sakhalin",12]],[[0,72,"Sakhalin",12],[0,74,"Sakhalin",12]],[[1,57,"Samarkand",12],[1,54,"Samara",18]],[[0,51,"Samarkand",12],[0,54,"Samarkand",12],[0,1,"Apia",21],[0,1,"Pago_Pago",21],[0,1,"Samoa",21],[0,1,"Samoa"],[0,47,"Samara",18],[0,51,"Samara",18]],[[1,47,"Johannesburg"],[0,42,"Johannesburg"],[1,47,"Maseru"],[1,47,"Windhoek"],[0,42,"Maseru"],[0,42,"Mbabane"],[0,42,"Windhoek"]],[[0,74,"Guadalcanal",21]],[[0,51,"Mahe",19]],[[0,63,"Singapore",12],[0,65,"Singapore",12],[0,63,"Singapore"],[0,65,"Singapore"]],[[1,57,"Aqtau",12]],[[0,54,"Aqtau",12],[0,57,"Aqtau",12]],[[1,30,"Freetown"],[1,35,"Freetown"]],[[0,60,"Saigon",12],[0,12,"Santiago",9],[0,12,"Continental",17],[0,60,"Phnom_Penh",12],[0,60,"Vientiane",12]],[[0,22,"Paramaribo",9],[0,21,"Paramaribo",9]],[[0,2,"Samoa",21],[0,2,"Midway",21],[0,2,"Pago_Pago",21],[0,2,"Samoa"]],[[0,47,"Volgograd",18],[0,51,"Volgograd",18]],[[1,54,"Yekaterinburg",12],[1,57,"Yekaterinburg",12]],[[0,51,"Yekaterinburg",12],[0,54,"Yekaterinburg",12]],[[0,47,"Syowa",10]],[[0,4,"Tahiti",21]],[[1,59,"Samarkand",12],[1,57,"Tashkent",12],[1,59,"Tashkent",12]],[[0,57,"Samarkand",12],[0,54,"Tashkent",12],[0,57,"Tashkent",12]],[[1,51,"Tbilisi",12],[1,54,"Tbilisi",12]],[[0,47,"Tbilisi",12],[0,51,"Tbilisi",12]],[[0,54,"Kerguelen",19]],[[0,54,"Dushanbe",12]],[[0,65,"Dili",12],[0,69,"Dili",12]],[[0,48,"Tehran",12],[0,48,"Iran"],[0,51,"Ashgabat",12],[0,51,"Ashkhabad",12],[0,54,"Ashgabat",12],[0,54,"Ashkhabad",12],[0,40,"Tallinn",18]],[[1,81,"Tongatapu",21]],[[0,79,"Tongatapu",21]],[[1,51,"Istanbul",18],[1,51,"Istanbul",12],[1,51,"Turkey"]],[[0,47,"Istanbul",18],[0,47,"Istanbul",12],[0,47,"Turkey"]],[[0,47,"Volgograd",18]],[[1,69,"Ulaanbaatar",12],[1,69,"Ulan_Bator",12]],[[0,59,"Ulaanbaatar",12],[0,65,"Ulaanbaatar",12],[0,59,"Choibalsan",12],[0,59,"Ulan_Bator",12],[0,65,"Choibalsan",12],[0,65,"Ulan_Bator",12]],[[1,54,"Oral",12],[1,57,"Oral",12]],[[0,51,"Oral",12],[0,54,"Oral",12],[0,57,"Oral",12]],[[0,57,"Urumqi",12]],[[1,22,"Montevideo",9],[1,24,"Montevideo",9]],[[1,25,"Montevideo",9]],[[0,22,"Montevideo",9],[0,21,"Montevideo",9]],[[1,57,"Samarkand",12],[1,57,"Tashkent",12]],[[0,54,"Samarkand",12],[0,54,"Tashkent",12]],[[0,14,"Caracas",9],[0,13,"Caracas",9]],[[1,72,"Vladivostok",12]],[[0,69,"Vladivostok",12],[1,74,"Vladivostok",12]],[[0,69,"Vladivostok",12],[0,72,"Vladivostok",12]],[[1,51,"Volgograd",18],[1,54,"Volgograd",18]],[[0,47,"Volgograd",18],[0,51,"Volgograd",18]],[[0,57,"Vostok",10]],[[1,76,"Efate",21]],[[0,74,"Efate",21]],[[1,22,"Mendoza",9],[1,22,"Jujuy",2],[1,22,"Mendoza",2],[1,22,"Jujuy",9]],[[0,14,"Mendoza",9],[0,14,"Catamarca",2],[0,14,"ComodRivadavia",2],[0,14,"Cordoba",2],[0,14,"Jujuy",2],[0,14,"La_Rioja",2],[0,14,"Mendoza",2],[0,14,"Rio_Gallegos",2],[0,14,"San_Juan",2],[0,14,"Tucuman",2],[0,14,"Ushuaia",2],[0,14,"Catamarca",9],[0,14,"Cordoba",9],[0,14,"Jujuy",9],[0,14,"Rosario",9]],[[1,42,"Windhoek"],[1,42,"Ndjamena"]],[[0,28,"Dakar"],[0,28,"Bamako"],[0,28,"Banjul"],[0,28,"Bissau"],[0,28,"Conakry"],[0,28,"El_Aaiun"],[0,28,"Freetown"],[0,28,"Niamey"],[0,28,"Nouakchott"],[0,28,"Timbuktu"],[0,31,"Freetown"],[0,35,"Brazzaville"],[0,35,"Bangui"],[0,35,"Douala"],[0,35,"Lagos"],[0,35,"Libreville"],[0,35,"Luanda"],[0,35,"Malabo"],[0,35,"Ndjamena"],[0,35,"Niamey"],[0,35,"Porto-Novo"],[0,35,"Windhoek"]],[[1,42,"Lisbon",18],[1,42,"Madrid",18],[1,42,"Monaco",18],[1,42,"Paris",18],[1,42,"Portugal"],[1,42,"WET"]],[[1,35,"Paris",18],[1,35,"Algiers"],[1,35,"Casablanca"],[1,35,"Ceuta"],[1,35,"Canary",13],[1,35,"Faeroe",13],[1,35,"Faroe",13],[1,35,"Madeira",13],[1,35,"Brussels",18],[1,35,"Lisbon",18],[1,35,"Luxembourg",18],[1,35,"Madrid",18],[1,35,"Monaco",18],[1,35,"Portugal"],[1,35,"WET"],[1,42,"Luxembourg",18]],[[0,31,"Paris",18],[0,31,"Algiers"],[0,31,"Casablanca"],[0,31,"Ceuta"],[0,31,"El_Aaiun"],[0,31,"Azores",13],[0,31,"Canary",13],[0,31,"Faeroe",13],[0,31,"Faroe",13],[0,31,"Madeira",13],[0,31,"Brussels",18],[0,31,"Lisbon",18],[0,31,"Luxembourg",18],[0,31,"Madrid",18],[0,31,"Monaco",18],[0,31,"Portugal"],[0,31,"WET"],[0,35,"Luxembourg",18]],[[1,25,"Godthab",9],[1,25,"Danmarkshavn",9]],[[0,22,"Godthab",9],[0,22,"Danmarkshavn",9]],[[0,59,"Jakarta",12],[0,63,"Jakarta",12],[0,65,"Jakarta",12],[0,59,"Pontianak",12],[0,63,"Pontianak",12],[0,65,"Pontianak",12]],[[0,65,"Perth",14],[1,69,"Perth",14],[0,2,"Apia",21],[0,65,"Casey",10],[0,65,"West",14],[1,69,"West",14]],[[1,69,"Yakutsk",12],[1,72,"Yakutsk",12]],[[0,65,"Yakutsk",12],[0,69,"Yakutsk",12]],[[1,8,"Dawson",9],[1,8,"Whitehorse",9],[1,8,"Yukon",16]],[[1,7,"Dawson",9],[1,7,"Whitehorse",9],[1,7,"Yakutat",9],[1,7,"Yukon",16]],[[1,57,"Yekaterinburg",12]],[[0,54,"Yekaterinburg",12]],[[1,51,"Yerevan",12],[1,54,"Yerevan",12]],[[0,47,"Yerevan",12],[0,51,"Yerevan",12]],[[1,7,"Dawson",9],[1,7,"Whitehorse",9],[1,7,"Yakutat",9],[1,7,"Yukon",16]],[[0,6,"Anchorage",9],[0,6,"Dawson",9],[0,6,"Juneau",9],[0,6,"Nome",9],[0,6,"Whitehorse",9],[0,6,"Yakutat",9],[0,6,"Yukon",16],[0,6,"Alaska"]],[[1,7,"Dawson",9],[1,7,"Whitehorse",9],[1,7,"Yakutat",9],[1,7,"Yukon",16]],[[0,35]],[[0,42]],[[0,47]],[[0,51]],[[0,54]],[[0,57]],[[0,59]],[[0,65]],[[0,69]],[[0,72]],[[0,74]],[[0,76]],[[0,28]],[[0,25]],[[0,22]],[[0,14]],[[0,11]],[[0,9]],[[0,8]],[[0,31,"UTC"]],[[0,7]],[[0,6]],[[0,4]],[[0,2]],[[0,0]],[[0,31,"Davis",10],[0,31,"DumontDUrville",10]],[[0,31]]];}
if(!php_js_shared.tz_abbreviations){php_js_shared.tz_abbreviations=["acst","act","addt","adt","aft","ahdt","ahst","akdt","akst","aktst","aktt","almst","almt","amst","amt","anast","anat","ant","apt","aqtst","aqtt","arst","art","ashst","asht","ast","awt","azomt","azost","azot","azst","azt","bakst","bakt","bdst","bdt","beat","beaut","bmt","bnt","bortst","bort","bost","bot","brst","brt","bst","btt","burt","cant","capt","cast","cat","cawt","cddt","cdt","cemt","cest","cet","cgst","cgt","chadt","chast","chat","chdt","chost","chot","cit","cjt","ckhst","ckt","clst","clt","cost","cot","cpt","cst","cvst","cvt","cwst","cwt","chst","dact","davt","ddut","dusst","dust","easst","east","eat","ect","eddt","edt","eest","eet","egst","egt","ehdt","eit","ept","est","ewt","fjst","fjt","fkst","fkt","fnst","fnt","fort","frust","frut","galt","gamt","gbgt","gest","get","gft","ghst","gmt","gst","gyt","hadt","hast","hdt","hkst","hkt","hovst","hovt","hpt","hst","hwt","ict","iddt","idt","ihst","iot","irdt","irkst","irkt","irst","isst","ist","javt","jdt","jst","kart","kast","kdt","kgst","kgt","kizst","kizt","kmt","kost","krast","krat","kst","kuyst","kuyt","kwat","lhst","lint","lkt","lont","lrt","lst","madmt","madst","madt","magst","magt","malst","malt","mart","mawt","mddt","mdst","mdt","mest","met","mht","mmt","most","mot","mpt","msd","msk","mst","mut","mvt","mwt","myt","ncst","nct","nddt","ndt","negt","nest","net","nft","novst","novt","npt","nrt","nst","nut","nwt","nzdt","nzmt","nzst","omsst","omst","orast","orat","pddt","pdt","pest","petst","pett","pet","phot","phst","pht","pkst","pkt","pmdt","pmst","pmt","ppt","pst","pwt","pyst","pyt","qyzst","qyzt","ret","rmt","rott","sakst","sakt","samst","samt","sast","sbt","sct","sgt","shest","shet","slst","smt","srt","sst","stat","svest","svet","syot","taht","tasst","tast","tbist","tbit","tft","tjt","tlt","tmt","tost","tot","trst","trt","tsat","ulast","ulat","urast","urat","urut","uyhst","uyst","uyt","uzst","uzt","vet","vlasst","vlast","vlat","volst","volt","vost","vust","vut","warst","wart","wast","wat","wemt","west","wet","wgst","wgt","wit","wst","yakst","yakt","yddt","ydt","yekst","yekt","yerst","yert","ypt","yst","ywt","a","b","c","d","e","f","g","h","i","k","l","m","n","o","p","q","r","s","t","utc","u","v","w","x","y","zzz","z"];}
if(!php_js_shared.tz_offsets){php_js_shared.tz_offsets=[-43200,-41400,-39600,-37800,-36000,-34200,-32400,-28800,-25200,-21600,-19800,-18000,-16966,-16200,-14400,-14308,-13500,-13252,-13236,-12756,-12652,-12600,-10800,-9052,-9000,-7200,-5400,-3996,-3600,-2670,-1200,0,1172,1200,2079,3600,4772,4800,5736,5784,5940,6264,7200,9000,9048,9384,9885,10800,12344,12600,12648,14400,16200,16248,18000,19800,20700,21600,23400,25200,25580,26240,26400,27000,28656,28800,30000,30600,31500,32400,34200,35100,36000,37800,39600,41400,43200,45000,45900,46800,49500,50400];}
if(!php_js_shared.tz_prefixes){php_js_shared.tz_prefixes=['Africa','America','America/Argentina','America','America/Indiana','America','America/Kentucky','America','America/North_Dakota','America','Antarctica','Arctic','Asia','Atlantic','Australia','Brazil','Canada','Chile','Europe','Indian','Mexico','Pacific'];}
var dtz=this.date_default_timezone_get();for(i=0,len=php_js_shared.tz_abbrs.length;i<len;i++){indice=php_js_shared.tz_abbreviations[i];curr=php_js_shared.tz_abbrs[i];list[indice]=[];for(j=0,jlen=curr.length;j<jlen;j++){currSub=curr[j];currSubPrefix=(currSub[3]?php_js_shared.tz_prefixes[currSub[3]]+'/':'');timezone_id=currSub[2]?(currSubPrefix+currSub[2]):null;tzo=php_js_shared.tz_offsets[currSub[1]];dst=!!currSub[0];list[indice].push({'dst':dst,'offset':tzo,'timezone_id':timezone_id});if(dtz===timezone_id){this.php_js.currentTimezoneOffset=tzo;this.php_js.currentTimezoneDST=dst;}}}
return list;}};this.PHP_JS=PHP_JS;}());
PHP = new PHP_JS();

/*****************************
FILE: tinymce/jquery_tinymce    
*****************************/

(function(b){var e,d,a=[],c=window;b.fn.tinymce=function(j){var p=this,g,k,h,m,i,l="",n="";if(!p.length){return p}if(!j){return tinyMCE.get(p[0].id)}function o(){var r=[],q=0;if(f){f();f=null}p.each(function(t,u){var s,w=u.id,v=j.oninit;if(!w){u.id=w=tinymce.DOM.uniqueId()}s=new tinymce.Editor(w,j);r.push(s);if(v){s.onInit.add(function(){var x,y=v;if(++q==r.length){if(tinymce.is(y,"string")){x=(y.indexOf(".")===-1)?null:tinymce.resolve(y.replace(/\.\w+$/,""));y=tinymce.resolve(y)}y.apply(x||tinymce,r)}})}});b.each(r,function(t,s){s.render()})}if(!c.tinymce&&!d&&(g=j.script_url)){d=1;h=g.substring(0,g.lastIndexOf("/"));if(/_(src|dev)\.js/g.test(g)){n="_src"}m=g.lastIndexOf("?");if(m!=-1){l=g.substring(m+1)}c.tinyMCEPreInit=c.tinyMCEPreInit||{base:h,suffix:n,query:l};if(g.indexOf("gzip")!=-1){i=j.language||"en";g=g+(/\?/.test(g)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(j.theme)+"&plugins="+escape(j.plugins)+"&languages="+i;if(!c.tinyMCE_GZ){tinyMCE_GZ={start:function(){tinymce.suffix=n;function q(r){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(r))}q("langs/"+i+".js");q("themes/"+j.theme+"/editor_template"+n+".js");q("themes/"+j.theme+"/langs/"+i+".js");b.each(j.plugins.split(","),function(s,r){if(r){q("plugins/"+r+"/editor_plugin"+n+".js");q("plugins/"+r+"/langs/"+i+".js")}})},end:function(){}}}}b.ajax({type:"GET",url:g,dataType:"script",cache:true,success:function(){tinymce.dom.Event.domLoaded=1;d=2;if(j.script_loaded){j.script_loaded()}o();b.each(a,function(q,r){r()})}})}else{if(d===1){a.push(o)}else{o()}}return p};b.extend(b.expr[":"],{tinymce:function(g){return g.id&&!!tinyMCE.get(g.id)}});function f(){function i(l){if(l==="remove"){this.each(function(n,o){var m=h(o);if(m){m.remove()}})}this.find("span.mceEditor,div.mceEditor").each(function(n,o){var m=tinyMCE.get(o.id.replace(/_parent$/,""));if(m){m.remove()}})}function k(n){var m=this,l;if(n!==e){i.call(m);m.each(function(p,q){var o;if(o=tinyMCE.get(q.id)){o.setContent(n)}})}else{if(m.length>0){if(l=tinyMCE.get(m[0].id)){return l.getContent()}}}}function h(m){var l=null;(m)&&(m.id)&&(c.tinymce)&&(l=tinyMCE.get(m.id));return l}function g(l){return !!((l)&&(l.length)&&(c.tinymce)&&(l.is(":tinymce")))}var j={};b.each(["text","html","val"],function(n,l){var o=j[l]=b.fn[l],m=(l==="text");b.fn[l]=function(s){var p=this;if(!g(p)){return o.apply(p,arguments)}if(s!==e){k.call(p.filter(":tinymce"),s);o.apply(p.not(":tinymce"),arguments);return p}else{var r="";var q=arguments;(m?p:p.eq(0)).each(function(u,v){var t=h(v);r+=t?(m?t.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):t.getContent()):o.apply(b(v),q)});return r}}});b.each(["append","prepend"],function(n,m){var o=j[m]=b.fn[m],l=(m==="prepend");b.fn[m]=function(q){var p=this;if(!g(p)){return o.apply(p,arguments)}if(q!==e){p.filter(":tinymce").each(function(s,t){var r=h(t);r&&r.setContent(l?q+r.getContent():r.getContent()+q)});o.apply(p.not(":tinymce"),arguments);return p}}});b.each(["remove","replaceWith","replaceAll","empty"],function(m,l){var n=j[l]=b.fn[l];b.fn[l]=function(){i.call(this,l);return n.apply(this,arguments)}});j.attr=b.fn.attr;b.fn.attr=function(n,q,o){var m=this;if((!n)||(n!=="value")||(!g(m))){return j.attr.call(m,n,q,o)}if(q!==e){k.call(m.filter(":tinymce"),q);j.attr.call(m.not(":tinymce"),n,q,o);return m}else{var p=m[0],l=h(p);return l?l.getContent():j.attr.call(b(p),n,q,o)}}}})(jQuery);

/*****************************
FILE: fileuploader/fileuploader    
*****************************/

/**
 * http://github.com/valums/file-uploader
 * 
 * Multiple file upload component with progress-bar, drag-and-drop. 
 * © 2010 Andrew Valums ( andrew(at)valums.com ) 
 * 
 * Licensed under GNU GPL 2 or later, see license.txt.
 */    

//
// Helper functions
//

var qq = qq || {};

/**
 * Adds all missing properties from second obj to first obj
 */ 
qq.extend = function(first, second){
    for (var prop in second){
        first[prop] = second[prop];
    }
};  

/**
 * Searches for a given element in the array, returns -1 if it is not present.
 * @param {Number} [from] The index at which to begin the search
 */
qq.indexOf = function(arr, elt, from){
    if (arr.indexOf) return arr.indexOf(elt, from);
    
    from = from || 0;
    var len = arr.length;    
    
    if (from < 0) from += len;  

    for (; from < len; from++){  
        if (from in arr && arr[from] === elt){  
            return from;
        }
    }  
    return -1;  
}; 
    
qq.getUniqueId = (function(){
    var id = 0;
    return function(){ return id++; };
})();

//
// Events

qq.attach = function(element, type, fn){
    if (element.addEventListener){
        element.addEventListener(type, fn, false);
    } else if (element.attachEvent){
        element.attachEvent('on' + type, fn);
    }
};
qq.detach = function(element, type, fn){
    if (element.removeEventListener){
        element.removeEventListener(type, fn, false);
    } else if (element.attachEvent){
        element.detachEvent('on' + type, fn);
    }
};

qq.preventDefault = function(e){
    if (e.preventDefault){
        e.preventDefault();
    } else{
        e.returnValue = false;
    }
};

//
// Node manipulations

/**
 * Insert node a before node b.
 */
qq.insertBefore = function(a, b){
    b.parentNode.insertBefore(a, b);
};
qq.remove = function(element){
    element.parentNode.removeChild(element);
};

qq.contains = function(parent, descendant){       
    // compareposition returns false in this case
    if (parent == descendant) return true;
    
    if (parent.contains){
        return parent.contains(descendant);
    } else {
        return !!(descendant.compareDocumentPosition(parent) & 8);
    }
};

/**
 * Creates and returns element from html string
 * Uses innerHTML to create an element
 */
qq.toElement = (function(){
    var div = document.createElement('div');
    return function(html){
        div.innerHTML = html;
        var element = div.firstChild;
        div.removeChild(element);
        return element;
    };
})();

//
// Node properties and attributes

/**
 * Sets styles for an element.
 * Fixes opacity in IE6-8.
 */
qq.css = function(element, styles){
    if (styles.opacity != null){
        if (typeof element.style.opacity != 'string' && typeof(element.filters) != 'undefined'){
            styles.filter = 'alpha(opacity=' + Math.round(100 * styles.opacity) + ')';
        }
    }
    qq.extend(element.style, styles);
};
qq.hasClass = function(element, name){
    var re = new RegExp('(^| )' + name + '( |$)');
    return re.test(element.className);
};
qq.addClass = function(element, name){
    if (!qq.hasClass(element, name)){
        element.className += ' ' + name;
    }
};
qq.removeClass = function(element, name){
    var re = new RegExp('(^| )' + name + '( |$)');
    element.className = element.className.replace(re, ' ').replace(/^\s+|\s+$/g, "");
};
qq.setText = function(element, text){
    element.innerText = text;
    element.textContent = text;
};

//
// Selecting elements

qq.children = function(element){
    var children = [],
    child = element.firstChild;

    while (child){
        if (child.nodeType == 1){
            children.push(child);
        }
        child = child.nextSibling;
    }

    return children;
};

qq.getByClass = function(element, className){
    if (element.querySelectorAll){
        return element.querySelectorAll('.' + className);
    }

    var result = [];
    var candidates = element.getElementsByTagName("*");
    var len = candidates.length;

    for (var i = 0; i < len; i++){
        if (qq.hasClass(candidates[i], className)){
            result.push(candidates[i]);
        }
    }
    return result;
};

/**
 * obj2url() takes a json-object as argument and generates
 * a querystring. pretty much like jQuery.param()
 * 
 * how to use:
 *
 *    `qq.obj2url({a:'b',c:'d'},'http://any.url/upload?otherParam=value');`
 *
 * will result in:
 *
 *    `http://any.url/upload?otherParam=value&a=b&c=d`
 *
 * @param  Object JSON-Object
 * @param  String current querystring-part
 * @return String encoded querystring
 */
qq.obj2url = function(obj, temp, prefixDone){
    var uristrings = [],
        prefix = '&',
        add = function(nextObj, i){
            var nextTemp = temp 
                ? (/\[\]$/.test(temp)) // prevent double-encoding
                   ? temp
                   : temp+'['+i+']'
                : i;
            if ((nextTemp != 'undefined') && (i != 'undefined')) {  
                uristrings.push(
                    (typeof nextObj === 'object') 
                        ? qq.obj2url(nextObj, nextTemp, true)
                        : (Object.prototype.toString.call(nextObj) === '[object Function]')
                            ? encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj())
                            : encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj)                                                          
                );
            }
        }; 

    if (!prefixDone && temp) {
      prefix = (/\?/.test(temp)) ? (/\?$/.test(temp)) ? '' : '&' : '?';
      uristrings.push(temp);
      uristrings.push(qq.obj2url(obj));
    } else if ((Object.prototype.toString.call(obj) === '[object Array]') && (typeof obj != 'undefined') ) {
        // we wont use a for-in-loop on an array (performance)
        for (var i = 0, len = obj.length; i < len; ++i){
            add(obj[i], i);
        }
    } else if ((typeof obj != 'undefined') && (obj !== null) && (typeof obj === "object")){
        // for anything else but a scalar, we will use for-in-loop
        for (var i in obj){
            add(obj[i], i);
        }
    } else {
        uristrings.push(encodeURIComponent(temp) + '=' + encodeURIComponent(obj));
    }

    return uristrings.join(prefix)
                     .replace(/^&/, '')
                     .replace(/%20/g, '+'); 
};

//
//
// Uploader Classes
//
//

var qq = qq || {};
    
/**
 * Creates upload button, validates upload, but doesn't create file list or dd. 
 */
qq.FileUploaderBasic = function(o){
    this._options = {
        action: '/server/upload',
        params: {},
        button: null,
        multiple: true,
        maxConnections: 3,
        // validation        
        allowedExtensions: [],               
        sizeLimit: 0,   
        minSizeLimit: 0,                             
        // events
        // return false to cancel submit
        onSubmit: function(id, fileName){},
        onProgress: function(id, fileName, loaded, total){},
        onComplete: function(id, fileName, responseJSON){},
        onCancel: function(id, fileName){},
        // messages                
        messages: {
            typeError: "{file} has invalid extension. Only {extensions} are allowed.",
            sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
            minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.",
            emptyError: "{file} is empty, please select files again without it.",
            onLeave: "The files are being uploaded, if you leave now the upload will be cancelled."            
        },
        showMessage: function(message){
            //alert(message);
        }               
    };
    qq.extend(this._options, o);
        
    // number of files being uploaded
    this._filesInProgress = 0;
    this._handler = this._createUploadHandler(); 
    
    if (this._options.button){ 
        this._button = this._createUploadButton(this._options.button);
    }
                        
    this._preventLeaveInProgress();         
};
   
qq.FileUploaderBasic.prototype = {
    setParams: function(params){
        this._options.params = params;
    },
    getInProgress: function(){
        return this._filesInProgress;         
    },
    _createUploadButton: function(element){
        var self = this;
        
        return new qq.UploadButton({
            element: element,
            multiple: this._options.multiple && qq.UploadHandlerXhr.isSupported(),
            onChange: function(input){
                self._onInputChange(input);
            }        
        });           
    },    
    _createUploadHandler: function(){
        var self = this,
            handlerClass;        
        
        if(qq.UploadHandlerXhr.isSupported()){           
            handlerClass = 'UploadHandlerXhr';                        
        } else {
            handlerClass = 'UploadHandlerForm';
        }

        var handler = new qq[handlerClass]({
            action: this._options.action,         
            maxConnections: this._options.maxConnections,   
            onProgress: function(id, fileName, loaded, total){                
                self._onProgress(id, fileName, loaded, total);
                self._options.onProgress(id, fileName, loaded, total);                    
            },            
            onComplete: function(id, fileName, result){
                self._onComplete(id, fileName, result);
                self._options.onComplete(id, fileName, result);
            },
            onCancel: function(id, fileName){
                self._onCancel(id, fileName);
                self._options.onCancel(id, fileName);
            }
        });

        return handler;
    },    
    _preventLeaveInProgress: function(){
        var self = this;
        
        qq.attach(window, 'beforeunload', function(e){
            if (!self._filesInProgress){return;}
            
            var e = e || window.event;
            // for ie, ff
            e.returnValue = self._options.messages.onLeave;
            // for webkit
            return self._options.messages.onLeave;             
        });        
    },    
    _onSubmit: function(id, fileName){
        this._filesInProgress++;  
    },
    _onProgress: function(id, fileName, loaded, total){        
    },
    _onComplete: function(id, fileName, result){
        this._filesInProgress--;                 
        if (result.error){
            this._options.showMessage(result.error);
        }             
    },
    _onCancel: function(id, fileName){
        this._filesInProgress--;        
    },
    _onInputChange: function(input){
        if (this._handler instanceof qq.UploadHandlerXhr){                
            this._uploadFileList(input.files);                   
        } else {             
            if (this._validateFile(input)){                
                this._uploadFile(input);                                    
            }                      
        }               
        this._button.reset();   
    },  
    _uploadFileList: function(files){
        for (var i=0; i<files.length; i++){
            if ( !this._validateFile(files[i])){
                return;
            }            
        }
        
        for (var i=0; i<files.length; i++){
            this._uploadFile(files[i]);        
        }        
    },       
    _uploadFile: function(fileContainer){      
        var id = this._handler.add(fileContainer);
        var fileName = this._handler.getName(id);
        
        if (this._options.onSubmit(id, fileName) !== false){
            this._onSubmit(id, fileName);
            this._handler.upload(id, this._options.params);
        }
    },      
    _validateFile: function(file){
        var name, size;
        
        if (file.value){
            // it is a file input            
            // get input value and remove path to normalize
            name = file.value.replace(/.*(\/|\\)/, "");
        } else {
            // fix missing properties in Safari
            name = file.fileName != null ? file.fileName : file.name;
            size = file.fileSize != null ? file.fileSize : file.size;
        }
                    
        if (! this._isAllowedExtension(name)){            
            this._error('typeError', name);
            return false;
            
        } else if (size === 0){            
            this._error('emptyError', name);
            return false;
                                                     
        } else if (size && this._options.sizeLimit && size > this._options.sizeLimit){            
            this._error('sizeError', name);
            return false;
                        
        } else if (size && size < this._options.minSizeLimit){
            this._error('minSizeError', name);
            return false;            
        }
        
        return true;                
    },
    _error: function(code, fileName){
        var message = this._options.messages[code];        
        function r(name, replacement){ message = message.replace(name, replacement); }
        
        r('{file}', this._formatFileName(fileName));        
        r('{extensions}', this._options.allowedExtensions.join(', '));
        r('{sizeLimit}', this._formatSize(this._options.sizeLimit));
        r('{minSizeLimit}', this._formatSize(this._options.minSizeLimit));
        
        this._options.showMessage(message);                
    },
    _formatFileName: function(name){
        if (name.length > 33){
            name = name.slice(0, 19) + '...' + name.slice(-13);    
        }
        return name;
    },
    _isAllowedExtension: function(fileName){
        var ext = (-1 !== fileName.indexOf('.')) ? fileName.replace(/.*[.]/, '').toLowerCase() : '';
        var allowed = this._options.allowedExtensions;
        
        if (!allowed.length){return true;}        
        
        for (var i=0; i<allowed.length; i++){
            if (allowed[i].toLowerCase() == ext){ return true;}    
        }
        
        return false;
    },    
    _formatSize: function(bytes){
        var i = -1;                                    
        do {
            bytes = bytes / 1024;
            i++;  
        } while (bytes > 99);
        
        return Math.max(bytes, 0.1).toFixed(1) + ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'][i];          
    }
};
    
       
/**
 * Class that creates upload widget with drag-and-drop and file list
 * @inherits qq.FileUploaderBasic
 */
qq.FileUploader = function(o){
    // call parent constructor
    qq.FileUploaderBasic.apply(this, arguments);
    
    // additional options    
    qq.extend(this._options, {
        element: null,
        // if set, will be used instead of qq-upload-list in template
        listElement: null,
                
        template: '<div class="qq-uploader">' + 
                '<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
                '<div class="qq-upload-button">Upload a file</div>' +
                '<ul class="qq-upload-list"></ul>' + 
             '</div>',

        // template for one item in file list
        fileTemplate: '<li>' +
                '<span class="qq-upload-file"></span>' +
                '<span class="qq-upload-spinner"></span>' +
                '<span class="qq-upload-size"></span>' +
                '<a class="qq-upload-cancel" href="#">Cancel</a>' +
                '<span class="qq-upload-failed-text">Failed</span>' +
            '</li>',        
        
        classes: {
            // used to get elements from templates
            button: 'qq-upload-button',
            drop: 'qq-upload-drop-area',
            dropActive: 'qq-upload-drop-area-active',
            list: 'qq-upload-list',
                        
            file: 'qq-upload-file',
            spinner: 'qq-upload-spinner',
            size: 'qq-upload-size',
            cancel: 'qq-upload-cancel',

            // added to list item when upload completes
            // used in css to hide progress spinner
            success: 'qq-upload-success',
            fail: 'qq-upload-fail'
        }
    });
    // overwrite options with user supplied    
    qq.extend(this._options, o);       

    this._element = this._options.element;
    this._element.innerHTML = this._options.template;        
    this._listElement = this._options._listElement || this._find(this._element, 'list');
    
    this._classes = this._options.classes;
        
    this._button = this._createUploadButton(this._find(this._element, 'button'));        
    
    this._bindCancelEvent();
    this._setupDragDrop();
};

// inherit from Basic Uploader
qq.extend(qq.FileUploader.prototype, qq.FileUploaderBasic.prototype);

qq.extend(qq.FileUploader.prototype, {
    /**
     * Gets one of the elements listed in this._options.classes
     **/
    _find: function(parent, type){                                
        var element = qq.getByClass(parent, this._options.classes[type])[0];        
        if (!element){
            throw new Error('element not found ' + type);
        }
        
        return element;
    },
    _setupDragDrop: function(){
        var self = this,
            dropArea = this._find(this._element, 'drop');                        

        var dz = new qq.UploadDropZone({
            element: dropArea,
            onEnter: function(e){
                qq.addClass(dropArea, self._classes.dropActive);
                e.stopPropagation();
            },
            onLeave: function(e){
                e.stopPropagation();
            },
            onLeaveNotDescendants: function(e){
                qq.removeClass(dropArea, self._classes.dropActive);  
            },
            onDrop: function(e){
                dropArea.style.display = 'none';
                qq.removeClass(dropArea, self._classes.dropActive);
                self._uploadFileList(e.dataTransfer.files);    
            }
        });
                
        dropArea.style.display = 'none';

        qq.attach(document, 'dragenter', function(e){     
            if (!dz._isValidFileDrag(e)) return; 
            
            dropArea.style.display = 'block';            
        });                 
        qq.attach(document, 'dragleave', function(e){
            if (!dz._isValidFileDrag(e)) return;            
            
            var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
            // only fire when leaving document out
            if ( ! relatedTarget || relatedTarget.nodeName == "HTML"){               
                dropArea.style.display = 'none';                                            
            }
        });                
    },
    _onSubmit: function(id, fileName){
        qq.FileUploaderBasic.prototype._onSubmit.apply(this, arguments);
        this._addToList(id, fileName);  
    },
    _onProgress: function(id, fileName, loaded, total){
        qq.FileUploaderBasic.prototype._onProgress.apply(this, arguments);

        var item = this._getItemByFileId(id);
        var size = this._find(item, 'size');
        size.style.display = 'inline';
        
        var text; 
        if (loaded != total){
            text = Math.round(loaded / total * 100) + '% from ' + this._formatSize(total);
        } else {                                   
            text = this._formatSize(total);
        }          
        
        qq.setText(size, text);         
    },
    _onComplete: function(id, fileName, result){
        qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);

        // mark completed
        var item = this._getItemByFileId(id);                
        qq.remove(this._find(item, 'cancel'));
        qq.remove(this._find(item, 'spinner'));
        
        if (result.success){
            qq.addClass(item, this._classes.success);    
        } else {
            qq.addClass(item, this._classes.fail);
        }         
    },
    _addToList: function(id, fileName){
        var item = qq.toElement(this._options.fileTemplate);                
        item.qqFileId = id;

        var fileElement = this._find(item, 'file');        
        qq.setText(fileElement, this._formatFileName(fileName));
        this._find(item, 'size').style.display = 'none';        

        this._listElement.appendChild(item);
    },
    _getItemByFileId: function(id){
        var item = this._listElement.firstChild;        
        
        // there can't be txt nodes in dynamically created list
        // and we can  use nextSibling
        while (item){            
            if (item.qqFileId == id) return item;            
            item = item.nextSibling;
        }          
    },
    /**
     * delegate click event for cancel link 
     **/
    _bindCancelEvent: function(){
        var self = this,
            list = this._listElement;            
        
        qq.attach(list, 'click', function(e){            
            e = e || window.event;
            var target = e.target || e.srcElement;
            
            if (qq.hasClass(target, self._classes.cancel)){                
                qq.preventDefault(e);
               
                var item = target.parentNode;
                self._handler.cancel(item.qqFileId);
                qq.remove(item);
            }
        });
    }    
});
    
qq.UploadDropZone = function(o){
    this._options = {
        element: null,  
        onEnter: function(e){},
        onLeave: function(e){},  
        // is not fired when leaving element by hovering descendants   
        onLeaveNotDescendants: function(e){},   
        onDrop: function(e){}                       
    };
    qq.extend(this._options, o); 
    
    this._element = this._options.element;
    
    this._disableDropOutside();
    this._attachEvents();   
};

qq.UploadDropZone.prototype = {
    _disableDropOutside: function(e){
        // run only once for all instances
        if (!qq.UploadDropZone.dropOutsideDisabled ){

            qq.attach(document, 'dragover', function(e){
                if (e.dataTransfer){
                    e.dataTransfer.dropEffect = 'none';
                    e.preventDefault(); 
                }           
            });
            
            qq.UploadDropZone.dropOutsideDisabled = true; 
        }        
    },
    _attachEvents: function(){
        var self = this;              
                  
        qq.attach(self._element, 'dragover', function(e){
            if (!self._isValidFileDrag(e)) return;
            
            var effect = e.dataTransfer.effectAllowed;
            if (effect == 'move' || effect == 'linkMove'){
                e.dataTransfer.dropEffect = 'move'; // for FF (only move allowed)    
            } else {                    
                e.dataTransfer.dropEffect = 'copy'; // for Chrome
            }
                                                     
            e.stopPropagation();
            e.preventDefault();                                                                    
        });
        
        qq.attach(self._element, 'dragenter', function(e){
            if (!self._isValidFileDrag(e)) return;
                        
            self._options.onEnter(e);
        });
        
        qq.attach(self._element, 'dragleave', function(e){
            if (!self._isValidFileDrag(e)) return;
            
            self._options.onLeave(e);
            
            var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);                      
            // do not fire when moving a mouse over a descendant
            if (qq.contains(this, relatedTarget)) return;
                        
            self._options.onLeaveNotDescendants(e); 
        });
                
        qq.attach(self._element, 'drop', function(e){
            if (!self._isValidFileDrag(e)) return;
            
            e.preventDefault();
            self._options.onDrop(e);
        });          
    },
    _isValidFileDrag: function(e){
        var dt = e.dataTransfer,
            // do not check dt.types.contains in webkit, because it crashes safari 4            
            isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1;                        

        // dt.effectAllowed is none in Safari 5
        // dt.types.contains check is for firefox            
        return dt && dt.effectAllowed != 'none' && 
            (dt.files || (!isWebkit && dt.types.contains && dt.types.contains('Files')));
        
    }        
}; 

qq.UploadButton = function(o){
    this._options = {
        element: null,  
        // if set to true adds multiple attribute to file input      
        multiple: false,
        // name attribute of file input
        name: 'file',
        onChange: function(input){},
        hoverClass: 'qq-upload-button-hover',
        focusClass: 'qq-upload-button-focus'                       
    };
    
    qq.extend(this._options, o);
        
    this._element = this._options.element;
    
    // make button suitable container for input
    qq.css(this._element, {
        position: 'relative',
        overflow: 'hidden',
        // Make sure browse button is in the right side
        // in Internet Explorer
        direction: 'ltr'
    });   
    
    this._input = this._createInput();
};

qq.UploadButton.prototype = {
    /* returns file input element */    
    getInput: function(){
        return this._input;
    },
    /* cleans/recreates the file input */
    reset: function(){
        if (this._input.parentNode){
            qq.remove(this._input);    
        }                
        
        qq.removeClass(this._element, this._options.focusClass);
        this._input = this._createInput();
    },    
    _createInput: function(){                
        var input = document.createElement("input");
        
        if (this._options.multiple){
            input.setAttribute("multiple", "multiple");
        }
                
        input.setAttribute("type", "file");
        input.setAttribute("name", this._options.name);
        
        qq.css(input, {
            position: 'absolute',
            // in Opera only 'browse' button
            // is clickable and it is located at
            // the right side of the input
            right: 0,
            top: 0,
            fontFamily: 'Arial',
            // 4 persons reported this, the max values that worked for them were 243, 236, 236, 118
            fontSize: '118px',
            margin: 0,
            padding: 0,
            cursor: 'pointer',
            opacity: 0
        });
        
        this._element.appendChild(input);

        var self = this;
        qq.attach(input, 'change', function(){
            self._options.onChange(input);
        });
                
        qq.attach(input, 'mouseover', function(){
            qq.addClass(self._element, self._options.hoverClass);
        });
        qq.attach(input, 'mouseout', function(){
            qq.removeClass(self._element, self._options.hoverClass);
        });
        qq.attach(input, 'focus', function(){
            qq.addClass(self._element, self._options.focusClass);
        });
        qq.attach(input, 'blur', function(){
            qq.removeClass(self._element, self._options.focusClass);
        });

        // IE and Opera, unfortunately have 2 tab stops on file input
        // which is unacceptable in our case, disable keyboard access
        if (window.attachEvent){
            // it is IE or Opera
            input.setAttribute('tabIndex', "-1");
        }

        return input;            
    }        
};

/**
 * Class for uploading files, uploading itself is handled by child classes
 */
qq.UploadHandlerAbstract = function(o){
    this._options = {
        action: '/upload.php',
        // maximum number of concurrent uploads        
        maxConnections: 999,
        onProgress: function(id, fileName, loaded, total){},
        onComplete: function(id, fileName, response){},
        onCancel: function(id, fileName){}
    };
    qq.extend(this._options, o);    
    
    this._queue = [];
    // params for files in queue
    this._params = [];
};
qq.UploadHandlerAbstract.prototype = {
    /**
     * Adds file or file input to the queue
     * @returns id
     **/    
    add: function(file){},
    /**
     * Sends the file identified by id and additional query params to the server
     */
    upload: function(id, params){
        var len = this._queue.push(id);

        var copy = {};        
        qq.extend(copy, params);
        this._params[id] = copy;        
                
        // if too many active uploads, wait...
        if (len <= this._options.maxConnections){               
            this._upload(id, this._params[id]);
        }
    },
    /**
     * Cancels file upload by id
     */
    cancel: function(id){
        this._cancel(id);
        this._dequeue(id);
    },
    /**
     * Cancells all uploads
     */
    cancelAll: function(){
        for (var i=0; i<this._queue.length; i++){
            this._cancel(this._queue[i]);
        }
        this._queue = [];
    },
    /**
     * Returns name of the file identified by id
     */
    getName: function(id){},
    /**
     * Returns size of the file identified by id
     */          
    getSize: function(id){},
    /**
     * Returns id of files being uploaded or
     * waiting for their turn
     */
    getQueue: function(){
        return this._queue;
    },
    /**
     * Actual upload method
     */
    _upload: function(id){},
    /**
     * Actual cancel method
     */
    _cancel: function(id){},     
    /**
     * Removes element from queue, starts upload of next
     */
    _dequeue: function(id){
        var i = qq.indexOf(this._queue, id);
        this._queue.splice(i, 1);
                
        var max = this._options.maxConnections;
        
        if (this._queue.length >= max){
            var nextId = this._queue[max-1];
            this._upload(nextId, this._params[nextId]);
        }
    }        
};

/**
 * Class for uploading files using form and iframe
 * @inherits qq.UploadHandlerAbstract
 */
qq.UploadHandlerForm = function(o){
    qq.UploadHandlerAbstract.apply(this, arguments);
       
    this._inputs = {};
};
// @inherits qq.UploadHandlerAbstract
qq.extend(qq.UploadHandlerForm.prototype, qq.UploadHandlerAbstract.prototype);

qq.extend(qq.UploadHandlerForm.prototype, {
    add: function(fileInput){
        fileInput.setAttribute('name', 'qqfile');
        var id = 'qq-upload-handler-iframe' + qq.getUniqueId();       
        
        this._inputs[id] = fileInput;
        
        // remove file input from DOM
        if (fileInput.parentNode){
            qq.remove(fileInput);
        }
                
        return id;
    },
    getName: function(id){
        // get input value and remove path to normalize
        return this._inputs[id].value.replace(/.*(\/|\\)/, "");
    },    
    _cancel: function(id){
        this._options.onCancel(id, this.getName(id));
        
        delete this._inputs[id];        

        var iframe = document.getElementById(id);
        if (iframe){
            // to cancel request set src to something else
            // we use src="javascript:false;" because it doesn't
            // trigger ie6 prompt on https
            iframe.setAttribute('src', 'javascript:false;');

            qq.remove(iframe);
        }
    },     
    _upload: function(id, params){                        
        var input = this._inputs[id];
        
        if (!input){
            throw new Error('file with passed id was not added, or already uploaded or cancelled');
        }                

        var fileName = this.getName(id);
                
        var iframe = this._createIframe(id);
        var form = this._createForm(iframe, params);
        form.appendChild(input);

        var self = this;
        this._attachLoadEvent(iframe, function(){                        
            self._options.onComplete(id, fileName, self._getIframeContentJSON(iframe));
            self._dequeue(id);
            
            delete self._inputs[id];
            // timeout added to fix busy state in FF3.6
            setTimeout(function(){
                qq.remove(iframe);
            }, 1);
        });

        form.submit();        
        qq.remove(form);        
        
        return id;
    }, 
    _attachLoadEvent: function(iframe, callback){
        qq.attach(iframe, 'load', function(){
            // when we remove iframe from dom
            // the request stops, but in IE load
            // event fires
            if (!iframe.parentNode){
                return;
            }

            // fixing Opera 10.53
            if (iframe.contentDocument &&
                iframe.contentDocument.body &&
                iframe.contentDocument.body.innerHTML == "false"){
                // In Opera event is fired second time
                // when body.innerHTML changed from false
                // to server response approx. after 1 sec
                // when we upload file with iframe
                return;
            }

            callback();
        });
    },
    /**
     * Returns json object received by iframe from server.
     */
    _getIframeContentJSON: function(iframe){
        // iframe.contentWindow.document - for IE<7
        var doc = iframe.contentDocument ? iframe.contentDocument: iframe.contentWindow.document,
            response;

        try {
            response = eval("(" + doc.body.innerHTML + ")");
        } catch(err){
            response = {};
        }

        return response;
    },
    /**
     * Creates iframe with unique name
     */
    _createIframe: function(id){
        // We can't use following code as the name attribute
        // won't be properly registered in IE6, and new window
        // on form submit will open
        // var iframe = document.createElement('iframe');
        // iframe.setAttribute('name', id);

        var iframe = qq.toElement('<iframe src="javascript:false;" name="' + id + '" />');
        // src="javascript:false;" removes ie6 prompt on https

        iframe.setAttribute('id', id);

        iframe.style.display = 'none';
        document.body.appendChild(iframe);

        return iframe;
    },
    /**
     * Creates form, that will be submitted to iframe
     */
    _createForm: function(iframe, params){
        // We can't use the following code in IE6
        // var form = document.createElement('form');
        // form.setAttribute('method', 'post');
        // form.setAttribute('enctype', 'multipart/form-data');
        // Because in this case file won't be attached to request
        var form = qq.toElement('<form method="post" enctype="multipart/form-data"></form>');

        var queryString = qq.obj2url(params, this._options.action);

        form.setAttribute('action', queryString);
        form.setAttribute('target', iframe.name);
        form.style.display = 'none';
        document.body.appendChild(form);

        return form;
    }
});

/**
 * Class for uploading files using xhr
 * @inherits qq.UploadHandlerAbstract
 */
qq.UploadHandlerXhr = function(o){
    qq.UploadHandlerAbstract.apply(this, arguments);

    this._files = [];
    this._xhrs = [];
    
    // current loaded size in bytes for each file 
    this._loaded = [];
};

// static method
qq.UploadHandlerXhr.isSupported = function(){
    var input = document.createElement('input');
    input.type = 'file';        
    
    return (
        'multiple' in input &&
        typeof File != "undefined" &&
        typeof (new XMLHttpRequest()).upload != "undefined" );       
};

// @inherits qq.UploadHandlerAbstract
qq.extend(qq.UploadHandlerXhr.prototype, qq.UploadHandlerAbstract.prototype)

qq.extend(qq.UploadHandlerXhr.prototype, {
    /**
     * Adds file to the queue
     * Returns id to use with upload, cancel
     **/    
    add: function(file){
        if (!(file instanceof File)){
            throw new Error('Passed obj in not a File (in qq.UploadHandlerXhr)');
        }
                
        return this._files.push(file) - 1;        
    },
    getName: function(id){        
        var file = this._files[id];
        // fix missing name in Safari 4
        return file.fileName != null ? file.fileName : file.name;       
    },
    getSize: function(id){
        var file = this._files[id];
        return file.fileSize != null ? file.fileSize : file.size;
    },    
    /**
     * Returns uploaded bytes for file identified by id 
     */    
    getLoaded: function(id){
        return this._loaded[id] || 0; 
    },
    /**
     * Sends the file identified by id and additional query params to the server
     * @param {Object} params name-value string pairs
     */    
    _upload: function(id, params){
        var file = this._files[id],
            name = this.getName(id),
            size = this.getSize(id);
                
        this._loaded[id] = 0;
                                
        var xhr = this._xhrs[id] = new XMLHttpRequest();
        var self = this;
                                        
        xhr.upload.onprogress = function(e){
            if (e.lengthComputable){
                self._loaded[id] = e.loaded;
                self._options.onProgress(id, name, e.loaded, e.total);
            }
        };

        xhr.onreadystatechange = function(){            
            if (xhr.readyState == 4){
                self._onComplete(id, xhr);                    
            }
        };

        // build query string
        params = params || {};
        params['qqfile'] = name;
        var queryString = qq.obj2url(params, this._options.action);

        xhr.open("POST", queryString, true);
        xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
        xhr.setRequestHeader("Content-Type", "application/octet-stream");
        xhr.send(file);
    },
    _onComplete: function(id, xhr){
        // the request was aborted/cancelled
        if (!this._files[id]) return;
        
        var name = this.getName(id);
        var size = this.getSize(id);
        
        this._options.onProgress(id, name, size, size);
                
        if (xhr.status == 200){
            var response;
                    
            try {
                response = eval("(" + xhr.responseText + ")");
            } catch(err){
                response = {};
            }
            
            this._options.onComplete(id, name, response);
                        
        } else {                   
            this._options.onComplete(id, name, {});
        }
                
        this._files[id] = null;
        this._xhrs[id] = null;    
        this._dequeue(id);                    
    },
    _cancel: function(id){
        this._options.onCancel(id, this.getName(id));
        
        this._files[id] = null;
        
        if (this._xhrs[id]){
            this._xhrs[id].abort();
            this._xhrs[id] = null;                                   
        }
    }
});

/*****************************
FILE: mindmap/Mindmap    
*****************************/


function mindmap_Mindmap ( element )
{
	ria_Component.call( this , element );
	
	var flashEle = this.$('#flashcontent');
	flashEle.flash(
        { 
        	src: '/file/mindmap/visorFreemind.swf',
          	width: flashEle.width(),
          	height: flashEle.height(),
          	flashvars: {         
	        	 openUrl: "_blank"
				,startCollapsedToLevel:"3"
				,maxNodeWidth:"100"
				,mainNodeShape:"elipse"
				,justMap:"false"
				,initLoadFile:this.jsdata.xml_uri//"/postsegment/mindmap/"+ "blog" +"/mmxml"
				,defaultToolTipWordWrap:300
				,offsetX:"left"
				,offsetY:"top"
				,buttonsPos:"top"
				,min_alpha_buttons:80
				,max_alpha_buttons:100
				,scaleTooltips:false
        	}        
        },
        { version: 8 }
    );
}

mindmap_Mindmap.prototype = new ria_Component();
mindmap_Mindmap.prototype.constructor = mindmap_Mindmap;


/*****************************
FILE: markitup/jquery_markitup    
*****************************/

// ----------------------------------------------------------------------------
// markItUp! Universal MarkUp Engine, JQuery plugin
// v 1.1.x
// Dual licensed under the MIT and GPL licenses.
// ----------------------------------------------------------------------------
// Copyright (C) 2007-2010 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ----------------------------------------------------------------------------
(function($) {
	$.fn.markItUp = function(settings, extraSettings) {
		var options, ctrlKey, shiftKey, altKey;
		ctrlKey = shiftKey = altKey = false;
	
		options = {	id:						'',
					nameSpace:				'',
					root:					'',
					previewInWindow:		'', // 'width=800, height=600, resizable=yes, scrollbars=yes'
					previewAutoRefresh:		true,
					previewPosition:		'after',
					previewTemplatePath:	'~/templates/preview.html',
					previewParserPath:		'',
					previewParserVar:		'data',
					resizeHandle:			true,
					beforeInsert:			'',
					afterInsert:			'',
					onEnter:				{},
					onShiftEnter:			{},
					onCtrlEnter:			{},
					onTab:					{},
					markupSet:			[	{ /* set */ } ]
				};
		$.extend(options, settings, extraSettings);

		// compute markItUp! path
		if (!options.root) {
			$('script').each(function(a, tag) {
				miuScript = $(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);
				if (miuScript !== null) {
					options.root = miuScript[1];
				}
			});
		}

		return this.each(function() {
			var $$, textarea, levels, scrollPosition, caretPosition, caretOffset,
				clicked, hash, header, footer, previewWindow, template, iFrame, abort;
			$$ = $(this);
			textarea = this;
			levels = [];
			abort = false;
			scrollPosition = caretPosition = 0;
			caretOffset = -1;

			options.previewParserPath = localize(options.previewParserPath);
			options.previewTemplatePath = localize(options.previewTemplatePath);

			// apply the computed path to ~/
			function localize(data, inText) {
				if (inText) {
					return 	data.replace(/("|')~\//g, "$1"+options.root);
				}
				return 	data.replace(/^~\//, options.root);
			}

			// init and build editor
			function init() {
				id = ''; nameSpace = '';
				if (options.id) {
					id = 'id="'+options.id+'"';
				} else if ($$.attr("id")) {
					id = 'id="markItUp'+($$.attr("id").substr(0, 1).toUpperCase())+($$.attr("id").substr(1))+'"';

				}
				if (options.nameSpace) {
					nameSpace = 'class="'+options.nameSpace+'"';
				}
				$$.wrap('<div '+nameSpace+'></div>');
				$$.wrap('<div '+id+' class="markItUp"></div>');
				$$.wrap('<div class="markItUpContainer"></div>');
				$$.addClass("markItUpEditor");

				// add the header before the textarea
				header = $('<div class="markItUpHeader"></div>').insertBefore($$);
				$(dropMenus(options.markupSet)).appendTo(header);

				// add the footer after the textarea
				footer = $('<div class="markItUpFooter"></div>').insertAfter($$);

				// add the resize handle after textarea
				if (options.resizeHandle === true && $.browser.safari !== true) {
					resizeHandle = $('<div class="markItUpResizeHandle"></div>')
						.insertAfter($$)
						.bind("mousedown", function(e) {
							var h = $$.height(), y = e.clientY, mouseMove, mouseUp;
							mouseMove = function(e) {
								$$.css("height", Math.max(20, e.clientY+h-y)+"px");
								return false;
							};
							mouseUp = function(e) {
								$("html").unbind("mousemove", mouseMove).unbind("mouseup", mouseUp);
								return false;
							};
							$("html").bind("mousemove", mouseMove).bind("mouseup", mouseUp);
					});
					footer.append(resizeHandle);
				}

				// listen key events
				$$.keydown(keyPressed).keyup(keyPressed);
				
				// bind an event to catch external calls
				$$.bind("insertion", function(e, settings) {
					if (settings.target !== false) {
						get();
					}
					if (textarea === $.markItUp.focused) {
						markup(settings);
					}
				});

				// remember the last focus
				$$.focus(function() {
					$.markItUp.focused = this;
				});
			}

			// recursively build header with dropMenus from markupset
			function dropMenus(markupSet) {
				var ul = $('<ul></ul>'), i = 0;
				$('li:hover > ul', ul).css('display', 'block');
				$.each(markupSet, function() {
					var button = this, t = '', title, li, j;
					title = (button.key) ? (button.name||'')+' [Ctrl+'+button.key+']' : (button.name||'');
					key   = (button.key) ? 'accesskey="'+button.key+'"' : '';
					if (button.separator) {
						li = $('<li class="markItUpSeparator">'+(button.separator||'')+'</li>').appendTo(ul);
					} else {
						i++;
						for (j = levels.length -1; j >= 0; j--) {
							t += levels[j]+"-";
						}
						li = $('<li class="markItUpButton markItUpButton'+t+(i)+' '+(button.className||'')+'"><a href="" '+key+' title="'+title+'">'+(button.name||'')+'</a></li>')
						.bind("contextmenu", function() { // prevent contextmenu on mac and allow ctrl+click
							return false;
						}).click(function() {
							return false;
						}).bind("focusin", function(){
                            $$.focus();
						}).mousedown(function() {
							if (button.call) {
								eval(button.call)();
							}
							setTimeout(function() { markup(button) },1);
							return false;
						}).hover(function() {
								$('> ul', this).show();
								$(document).one('click', function() { // close dropmenu if click outside
										$('ul ul', header).hide();
									}
								);
							}, function() {
								$('> ul', this).hide();
							}
						).appendTo(ul);
						if (button.dropMenu) {
							levels.push(i);
							$(li).addClass('markItUpDropMenu').append(dropMenus(button.dropMenu));
						}
					}
				}); 
				levels.pop();
				return ul;
			}

			// markItUp! markups
			function magicMarkups(string) {
				if (string) {
					string = string.toString();
					string = string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,
						function(x, a) {
							var b = a.split('|!|');
							if (altKey === true) {
								return (b[1] !== undefined) ? b[1] : b[0];
							} else {
								return (b[1] === undefined) ? "" : b[0];
							}
						}
					);
					// [![prompt]!], [![prompt:!:value]!]
					string = string.replace(/\[\!\[([\s\S]*?)\]\!\]/g,
						function(x, a) {
							var b = a.split(':!:');
							if (abort === true) {
								return false;
							}
							value = prompt(b[0], (b[1]) ? b[1] : '');
							if (value === null) {
								abort = true;
							}
							return value;
						}
					);
					return string;
				}
				return "";
			}

			// prepare action
			function prepare(action) {
				if ($.isFunction(action)) {
					action = action(hash);
				}
				return magicMarkups(action);
			}

			// build block to insert
			function build(string) {
				openWith 	= prepare(clicked.openWith);
				placeHolder = prepare(clicked.placeHolder);
				replaceWith = prepare(clicked.replaceWith);
				closeWith 	= prepare(clicked.closeWith);
				if (replaceWith !== "") {
					block = openWith + replaceWith + closeWith;
				} else if (selection === '' && placeHolder !== '') {
					block = openWith + placeHolder + closeWith;
				} else {
					block = openWith + (string||selection) + closeWith;
				}
				return {	block:block, 
							openWith:openWith, 
							replaceWith:replaceWith, 
							placeHolder:placeHolder,
							closeWith:closeWith
					};
			}

			// define markup to insert
			function markup(button) {
				var len, j, n, i;
				hash = clicked = button;
				get();

				$.extend(hash, {	line:"", 
						 			root:options.root,
									textarea:textarea, 
									selection:(selection||''), 
									caretPosition:caretPosition,
									ctrlKey:ctrlKey, 
									shiftKey:shiftKey, 
									altKey:altKey
								}
							);
				// callbacks before insertion
				prepare(options.beforeInsert);
				prepare(clicked.beforeInsert);
				if (ctrlKey === true && shiftKey === true) {
					prepare(clicked.beforeMultiInsert);
				}			
				$.extend(hash, { line:1 });
				
				if (ctrlKey === true && shiftKey === true) {
					lines = selection.split(/\r?\n/);
					for (j = 0, n = lines.length, i = 0; i < n; i++) {
						if ($.trim(lines[i]) !== '') {
							$.extend(hash, { line:++j, selection:lines[i] } );
							lines[i] = build(lines[i]).block;
						} else {
							lines[i] = "";
						}
					}
					string = { block:lines.join('\n')};
					start = caretPosition;
					len = string.block.length + (($.browser.opera) ? n-1 : 0);
				} else if (ctrlKey === true) {
					string = build(selection);
					start = caretPosition + string.openWith.length;
					len = string.block.length - string.openWith.length - string.closeWith.length;
					len -= fixIeBug(string.block);
				} else if (shiftKey === true) {
					string = build(selection);
					start = caretPosition;
					len = string.block.length;
					len -= fixIeBug(string.block);
				} else {
					string = build(selection);
					start = caretPosition + string.block.length ;
					len = 0;
					start -= fixIeBug(string.block);
				}
				if ((selection === '' && string.replaceWith === '')) {
					caretOffset += fixOperaBug(string.block);
					
					start = caretPosition + string.openWith.length;
					len = string.block.length - string.openWith.length - string.closeWith.length;

					caretOffset = $$.val().substring(caretPosition,  $$.val().length).length;
					caretOffset -= fixOperaBug($$.val().substring(0, caretPosition));
				}
				$.extend(hash, { caretPosition:caretPosition, scrollPosition:scrollPosition } );

				if (string.block !== selection && abort === false) {
					insert(string.block);
					set(start, len);
				} else {
					caretOffset = -1;
				}
				get();

				$.extend(hash, { line:'', selection:selection });

				// callbacks after insertion
				if (ctrlKey === true && shiftKey === true) {
					prepare(clicked.afterMultiInsert);
				}
				prepare(clicked.afterInsert);
				prepare(options.afterInsert);

				// refresh preview if opened
				if (previewWindow && options.previewAutoRefresh) {
					refreshPreview(); 
				}
																									
				// reinit keyevent
				shiftKey = altKey = ctrlKey = abort = false;
			}

			// Substract linefeed in Opera
			function fixOperaBug(string) {
				if ($.browser.opera) {
					return string.length - string.replace(/\n*/g, '').length;
				}
				return 0;
			}
			// Substract linefeed in IE
			function fixIeBug(string) {
				if ($.browser.msie) {
					return string.length - string.replace(/\r/g, '').length;
				}
				return 0;
			}
				
			// add markup
			function insert(block) {	
				if (document.selection) {
					var newSelection = document.selection.createRange();
					newSelection.text = block;
				} else {
					textarea.value =  textarea.value.substring(0, caretPosition)  + block + textarea.value.substring(caretPosition + selection.length, textarea.value.length);
				}
			}

			// set a selection
			function set(start, len) {
				if (textarea.createTextRange){
					// quick fix to make it work on Opera 9.5
					if ($.browser.opera && $.browser.version >= 9.5 && len == 0) {
						return false;
					}
					range = textarea.createTextRange();
					range.collapse(true);
					range.moveStart('character', start); 
					range.moveEnd('character', len); 
					range.select();
				} else if (textarea.setSelectionRange ){
					textarea.setSelectionRange(start, start + len);
				}
				textarea.scrollTop = scrollPosition;
				textarea.focus();
			}

			// get the selection
			function get() {
				textarea.focus();

				scrollPosition = textarea.scrollTop;
				if (document.selection) {
					selection = document.selection;	
					if ($.browser.msie) { // ie	
						var range = selection.createRange();
						var stored_range = range.duplicate();
						stored_range.moveToElementText(textarea);
						stored_range.setEndPoint('EndToEnd', range);
						var s = stored_range.text.length - range.text.length;
	
						caretPosition = s - (textarea.value.substr(0, s).length - textarea.value.substr(0, s).replace(/\r/g, '').length);
						selection = range.text;
					} else { // opera
						caretPosition = textarea.selectionStart;
					}
				} else { // gecko & webkit
					caretPosition = textarea.selectionStart;
					selection = textarea.value.substring(caretPosition, textarea.selectionEnd);
				} 
				return selection;
			}

			// open preview window
			function preview() {
				if (!previewWindow || previewWindow.closed) {
					if (options.previewInWindow) {
						previewWindow = window.open('', 'preview', options.previewInWindow);
						$(window).unload(function() {
							previewWindow.close();
						});
					} else {
						iFrame = $('<iframe class="markItUpPreviewFrame"></iframe>');
						if (options.previewPosition == 'after') {
							iFrame.insertAfter(footer);
						} else {
							iFrame.insertBefore(header);
						}	
						previewWindow = iFrame[iFrame.length - 1].contentWindow || frame[iFrame.length - 1];
					}
				} else if (altKey === true) {
					if (iFrame) {
						iFrame.remove();
					} else {
						previewWindow.close();
					}
					previewWindow = iFrame = false;
				}
				if (!options.previewAutoRefresh) {
					refreshPreview(); 
				}
				if (options.previewInWindow) {
					previewWindow.focus();
				}
			}

			// refresh Preview window
			function refreshPreview() {
 				renderPreview();
			}

			function renderPreview() {		
				var phtml;
				if (options.previewParserPath !== '') {
					$.ajax( {
						type: 'POST',
						url: options.previewParserPath,
						data: options.previewParserVar+'='+encodeURIComponent($$.val()),
						success: function(data) {
							writeInPreview( localize(data, 1) ); 
						}
					} );
				} else {
					if (!template) {
						$.ajax( {
							url: options.previewTemplatePath,
							success: function(data) {
								writeInPreview( localize(data, 1).replace(/<!-- content -->/g, $$.val()) );
							}
						} );
					}
				}
				return false;
			}
			
			function writeInPreview(data) {
				if (previewWindow.document) {			
					try {
						sp = previewWindow.document.documentElement.scrollTop
					} catch(e) {
						sp = 0;
					}	
					previewWindow.document.open();
					previewWindow.document.write(data);
					previewWindow.document.close();
					previewWindow.document.documentElement.scrollTop = sp;
				}
			}
			
			// set keys pressed
			function keyPressed(e) { 
				shiftKey = e.shiftKey;
				altKey = e.altKey;
				ctrlKey = (!(e.altKey && e.ctrlKey)) ? e.ctrlKey : false;

				if (e.type === 'keydown') {
					if (ctrlKey === true) {
						li = $("a[accesskey="+String.fromCharCode(e.keyCode)+"]", header).parent('li');
						if (li.length !== 0) {
							ctrlKey = false;
							setTimeout(function() {
								li.triggerHandler('mousedown');
							},1);
							return false;
						}
					}
					if (e.keyCode === 13 || e.keyCode === 10) { // Enter key
						if (ctrlKey === true) {  // Enter + Ctrl
							ctrlKey = false;
							markup(options.onCtrlEnter);
							return options.onCtrlEnter.keepDefault;
						} else if (shiftKey === true) { // Enter + Shift
							shiftKey = false;
							markup(options.onShiftEnter);
							return options.onShiftEnter.keepDefault;
						} else { // only Enter
							markup(options.onEnter);
							return options.onEnter.keepDefault;
						}
					}
					if (e.keyCode === 9) { // Tab key
						if (shiftKey == true || ctrlKey == true || altKey == true) {
							return false; 
						}
						if (caretOffset !== -1) {
							get();
							caretOffset = $$.val().length - caretOffset;
							set(caretOffset, 0);
							caretOffset = -1;
							return false;
						} else {
							markup(options.onTab);
							return options.onTab.keepDefault;
						}
					}
				}
			}

			init();
		});
	};

	$.fn.markItUpRemove = function() {
		return this.each(function() {
				var $$ = $(this).unbind().removeClass('markItUpEditor');
				$$.parent('div').parent('div.markItUp').parent('div').replaceWith($$);
			}
		);
	};

	$.markItUp = function(settings) {
		var options = { target:false };
		$.extend(options, settings);
		if (options.target) {
			return $(options.target).each(function() {
				$(this).focus();
				$(this).trigger('insertion', [options]);
			});
		} else {
			$('textarea').trigger('insertion', [options]);
		}
	};
})(jQuery);


/*****************************
FILE: prettify/core/prettify    
*****************************/

window.PR_SHOULD_USE_CONTINUATION=true;window.PR_TAB_WIDTH=8;window.PR_normalizedHtml=window.PR=window.prettyPrintOne=window.prettyPrint=void 0;window._pr_isIE6=function(){var y=navigator&&navigator.userAgent&&navigator.userAgent.match(/\bMSIE ([678])\./);y=y?+y[1]:false;window._pr_isIE6=function(){return y};return y};
(function(){function y(b){return b.replace(L,"&amp;").replace(M,"&lt;").replace(N,"&gt;")}function H(b,f,i){switch(b.nodeType){case 1:var o=b.tagName.toLowerCase();f.push("<",o);var l=b.attributes,n=l.length;if(n){if(i){for(var r=[],j=n;--j>=0;)r[j]=l[j];r.sort(function(q,m){return q.name<m.name?-1:q.name===m.name?0:1});l=r}for(j=0;j<n;++j){r=l[j];r.specified&&f.push(" ",r.name.toLowerCase(),'="',r.value.replace(L,"&amp;").replace(M,"&lt;").replace(N,"&gt;").replace(X,"&quot;"),'"')}}f.push(">");
for(l=b.firstChild;l;l=l.nextSibling)H(l,f,i);if(b.firstChild||!/^(?:br|link|img)$/.test(o))f.push("</",o,">");break;case 3:case 4:f.push(y(b.nodeValue));break}}function O(b){function f(c){if(c.charAt(0)!=="\\")return c.charCodeAt(0);switch(c.charAt(1)){case "b":return 8;case "t":return 9;case "n":return 10;case "v":return 11;case "f":return 12;case "r":return 13;case "u":case "x":return parseInt(c.substring(2),16)||c.charCodeAt(1);case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":return parseInt(c.substring(1),
8);default:return c.charCodeAt(1)}}function i(c){if(c<32)return(c<16?"\\x0":"\\x")+c.toString(16);c=String.fromCharCode(c);if(c==="\\"||c==="-"||c==="["||c==="]")c="\\"+c;return c}function o(c){var d=c.substring(1,c.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));c=[];for(var a=[],k=d[0]==="^",e=k?1:0,h=d.length;e<h;++e){var g=d[e];switch(g){case "\\B":case "\\b":case "\\D":case "\\d":case "\\S":case "\\s":case "\\W":case "\\w":c.push(g);
continue}g=f(g);var s;if(e+2<h&&"-"===d[e+1]){s=f(d[e+2]);e+=2}else s=g;a.push([g,s]);if(!(s<65||g>122)){s<65||g>90||a.push([Math.max(65,g)|32,Math.min(s,90)|32]);s<97||g>122||a.push([Math.max(97,g)&-33,Math.min(s,122)&-33])}}a.sort(function(v,w){return v[0]-w[0]||w[1]-v[1]});d=[];g=[NaN,NaN];for(e=0;e<a.length;++e){h=a[e];if(h[0]<=g[1]+1)g[1]=Math.max(g[1],h[1]);else d.push(g=h)}a=["["];k&&a.push("^");a.push.apply(a,c);for(e=0;e<d.length;++e){h=d[e];a.push(i(h[0]));if(h[1]>h[0]){h[1]+1>h[0]&&a.push("-");
a.push(i(h[1]))}}a.push("]");return a.join("")}function l(c){for(var d=c.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),a=d.length,k=[],e=0,h=0;e<a;++e){var g=d[e];if(g==="(")++h;else if("\\"===g.charAt(0))if((g=+g.substring(1))&&g<=h)k[g]=-1}for(e=1;e<k.length;++e)if(-1===k[e])k[e]=++n;for(h=e=0;e<a;++e){g=d[e];if(g==="("){++h;if(k[h]===undefined)d[e]="(?:"}else if("\\"===
g.charAt(0))if((g=+g.substring(1))&&g<=h)d[e]="\\"+k[h]}for(h=e=0;e<a;++e)if("^"===d[e]&&"^"!==d[e+1])d[e]="";if(c.ignoreCase&&r)for(e=0;e<a;++e){g=d[e];c=g.charAt(0);if(g.length>=2&&c==="[")d[e]=o(g);else if(c!=="\\")d[e]=g.replace(/[a-zA-Z]/g,function(s){s=s.charCodeAt(0);return"["+String.fromCharCode(s&-33,s|32)+"]"})}return d.join("")}for(var n=0,r=false,j=false,q=0,m=b.length;q<m;++q){var t=b[q];if(t.ignoreCase)j=true;else if(/[a-z]/i.test(t.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,
""))){r=true;j=false;break}}var p=[];q=0;for(m=b.length;q<m;++q){t=b[q];if(t.global||t.multiline)throw Error(""+t);p.push("(?:"+l(t)+")")}return RegExp(p.join("|"),j?"gi":"g")}function Y(b){var f=0;return function(i){for(var o=null,l=0,n=0,r=i.length;n<r;++n)switch(i.charAt(n)){case "\t":o||(o=[]);o.push(i.substring(l,n));l=b-f%b;for(f+=l;l>=0;l-=16)o.push("                ".substring(0,l));l=n+1;break;case "\n":f=0;break;default:++f}if(!o)return i;o.push(i.substring(l));return o.join("")}}function I(b,
f,i,o){if(f){b={source:f,c:b};i(b);o.push.apply(o,b.d)}}function B(b,f){var i={},o;(function(){for(var r=b.concat(f),j=[],q={},m=0,t=r.length;m<t;++m){var p=r[m],c=p[3];if(c)for(var d=c.length;--d>=0;)i[c.charAt(d)]=p;p=p[1];c=""+p;if(!q.hasOwnProperty(c)){j.push(p);q[c]=null}}j.push(/[\0-\uffff]/);o=O(j)})();var l=f.length;function n(r){for(var j=r.c,q=[j,z],m=0,t=r.source.match(o)||[],p={},c=0,d=t.length;c<d;++c){var a=t[c],k=p[a],e=void 0,h;if(typeof k==="string")h=false;else{var g=i[a.charAt(0)];
if(g){e=a.match(g[1]);k=g[0]}else{for(h=0;h<l;++h){g=f[h];if(e=a.match(g[1])){k=g[0];break}}e||(k=z)}if((h=k.length>=5&&"lang-"===k.substring(0,5))&&!(e&&typeof e[1]==="string")){h=false;k=P}h||(p[a]=k)}g=m;m+=a.length;if(h){h=e[1];var s=a.indexOf(h),v=s+h.length;if(e[2]){v=a.length-e[2].length;s=v-h.length}k=k.substring(5);I(j+g,a.substring(0,s),n,q);I(j+g+s,h,Q(k,h),q);I(j+g+v,a.substring(v),n,q)}else q.push(j+g,k)}r.d=q}return n}function x(b){var f=[],i=[];if(b.tripleQuotedStrings)f.push([A,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
null,"'\""]);else b.multiLineStrings?f.push([A,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):f.push([A,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);b.verbatimStrings&&i.push([A,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);if(b.hashComments)if(b.cStyleComments){f.push([C,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]);i.push([A,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,
null])}else f.push([C,/^#[^\r\n]*/,null,"#"]);if(b.cStyleComments){i.push([C,/^\/\/[^\r\n]*/,null]);i.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}b.regexLiterals&&i.push(["lang-regex",RegExp("^"+Z+"(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);b=b.keywords.replace(/^\s+|\s+$/g,"");b.length&&i.push([R,RegExp("^(?:"+b.replace(/\s+/g,"|")+")\\b"),null]);f.push([z,/^\s+/,null," \r\n\t\u00a0"]);i.push([J,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/,
null],[z,/^[a-z_$][a-z_$@0-9]*/i,null],[J,/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],[E,/^.[^\s\w\.$@\'\"\`\/\#]*/,null]);return B(f,i)}function $(b){function f(D){if(D>r){if(j&&j!==q){n.push("</span>");j=null}if(!j&&q){j=q;n.push('<span class="',j,'">')}var T=y(p(i.substring(r,D))).replace(e?d:c,"$1&#160;");e=k.test(T);n.push(T.replace(a,s));r=D}}var i=b.source,o=b.g,l=b.d,n=[],r=0,j=null,q=null,m=0,t=0,p=Y(window.PR_TAB_WIDTH),c=/([\r\n ]) /g,
d=/(^| ) /gm,a=/\r\n?|\n/g,k=/[ \r\n]$/,e=true,h=window._pr_isIE6();h=h?b.b.tagName==="PRE"?h===6?"&#160;\r\n":h===7?"&#160;<br>\r":"&#160;\r":"&#160;<br />":"<br />";var g=b.b.className.match(/\blinenums\b(?::(\d+))?/),s;if(g){for(var v=[],w=0;w<10;++w)v[w]=h+'</li><li class="L'+w+'">';var F=g[1]&&g[1].length?g[1]-1:0;n.push('<ol class="linenums"><li class="L',F%10,'"');F&&n.push(' value="',F+1,'"');n.push(">");s=function(){var D=v[++F%10];return j?"</span>"+D+'<span class="'+j+'">':D}}else s=h;
for(;;)if(m<o.length?t<l.length?o[m]<=l[t]:true:false){f(o[m]);if(j){n.push("</span>");j=null}n.push(o[m+1]);m+=2}else if(t<l.length){f(l[t]);q=l[t+1];t+=2}else break;f(i.length);j&&n.push("</span>");g&&n.push("</li></ol>");b.a=n.join("")}function u(b,f){for(var i=f.length;--i>=0;){var o=f[i];if(G.hasOwnProperty(o))"console"in window&&console.warn("cannot override language handler %s",o);else G[o]=b}}function Q(b,f){b&&G.hasOwnProperty(b)||(b=/^\s*</.test(f)?"default-markup":"default-code");return G[b]}
function U(b){var f=b.f,i=b.e;b.a=f;try{var o,l=f.match(aa);f=[];var n=0,r=[];if(l)for(var j=0,q=l.length;j<q;++j){var m=l[j];if(m.length>1&&m.charAt(0)==="<"){if(!ba.test(m))if(ca.test(m)){f.push(m.substring(9,m.length-3));n+=m.length-12}else if(da.test(m)){f.push("\n");++n}else if(m.indexOf(V)>=0&&m.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)){var t=m.match(W)[2],p=1,c;c=j+1;a:for(;c<q;++c){var d=l[c].match(W);if(d&&
d[2]===t)if(d[1]==="/"){if(--p===0)break a}else++p}if(c<q){r.push(n,l.slice(j,c+1).join(""));j=c}else r.push(n,m)}else r.push(n,m)}else{var a;p=m;var k=p.indexOf("&");if(k<0)a=p;else{for(--k;(k=p.indexOf("&#",k+1))>=0;){var e=p.indexOf(";",k);if(e>=0){var h=p.substring(k+3,e),g=10;if(h&&h.charAt(0)==="x"){h=h.substring(1);g=16}var s=parseInt(h,g);isNaN(s)||(p=p.substring(0,k)+String.fromCharCode(s)+p.substring(e+1))}}a=p.replace(ea,"<").replace(fa,">").replace(ga,"'").replace(ha,'"').replace(ia," ").replace(ja,
"&")}f.push(a);n+=a.length}}o={source:f.join(""),h:r};var v=o.source;b.source=v;b.c=0;b.g=o.h;Q(i,v)(b);$(b)}catch(w){if("console"in window)console.log(w&&w.stack?w.stack:w)}}var A="str",R="kwd",C="com",S="typ",J="lit",E="pun",z="pln",P="src",V="nocode",Z=function(){for(var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=",
"~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],f="(?:^^|[+-]",i=0;i<b.length;++i)f+="|"+b[i].replace(/([^=<>:&a-z])/g,"\\$1");f+=")\\s*";return f}(),L=/&/g,M=/</g,N=/>/g,X=/\"/g,ea=/&lt;/g,fa=/&gt;/g,ga=/&apos;/g,ha=/&quot;/g,ja=/&amp;/g,ia=/&nbsp;/g,ka=/[\r\n]/g,K=null,aa=RegExp("[^<]+|<!--[\\s\\S]*?--\>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|</?[a-zA-Z](?:[^>\"']|'[^']*'|\"[^\"]*\")*>|<","g"),ba=/^<\!--/,ca=/^<!\[CDATA\[/,da=/^<br\b/i,W=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,
la=x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END break continue do else for if return while case done elif esac eval fi function in local set then until ",
hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true}),G={};u(la,["default-code"]);u(B([],[[z,/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[E,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup",
"htm","html","mxml","xhtml","xml","xsl"]);u(B([[z,/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[E,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],
["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);u(B([],[["atv",/^[\s\S]+/]]),["uq.val"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where ",
hashComments:true,cStyleComments:true}),["c","cc","cpp","cxx","cyc","m"]);u(x({keywords:"null true false"}),["json"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ",
hashComments:true,cStyleComments:true,verbatimStrings:true}),["cs"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",
cStyleComments:true}),["java"]);u(x({keywords:"break continue do else for if return while case done elif esac eval fi function in local set then until ",hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);u(x({keywords:"break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);
u(x({keywords:"caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);u(x({keywords:"break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",hashComments:true,
multiLineStrings:true,regexLiterals:true}),["rb"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN ",cStyleComments:true,regexLiterals:true}),["js"]);u(B([],[[A,/^[\s\S]+/]]),
["regex"]);window.PR_normalizedHtml=H;window.prettyPrintOne=function(b,f){var i={f:b,e:f};U(i);return i.a};window.prettyPrint=function(b){function f(){for(var t=window.PR_SHOULD_USE_CONTINUATION?j.now()+250:Infinity;q<o.length&&j.now()<t;q++){var p=o[q];if(p.className&&p.className.indexOf("prettyprint")>=0){var c=p.className.match(/\blang-(\w+)\b/);if(c)c=c[1];for(var d=false,a=p.parentNode;a;a=a.parentNode)if((a.tagName==="pre"||a.tagName==="code"||a.tagName==="xmp")&&a.className&&a.className.indexOf("prettyprint")>=
0){d=true;break}if(!d){a=p;if(null===K){d=document.createElement("PRE");d.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));K=!/</.test(d.innerHTML)}if(K){d=a.innerHTML;if("XMP"===a.tagName)d=y(d);else{a=a;if("PRE"===a.tagName)a=true;else if(ka.test(d)){var k="";if(a.currentStyle)k=a.currentStyle.whiteSpace;else if(window.getComputedStyle)k=window.getComputedStyle(a,null).whiteSpace;a=!k||k==="pre"}else a=true;a||(d=d.replace(/(<br\s*\/?>)[\r\n]+/g,"$1").replace(/(?:[\r\n]+[ \t]*)+/g,
" "))}d=d}else{d=[];for(a=a.firstChild;a;a=a.nextSibling)H(a,d);d=d.join("")}d=d.replace(/(?:\r\n?|\n)$/,"");m={f:d,e:c,b:p};U(m);if(p=m.a){c=m.b;if("XMP"===c.tagName){d=document.createElement("PRE");for(a=0;a<c.attributes.length;++a){k=c.attributes[a];if(k.specified)if(k.name.toLowerCase()==="class")d.className=k.value;else d.setAttribute(k.name,k.value)}d.innerHTML=p;c.parentNode.replaceChild(d,c)}else c.innerHTML=p}}}}if(q<o.length)setTimeout(f,250);else b&&b()}for(var i=[document.getElementsByTagName("pre"),
document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],o=[],l=0;l<i.length;++l)for(var n=0,r=i[l].length;n<r;++n)o.push(i[l][n]);i=null;var j=Date;j.now||(j={now:function(){return(new Date).getTime()}});var q=0,m;f()};window.PR={combinePrefixPatterns:O,createSimpleLexer:B,registerLangHandler:u,sourceDecorator:x,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:C,PR_DECLARATION:"dec",PR_KEYWORD:R,PR_LITERAL:J,PR_NOCODE:V,PR_PLAIN:z,PR_PUNCTUATION:E,PR_SOURCE:P,PR_STRING:A,
PR_TAG:"tag",PR_TYPE:S}})()

/*****************************
FILE: prettify/ext/lang-css    
*****************************/

PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[ \t\r\n\f]+/,null," \t\r\n\u000c"]],[["str",/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],["str",/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],["kwd",/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],
["com",/^(?:<!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#(?:[0-9a-f]{3}){1,2}/i],["pln",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],["pun",/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^\)\"\']+/]]),["css-str"])

/*****************************
FILE: prettify/ext/lang-sql    
*****************************/

PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],["kwd",/^(?:ADD|ALL|ALTER|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PERCENT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|UPDATETEXT|USE|USER|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i,
null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_][\w-]*/i],["pun",/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]]),["sql"])

/*****************************
FILE: prettify/ext/lang-wiki    
*****************************/

PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t \xA0a-gi-z0-9]+/,null,"\t \u00a0abcdefgijklmnopqrstuvwxyz0123456789"],["pun",/^[=*~\^\[\]]+/,null,"=*~^[]"]],[["lang-wiki.meta",/(?:^^|\r\n?|\n)(#[a-z]+)\b/],["lit",/^(?:[A-Z][a-z][a-z0-9]+[A-Z][a-z][a-zA-Z0-9]+)\b/],["lang-",/^\{\{\{([\s\S]+?)\}\}\}/],["lang-",/^`([^\r\n`]+)`/],["str",/^https?:\/\/[^\/?#\s]*(?:\/[^?#\s]*)?(?:\?[^#\s]*)?(?:#\S*)?/i],["pln",/^(?:\r\n|[\s\S])[^#=*~^A-Zh\{`\[\r\n]*/]]),["wiki"]);
PR.registerLangHandler(PR.createSimpleLexer([["kwd",/^#[a-z]+/i,null,"#"]],[]),["wiki.meta"])

/*****************************
FILE: ostudios/Route    
*****************************/


function Route ( routeStr )
{
	this.init();
	if ( routeStr ) {
		this.routeStr = routeStr;
		this.decodeURL();
	}
}

Route.prototype.routeStr;

Route.prototype.content_type;
Route.prototype.tags;
Route.prototype.open_posts;
Route.prototype.open_page;
Route.prototype.open_stack;
Route.prototype.header_type;
Route.prototype.inline;

Route.prototype._content_type_index;
Route.prototype._tags_index;
Route.prototype._open_posts_index;
Route.prototype._open_page_index;
Route.prototype._open_stack_index;
Route.prototype._header_type_index;
Route.prototype._inline_index;

Route.prototype.init = function () {	
	var template = ostudios_Services.getServiceURL("route");
	templateArr = template.substr(1).split("/");
	this._content_type_index = $.inArray( "post" , templateArr );//just picked a content type arbitrarily...
	this._tags_index = $.inArray( "[tags]" , templateArr );;
	this._open_posts_index = $.inArray( "[open_posts]" , templateArr );
	this._open_page_index = $.inArray( "[open_page]" , templateArr );
	this._open_stack_index = $.inArray( "[open_stack]" , templateArr );
	this._header_type_index = $.inArray( "[header_type]" , templateArr );
	this._inline_index = $.inArray( "[inline]" , templateArr );
	
	//set up local default arrays
	this.open_posts = [];
	this.open_page = [];
}

Route.prototype.decodeURL = function ( routeStr ) {	
	var routeArr = this.routeStr.substr(1).split("/");

	this.content_type = ( routeArr[this._content_type_index] ) ? routeArr[this._content_type_index] : "-";

	//keep tags clustered for now...
	this.tags = ( routeArr[this._tags_index] ) ? routeArr[this._tags_index] : "all";
	
	if ( routeArr[this._open_posts_index] && routeArr[this._open_posts_index] != "-"  ) {
		this.open_posts = routeArr[this._open_posts_index].split("-");
	}else{
		this.open_posts = [];
	}	
	
	if ( routeArr[this._open_page_index] && routeArr[this._open_page_index] != "-" ) {
		this.open_page = routeArr[this._open_page_index].split("-");
	}else{
		this.open_page = [];
	}	

	this.open_stack = ( routeArr[this._open_stack_index] ) ? routeArr[this._open_stack_index] : "-";
	this.header_type = ( routeArr[this._header_type_index] ) ? routeArr[this._header_type_index] : "-";
	this.inline = ( routeArr[this._inline_index] ) ? routeArr[this._inline_index] : "-";
}

Route.prototype.addPost = function ( post_id ) {
	if ( this.open_posts.length == 0 ) {
		this.open_posts.push( post_id );
		return true;
	}else{
		if ( $.inArray( post_id , this.open_posts ) === -1  ) {
			this.open_posts.push( post_id );
			return true;
		}else{
			return false;
		}
	}
}

Route.prototype.removePost = function ( post_id ) {
	var new_open_posts = [];
	for ( var i=0; i<this.open_posts.length; i++ ) {
		var post = this.open_posts[i];
		if ( post_id != post ) {
			new_open_posts.push( post ); 
		}
	}
	this.open_posts = new_open_posts;
}




Route.prototype.addPage = function ( page_index ) {
	//page_index = parseInt( page_index );
	if ( this.open_page.length == 0 ) {
		this.open_page.push( page_index );
		return true;
	}else{
		if ( $.inArray( page_index , this.open_page ) === -1  ) {
			this.open_page.push( page_index );
			return true;
		}else{
			return false;
		}
	}
}

Route.prototype.removePage = function ( page_id ) {
	var new_open_page = [];
	for ( var i=0; i<this.open_page.length; i++ ) {
		var page = this.open_page[i];
		if ( page_id != page ) {
			new_open_page.push( page ); 
		}
	}
	this.open_page = new_open_page;
}



Route.isNull = function ( prop ) {
	if (   prop == "-" 
		|| prop == "" 
		|| RIA.isNull( prop ) 
	) {
		return true;
	}else{
		return false;
	}
}

Route.prototype.encode = function () {	
	//check for home page:
	/*if ( Route.isNull( this.content_type ) ) {
		//nothing is home...
		this.content_type = "home";
	}*/
		
	var newRouteArr = new Array();
	
	newRouteArr.splice( this._header_type_index , 0 , this.header_type );
	newRouteArr.splice( this._inline_index , 0 , this.inline );
	newRouteArr.splice( this._content_type_index , 0 , this.content_type );
	
	if ( this.tags && this.tags.length > 0 ) {
		newRouteArr.splice( this._tags_index , 0 , this.tags );
	}else{
		newRouteArr.splice( this._tags_index , 0 , "-" );
	}
	
	
	if ( this.open_posts.length > 0 ) {
		newRouteArr.splice( this._open_posts_index , 0 , this.open_posts.join("-") );
	}else{
		newRouteArr.splice( this._open_posts_index , 0 , "-" );
	}
	
	if ( this.open_page.length > 0 ) {
		newRouteArr.splice( this._open_page_index , 0 , this.open_page.join("-") );
	}else{
		newRouteArr.splice( this._open_page_index , 0 , "-" );
	}
	
	newRouteArr.splice( this._open_stack_index , 0 , this.open_stack );

	var url = "/" + newRouteArr.join("/");
	
	//trim off extraneous info
	var lastChar = url.substring( url.length-1 );
	var last2Char = url.substring( url.length-2 );
	while ( last2Char == "/-" || lastChar == "/" ) {
		url = url.substring( 0 , url.length-1 );		
		var lastChar = url.substring( url.length-1 );
		var last2Char = url.substring( url.length-2 );
	}

	return url;
}

Route.prototype.clone = function () {
	return new Route( this.encode() );
}



/*****************************
FILE: ostudios/Router    
*****************************/


function ostudios_Router ( scope )
{
	this.scope = scope;
	var me = this;
	if ( ostudios_Services.route_level != "core" ) {
		if (typeof history.pushState === 'undefined') {
			this.isHTML5 = false;
			
			if ( ostudios_Services.route_level == "hash" ) {
				//redirect to root
				if ( location.pathname != "/" ) {
					if ( location.hash.length > 0 ) {
						location = "/" + location.hash;
					}else{
						location = "/#!" + location.pathname;
					}
					return;
				}		
				
				//load default...
				if ( location.hash.length > 0 ) {
					url = location.hash.substring( 2 );
				}else{
					url = new Route("/home").encode();
					location.hash = "!/home";
				}
				
				this.route = new Route(url);
				setTimeout ( 
					function () {
						me.loadPage( me.route.encode() );
					}
				, 500 );
				
				//hook up events
				$(window).hashchange( function(){
					me.onhashstatechange();
				});
			}else{
				this.route = new Route( location.pathname );
				if ( location.pathname == "/" ) {
					location = "/home";
					return;
				}
			}
			
		} else {
			this.isHTML5 = true;
			if ( location.hash.length > 0 ) {
				url = location.hash.substring( 2 );
				window.history.replaceState( {} ,"" , url );
				
				setTimeout ( 
					function () {
						var newRoute = new Route ( url );
						me.loadPage( newRoute.encode() );
					}
				, 500 );
			}
			
			if ( location.pathname.length == 1 ) {
				window.history.replaceState( {} ,"" , "/home" );
				setTimeout ( 
					function () {
						var newRoute = new Route ( "/home" );
						me.loadPage( newRoute.encode() );
					}
				, 500 );
			}
			
			$(window).bind("popstate", function() {
			    me.onhtml5statechange()
			});	
			this.route = new Route(location.pathname);
		}
	}
	
	//singleton-ish
	Router = this;
}

ostudios_Router.prototype.isHTML5;
ostudios_Router.prototype.route;
ostudios_Router.prototype.hash;

ostudios_Router.PAGE = "PAGE";//   /post/dog

ostudios_Router.OPEN_POST = "OPEN_POST";//   /post/dog
ostudios_Router.INJECT_POST = "INJECT_POST";//   /posts/dogs/22-3/
ostudios_Router.CLOSE_POST = "CLOSE_POST";//    /posts/dogs/3/

ostudios_Router.OPEN_LIST_COLLECTION = "OPEN_LIST_COLLECTION";//  /posts/dogs/
ostudios_Router.INJECT_LIST = "INJECT_LIST";//  /posts/dogs/-/1-2/  OR /post/dog/-/1-2
ostudios_Router.CLOSE_LIST = "CLOSE_LIST";//   /posts/dogs/-/2   OR /post/dog/-/2

ostudios_Router.SWITCH_LIST_COLLECTION = "SWITCH_LIST_COLLECTION"

ostudios_Router.prototype.onhashstatechange = function()
{
	var url = location.hash.substring( 2 );
	var newRoute = new Route ( url );
	if ( this.isNewPageLoad( newRoute , this.route ) ) {
		this.loadPage( newRoute.encode() );
	}else{
		//page is not going away, so a pert is loading...
		this.route = newRoute;
		this.scope.bounceEvent( "router_state_change" , this.route );			
	}	
}
ostudios_Router.prototype.onhtml5statechange = function()
{
	var url = location.pathname;
	var newRoute = new Route ( url );
	if ( this.isNewPageLoad( newRoute , this.route ) ) {
		this.loadPage( newRoute.encode() );
	}
}

ostudios_Router.prototype.refreshPage = function()
{
	this.loadPage( this.route.encode() , false );
}
ostudios_Router.prototype.reload = ostudios_Router.prototype.refreshPage;

ostudios_Router.prototype.loadPage = function( url , checkCache )
{
	if ( RIA.isNull( checkCache ) )
		checkCache = true;
	
	this.route = new Route( url );
	
	if ( checkCache ) {
		var cachedHTML = $.jCache.getItem( url );
		if ( cachedHTML ) {
			this.renderPage( url , cachedHTML );
			return;
		}
	}	
	
	var cmd = new ostudios_root_cmd_LoadPageCMD();
	cmd.execute( {route:url,page_route:url} , this );
}

ostudios_Router.prototype.renderPage = function( url , html )
{
	$.jCache.setItem( url , html );
	
	if ( window['_gaq'] ) {
		_gaq.push(['_trackPageview', url ]);
	}
	
	this.scope.$('#root_content').html( html );
	//look for and create lazy comps
	
	RIA.createComponents();
}

ostudios_Router.prototype.statechange = function( action , core_link , post_id )
{
	if ( ostudios_Services.route_level != "core" ) {
		switch ( action ) {
			case ostudios_Router.PAGE :
				var requestedRoute = new Route( core_link );
				newRoute = requestedRoute;
				break;
			case ostudios_Router.INJECT_POST :
				var newRoute = this.route.clone();
				newRoute.addPost( post_id );
				RIA.createLazyComponents( $("#comp_post_" + post_id ) );
				break;
			case ostudios_Router.CLOSE_POST :
				var newRoute = this.route.clone();
				newRoute.removePost( post_id );
				RIA.createLazyComponents( $("#comp_post_" + post_id ) );
				break;
			case ostudios_Router.INJECT_LIST :
				var newRoute = this.route.clone();
				var requestedRoute = new Route( core_link );
				newRoute.addPage( requestedRoute.open_page[0] );
				RIA.createLazyComponents( $("#comp_list_" + requestedRoute.open_page[0] ) );
				break;
			case ostudios_Router.CLOSE_LIST :
				var newRoute = this.route.clone();
				var requestedRoute = new Route( core_link );
				newRoute.removePage( requestedRoute.open_page[0] );
				RIA.createLazyComponents( $("#comp_list_" + requestedRoute.open_page[0] ) );
				break;
			
			case ostudios_Router.OPEN_POST :
			default:
				var requestedRoute = new Route( core_link );
				if ( this.isNewPageLoad( requestedRoute , this.route ) ) {
					newRoute = requestedRoute;
				}else{
					return false;
				}			
				break;
		}
		
		if ( this.isHTML5 ) {
			if ( this.isNewPageLoad( newRoute , this.route ) ) {
				this.loadPage( newRoute.encode() );
			}else{
				//page is not going away, so a pert is loading...
				this.route = newRoute;
				this.scope.bounceEvent( "router_state_change" , this.route );			
			}			
			window.history.pushState( {} , "" , this.route.encode() );		
		}else{
			if ( ostudios_Services.route_level == "hash" ) {
				location.hash = "!" + newRoute.encode();
			}else{
				if ( this.isNewPageLoad( newRoute , this.route ) ) {
					location = newRoute.encode();
				}else{
					this.route = newRoute;
					this.scope.bounceEvent( "router_state_change" , this.route );	
				}				
			}
		}
	}
	return true;
}

ostudios_Router.prototype.loadPost = function ( slug ) {	
	var url = "/post/" + slug;
	if ( ostudios_Services.route_level != "core" ) {
		if ( this.isHTML5 ) {		
			this.loadPage( url );
			window.history.pushState( {} ,"" , url );
		}else{
			//location.hash = "!" + url;
			if ( ostudios_Services.route_level == "hash" ) {
				location.hash = "!" + url;
			}else{
				location = url;
			}
		}
	}else{
		location = url;
	}
}

ostudios_Router.prototype.isNewPageLoad = function ( route1 , route2 ) {
	if ( route1.content_type != route2.content_type 
			|| route1.tags != route2.tags ) {
		return true;
	}else{
		return false;
	}
}









/*****************************
FILE: ostudios/Services    
*****************************/

function ostudios_Services ()
{
}

ostudios_Services.gateway = "/";

ostudios_Services.route_level = "hash";

ostudios_Services.theme = "octopikidstheme_";

ostudios_Services.serializeTags = function( tags )
{
	switch ( RIA.typeOf( tags ) ) {
		case "array" :
			if ( tags.length == 0 ) {
				return "all";
			}else if ( tags.length == 1 ) {
				if ( tags[0] == "" ) {
					return "all";
				}else{
					return tags[0];
				}
			}else if ( tags.length > 1 ) {
				if ( tags[1] == "" ) {
					if ( tags[0] == "" ) {
						return "all";
					}else{
						return tags[0];
					}
				}else{
					return tags[0] +"_"+tags[1];
				}
			}
			break;
		case "string" :
		default:
			return tags;
	}

}

ostudios_Services.getServiceURL = function( serviceId , data )
{
	var url = "";
	switch ( serviceId ) {
		case "jsonhtml_simple_post_details" :
			url = 'postinline/[tags]/-/-/-/jsonhtml/inline';
			break;
		case "jsonhtml_list" :
			url = 'listsegment/[content_type]/[tags]/jsonhtml/inline/-/[open_page]';
			break;
		case "submit_post" :
			url = 'api/post/submit';
			break;
		case "delete_post" :
			url = 'api/post/delete';
			break;
		case "json_post" :
			url = 'postsegment/post/[tags]/json';
			break;
		case "image_upload" :
			url = 'api/imageupload/index';
			break;
		case "image_url_upload" :
			url = 'api/imageupload/url';
			break;
		case "get_page_info" :
			url = 'api/post/getpageinfo';
			break;
		case "contact_email" :
			url = 'api/email/index';
			break;
		case "ajax" :
			url = 'ajax/index';
			break;
		case "route" :
			url = 'post/[tags]/[open_posts]/[open_page]/[open_stack]/[header_type]/[inline]';
			break;

	}

	for ( var i in data ) {
		if ( i == "tags" )
			data[i] = ostudios_Services.serializeTags( data[i] );

		url = url.replace( "[" +i+ "]" , data[i] );
	}

	return ostudios_Services.gateway + url;
}


/*****************************
FILE: ostudios/admin/login/LoginPage    
*****************************/


function ostudios_admin_login_LoginPage ( element )
{
	ria_Component.call( this , element );

	
}

ostudios_admin_login_LoginPage.prototype = new ria_Component();
ostudios_admin_login_LoginPage.prototype.constructor = ostudios_admin_login_LoginPage;

//props
ostudios_admin_login_LoginPage.prototype.post;

ostudios_admin_login_LoginPage.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
		case "alertme" :
			break;
	}
}

ostudios_admin_login_LoginPage.prototype.onSubmit = function( formid , event )
{
	switch ( formid ) {
		case "join" :
			$('#join_messages').html("thought you could join, huh?");
			break;
		case "login" :
			var cmd = new ostudios_admin_login_cmd_LoginCMD();
			cmd.execute( RIA.getAssocFormData( $(event.target) ) , this );
			break;
	}
}



/*****************************
FILE: ostudios/admin/login/cmd/logincmd    
*****************************/


function ostudios_admin_login_cmd_LoginCMD ( )
{
	this.url = '/api/login/login';
}

ostudios_admin_login_cmd_LoginCMD.prototype = new ria_cmd_Command();
ostudios_admin_login_cmd_LoginCMD.prototype.constructor = ostudios_admin_login_cmd_LoginCMD;


ostudios_admin_login_cmd_LoginCMD.prototype.loadingStarted = function()
{
	//PopupManager.showGlobalLoading();
	this.scope.$(".submitButton").css('visibility','hidden');
	this.scope.$("#login_messages").html( "" );
}

ostudios_admin_login_cmd_LoginCMD.prototype.loadingDone = function()
{
	//PopupManager.hideGlobalLoading();
	this.scope.$(".submitButton").css('visibility','visible');
}

ostudios_admin_login_cmd_LoginCMD.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );
	
	//GlobalEventManager.dispatchEvent( "newCommentAdded" , results.result );	
	//PopupManager.closeWindow( this.scope.element );
	//this.scope.$(".submitButton").css('visibility','visible');
	window.location.reload();
}






/*****************************
FILE: ostudios/admin/login/cmd/logoutcmd    
*****************************/


function ostudios_admin_login_cmd_LogoutCMD ( )
{
	this.url = '/api/login/logout';
}

ostudios_admin_login_cmd_LogoutCMD.prototype = new ria_cmd_Command();
ostudios_admin_login_cmd_LogoutCMD.prototype.constructor = ostudios_admin_login_cmd_LogoutCMD;


ostudios_admin_login_cmd_LogoutCMD.prototype.loadingStarted = function()
{
	//PopupManager.showGlobalLoading();
}

ostudios_admin_login_cmd_LogoutCMD.prototype.loadingDone = function()
{
	//PopupManager.hideGlobalLoading();
}

ostudios_admin_login_cmd_LogoutCMD.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );
	
	//GlobalEventManager.dispatchEvent( "newCommentAdded" , results.result );	
	//PopupManager.closeWindow( this.scope.element );
	window.location.reload();
}

ostudios_admin_login_cmd_LogoutCMD.prototype.failure = function( status, errorThrown )
{
	//this.scope.injectError( errorThrown );

	//PopupManager.hideGlobalLoading();
	//ria_cmd_Command.prototype.failure.call( this, status, errorThrown );
	alert("ERROR, try again.");
	//window.location.reload();
}





/*****************************
FILE: ostudios/admin/login/tpl/loginview    
*****************************/


ostudios_admin_login_tpl_loginview = function () {
	
	return new microtemplate_Template( '  <div jsclass="ostudios_admin_login_LoginPage" class="loginform">    	    	<div class="joinSection">  		<div class="joinContent"><form id="join" onsubmit="return RIA.onsubmit(event);">  			<h2>Join</h2>  			<div>username</div>  			<input class="dd_input" name="username" />  			<div>email</div>  			<input class="dd_input" name="email" />  			<div>password</div>  			<input class="dd_input" name="password" type="password" />  			<div>confirm password</div>  			<input class="dd_input" name="password_confirm" type="password" />  			<div class="submit"><input type="submit" class="button_medium submitButton" value="join" /></div>  			  		</form><div id="join_messages" class="errors"></div></div>  	</div>    	<div class="loginSection">  		<div class="loginContent"><form id="login" onsubmit="return RIA.onsubmit(event);">  			<h2>Login</h2>  			<div>username</div>  			<input class="dd_input" name="username" />  			<div>password</div>  			<input class="dd_input" name="password" type="password" />  			  			<div class="submit"><input type="submit" class="button_medium submitButton" value="login" /></div>  		</form><div id="login_messages" class="errors"></div></div>  	</div>    </div>' );	
	
}



/*****************************
FILE: ostudios/admin/post/PostAdmin    
*****************************/


function ostudios_admin_PostAdmin ( element )
{
	ria_Component.call( this , element );
	
	if ( this.jsdata.slug && this.jsdata.slug.length > 0 ) {
		var tpl = new ostudios_admin_post_tpl_PostAdmin();	
		this.element.html( tpl.parse( {} ) );
		
		var cmd = new ostudios_admin_post_cmd_getPostCMD();
		cmd.execute({tags:this.jsdata.slug},this);
	}else{
		var post = new ostudios_vo_postvo();
		post.post_date = new Date();
		post.tags = [];
		post.sites = [{id:ostudios_OStudios.site_id}];
		if ( this.jsdata.tags ) {
			for ( var i=0; i<this.jsdata.tags.length; i++ ) {
				var tag = this.jsdata.tags[i];
				if ( tag.length > 0 )
					post.tags.push( {name:tag} );
			}
		}
		this.renderForm( post );
	}
	
}

ostudios_admin_PostAdmin.prototype = new ria_Component();
ostudios_admin_PostAdmin.prototype.constructor = ostudios_admin_PostAdmin;

//props
ostudios_admin_PostAdmin.prototype.post;
ostudios_admin_PostAdmin.prototype.user_sites = [];

ostudios_admin_PostAdmin.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
		case "imgURL" :
			var cmd = new ostudios_admin_post_cmd_uploadImageViaURLCMD();
			cmd.execute ( {url:this.$('#imgURL').val()} , this );
			break;
		case "end_now" :
			this.$('#end_date').val( PHP.date( "F j, Y g:i A" , new Date() ) );		
			break;
		case "renderForm" :
			this.renderForm();
			break;
		case "delete_post" :
			var cmd = new ostudios_admin_post_cmd_deletePostCMD();
			cmd.execute ( {id:this.post.id} , this );
			break;
		case "image_right" :
			var newImages = [];
			var theImage = false;
			for ( var i=0; i<this.post.images.length; i++ ) {
				var image = this.post.images[i];
				if ( image.id == value && i < this.post.images.length-1 ) {
					theImage = image;
				}else{
					newImages.push( image );
					if ( theImage != false ) {
						newImages.push( theImage );
						theImage = false;
					}
				}							
			}
			//RIA.log( newImages );
			this.post.images = newImages;
			var tpl = new ostudios_admin_post_tpl_ImagePreview();	
			this.$('#imagePreview').html( tpl.parse( {images:this.post.images} ) );
			break;
		case "image_left" :
			var newImages = [];
			var theImage = false;
			for ( var i=0; i<this.post.images.length; i++ ) {
				var image = this.post.images[i];
				if ( i == 0 && image.id == value ) {
					newImages = this.post.images;
					break;
				}
				
				if ( i < this.post.images.length-1 ) {
					var nextImage = this.post.images[i+1];
					if ( nextImage.id == value ) {
						newImages.push( nextImage );
					}
				}
				if ( image.id != value ) {
					newImages.push( image );
				}											
			}
			//RIA.log( newImages );
			this.post.images = newImages;
			var tpl = new ostudios_admin_post_tpl_ImagePreview();	
			this.$('#imagePreview').html( tpl.parse( {images:this.post.images} ) );
			break;
		case "image_delete" :
			var newImages = [];
			var theImage = false;
			for ( var i=0; i<this.post.images.length; i++ ) {
				var image = this.post.images[i];
				if ( image.id != value ) {
					newImages.push( image );
				}											
			}
			//RIA.log( newImages );
			this.post.images = newImages;
			var tpl = new ostudios_admin_post_tpl_ImagePreview();	
			this.$('#imagePreview').html( tpl.parse( {images:this.post.images} ) );
			break;
	}
}
ostudios_admin_PostAdmin.prototype.onSubmit = function( formid , event )
{
	switch ( formid ) {
		
		case "postform" :
			var newPost = RIA.getAssocFormData( $(event.target) );
			
			this.post.title = newPost.title;
			
			var bodySplit = newPost.body.split("<!-- pagebreak -->");
			
			this.post.html_header = bodySplit.shift();
			this.post.html_body = bodySplit.join("");
			this.post.html_all = this.post.html_header + this.post.html_body;
			this.post.has_more_text = ( this.post.html_body.length > 0 ) ? 1 : 0;
			
			this.post.is_private = ( newPost.is_private == "on" ) ? 1 : 0;

			//post date
			this.post.post_date = PHP.strtotime( newPost.post_date );
			this.post.start_date = PHP.strtotime( newPost.start_date );

			if ( newPost.end_date.toLowerCase() == "today" 
				|| newPost.end_date.toLowerCase() == "now" ) {
				this.post.end_date = 0;
				this.post.end_is_now = 1;
			}else{
				this.post.end_date = PHP.strtotime( newPost.end_date );
				this.post.end_date = ( this.post.end_date == false ) ? 0 : this.post.end_date;
				this.post.end_is_now = 0;
			}
						
			//tags
			this.post.tags_string = newPost.tags_string;
			this.post.list_tags = newPost.list_tags;
			
			this.post.post_view_type = newPost.post_view_type;
			
			this.post.sites = ( RIA.typeOf( newPost.sites ) === "array" ) ? newPost.sites.join(",") : newPost.sites;

			//images
			//nada..already in there..
			var cmd = new ostudios_admin_post_cmd_submitPostCMD();
			cmd.execute( {post:this.post} , this , true );
			break;
	}
}

ostudios_admin_PostAdmin.prototype.successfulSubmit = function( post )
{
	var tpl = new ostudios_admin_post_tpl_success();	
	this.element.html( tpl.parse( {postUrl:post.full_url} ) );
	
	/*if ( this.post.id == "" ) {
		window.location = post.full_url;
	}else{
		window.location.reload();
	}*/
}

ostudios_admin_PostAdmin.prototype.successfulDelete = function( post )
{
	PopupManager.closeWindow( this.element );
	//window.location.reload();
	Router.refreshPage();
}

ostudios_admin_PostAdmin.prototype.showError = function( error )
{
	alert("ERROR:" + error );
}

ostudios_admin_PostAdmin.prototype.renderForm = function( post , user_sites )
{
	this.post = post;	
	if ( user_sites )
		this.user_sites = user_sites;
	
	//process tags
	var tagNameArray = [];
	for ( var i=0; i<this.post.tags.length; i++ ) {
		tagNameArray.push( this.post.tags[i].name );
	}
	this.post.tags_string = tagNameArray.join(",");
//RIA.log(this.post);
	var tpl = new ostudios_admin_post_tpl_PostForm();	
	//var tpl = new ostudios_admin_post_tpl_QuickEdit();
	this.element.html( tpl.parse( {post:this.post,user_sites:ostudios_OStudios.user_sites} ) );
	
	this.$('#body').markItUp(this.markitupsettings);
	
	var me = this;
	var uploader = new qq.FileUploader({
        element: $('#selectImage')[0]
       ,action: ostudios_Services.getServiceURL( 'image_upload' )
       ,allowedExtensions: ['jpg','gif','png']
       ,onSubmit : function () { PopupManager.showGlobalLoading(); }
       ,onComplete: function (id, fileName, responseJSON) { me.captureImageUpload( responseJSON ) }
   });
      
   	var tpl = new ostudios_admin_post_tpl_ImagePreview();	
	this.$('#imagePreview').html( tpl.parse( {images:this.post.images} ) );
}

ostudios_admin_PostAdmin.prototype.captureImageUpload = function( result )
{
	PopupManager.hideGlobalLoading();
	if ( this.post.images == "" ) {
		this.post.images = [];
	}
	this.post.images.push( result.result );
	
	RIA.log( this.post );	
	var tpl = new ostudios_admin_post_tpl_ImagePreview();	
	this.$('#imagePreview').html( tpl.parse( {images:this.post.images} ) );
}


ostudios_admin_PostAdmin.prototype.markitupsettings = {
	onShiftEnter:	{keepDefault:false, replaceWith:'<br />\n'},
	onCtrlEnter:	{keepDefault:false, openWith:'\n<p>', closeWith:'</p>\n'},
	onTab:			{keepDefault:false, openWith:'	 '},
	markupSet: [
		{name:'Heading 1', key:'1', openWith:'<h1(!( class="[![Class]!]")!)>', closeWith:'</h1>', placeHolder:'Your title here...' },
		{name:'Heading 2', key:'2', openWith:'<h2(!( class="[![Class]!]")!)>', closeWith:'</h2>', placeHolder:'Your title here...' },
		{name:'Heading 3', key:'3', openWith:'<h3(!( class="[![Class]!]")!)>', closeWith:'</h3>', placeHolder:'Your title here...' },
		{name:'Heading 4', key:'4', openWith:'<h4(!( class="[![Class]!]")!)>', closeWith:'</h4>', placeHolder:'Your title here...' },
		//{name:'Heading 5', key:'5', openWith:'<h5(!( class="[![Class]!]")!)>', closeWith:'</h5>', placeHolder:'Your title here...' },
		{name:'Quote', openWith:'<blockquote>', closeWith:'</blockquote>', placeHolder:'Your quote here...' },
		//{name:'Heading 6', key:'6', openWith:'<h6(!( class="[![Class]!]")!)>', closeWith:'</h6>', placeHolder:'Your title here...' },
		{name:'Code', openWith:'<pre class="prettyprint linenums">', closeWith:'</pre>', placeHolder:'Your code here...' },
		{name:'Paragraph', key:'P', openWith:'<p(!( class="[![Class]!]")!)>', closeWith:'</p>' },
		{separator:'---------------' },
		{name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
		{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
		{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
		{separator:'---------------' },
		{name:'Ul', openWith:'<ul>\n', closeWith:'\n</ul>\n' },
		{name:'Ol', openWith:'<ol>\n', closeWith:'\n</ol>\n' },
		{name:'Li', openWith:'	 <li>', closeWith:'</li>' },
		{separator:'---------------' },
		//{name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
		{name:'Link', key:'L', openWith:'<a href="[![Link:!:]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
		{name:'More', openWith:'<!-- pagebreak -->\n', closeWith:'' },
		{name:'Break', openWith:'<br />\n', closeWith:''
				,replaceWith:function(markitup) { return markitup.selection.replace(/\n/g, "<br />\n") } },
		//{name:'Break',replaceWith:function(markitup) { return markitup.selection.replace(/\n/g, "<br />") } },
		{separator:'---------------' },
		{name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },
		//{name:'Preview', className:'preview', call:'preview' }
	]
}


/*****************************
FILE: ostudios/admin/post/cmd/deletePostCMD    
*****************************/


function ostudios_admin_post_cmd_deletePostCMD ( )
{
	this.url = ostudios_Services.getServiceURL( 'delete_post' );
}

ostudios_admin_post_cmd_deletePostCMD.prototype = new ria_cmd_Command();
ostudios_admin_post_cmd_deletePostCMD.prototype.constructor = ostudios_admin_post_cmd_deletePostCMD;

ostudios_admin_post_cmd_deletePostCMD.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );
	
	this.scope.successfulDelete( results.result );
}







/*****************************
FILE: ostudios/admin/post/cmd/getPostCMD    
*****************************/


function ostudios_admin_post_cmd_getPostCMD ( )
{
}

ostudios_admin_post_cmd_getPostCMD.prototype = new ria_cmd_Command();
ostudios_admin_post_cmd_getPostCMD.prototype.constructor = ostudios_admin_post_cmd_getPostCMD;

ostudios_admin_post_cmd_getPostCMD.prototype.execute = function( data , scope , encodeArgs )
{
	this.url = ostudios_Services.getServiceURL( 'json_post' , data );
	ria_cmd_Command.prototype.execute.call( this , data , scope , encodeArgs );
}

ostudios_admin_post_cmd_getPostCMD.prototype.loadingStarted = function()
{
	//PopupManager.showGlobalLoading();
}

ostudios_admin_post_cmd_getPostCMD.prototype.loadingDone = function()
{
	//PopupManager.hideGlobalLoading();
}

ostudios_admin_post_cmd_getPostCMD.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );
	
	this.scope.renderForm( results.result.post , results.result.user_sites );
}







/*****************************
FILE: ostudios/admin/post/cmd/submitPostCMD    
*****************************/


function ostudios_admin_post_cmd_submitPostCMD ( )
{
	this.url = ostudios_Services.getServiceURL( 'submit_post' );
}

ostudios_admin_post_cmd_submitPostCMD.prototype = new ria_cmd_Command();
ostudios_admin_post_cmd_submitPostCMD.prototype.constructor = ostudios_admin_post_cmd_submitPostCMD;

ostudios_admin_post_cmd_submitPostCMD.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );
	
	this.scope.successfulSubmit( results.result );
}







/*****************************
FILE: ostudios/admin/post/cmd/uploadImageViaURLCMD    
*****************************/


function ostudios_admin_post_cmd_uploadImageViaURLCMD ( )
{
	this.url = ostudios_Services.getServiceURL( 'image_url_upload' );
}

ostudios_admin_post_cmd_uploadImageViaURLCMD.prototype = new ria_cmd_Command();
ostudios_admin_post_cmd_uploadImageViaURLCMD.prototype.constructor = ostudios_admin_post_cmd_uploadImageViaURLCMD;


ostudios_admin_post_cmd_uploadImageViaURLCMD.prototype.loadingStarted = function()
{
	PopupManager.showGlobalLoading();
}

ostudios_admin_post_cmd_uploadImageViaURLCMD.prototype.loadingDone = function()
{
	PopupManager.hideGlobalLoading();
}

ostudios_admin_post_cmd_uploadImageViaURLCMD.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );
	
	this.scope.captureImageUpload( results );
	this.scope.$("#imgURL").val("");
	//PopupManager.hideGlobalLoading();
	RIA.log( results );
}

ostudios_admin_post_cmd_uploadImageViaURLCMD.prototype.failure = function( status, errorThrown )
{
	this.scope.showError( errorThrown.details );
	RIA.log( status );
	RIA.log( errorThrown );
	PopupManager.hideGlobalLoading();
}





/*****************************
FILE: ostudios/admin/post/tpl/ImagePreview    
*****************************/


ostudios_admin_post_tpl_ImagePreview = function () {
	
	return new microtemplate_Template( '<#     for ( var i=0; i<images.length; i++ ) {  	var image = images[i];  #>  	<div class="image_preview">  	<#=   		Media.image( image.local_url   			, {width:30,height:30,clickaction:\'move_image\',clickvalue:image.id}   			, {minwidth:30,minheight:30}   		)   	#>  		<a href="#" onclick=\'RIA.preventDefault(event);\' clickaction="image_left" clickvalue="<#=image.id#>">&#60;</a>  		<a href="#" onclick=\'RIA.preventDefault(event);\' clickaction="image_delete" clickvalue="<#=image.id#>">x</a>  		<a href="#" onclick=\'RIA.preventDefault(event);\' clickaction="image_right" clickvalue="<#=image.id#>">&#62;</a>  	</div>  <#  }   #>' );	
	
}



/*****************************
FILE: ostudios/admin/post/tpl/PostAdmin    
*****************************/


ostudios_admin_post_tpl_PostAdmin = function () {
	
	return new microtemplate_Template( '<div class="postadmin" style="text-align: center;"> 	<div style="padding-top: 200px; height: 50px;">Loading...</div> </div>' );	
	
}



/*****************************
FILE: ostudios/admin/post/tpl/PostForm    
*****************************/


ostudios_admin_post_tpl_PostForm = function () {
	
	return new microtemplate_Template( ' <div class="postadmin"> 	<form id="postform" onsubmit="return RIA.onsubmit(event);"> 		<input id="id" name="id" type="hidden" value="<#= post.id #>" /> 		 		<div class="left_side"> 			<input id="title" name="title" value="<#= post.title #>" /><br /> 			<textarea id="body" name="body"><#  			if ( post.has_more_text == 1 ) {  				#><#= post.html_header + "<!-- pagebreak -->" + post.html_body #><#  			}else{  				#><#= post.html_all #><#  			}  			#></textarea> 		</div> 		 		<div class="right_side"> 			 			<div class="post_type"> 				<select name="post_view_type" id="post_view_type"> 					<option value="1" <# if (post.post_view_type==1) { #>selected="yes"<#}#>>Blog Layout</option> 					<option value="2" <# if (post.post_view_type==2) { #>selected="yes"<#}#>>Wiki Layout</option> 					<option value="3" <# if (post.post_view_type==3) { #>selected="yes"<#}#>>Full Image Layout</option> 					<option value="4" <# if (post.post_view_type==4) { #>selected="yes"<#}#>>Update Layout</option> 				</select>				 				<div class="private_box"> 					<input type="checkbox" id="is_private" name="is_private" <# if ( parseInt( post.is_private ) == 1 ) { #>checked="true"<# } #>" /> 					<label for="is_private">Private</label><br /> 				</div>					 			</div> 			<div class="clear"></div> 			 			<div class="tags"> 				<div class="tags_row"> 					<label for="tags">Tags:</label> 					<textarea id="tags_string" name="tags_string"><#= post.tags_string #></textarea> 				</div> 				<div class="tags_row"> 					<label for="list_tags">List Tags</label> 					<input id="list_tags" name="list_tags" value="<#= post.list_tags #>" /><br /> 				</div> 			</div> 			 			<div class="dates"> 				<div class="date_row"> 					<label for="post_date">Published:</label> 					<input id="post_date" name="post_date" value="<#= PHP.date( "n/j/Y g:i A" , post.post_date ) #>" /> 				</div> 				<div class="date_row"> 					<label for="start_date">Start:</label> 					<input id="start_date" name="start_date" value="<#= PHP.date( "n/j/Y g:i A" , post.start_date ) #>" /> 				</div> 				<div class="date_row">	 					<label for="end_date">End:</label> 					<div clickaction="end_now" class="button end_date_now">now</div> 					<input id="end_date" name="end_date" value="<# if ( post.end_is_now == 1 ) {  							#>today<#  						}else if ( post.end_date != 0 ) {  							#><#= PHP.date( "n/j/Y g:i A" , post.end_date ) #><# 			 						}else{  							#>ends on start date<#  						} #>" />					 				</div> 			</div> 			 			<div class="image_box"> 				<div id="selectImage"></div> 				<div id="inputImgURL"> 					<input id="imgURL" name="imgURL" /> 					<a href="#" onclick=\'RIA.preventDefault(event);\' clickaction="imgURL">go</a> 				</div> 			</div> 			 			<div class="imagePreviewBox"> 				<div id="imagePreview"></div> 			</div> 			 			<div class="sites_box"> 				<label for="sites">Sites:</label> 				<select multiple="yes" size="6" id="sites" name="sites"> 					<#  						var postSiteLookup = []; 						for ( var a=0; a<post.sites.length; a++ ) { 							var postSite = post.sites[a]; 							postSiteLookup[ postSite.id ] = true; 						} 						 						for ( var i=0; i<user_sites.length; i++ ) {  							var site = user_sites[i]; 					#> 							<option value="<#= site.id #>" <#  								if ( postSiteLookup[ site.id ] === true ) {  							#> selected="yes"<#  								} #>><#= site.title #></option> 					<# } #> 				</select> 			</div> 			 			<div class="submit_nav"> 				<div class="button delete_button" clickaction="delete_post">delete</div> 							 				<input type="submit" value="Save" /> 				<input clickaction="closewindow" type="reset" value="Cancel" />	 			</div> 				 		</div>		 	</form> </div>' );	
	
}



/*****************************
FILE: ostudios/admin/post/tpl/QuickEdit    
*****************************/


ostudios_admin_post_tpl_QuickEdit = function () {
	
	return new microtemplate_Template( ' <div class="postadmin"> 	<form id="postform" onsubmit="return RIA.onsubmit(event);"> 		<input id="id" name="id" type="hidden" value="<#= post.id #>" /> 		 		<div class="left_side"> 			<input id="title" name="title" value="<#= post.title #>" /><br /> 			<textarea id="body" name="body"> 			<# if ( post.has_more_text ) { #> 				<#= post.html_header + "<!-- pagebreak -->" + post.html_body #> 			<# }else{ #> 				<#= post.html_all #> 			<# } #> 			</textarea> 			 			<input type="reset" value="Cancel" /><input type="submit" value="Save" /> 		</div>		 	</form> </div>' );	
	
}



/*****************************
FILE: ostudios/admin/post/tpl/success    
*****************************/


ostudios_admin_post_tpl_success = function () {
	
	return new microtemplate_Template( '  <div class="postadmin" style="text-align: center;">  	<div style="padding-top: 200px; height: 50px;">Successful update. <br />  		Would you like to <a href="<#= postUrl #>">go to post\'s page</a>  	, <a href="#" onclick="Router.reload(); RIA.preventDefault(event);" clickaction="closewindow">refresh</a>?</div>  </div>  ' );	
	
}



/*****************************
FILE: ostudios/admin/root/OStudiosAdmin    
*****************************/


function ostudios_OStudiosAdmin ( element )
{
	ria_Component.call( this , element );
}

ostudios_OStudiosAdmin.prototype = new ria_Component();
ostudios_OStudiosAdmin.prototype.constructor = ostudios_OStudiosAdmin;

ostudios_OStudiosAdmin.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
		case "alertme" :
			break;
	}
}



/*****************************
FILE: ostudios/admin/toolbar/ToolBar    
*****************************/


function ostudios_admin_toolbar_ToolBar ( element )
{
	ria_Component.call( this , element );
	this.tagsStr = this.jsdata.tags;
	this.tags = this.tagsStr.split("_");
	
	var me = this;
	
	$(window).unbind("scroll");//should only be one going...
	$(window).scroll(function(e){ me.onScroll(e) });
}

ostudios_admin_toolbar_ToolBar.prototype = new ria_Component();
ostudios_admin_toolbar_ToolBar.prototype.constructor = ostudios_admin_toolbar_ToolBar;

ostudios_admin_toolbar_ToolBar.prototype.is_floating = false;

ostudios_admin_toolbar_ToolBar.prototype.onScroll = function(evt)
{
	//this.$(".output").html($(window).scrollTop());
	var offset = this.element.offset();

	if( $(window).scrollTop() > offset.top ) { //180 ) {
		if ( this.is_floating == false ) {
			this.$(".content").css("position","fixed");
			//this.$(".content").width(this.element.width());
			this.$(".content").addClass("floating");
		}
		this.is_floating = true;
		//this.$(".content").css("top",$(window).scrollTop() + "px");
	}else{
		if ( this.is_floating == true ) {
			this.$(".content").css("position","static");
			this.$(".content").removeClass("floating");
		}
		this.is_floating = false;
	}
}

ostudios_admin_toolbar_ToolBar.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
		case "toolbar_quick_link" :
			var quicktpl = new ostudios_admin_toolbar_tpl_QuickLink();
			this.listenToElementClick( PopupManager.createModalWindow( quicktpl.parse({}) , "Quick Link" ) );
			event.stopPropagation();
			break;
		case "toolbar_quick_log" :
			this.post = new ostudios_vo_postvo();
			this.post.title = this.processTagToSlug(this.tags) + "Log " + PHP.date( "n/j/Y" , new Date() );//title;
			
			this.post.has_more_text = false;//this.post.html_body.length > 0;			
			this.post.is_private = true;//( newPost.is_private == "on" );
			
			//post date
			this.post.post_date = PHP.strtotime( PHP.date( "F j, Y g:i A" , new Date() ) );//PHP.strtotime( newPost.post_date );
			this.post.start_date = PHP.strtotime( PHP.date( "F j, Y g:i A" , new Date() ) );//PHP.strtotime( newPost.start_date );
			this.post.end_date = 0;
			this.post.end_is_now = 1;
			
			//tags
			this.tags.push("log");
			if ( this.tags.length > 1 ) {
				this.post.tags_string = this.tags.join(",");//newPost.tags_string;			
			}else if ( this.tags.length > 0 ){
				this.post.tags_string = this.tags[0];//newPost.tags_string;
			}
			this.post.post_view_type = 4;//newPost.post_view_type;
			this.post.sites = ostudios_OStudios.site_id;
			//images
			//nada..already in there..
			
			var cmd = new ostudios_admin_post_cmd_submitPostCMD();
			cmd.execute( {post:this.post} , this , true );
			event.stopPropagation();
			break;
		case "toolbar_add" :
			event.stopPropagation();
			break;
		case "toolbar_quick_link" :
			event.stopPropagation();
			break;	
			
		case "cancel" :
			//var addBtnsTpl = new ostudios_admin_toolbar_tpl_AddButtonsView();
			//this.$('.quickadd').html( addBtnsTpl.parse({tags:this.tags}) );
			this.$('.quickadd').show();
			this.$('.quicklinkform').hide();
			event.stopPropagation();
			break;
	}
}

ostudios_admin_toolbar_ToolBar.prototype.createLinkPost = function( link )
{
	this.post = new ostudios_vo_postvo();
	this.post.title = link.title;//title;

	this.post.html_header = "";//bodySplit.shift();
	this.post.html_body = "";//bodySplit.join("");
	this.post.html_all = "<blockquote>" + link.body + "</blockquote>";//this.post.html_header + this.post.html_body;
	this.post.has_more_text = false;//this.post.html_body.length > 0;
	
	this.post.is_private = false;//( newPost.is_private == "on" );
	
	//post date
	this.post.post_date = PHP.strtotime( PHP.date( "F j, Y g:i A" , new Date() ) );//PHP.strtotime( newPost.post_date );
	this.post.start_date = PHP.strtotime( PHP.date( "F j, Y g:i A" , new Date() ) );//PHP.strtotime( newPost.start_date );

	//tags
	if ( this.tags.length > 1 ) {
		this.post.tags_string = this.tags.join(",");//newPost.tags_string;			
	}else if ( this.tags.length > 0 ){
		this.post.tags_string = this.tags[0];//newPost.tags_string;
	}		
	this.post.post_view_type = 4;//newPost.post_view_type;
	
	this.post.sites = ostudios_OStudios.site_id;

	//images
	//nada..already in there..
	
	var cmd = new ostudios_admin_post_cmd_submitPostCMD();
	cmd.execute( {post:this.post} , this , true );
}

ostudios_admin_toolbar_ToolBar.prototype.onSubmit = function( formid , event )
{
	switch ( formid ) {
		
		case "quick_link_add_form" :
			var info = RIA.getAssocFormData( $(event.target) );
			var cmd = new ostudios_toolbar_cmd_GetPageInfoCMD();
			cmd.execute( {url:info.url} , this , true );
			break;
	
		case "quickadd_form" :
			var newPost = RIA.getAssocFormData( $(event.target) );
			
			this.post = new ostudios_vo_postvo();
			this.post.title = newPost.title;//title;
			
			//var bodySplit = newPost.body.split("<!-- pagebreak -->");
			
			this.post.html_header = newPost.body;//bodySplit.shift();
			this.post.html_body = "";//bodySplit.join("");
			this.post.html_all = newPost.body;//this.post.html_header + this.post.html_body;
			this.post.has_more_text = false;//this.post.html_body.length > 0;
			
			this.post.is_private = true;//( newPost.is_private == "on" );
			
			//post date
			this.post.post_date = PHP.strtotime( PHP.date( "F j, Y g:i A" , new Date() ) );//PHP.strtotime( newPost.post_date );
			this.post.start_date = PHP.strtotime( PHP.date( "F j, Y g:i A" , new Date() ) );//PHP.strtotime( newPost.start_date );

			//tags
			if ( this.tags.length > 1 ) {
				this.post.tags_string = this.tags.join(",");//newPost.tags_string;			
			}else if ( this.tags.length > 0 ){
				this.post.tags_string = this.tags[0];//newPost.tags_string;
			}		
			this.post.post_view_type = 4;//newPost.post_view_type;
			
			this.post.sites = ostudios_OStudios.site_id;

			//images
			//nada..already in there..
			
			var cmd = new ostudios_admin_post_cmd_submitPostCMD();
			cmd.execute( {post:this.post} , this , true );
			break;
	}
}

ostudios_admin_toolbar_ToolBar.prototype.processTagToSlug = function( tags ){
	var slug = "";
	if ( tags.length > 1 ) {
		slug = tags.join(" ");//newPost.tags_string;			
	}else if ( tags.length > 0 ){
		slug = tags[0];//newPost.tags_string;
	}else {
		return "";
	}
	slug = slug.replace( /-/g , " " );
	slug += " ";
	return slug.toLowerCase().replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
}



ostudios_admin_toolbar_ToolBar.prototype.successfulSubmit = function ( result ) {
	PopupManager.showGlobalLoading();
	window.location.reload();
}



/*****************************
FILE: ostudios/admin/toolbar/cmd/GetPageInfoCMD    
*****************************/


function ostudios_toolbar_cmd_GetPageInfoCMD ( )
{
	
}

ostudios_toolbar_cmd_GetPageInfoCMD.prototype = new ria_cmd_Command();
ostudios_toolbar_cmd_GetPageInfoCMD.prototype.constructor = ostudios_toolbar_cmd_GetPageInfoCMD;

ostudios_toolbar_cmd_GetPageInfoCMD.prototype.execute = function( data , scope , encodeArgs )
{
	this.url = ostudios_Services.getServiceURL( 'get_page_info' , data );
	ria_cmd_Command.prototype.execute.call( this , data , scope , encodeArgs );
}


ostudios_toolbar_cmd_GetPageInfoCMD.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );	
	this.scope.createLinkPost( results.result );
}







/*****************************
FILE: ostudios/admin/toolbar/tpl/QuickLink    
*****************************/


ostudios_admin_toolbar_tpl_QuickLink = function () {
	
	return new microtemplate_Template( '  <div class="quicklinkform"> 	<form id="quick_link_add_form" onsubmit="return RIA.onsubmit(event);"> 		<input id="url" name="url" /> 		<div class="nav"> 			<a href="#" onclick="return RIA.onsubmit(event);" 				class="toolbar_button">submit</a><input type="submit" class="hidden" /> 			<a href="#" onclick="return false" clickaction="cancel" 				class="toolbar_button">cancel</a> 		</div> 	</form> </div>' );	
	
}



/*****************************
FILE: ostudios/contact/Contact    
*****************************/


function ostudios_contact_Contact ( element )
{
	ria_Component.call( this , element );
	
	var me = this;
	this.$("#email").focus( function() { me.$("#email").removeClass( "invalid_input" ); });
	this.$("#email").change( function() { me.$("#email").removeClass( "invalid_input" ); });
}

ostudios_contact_Contact.prototype = new ria_Component();
ostudios_contact_Contact.prototype.constructor = ostudios_contact_Contact;

ostudios_contact_Contact.prototype.onSubmit = function( formid , event )
{
	switch ( formid ) {
		case "contact_form" :
			var info = RIA.getAssocFormData( this.$("#contact_form") );
			
			if ( Validate.email( info.email ) ) {
				var cmd = new ostudios_contact_cmd_ContactCMD();
				cmd.execute( info , this );
			}else{
				//invalid
				this.$("#email").fadeOut(0);
				this.$("#email").fadeIn('slow');
				this.$("#email").addClass( "invalid_input" );
			}	
			
			break;
	
	}
}

ostudios_contact_Contact.prototype.emailSent = function( results )
{
	//alert("emailSendt");
	this.$("#contact_form")[0].reset();
}


/*****************************
FILE: ostudios/contact/cmd/ContactCMD    
*****************************/


function ostudios_contact_cmd_ContactCMD ( )
{
	
}

ostudios_contact_cmd_ContactCMD.prototype = new ria_cmd_Command();
ostudios_contact_cmd_ContactCMD.prototype.constructor = ostudios_contact_cmd_ContactCMD;

ostudios_contact_cmd_ContactCMD.prototype.execute = function( data , scope , encodeArgs )
{
	this.url = ostudios_Services.getServiceURL( 'contact_email' , data );
	ria_cmd_Command.prototype.execute.call( this , data , scope , encodeArgs );
}

ostudios_contact_cmd_ContactCMD.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );	
	this.scope.emailSent( results.result );
}






/*****************************
FILE: ostudios/post/Post    
*****************************/


function ostudios_Post ( element )
{
	ria_Component.call( this , element );

	this.id = this.jsdata.id;
	this.is_open = this.jsdata.is_open;
	prettyPrint();
}

ostudios_Post.prototype = new ria_Component();
ostudios_Post.prototype.constructor = ostudios_Post;

ostudios_Post.prototype.id;

ostudios_Post.prototype.onClick = function( action , value , event )
{
	switch ( action ) {		
		case "changePicture" :
			this.$('.full_image').hide();
			this.$('#' + value ).show();
			$(event.target).blur();
			break;
		case "openPostDetail" :
			alert("Don't use openPostDetail");
			//this.openPost();
			event.stopPropagation();
			break;
		case "closePostDetail" :
			alert("Don't use closePostDetail");
			//this.closePost();
			//event.stopPropagation();
			break;
	}
}
ostudios_Post.prototype.onBounce = function( action , value , event )
{
	switch ( action ) {
		case "router_state_change" :
			var route = value;
			if ( $.inArray( this.id , route.open_posts ) != -1 ) {
				this.openPost();
			}else{
				this.closePost();
			}
			break;
	}
}

ostudios_Post.prototype.openPost = function()
{
	if ( !this.is_open ) {
		
		var cachestr = "inline||" + this.jsdata.slug;
		var cachedHTML = $.jCache.getItem( cachestr );
		if ( cachedHTML ) {
			this.renderDetails( cachedHTML , false );
			this.is_open = true;
			return;
		}		
		
		//this.$(".more").html( "loading... " );
		this.$(".loading_more").show();
		
		this.$(".loader").css('display','block');
		this.$('[clickaction|="openPostDetail"]').attr("clickaction" , "nothing" );
		
		var cmd = new ostudios_Post_cmd_GetPostDetailsCommand();
		cmd.execute( {"tags":this.jsdata.slug} , this );
		this.is_open = true;
	}
}

ostudios_Post.prototype.closePost = function()
{
	if ( this.is_open ) {
		var me = this;

		this.$(".loader").css('display','none');
		this.$(".list_post_detail_content_content").fadeOut(400 , function() {
			me.$(".list_post_content").fadeIn(0);
			me.$(".list_post_content_content").fadeIn(0);
			me.$(".list_post_detail_content_content").html("");
			me.$('[clickaction|="closePostDetail"]').attr("clickaction" , "openPostDetail");
			
			//me.$(".more").html('');
			me.$(".loading_more").hide();
			//me.$(".thumb").show();
			
			//allposts
			me.$("#header").removeClass("openheader");
			me.$("#header").addClass("header");
		});
		this.is_open = false;
	}
}

ostudios_Post.prototype.renderDetails = function( postsegment , cacheContent )
{
	if ( cacheContent ) {
		var cachestr = "inline||" + this.jsdata.slug;
		$.jCache.setItem( cachestr , postsegment );
	}
	
	if ( window['_gaq'] ) {
		_gaq.push(['_trackPageview'
		    , ostudios_Post_cmd_GetPostDetailsCommand.getURL( {"tags":this.jsdata.slug} ) ]);
	}
	
	//var tpl = new ostudios_post_tpl_PostDetail();	
	this.$(".list_post_detail_content_content").fadeOut(0);

	var me = this;
	this.$(".list_post_content_content").fadeOut(400 , function() {
		me.$(".list_post_content").fadeOut(0);
		me.$(".list_post_detail_content_content").html( postsegment.html );
		prettyPrint();
		//me.$(".thumb").hide();
		me.$(".list_post_detail_content_content").fadeIn(400);
		me.$('[clickaction|="openPostDetail"]').attr("clickaction" , "closePostDetail");
		me.$('[clickaction|="nothing"]').attr("clickaction" , "closePostDetail" );
		me.$(".loader").css('display','none');
		
		//me.$(".more").html('');// '<div clickaction="closePostDetail" style="cursor:hand;cursor:pointer">less...</a>' );
		me.$(".loading_more").hide();
		
		//allposts
		me.$("#header").removeClass("header");
		me.$("#header").addClass("openheader");
		
		RIA.createComponents();
	});

}


/*****************************
FILE: ostudios/post/cmd/GetPostDetailsCommand    
*****************************/


function ostudios_Post_cmd_GetPostDetailsCommand ( )
{
	
}

ostudios_Post_cmd_GetPostDetailsCommand.prototype = new ria_cmd_Command();
ostudios_Post_cmd_GetPostDetailsCommand.prototype.constructor = ostudios_Post_cmd_GetPostDetailsCommand;

ostudios_Post_cmd_GetPostDetailsCommand.prototype.execute = function( data , scope , encodeArgs )
{
	this.url = ostudios_Post_cmd_GetPostDetailsCommand.getURL ( data );

	ria_cmd_Command.prototype.execute.call( this , data , scope , encodeArgs );
}

ostudios_Post_cmd_GetPostDetailsCommand.getURL = function( data )
{
	return ostudios_Services.getServiceURL( 'jsonhtml_simple_post_details' , data );
}


ostudios_Post_cmd_GetPostDetailsCommand.prototype.loadingStarted = function()
{
	//PopupManager.showGlobalLoading();
}

ostudios_Post_cmd_GetPostDetailsCommand.prototype.loadingDone = function()
{
	//PopupManager.hideGlobalLoading();
}

ostudios_Post_cmd_GetPostDetailsCommand.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );	
	this.scope.renderDetails( results.result , true );
}

ostudios_Post_cmd_GetPostDetailsCommand.prototype.failure = function( status, errorThrown )
{
	RIA.log( errorThrown );
	//PopupManager.hideGlobalLoading();
	//ria_cmd_Command.prototype.failure.call( this, status, errorThrown );
}





/*****************************
FILE: ostudios/postpage/PostPage    
*****************************/


function ostudios_PostPage ( element )
{
	ria_Component.call( this , element );
	
	this.page_num = this.jsdata.page_num;//different than list_index which is zero indexd
}

ostudios_PostPage.prototype = new ria_Component();
ostudios_PostPage.prototype.constructor = ostudios_PostPage;

ostudios_PostPage.prototype.is_open = false;

ostudios_PostPage.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
	}
}

ostudios_PostPage.prototype.onBounce = function( action , value , event )
{
	switch ( action ) {
		case "router_state_change" :
			var route = value;
			if ( $.inArray( this.page_num , route.open_page ) != -1 ) {
				this.openList();
			}else{
				this.closeList();
			}
			break;
	}
}

ostudios_PostPage.prototype.openList = function()
{
	if ( !this.is_open ) {
		var cmd = new ostudios_postpage_cmd_GetPostPageDetailsCommand();
		this.$(".loading_more").show();
		
		cmd.execute( {
			 "open_page":this.jsdata.page_num
			,"tags":this.jsdata.tags
			,"content_type":this.jsdata.list_type
		} , this );		
		
		this.is_open = true;
	}
	//$(event.target).blur();
}

ostudios_PostPage.prototype.closeList = function()
{
	if ( this.is_open ) {
		this.$('.page_content').html( "" );
		this.$(".click_to_close").hide();
		this.$(".click_to_open").show();
	
		this.is_open = false;
	}
	//$(event.target).blur();
}
	
ostudios_PostPage.prototype.renderDetails = function( postsegment )
{
	if ( window['_gaq'] ) {
		_gaq.push(['_trackPageview'
		        , ostudios_postpage_cmd_GetPostPageDetailsCommand.getURL( {
		  			 "open_page":this.jsdata.page_num
		 			,"tags":this.jsdata.tags
		 			,"content_type":this.jsdata.list_type
		 		} ) 
		 ]);
	}
	
	this.$(".click_to_close").show();
	this.$(".click_to_open").hide();
	
	this.$('.page_content').html( postsegment.html );
	
	this.$(".loading_more").hide();
	
	this.$('[clickaction|="openDetail"]').attr("clickaction" , "closePageDetail");
	this.$('[clickaction|="nothing"]').attr("clickaction" , "closePageDetail" );
	
	RIA.createComponents();
}


/*****************************
FILE: ostudios/postpage/cmd/GetPostPageDetailsCommand    
*****************************/


function ostudios_postpage_cmd_GetPostPageDetailsCommand ( )
{
	
}

ostudios_postpage_cmd_GetPostPageDetailsCommand.prototype = new ria_cmd_Command();
ostudios_postpage_cmd_GetPostPageDetailsCommand.prototype.constructor = ostudios_postpage_cmd_GetPostPageDetailsCommand;

ostudios_postpage_cmd_GetPostPageDetailsCommand.prototype.execute = function( data , scope , encodeArgs )
{
	this.url = ostudios_postpage_cmd_GetPostPageDetailsCommand.getURL( data );
	ria_cmd_Command.prototype.execute.call( this , data , scope , encodeArgs );
}


ostudios_postpage_cmd_GetPostPageDetailsCommand.getURL = function( data )
{
	return ostudios_Services.getServiceURL( 'jsonhtml_list' , data );
}

ostudios_postpage_cmd_GetPostPageDetailsCommand.prototype.loadingStarted = function()
{

}

ostudios_postpage_cmd_GetPostPageDetailsCommand.prototype.loadingDone = function()
{

}

ostudios_postpage_cmd_GetPostPageDetailsCommand.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );
	
	this.scope.renderDetails( results.result );
}

ostudios_postpage_cmd_GetPostPageDetailsCommand.prototype.failure = function( status, errorThrown )
{
	
	//PopupManager.hideGlobalLoading();
	//ria_cmd_Command.prototype.failure.call( this, status, errorThrown );
}





/*****************************
FILE: ostudios/root/OStudios    
*****************************/


function ostudios_OStudios ( element )
{
	ria_Component.call( this , element );

	ostudios_OStudios.user_sites = this.jsdata.user_sites;
	ostudios_OStudios.site_id = this.jsdata.site_id;
	
	this.router = new ostudios_Router( this );
	//this.router.start();
	
}

ostudios_OStudios.prototype = new ria_Component();
ostudios_OStudios.prototype.constructor = ostudios_OStudios;

//Static info
ostudios_OStudios.user_sites = [];

ostudios_OStudios.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
		case "statechange" :
			if ( ostudios_Services.route_level != "core" ) {
				var vals = RIA.deserializeJSData( value );
				RIA.preventDefault(event);	
				this.router.statechange( vals.state_action , vals.core_link , vals.post_id );
			}
			break;
		case "renderTimeline" :
			this.bounceEvent(action,value);
			break;
		case "login" :
			var tpl = new ostudios_admin_login_tpl_loginview();
			var loginpopup = PopupManager.createModalWindow( 
				 tpl.parse({}) 
				,"Login/Join" 
				,true 
			); 
			RIA.createComponents();
			break;
		case "logout" :
			$(event.target).html("<span style='font-size:12px; font-style:italic;'>loading...</span>");
			$(event.target).blur();
			
			var cmd = new ostudios_admin_login_cmd_LogoutCMD();
			cmd.execute({},this);
			break;
		case "newPost" :
			//RIA.log( value );
			var loginpopup = PopupManager.createModalWindowComponentTag( 
				 "New Post"
				,true
				,"ostudios_admin_PostAdmin"
				,( value ) ? RIA.deserializeJSData(value) : {}
			); 
			break;
		case "editpost" :
			var loginpopup = PopupManager.createModalWindowComponentTag( 
				 "Edit Post"
				,true
				,"ostudios_admin_PostAdmin"
				,{slug:value}
			); 
			break;
		case "openPostDetail" :
		case "openPageDetail" :
			var target = $(event.target);
			RIA.createLazyComponents( target );
			
			target.click();
			break;
	}
}


OStudios = function() {};


// onclick="return OStudios.click('post','<?php echo $post->slug; ?>')"
OStudios.click = function ( pageType , tags , open_page ) {
	var cmd = new ostudios_root_cmd_LoadPageCMD();
	cmd.url = "/postsegment/"+pageType+"/"+tags+"/jsonhtml/0/" + open_page;
	cmd.execute( {} , this );
	document.location += "#" + tags;
	return false;
}
OStudios.renderPage = function ( pageHTML ) {
	RIA.log( pageHTML );
	//root_content
	
	$('#root_content').html( pageHTML );
}

OStudios.link = function ( action , action_obj , content , atts ) {
	
}




/*****************************
FILE: ostudios/root/cmd/LoadPageCMD    
*****************************/


function ostudios_root_cmd_LoadPageCMD ( )
{
	this.url = ostudios_Services.getServiceURL( 'ajax' );
}

ostudios_root_cmd_LoadPageCMD.prototype = new ria_cmd_Command();
ostudios_root_cmd_LoadPageCMD.prototype.constructor = ostudios_root_cmd_LoadPageCMD;

/*
 * Triggered each time a service starts loading 
 * */
ostudios_root_cmd_LoadPageCMD.prototype.loadingStarted = function()
{
 	var loadingClass = ostudios_Services.theme + "loadingview";
	var loadingtpl = new window[loadingClass]();
	$("#root_content").html( loadingtpl.parse({}) );
}

/*
 * Triggered when a service is done loading regardless of success/failure
 * */
ostudios_root_cmd_LoadPageCMD.prototype.loadingDone = function()
{
	//PopupManager.hideGlobalLoading();
}

ostudios_root_cmd_LoadPageCMD.prototype.execute = function( data , scope , encodeArgs )
{
	this.route = data.route;
	
	/*
	 * Doesn't capture cache..
	 * if ( window['_gaq'] ) {
		_gaq.push(['_trackPageview', data.route]);
	}*/
	
	ria_cmd_Command.prototype.execute.call( this , data , scope , encodeArgs );
}

ostudios_root_cmd_LoadPageCMD.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );	
	this.scope.renderPage( this.route , results.result.html );
}





/*****************************
FILE: ostudios/search/Search    
*****************************/



function ostudios_search_Search ( element )
{
	ria_Component.call( this , element );
	
	var tpl = new ostudios_search_tpl_SearchView();
	this.element.html( tpl.parse({}) );
	
	var me = this;
	this.$('#titlesearch').keyup( function(event) { me.onSearchKeyUp(event) } );
	this.$('#titlesearch').focus( function() { me.onSearchFocus() } );
	this.$('#titlesearch').blur( function() { me.onSearchBlur() } );
}

ostudios_search_Search.prototype = new ria_Component();
ostudios_search_Search.prototype.constructor = ostudios_search_Search;

ostudios_search_Search.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
		case "searchresultover" :
			this.$('.searchresult').removeClass("over");
			$(event.target).addClass('over');
			this.resultsIndex = value;
			event.stopPropagation();
			break;
		case "searchresultclicked" :
			this.resultsIndex = value;
			Router.loadPost( this.searchResults[value].slug );
			event.stopPropagation();
			this.onSearchBlurWorker();
			break;
		case "clearsearch" :
			this.$('#titlesearch').val("");
			this.$('#titlesearch').focus();
			event.stopPropagation();
			break;			
	}
}

ostudios_search_Search.prototype.is_searching = false;
ostudios_search_Search.prototype.onSearchKeyUp = function(event)
{
	switch ( event.keyCode ) {
		case 38 : //up
			var newResultsIndex = ( this.resultsIndex-1 < 0 ) ? this.searchResults.length-1 : this.resultsIndex-1;
			this.highlightFocus ( newResultsIndex );
			return false;
			break;
		case 40 : //down
			var newResultsIndex = ( this.resultsIndex+1 >= this.searchResults.length ) ? 0 : this.resultsIndex+1;
			this.highlightFocus ( newResultsIndex );
			return false;
			break;
		case 13 ://return
			Router.loadPost( this.searchResults[this.resultsIndex].slug );
			this.onSearchBlurWorker();
			return false;
			break;
		default :
			this.search();
			return true;
			break;
	}
	event.stopPropagation();
}
ostudios_search_Search.prototype.search = function()
{	
	//redundant it missed.
	this.$('.searchlabel').hide();
	if ( !this.is_searching ) {
		var val = this.$('#titlesearch').val();
		if ( !this.searchCache[ val ] ) {
			if ( val.length > 0 ) {
				this.is_searching = true;
				var cmd = new ostudios_search_cmd_SearchTitleCommand();
				cmd.searchString = val;
				cmd.execute( {searchstr:val} , this );
			}else{
				this.$("#search_results").html("");
			}
		}else{
			this.renderSearch( this.searchCache[ val ] );
		}
	}
}

ostudios_search_Search.prototype.highlightFocus = function(index)
{
	this.resultsIndex = index;
	
	this.$('.searchresult').removeClass("over");
	this.$('#searchresult_' + this.resultsIndex).addClass('over');
}

ostudios_search_Search.prototype.searchCache = {};
ostudios_search_Search.prototype.searchResults = [];
ostudios_search_Search.prototype.resultsIndex = 0;
ostudios_search_Search.prototype.onSearchResult = function( posts , searchStr )
{
	this.searchCache[ searchStr ] = posts;	
	this.is_searching = false;
	this.search();//should try for the last search...
}

ostudios_search_Search.prototype.renderSearch = function( posts )
{
	this.searchResults = posts;
	
	var tpl = new ostudios_search_tpl_SearchResults();
	this.$("#search_results").html( tpl.parse({results:posts}) );
	this.$("#search_results").css( "visibility" ,"visible" );
	
	this.highlightFocus( 0 );
}

ostudios_search_Search.prototype.onSearchFocus = function()
{
	this.$('.searchlabel').hide();
	this.search();
}

ostudios_search_Search.prototype.onSearchBlur = function () {
	var me = this;
	if(this.$('#titlesearch').val().length == 0 )
		this.$('.searchlabel').show();
	setTimeout ( function() { me.onSearchBlurWorker(); }, 500 );
}

ostudios_search_Search.prototype.onSearchBlurWorker = function () {
	this.$("#search_results").css( "visibility" ,"hidden" );
	//this.$('#titlesearch').blur();	
}




/*****************************
FILE: ostudios/search/cmd/SearchTitleCommand    
*****************************/


function ostudios_search_cmd_SearchTitleCommand ( )
{
	this.url = '/api/post/searchtitles';
}

ostudios_search_cmd_SearchTitleCommand.prototype = new ria_cmd_Command();
ostudios_search_cmd_SearchTitleCommand.prototype.constructor = ostudios_search_cmd_SearchTitleCommand;

ostudios_search_cmd_SearchTitleCommand.prototype.searchString;
ostudios_search_cmd_SearchTitleCommand.prototype.loadingStarted = function()
{
	//PopupManager.showGlobalLoading();
}

ostudios_search_cmd_SearchTitleCommand.prototype.loadingDone = function()
{
	//PopupManager.hideGlobalLoading();
}

ostudios_search_cmd_SearchTitleCommand.prototype.success = function( results, status )
{
	ria_cmd_Command.prototype.success.call( this, results, status );
	
	this.scope.onSearchResult( results.result , this.searchString );
}






/*****************************
FILE: ostudios/search/tpl/SearchResults    
*****************************/


ostudios_search_tpl_SearchResults = function () {
	
	return new microtemplate_Template( '  <div class="search_results_header"></div> <div class="search_results_body"><div><#  for ( var i=0; i<results.length; i++ ) {  	var result = results[i]; #>  	<div class="searchresult" id="searchresult_<#=i#>" clickaction="searchresultclicked"  		onmouseover="RIA.triggerClick($(event.target),\'searchresultover\',<#= i #>)" 		clickvalue="<#= i #>"><#= result.title #></div>  <# } #></div></div> <div class="search_results_footer"></div>' );	
	
}



/*****************************
FILE: ostudios/search/tpl/SearchView    
*****************************/


ostudios_search_tpl_SearchView = function () {
	
	return new microtemplate_Template( '<div class="search"> 	<div class="searchlabel">search</div> 	<input id=\'titlesearch\' name=\'titlesearch\' spellcheck=\'false\' 		onkeydown="if(event.keyCode==38){ return false; }" /> 	<div id=\'clearsearch\' clickaction="clearsearch"></div> </div>  <div id="search_results"></div>' );	
	
}



/*****************************
FILE: octopikidstheme/loadingview    
*****************************/


octopikidstheme_loadingview = function () {
	
	return new microtemplate_Template( '  <div class="root loading tk-museo-slab-local wf-loading">  </div>' );	
	
}



/*****************************
FILE: simile/Timeline    
*****************************/


function simile_Timeline ( element )
{
	ria_Component.call( this , element );

	this.events = this.jsdata;
	this.startDate = this.jsdata.startDate;
	this.render(
		 this.jsdata.topDisplaySpan
		,this.jsdata.topSize
		,this.jsdata.bottomDisplaySpan
		,this.jsdata.bottomSize
	);	
	
	//turn off scrolling hack...
	Timeline._Band.prototype._onMouseScroll = function(innerFrame, evt, target) {};
}

simile_Timeline.prototype = new ria_Component();
simile_Timeline.prototype.constructor = simile_Timeline;

simile_Timeline.prototype.eventSource;
simile_Timeline.prototype.timeline;
simile_Timeline.prototype.data;

simile_Timeline.prototype.render = function ( topSpan , topSize , bottomSpan , bottomSize ) {
	this.eventSource = new Timeline.DefaultEventSource();
	var bandInfos = [
	    Timeline.createBandInfo({
	    	eventSource:    this.eventSource,	        
	        width:          "80%",
	        date:           this.startDate,
	        intervalUnit:   Timeline.DateTime[topSpan],//.DAY,//MONTH,
	        intervalPixels: topSize//200
	    }),
	    Timeline.createBandInfo({
	        eventSource:    this.eventSource,	        
	        width:          "20%",
	        overview:       true,
	        date:           this.startDate,
	        intervalUnit:   Timeline.DateTime[bottomSpan],//.DAY,
	        intervalPixels: bottomSize//50,
	        
	    })
	];
	bandInfos[1].syncWith = 0;
	bandInfos[1].highlight = true;
	
	this.timeline = Timeline.create( this.$('#timeline')[0] , bandInfos );
	this.eventSource.loadJSON( this.events , "http://www.octopistudios.com/" );
	  
	this.listenToResize();
}

simile_Timeline.prototype.resizeTimerID = null;
simile_Timeline.prototype.onResize = function () {
	var me = this;
	if ( this.timeline ) {
		if (this.resizeTimerID == null) {
	    	this.resizeTimerID = window.setTimeout(function() {
	    		me.resizeTimerID = null;
	    		me.timeline.layout();
	        }, 500);
	    }
    }
}


simile_Timeline.prototype.onClick = function( action , value , event )
{
	switch ( action ) {
		case "renderTimeline" :
			this.newData = RIA.deserializeJSData( value );
			
			this.render(
					 this.newData.topDisplaySpan
					,this.newData.topSize
					,this.newData.bottomDisplaySpan
					,this.newData.bottomSize
				);
			event.stopPropagation();
			break;
	
	}
}


/********
ostudios_vo_listcollectionvo
**************/

ostudios_vo_listcollectionvo = function ( defaultObj ) {	
	ria_valueobject.call( this );

	this.tags = "";
	this.list_type = "";
	this.content_type = "html";
	this.lists = [];

	ria_valueobject.extend( this , defaultObj );	
}

ostudios_vo_listcollectionvo.prototype = new ria_valueobject();
ostudios_vo_listcollectionvo.prototype.constructor = ostudios_vo_listcollectionvo;


/********
ostudios_vo_listvo
**************/

ostudios_vo_listvo = function ( defaultObj ) {	
	ria_valueobject.call( this );

	this.tags = "";
	this.list_type = "";
	this.content_type = "";
	this.is_open = false;
	this.list_index = "1";
	this.posts = [];

	ria_valueobject.extend( this , defaultObj );	
}

ostudios_vo_listvo.prototype = new ria_valueobject();
ostudios_vo_listvo.prototype.constructor = ostudios_vo_listvo;


/********
ostudios_vo_mediavo
**************/

ostudios_vo_mediavo = function ( defaultObj ) {	
	ria_valueobject.call( this );

	this.id = "";
	this.type = "";
	this.url = "";
	this.local_url = "";
	this.width = "";
	this.height = "";
	this.size = "";
	this.caption = "";

	ria_valueobject.extend( this , defaultObj );	
}

ostudios_vo_mediavo.prototype = new ria_valueobject();
ostudios_vo_mediavo.prototype.constructor = ostudios_vo_mediavo;


/********
ostudios_vo_postvo
**************/

ostudios_vo_postvo = function ( defaultObj ) {	
	ria_valueobject.call( this );

	this.id = "";
	this.title = "";
	this.slug = "";
	this.list_tags = "";
	this.full_url = "";
	this.user_id = "";
	this.user = "";
	this.site_id = "";
	this.site = "";
	this.sites = "";
	this.date_created = "";
	this.post_date = "";
	this.last_updated = "";
	this.start_date = "";
	this.end_date = "";
	this.end_is_now = "";
	this.is_private = "0";
	this.images = "";
	this.tags = "";
	this.tags_assoc = "";
	this.html_header = "";
	this.html_body = "";
	this.html_all = "";
	this.has_more_text = "0";
	this.post_view_type = "1";

	ria_valueobject.extend( this , defaultObj );	
}

ostudios_vo_postvo.prototype = new ria_valueobject();
ostudios_vo_postvo.prototype.constructor = ostudios_vo_postvo;


/********
ostudios_vo_sitevo
**************/

ostudios_vo_sitevo = function ( defaultObj ) {	
	ria_valueobject.call( this );

	this.id = "";
	this.slug = "";
	this.title = "";
	this.user_id = "";
	this.server_name = "";
	this.view_root = "";
	this.config = "";
	this.home_tags = "";
	this.google_analytics = "";

	ria_valueobject.extend( this , defaultObj );	
}

ostudios_vo_sitevo.prototype = new ria_valueobject();
ostudios_vo_sitevo.prototype.constructor = ostudios_vo_sitevo;


/********
ostudios_vo_tagvo
**************/

ostudios_vo_tagvo = function ( defaultObj ) {	
	ria_valueobject.call( this );

	this.id = "";
	this.name = "";

	ria_valueobject.extend( this , defaultObj );	
}

ostudios_vo_tagvo.prototype = new ria_valueobject();
ostudios_vo_tagvo.prototype.constructor = ostudios_vo_tagvo;


/********
ostudios_vo_uservo
**************/

ostudios_vo_uservo = function ( defaultObj ) {	
	ria_valueobject.call( this );

	this.id = "";
	this.email = "";
	this.username = "";
	this.password = "";
	this.logins = "";
	this.last_login = "";
	this.sites = "";

	ria_valueobject.extend( this , defaultObj );	
}

ostudios_vo_uservo.prototype = new ria_valueobject();
ostudios_vo_uservo.prototype.constructor = ostudios_vo_uservo;



$(document).ready( function() {
RIA.createComponents();});

/**/
