/* The following function creates an XMLHttpRequest object... */
var http = new AJAXcompiler();
var t2;

function AJAXcompiler(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	this.comp = request_o; //return the object
	
}

function createRequestObject(){
}

/* You can get more specific with version information by using 
	parseInt(navigator.appVersion)
	Which will extract an integer value containing the version 
	of the browser being used.
*/
/* The variable http will hold our new XMLHttpRequest object. */
AJAXcompiler.prototype.doAAction = function ( url, target){
	trace (url);
	trace (this.comp.readyState +" doAction, mode:"+this.mode);
	trace (this.redraw_href);
	if (this.comp.readyState == 0 || this.comp.readyState == 4 )
	{
		clearTimeout(t2);
		if (target != null)
		{
			this.msg_target = target;	
		}
		this.params = null;
		if (this.mode == 'post')
		{
			splitString = url.split("?")
			url = splitString[0];
			this.params = splitString[1];
		}
		this.comp.open(this.mode, url, true);
		if (this.mode == 'post')
		{
//			this.AJAX_main_to = true;
			this.comp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			this.comp.setRequestHeader("Content-length", this.params.length);
			this.comp.setRequestHeader("Connection", "close");
			this.mode = 'get';
		}
		this.comp.onreadystatechange = function() {
			http.handleAction();
		}
		this.comp.send(this.params);
	}
	else
	{
		http.mode = this.mode;
		t3 = setTimeout("http.doAAction('"+url+"','"+target+"')", 500);
	}
}

AJAXcompiler.prototype.handleAction = function (){
//	trace('readyState:'+this.comp.readyState);
	if(this.comp.readyState < 4){
//		var response = 'processing....';
//		document.getElementById(this.msg_target).innerHTML = response;
		if (!this.silentmode) show_loader();
	}
	
	if(this.comp.readyState == 4){ //Finished loading the response
//		alert (this.msg_target);
		if (this.silentmode)
		{
			this.silentmode = false;	
		}
		else
		{
			hide_loader();
		}
		if (this.AJAX_main_to)
		{
			var t2=setTimeout("clearById('AJAX_main')",7500);
			this.AJAX_main_to = false;
		}
		var response = this.comp.responseText;
		var valreg = new RegExp("{[^=]+=([^}]+)}", "g");
		response = response.replace(valreg, '');
		flag = response.substring(0,1);
		if (flag == '0' || flag == '1')
		{
			response = response.substring(1);
		}
//		trace(response);
		if (this.spec_handle)
		{
			trace(this.spec_handle+"()");
			eval(this.spec_handle+"()");
		}
		else
		{
			target = this.msg_target;
			if (this.msg_target == 'full_value_mid') target = 'full_value';
			if (document.getElementById(target) != null) document.getElementById( target ).innerHTML = response;
			if (this.msg_target == 'full_value_mid'){
				show_full_front('mid');
			}
			if (this.msg_target == 'full_value'){
				show_full_front('top');
			}
		}
		if ( this.do_redraw ) this.doRedraw();
	}
}

AJAXcompiler.prototype.doRedraw = function (){
	this.do_redraw = false;
	if (this.voidmode)
	{
		flag = this.comp.responseText.substring(0,1);
		if (flag == '0')
		{
			return;
		}
		else
		{
			var varreg = new RegExp("{[^}]+}", "g");
			lista = this.redraw_href.match(varreg, '');
			if (lista != null)
			{
				for (i = 0; i < lista.length; i++)
				{
					var chgvar = lista[i].substring(1, lista[i].length-1);
					var valreg = new RegExp("{"+chgvar+"=([^}]+)}", "g");
					if(this.comp.responseText.match(valreg) != null)
					{
						value = RegExp.$1;
						this.redraw_href = this.redraw_href.replace('{'+chgvar+'}', value);
					}
					
				}
			}
		}
	}

if ( this.refreshall )
	{
		this.refreshall = false;
		document.location=this.redraw_href;
	}
	else if ( this.refrfunc )
	{
		trace('refr:'+this.refrfunc);
		eval (this.refrfunc);
		this.refrfunc = '';
	}
	else
	{
	trace( this.redraw_href);
		this.comp.open('get', this.redraw_href);
		this.msg_target = this.redraw_div;
		this.comp.onreadystatechange = function() {
			http.handleAction();
		}
		this.comp.send(null);
	}
	this.voidmode = false;
}

AJAXcompiler.prototype.msg_target = 'AJAX_main';
AJAXcompiler.prototype.do_redraw = false;
AJAXcompiler.prototype.redraw_div = '';
AJAXcompiler.prototype.redraw_href = '';
AJAXcompiler.prototype.mode = 'get';

function show_loader() {
//	trace ('mutatnia kéne');
	var div_load = document.getElementById( 'loader' );
	var div_ajaxload = document.getElementById( 'ajax-loader' );
	getPageSize();
	getPageScroll();
//	trace (div_ajaxload.offsetWidth);
	div_load.style.display = '';
	var ajaxloadTop = arrayPageScroll[1] + arrayPageSize[3] / 2;
	var ajaxloadLeft = ( arrayPageSize[2] - div_ajaxload.offsetWidth ) / 2;
	div_load.style.height =  arrayPageSize[1] + 'px';
	div_ajaxload.style.top = ajaxloadTop + 'px';
	div_ajaxload.style.left = ajaxloadLeft + 'px';
	
}

function hide_loader() {
	var div_load = document.getElementById( 'loader' );
	div_load.style.display = 'none';	
}

function show_full_front(p_place) {
	trace(p_place);
	hide_objects();
	var div_load = document.getElementById( 'full_front' );
	var div_ajaxload = document.getElementById( 'full_value' );
	getPageSize();
	getPageScroll();
	div_load.style.display = 'block';


	var ajaxloadTop = arrayPageScroll[1] + arrayPageSize[3] / 2 - div_ajaxload.offsetHeight / 2;
	var ajaxloadLeft = ( document.getElementById('main').offsetWidth - div_ajaxload.offsetWidth ) / 2;
	if (ajaxloadTop < 0 ) ajaxloadTop = 0;
	if (ajaxloadLeft < 0 ) ajaxloadLeft = 0;
//	div_load.style.height =  arrayPageSize[1] + 'px';
//	trace (document.getElementById('main').offsetWidth);
	div_load.style.height =  document.getElementById('main').offsetHeight + 'px';
	if (p_place == 'mid')
	{
		div_ajaxload.style.top = ajaxloadTop + 'px';
	}
	else
	{
		div_ajaxload.style.top = arrayPageScroll[1] + 'px';
	}
	div_ajaxload.style.left = ajaxloadLeft + 'px';
	
}

function hide_full_front() {
	show_objects();
	var div_load = document.getElementById( 'full_front' );
	document.getElementById( 'full_value' ).innerHTML = '';
	div_load.style.display = 'none';	
}

function hide_objects()
{
     var elem = document.getElementsByTagName('embed');
     for(i = 0; i < elem.length; i++) {
		if (document.layers) {
			elem[i].style.visibility = 'hide';
		}
		else {
			elem[i].style.visibility = 'hidden';	
		}
     }
     var elem = document.getElementsByTagName('object');
     for(i = 0; i < elem.length; i++) {
		if (document.layers) {
			elem[i].style.visibility = 'hide';
		}
		else {
			elem[i].style.visibility = 'hidden';	
		}
     }
}

function show_objects()
{
     var elem = document.getElementsByTagName('embed');
     for(i = 0; i < elem.length; i++) {
		if (document.layers) {
			elem[i].style.visibility = 'show';
		}
		else if (document.getElementById) {
			elem[i].style.visibility = 'visible';	
		}
     }
     var elem = document.getElementsByTagName('object');
     for(i = 0; i < elem.length; i++) {
		if (document.layers) {
			elem[i].style.visibility = 'show';
		}
		else if (document.getElementById) {
			elem[i].style.visibility = 'visible';	
		}
     }
}

function A_clear( target )
{
	if ( target == '' ) target = 'AJAX_main';
	document.getElementById( target ).innerHTML = '';
}

function AJAX_switch (cont, label1, label2, href1, href2)
{
	http.msg_target = 'AJAX_main';
	http.mode = 'get';

	if (document.getElementById(cont).innerHTML == label1)
	{
		http.doAAction(href1, null);
		document.getElementById(cont).innerHTML = label2;
	}
	else
	{
		http.doAAction(href2, null);		
		document.getElementById(cont).innerHTML = label1;		
	}
}

function A_load(p_href, p_target)
{
	var href1 = p_href;
	http.msg_target = p_target;
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_inactive (p_class, p_clid, p_act, p_parent)
{
	var href1 = 'index.php?putsetup_ajax&mode=AJAX&class='+p_class+'&clid='+p_clid+'&def=inactive&value='+p_act;
//	alert(href1);
	http.msg_target = 'AJAX_main';
	http.mode = 'get';
	http.do_redraw = true;
	if (p_class == 'forumtopic' || p_class == 'forum' || p_class == 'comment'|| p_class == 'szavazas_head'){
		http.redraw_div	 = 'main_win';				
		http.redraw_href = document.baseURI + "&mode=AJAX";
	}
	if (p_class == 'rating')
	{
		http.redraw_div = 'full_value';
		http.redraw_href = 'index.php?gal_element='+p_parent+'&mode=AJAX&part=detail';
//		alert(http.redraw_href);
	}

	http.doAAction(href1, null);

}

/*function A_inactive_old ( p_cont, p_class, p_clid, p_act, p_mode )
{
	var label2 = '<a href="javascript:A_inactive(\''+p_cont+'\',\''+p_class+'\','+p_clid+',\''+p_act+'\',\'do\')"><img src="img/b_inactive'+act+'.png" border="0"></a>';
	var label1 = '<a href="javascript:A_inactive(\''+cont+'\',\''+class+'\','+clid+',\''+(1-eval(act))+'\',\'do\')"><img src="img/b_inactive'+(1-eval(act))+'.png" border="0"></a>';
	var href2 = 'index.php?putsetup_ajax&mode=AJAX&class='+class+'&clid='+clid+'&def=inactive&value='+act;
	var href1 = 'index.php?putsetup_ajax&mode=AJAX&class='+class+'&clid='+clid+'&def=inactive&value='+(1-eval(act));
//alert(href1+','+href2);
	if (mode == 'do')
	{
		AJAX_switch(cont, 
				 label1,
				 label2,
				 href1,
 				 href2);
	}
	else
	{
		document.getElementById(cont).innerHTML = label1;
	}
}
*/

function A_comm_shout(p_concid)
{
	var t_div = document.getElementById('shout_extra');
	if (t_div.style.display == 'none')
	{
		hide_objects();
		t_div.style.display = 'block';
		var href1 = 'index.php?mode=AJAX&addcomment=' + p_concid + '&commenttype=comment';
//		trace (href1);
		http.msg_target = 'shout_extra';
		http.mode = 'get';
	
		http.doAAction(href1, null);
	}
	else
	{
		show_objects();
		t_div.style.display = 'none';
	}
}

function A_proc_newshout()
{
	var t_div = document.getElementById('shout_extra');
	show_objects();
	t_div.style.display = 'none';
	document.getElementById('ujshoutcommentform_n_comment_hun').value = '';	
	A_refr_shout(0);
}

function A_refr_shout(p_beg)
{
	trace('Helló, refr_shout');
	var href1 = 'index.php?shout_redraw&mode=AJAX&limit=50&beg='+p_beg;
	http.msg_target = 'shout_container';
	http.mode = 'get';
	trace(href1);	
	http.doAAction(href1, null);
}

function A_refr_gc( p_dlid )
{
	var href1 = 'index.php?refr_gal_cont='+p_dlid+'&mode=AJAX';
	http.msg_target = 'gc_'+p_dlid;
	http.mode = 'get';
	
	http.doAAction(href1, null);
}

function A_mk_conrat(p_class, p_clid)
{
	var href1 = 'index.php?mk_conrat=1&mode=AJAX&class='+p_class+'&clid='+p_clid;
	http.msg_target = 'AJAX_main';
	http.mode = 'get';

	http.doAAction(href1, null);
	http.do_redraw = true;
	if (p_class == 'gal_element')
	{
		http.redraw_div = 'full_value';
		http.redraw_href = 'index.php?gal_element='+p_clid+'&mode=AJAX&part=detail';
//		alert(http.redraw_href);
	}
	
}

function A_upload_img(p_dir, p_gal_type, p_target)
{
	var href1 = 'index.php?mode=AJAX&imgup=1&gal='+p_dir+'&type='+p_gal_type;
//	alert (href1);
trace (p_target);
	http.msg_target = p_target;
	http.mode = 'get';

	http.doAAction(href1, null);
	
}

function A_set_avatar(p_target)
{
	hide_full_front();
	document.getElementById('avatar').value = p_target;	
}

function A_set_embed(p_target)
{
	trace(p_target);
	pushImg(p_target);	
	hide_full_front();
}

function A_set_leadpic(p_target, p_field)
{
	document.getElementById(p_field).value = p_target;
	hide_full_front();
}

function A_addvote(p_form, p_num)
{
	var href1 = 'index.php?mode=AJAX&ujvote='+p_num;
	if (p_form != '')
	{
		currForm = document.getElementById(p_form);
		for(i = 0; i <= currForm.elements.length - 1; i++)
		{
	//		trace(currForm.elements[i].name);
			if (currForm.elements[i].name != undefined && currForm.elements[i].name != "" && currForm.elements[i].value != "")
			{
				var fields = currForm.elements[i].name+"="+encodeURIComponent(currForm.elements[i].value);
				href1 += '&'+fields;
			}
			
		}
	}

//	href1 += '&norefresh&form_debug';
	trace (href1);
	http.msg_target = 'full_value_mid';
	http.mode = 'get';

	http.doAAction(href1, null);
	
}

function A_print_date_sh(p_target)
{
	var href1 = 'index.php?mode=AJAX&drawsh=1&type=date&step=form&target='+p_target;
	if (arguments[1] != null) href1 += '&year='+arguments[1];
	if (arguments[2] != null) href1 += '&month='+arguments[2];
	if (arguments[3] != null) href1 += '&day='+arguments[3];
	q_target = p_target+'_cont';
	s_target = 'a_'+p_target;
	http.msg_target = q_target;
	document.getElementById(q_target).style.display = 'block';
//	alert(document.getElementById(s_target).offsetLeft);
/*	if (document.getElementById(q_target).style.left == 0)
	{
		document.getElementById(q_target).style.left = document.getElementById(q_target).offsetLeft + document.getElementById(s_target).offsetLeft;
	}*/
	http.mode = 'get';

	http.doAAction(href1, null);
	
}

function A_send_date(p_target)
{
	p_target_sel = p_target+'_sel';
	p_target_time = p_target+'_time';
	ret = document.getElementById(p_target_sel).title+' '+document.getElementById(p_target_time).value+':00';
//	alert(document.getElementById(p_target_sel).title+' '+document.getElementById(p_target_time).value+':00');
	document.getElementById(p_target).value = ret;
	A_chg_vis('naptar_cont_'+p_target);
}

function A_print_mus_sh(p_target, p_mode)
{
	rec = document.getElementById('mus').value;
	var href1 = 'index.php?mode=AJAX&drawsh=1&type=mu_select&step=form&target='+p_target+'&rec='+rec+'&subtype='+p_mode;
/*	if (arguments[1] != null) href1 += '&year='+arguments[1];
	if (arguments[2] != null) href1 += '&month='+arguments[2];
	if (arguments[3] != null) href1 += '&day='+arguments[3];*/
	q_target = p_target+'_cont';
	s_target = 'a_'+p_target;

	http.msg_target = q_target;
	document.getElementById(q_target).style.display = 'block';
//	alert(document.getElementById(s_target).offsetLeft);
/*	if (document.getElementById(q_target).style.left == 0)
	{
		document.getElementById(q_target).style.left = document.getElementById(q_target).offsetLeft;
	}*/
	http.mode = 'get';

	http.doAAction(href1, null);
	
}

function A_mus_add(p_uid, p_nick)
{
	var mus = document.getElementById('mus');
	var muscont = document.getElementById('muscont');
	srch = ','+mus.value+',';
//	trace(srch.indexOf(','+uid+','));
	if (srch.indexOf(','+p_uid+',') >= 0)
	{
		var musreg = new RegExp(p_uid+"[,]?", "g");
		mus.value = mus.value.replace(musreg, '');
		document.getElementById('musval'+p_uid).innerHTML = '';
		var muscontreg = new RegExp('<div id="musval'+p_uid+'"[^<]*</div>', "g");
		muscont.innerHTML = muscont.innerHTML.replace(muscontreg, '');
	}
	else
	{
		if (mus.value != '' && mus.value.substr(-1) != ',') mus.value += ',';
		mus.value += p_uid;
		muscont.innerHTML += '<div id="musval'+p_uid+'" style="float:left">&nbsp;<a href="javascript:A_mus_add('+p_uid+', \''+p_nick+'\')">'+p_nick+'</a>,</div>';
	}
}

function A_print_tag_sh(p_target)
{
	rec = document.getElementById(p_target).value;
	var href1 = 'index.php?mode=AJAX&drawsh=1&type=tags&step=form&target='+p_target+'&tags='+rec;
	q_target = p_target+'_cont';
	s_target = 'a_'+p_target;

	http.msg_target = q_target;
	document.getElementById(q_target).style.display = 'block';
	http.mode = 'get';

	http.doAAction(href1, null);
	
}

function A_tag_add(p_target, p_tag)
{
	var mus = document.getElementById(p_target);
	var muscont = document.getElementById('muscont');
	mus.value += ', '+p_tag;
//	srch = ','+mus.value+',';
//	trace(srch.indexOf(','+uid+','));
/*	if (srch.indexOf(','+p_uid+',') >= 0)
	{
		var musreg = new RegExp(p_uid+"[,]?", "g");
		mus.value = mus.value.replace(musreg, '');
		document.getElementById('musval'+p_uid).innerHTML = '';
		var muscontreg = new RegExp('<div id="musval'+p_uid+'"[^<]*</div>', "g");
		muscont.innerHTML = muscont.innerHTML.replace(muscontreg, '');
	}
	else
	{
		if (mus.value != '' && mus.value.substr(-1) != ',') mus.value += ',';
		mus.value += p_uid;
		muscont.innerHTML += '<div id="musval'+p_uid+'" style="float:left">&nbsp;<a href="javascript:A_mus_add('+p_uid+', \''+p_nick+'\')">'+p_nick+'</a>,</div>';
	}*/
}

function A_login()
{
	var t_div = document.getElementById('full_front');
//	var v_div = document.getElementById('full_value');
//	trace (document.location);

	if (t_div.style.display == 'none')
	{
		var href1 = 'index.php?mode=AJAX&AJAX_login=1';
		http.msg_target = 'full_value_mid';
		http.mode = 'get';
//		http.do_redraw = true;
//		http.redraw_target = '';
//		http.redraw_href = document.location;
	
		http.doAAction(href1, null);
	}
	else
	{
		t_div.style.display = 'none';
		t_div.innerHtml = '';
	}
}

function A_login_refresh()
{
	hide_full_front();
	if (http.comp.responseText == '')
	{
		document.location.replace(document.location.search.replace(/logout[=1]?/gi, ''));
		//itt kell a logout=1-t kiszedni
	}
}

function A_proc_reg()
{
	trace ('meg volt a check a areg után');
	var response = http.comp.responseText;
//	trace (response);
	flag = response.substring(0,1);
//	trace (flag);
//	if (flag == 0 || flag == undefined || flag == null) chg_class(document.getElementById( 'usernev' ), 'input_error');
	document.getElementById( 'AJAX_main' ).innerHTML = response.substring(1);
	if (flag == 1)
	{
		
	}
}

function A_chg_vis(lng)
{
	var d = document.getElementById(lng).style.display
	var newd
	if (d == "none")
	{
		newd = ""
	}
	else
	{
		newd = "none"
	}
//	alert (newd);
	document.getElementById(lng).style.display=newd
}

function A_newCaptcha()
{
	var myDate = new Date();
	document.getElementById( 'captcha_cont' ).src = 'captcha_img.php?t=' + myDate.getTime();
}

function A_gen_files(target)
{
	trace(target);
	var href1 = 'index.php?mode=AJAX&gen_files='+URLEncode(target);
//	href1 += '&norefresh&form_debug';
//	alert (href1);
	http.msg_target = 'files_cont';
	http.mode = 'get';

	http.doAAction(href1, null);
	
}

function A_gen_gal(target, beg, type)
{
	if (beg == undefined) beg = 0;
	var href1 = 'index.php?mode=AJAX&gen_gal='+URLEncode(target)+'&beg='+beg+'&type='+type;
//	href1 += '&norefresh&form_debug';
//	alert (href1);
	http.msg_target = 'gal_cont';
	http.mode = 'get';
	http.doAAction(href1, null);
	
}

function A_gen_galdir(p_target, p_type)
{
	trace(p_target);
	var href1 = 'index.php?mode=AJAX&gen_galdir='+URLEncode(p_target)+'&beg=0&type='+p_type;
//	href1 += '&norefresh&form_debug';
//	alert (href1);
	http.msg_target = 'galdir_cont';
	http.mode = 'get';
	http.doAAction(href1, null);
	
}


function A_avatar_browse()
{
	var objGalCont = document.createElement("div");
	objGalCont.setAttribute('id','gal_cont');
	objGalCont.setAttribute('class','cwin_cont_gal_center');
	document.getElementById('full_value').appendChild(objGalCont);
	http.do_redraw = true;
	http.refrfunc = 'show_full_front("mid")';

	A_gen_gal('innergal/avatar/core', 0, 'avatar');
		
}

function A_icon_browse()
{
	var objGalCont = document.createElement("div");
	objGalCont.setAttribute('id','gal_cont');
	objGalCont.setAttribute('class','cwin_cont_gal_center');
	document.getElementById('full_value').appendChild(objGalCont);
	http.do_redraw = true;
	http.refrfunc = 'show_full_front("mid")';

	A_gen_gal('innergal/icons', 0, 'icon');
		
}

function A_img_browse(p_mode)
{
	var objGalCont = document.createElement("div");
	objGalCont.setAttribute('id','gal_cont');
	objGalCont.setAttribute('class','cwin_cont_gal_center');
	document.getElementById('full_value').appendChild(objGalCont);
	http.do_redraw = true;
	http.refrfunc = 'show_full_front("mid")';

	A_gen_gal('innergal/hirek', 0, p_mode);
		
}

function A_file_det(dlid)
{
	var d = document.getElementById('file_extra_'+dlid);
	invisbyName('file_extra');
	if (d.style.display == 'none')
	{
		d.style.display = 'block';
		var href1 = 'index.php?mode=AJAX&get_file_det='+dlid;
	//	href1 += '&norefresh&form_debug';
	//	alert (href1);
		http.msg_target = 'file_extra_'+dlid;
		http.mode = 'get';
	
		http.doAAction(href1, null);
		
	}
	else
	{
		d.innerHTML = '';
		d.style.display = 'none';		
	}
	
}

function A_get_file(dlid)
{
	var href1 = 'index.php?mode=AJAX&get_file='+dlid;
// ami IE-vel is működik....	
    // create new iframe
    var new_iframe = document.createElement('iframe');
    new_iframe.src = href1;
	new_iframe.style.display = 'none';
    new_iframe.frameBorder = '0';
    document.getElementById('iframe_cont').appendChild(new_iframe);


	return;
// csak FF	az egyszerűbb letöltő box-szal
	trace(document.getElementById('dlFrame').src);
	trace(href1);
	document.getElementById('dlFrame').src = href1;
	
	return;
//	href1 += '&norefresh&form_debug';
//	alert (href1);
	http.msg_target = '';
	http.spec_handle = 'file_passthrough';
	http.mode = 'get';

	http.doAAction(href1, null);

}

function A_reload_ua_clid()
{
	href1 = document.getElementById('ua_clid_query').value + '&mode=AJAX';
	clid = document.getElementById('ua_clid').value;
	if (clid != '')
	{
		href1 += '&clid=' + clid;
	}
	else
	{
		href1 += '&clid=NULL';
	}
		
	http.msg_target = 'userauth_cont';
	http.mode = 'get';

	http.doAAction(href1, null);
}

function A_reload_ua_clid_select()
{
	href1 = document.getElementById('ua_clid_query').value + '&mode=AJAX';
	idx = document.getElementById('ua_clid_select').selectedIndex;
	clid = document.getElementById('ua_clid_select').options[idx].value;
	if (clid != '')
	{
		href1 += '&clid=' + clid;
	}
	else
	{
		href1 += '&clid=NULL';
	}
		
	http.msg_target = 'userauth_cont';
	http.mode = 'get';

	http.doAAction(href1, null);
}

function A_reload_ua_uid()
{
	href1 = document.getElementById('ua_uid_query').value + '&mode=AJAX';
	uid = document.getElementById('ua_uid').value;
	if (uid != '')
	{
		href1 += '&uid=' + uid;
	}
		
	http.msg_target = 'userauth_cont';
	http.mode = 'get';

	http.doAAction(href1, null);
}

function A_reload_ua_uid_select()
{
	href1 = document.getElementById('ua_uid_query').value + '&mode=AJAX';
	idx = document.getElementById('ua_uid_select').selectedIndex;
	uid = document.getElementById('ua_uid_select').options[idx].value;
	if (uid != '')
	{
		href1 += '&uid=' + uid;
	}
		
	http.msg_target = 'userauth_cont';
	http.mode = 'get';

	http.doAAction(href1, null);
}

function A_chg_auth(i_class, clid, level, uid)
{
	href1 = 'index.php?mode=AJAX&chg_auth&class='+i_class+'&clid='+clid+'&level='+level+'&uid='+uid;
	http.msg_target = 'auth_'+i_class+'|'+clid+'|'+level.replace('forb.', '')+'|'+uid;
	http.mode = 'get';

	http.doAAction(href1, null);
}

function A_reload_gid_select()
{
	href1 = document.getElementById('gid_query').value + '&mode=AJAX';
	idx = document.getElementById('gid_select').selectedIndex;
	gid = document.getElementById('gid_select').options[idx].value;
	if (gid == '----')
	{
		return false;
	}
	else
	{
		href1 += '&gid=' + gid;
	}
		
	http.msg_target = 'group_cont';
	http.mode = 'get';

	http.doAAction(href1, null);
}

function A_reload_gtype_select()
{
	href1 = document.getElementById('gid_query').value + '&mode=AJAX';
	idx = document.getElementById('gtype_select').selectedIndex;
	gid = document.getElementById('gtype_select').options[idx].value;
	if (gid == '----')
	{
		return false;
	}
	else
	{
		href1 += '&gtype=' + gid;
	}
		
	http.msg_target = 'main_win';
	http.mode = 'get';

	http.doAAction(href1, null);
}

function A_chg_grp(gid, uid)
{
	href1 = 'index.php?mode=AJAX&chg_memb&gid='+gid+'&uid='+uid+'';

	http.msg_target = 'group_cont';
	http.mode = 'get';

	http.doAAction(href1, null);

}

function A_addSmiley( javafunc ) {
	href1 = 'index.php?mode=AJAX&smlist&javafunc='+javafunc;

	http.msg_target = 'full_value_mid';
	http.mode = 'get';

	http.doAAction(href1, null);
}

function A_admin( javafunc ) {
	href1 = 'index.php?ap&mode=AJAX';

	http.msg_target = 'full_value_mid';
	http.mode = 'get';

	http.doAAction(href1, null);
}

function A_show_pmdir( p_dir ) {
	invisbyName('pmdir_cont');
	document.getElementById(p_dir + '_cont').style.display = 'block';
	A_refresh_pmdir( p_dir, 0);
}

function A_show_pmdet( p_pmid ) {
	href1 = 'index.php?mode=AJAX&pmdet='+p_pmid;
	http.msg_target = 'full_value_mid';
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_refresh_pmdir( dir, beg ){
	href1 = 'index.php?mode=AJAX&pmdir='+dir+'&beg='+beg;
	http.msg_target = dir + '_cont';
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_cat_form( p_parent, p_catid ){
	href1 = 'index.php?mode=AJAX&catadmform&parent='+p_parent+'&catid='+p_catid;
	http.msg_target = 'catadm_cont';
	http.mode = 'get';
	http.doAAction(href1, null);
}

function  A_refr_comments( p_parent, p_beg, p_mode) {
	href1 = 'index.php?mode=AJAX&refrc='+p_parent+'&beg='+p_beg+"&forummode="+p_mode;
	http.msg_target = 'fc_cont_'+p_parent;
	http.mode = 'get';
	http.doAAction(href1, null);
}

function  A_refr_vote(p_target, p_vid, p_mode) {
	href1 = 'index.php?mode=AJAX&vote='+p_vid+'&votemode='+p_mode;
	if (arguments[3] != null) href1 += '&showresult=1';
	http.msg_target = p_target;
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_proc_vote(p_kulcs, p_confirm, p_target, p_mode, p_vid) {
	href1 = 'index.php?mode=AJAX&class=szavazas&vid='+p_vid+'&pid='+p_kulcs+'&confirm='+p_confirm+'&votemode='+p_mode;
	hide_full_front();
	if (p_confirm) {
		http.msg_target = 'AJAX_main';
		http.do_redraw = true;
		http.refrfunc = 'A_refr_vote("'+p_target+'", '+p_vid+', "'+p_mode+'")';
	}
	else {
		http.msg_target = 'full_value_mid';
	}
//	trace (http.refcrfunc);
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_edit_dict(p_clid, p_mode)
{
	var href1 = 'index.php?szotar&db_table=commenttext&class=dictionary&mode=AJAX&clid='+p_clid+'&editmode='+p_mode;
	http.msg_target = 'AJAX_main';
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_edit_dir(p_dlid)
{
	var href1 = 'index.php?editdir='+p_dlid+'&mode=AJAX';
	http.msg_target = 'AJAX_main';
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_scroll_TA(p_bm)
{
	targ = 'muslist';
	if (arguments[1] != null) targ = arguments[1];
	if (feid = document.getElementById("b_"+p_bm).value)
	{
		var firstel = document.getElementById(feid);
		var sdiv = document.getElementById(targ);
		sdiv.scrollTop = firstel.offsetTop - sdiv.offsetTop;
//		trace ("magas:"+firstel.offsetTop)
//		trace (sdiv.scrollTop);
	}
}

function A_chgsel(p_catid, p_oblig, p_name)
{
	idx = document.getElementById('p_'+p_catid).selectedIndex;
	clid = document.getElementById('p_'+p_catid).options[idx].value;
	var href1 = 'index.php?mode=AJAX&mk_chsel='+clid+'&oblig='+p_oblig+'&catname='+p_name;
	http.msg_target = 'grch_'+p_catid;
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_search()
{
	needbase=document.getElementById('needle').value;
	var needle = encodeURIComponent(needbase);
	var href1 = 'index.php?procsearch&mode=AJAX&needle='+needle;
	http.msg_target = 'search_res';
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_searchpart(needle, part, beg)
{
//	needle = encodeURIComponent(document.getElementById('needle').value)
	if (document.getElementById('search_cont').style.display == 'none')
	{
		document.getElementById('search_cont').style.display = 'block';
		chg_picById('pic_stab', loc+'/img/det0.png', loc+'/img/det1.png');
	}
	var href1 = 'index.php?procsearchpart&mode=AJAX&needle='+needle+'&cr='+part+'&beg='+beg;
	if (arguments[3] != null) href1 += '&order='+arguments[3];
	http.msg_target = 'search_cont';
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_searchhit(needle, url)
{
	if (document.getElementById('search_cont').style.display != 'none')
	{
		document.getElementById('search_cont').style.display = 'none';
		chg_picById('pic_stab', loc+'/img/det0.png', loc+'/img/det1.png');
	}
	http.do_redraw = true;
	http.redraw_div = 'main_win';
	http.redraw_href = url;
	var href1 = 'void.php?searchhit&mode=AJAX&needle='+needle+'&url='+encodeURIComponent(url);
	http.mode = 'post';
	http.msg_target = 'AJAX_main';
	http.doAAction(href1, null);
}

function A_teedit(p_db_alias, p_class, p_cid)
{
	var href1 = 'index.php?teedit&mode=AJAX&db_alias='+p_db_alias+'&class='+p_class+'&cid='+p_cid;
	http.msg_target = 'AJAX_main';
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_ren_file(p_dlid, p_confirm)
{
	href1 = 'index.php?mode=AJAX&ren_f='+p_dlid+'&confirm='+p_confirm;
	hide_full_front();
	if (p_confirm) {
		http.msg_target = 'AJAX_main';
/*		http.do_redraw = true;
		http.refrfunc = 'A_cr_dir_post()';*/
	}
	else {
		http.msg_target = 'full_value_mid';
	}
//	trace (http.refcrfunc);
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_cr_dir(p_dir, p_name, p_confirm) {
	href1 = 'index.php?mode=AJAX&cr_dir&dir='+p_dir+'&name='+p_name+'&confirm='+p_confirm;
	hide_full_front();
	if (p_confirm) {
		http.msg_target = 'AJAX_main';
/*		http.do_redraw = true;
		http.refrfunc = 'A_cr_dir_post()';*/
	}
	else {
		http.msg_target = 'full_value_mid';
	}
//	trace (http.refcrfunc);
	http.mode = 'get';
	http.doAAction(href1, null);
}

function A_userlist_part(p_filt)
{
	var href1 = 'index.php?mode=AJAX&users='+p_filt;
	http.msg_target = 'userlist';
	http.mode = 'get';
	http.doAAction(href1, null);
}

function slide(p_targ) //jQuery
{
	var origisrc = $("img#"+p_targ+"_i").attr("src");
	var lensrc = origisrc.length;
	newsrc = origisrc.substring(0, lensrc-5)+ (1 - (eval(origisrc.substring(lensrc-5, lensrc-4)))) + origisrc.substring(lensrc-4);
//	trace(newsrc);
	if ($("div#"+p_targ).is(":hidden")) {
	$("div#"+p_targ).slideDown(200,function () {
							   	$("img#"+p_targ+"_i").attr("src", newsrc);
								}
							   );
	} else {
	$("div#"+p_targ).slideUp(200,function () {
							   	$("img#"+p_targ+"_i").attr("src", newsrc);
								});
	}
}

function A_p(p_tpl, p_target)
{
	var href1 = 'index.php?mode=AJAX&p='+p_tpl;
	document.getElementById('qstr').value = "p="+p_tpl;
	http.msg_target = p_target;
	http.mode = 'get';
	http.doAAction(href1, null);
}


function file_passthrough()
{
	trace('asdasdasdas');
//	document.getElementById('dlFrame').src = http.comp
}

function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}

function rfRecolor(id)
{

	for(i = 1; i <= id; i++)
	{
		document.getElementById('rf_'+i).src = 'img/vote_red.png';	

}
	for(i = id + 1; i <= 10; i++)
	{
		document.getElementById('rf_'+i).src = 'img/vote.png';	
	}
}
function nothing()
{
}

function get_tmp()
{
	var href1 = 'index.php?mode=AJAX&refrc=16086';
	http.msg_target = 'fr_content_i';
	http.mode = 'get';
	
	http.doAAction(href1, null);

}
