var box04 = false; //ez kell hogy letezik e a negyes box;
var box05 = false; //ez kell hogy letezik e a negyes box;

function init() {
	main_poz();
}

function centerNewsBoxHeightS(x,y) {
	obj1 = document.getElementById('centerNewsBoxText'+x);
	obj2 = document.getElementById('centerNewsBoxText'+y);
	boxHeight1 = obj1.offsetHeight;
	boxHeight2 = obj2.offsetHeight;

	newBoxHeight = Math.max(boxHeight1,boxHeight2);
	obj1.style.height = newBoxHeight;
	obj2.style.height = newBoxHeight;
}

function main_poz() {
	var body_width  = document.body.offsetWidth;
	var body_height = document.body.offsetHeight;
	document.getElementById('main-window').style.height = body_height - 5;

	//centerNewsBox-ok magassaganak beallitasa
	centerNewsBoxHeightS(1,4);
	centerNewsBoxHeightS(2,5);
	centerNewsBoxHeightS(3,6);

	centerBoxHeight  = document.getElementById('centerBox').offsetHeight;
	centerBox2Height =document.getElementById('centerBox2').offsetHeight;

	rovatokHeight = Math.max(centerBoxHeight,centerBox2Height);
	document.getElementById('rovatok').style.height = rovatokHeight + 26;

	max = div_max();

	textHeight = document.getElementById('text').offsetHeight;
	textDivFullHeight = document.getElementById('textDivHeight').offsetHeight+25;
	if ( textDivFullHeight != max ) {
		textHeight += max - textDivFullHeight;
		document.getElementById('text').style.height = textHeight;
	}

	newsfile = document.location.href.split("/");
	newsfile2 = newsfile[ newsfile.length-1 ].split("?");
	if ( newsfile2[ 0 ] == "news.php" ) {
	document.getElementById('hle').style.top = max-42;
	}

	document.getElementById('menu').style.height = max-21;
	document.getElementById('box').style.height = max;

	document.getElementById('ikonok').style.top = max-21;

	document.getElementById('main-body').style.height = max + 25;

	//document.getElementById('logo-edomo').style.top = max-22;
	//document.getElementById('logo-molesoft').style.top = max;
	//document.getElementById('stat').style.top = max-20;

	//document.getElementById('box-line').style.top = max - 1;
	//document.getElementById('impresszum').style.top = max;

	if ( body_width < 775 )
	{
		left = 0;
	}
	else left = ( body_width - 793 ) / 2;
	document.getElementById('main-window').style.left = left;

	document.getElementById('main-window').style.visibility = 'visible';
	document.getElementById('text').style.border="1 solid #9C9C9C";
}

function main_poz2(){

	var body_width  = document.body.offsetWidth;
	var body_height = document.body.offsetHeight;

		//centerNewsBox-ok magassaganak beallitasa
	centerNewsBoxHeightS(1,4);
	centerNewsBoxHeightS(2,5);
	centerNewsBoxHeightS(3,6);

	centerBoxHeight  = document.getElementById('centerBox').offsetHeight;
	centerBox2Height =document.getElementById('centerBox2').offsetHeight;
	textHeight = document.getElementById('text').offsetHeight;
	textDivFullHeight = document.getElementById('textDivHeight').offsetHeight+25;

	rovatokHeight = Math.max(centerBoxHeight,centerBox2Height);
	document.getElementById('rovatok').style.height = rovatokHeight + 26;
	max = textDivFullHeight;
	document.getElementById('menu').style.height = max-25;
	document.getElementById('ikonok').style.top = max-25;

	//document.getElementById('text').style.border="1 solid #9C9C9C";

}

onresize = main_poz;

function popUp(pPage,x,y) {
open(pPage,'winPOPUP','resizable=no,scrollbars=no,width='+x+',height='+y);
}

function imgSizer(melyik) {
	obj = document.getElementById("commImg"+melyik);
	imgWidth = obj.width;
	if ( imgWidth > 440 ) {
		imgHeight = obj.height;
		ratio = 440/imgWidth;
		new_imgHeight = imgHeight*ratio;

		obj.width  = 440;
		obj.height = new_imgHeight;
		//obj.style.cursor = "pointer";
		obj.alt = "Nagyobb méret!";

		obj.onclick = function (){ window.open(this.src); };

	}
	obj.style.visibility='visible';
}

function div_max() {
	div_text = document.getElementById('textDivHeight').offsetHeight+25;
	div_menu = document.getElementById('menu').offsetHeight+25;
	div_box = document.getElementById('box').offsetHeight+25;
	html = document.body.offsetHeight - 107+25;
	
	return Math.max(div_text,div_box);
}

function p_links() {
	var link_table = false;
	
	p_length = document.getElementById('p_links').children.length;
	if ( p_length != 0 )
	{
		p_obj = document.getElementById('p_links').firstChild;
		p_obj.style.display = 'none';
		for(j = 1; j < p_length; j++ ) {
			p_obj = p_obj.nextSibling;
			if ( p_obj.getAttribute('href') != null ) {
				link_table = true;
			}
		}
	}
	if ( !link_table )
	{
		document.getElementById('kapcs_link').style.display = 'none';
	}
}

function login() {
	if ( document.getElementById('log_name').value == "" || document.getElementById('log_pass').value == "" )
	{
		alert('Valamelyik mező nincs kitöltve!');
	}
	else {
		document.getElementById('log_form').submit();
	}
}

function reg() {
	document.location.href = "user_reg.php";
}

function car() {
	document.location.href = "car_data_new.php";
}

function mod_reg() {
	document.location.href = "user_mod.php";
}

function logout() {
	document.location.replace('logout.php');
}

function comment() {
	if ( document.getElementById('comm_text').value == "" )
	{
		alert('A comment mező nincs kitöltve!');
	}
	else {
		var text = document.getElementById('comm_text').value;

		iconArray = text.split("[I:");
		textIcon = iconArray[0];
		var img_num = 0;
		for (var i=1; i<iconArray.length; i++)
		{
			elem = iconArray[i].split("]");
			if ( img_num < 5 )
			{
				textIcon += "<img src=\"img/forum_icon_"+elem[0]+".gif\" border=\"0\" hspace=\"1\" align=\"absmiddle\">"+elem[1];
			}
			else {
				textIcon += elem[1];
			}
			for (var j=2; j<elem.length; j++)
			{
				textIcon += "]"+elem[j];
			}
			img_num++;
		}

		//alert(textIcon);

		boldArray = textIcon.split("[B:");
		textBold = boldArray[0];
		for (var i=1; i<boldArray.length; i++)
		{
			elem = boldArray[i].split("]");
			textBold += "<b>"+elem[0]+"</b>"+elem[1];
			for (var j=2; j<elem.length; j++)
			{
				textBold += "]"+elem[j];
			}
		}

		//alert(textBold);

		linkArray = textBold.split("[A:");
		textLink = linkArray[0];
		for (var i=1; i<linkArray.length; i++)
		{
			elem = linkArray[i].split("]");
			elemLink = elem[0].split(";");
			if ( elemLink[1].substr(0,7) != "http://" )
			{
				textLink += "<a href=\""+elemLink[1]+"\" onFocus=\"blur();\">"+elemLink[0]+"</a>"+elem[1];
			}
			else {
				textLink += "<a href=\""+elemLink[1]+"\" onFocus=\"blur();\" target=\"_blank\">"+elemLink[0]+"</a>"+elem[1];
			}
		}

		//alert(textLink);
		document.getElementById('comm').value = textLink;
		document.getElementById('comm_form').submit();
	}
}

function comm_bold() {
	bold = prompt("A bold szöveg:","ide írd be a szöveget");
	if ( bold != null )
	{
		document.getElementById('comm_text').value += "[B:"+bold+"]";
	}
}

function comm_link() {
	nameLink = prompt("A link neve:","ide írd be a link nevét");
	nameUrl = prompt("Az url:","http://");
	if ( nameLink != null || nameUrl != null)
	{
		document.getElementById('comm_text').value += "[A:"+nameLink+";"+nameUrl+"]";
	}
}

function comm_add_pic() {
	picLink = prompt("A kép urlje:","http://");
	if ( picLink != null && picLink != "http://" && picLink != "" )
	{

		document.getElementById('comm_pic').innerHTML = "Kép: <a href=\""+picLink+"\" onFocus=\"blur();\" target=\"_blank\">megtekint</a> - <a href=\"javascript:comm_del_pic();\" onFocus=\"blur();\">töröl</a>";
		document.getElementById('comment_pic').value = picLink;
	}
}

function comm_del_pic() {
	document.getElementById('comm_pic').innerHTML = "&nbsp;Kép: -";
	document.getElementById('comment_pic').value = "";
}

var icon_num = 0;
function comm_icon( icon ) {
	document.getElementById('comm_text').value += "[I:"+icon+"]";
}


function change_gal_num() {
	var step = document.getElementById('list_num').value;
	var id   = document.getElementById('galeri_id').value;
	document.location.href = "galeria.php?id="+id+"&step="+step;
}

function change_car_num() {
	var orderby = document.getElementById('list_num').name;
	var step = document.getElementById('list_num').value;
	document.location.href = "car_list.php?orderby="+orderby+"&step="+step;
}

function chicken_list() {
	var orderby = document.getElementById('list_num').name;
	var step = document.getElementById('list_num').value;
	document.location.href = "chicken_list.php?orderby="+orderby+"&step="+step;
}

function change_forum_num() {
	var step = document.getElementById('list_num').value;
	var id   = document.getElementById('forum_id').value;
	document.location.href = "forum_shower.php?id="+id+"&step="+step;
}
function change_forum_n_num() {
	var step = document.getElementById('list_num').value;
	var id   = document.getElementById('forum_id').value;
	document.location.href = "forum_n_shower.php?id="+id+"&step="+step;
}
function change_forum_m_num() {
	var step = document.getElementById('list_num').value;
	var id   = document.getElementById('forum_id').value;
	document.location.href = "forum_m_shower.php?id="+id+"&step="+step;
}
function change_forum_all_num() {
	var step = document.getElementById('list_num').value;
	var id   = document.getElementById('forum_id').value;
	var name   = document.getElementById('forum_id').name;
	document.location.href = "forum_all_shower.php?"+name+"="+id+"&step="+step;
}

function change_vid_num() {
	var step = document.getElementById('list_num').value;
	var id   = document.getElementById('video_id').value;
	document.location.href = "video.php?id="+id+"&step="+step;
}

function change_gals_num() {
	var step = document.getElementById('list_num').value;
	var galeri_text = document.getElementById('galeri_text').value;
	var search_type = document.getElementById('search_type').value;
	document.location.href = "pic_search.php?search_type="+search_type+"&search_text="+galeri_text+"&step="+step;
}

function change_vids_num() {
	var step = document.getElementById('list_num').value;
	var video_text = document.getElementById('video_text').value;
	var search_type = document.getElementById('search_type').value;
	document.location.href = "video_file_search.php?search_type="+search_type+"&search_text="+video_text+"&step="+step;
}

function change_gal_list() {
	var step = document.getElementById('list_num').value;
	document.location.href = "galeria_list.php?step="+step;
}

function change_news1_list() {
	var step = document.getElementById('list_num').value;
	document.location.href = "news1.php?step="+step;
}

function change_news_list() {
	var list = document.getElementById('list_num').value;
	if ( list != 5 ) {
		document.location.href = "news1.php?list="+list;
	}
	else {
		document.location.href = "news.php?list="+list;
	}
}

function change_account_list() {
	var step = document.getElementById('list_num').value;
	var type = document.getElementById('list_type').value;
	document.location.href = "account.php?T="+type+"&step="+step;
}

function change_preview_list() {
	var list = document.getElementById('list_num').value;
	document.location.href = "preview.php?list="+list;
}

function change_tuning_list() {
	var step = document.getElementById('list_num').value;
	document.location.href = "tuning.php?step="+step;
}

function change_forum_list(id) {
	var list = document.getElementById('list_num').value;
	document.location.href = "forum_tema.php?id="+id+"&step="+list;
}

function change_buy_list() {
	var list = document.getElementById('list_num').value;
	var type = document.getElementById('type_num').value;
	var cat = document.getElementById('cat').value;
	document.location.href = "buy.php?cat="+cat+"&step="+list+"&type="+type;
}

function change_buys_list() {
	var step = document.getElementById('list_num').value;
	var type = document.getElementById('type_num').value;
	var text = document.getElementById('search_text1').value;
	document.location.href = "buy_search.php?search_text="+text+"&step="+step+"&type="+type;
}

function change_type_num( type_num ) {
	var list = document.getElementById('list').value;
	var cat = document.getElementById('cat').value;
	document.location.href = "buy.php?cat="+cat+"&list="+list+"&type="+type_num;
}

function change_types_num( type_num ) {
	var list = document.getElementById('list').value;
	var text = document.getElementById('search_text1').value;
	var start = document.getElementById('start').value;
	var step = document.getElementById('step').value;
	document.location.href = "buy_search.php?start="+start+"&step="+step+"&search_text="+text+"&list="+list+"&type="+type_num;
}

function search_buy1(id) {
	var text = document.getElementById('search_text').value;
	if ( document.getElementById('type1').checked == true && document.getElementById('type2').checked == true )
	{
		type = 2;
	}
	else if ( document.getElementById('type1').checked == true ) {
		type = 0;
	}
	else if ( document.getElementById('type2').checked == true ) {
		type = 1;
	}
	else {
		type = 2;
	}

	if ( id == 1 )
	{
		var cat = document.getElementById('cat').value;
		document.location.href = "buy_search.php?cat="+cat+"&search_text="+text+"&type="+type;
	}
	else {
		document.location.href = "buy_search.php?search_text="+text+"&type="+type;
	}
}

function change_forums_list() {
	var step = document.getElementById('list_num').value;
	var text = document.getElementById('search_text').value;
	document.location.href = "forum_search.php?search_text="+text+"&step="+step;
}

function change_club_list() {
	var start = document.getElementById('hidden1').value;
	var step = document.getElementById('list_num').value;
	var text = document.getElementById('s_text').value;
	document.location.href = "club_search.php?search_text="+text+"&step="+step+"&start="+start;
}

function change_clubaz_list() {
	var step = document.getElementById('list_num').value;
	document.location.href = "club_list.php?step="+step;
}

function change_prog_list() {
	var start = document.getElementById('hidden1').value;
	var step = document.getElementById('list_num').value;
	var text = document.getElementById('s_text').value;
	document.location.href = "prog_search.php?search_text="+text+"&step="+step+"&start="+start;
}

function change_progday_list() {
	var step = document.getElementById('list_num').value;
	var day = document.getElementById('list_num').name;
	document.location.href = "prog_list_day.php?day="+day+"&step="+step;
}

function change_progaz_list() {
	var step = document.getElementById('list_num').value;
	document.location.href = "prog_list.php?step="+step;
}

function change_action_list() {
	var step = document.getElementById('list_num').value;
	document.location.href = "firm_action_list.php?step="+step;
}

function change_accounts_list() {
	var s_text = document.getElementById('s_text').value;
	var start = document.getElementById('hidden1').value;
	var step = document.getElementById('list_num').value;
	var type = document.getElementById('list_type').value;
	document.location.href = "account_search.php?T="+type+"&search_text="+s_text+"&step="+step+"&start="+start;
}

function change_previews_list() {
	var s_text = document.getElementById('s_text').value;
	var start = document.getElementById('hidden1').value;
	var step = document.getElementById('list_num').value;
	document.location.href = "preview_search.php?search_text="+s_text+"&step="+step+"&start="+start;
}

function change_tunings_list() {
	var s_text = document.getElementById('s_text').value;
	var start = document.getElementById('hidden1').value;
	var step = document.getElementById('list_num').value;
	document.location.href = "tuning_search.php?search_text="+s_text+"&step="+step+"&start="+start;
}

function change_gals_list() {
	var s_text = document.getElementById('s_text').value;
	var step = document.getElementById('list_num').value;
	document.location.href = "galeria_search.php?search_text="+s_text+"&step="+step;
}

function change_vids_list() {
	var s_text = document.getElementById('s_text').value;
	var step = document.getElementById('list_num').value;
	document.location.href = "video_search.php?search_text="+s_text+"&step="+step;
}

function change_makers_list() {
	var s_text = document.getElementById('s_text').value;
	var list = document.getElementById('list_num').value;
	document.location.href = "maker_search.php?search_text="+s_text+"&step="+list;
}

function change_firm_list() {
	var list = document.getElementById('list_num').value;
	document.location.href = "firm_list.php?list="+list;
}

function change_maker_list() {
	var list = document.getElementById('list_num').value;
	document.location.href = "maker_list.php?step="+list;
}

function change_firmaz_list() {
	var list = document.getElementById('list_num').value;
	document.location.href = "firm_list.php?step="+list;
}

function change_firm_list0() {
	var text = document.getElementById('hidden3').value;
	var county = document.getElementById('hidden2').value;
	var service = document.getElementById('hidden1').value;
	var start = document.getElementById('hidden4').value;
	var step = document.getElementById('list_num').value;
	document.location.href = "firm_search0.php?search_text="+text+"&search_service="+service+"&search_county="+county+"&start="+start+"&step="+step;
}

function change_vid_list() {
	var step = document.getElementById('list_num').value;
	document.location.href = "video_list.php?step="+step;
}

function gal_search() {
	if ( document.getElementById('r1').checked || document.getElementById('r2').checked )
	{
		document.getElementById('search_form').action = "pic_search.php";
	}
	else document.getElementById('search_form').action = "galeria_search.php";

	document.getElementById('search_form').submit();
}

function vid_search() {
	if ( document.getElementById('r1').checked )
	{
		document.getElementById('search_form').action = "video_file_search.php";
	}
	else document.getElementById('search_form').action = "video_search.php";
	document.getElementById('search_form').submit();
}

function firm_search_change( num ) {
	if ( num ) {
		document.getElementById('tr1').style.display = "none";
		document.getElementById('tr2').style.display = "block";
		document.getElementById('tr3').style.display = "block";
	}
	else {
		document.getElementById('tr1').style.display = "block";
		document.getElementById('tr2').style.display = "none";
		document.getElementById('tr3').style.display = "none";
	}
	document.getElementById('type_search_id').value = num;
}

function firm_search() {
	//alert(document.getElementById('type_search_id').value);
	//num = document.getElementById('type_search_id').value;
	search_num = document.getElementById('type_search_id').value;
	if ( search_num == 1 )
	{
		string = "";
		for(var i=0; i<9; i++){
			if ( document.getElementById('s'+i).checked == true )
			{
				string = string+' "'+document.getElementById('s'+i).value+'"';
			}
		}
		document.getElementById('search_service2').value = "";
		document.getElementById('search_county2').value = document.getElementById('select2').value;
		document.getElementById('search_text2').value = document.getElementById('form_text').value+string;
	}
	else {
		document.getElementById('search_service2').value = document.getElementById('select1').value;
		document.getElementById('search_county2').value = document.getElementById('select2').value;
		document.getElementById('search_text2').value = document.getElementById('form_text').value;
	}
	num = 0;
	document.getElementById('search_form').action = "firm_search"+num+".php";
	document.getElementById('search_form').submit();
}

function reg_ellenoriz() {
	j_nev = document.getElementById('nev').value;
	j_teljes = document.getElementById('teljes').value;
	j_mail = document.getElementById('mail').value;

	if ( j_nev == '' || j_mail == '' || j_teljes == '' ) {
		alert("Minden *-al jelölt mezőt ki kell töltened!");
		return false;
	}
	else if ( j_mail.indexOf ( "@" ) == -1 || j_mail.indexOf ( "." ) == -1 ) {
		alert("Kérjük töltse ki (helyesen) az email mezőt!");
		return false;
	}
	else {
		return true;
	}
}

function reg_mod_ellenoriz() {
	j_teljes = document.getElementById('teljes').value;
	j_mail = document.getElementById('mail').value;

	if ( j_mail == '' || j_teljes == '' ) {
		alert("Minden *-al jelölt mezőt ki kell töltened!");
		return false;
	}
	else if ( j_mail.indexOf ( "@" ) == -1 || j_mail.indexOf ( "." ) == -1 ) {
		alert("Kérjük töltse ki (helyesen) az email mezőt!");
		return false;
	}
	else {
		return true;
	}
}

function buy_ellenoriz() {
	j_title = document.getElementById('title').value;
	j_address = document.getElementById('address').value;
	j_tel = document.getElementById('tel').value;
	j_mail = document.getElementById('mail').value;

	if ( j_title == "" ) {
		alert("Nincs kitöltve a hirdetés címe!");
	}
	else if ( j_title.length > 50 )
	{
		alert("Tul hosszu a megadott cím! Max. 50 karakter lehet!");
	}
	else if ( j_address.length > 50 )
	{
		alert("Tul hosszu a megadott cím! Max. 50 karakter lehet!");
	}
	else if ( j_tel.length > 50 )
	{
		alert("Tul hosszu a megadott telefon! Max. 50 karakter lehet!");
	}
	else if ( j_mail.length > 50 )
	{
		alert("Tul hosszu a megadott E-mail! Max. 50 karakter lehet!");
	}
	else {
		links_send();
	}
}

function search() {
	if ( document.form2.search_text.value == 'vonal' )
	{
		return false;
	}
	else return true;
}

//linkek eloallitasa
var links_url  = new Array();
var links_name = new Array();
var i          = 0;

function links_add() {
	link_begin = document.getElementById('l_url').value.substr(0,7);
	if ( link_begin != "http://" && link_begin != "" ) {
		links_url[i]  = "http://"+document.getElementById('l_url').value;
		if ( links_url[i].length > 40 ) {
			links_name[i] = links_url[i].substr(0,40)+"...";
		}
		else {
			links_name[i] = links_url[i];
		}
		/*re = new RegExp('\r\n','ig');
		links_name[i] = document.getElementById('l_name').value.replace(re,'<BR>');*/
		//alert(links_name[i]);
		i++;
		p_tag();
	}
	else {
		alert('Nem megfelelő a link!');
	}
}

function p_tag() {
	string = "";
	for(var j=0; j < links_url.length; j++){
		if ( links_url[j] != '' )
		{
			if ( links_url[j].length > 25 ) {
				idLinkName = links_url[j].substr(0,25)+"...";
			}
			else {
				idLinkName = links_url[j];
			}
			string = "<b><a href=\""+links_url[j]+"\" target=\"_blank\">"+idLinkName+"</a></b> - <a href=\"javascript:links_del("+j+");\" onFocus=\"blur();\">Töröl</a><BR>"+string;
		}
	}
	document.getElementById('p_links').innerHTML = string;
}

function links_del( num ) {
	if ( num != null ) //nem az osszeset torli
	{
		links_url[ num ]  = '';
		links_name[ num ] = '';
	}
	else {
		for(var j=0; j < links_url.length; j++){
			links_url[ j ]  = '';
			links_name[ j ] = '';
		}
	}
	p_tag();
}

function links_send(){
	string = "";
	for(var j=0; j < links_url.length; j++){
		if ( links_url[j] != '' )
		{
			string = ";"+links_name[j]+","+links_url[j]+string;
		}
	}
	document.getElementById('links_full').value = string.substr( 1, string.length );
	document.getElementById('new_form').submit();
}

function links_send_pic(){
	string = "";
	for(var j=0; j < links_url.length; j++){
		if ( links_url[j] != '' )
		{
			string = ";"+links_name[j]+","+links_url[j]+string;
		}
	}
	document.getElementById('links_full').value = string.substr( 1, string.length );
	//alert(string);
	document.getElementById('form').submit();
}

/*function nextNum(num) {
	evalPic = "";
	for(var j=0; j < links_url.length; j++) {
		if ( links_name[j] != "" ) {
			evalPic += ","+links_name[j].substr(3,links_name[j].length);
		}
	}
	if ( evalPic != "" ) {
		reg = "Math.max("+evalPic.substr(1,evalPic.length)+")";
		return eval(reg)+1;
	}
	else return 0;
}*/

function links_add_pic() {
	link_begin = document.getElementById('l_url').value.substr(0,7);
	if ( link_begin != "http://" && link_begin != "" ) {
		//nextI = nextNum();
		links_url[i]  = "http://"+document.getElementById('l_url').value;
		links_name[i] = "pic"+i;
		//alert("pic"+i);
		i++;
		p_tag_pic();
		document.getElementById('newTable').style.display = "block";
	}
	else {
		alert('Nem megfelelő a link!');
	}
}

function p_tag_pic() {
	string = "";
	for(var j=0; j < links_url.length; j++){
		if ( links_url[j] != '' )
		{
			if ( links_url[j].length > 40 ) {
				idLinkName = links_url[j].substr(0,40)+"...";
			}
			else {
				idLinkName = links_url[j];
			}
			string = "<b><a href=\""+links_url[j]+"\" target=\"_blank\">"+idLinkName+"</a></b> - <a href=\"javascript:links_del_pic("+j+");\" onFocus=\"blur();\">Töröl</a><BR>"+string;
		}
	}
	document.getElementById('p_links').innerHTML = string;
}

function links_del_pic( num ) {
	if ( num != null ) //nem az osszeset torli
	{
		links_url[ num ]  = '';
		links_name[ num ] = '';
	}
	else {
		for(var j=0; j < links_url.length; j++){
			links_url[ j ]  = '';
			links_name[ j ] = '';
		}
	}
	p_tag_pic();
	document.getElementById('newTable').style.display = "block";
}

//

function galeria_dob(id) {
	document.location.href = "galeria.php?id="+id;
}

//szavazas az autokra

function car_vote() {
	document.getElementById('car_vote_form').submit();
}

function chicken_vote() {
	document.getElementById('chicken_vote_form').submit();
}

function ellenoriz_car() {
	num = document.getElementById('form').num;
	for(i=1;i<=num;i++ ) {
		if ( document.getElementById('area'+i).value.length > 250 ){
			string = document.getElementById('text'+i).innerHTML;
			string2 = string.substr(3,string.length);
			newText = string2.substr(0,string2.length-4);
			alert("A "+newText+" max. 250 karakter lehet!");
			return false;
		}
	}
	return true;
}

//car_list radiobuttonok
function car_orderby_change() {
	document.getElementById("car_list_form").submit();
}

//chicken_list radiobuttonok
function chicken_orderby_change() {
	document.getElementById("chicken_list_form").submit();
}

//firm action new ellenoriz
function firm_action_ellenoriz() {
	j_title = document.getElementById('title').value;
	j_from1 = document.getElementById('datum_from1').value;
	j_from2 = document.getElementById('datum_from2').value;
	j_from3 = document.getElementById('datum_from3').value;
	j_to1 = document.getElementById('datum_to1').value;
	j_to2 = document.getElementById('datum_to2').value;
	j_to3 = document.getElementById('datum_to3').value;

	if ( j_title == "" ) {
		alert("Nincs kitöltve a hirdetés címe!");
	}
	else if ( j_title.length > 50 )
	{
		alert("Tul hosszú a megadott cím! Max. 50 karakter lehet!");
	}
	else if ( j_from1 == "" || j_from2 == "" || j_from3 == "" )
	{
		alert("Nincs megadva az akció kezdete!");
	}
	else if ( j_to1 == "" || j_to2 == "" || j_to3 == "" )
	{
		alert("Nincs megadva az akció vége!");
	}
	else {
		links_send();
	}
}
// JavaScript Document
function crt(text1, text2, text3) {
	flc = "HIBA A BEJEGYZÉSKOR! A HIBA OKA :\n\n";
	if (text1.value == "") {
		alert(flc+"A 'név' mező üresen maradt!");
		return false;
	}else if (text2.value == "") {
		alert(flc+"Az 'e-mail cím' mező üresen maradt!");
		return false;
	}else if (text2.value.indexOf("@") < 1 || text2.value.indexOf(".") < 1) {
		alert(flc+"Hibás e-mail cím. ("+text2.value+")! Kérlek adj meg valós címet.");
		return false;	
	}else if (text3.value == "") {
		alert(flc+"A 'hozzászólás' mező üresen maradt!");
		return false;					
	}else{
		return true;
	}
}
function del(text1, text2, text3) {
	text1.value = "";
	text2.value = "";
	text3.value = "";
}
function smili1(text1) {
	text1.value += ":)";
}
function smili2(text1) {
	text1.value += ":(";
}
function smili3(text1) {
	text1.value += ":/";
}


function preloadImages() { 
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function swapImgRestore() { 
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() { 
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

