// JavaScript Document

function FormSubmit(melyik,merre) {
	var merre_id = document.getElementById('merre');
	
	if ( merre_id != null ) {
		merre_id.value = merre;
		eval('document.'+melyik+'.submit()');
	}
}

function NumberCheck(obj) { 
	obj.value = obj.value.replace(/[^0-9, ',']/g, ''); 
}

function InsertRightBox(id, text, add) {
	var elem = document.getElementById(id);
	if ( elem != null ) {
		if ( add ) {
			elem.innerHTML += text;
		} else {
			elem.innerHTML = '&nbsp;&nbsp;&nbsp;&bull; '+text;
		}
	} else {
		//alert('Error');
	}
}


function in_array (needle, haystack, int) {
	var key = ''; 
	
	for (key in haystack) {
		if (haystack[key] == needle) {
			if ( int ) return key;
				else return true;
		}
	}
	if ( int ) return -1;
		else return true;
}

function InsertOption(obj,text) {
	if ( !obj.checked ) {
		for (i=0;i<seloptions.length;i++) {
			if (seloptions[i] == text) {
				seloptions.splice(i, 1);
	            break;
			}
		}
	} else {
		seloptions.push(text);
	}
	
	document.getElementById('selected').value	= seloptions;
	
	document.getElementById('option').innerHTML = '';
	
	for(var k in optionlist) {
		id = in_array(k.substr(1), seloptions, true);
		if ( id != -1 ) {
			InsertRightBox('option', optionlist["#"+seloptions[id]], true);
		}
	}
}

function TextBoxVisible(show,srsz) {
	var textBoxTR	= document.getElementById('textboxTR'+srsz);
	var textBox		= document.getElementById('textbox'+srsz);
	if ( show == 'n' ) {
		 textBoxTR.style.display = 'none';
		 textBox.value	= '';
	} else if ( ( show == 'i' ) || ( show == 'k' ) ) {
		 textBoxTR.style.display = '';
		 textBox.value	= '';
	}
	
	return true;
}


function mutat(kep,kepw,keph){
	$('#showimg').html("<img src='"+kep+"' alt=\"Töltés\" onclick=\"elrejt()\"/>");
	var monw = $(window).width();

	var cssOpt = {'width':kepw+'px',
				  'height':keph+'px',
				  'position':'absolute',
				  'left':((monw/2)-(kepw/2))+'px',
				  'border':'1px solid #fff',
				  'backgroundColor':'#fff',
				  'padding':'6px',
				  'zIndex':'100',
				  'top':'50px'}
				  
	$('#showimg').css(cssOpt);
	$('#showimg').fadeIn(250);
}

function elrejt(id){
	$('#showimg').fadeOut(250);
}

function box() {
	var id = 'box';
	var width = $(window).width();
	var scrollTop = $(window).scrollTop();

	var cssOpt = {'width':'250',
				  'text-align':'center',
				  'position':'absolute',
				  'left':((width/2))+'px',
				  'border':'1px solid #211f1d',
				  'backgroundColor':'#fff',
				  'color':'#211f1d',
				  'padding':'6px',
				  'zIndex':'10',
				  'top':'200px'}
	$('#'+id).css(cssOpt);
	$('#'+id).fadeIn(250);
}



