
var FormisbeeingSent = 0;

function submitform2forum(){

if(document.newmsgform.ada.value>0)
	{
	var pre1=$('.tit .nicEdit-main').html();
	var pre2=$('.cont .nicEdit-main').html();
	document.newmsgform.title.value = pre1;
	document.newmsgform.msgBody.value = pre2;
	}

if(FormisbeeingSent == 0) document.newmsgform.submit();

FormisbeeingSent = 1;

}




function updateViewsCount(msgid, type){
        $(document).ready(function(){
        $.get("checkUsers.php", { action: "viewsCounter", msgid: msgid, type: type },
        function(data){  if(data > 5) document.location.href="page.php?aid=15"; });

        $.get("checkUsers.php", { action: "checkForAttachments", msgid: msgid, type: type },
        function(data2){
               if(type == "topic") $("#topicAttachmentsContainer"+msgid).html(data2);
               else $("#feedbackAttachmentsContainer"+msgid).html(data2);                    
          });          
        });     
}


function show_hidden_text(content, type, msgid)
{
if(document.getElementById(content).style.display == "none"){ 	
																	document.getElementById(content).style.display = "block";
																	updateViewsCount(msgid, type);    
																					}
else  {document.getElementById(content).style.display = "none";}
}




function insertSmile(e){
				//textF = "#" + document.add_main_menu_item1.textFF.value;
			    //$(textF).tinymce().execCommand("mceInsertContent",false,e);
obj1 = document.newmsgform.titleForumForm1;
obj2 = document.newmsgform.textForumForm2;

if(document.newmsgform.textFF.value == 'titleForumForm1')	
	{ 
	obj1.focus();
	obj1.value =	obj1.value + e; 
	}

if(document.newmsgform.textFF.value == 'textForumForm2')	
	{
	obj2.focus();
	obj2.value =	obj2.value + e; 
	}

}



function insertSmile2(e){
var pre=$('#textJJ').val();
var path='.'+pre+' .nicEdit-main';
  $(path).html($(path).html() + (e)) ;
}




function changeAndUpdate1(){
			document.newmsgform.textFF.value='titleForumForm1';
			document.newmsgform.textJJ.value='tit';
			document.getElementById('arrow1').src = 'images/arr_on.gif';
			document.getElementById('arrow2').src = 'images/arr_off.gif';
}


function changeAndUpdate2(){
			document.newmsgform.textFF.value='textForumForm2';
			document.newmsgform.textJJ.value='cont';
			document.getElementById('arrow2').src = 'images/arr_on.gif';
			document.getElementById('arrow1').src = 'images/arr_off.gif';
}


function SetTextFocusHere(theid){
			document.newmsgform.textFF.value=theid;
			if(theid=='titleForumForm1') 
				{
			document.getElementById('arrow1').src = 'images/arr_on.gif';
			document.getElementById('arrow2').src = 'images/arr_off.gif';
				}
				else{
			document.getElementById('arrow2').src = 'images/arr_on.gif';
			document.getElementById('arrow1').src = 'images/arr_off.gif';
				}
}



