// felsomen� inicializ�l�s
//var menu = new UvumiDropdown('dropdown-menu', {mode:'vertical', duration: 0});
//var menu_wa = new UvumiDropdown('dropdown-webaruhaz', {mode:'vertical'});

window.addEvent('domready', function() {

	var myMenu = new MenuMatic({ id: 'dropdown-menu', orientation:'vertical', duration: 0 });	

	// akci� flash
	var flash_1 = new Swiff('/swf/akcio.swf', {
	    id: 'flash_epitoanyag_akciok_id',
	    width: 160,
	    height: 80,
	    container: 'flash_epitoanyag_akciok'
	});

	// el�rhetos�g kamara
	var flash_2 = new Swiff('/swf/kamara.swf', {
	    id: 'flash_elerh_kamara_id',
	    width: 160,
	    height: 80,
	    container: 'flash_elerh_kamara'
	});
	
	
	// el�rhetos�g f�ti
	var flash_3 = new Swiff('/swf/foti.swf', {
	    id: 'flash_elerh_foti_id',
	    width: 160,
	    height: 80,
	    container: 'flash_elerh_foti'
	});

	// aj�nlatk�ro accordion
	var myAccordion = new Accordion($('accordion'), 'a.toggler', 'div.element', {
		opacity: true,
		alwaysHide: false,
		display: -1,
		show: -1,
		onActive: function(toggler, element){
			//toggler.setStyle('color', '#41464D');
		},
		onBackground: function(toggler, element){
			//toggler.setStyle('color', '#528CE0');
		}
	});
	
	// tipek
	/*var t = new Tips('.tip', {
		maxOpacity: 0.9, 
		maxTitleChars: 100, 
		className: 'tooltip',
		hideDelay:50,
		showDelay:50,
		offsets:{x:10,y:10},
		onShow: function(toolTip) {
			toolTip.fade(0.9);
		},
		onHide: function(toolTip) {
			toolTip.fade('out');
		}
	});
	
	// linkekn�l / jel el�rak�s
	anchorAddSlash();*/

});

// linkekn�l / jel el�rak�s
function anchorAddSlash()
{
	var anchors = $('col_middle').getElements('a');
	anchors.each(function(v,k){
		var href = v.get('href');
		if(
		   href.charAt(0) != '/' && 
		   href.indexOf('http://') == -1 && 
		   href.indexOf('javascript:') == -1
		)v.set("href","/" + href);
	});
}

// aj�nlatk�ro functions
function copySzallitasi()
	  {
	  	$('ert_irsz').value = $('szall_irsz').value;
	  	$('ert_orszag').selectedIndex = $('szall_orszag').selectedIndex;
	  	$('ert_varos').value = $('szall_varos').value;
	  	$('ert_utca').value = $('szall_utca').value;
	  	$('ert_hsz').value = $('szall_hsz').value;
	  }
	  function copyErtesitesi()
	  {
	  	$('szam_irsz').value = $('ert_irsz').value;
	  	$('szam_orszag').selectedIndex = $('ert_orszag').selectedIndex;
	  	$('szam_varos').value = $('ert_varos').value;
	  	$('szam_utca').value = $('ert_utca').value;
	  	$('szam_hsz').value = $('ert_hsz').value;
	  }

	function changeTermek()
	{
		$('step').value = 3;
		$('ajanlatForm').submit();
	}

function betoltUser()
{
	//$('user_betolt').value = 1;	
	$('ajanlatFormBetolt').submit();
}
function setStepAndSubmit(step)
{
	$('step').value = step;
	$('ajanlatForm').submit();
}

// form t�rl�s
function clearForm(formName)
{
	var form = $(formName);	
	if(form != null)
	{
		// inputok
		var inputs = form.getElements('input');
		inputs.each(function(v,k){
			// text vagy password input
			if(v.get('type') == "text" || v.get('type') == "password")
			{
				v.set('value','');
			}
			// checkbox vagy radio
			else if(v.get('type') == "checkbox" || v.get('type') == "radio")
			{
				v.set('checked','false');
			}
		});
		// selectek
		var selects = form.getElements('select');
		selects.each(function(v,k){
			v.selectedIndex = 0;
		});
		// textarea-k
		var textareas = form.getElements('textarea');
		textareas.each(function(v,k){
			v.set('html','');
		});
	}
}
