function ajanlasOn(target,text) {
	var el = document.getElementById(target);
	if (el.value.length < 1 || el.value == text ) {
		el.value = text;
		el.style.color = "#999";
	}
}

function ajanlasOff(target,text) {
	var el = document.getElementById(target);
	if (el.value == text) {
		el.value = "";
		el.style.color = "#000";
	}
}

function submit_kereso(text,err) {
	var el = document.getElementById('search');
	if(el.value.length < 1){
		$("<div>"+err+"</div>").dialog({modal:true,buttons:{'OK':function(){$(this).dialog('close');} }});
		return false;
	}else if(el.value == text){
		$("<div>"+err+"</div>").dialog({modal:true,buttons:{'OK':function(){$(this).dialog('close');} }});	
		return false;
	}else{
		return true;
	}
}

function elemszam_reload(that,url){
	if(strpos(url, '?')) var sep = '&';
	else var sep = '?';
	document.location.href = '/'+url+sep+'epl='+that.value;
}

function show_categories(){
	var left = document.getElementById("a_cat_menu").offsetLeft;
  	var top = 14+document.getElementById("a_cat_menu").offsetTop;
   /* $(obj1).style.top = top+'px';
    $(obj1).style.left = left+'px';*/
  	if($("#div_cat").html() == ""){	
  		$("#div_cat").html("Betöltés..");
		$.post('/categories.layer', {},
				function(data){
					$("#div_cat").html(data);
				}
		);
  	}
  	$("#a_cat_menu").addClass("menu_act");
  	document.getElementById("div_cat").style.display = 'block';
}

function hide_categories(){
 	$("#a_cat_menu").removeClass("menu_act");
	document.getElementById("div_cat").style.display = 'none';
}

function strpos (haystack, needle, offset) {
    var i = (haystack+'').indexOf(needle, (offset ? offset : 0));
    return i === -1 ? false : i;
}


function kgyAdElvesz(el,kgybe,kgyki,cid,ctitle)
{
    if ($(el).html()==kgybe)
    {
	$(el).html("Hozzáadás...")
	$.post('/felhasznalo/kosarba.html?id='+cid,{},function(){
	    $(el).html(kgyki);
	    $('#befogl'+cid).attr('className','lista_kupongyujtobe_cancel');
	    kgyBeszur(cid,ctitle, kgybe);
	});
    } else {
	$(el).html("Törlés...")
	$.post('/felhasznalo/kosarbol.html?id='+cid,{},function(){
	    $(el).html(kgybe);
	    $('#kuponsor_'+cid).remove();
	    $('#befogl'+cid).attr('className','lista_kupongyujtobe');
	});
    }
    $(el).blur()
}




$('.ltipus').live('change' , function(){
if ( $(this).val() == "customer" ) {
    $('#loginform').attr('action' , '/customer');
} else {
     $('#loginform').attr('action' , '?');
}
});



/*
window.fbAsyncInit = function() {
    FB.init({
      appId   : '132593533472973',
      status  : true, // check login status
      cookie  : true, // enable cookies to allow the server to access the session
      xfbml   : true // parse XFBML
    });

    // whenever the user logs in, we refresh the page
    FB.Event.subscribe('auth.login', function() {
      window.location.reload();
    });
};

(function() {
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/hu_HU/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
}());
    */
