String.prototype.trim = function() {
 return this.replace(/^\s+|\s+$/, '');
}
String.prototype.encloseByTag = function(tag, value) {
 var str = '[' + tag;
 if (value) {
 str += '=' + value;
 }
 str += ']' + this + '[/' + tag + ']';
 return str;
}
String.prototype.encloseByText = function(front, behind) {
 return front + this + behind;
}
function inArray(heuhaufen, nadel) {
 for (var n in heuhaufen) {
 if (heuhaufen[n] == nadel) {
 return n;
 }
 }
 return false;
};
function doNothing() {
}
function SetTag(sTag, sText)
{
return '['+ sTag +']'+ sText +'[/'+ sTag +']';
}
function CheckForm()
{
var wysiwyg;
with (document.getElementById(FormName)) {
if (empfaenger.value.length == 0 && freund.value == 0) {
alert('Bitte wähle einen Freund aus, \noder gib einen Usernamen ein.');
empfaenger.focus();
return false;
}
try {
if (editor.value == 'html') {
wysiwyg = true;
}
} catch (e) {
wysiwyg = false;
}
if (text.value.length == 0 && wysiwyg == false){
alert('Bitte gib einen Nachrichtentext ein.');
text.focus();
return false;
}
submit.value = "Bitte warten...";
submit.disabled = true;
}
return true;
}
function getPageScroll()
{
var yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){
yScroll = document.documentElement.scrollTop;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
}
return new Array('',yScroll);
}
function getPageSize()
{
var xScroll;
var yScroll;
var windowWidth;
var windowHeight;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
}
else if (document.body.scrollHeight > document.body.offsetHeight) {
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
}
else {
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
if (self.innerHeight) {
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight) {
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
}
else if (document.body){
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
if(yScroll < windowHeight) {
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth) {
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
}
function abfrage(frage) {
if (typeof(window.opera) != 'undefined') {
return true;
}
var toggle = confirm(frage);
if (toggle) {
return true;
}
return false;
}
function SetChecked(val) {
dml = document.mailbox;
len = dml.elements.length;
var i=0;
for( i=0 ; i<len ; i++) {
if (dml.elements[i].name=='mid[]') {
dml.elements[i].checked=val;
}
}
}
function p(profil) {
var link = '/popup/'+profil;
var popup = window.open(link, profil, "width=645,height=500,scrollbars=yes,resizable=yes");
popup.focus();
return false;
}
function chat(url, profil) {
var popup = window.open(url, profil, "width=700,height=650,scrollbars=yes,resizable=yes");
popup.focus();
}
function counter(max_laenge, element) {
if (!element) {
element = "c_eingabe";
}
laenge = document.getElementById(element).value.length;
if(laenge <= max_laenge) {
document.getElementById("c_counter").innerHTML=(max_laenge - laenge);
}
else {
document.getElementById(element).value=document.getElementById(element).value.substr(0,max_laenge);
document.getElementById("c_counter").innerHTML="Ende";
}
}
function ssl() {
if (document.getElementById("ssl_login")) {
if (document.getElementById("ssl_login").checked == true) {
document.getElementById("login").action = "https://www.jappy.de/password";
}
else {
document.getElementById("login").action = "/password";
}
}
}
function deactivateSubmitButton(form, text) {
$(form).find('button').html(text).attr('disabled', true);
}
function addDiv2ExtImages() {
 $('img.ext').wrap('<div style="width: 400px; overflow: hidden;"></div>');
}
function resizeExtImages(width) {
if (!width) {
width = 400;
}
 $("img.ext").each(function() {
 if (this.width > width) {
 this.width = width;
 this.height = this.width * (this.height / this.width);
 }
 });
}
// Wed Jan  5 15:27:49 2011
