YAHOO.namespace("z3.forum");
var atworkinput = '';

var handleSuccess = function(o){
		if(o.responseText !== undefined){
				var type = o.responseText.split("<!")[0];
				var rText = o.responseText.split("<!")[1];
				if (type == "ERROR") {
					document.getElementById('forum_hozzaszolas_error').innerHTML = '<font color="#ff0000"><b>(!)</b> '+rText+'</font>';
				}
				else {
					location.href=rText;
				}
		}else {
			
		}
};

var handleFailure = function(o)
{
		if(o.responseText !== undefined){
			YAHOO.z3.forum.dialog1.setBody('<font color="#ff0000"><b>(!)</b> Connection fault!</font> ');
		}
};


var callback =
{
		success:handleSuccess,
		failure:handleFailure,
		argument:['webid','2313asd32asf22!42']
};



function mkrequest(toURL, toArgs){
	var request = YAHOO.util.Connect.asyncRequest('POST', toURL, callback, toArgs);
}

	
function init() {
		YAHOO.z3.forum.dialog1 = new YAHOO.widget.Dialog("forum_hozzaszolas", 
																	{ width : "500px",
																	  fixedcenter : true,
																	  visible : false, 
																	  draggable: false, 
																	  close: true,
																	  modal:true,
																	  zindex:13,
																	  constraintoviewport : true
																	 });
		YAHOO.z3.forum.dialog1.render();
	
}

function forumAdd() {
	YAHOO.z3.forum.dialog1.show();
}

function forumSend(name,email,message,cat) {
	if (!name || !email || !message || !cat) {
		document.getElementById('forum_hozzaszolas_error').innerHTML = '<font color="#ff0000"><b>(!)</b> Minden mezőt kötelező kitölteni!</font>';
	}else {
		document.getElementById('forum_hozzaszolas_error').innerHTML = '<img src="./html/img/lightbox/loading.gif" alt="" />';
		var request = YAHOO.util.Connect.asyncRequest('POST', location.href, callback, '&name='+name+'&email='+email+'&cat='+cat+'&text='+message);
	}
	
	
}


YAHOO.util.Event.onDOMReady(init);
