        function openAllSmiles(){
                smiles = window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=300,resizable=yes,scrollbars=yes,WIDTH=450');
                smiles.focus();
                return false;
        }
        
        function storeCaret(textEl) {
                if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
        }

        function emoticon(text) {
                if (document.post.message.createTextRange && document.post.message.caretPos) {
                        var caretPos = document.post.message.caretPos;
                        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
                        document.post.message.focus();
                } else {
                        document.post.message.value  += text;
                        document.post.message.focus();
                }
        }

        function checkForm() {
                formErrors = false;
                if (document.post.message.value.length < 2) {
                        formErrors = '{L_EMPTY_MESSAGE}';
                }
                if (formErrors) {
                        alert(formErrors);
                        return false;
                } else {
                        if (document.post.quick_quote.checked) {
                                document.post.message.value = document.post.last_msg.value + document.post.message.value;
                        } 
                        document.post.quick_quote.checked = false;
                        return true;
                }
        }



function ShowHide(id1, id2)
{
	if (id1 != '') toggleview(id1);
	if (id2 != '') toggleview(id2);
}
	
/*-------------------------------------------------------------------------*/
// Get element by id
/*-------------------------------------------------------------------------*/

function my_getbyid(id)
{
	itm = null;
	
	if (document.getElementById)
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	}
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	
	return itm;
}

/*-------------------------------------------------------------------------*/
// Show/hide toggle
/*-------------------------------------------------------------------------*/

function toggleview(id)
{
	if ( ! id ) return;
	
	if ( itm = my_getbyid(id) )
	{
		if (itm.style.display == "none")
		{
			my_show_div(itm);
		}
		else
		{
			my_hide_div(itm);
		}
	}
}

/*-------------------------------------------------------------------------*/
// Set DIV ID to hide
/*-------------------------------------------------------------------------*/

function my_hide_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "none";
}

/*-------------------------------------------------------------------------*/
// Set DIV ID to show
/*-------------------------------------------------------------------------*/

function my_show_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "";
}



var maxWidth = 700;

function scaleImage(im) {

  if (typeof im.naturalWidth == 'undefined') im.naturalWidth = im.width;

  if (im.naturalWidth > maxWidth) {

    im.width = maxWidth;
    im.style.maxWidth = im.naturalWidth + 'px';
    im.className = 'resized';
        im.style.borderWidth = '2px';
        im.style.borderStyle = 'outset';
    im.title = 'Orginalbild? Einmal Cursor(Maus) über Bild halten!';
    im.onmouseover = unscaleImage;

  }

}

function unscaleImage() {

  if (this.width == maxWidth) {

    this.width = this.naturalWidth;
    this.style.borderWidth = '2px';
    this.style.borderStyle = 'inset';
    this.title = 'Cursor(Maus) vom Bild, schon wird es kleiner!';
    this.onmouseout = unscaleImage;


  } else {

    this.width = maxWidth;
    this.style.borderWidth = '2px';
    this.style.borderStyle = 'outset';
    this.title = 'Orginalbild? Einmal Cursor(Maus) über Bild halten!';

  }

}