// JavaScript Document
var old_item='';
function show_new_message(ID, msg_ID, box_size1, re_msg_title, Edit)
{

  xitem="_newmessage"+msg_ID;

  document.getElementById(xitem).innerHTML='<form name="new_message" action="forum.php?action=save_msg" method="post" onsubmit="return validate_msg()" style="width:'+box_size1+'px; height:145px; min-height:145px; font-size:12px; border:solid 1px #ff0000; background-color:white; text-align:center; float:right; z-index:10;">Titel: <input type="text" name="new_msg_title" onchange="noschrott(this)" maxlength="75" style="margin:5px; width:'+(box_size1-15)+'px; height:14px; min-height:14px; font-size:12px; border:solid 1px #50779e;" value="'+re_msg_title+'" /><br />Text: <textarea name="new_msg_text" style="margin:5px; width:'+(box_size1-15)+'px; height:50px; min-height:50px; font-size:12px; border:solid 1px #50779e; " ></textarea><br /><input type="submit" value="neuer Eintrag" style="height:18px; min-height:18px; font-size:12px; border:outset 2px #dcdcdc;" /><input name="msg_ID" type="hidden" value="'+msg_ID+'" /></form>';
  if (old_item>'') document.getElementById(old_item).innerHTML='';
  old_item=xitem;

   
}

function show_new_thread(ID, msg_ID, box_size1)
{
  if (document.getElementById('_newthread').innerHTML > '') document.getElementById('_newthread').innerHTML='';
  else document.getElementById('_newthread').innerHTML='<form name="new_thread" action="forum.php?action=save_msg" onsubmit="return validate_msg1()" method="post" style="width:510px; height:155px; min-height:120px; font-size:12px; border:solid 1px #ff0000; background-color:white; text-align:center; float:right; z-index:10;"><span style="float:left; width:510px; text-align:center; margin-top:5px;">Titel:</span><input type="text" name="new_msg_title" onchange="noschrott(this)" maxlength="75" style="margin:5px; width:495px; height:14px; min-height:14px; font-size:12px; border:solid 1px #50779e;" /><br /><span style="float:left; width:510px; text-align:center; margin-top:5px;">Nachricht:</span><textarea name="new_msg_text" style="margin:5px; width:495px; height:50px; min-height:50px; font-size:12px; border:solid 1px #50779e; " ></textarea><br /><input type="submit" value="neues Thema" style="height:18px; min-height:18px; font-size:12px; border:outset 2px #dcdcdc;" /><input name="msg_ID" type="hidden" value="0" /></form><div style="clear:both;"></div>';
  
} 

function validate_msg() {

		var v1 = document.new_message.new_msg_title.value;
		var v2 = document.new_message.new_msg_text.value;

	  var objRegExp = /^[a-zA-Z0-9äöüßÄÖÜ+-.,:?!()*^ -]*$/;
	  
	  if( objRegExp.test(v1)==false )
	  {     
			if ( v1 == '' || v2 == '' ) {
				alert('Please fill in all required fields!');
				return false;
			}
			alert('Only alphanumeric chars allowed!');
      return false;
		}
    else return true;
	}

function validate_msg1() {

		var v1 = document.new_thread.new_msg_title.value;
		var v2 = document.new_thread.new_msg_text.value;

	  var objRegExp = /^[a-zA-Z0-9äöüßÄÖÜ+-.,:?!()*^ -]*$/;
	
	  if( objRegExp.test(v1)==false )
	  {     
			if ( v1 == '' || v2 == '' ) {
				alert('Please fill in all required fields!');
				return false;
			}
			alert('Only alphanumeric chars allowed!');
      return false;
		}
    else return true;
	}
