// JavaScript Document
var old_item='';
function show_new_message(msg)
{

  xitem=msg; alert(xitem);
  if (document.getElementById(xitem).innerHTML > '') document.getElementById(xitem).innerHTML='';
  else 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, board_id, nix, kategorie)
{
  if (document.getElementById('_newthread').innerHTML > '') document.getElementById('_newthread').innerHTML='';
  else document.getElementById('_newthread').innerHTML='<form name="new_thread" action="?action=save_msg&kategorie='+kategorie+'" onsubmit="return validate_msg1()" method="post" style="width:485px; max-width:485px; height:220px; min-height:220px; max-height:220px; padding:5px; margin:0px; font-size:12px; border:solid 1px #ffff00; background-color:#242423; text-align:left; float:left; z-index:10;"><div style="float:left; width:480px; text-align:left; margin-top:5px; float:left;">Title: <br /><input type="text" name="new_msg_title" onchange="noschrott(this)" maxlength="75" style="margin:5px; width:475px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #000000; float:left;" /><input name="new_msg_art" type="hidden" value="1" /></div><br /><span style="float:left; width:475px; text-align:left; margin-top:5px;">Short Description:</span><input type="text" name="new_msg_abstract" onchange="noschrott(this)" style="margin:5px; width:475px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #000000;" /><br /><span style="float:left; width:475px; text-align:left; margin-top:5px;">Blog Text:</span><textarea name="new_msg_text" style="margin:5px; width:475px; height:50px; min-height:50px; font-size:12px; border:solid 1px #000000; " ></textarea><br /><input type="submit" value="write Blog" style="margin-left:5px; min-width:477px; width: 475px; max-width:477px; height:22px; min-height:22px; font-size:12px; text-align:center; border:outset 2px #dcdcdc;" /><input name="msg_ID" type="hidden" value="0" /><input name="board_id" type="hidden" value="'+board_id+'" /></form><div style="clear:both;"></div><br />';
  // alert(kategorie);
  //OLD: else document.getElementById('_newthread').innerHTML='<form name="new_thread" action="?action=save_msg" onsubmit="return validate_msg1()" method="post" style="width:485px; max-width:485px; height:255px; padding:5px; margin:0px; min-height:240px; font-size:12px; border:solid 1px #ffff00; background-color:#242423; text-align:left; float:left; z-index:10;"><div style="float:left; width:480px; text-align:left; margin-top:5px; float:left;">Titel: <br /><input type="text" name="new_msg_title" onchange="noschrott(this)" maxlength="75" style="margin:5px; width:375px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #50779e; float:left;" /><select name="new_msg_art" style="width: 85px; margin-top:5px; float:right; line-height:16px; height:20px; max-height:20px; min-height:20px; " ><option value="1" />Blog<option value="2" />News</select></div><br /><span style="float:left; width:475px; text-align:left; margin-top:5px;">Kurzbeschreibung:</span><input type="text" name="new_msg_abstract" onchange="noschrott(this)" maxlength="255" style="margin:5px; width:475px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #50779e;" /><br /><span style="float:left; width:485px; text-align:left; margin-top:5px;">Bild:</span><input type="text" name="new_msg_bild" onchange="noschrott(this)" maxlength="255" style="margin:5px; width:465px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #50779e;" /><br /><span style="float:left; width:475px; text-align:left; margin-top:5px;">Nachricht:</span><textarea name="new_msg_text" style="margin:5px; width:475px; height:50px; min-height:50px; font-size:12px; border:solid 1px #50779e; " ></textarea><br /><input type="submit" value="neues Thema" style="width: 475px; height:22px; min-height:22px; font-size:12px; text-align:center; border:outset 2px #dcdcdc;" /><input name="msg_ID" type="hidden" value="0" /><input name="board_id" type="hidden" value="'+board_id+'" /></form><div style="clear:both;"></div>';
} 

function show_new_news(ID, board_id, nix)
{
  if (document.getElementById('_newthread').innerHTML > '') document.getElementById('_newthread').innerHTML='';
  else document.getElementById('_newthread').innerHTML='<form name="new_thread" action="?action=save_msg" onsubmit="return validate_msg1()" method="post" style="width:485px; max-width:485px; height:220px; min-height:220px; max-height:220px; padding:5px; margin:0px; font-size:12px; border:solid 1px #ffff00; background-color:#242423; text-align:left; float:left; z-index:10;"><div style="float:left; width:480px; text-align:left; margin-top:5px; float:left;">Title: <br /><input type="text" name="new_msg_title" onchange="noschrott(this)" maxlength="75" style="margin:5px; width:475px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #000000; float:left;" /><input name="new_msg_art" type="hidden" value="2" /></div><br /><span style="float:left; width:475px; text-align:left; margin-top:5px;">Short Description:</span><input type="text" name="new_msg_abstract" onchange="noschrott(this)" maxlength="255" style="margin:5px; width:475px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #000000;" /><br /><span style="float:left; width:475px; text-align:left; margin-top:5px;">News Text:</span><textarea name="new_msg_text" style="margin:5px; width:475px; height:50px; min-height:50px; font-size:12px; border:solid 1px #000000; " ></textarea><br /><input type="submit" value="write News" style="margin-left:5px; min-width:477px; width: 475px; max-width:477px; height:22px; min-height:22px; font-size:12px; text-align:center; border:outset 2px #dcdcdc;" /><input name="msg_ID" type="hidden" value="0" /><input name="board_id" type="hidden" value="'+board_id+'" /></form><div style="clear:both;"></div><br />';
  //OLD: else document.getElementById('_newthread').innerHTML='<form name="new_thread" action="?action=save_msg" onsubmit="return validate_msg1()" method="post" style="width:485px; max-width:485px; height:255px; padding:5px; margin:0px; min-height:240px; font-size:12px; border:solid 1px #ffff00; background-color:#242423; text-align:left; float:left; z-index:10;"><div style="float:left; width:480px; text-align:left; margin-top:5px; float:left;">Titel: <br /><input type="text" name="new_msg_title" onchange="noschrott(this)" maxlength="75" style="margin:5px; width:375px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #50779e; float:left;" /><select name="new_msg_art" style="width: 85px; margin-top:5px; float:right; line-height:16px; height:20px; max-height:20px; min-height:20px; " ><option value="1" />Blog<option value="2" />News</select></div><br /><span style="float:left; width:475px; text-align:left; margin-top:5px;">Kurzbeschreibung:</span><input type="text" name="new_msg_abstract" onchange="noschrott(this)" maxlength="255" style="margin:5px; width:475px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #50779e;" /><br /><span style="float:left; width:485px; text-align:left; margin-top:5px;">Bild:</span><input type="text" name="new_msg_bild" onchange="noschrott(this)" maxlength="255" style="margin:5px; width:465px; height:20px; max-height:20px; min-height:20px; font-size:12px; border:solid 1px #50779e;" /><br /><span style="float:left; width:475px; text-align:left; margin-top:5px;">Nachricht:</span><textarea name="new_msg_text" style="margin:5px; width:475px; height:50px; min-height:50px; font-size:12px; border:solid 1px #50779e; " ></textarea><br /><input type="submit" value="neues Thema" style="width: 475px; height:22px; min-height:22px; font-size:12px; text-align:center; border:outset 2px #dcdcdc;" /><input name="msg_ID" type="hidden" value="0" /><input name="board_id" type="hidden" value="'+board_id+'" /></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;
    */
    return true;
	}
