var PeugeotMenu = {
	showSubMenu: function() {
		var pos = $(this).offset();
		$('div', this)
			.css('top', (pos.top + this.offsetHeight) + 'px')
			.css('left', (pos.left - 4) + 'px')
			.show('fast');
	},
	hideSubMenu: function() {
		$('div', this).hide('fast');
	}

}

/*


function ShowIt(t){

	$(t).addClass("sfhover");
	$(t).find(" > ul").css("left","auto").show();
	bum = $(t).find(" > ul").get(0);

	if(findPosX(bum)+bum.offsetWidth >= getWidth()){
		$(t).find(" > ul").css("left","-250px");
		rev = 1
	}
}

function HideIt(t){
	$(t).find(" > ul").css("left","-999em");
	$(t).removeClass("sfhover");
};

function getWidth(){
	var myWidth = 0
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}

	return myWidth;
}
function findPosX(obj){
	var curleft = 0;
	if(obj.offsetParent)
	while(1)
	{
		curleft += obj.offsetLeft;
		if(!obj.offsetParent)
		break;
		obj = obj.offsetParent;
	}
	else if(obj.x)
	curleft += obj.x;
	return curleft;
}
*/


/**
 * Uj auto formbol mezok elrejtese amennyiben keszpenzes fizetest valaszt
 */
Ext.onReady(function() {
    if (Ext.fly('new_car') && Ext.fly(Ext.fly('new_car').dom.payment)) {
	var payment_field = Ext.get(Ext.fly('new_car').dom.payment);
	var hide1 = Ext.get(Ext.fly('new_car').dom.money.parentNode.parentNode);
	var hide2 = Ext.get(Ext.fly('new_car').dom.time.parentNode.parentNode);
	hide1.setVisibilityMode(Ext.Element.DISPLAY);
	hide2.setVisibilityMode(Ext.Element.DISPLAY);

	payment_field.on('change', function(evt, el, o) {
	    if (el.value == "Készpénzzel") {
		hide1.hide();
		hide2.hide();
		hide1.dom.children[1].children[0].value = 'nincs megadva';
		hide2.dom.children[1].children[0].value = 'nincs megadva';
	    } else {
		hide1.dom.children[1].children[0].value = '';
		hide2.dom.children[1].children[0].value = '';
		hide1.show();
		hide2.show();
	    }
	});
    }
});