function smileins(ins)
{
	if(ins != "0")
		document.form_insert.textarea.value += ins;
	document.form_insert.size.selectedIndex = 0;
	document.form_insert.color.selectedIndex = 0;
	document.form_insert.family.selectedIndex = 0;
}

function markall(form_name)
{
	var f=document.getElementsByName(form_name)[0];
	for(var i=0;i < f.length;i++)
	{
		f.elements[i].checked = (f.elements[i].checked == 1) ? 0 : 1;
	}
}

function count_string(string,zeichen)
{
	var posi;
	var count=0;
	for(var i=0;i < string.length;i++)
	{
		posi = string.indexOf(zeichen);
		if(posi!=-1) 
		{
			count++;
			string = string.substr((posi+3),(string.length-posi+3));
		}
		else break;
	}
	return count;
}

function find_bbcode()
{
	var text = document.form_insert.textarea;
	var code = new Array("[B]","[I]","[U]","[FONT=","[SIZE=","[COLOR=","[QUOTE","[MAIL=","[URL=","[IMG]","[LIST");
	var replace = new Array("[/B]","[/I]","[/U]","[/FONT]","[/SIZE]","[/COLOR]","[/QUOTE]","[/MAIL]","[/URL]",
													"[/IMG]","[/LIST]");
	for(var x=0;x < code.length;x++)
	{
		temptext = text.value;
		if(count_string(temptext.toUpperCase(),code[x]) > count_string(temptext.toUpperCase(),replace[x]))
			text.value += replace[x];
	}
}

function SwitchAttribute(width,height)
{
	var img = document.getElementById('main_img');
	var div = document.getElementById('main_div');
	if(img.width == width)
	{
	 	div.style.overflow = 'auto';
		img.removeAttribute('width');
		img.removeAttribute('height');
	}
	else
	{
		div.style.overflow = 'visible';
		img.setAttribute('width',width,false);
		img.setAttribute('height',height,false);
	}
}