/**
 * default.js
 */
var USER_AGENT 		= navigator.userAgent.toLowerCase();
var IS_OPERA 		= (USER_AGENT.indexOf('opera') != -1);
var IS_SAFARI 		= ((USER_AGENT.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Computer, Inc.'));
var IS_SAFARI_MOBILE	= (IS_SAFARI && ((USER_AGENT.indexOf('iphone') != -1) || (USER_AGENT.indexOf('ipod') != -1)));
var IS_IE		= ((USER_AGENT.indexOf('msie') != -1) && !IS_OPERA && !IS_SAFARI);
var IS_IE7		= false;
var IS_IE6		= false;
if (IS_IE) {
	if (!IS_OPERA && window.XMLHttpRequest) IS_IE7 = true;
	else IS_IE6 = true;
}
var IS_MOZILLA		= ((navigator.product == 'Gecko') && !IS_SAFARI);
var IS_KONQUEROR	= (USER_AGENT.indexOf('konqueror') != -1);

var onloadEvents=new Array();window.onload=function(){for(var i=0;i<onloadEvents.length;i++)onloadEvents[i]()}

Object.extend(String.prototype,{firstCharToUpperCase:function(){return this.slice(0,1).toUpperCase()+this.slice(1,this.length)}});

Object.extend(Element.Methods,{getDimensions:function(a){a=$(a);var b=a.getStyle('display');if(b!='none'&&b!=null)return{width:a.offsetWidth,height:a.offsetHeight};var c=a.style;var d=c.visibility;var e=c.display;c.visibility='hidden';c.display='block';var f=a.clientWidth;var g=a.clientHeight;c.display=e;c.visibility=d;return{width:f,height:g}}});
Element.addMethods();

function enableOptions(){for(var i=0;i<arguments.length;i++){var a=document.getElementById(arguments[i]+'Div');if(a){enableFormElements(a,true);var b=a.className;b=b.replace(/ ?disabled/,'');b=b.replace(/disabled ?/,'');a.className=b}}return true}

function enableFormElements(a,b){if(!a.childNodes){return}for(var i=0;i<a.childNodes.length;i++){var c=a.childNodes[i].nodeName;if(c)c=c.toLowerCase();if(c=='textarea'||c=='input'||c=='select'){if(c=='select'||a.childNodes[i].type=='checkbox'||a.childNodes[i].type=='radio'){a.childNodes[i].disabled=!b}else{if(b)a.childNodes[i].removeAttribute('readonly');else a.childNodes[i].setAttribute('readonly',true)}}enableFormElements(a.childNodes[i],b)}}

function disableOptions(){for(var i=0;i<arguments.length;i++){var a=document.getElementById(arguments[i]+'Div');if(a){enableFormElements(a,false);var b=a.className;if(b.indexOf('disabled')==-1){if(b!=''){b+=' '}b+='disabled';a.className=b}}}return true}

var animatingList = false;

function openList(b,c){var c=Object.extend({save:false,openTitle:null,closeTitle:null,setVisible:null,afterOpen:null,afterClose:null},arguments[1]||{});if(animatingList){return false}else{var d=$(b);if(d==null){return false}if(Prototype.Browser.IE){d.setStyle({zoom:1})}var e=0;var f=d.getHeight();if(d.visible()){if(c.setVisible==null||(c.setVisible!=null&&c.setVisible==false)){d.blindUp({beforeStart:function(){animatingList=true},afterFinish:function(){var a=$(b+'Image');if(a){a.src=a.src.replace(/minus/,'plus');if(c.openTitle)a.title=c.openTitle}animatingList=false;if(c.afterClose){c.afterClose()}},duration:Math.sqrt(f)/40})}}else{if(c.setVisible==null||(c.setVisible!=null&&c.setVisible==true)){e=1;d.blindDown({beforeStart:function(){animatingList=true},afterFinish:function(){var a=$(b+'Image');if(a){a.src=a.src.replace(/plus/,'minus');if(c.closeTitle)a.title=c.closeTitle}animatingList=false;if(c.afterOpen){c.afterOpen()}},duration:Math.sqrt(f)/40})}}if(c.save)saveStatus(b,e);return true}}

function saveStatus(a,b){var c=new AjaxRequest();c.openPost('index.php?action=StatusSave'+SID_ARG_2ND,'name='+encodeURIComponent(a)+'&status='+encodeURIComponent(b))}

function initList(a,b){if(!b){var c=document.getElementById(a);c.style.display='none';document.getElementById(a+'Image').src=document.getElementById(a+'Image').src.replace(/minus/,'plus')}}

function showContent(a,b){document.getElementById(b).style.display='none';document.getElementById(a).style.display='';return}

function fixURL(a){if(IS_IE||IS_OPERA){if(a.indexOf("/")==-1&&document.getElementsByTagName('base').length>0){return document.getElementsByTagName('base')[0].href+a}}return a}

function WysiwygInsert(a,b,c,d){if(typeof(tinyMCE)!='undefined'){if(!tinyMCE.initialized){window.setTimeout(function(){WysiwygInsert(a,b,c,d)},500);return}if(a=='smiley')tinyMCE.insertSmiley(b,c,d);else if(a=='attachment')tinyMCE.insertAttachment(b);else if(a=='text')tinyMCE.insertText(b);else if(a=='bbcode')tinyMCE.insertBBCodes(b)}else{}}

function inlineDelete(b){if(!(!!b&&b.nodeType===1)){var a=b.findElement('a');var c=b}else{var a=b}var d=a.down('img');var e=d.readAttribute('longdesc');if(e==null){e=LANG_DELETE_CONFIRM}if(e==""){e=null}if(a&&e){if(confirm(e)){a.up('.deletable').fade({duration:0.5,afterFinish:function(){a.up('.deletable').remove();document.fire('wcf:inlineDelete')}});var f=new AjaxRequest();f.openGet(a.href.gsub('&nbsp;','&')+'&ajax=1')}else{document.fire('wcf:inlineDelete')}}else if(a){a.up('.deletable').fade({duration:0.5,afterFinish:function(){a.up('.deletable').remove();document.fire('wcf:inlineDelete')}});var f=new AjaxRequest();f.openGet(a.href.gsub('&nbsp;','&')+'&ajax=1')}else{document.fire('wcf:inlineDelete')}if(c)c.stop()}

document.observe("dom:loaded",function(){$$('.deletable .deleteButton').invoke('observe','click',inlineDelete)});

var ss={fixAllLinks:function(){var a=document.getElementsByTagName('a');for(var i=0;i<a.length;i++){var b=a[i];if((b.href&&b.href.indexOf('#')!=-1)&&((b.pathname==location.pathname)||('/'+b.pathname==location.pathname))&&(b.search==location.search)){ss.addEvent(b,'click',ss.smoothScroll)}}},smoothScroll:function(e){if(window.event){target=window.event.srcElement}else if(e){target=e.target}else return;if(target.nodeName.toLowerCase()!='a'){target=target.parentNode}if(target.nodeName.toLowerCase()!='a')return;anchor=target.hash.substr(1);var a=document.getElementsByTagName('a');var b=null;for(var i=0;i<a.length;i++){var c=a[i];if(c.name&&(c.name==anchor)){b=c;break}}if(!b)b=document.getElementById(anchor);if(!b)return true;var d=b.offsetLeft;var f=b.offsetTop;var g=b;while(g.offsetParent&&(g.offsetParent!=document.body)){g=g.offsetParent;d+=g.offsetLeft;f+=g.offsetTop}clearInterval(ss.INTERVAL);cypos=ss.getCurrentYPos();ss_stepsize=parseInt((f-cypos)/ss.STEPS);ss.INTERVAL=setInterval('ss.scrollWindow('+ss_stepsize+','+f+',"'+anchor+'")',10);if(window.event){window.event.cancelBubble=true;window.event.returnValue=false}if(e&&e.preventDefault&&e.stopPropagation){e.preventDefault();e.stopPropagation()}},scrollWindow:function(a,b,c){wascypos=ss.getCurrentYPos();isAbove=(wascypos<b);window.scrollTo(0,wascypos+a);iscypos=ss.getCurrentYPos();isAboveNow=(iscypos<b);if((isAbove!=isAboveNow)||(wascypos==iscypos)){window.scrollTo(0,b);clearInterval(ss.INTERVAL);location.hash=c}},getCurrentYPos:function(){if(document.body&&document.body.scrollTop)return document.body.scrollTop;if(document.documentElement&&document.documentElement.scrollTop)return document.documentElement.scrollTop;if(window.pageYOffset)return window.pageYOffset;return 0},addEvent:function(a,b,c,d){if(a.addEventListener){a.addEventListener(b,c,d);return true}else if(a.attachEvent){var r=a.attachEvent("on"+b,c);return r}else{alert("Handler could not be removed")}}};ss.STEPS=25;ss.addEvent(window,"load",ss.fixAllLinks);
/**
 * PopupMenuList.class.js
 */
function PopupMenuList(){this.menus=new Array();this.menuBarOpen=false;this.hiddenSelects=new Array();window.onresize=function(){popupMenuList.closeAllMenus()};document.onclick=function(e){return popupMenuList.handleClickEvents(e)};this.register=function(a){for(var i=0;i<this.menus.length;i++){if(this.menus[i]==a){return false}}this.menus.push(a);return true};this.closeAllMenus=function(){for(var i=0;i<this.menus.length;i++){var a=document.getElementById(this.menus[i]+"Menu");if(!a){this.menus.slice(i,1);continue}a.className="hidden"}this.menuBarOpen=false};this.handleClickEvents=function(a){if(!a)a=window.event;var b;if(a.target)b=a.target;else if(a.srcElement)b=a.srcElement;if(b.nodeType==3){b=b.parentNode}var c=b.getAttribute("id");if((c==null||!c)&&b.parentNode&&b.parentNode.getAttribute){c=b.parentNode.getAttribute("id")}this.enable(c)};this.getOffset=function(a){var b=a.offsetLeft;var c=a.offsetTop;while((a=a.offsetParent)!=null){b+=a.offsetLeft;c+=a.offsetTop}return{'left':b,'top':c}};this.enable=function(a,b){this.showSelects();this.menuBarOpen=false;for(var i=0;i<this.menus.length;i++){var c=document.getElementById(this.menus[i]+"Menu");if(!c){this.menus.slice(i,1);continue}if(this.menus[i]==a){if(c.className!='popupMenu pageMenu'){var d=c.parentNode?c.parentNode.offsetHeight:0;var e=window.innerHeight?window.innerHeight:(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);var f=window.innerWidth?window.innerWidth:(document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth);var g='down';if(!b&&!IS_OPERA){c.style.clip='rect(auto, auto, 0, auto)'}else{c.style.clip='rect(auto, auto, auto, auto)'}c.className="popupMenu pageMenu";if(IS_IE){c.style.filter="progid:DXImageTransform.Microsoft.alpha(enabled=1,opacity=90)";c.style.filter+="progid:DXImageTransform.Microsoft.shadow(direction=135,color=#8e8e8e,strength=3)"}if(a.indexOf('menuBar')!=-1)this.menuBarOpen=true;c.style.marginTop='';var h=(window.pageYOffset?window.pageYOffset:(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop))+e;var j=this.getOffset(c);if((j['top']-c.offsetHeight-d)>=0&&(j['top']+c.offsetHeight>=h||(IS_IE&&d>0&&a.indexOf('menuBar')==-1&&j['top']-c.offsetHeight>0))){c.style.marginTop=(-c.offsetHeight-d)+'px';g='up';if(!b&&!IS_OPERA){c.style.clip='rect('+c.offsetHeight+'px, auto, auto, auto)'}}this.hideSelects(c);if(j['left']+c.offsetWidth>=f){c.style.right='0'}if(!b&&!IS_OPERA){var k=parseInt(c.offsetHeight/8);this.slide(this.menus[i]+"Menu",0,k,g)}continue}else if(b){if(a.indexOf('menuBar')!=-1)this.menuBarOpen=true;continue}}if(c.className!="hidden")c.className="hidden"}};this.slide=function(a,b,c,d){var e=document.getElementById(a);if(b>e.offsetHeight){b=e.offsetHeight}if(d=='down'){e.style.clip='rect(auto, auto, '+b+'px, auto)'}else{e.style.clip='rect('+(e.offsetHeight-b)+'px, auto, auto, auto)'}if(b>=e.offsetHeight){return}b+=c;setTimeout("popupMenuList.slide('"+a+"', "+b+", "+c+", '"+d+"')",10)};this.overlaps=function(a,b){if(b['left']>a['right']||b['right']<a['left']||b['top']>a['bottom']||b['bottom']<a['top']){return false}return true};this.getPositionArray=function(a){var b=this.getOffset(a);b['right']=b['left']+a.offsetWidth;b['bottom']=b['top']+a.offsetHeight;return b};this.hideSelects=function(a){if(!IS_IE6){return}var b=document.getElementsByTagName('select');if(b.length>0){var c=this.getPositionArray(a);for(var i=0;i<b.length;i++){var d=this.getPositionArray(b[i]);if(this.overlaps(c,d)){b[i].style.visibility='hidden';this.hiddenSelects.push(b[i])}}}};this.showSelects=function(){if(!IS_IE){return}while(this.hiddenSelects.length>0){var a=this.hiddenSelects.shift();if(a){a.style.visibility='visible'}}}}var popupMenuList=new PopupMenuList();
/**
 * AjaxRequest.class.js
 */
 function AjaxRequest(){this.xmlHttpRequest=null;this.response=null;this.openPost=function(a,b,c){a=fixURL(a);if(this.openXMLHttpRequest(c)){this.xmlHttpRequest.open('POST',a,true);this.xmlHttpRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded');this.xmlHttpRequest.send(b);return true}return false};this.openGet=function(a,b){a=fixURL(a);if(this.openXMLHttpRequest(b)){this.xmlHttpRequest.open('GET',a,true);this.xmlHttpRequest.send(null);return true}return false};this.openXMLHttpRequest=function(a){if(this.xmlHttpRequest){if(this.xmlHttpRequest.readyState!=0&&this.xmlHttpRequest.readyState!=4){return false}this.xmlHttpRequest.abort()}try{this.xmlHttpRequest=new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{this.xmlHttpRequest=new ActiveXObject('Microsoft.XMLHTTP')}catch(e){this.xmlHttpRequest=null}}if(!this.xmlHttpRequest){if(typeof XMLHttpRequest!='undefined'){this.xmlHttpRequest=new XMLHttpRequest();if(this.xmlHttpRequest.overrideMimeType){this.xmlHttpRequest.overrideMimeType('text/xml')}}else{return false}}if(a){this.xmlHttpRequest.onreadystatechange=a}else{this.xmlHttpRequest.onreadystatechange=this.handleResponse;if(this.xmlHttpRequest.overrideMimeType){this.xmlHttpRequest.overrideMimeType('text/plain')}}return true};this.handleResponse=function(){if(this.readyState==4){if(this.status!=200){}else if(this.responseText!=''){}}}};
