/*
 *	Copyright (C) 2003-2007 UseBB Team
 *	http://www.usebb.net
 *	
 *	$Header: /cvsroot/usebb/UseBB/sources/javascript.js,v 1.18 2007/01/25 16:36:16 pc_freak Exp $
 *	
 *	This file is part of UseBB.
 *	
 *	UseBB is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *	
 *	UseBB is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 *	GNU General Public License for more details.
 *	
 *	You should have received a copy of the GNU General Public License
 *	along with UseBB; if not, write to the Free Software
 *	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
var clientPC=navigator.userAgent.toLowerCase();var is_gecko=((clientPC.indexOf("gecko")!=-1)&&(clientPC.indexOf("spoofer")==-1)&&(clientPC.indexOf("khtml")==-1)&&(clientPC.indexOf("netscape/7.0")==-1));var is_safari=((clientPC.indexOf("AppleWebKit")!=-1)&&(clientPC.indexOf("spoofer")==-1));var is_khtml=(navigator.vendor=="KDE"||(document.childNodes&&!document.all&&!navigator.taintEnabled));if(clientPC.indexOf("opera")!=-1){var is_opera=true;var is_opera_preseven=(window.opera&&!document.childNodes);var is_opera_seven=(window.opera&&document.childNodes)}function insert_tags(i,a){var k=document.getElementById("tags-txtarea");var b="";if(document.selection&&!is_gecko){var l=document.selection.createRange().text;var o=true;if(!l){o=false;l=b}k.focus();m=l;if(l.charAt(l.length-1)==" "){l=l.substring(0,l.length-1);r=document.selection.createRange();r.text=i+l+a+" "}else{r=document.selection.createRange();r.text=i+l+a}if(!o){r.moveStart("character",-m.length-a.length);r.moveEnd("character",-a.length)}r.select()}else{if(k.selectionStart||k.selectionStart=="0"){var o=false;var j=k.selectionStart;var c=k.selectionEnd;if(c-j){o=true}var e=k.scrollTop;var d=(k.value).substring(j,c);if(!d){d=b}if(d.charAt(d.length-1)==" "){subst=i+d.substring(0,(d.length-1))+a+" "}else{subst=i+d+a}k.value=k.value.substring(0,j)+subst+k.value.substring(c,k.value.length);k.focus();if(o){var n=j+(i.length+d.length+a.length);k.selectionStart=n;k.selectionEnd=n}else{k.selectionStart=j+i.length;k.selectionEnd=j+i.length+d.length}k.scrollTop=e}else{var h=alertText;var g=new RegExp("\\$1","g");var f=new RegExp("\\$2","g");h=h.replace(g,b);h=h.replace(f,i+b+a);var m;if(b){m=prompt(h)}else{m=""}if(!m){m=b}m=i+m+a;k.value+="\n"+m;if(!is_safari){k.focus()}}}if(k.createTextRange){k.caretPos=document.selection.createRange().duplicate()}}function insert_smiley(a){insert_tags(" "+a+" ","")}function set_focus(a){document.getElementById(a).focus()}function insert_table(a){insert_tags(a,"")}function acp_config_toggle(a){if(!document.getElementsByTagName){return}var b=document.getElementsByTagName("div");for(var c=0;c<b.length;c++){if(b[c].className=="adminconfigtablecell"){b[c].style.display="none"}}if(a!=null){document.getElementById(a).style.display="block"}}function init_external(){if(!document.getElementsByTagName){return}var c=document.getElementsByTagName("a");for(var b=0;b<c.length;b++){var a=c[b];if(a.href&&a.rel&&(" "+a.rel+" ").indexOf(" external ")!=-1){a.target="_blank"}}}function resize_avatars(e,c){if(!document.getElementsByTagName){return}var d=document.getElementsByTagName("img");for(var b=0;b<d.length;b++){if(d[b].className=="usebb-avatar"){var a=d[b];if(e>0&&a.width>e){a.width=e}if(c>0&&a.height>c){a.height=c}}}}$(document).ready(function(){$("a.group").fancybox({imageScale:false,centerOnScroll:false,zoomSpeedIn:0,zoomSpeedOut:0,callbackOnShow:function(){$("div#fancy_title").hide()}})});