// Febukkano buborek szoveg a formoknal
var MARGIN_TOP = 5;
var MARGIN_LEFT = 4;

function showHint(message, el, paddingTop, paddingLeft ) {
    if(message == null || message == '') { return; }
    if(!paddingTop) {
        paddingTop = 0;
    }
    if(!paddingLeft) {
        paddingLeft = 0;
    }
    var hint = $("span#hint-frame");
    if(hint.size()==0) {
        $("body").append("<span id=\"hint-frame\" class=\"hint\"></span>");
        hint = $("span#hint-frame");
    }
    hint.css("visibility", "visible");
    hint.css("display", "block");
        
    var dialogLeft = el.absolutePosition().left + el.width() + paddingLeft + MARGIN_LEFT;
    var dialogTop = el.absolutePosition().top  + paddingTop - MARGIN_TOP;
    
    hint.css("top", dialogTop + "px");
    hint.css("left", dialogLeft + "px");
    hint.html(message);
    hint.append("<span class=\"hint-pointer\"></span>");
}
function closeHint() {
    var hint = $("span#hint-frame");
    hint.css("visibility", "hidden");
    hint.css("display", "none");
}

function prepareInputsForHints(){
	$("form#dialogue input:text").focus( function(){showHint($("span.hint",$(this).parent()).html(),$(this));} );
	$("form#dialogue input:password").focus( function(){showHint($("span.hint",$(this).parent()).html(),$(this));} );
	$("form#dialogue input:checkbox").focus( function(){showHint($("span.hint",$(this).parent()).html(),$(this), 0, $("label",$(this).parent()).width());} );
	$("form#dialogue select").focus( function(){showHint($("span.hint",$(this).parent()).html(),$(this));} );
	$("form#dialogue textarea").focus( function(){showHint($("span.hint",$(this).parent()).html(),$(this));} );
	$("form#dialogue input").blur( function(){closeHint();} );
	$("form#dialogue select").blur( function(){closeHint();} );
	$("form#dialogue textarea").blur( function(){closeHint();} );
}
$(document).ready( function(){prepareInputsForHints();} );

// Tartalom elrejto/megjelenito
var ids=new Array('hided-content1','hided-content2','hided-content3','hided-content4','hided-content5','hided-content6');
function switchid(id,menuid){	
	hideallids();
	showdiv(id,menuid);
}
function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i],i+1);
	}		  
}
function hidediv(id,menuid) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
		document.getElementById('menu'+menuid).style.color = '#666';
		document.getElementById('menu'+menuid).style.borderBottom = '2px solid #a2a2a2';
		document.getElementById('menu'+menuid).style.padding = '5px 4px 4px 4px';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}
function showdiv(id,menuid) {
	//safe function to show an element with a specified id 
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
		document.getElementById('menu'+menuid).style.color = '#da241b';
		document.getElementById('menu'+menuid).style.borderBottom = '2px solid #da241b';
		document.getElementById('menu'+menuid).style.padding = '7px 4px 6px 4px';			
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';

		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
