/* Zsolti kiegészítése */

var loc = location.href;
var domain = loc;

if(domain.indexOf("csere.detuti.hu")!==-1 || domain.indexOf("detuti.hu")!==-1 || domain.indexOf("floretta.hu")!==-1) 
{
}else{window.location.href="http://www.google.com";}




$(document).ready(function(){

$("#logoload").css("display","none");
});


function need_velemeny(){
$.post("zs_ajax.php", {need_velemeny: $("#need_velemeny").val() }, function(msg) {
																	$.facebox.close(); 
																			});	
}

 $(document).ready(function() {
  if(	$(".nifty2").length > 0 ) $(".nifty2").corner();
  if(	$(".nifty3").length > 0 ) $(".nifty3").corner("tl");
   if(	$(".nifty4").length > 0 ) $(".nifty4").corner("tl").corner("bl");
   if(	$(".lehetbox").length > 0 ) $(".lehetbox").corner("3px");
});


 
/***********************/
/**    SIGNUP DOLGAI   **/
/***********************/
function ebp(){
   if ( $("#egeszbp1:checked").val() == "1" ) {
      $("#kinalathelye").fadeOut("slow", function() { $("#egeszbp_yes").fadeIn("fast"); });
	  $("#kinalathelye_good").attr("src","./images/frmgood.png"); 
	  $("#kinalathelye_bad").attr("src","./images/frmbad_gray.png");
	  $("#txtcounty").val("Budapest");
	  $("#txtcity").val("");
	  
	   
	  errorbox("ki", $("#kinalathelye_good").next(".errorbox") );
   }else{
	   $("#egeszbp_yes").fadeOut("slow", function() { $("#kinalathelye").fadeIn("fast"); });
      	  $("#kinalathelye_good").attr("src","./images/frmgood_gray.png"); 
	  $("#kinalathelye_bad").attr("src","./images/frmbad_gray.png");
    	$("#txtcounty").val("");
		$("#txtcity").val("");

	  errorbox("ki", $("#kinalathelye_good").next(".errorbox") );
   }
}

function eorsz(){
   if ( $("#egeszorszag1:checked").val() == "1" ) {
      $("#kinalathelye").fadeOut("slow", function() { $("#egeszorszag_yes").fadeIn("fast"); });
	  $("#kinalathelye_good").attr("src","./images/frmgood.png");
	  $("#kinalathelye_bad").attr("src","./images/frmbad_gray.png");
	
	  errorbox("ki", $("#kinalathelye_good").next(".errorbox") );
   }else{
	   $("#egeszorszag_yes").fadeOut("slow", function() { $("#kinalathelye").fadeIn("fast"); });
      	  $("#kinalathelye_good").attr("src","./images/frmgood_gray.png"); 
	  $("#kinalathelye_bad").attr("src","./images/frmbad_gray.png");
	
	  errorbox("ki", $("#kinalathelye_good").next(".errorbox") );
   }
}

 $(document).ready(function() {
  if(	$(".nifty").length > 0 ) $(".nifty").corner("bottom").corner("tl");
});
function quitnifty(id){
$("#"+id).fadeOut("fast");	
}

 $(document).ready(function(){
   $(".infobox").click(function(){
	 if($("em",this).css("display")=="none"){							
		var pos = $(this).position();
        var newleft=pos.left-180;
		var newtop=pos.top-45;
		$("em",this).css("top",newtop);
		$("em",this).css("left",newleft);
		$("em",this).fadeIn("fast");
   }else{
	 $("em",this).fadeOut("slow");
    }
   });
});
 <!-- Validáló funkció -->
function frm_sgn_valid(mezo){
$("#loadingbadge").css("display","block");	
  if(mezo=="txtusername"){  <!--  USERNAME -->
	$.ajax({
			   
          type: "GET",
          url: "zs_ajax.php?issetuser="+$("#txtusername").val(),
          cache: false,
          dataType : "script",
           async : true,
          success: function(data){
	  if( $("#txtusername").val().length > 20 ||  $("#txtusername").val().length < 6 ){
      $("#txtusername_good").attr("src","./images/frmgood_gray.png");
	  $("#txtusername_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtusername_good").next(".errorbox"), "A felhasználói névnek legalább 6, legfeljebb 20 karakter hosszúságúnak kell lennie!" );
	   }
	   else if( !isNaN($("#txtusername").val().substring(0, 1)) ){
      $("#txtusername_good").attr("src" , "./images/frmgood_gray.png");
	  $("#txtusername_bad").attr("src", "./images/frmbad.png");   
	  errorbox("be", $("#txtusername_good").next(".errorbox"), "A felhasználói névnek betűvel kell kezdődnie!" );
	   }
	   else if(data=="1"){
      $("#txtusername_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtusername_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtusername_good").next(".errorbox"), "Már van ilyen felhasználói névvel regisztrált tagunk!" );
	   }
	   else{
      $("#txtusername_good").attr("src","./images/frmgood.png");
	  $("#txtusername_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#txtusername_good").next(".errorbox") );
	
	   }
   }});  
  }
 if(mezo=="txtpassword"){  <!--  PASSWORD -->
   if( $("#txtpassword").val().length < 6 || $("#txtpassword").val().length > 20 ){
      $("#txtpassword_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtpassword_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtpassword_good").next(".errorbox"), "A jelszónak legalább 6, legfeljebb 20 karakter hosszúságúnak kell lennie!" );	   
   }else{
      $("#txtpassword_good").attr("src","./images/frmgood.png");
	  $("#txtpassword_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#txtpassword_good").next(".errorbox") );	   
   }
 }
 if(mezo=="txtpassword2"){  <!--  PASSWORD2 -->
   if( $("#txtpassword2").val().length < 6 || $("#txtpassword2").val().length > 20 ){
      $("#txtpassword_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtpassword_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtpassword_good").next(".errorbox"), "A jelszónak legalább 6, legfeljebb 20 karakter hosszúságúnak kell lennie!" );	   
   }else if( $("#txtpassword").val()!==$("#txtpassword2").val() ){
      $("#txtpassword_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtpassword_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtpassword_good").next(".errorbox"), "A két jelszó nem egyezik!" );	   	   
   }else{
	  $("#txtpassword_good").attr("src","./images/frmgood.png");
	  $("#txtpassword_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#txtpassword_good").next(".errorbox") );	   
   }
 }
 if(mezo=="txtfirstname"){
 if( $("#txtfirstname").val().length < 2 ){
      $("#txtfirstname_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtfirstname_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtfirstname_good").next(".errorbox"), "Meg kell adni a keresztnevet." );	   
   }else{
      $("#txtfirstname_good").attr("src","./images/frmgood.png");
	  $("#txtfirstname_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#txtfirstname_good").next(".errorbox") );	   
   }	
	
 }
 if(mezo=="txtlastname"){
 if( $("#txtlastname").val().length < 2 ){
      $("#txtlastname_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtlastname_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtlastname_good").next(".errorbox"), "Meg kell adni a vezetéknevet." );	   
   }else{
      $("#txtlastname_good").attr("src","./images/frmgood.png");
	  $("#txtlastname_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#txtlastname_good").next(".errorbox") );	   
   }	
	
 }
 if(mezo=="txtemail"){  <!--  EMAIL -->
  var txtemailval=$("#txtemail").val();
	$.ajax({		   
          type: "GET",
          url: "zs_ajax.php?issetemail="+$("#txtemail").val(),
          cache: false,
          dataType : "script",
           async : true,
          success: function(data){
	  if( $("#txtemail").val().length < 4 ){
      $("#txtemail_good").attr("src","./images/frmgood_gray.png");
	  $("#txtemail_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtemail_good").next(".errorbox"), "Az e-mail cím valószínűleg nem helyes!" );
	   }
	    else if( txtemailval.indexOf("@")=="-1" ){
      $("#txtemail_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtemail_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtemail_good").next(".errorbox"), "Az e-mail cím valószínűleg nem helyes!" );
		}
	   else if(data=="1"){
      $("#txtemail_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtemail_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtemail_good").next(".errorbox"), "Már van ilyen e-mail címmel regisztrált tagunk!" );
	   }
	   else{
      $("#txtemail_good").attr("src","./images/frmgood.png");
	  $("#txtemail_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#txtemail_good").next(".errorbox") );
	
	   }
   }});  
 }
 if(mezo=="txtemailconf"){  <!--  EMAILCONF -->
   var txtemailval=$("#txtemail").val();
   if( $("#txtemailconf").val() !==  txtemailval && $("#txtemailconf").val() !== ""  ){
      $("#txtemail_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtemail_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtemail_good").next(".errorbox"), "A megadott e-mail címek nem azonosak" );	
   }else if( $("#txtemailconf").val() !== "" && $("txtemail_good").attr("src")=="./images/frmgood.png" ){
	   $("#txtemail_good").attr("src","./images/frmgood.png");
	  $("#txtemail_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#txtemail_good").next(".errorbox") );	   
   }
 }
 if(mezo=="txtvalue"){  <!--  TXTVALUE -->
 var val=$("#txtvalue").val().replace(" ","");
   if( val ==  "" || val=="0" ){
      $("#txtvalue_good").attr("src", "./images/frmgood_gray.png");
	  $("#txtvalue_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#txtvalue_good").next(".errorbox"), "Az érték megadása kötelező" );	    	   
   }else{
	   $("#txtvalue_good").attr("src","./images/frmgood.png");
	  $("#txtvalue_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#txtvalue_good").next(".errorbox") );	   
   }
 }
 if(mezo.substr(0,6)=="egyedi"){  <!--  EGYEDI -->
 var val=$("#"+mezo).val().replace(" ","");
   if( val ==  "" ){
      $("#"+mezo+"_good").attr("src", "./images/frmgood_gray.png");
	  $("#"+mezo+"_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#"+mezo+"_good").next(".errorbox"), "Az érték megadása kötelező" );	    	   
   }else{
	   $("#"+mezo+"_good").attr("src","./images/frmgood.png");
	  $("#"+mezo+"_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#"+mezo+"_good").next(".errorbox") );	   
   }
 }
 if(mezo=="accept_tos"){  <!--  TOS -->
   if( $('#accept_tos').is(':checked')  ){  	   
     $("#felh_good").attr("src","./images/frmgood.png");
	  $("#felh_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#felh_good").next(".errorbox") );
  }else{
	$("#felh_good").attr("src", "./images/frmgood_gray.png");
	  $("#felh_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#felh_good").next(".errorbox"), "A használati feltételeket el kell fogadni!" );
   }
 }
 
  if(mezo=="about_me"){  <!--  LEÍRÁS -->
   if( $('#about_me').val().length > 20  ){  	   
     $("#about_me_good").attr("src","./images/frmgood.png");
	  $("#about_me_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#about_me_good").next(".errorbox") );
  }else{
	$("#about_me_good").attr("src", "./images/frmgood_gray.png");
	  $("#about_me_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#about_me_good").next(".errorbox"), "A leírás hossza minimum 20 karakter!" );
   }
 }
   if(mezo=="about_ker"){  <!--  LEÍRÁS -->
   if( $('#about_ker').val().length > 20  ){  	   
     $("#about_ker_good").attr("src","./images/frmgood.png");
	  $("#about_ker_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#about_ker_good").next(".errorbox") );
  }else{
	$("#about_ker_good").attr("src", "./images/frmgood_gray.png");
	  $("#about_ker_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#about_ker_good").next(".errorbox"), "A leírás hossza minimum 20 karakter!" );
   }
 }
 
  if(mezo=="szulev"){  <!--  LEÍRÁS -->
   if( $('#szulev').val().length !== 4  ){  	    
	  $("#szulev_good").attr("src", "./images/frmgood_gray.png");
	  $("#szulev_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#szulev_good").next(".errorbox"), "Születési év helyes megadása kötelező!" );
  }else if( isNaN($('#szulev').val()) ){
	  $("#szulev_good").attr("src", "./images/frmgood_gray.png");
	  $("#szulev_bad").attr("src","./images/frmbad.png");
	  errorbox("be", $("#szulev_good").next(".errorbox"), "Születési év helyes megadása kötelező!" ); 
  }else{
     $("#szulev_good").attr("src","./images/frmgood.png");
	  $("#szulev_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#szulev_good").next(".errorbox") );
   }
 } 
 
   if(mezo=="nem"){  <!--  LEÍRÁS -->
     $("#nem_good").attr("src","./images/frmgood.png");
	  $("#nem_bad").attr("src","./images/frmbad_gray.png");
	  errorbox("ki", $("#nem_good").next(".errorbox") );
 } 
 
 $("#loadingbadge").css("display","none");	
}
function errorbox(mozg,elem,mesg){
$("em .em-inner",elem).html(mesg);
  if(mozg=="be"){
	var pos = $(elem).position();
    var newleft=pos.left-180;
	var newtop=pos.top-45;
	$("em",elem).css("top",newtop);
	$("em",elem).css("left",newleft);
	$("em",elem).fadeIn("fast");  
  }else{
  $("em",elem).fadeOut("slow"); 
  $("em .em-inner",elem).html("");
}}


			

 $(document).ready(function(){	  // LAKHELY 1 működés
   $("#lakhely1").change(function(){					  
	$("#loadingbadge").css("display","block");
	 var thislab=$("option:selected", this).text();
	var ide=$("option:selected",this).text();
	 if (ide.indexOf("-->")=="0"   ) {//bekkelős if
         $("#txtusercity").val("");
		$("#txtusercounty").val("");
       var userfrom = $("#txtuserfrom").val() ;
      	$.post("zs_ajax.php", {"lakhely1" : userfrom}, function(msg) {
				if(msg=="") alert("Hiba tipus : #6193");	
				$("#lakhely1").html(msg);
				$("#txtuserfrom").val( userfrom );
		 });
	         
	 }else if(ide.indexOf("->")=="0" ) { // bekk bekk
		  $("#txtusercity").val("");
		$("#txtusercounty").val("");
		 $("#txtuserfrom").val("");
		 $.post("zs_ajax.php", {"lakhely3" : "-"}, function(msg) {
				if(msg=="") alert("Hiba tipus : #6199");
				$("#lakhely1").html(msg);
		 });
	 }else{//nimncs bekk else
	   
	     if( $("#txtuserfrom").val()=="" ) {  //Ha nincs ország választva
	var userfrom = $("#lakhely1").val() ;
	$.post("zs_ajax.php", {"lakhely1" : userfrom}, function(msg) {
				if(msg=="") alert("Hiba tipus : #6193");	
				$("#lakhely1").html(msg);
				$("#txtuserfrom").val( userfrom );
		 });
	
		 }else if( $("#txtusercounty").val()=="" ) {  //Ha nincs megye választva
	 var usercounty=$("#lakhely1").val();
	$.post("zs_ajax.php", {"lakhely2" : usercounty }, function(msg) {
				if(msg=="") alert("Hiba tipus : #6194");	
				$("#lakhely1").html(msg);
				$("#txtusercounty").val( usercounty );
		 });		 
		 }else{
			$("#txtusercity").val( $("#lakhely1").val() ); 
	  $("#lakhely1_good").attr("src","./images/frmgood.png"); <!-- LAKHELY 1 VALIDÁLÁS-->
	  $("#lakhely1_bad").attr("src","./images/frmbad_gray.png");
	  
	  errorbox("ki", $("#lakhely1_good").next(".errorbox") );	
		 }
	 }//bekkelős if vége
	$("#loadingbadge").css("display","none");
            
});
								
});



 $(document).ready(function(){	  // KINALATHELYE működés
  <!--$("#egeszorszagdiv").fadeIn("slow");-->
   $("#kinalathelye").change(function(){	
	$("#loadingbadge").css("display","block");
	 var thislab=$("option:selected", this).text();
	var ide=$("option:selected",this).text();
	 if (ide.indexOf("-->")=="0"   ) {//bekkelős if
         $("#txtcity").val("");
		$("#txtcounty").val("");
       var from = $("#txtfrom").val() ;
      	$.post("zs_ajax.php", {"lakhely1" : from}, function(msg) {
				if(msg=="") alert("Hiba tipus : #6293");	
				$("#kinalathelye").html(msg);
				$("#txtfrom").val( from );
		 });
	         
	 }else if(ide.indexOf("->")=="0" ) { // bekk bekk
		  $("#txtcity").val("");
		$("#txtcounty").val("");
		 $("#txtfrom").val("");
		 $.post("zs_ajax.php", {"lakhely3" : "-"}, function(msg) {
				if(msg=="") alert("Hiba tipus : #6299");
				$("#kinalathelye").html(msg);
		 });
	 }else{//nimncs bekk else
	   
	     if( $("#txtfrom").val()=="" ) {  //Ha nincs ország választva
	var from = $("#kinalathelye").val() ;
	$.post("zs_ajax.php", {"lakhely1" : from}, function(msg) {
				if(msg=="") alert("Hiba tipus : #6293");	
				$("#kinalathelye").html(msg);
				$("#txtfrom").val( from );
		 });
	
		 }else if( $("#txtcounty").val()=="" ) {  //Ha nincs megye választva
	 var county=$("#kinalathelye").val();
	$.post("zs_ajax.php", {"lakhely2" : county }, function(msg) {
				if(msg=="") alert("Hiba tipus : #6294");	
				$("#kinalathelye").html(msg);
				$("#txtcounty").val( county );
		 });		 
		 }else{
			$("#txtcity").val( $("#kinalathelye").val() ); 
	  $("#kinalathelye_good").attr("src","./images/frmgood.png"); <!-- KINALATHELYE VALIDÁLÁS-->
	  $("#kinalathelye_bad").attr("src","./images/frmbad_gray.png");
	
	  errorbox("ki", $("#kinalathelye_good").next(".errorbox") );	
		 }
	 }//bekkelős if vége
	$("#loadingbadge").css("display","none");
            
});
								
});

function close_kereskapcsol(){
	   $("#kereskapcsol").fadeOut();
	   $("#darkenBackground").fadeOut();	
}


function nextpage2(page,thispage,kinalataim_count){

$("body,html").animate({scrollTop : 120},500);
	
	$("#"+thispage+" .goodjelzo").each(function(){
		if( $(this).attr("src")=="./images/frmgood_gray.png" ) {
		IsFrmError="yes";
		}
      })
		
	if(thispage=="page_1" ) {
         //mi legyen a következő oldal ?
         if( $("#nemkellmasodikoldal").val() !== "1" ) {  
		 page="2";	
		 }else {
		
			      page="5";
          
			 
			 
		 }		
		//
	}
	
	
	
//Leellenőrizzük a zöldeket
var IsFrmError="";
$("#"+thispage+" .goodjelzo").each(function(){
		if( $(this).attr("src")=="./images/frmgood_gray.png" ) {
		IsFrmError="yes";
		}
      })

	if( IsFrmError!=="yes") {   //HA VALIDÁLVA VAN
	$("#txtneednewcatcategory").val("");
$(".pages").fadeOut("fast");
$("#page_"+page).fadeIn("slow");
$("#pagenum").text(page);

if(page=="1") var title="Kínálatom megadása";
if(page=="2") var title="Kulcsszavak és egyedi információk";
if(page=="3") var title="Keresett kínálat megadása";
if(page=="4") var title="Adataim megadása";
if(page=="5") var title="Egyebek";


$("#pagetitle").text(title);
	}else{
		alert("Minden állapotjelzőnek zöldre kell váltania!");
	}
$(document).scrollTop(300);

}

function nextpage(page,thispage,kinalataim_count){
	$("body,html").animate({scrollTop : 120},1000);
	var check_keresem_checked;
	
	$(".check-keresem:checked").each(function(){
		check_keresem_checked = "1";
	});
	
	
	$("#"+thispage+" .goodjelzo").each(function(){
		if( $(this).attr("src")=="./images/frmgood_gray.png" ) {
		IsFrmError="yes";
		}
      })
	
	if(kinalataim_count > 0 && $("#ingyenelviheto:checked").val()!=="1" && IsFrmError!=="yes") {
	   $("#kereskapcsol").fadeIn();
	   $("#darkenBackground").fadeIn();
	}else{
		
	if(thispage=="page_1" ) {
         //mi legyen a következő oldal ?
         if( $("#nemkellmasodikoldal").val() !== "1" ) {  
		 page="2";	
		 }else {
			if($("#ingyenelviheto:checked").val()=="1") 
			      {page="5";}
              else {
				  
				  if( check_keresem_checked == "1" ) {
					  page="5";
				  }else
				  { page="3";}	
				  
			  }
   
			 
			 
		 }		
		//
	}
	if(thispage=="page_2" ) {
          
		if( $("#ingyenelviheto:checked").val()=="1" || check_keresem_checked == "1" )  page="5";	

	   }
	
	
	
//Leellenőrizzük a zöldeket
var IsFrmError="";
$("#"+thispage+" .goodjelzo").each(function(){
		if( $(this).attr("src")=="./images/frmgood_gray.png" ) {
		IsFrmError="yes";
		}
      })

	if( IsFrmError!=="yes") {   //HA VALIDÁLVA VAN
	$("#txtneednewcatcategory").val("");
$(".pages").fadeOut("fast");
$("#page_"+page).fadeIn("slow");
$("#pagenum").text(page);

if(page=="1") var title="Kínálatom megadása";
if(page=="2") var title="Kulcsszavak és egyedi információk";
if(page=="3") var title="Keresett kínálat megadása";
if(page=="4") var title="Adataim megadása";
if(page=="5") var title="Egyebek";


$("#pagetitle").text(title);
	}else{
		alert("Minden állapotjelzőnek zöldre kell váltania!");
	}
$(document).scrollTop(300);
	}
}


function NextAlkat(kat, valaszto_elem, amit_form_tovabbkuld , limit ){ 

$("#txtgender_callfunc").val("NextAlkat('"+kat+"','"+valaszto_elem+"','"+amit_form_tovabbkuld+"','"+limit+"' );");
	
	$("#txtneednewcatcategory").val(kat);
 $("#"+valaszto_elem).html("<div align='center' id='katloadergif' style='position:relative;'><img src='images/ajaxloader2.gif' /></div>");
	$("#"+amit_form_tovabbkuld).val(kat);
 $.post("zs_ajax.php", {nextalkat: kat, velem: valaszto_elem, aft:amit_form_tovabbkuld}, function(msg){
						if(msg!=="") { $("#"+valaszto_elem).html(msg); }
						else { $("#"+valaszto_elem+" #katloadergif").remove(); }
												  });	
  $.post("zs_ajax.php", {actkatname: kat, irany:'kov'}, function(msg){
                      $("#"+valaszto_elem+"selected").html(msg);
												  });	
//VALIDÁLÁS  
  $.post("zs_ajax.php", {actkatlevel: kat}, function(msg){
					  if(msg.charAt(0)!=="*") {//ÜZLETI BARTERNÉL NEM ELÉG 2 ALKAT
					  parseInt(msg);
					 if(msg==2) {
					 showkwordsUJ("kwordstd", $("#"+amit_form_tovabbkuld).val() );
					  }
                    
					if(msg > 1) {
				 $("#"+amit_form_tovabbkuld+"_good").attr("src","./images/frmgood.png"); <!-- GENDER VALIDÁLÁS-->
	             $("#"+amit_form_tovabbkuld+"_bad").attr("src","./images/frmbad_gray.png");
	             errorbox("ki", $("#"+amit_form_tovabbkuld+"_good").next(".errorbox") );	  	  
						  }
					  }else{   //ÜZLETI BARTERNÉL NEM ELÉG 2 ALKAT
					  msg=msg.substr(1);
					  parseInt(msg);
					 if(msg==4) {
					 showkwordsUJ("kwordstd", $("#"+amit_form_tovabbkuld).val() );
					  }
                    
					if(msg > 3) {
				 $("#"+amit_form_tovabbkuld+"_good").attr("src","./images/frmgood.png"); <!-- GENDER VALIDÁLÁS-->
	             $("#"+amit_form_tovabbkuld+"_bad").attr("src","./images/frmbad_gray.png");
	             errorbox("ki", $("#"+amit_form_tovabbkuld+"_good").next(".errorbox") );	  	  
						  }
					  						  
					  }
												  });  
}
function copyto_txtlookgenderhid(amit_form_tovabbkuld, szint){
					var ertek="";
				$('.txtlookgender-checkbox:checked').each(function(){
										ertek=ertek+$(this).val()+"-";
														 });
				         ertek = ertek.slice(0, -1);
	                      $("#txtlookgenderhid").val( ertek );	
						
}
									
function do_valid_1stlevel() {
		var checked_count=0;
	 $(".txtlookgender-checkbox").each(function(){
							
		if( $(this).attr('checked')) {
			checked_count=checked_count+1;
		       }
			   });
	 
				if( checked_count>0 ) {
 $("#txtlookgenderhid_good").attr("src","./images/frmgood.png"); <!-- GENDER VALIDÁLÁS-->
 $("#txtlookgenderhid_bad").attr("src","./images/frmbad_gray.png");	
  errorbox("ki", $("#txtlookgenderhid_good").next(".errorbox") );	
	}else{
 $("#txtlookgenderhid_good").attr("src","./images/frmgood_gray.png"); <!-- GENDER VALIDÁLÁS-->
 $("#txtlookgenderhid_bad").attr("src","./images/frmbad.png");	
errorbox("be", $("#txtlookgenderhid_good").next(".errorbox"), "Legalább egy alkategória kiválasztása kötelező!" )	
	}
												  

	
}

function NextAlkatKer(kat, valaszto_elem, amit_form_tovabbkuld ){

$("#txtgender_callfunc").val("NextAlkatKer('"+kat+"','"+valaszto_elem+"','"+amit_form_tovabbkuld+"' );");

$("#txtneednewcatcategory").val(kat);
       //   if( $('.txtlookgender-checkbox:checked').size() == 0 ) { //HA NINCS KIJELÖLVE SEMMI 	
 $("#"+valaszto_elem).html("<div align='center' id='katloadergif' style='position:relative;'><img src='images/ajaxloader2.gif' /></div>");
	$("#"+amit_form_tovabbkuld).val(kat);
 $.post("zs_ajax.php", {nextalkatker: kat, velem: valaszto_elem, aft:amit_form_tovabbkuld}, function(msg){
						if(msg!=="") { $("#"+valaszto_elem).html(msg); }
						else { $("#"+valaszto_elem+" #katloadergif").remove(); }
												  });	
  $.post("zs_ajax.php", {actkatname: kat, irany:'kov'}, function(msg){
                      $("#"+valaszto_elem+"selected").html(msg);
												  });	
//VALIDÁLÁS  
  $.post("zs_ajax.php", {actkatlevel: kat}, function(msg){
					  parseInt(msg);
					  if(msg > 1  ) {
				 $("#"+amit_form_tovabbkuld+"_good").attr("src","./images/frmgood.png"); <!-- GENDER VALIDÁLÁS-->
	             $("#"+amit_form_tovabbkuld+"_bad").attr("src","./images/frmbad_gray.png");
	             errorbox("ki", $("#"+amit_form_tovabbkuld+"_good").next(".errorbox") );	  	  
						  }
												  });  
		 // }else{
			//alert("Ha ki van jelölve egy kategória, akkor nem lehet az alkategóriájába lépni!");  
		  //}
}
function PrevAlkat(kat, valaszto_elem, amit_form_tovabbkuld ){
 $("#"+valaszto_elem).html("<div align='center' id='katloadergif' style='position:relative;'><img src='images/ajaxloader2.gif' /></div>");
 $.post("zs_ajax.php", {prevalkat: kat, velem: valaszto_elem, aft:amit_form_tovabbkuld}, function(msg){
						if(msg!=="") { 
						var msgArray=msg.split("|||");
						$("#"+valaszto_elem).html(msgArray[1]); 
						$("#"+amit_form_tovabbkuld).val(msgArray[0]);
						 $("#txtneednewcatcategory").val(msgArray[0]);	
	                  				
						}
						else { $("#"+valaszto_elem+" #katloadergif").remove(); }
												  });	
 $.post("zs_ajax.php", {actkatname: kat, irany:'elozo'}, function(msg){
         
				   if( msg.indexOf("<")=="0" ){
					$("#"+valaszto_elem+"selected").html(msg);
					  }else{ $("#"+valaszto_elem+"selected").html("Főkategóriák"); }
												  });	
//VALIDÁLÁS  
  $.post("zs_ajax.php", {actkatlevel: $("#"+amit_form_tovabbkuld).val() }, function(msg){
						parseInt(msg);
                      if( msg > 2) {
				 $("#"+amit_form_tovabbkuld+"_good").attr("src","./images/frmgood.png"); <!-- GENDER VALIDÁLÁS-->
	             $("#"+amit_form_tovabbkuld+"_bad").attr("src","./images/frmbad_gray.png");
	             errorbox("ki", $("#txtgenderhid_good").next(".errorbox") );	  						  
						  }else{
                 $("#"+amit_form_tovabbkuld+"_good").attr("src", "./images/frmgood_gray.png");
	             $("#"+amit_form_tovabbkuld+"_bad").attr("src","./images/frmbad.png");
	             errorbox("be", $("#"+amit_form_tovabbkuld+"_good").next(".errorbox"), "Legalább egy alkategória kiválasztása kötelező!" );	    
						  }
												  });

}
function PrevAlkatKer(kat, valaszto_elem, amit_form_tovabbkuld ){
	$("#txtneednewcatcategory").val(kat);
 $("#"+valaszto_elem).html("<div align='center' id='katloadergif' style='position:relative;'><img src='images/ajaxloader2.gif' /></div>");
 $.post("zs_ajax.php", {prevalkatker: kat, velem: valaszto_elem, aft:amit_form_tovabbkuld}, function(msg){
						if(msg!=="") { 
						var msgArray=msg.split("|||");
						$("#"+valaszto_elem).html(msgArray[1]); 
						$("#"+amit_form_tovabbkuld).val(msgArray[0]);
						 $("#txtneednewcatcategory").val(msgArray[0]);
						
						}
						else { $("#"+valaszto_elem+" #katloadergif").remove(); }
												  });	
 $.post("zs_ajax.php", {actkatname: kat, irany:'elozo'}, function(msg){
         
				   if( msg.indexOf("<")=="0" ){
					$("#"+valaszto_elem+"selected").html(msg);
					  }else{ $("#"+valaszto_elem+"selected").html("Főkategóriák"); }
												  });	
//VALIDÁLÁS  
  $.post("zs_ajax.php", {actkatlevel: $("#"+amit_form_tovabbkuld).val() }, function(msg){
						parseInt(msg);
                      if( msg > 2) {
				 $("#"+amit_form_tovabbkuld+"_good").attr("src","./images/frmgood.png"); <!-- GENDER VALIDÁLÁS-->
	             $("#"+amit_form_tovabbkuld+"_bad").attr("src","./images/frmbad_gray.png");
	             errorbox("ki", $("#txtgenderhid_good").next(".errorbox") );	  						  
						  }else{
                 $("#"+amit_form_tovabbkuld+"_good").attr("src", "./images/frmgood_gray.png");
	             $("#"+amit_form_tovabbkuld+"_bad").attr("src","./images/frmbad.png");
	             errorbox("be", $("#"+amit_form_tovabbkuld+"_good").next(".errorbox"), "Legalább egy alkategória kiválasztása kötelező!" );	    
						  }
												  }); 
}
function reg_kinalathelye_eq_lakhely1(){
	if( $("#txtfrom").val()!=="" && $("#txtcounty").val()!=="" && $("#txtcity").val()!=="" ){
 $("#txtuserfrom").val( $("#txtfrom").val() );
  $("#txtusercounty").val( $("#txtcounty").val() );
   $("#txtusercity").val( $("#txtcity").val() );
   
  $.post("zs_ajax.php", {fillkinalathelye: "y", orszag: $("#txtfrom").val(), megye: $("#txtcounty").val(), varos:$("#txtcity").val() }, function(msg){
						$("#lakhely1").html(msg);	
				 $("#lakhely1_good").attr("src","./images/frmgood.png"); <!-- LAKHELY1 VALIDÁLÁS-->
	             $("#lakhely1_bad").attr("src","./images/frmbad_gray.png");
	             errorbox("ki", $("#lakhely1_good").next(".errorbox") );	
									 });
	}
}
function valdropdown(meiket){
$(".valuedropdowns").css("display","none");

$("#"+meiket+"_drop").css("display","block");
}
/***********************/
/**    SIGNUP DOLGAI END  **/
/***********************/



function do_qs_link(nev,ertek){
var tosubmit="http://www.detuti.hu/kereses_eredmenye-"+nev+"_csere_bere-"+ertek+".html"
$("#qs_link").val(tosubmit);
}


function newqssub(ertek,elem,param) {
/*	var nev = $("#txtqsgender :selected").text();
	var tosubmit="http://www.detuti.hu/kereses_eredmenye-"+nev+"_csere_bere-"+ertek+".html"

$("#qs_link").val(tosubmit);
	
	$('#txtqsgenderhid').val(ertek);*/
if(param=="max2") {

$.ajax({
                type: "POST",
                 url: "../zs_ajax.php",
                  data: "what=qsparentnyito&param=max2&which="+ ertek,
                   success:  function(msg){
			      if(ertek!=='subcancel') {
				// $(elem).attr("disabled","disabled");
				 $('#txtqsgenderhid').val(ertek);
				 $('#txtqsgendertd').html(msg).hide().fadeIn(100); 	 
                 
				 }else{
					$('#txtqsgendertd').html(' ');  
				 }
		                  
						  }
				   
				   });




}else{
	$.ajax({
                type: "POST",
                 url: "../zs_ajax.php",
                  data: "what=qsparent&which="+ ertek,
                   success:  function(msg){
			      if(ertek!=='subcancel') {
				 //$(elem).attr("disabled","disabled");
				 $('#txtqsgendertd').append(msg); 
                 $('#txtqsgenderhid').val(ertek);
				 }else{
					$('#txtqsgendertd').html(' ');  
				 }
		                  
						  }
				   
				   });


}}

$(function(){
			$("select#txtqsgender").change(function(){
												
									$('.txtqsgendersub').remove();
						

												  });});


function saveertesites(detuti,uzenet,userid){
	if( document.getElementById("ujdetuti").checked ) { var detutival="1";	}else{ var detutival="0";}
	if( document.getElementById("ujuzenet").checked ) { var uzenetval="1";	}else{ var uzenetval="0";}
	$.post("zs_ajax.php", {funkcio:"saveertesites", detutivalue:detutival, uzenetvalue:uzenetval, uid:userid}, function(msg){
																												
																												// alert(msg);
																												  });
}

function showitems(items){
$.post("zs_ajax.php", {showitems:items}, function(msg){
												  window.location.href="/";
												  });
}

function validateonthefly(mezo){
	if(mezo=="username"){
	   	$.ajax({
			   
          type: "GET",
          url: "zs_ajax.php?issetuser="+$("#txtusername").val(),
          cache: false,
          dataType : "script",
           async : true,
          success: function(data){
	  if( $("#txtusername").val().length > 20 ||  $("#txtusername").val().length < 6 ){
		 $("#usernametd").css("background-color","#FFBBBB");
		 $("#usernameerror").html("Hiba: Nem megfelelő hosszúságú felhasználói név!");
	   }
	   else if( $("#txtusername").val().substring(0, 1)=="1" ){
		 $("#usernametd").css("background-color","#FFBBBB");
		 $("#usernameerror").html("Hiba: Számmal kezdődő felhasználónév!");  
		   
	   }
	   else if(data=="1"){
		 $("#usernametd").css("background-color","#FFBBBB");
		 $("#usernameerror").html("Hiba: Már létező felhasználónév!");  
	   }
	   else{
	     $("#usernametd").css("background-color","");
	   	$("#usernameerror").html("");
	   }
			  
			  
		   }});

	   
	
	}
	if(mezo=="password"){
	   	
	  if( $("#txtpassword").val().length > 20 ||  $("#txtpassword").val().length < 6 ){
		 $("#passwordtd").css("background-color","#FFBBBB");
		 $("#passworderror").html("Hiba: Nem megfelelő hosszúságú jelszó!");
	   }
	   else{
	     $("#passwordtd").css("background-color","");
	   	$("#passworderror").html("");
	   }
	     
	
	}
		if(mezo=="password2"){
	   	
	  if( $("#txtpassword2").val() !== $("#txtpassword").val() ){
		 $("#password2td").css("background-color","#FFBBBB");
		 $("#password2error").html("Hiba: A két jelszó nem egyezik!");
	   }
	   else{
	     $("#password2td").css("background-color","");
	   	$("#password2error").html("");
	   }
	     
	
	}
	if(mezo=="email"){
	   	
	  if( document.getElementById("txtemail").value.indexOf("@")==-1 ){
		 
		 $("#emailtd").css("background-color","#FFBBBB");
		 $("#emailerror").html("Hiba: Hibásan megadott email cím!");
	   }
	   else{
		 
	     $("#emailtd").css("background-color","");
	   	$("#emailerror").html("");
	   }
	     
	
	}
	if(mezo=="emailconf"){
	   	
	  if( $("#txtemail").val() !== $("#txtemailconf").val()  ){
		 $("#emailconftd").css("background-color","#FFBBBB");
		 $("#emailconferror").html("Hiba: A két email nem egyezik!");
	   }
	   else{
	     $("#emailconftd").css("background-color","");
	   	$("#emailconferror").html("");
	   }
	     
	
	}
}


function removetxtgendersub(){
	
$(".txtgendersub").remove();	
}

function showbyid(){

$.post("zs_ajax.php" , {showbyid: $("#showbyid").val() }, function(msg) {
																if(msg=="nincsilyen"){
																alert("Nincs ilyen azonosítójú kínálat a rendszerben!");	
																}else{
																 window.location.href="/"+msg;	
																}
																
																  });
	
	
}

/**számlázásnál a form piszkálása ***/
$(function(){
$("#frm_atutalas_change").click(function () {
			$("#nyugtaszamla1").attr("disabled","disabled");		
			$("#radionyugtat").css("text-decoration","line-through");	
			$("#nyugtaszamla1").attr("checked", false); 
			$("#nyugtaszamla2").attr("checked", true); 
			$("#szamladiv").css("display","block");
            $("#smsszamladiv").css("display","none");
										  });});
$(function(){
$("#frm_bank_change").click(function () {
$("#nyugtaszamla1").attr("disabled","");	
$("#nyugtaszamla2").attr("disabled","");
$("#nyugtaszamla1").attr("checked", false); 
$("#nyugtaszamla2").attr("checked", false); 
$("#radionyugtat").css("text-decoration","none");
$("#szamladiv").css("display","block");
$("#smsszamladiv").css("display","none");

										  });});
$(function(){
$("#frm_sms_change").click(function () {
$("#nyugtaszamla1").attr("disabled","");	
$("#nyugtaszamla2").attr("disabled","");
$("#nyugtaszamla1").attr("checked", false); 
$("#nyugtaszamla2").attr("checked", false); 
$("#radionyugtat").css("text-decoration","none");
$("#szamladiv").css("display","none");
$("#smsszamladiv").css("display","block");


										  });});
$(function(){
$("#frm_free_change").click(function () {
$("#nyugtaszamla1").attr("disabled","");	
$("#nyugtaszamla2").attr("disabled","");
$("#nyugtaszamla1").attr("checked", false); 
$("#nyugtaszamla2").attr("checked", false); 
$("#radionyugtat").css("text-decoration","none");
$("#szamladiv").css("display","none");
$("#smsszamladiv").css("display","none");


										  });});


function menu(id){
$("#"+id).css("visibility","visible");	
}


function setrovat(id) {
if(id=="462" || id=="463" || id=="461" || id=="460" || id=="260" ||id=="259" ||id=="0" ||id=="1" ||id=="2")	{
$.post("setcookie.php", {dofokatid:id} ,function(msg) {
									  window.location.href = "/";
											 });
}
}
	
function updaterow(column,id, ujertek) {
$.post("zs_ajax.php", {funkcio: "updaterow", mezo:column,ertek: ujertek, row:id});	
alert("Sikeres művelet.");
$("#modker").css("display","none");
$("#modkin").css("display","none");
$("#refreshable2").load("kinalatedit.php?id="+id+" #refreshable2");
$("#refreshable3").load("kinalatedit.php?id="+id+" #refreshable3");
}

function indexpagetiming() {
if(location.href=="http://www.detuti.hu/" || location.href=="http://www.detuti.hu" || location.href=="http://www.detuti.hu/index.php"){
/*$("#linknyitodiv").fadeTo("slow", 0.0);*/	
$("#linknyitodiv").load("linknyito.php #linknyitodiv>*");
var t=setTimeout("indexpagetiming()",15000);	
}
}

if($("#linknyitodiv")) { indexpagetiming(); }


function fbackvote(id) {
$.post("feedback_win.php" , {vote: id } );	
$("#fbacktable").fadeOut('fast', function() {
				$("#fbacktable").load("feedback_win.php" + " #fbacktable").fadeIn('fast');
			});
}

function sendfeedback(form) {
	
	if( $("#securitynum").val() !== $("#securityvalid").val()  ) {

alert("Hibás biztonsági szám !");

 }else{



$.post("feedback_win.php" , {record: $("#txtfback").val() , fbmail:$("#fbmail").val(), securitynum: $("#securitynum").val(), securitytextfield: $("#securitytextfield").val() } );

$("#fadearea").fadeOut('fast', function() {
				$("#fadearea").html("<div align='center' style='color:green;padding:40px;'><h2>Köszönjük !</h2></div>").fadeIn('fast');
			});
$("#fbacktable").fadeOut('fast', function() {$("#fbacktable").load("feedback_win.php" + " #fbacktable").fadeIn('fast');	});

 }
	

}

function adddbtype() {


$.post("zs_ajax.php" , {adddbtype:$("#txtadddbtype").val() });
$.get("zs_ajax.php" , {refreshdbtype:"ok" }, function (data){
								$("#darabrefresh").html(data);	
								$("#darabrefresh2").html(data);
													   });

$("#okay").css("display", "block");
//  $("#darabrefresh").load("zs_ajax.php?refreshdbtype=ok");
// $("#darabrefresh2").load("zs_ajax.php?refreshdbtype=ok");

}
function adddbtypepop(ez){
	

	
							if( $(ez).val()=="más"  ){
jQuery.facebox("<div id='okay' align='center' style='padding:4px;display:none; background-color:#e5f5da; border:2px solid green; color:green; font-weight:bold;'>Köszönjük!<br>Mostmár választhatod az igényelt mennyiség-egységet!</div><h3 align=center>Kérlek add meg az igényelt mennyiség-egységet!</h3><br /><div align='center'><input type='text' id='txtadddbtype' /><input type='submit' value='Hozzáad' onclick='adddbtype();' /></div>");
							}}



function dbmindegyfunc() {
if(document.getElementById("dbmindegy").checked===true) 
   {
	  $("#darabszam").attr("disabled",true);
	  $("#darabtype").attr("disabled",true);
	   
   }
else {
	$("#darabszam").attr("disabled",false);
	  $("#darabtype").attr("disabled",false);  
} }
function dbmindegyfunc2() {
if(document.getElementById("dbmindegyKIN").checked===true) 
   {
	  $("#darabszamKIN").attr("disabled",true);
	  $("#darabtypeKIN").attr("disabled",true);
	   
   }
else {
	$("#darabszamKIN").attr("disabled",false);
	  $("#darabtypeKIN").attr("disabled",false);
}	
}


function check(elem) {
$("#"+elem).attr("checked", true); 	
}


function replaceaddress(userid,page){
	if(page!=="signup" && page!=="signup2") {
$.post("zs_ajax.php", {replaceaddress:userid }, function(msg) {
var fields=msg.split("|");
                                           /*   $("#txtfrom").val(fields[0]);	
											  $("#txtcounty").val(fields[1]);	
											  $("#txtcity").val(fields[2]);	
											  $("#txtzipi").val(fields[3]);
											/*  $("#txtaddress1").val(fields[4]);*/
											  /*$("#txtaddress2").val(fields[5]);*/
		if( fields[0]=="") { var orszag="Nincs megadva"; } else if( fields[0]=="HU") { var orszag = "Magyarország"; } 
		else if( fields[0]=="RO") { var orszag = "Románia"; }else if( fields[0]=="SL") { var orszag = "Szlovákia"; }
		else if( fields[0]=="AT") { var orszag = "Ausztria"; }
		
		if( fields[1]=="") { var megye="Nincs megadva"; } else { var megye = fields[1]; }
		
		if( fields[2]=="") { var varos="Nincs megadva"; } else { var varos = fields[2]; }
		
		$("#txtfrom").replaceWith("<b><i>"+orszag+"</i></b><input type='hidden' name='txtfrom' id='txtfrom' value='"+orszag+"'>");
		$("#txtcounty").replaceWith("<b><i>"+megye+"</i></b><input type='hidden' name='txtcounty' id='txtcounty' value='"+megye+"'>");
		$("#txtcity").replaceWith("<b><i>"+varos+"</i></b><input type='hidden' name='txtcity' id='txtcity' value='"+varos+"'>");
			$("#sameasregaddr").attr("disabled","disabled");									 
														 });	
	}
	
	if(page=="signup"){
	$("#txtfrom").val(  $("#txtuserfrom").val()  );	
	$("#txtcounty").val(  $("#txtusercounty").val()  );	
	$("#txtcity").val(  $("#txtusercity").val()  );	
	$("#txtzip").val(  $("#txtuserzip").val()  );	

	}
	if(page=="signup2"){
	$("#txtuserfrom").val(  $("#txtfrom").val()  );	
	$("#txtusercounty").val(  $("#txtcounty").val()  );	
	$("#txtusercity").val(  $("#txtcity").val()  );	
	$("#txtuserzip").val(  $("#txtzip").val()  );	

	}
}

function affdel(id){
var isdel=confirm("Valóban törlöd magad a rendszerből?");
if (isdel) { $.post("zs_ajax.php", {affdel:id}, function(msg) {
													   window.location.href='http://www.detuti.hu'; 
													   } );
}
}


function numerize(elem) {
var checkOK = "1234567890 ";
var checkStr = $(elem).val();
var allValid = true;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Kérlek csak számokat vagy szóközt írj be! Pl. 12 600 000");
$(elem).val('');
$(elem).focus();
return (false);
}	
	
	
str=$(elem).val();
trimstr = str.split(' ').join('');
backward = trimstr.split("").reverse().join("");
newstr="";
for ( var x = 0; x < backward.length; x++ ) {
if(x%3==0) {var space=" ";}else{var space="";}
newstr=newstr+space+backward.charAt(x);
}
newstr=newstr.split("").reverse().join("");
elem.value=newstr;
}

function neednewcat(sep,kat) {

if(sep!=="1" & sep!=="2") {
	$("#neednewcat").css('visibility','visible');
	
	}if(sep=="1"){
		$("#neednewcat").append("<div id='addnewcatpreloader' style='background-color: #e5f5da; '><img src='/images/ajaxloader2.gif'>&nbsp;<b>Kategória hozzáadása, kérlek várj.</b></div>");
		$("#neednewcatbtn").attr("disabled","disabled");
	var newcatname=$("#txtneednewcat").val();
	var sendermail=$("#sendermail").val();
if(newcatname !== "null" && newcatname !== "" && sendermail !== "null" && sendermail !== ""){
             $.post("../zs_ajax.php", {neednewcat: newcatname, hova:kat, kuldo:sendermail }, function(msg) {
																					alert(msg); 
																					$("#neednewcat").css('visibility','hidden');
																					if(kat!=='' && kat!=='0'){
																					var lastid=$('#divco1').val();
																					lastid=parseInt(lastid);
																					var lastid1=lastid-1;
																					
																					$("#"+lastid1).html('');
																					newsub(kat,'elem',lastid1);
						                                                             
																					 $("#addnewcatpreloader").remove();
																					 $("#neednewcatbtn").removeAttr("disabled");
																					
																					}
							                                                           	});
}else {
alert("Ki kell töltened a mezőket!");	
}
	}
if(sep=="2"){
   $("#neednewcat").css('visibility','hidden');
  }
  
}

function neednewcatUJ(sep,kat,selector) {

if(sep!=="1" & sep!=="2") {
	$("#neednewcat").css('visibility','visible');
		
	}if(sep=="1"){
		$("#neednewcat").append("<div id='addnewcatpreloader' style='background-color: #e5f5da; '><img src='/images/ajaxloader2.gif'>&nbsp;<b>Kategória hozzáadása, kérlek várj.</b></div>");
		$("#neednewcatbtn").attr("disabled","disabled");
	var newcatname=$("#txtneednewcat").val();
	var sendermail=$("#sendermail").val();
if(newcatname !== "null" && newcatname !== "" && sendermail !== "null" && sendermail !== ""){
             $.post("../zs_ajax.php", {neednewcat: newcatname, hova:kat, kuldo:sendermail }, function(msg) {
																					alert(msg); 
																					$("#neednewcat").css('visibility','hidden');
																					if(kat!=='' && kat!=='0'){
																					var lastid=$('#txtgenderhid').val();
																					lastid=parseInt(lastid);
																					var lastid1=lastid-1;
																					
																					$("#"+lastid1).html('');
																					//newsub(kat,'elem',lastid1);
						                                                             
																					 $("#addnewcatpreloader").remove();
																					 $("#neednewcatbtn").removeAttr("disabled");
																					 var refr=$("#txtgender_callfunc").val();
																					eval(refr);
																					
																					}
							                                                           	});
}else {
alert("Ki kell töltened a mezőket!");	
}
	}
if(sep=="2"){
   $("#neednewcat").css('visibility','hidden');
  }
  
}


function owncheckall()  {
 if(document.getElementById('mmcheckall').checked===true) {
	 $(".delsrc").attr("checked", true);
     }
  else {
	   $(".delsrc").attr("checked",false);
  }
}

function lattam(element) {
$.post("../zs_ajax.php", { lattam:element });
$("#"+element).remove();
}
								  




$('#checkall-delsrc').click( function() {

	 $(".delsrc").attr({ 
          checked: "checked"

        });
 });
	


function uncheckall_del() {
				  
 $(".delsrc").removeAttr('checked');
									  }
 
 
 
 

function delfeat(id){
$.post("kinalat.php", { delfeat: id } );
alert("Kiemelés sikeresen eltávolítva. (a csillag frissités után tünik el)");
}

$(function(){
$("#csereertekdoreplace").click(function () {
						$("#csereertekreplace").html('<input name="txtvalue" id="txtvalue" type="text" size="30" maxlength="100" onchange="numerize(this,this.value);"/> (Csak számok és szóköz!)');
								  });});

function csereertekKERdoreplace(){
						$("#csereertekKERreplace").load('zs_ajax.php?what=csereertekkerreplaceshow');
								  }
								  
function csereertekKERredoreplace() {
		$("#csereertekKERreplace").load('zs_ajax.php?what=csereertekkerreplacehide');
								  }


function showkwords(hova,mit) {
	
$("#"+hova).load("zs_ajax.php?kwordsid="+mit);	
}
function showkwordsUJ(hova,mit) {
$("#"+hova).load("zs_ajax.php?kwordsidUJ="+mit);
$.get("zs_ajax.php", {kwordsidUJ: mit, numma:"yes"}, function(msg){
												msg=msg.replace(" ","");		
												
												 if(msg=="00"){
													 $("#nemkellmasodikoldal").val("1");
												 }else{
													 $("#nemkellmasodikoldal").val(""); 
												 }
												 
												 })
}
function showkwordsKER(hova,mit) {

$("#"+hova).load("zs_ajax.php?kwordsKINid="+mit);	
}




	function sendwink(userid){
	
		$.get("sendwinks.php", { ref_id: userid }, alert("Sikeresen elküldted !") );
		
		
		return false;
	}



/*autodel_val set*/
function kinalatshowdel(id){
var conf = confirm('Biztosan törlöd?');
   if(conf) {
	window.location='showkinalat.php?delid='+id;   
   }else{
	
   }
   
}

function set_autodelprof(value) {
	$.post("../zs_ajax.php", { autodelprof:value }, alert("Sikeres módosítás."));
 }


/*delme*/
function deletemecancel(){
$.facebox.close();	
}

function deleteme( id , mess ){

window.location="logout.php?deleteme="+id+"&message="+mess;

}

/*Set pic assign*/
function setkinalomid(mit,mive) {
	$.post("./zs_ajax.php", { whichkinalomid: mit, setkinalomid: mive }, alert("Sikeres módosítás."));
}
function setvidkinalomid(mit,mive) {
	$.post("./zs_ajax.php", { whichvidkinalomid: mit, setvidkinalomid: mive }, alert("Sikeres módosítás."));
}

/*ren kat*/
function admin_renkat(pid) {
												 
 $.post("./managecats.php", { ujnevid:  pid, ujneve:  $("#oldname"+pid).val() } ,function(gr){
																 $("#tabletorefresh").load(location.href+" #tabletorefresh>*"); 
																						  });

}
/*add alkat*/

function admin_addalkat() {
								 
 $.post("./managecats.php", { ujparent: $("#newcatparent").val() , ujname: $("#newcatval").val() }, function(nfg){
															$("#tabletorefresh").load(location.href+" #tabletorefresh>*");
																											 });
	 }


/*add fokat*/
function admin_addfokat() {
jPrompt('Új kategória neve:', '', 'Kérdés', function(ujfokatnev) {
													 
 if(ujfokatnev!==null)
 {$.post("./managecats.php", { addfokatname: ujfokatnev });
 }
 });}
/*delkat*/
function admin_remalkat(pid) {
var bizti = confirm("Biztos törlés?");
if(bizti) {
 $.post("./managecats.php", { delkat: pid }, function(msg){
													   $("#tabletorefresh").load(location.href+" #tabletorefresh>*");
													  });
}

}
 

/* megyék városok betöltése */
$(function(){
			$("select#txtfrom").change(function(){
										
				 $.ajax({
                type: "POST",
                 url: "../zs_ajax.php",
                  data: "what=megyek&which="+ $("select#txtfrom").val(),
                   success:  function(msg){/*ha nincsenek megyék*/
                              if(msg=='') {$("#txtcounty").remove();$("#txtcountytd").append('<input name="txtcounty"  id="txtcounty" type="text" size="30" maxlength="100" value="" />');
							  $("#txtcity").remove();$("#txtcitytd").append('<input name="txtcity"  id="txtcity" type="text" size="30" maxlength="100" value="" />');
							  }
							  else {/*ha vannak megyék*/
								$("#txtcounty").remove();
								 $("#txtcountytd").append('<select class="select" style="width: 175px" name="txtcounty" id="txtcounty" onchange="showvaros(this.value);">'+msg+'</select>');
											  
								  
								 }
                                    }
                    });	
				
				}); 
						
			});	  

function showvaros(megye) {

	$("#txtcity").remove();
	$("#txtcitytd").append('<input name="txtcity"  id="txtcity" type="text" size="30" maxlength="100" value="" />');
$.getJSON("../zs_varosok.php",{id: megye }, function(j){
			$("#txtcity").remove();
		var options = '<select class="select" style="width: 175px" name="txtcity" id="txtcity"><option value="">(kattints!)</option>';
		for (var i = 0; i < j.length; i++) {
		options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';	
		}
		options += '</select>';
        $("#txtcitytd").append(options);
			 });

}
/* end of megyék városok betöltése */
/* megyék városok betöltése X :) */
$(function(){
			$("select#txtuserfrom").change(function(){
										
				 $.ajax({
                type: "POST",
                 url: "../zs_ajax.php",
                  data: "what=megyek&which="+ $("select#txtuserfrom").val(),
                   success:  function(msg){/*ha nincsenek megyék*/
                              if(msg=='') {$("#txtusercounty").remove();$("#txtusercountytd").append('<input name="txtcounty"  id="txtusercounty" type="text" size="30" maxlength="100" value="" />');
							  $("#txtusercity").remove();$("#txtusercitytd").append('<input name="txtcity"  id="txtusercity" type="text" size="30" maxlength="100" value="" />');
							  }
							  else {/*ha vannak megyék*/
								$("#txtusercounty").remove();
								 $("#txtusercountytd").append('<select class="select" style="width: 175px" name="txtcounty" id="txtusercounty" onchange="showuservaros(this.value);">'+msg+'</select>');
											  
								  
								 }
                                    }
                    });	 }); }); 	  

function showuservaros(megye,size,size2) {
if(size==undefined)  { size="175"; size2="30"; }
	$("#txtusercity").remove();
	$("#txtusercitytd").append('<input name="txtusercity"  id="txtusercity" type="text" size="'+size2+'" maxlength="100" value="" />');
 $.getJSON("../zs_varosok.php",{id: megye }, function(j){
			$("#txtusercity").remove();
		var options = '<select class="select" style="width: '+size+'px" name="txtusercity" id="txtusercity"><option value="">(kattints!)</option>';
		for (var i = 0; i < j.length; i++) {
		options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
		}
		options += '</select>';
        $("#txtusercitytd").append(options);
			 });

}
function showuservaros2(megye,size,size2) {
if(size==undefined)  { size="175"; size2="30"; }
	$("#txtusercity2").remove();
	$("#txtusercitytd2").append('<input name="txtusercity"  id="txtusercity2" type="text" size="'+size2+'" maxlength="100" value="" />');
 $.getJSON("../zs_varosok.php",{id: megye }, function(j){
			$("#txtusercity2").remove();
		var options = '<select class="select" style="width: '+size+'px" name="txtusercity" id="txtusercity2"><option value="">(kattints!)</option>';
		for (var i = 0; i < j.length; i++) {
		options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
		}
		options += '</select>';
        $("#txtusercitytd2").append(options);
			 });

}
/* end of megyék városok betöltése X :) */

function showlookmegye(orszag) {
			
				 $.ajax({
                type: "POST",
                 url: "../zs_ajax.php",
                  data: "what=megyek&kinalkeres=keres&which="+ $("select#txtlookfrom").val(),
                   success:  function(msg){/*ha nincsenek megyék*/
                              if(msg=='') {$("#txtlookcounty").remove();$("#txtlookcountytd").append('<input name="txtlookcounty"  id="txtlookcounty" type="text" size="30" maxlength="100" value="" />');
							  $("#txtlookcity").remove();$("#txtlookcitytd").append('<input name="txtlookcity"  id="txtlookcity" type="text" size="30" maxlength="100" value="" />');}
							  else {/*ha vannak megyék*/
								$("#txtlookcounty").remove();
								 $("#txtlookcountytd").append('<select class="select" style="width: 175px" name="txtlookcounty" id="txtlookcounty" onchange="showlookvaros(this.value);">'+msg+'</select>');
											  
								  
								 }
                                    }
                    });	
				
					
}
function showmegye(orszag) {
			
				 $.ajax({
                type: "POST",
                 url: "../zs_ajax.php",
                  data: "what=megyek&kinalkeres=keres&which="+ $("select#txtlookfrom").val(),
                   success:  function(msg){/*ha nincsenek megyék*/
                              if(msg=='') {$("#txtlookcounty").remove();$("#txtlookcountytd").append('<input name="txtlookcounty"  id="txtlookcounty" type="text" size="30" maxlength="100" value="" />');
							  $("#txtlookcity").remove();$("#txtlookcitytd").append('<input name="txtlookcity"  id="txtlookcity" type="text" size="30" maxlength="100" value="" />');}
							  else {/*ha vannak megyék*/
								$("#txtlookcounty").remove();
								 $("#txtlookcountytd").append('<select class="select" style="width: 175px" name="txtlookcounty" id="txtlookcounty" onchange="showlookvaros(this.value);">'+msg+'</select>');
											  
								  
								 }
                                    }
                    });	
				
					
}

 function showmultilookfrom(orszag){

				 $.ajax({
                type: "POST",
                 url: "../zs_ajax.php",
                  data: "what=multiplemegyek&kinalkeres=keres&which="+orszag,
                   success:  function(msg){/*ha nincsenek megyék*/
                              if(msg=='') {
								
								  }
							  else {/*ha vannak megyék*/
								$("#txtlookcounty").html(msg);
																  
								  
								 }
                                    }
                    });	
 }
				

function showlookvaros(megye) {
	$("#txtlookcity").remove();
	$("#txtlookcitytd").append('<input name="txtlookcity"  id="txtlookcity" type="text" size="30" maxlength="100" value="" />');
 $.getJSON("../zs_varosok.php",{id: megye }, function(j){
			$("#txtlookcity").remove();
		var options = '<select class="select" multiple="multiple" size="7" name="txtlookcity" id="txtlookcity" style="width:160px;" ><option value="NULL">Mind</option>';
		for (var i = 0; i < j.length; i++) {
		options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
		}
		options += '</select>';
        $("#txtlookcitytd").append(options);
			 });

}
function showmultilookvaros(megye) {
	 $.ajax({
                type: "POST",
                 url: "../zs_ajax.php",
                  data: "what=multiplevarosok&which="+$("#txtlookcounty").val(),
                   success:  function(msg){/*ha nincsenek megyék*/
                              if(msg=='') {
								
								  }
							  else {/*ha vannak megyék*/
						
								$("#txtlookcity").html(msg);
 
								 }
                                    }
                    });	
	 
$("#txtlookcounty_cont").val($("#txtlookcounty").val());	
}
function multilookvaroskijelol(){
$("#txtlookcity_cont").val($("#txtlookcity").val());	
}
/* end of megyék városok betöltése 2*/

/* Regisztráció QUICKSEARCH Alkategóriázó */


function do_qs_link(nev,ertek){
var tosubmit="http://www.detuti.hu/kereses_eredmenye-"+nev+"_csere_bere-"+ertek+".html"
$("#qs_link").val(tosubmit);
}


	
/* Create the htprequest opbect and process the readystate contents */

function createRequestObject() {
	if (window.XMLHttpRequest && !(window.ActiveXObject)) {
		return new XMLHttpRequest();
	} else if (window.ActiveXObject){
/*		return new ActiveXObject('Microsoft.XMLHTTP'); */
		try {
			return new ActiveXObject('MSXML2.XMLHTTP');  
		} catch (e) {
			return new ActiveXObject('Microsoft.XMLHTTP');
		}
	} 
}

var http = createRequestObject();

function handleResponse() {
    if(http.readyState == 4){
	var response = http.responseText;
	if (response != 'undefined' && response != '') {
		var update = new Array();
		var up2 = new Array();
		if(response.indexOf('|||' != -1)  ) {
		    update = response.split('|||');
  		    for (var i = 1; i<update.length; i++) {
		        up2 = update[i].split("|:|");
		        if (up2[0] != 'undefined' && up2[0] != '' && document.getElementById(up2[0]) ) {
			    document.getElementById(up2[0]).innerHTML = up2[1];
		        } 
		    }
		}
	}
    }
}

if ( use_popups == undefined ) {
	var use_popups = true;
}

function isValidEmail( fieldValue ) {
	if ( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7});+$/.test(fieldValue) )
		return true;

	return false;
}


function isValidURL(url) {

	if ( url == null )
		return false;

/* space extr */
	var reg='^ *';
/* protocol */
	reg = reg+'(?:([Hh][Tt][Tt][Pp](?:[Ss]?))(?:\:\\/\\/))?';
/* usrpwd */
	reg = reg+'(?:(\\w+\\:\\w+)(?:\\@))?';
/* domain */
	reg = reg+'([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|localhost|([Ww][Ww][Ww].|[a-zA-Z0-9].)[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,6});';
/* port */
	reg = reg+'(\\:\\d+)?';
/* path */
	reg = reg+'((?:\\/.*)*\\/?)?';
/* filename */
	reg = reg+'(.*?\\.(\\w{2,4});)?';
/* qrystr */
	reg = reg+'(\\?(?:[^\\#\\?]+)*)?';
/* bkmrk */
	reg = reg+'(\\#.*)?';
/* space extr */
	reg = reg+' *$';

	return url.match(reg);
}

/* returns true if checkStr contains only characters specified in checkOK
   probably can be replaced with a more efficient regular expression  */

function isValidString( checkStr, checkOK ) {

	if ( !checkOK )
		var checkOK = '';

	var allValid = true;

	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);

		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;

		if (j == checkOK.length) {
			allValid = false;
			break;
		}
	}

	return allValid;
}

var alphabeticChars = "aábcdeéfghiíjklmnoóöőpqrstuúüűvwxyzAÁBCDEÉFGHIÍJKLMNOÓÖŐPQRSTUÚÜŰVWXYZ";
var numericChars = "0123456789";

function isNumeric ( fieldValue ) {
	if ( /[0-9]/.test ( fieldValue ) )
		return true;
	return false;
}

function isNumeric( val, addChars ) {
	return isValidString( val, numericChars + addChars );
}

function isAlphabetic( val ) {
	if ( /[A-Za-z]/.test ( val ) )
		return true;
	return false;
}

function isAlphabetic( val, addChars ) {
	return isValidString( val, alphabeticChars + addChars );
}

function isAlphaNumeric( val ) {
	if ( /\w/.test ( val ) )
		return true;
	return false;
}

function isAlphaNumeric( val, addChars ) {
	return isValidString( val, alphabeticChars + numericChars + addChars );
}

function DispDispHide ( disp1, disp2, hide )
{
    if (hide) hide.style.display = 'none';
    if (disp1) disp1.style.display = 'inline';
    if (disp2) disp2.style.display = 'inline';
}

function DispHideHide ( disp, hide1, hide2 )
{
    if (hide1) hide1.style.display = 'none';
    if (hide2) hide2.style.display = 'none';
    if (disp) disp.style.display = 'inline';
}


function openWin(id)
{
	if ( use_popups == false ) {
		window.location.href = 'viewresult.php?pollid=' + id;
		return;
	}

	var width=550;
	var height=378;
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;

	openpopup=window.open('viewresult.php?pollid=' + id ,'','width='+width+',height='+height+',left='+left+',top='+top+',resizable=yes,scrollbars=yes,status=no');
	openpopup.opener.name='abc';
}

function previousPolls(){

	if ( use_popups == false ) {
		window.location.href = 'previouspolls.php';
		return;
	}

	var width=600;
	var height=378;
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;

	openpopup=window.open('previouspolls.php' ,'popupwin','width='+width+',height='+height+',left='+left+',top='+top+',resizable=yes,scrollbars=yes,status=no');
	openpopup.opener.name="abc";
}


function launchTellFriend ()
{
	if ( use_popups == false ) {
		window.location.href = 'tellafriend.php';
		return;
	}

	var left = (screen.width/2) - 400/2;
	var top = (screen.height/2) - 400/2;
	var win = "width=300,height=250,left=" + left + ",top=" + top + ",copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=no";
	window.open("tellafriend.php",'tellfriend',win);
}

function launchTellFriendProfile ( sID )
{
	if ( use_popups == false ) {
		window.location.href = 'tellafriend.php?ID=' + sID;
		return;
	}

	var left = (screen.width/2) - 280/2;
	var top = (screen.height/2) - 280/2;
	var win = "width=280,height=300,left=" + left + ",top=" + top + ",copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
	window.open("tellfriend.php?ID=" + sID,'tellfriendprofile',win);
}

var popUpWin=0;



function popUpWindowMessage(URLStr, align, width, height, msgid)
{

	width = 450;
	height = 450;

	if ( use_popups == false ) {
		window.location.href = URLStr;
		return;
	}

	if( align == 'center' ){

		var left = (screen.width/2) - width/2;
		var top = (screen.height/2) - height/2;
	} else {

		var left = 0;
		var top = 0;
	}

	popUpWin = open(URLStr, 'popUpWin'+msgid, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}



function showIM(msgid){
	popUpWindow('showinstantmsg.php?id=' + msgid,'center',320,260,msgid);
}

function popUpWindow(URLStr, align, width, height, msgid)
{
	if ( use_popups == false ) {
		window.location.href = URLStr;
		return;
	}

	if( align == 'center' ){

		var left = (screen.width/2) - width/2;
		var top = (screen.height/2) - height/2;
	} else {

		var left = 0;
		var top = 0;
	}

	popUpWin = open(URLStr, 'popUpWin'+msgid, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	popUpWin.opener.name="abc1"; 
}


function popUpScrollWindow(URLStr, align, width, heightParam)
{
	if ( use_popups == false  ) {
		window.location.href = URLStr;
		return;
	}

	height = screen.height - 150;
	height = Math.min( height, heightParam );

	if( align == 'center' ){

		var left = (screen.width/2) - width/2;
		var top = (screen.height/2) - height/2;
	}else if( align == 'top' ){

		var left = (screen.width/2) - width/2;
		var top = 0;
	}else{

		var left = 0;
		var top = 0;
	}

	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpScrollWindow2 (URLStr, align, width, heightParam)
{
	if ( use_profilepopups == false ) {
		window.location.href = URLStr;
		return;
	}

	height = screen.height - 150;
	height = Math.min( height, heightParam );

/*	if(popUpWin){

		if(!popUpWin.closed) { popUpWin.close(); }
	}
*/
	if( align == 'center' ){

		var left = (screen.width/2) - width/2;
		var top = (screen.height/2) - height/2;
	}else if( align == 'top' ){

		var left = (screen.width/2) - width/2;
		var top = 0;
	}else{

		var left = 0;
		var top = 0;
	}

	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	popUpWin.opener.name="abc1";
}

var prevRow = null;

function toggleRow(rwId, num){

	if( prevRow != null ) {
		prevRow.style.display ='none';
	}
	prevRow = obj = document.getElementById(rwId);
	obj.style.display ='inline';

	for( i=0; i<document.getElementById('tblSelect').length ; i++ ){

		if( i == num ) {
			document.getElementById('tblSelect')[i].className = "s_table_blue";
		} else {
			document.getElementById('tblSelect')[i].className = "s_table_white";
		}
	}
}



function checkAll(form,name,val){
	for( i=0 ; i < form.length ; i++) {
		if( form.elements[i].type == 'checkbox' && form.elements[i].name == name ) {
			form.elements[i].checked = val;
		}
	}
}

function datefromtovalid(sy,sm,sd,ey,em,ed,msg)
{
	month=new Array("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")
	var syear=sy[sy.selectedIndex].value;
	var smonth=sm[sm.selectedIndex].value;
	var sdays=sd[sd.selectedIndex].value;
	var eyear=ey[ey.selectedIndex].value;
	var emonth=em[em.selectedIndex].value;
	var edays=ed[ed.selectedIndex].value;
	for (var count=0;count<12;count++)
	{
		if ((smonth== month[count]))
		{
			smonth=count;
		}
		if ((emonth== month[count]))
		{
			emonth=count;
		}
	}
	from_date=new Date(syear,smonth,sdays);
	to_date=new Date(eyear,emonth,edays);
	if (from_date > to_date)
	{
	 	alert(msg);
	 	return false;
	}
	return true;
}

function DateCheck(syr, smt, sdt, msg)
{
   hdt=sdt[sdt.selectedIndex].value;
   hmt=smt[smt.selectedIndex].value;
   hyr=syr[syr.selectedIndex].value;

   hms_maxval=31;
   if ((hmt=="APR") || (hmt=="JUN") || (hmt=="SEP") || (hmt=="NOV")){hms_maxval=30;}
   if ((hmt=="FEB") && (hyr%4)==0){hms_maxval=29;}
   if ((hmt=="FEB") && (hyr%4)!=0){hms_maxval=28;}
   if (parseInt(hdt)>hms_maxval)
   {
      alert(msg);
      return false;
   }
   return true;
}



function validateLogin(form)
{
	ErrorMsg = new Array();
	ErrorMsg[0]="------------------------- A következő hibák találhatóak -------------------------" + String.fromCharCode(13);

	CheckFieldString("noblank",form.txtusername,"{$lang.signup_js_errors.username_noblank}");
	CheckFieldString("noblank",form.txtpassword,"{$lang.signup_js_errors.password_noblank}");

	CheckFieldString("alphanum",form.txtusername,"{$lang.signup_js_errors.username_charset}");
	CheckFieldString("alphanum",form.txtpassword,"{$lang.signup_js_errors.password_charset}");

	/* concat all error messages into one string */
	result="";
	if( ErrorCount > 0)
	{
		alert(ErrorMsg[1]);
		return false;
	}
	return true;
}

function confirmLink(theLink, theMessage) {

      var is_confirmed = confirm(theMessage);
      if (is_confirmed) {
         theLink.href += '&delete=Y';
      }
      
      return is_confirmed;
 }

function confirmButton(theMessage) {

      var is_confirmed = confirm(theMessage);

      return is_confirmed;
}

 
 function countCheck(countLimit) {
   if(document.frmCmt.comment.value.length > countLimit) {
     alert('Too many characters in the comment box!');
     document.frmCmt.comment.focus();
     return false; }
   else
     return true; }
 function countText(countLimit) {
   var old = document.frmCmt.counter.value;
   document.frmCmt.counter.value=document.frmCmt.comment.value.length;
   if(document.frmCmt.counter.value > countLimit && old <= countLimit) {
     alert('Too many characters in the comment box!');
     if(document.styleSheets) {
       document.frmCmt.counter.style.fontWeight = 'bold';
       document.frmCmt.counter.style.color = '#ff0000'; } }
   else if(document.frmCmt.counter.value <= countLimit && old > countLimit
	   && document.styleSheets ) {
       document.frmCmt.counter.style.fontWeight = 'normal';
       document.frmCmt.counter.style.color = '#000000'; } 
   }
 
function openInParentWindow(url)
{	window.opener.document.location.href=url;
	window.opener.focus();
}


/* To validate the type of input values in the form fields */
function CheckFieldString(type, formField, strMsg) {

	var checkOK;
	var checkStr = formField.value;
  	var allValid = true;
	var flagDot  = false;
	var namestr, domainstr;
	
	if (type == 'noblank')
	{
		if (checkStr == "")
  		{
  			ErrorCount++;
	   	 	ErrorMsg[ErrorCount] = strMsg  ;
  		}
	} else 	{
		if(type == "isntsamemail") {
		  if(document.frmSignup.txtemail.value!==document.frmSignup.txtemailconf.value) { 
		ErrorCount++;
	   	 	ErrorMsg[ErrorCount] = "Két email cím nem egyforma!"  ;
		  }
		}
				if(type == "isntsamemailtell") {
		  if(document.frmCompose.txtrcpntemail.value!==document.frmCompose.txtrcpntemail_again.value) { 
		ErrorCount++;
	   	 	ErrorMsg[ErrorCount] = "Két email cím nem egyforma!"  ;
		  }
		}
		if (type == 'integer')	{
  			checkOK = "0123456789";
  		} else if (type == 'decimal'){	
  			checkOK = "0123456789.";
		} else if (type == 'text') {
			checkOK = "AÁBCDEÉFGHIÍJKLMNOÓÖŐPQRSTUÚÜŰVWXYZaábcdeéfghiíjklmnoóöőpqrstuúüűvwxyz "; 
			/*checkOK = text_chars;      Zsolti*/
		} else if (type == 'alphanumeric') {
		checkOK = "0123456789.+-_#,/AÁBCDEÉFGHIÍJKLMNOÓÖŐPQRSTUÚÜŰVWXYZaábcdeéfghiíjklmnoóöőpqrstuúüűvwxyz ()_"; 
			/*checkOK = alphanumeric_chars;*/
		} else if (type == 'full') {
			checkOK = "0123456789.,[]{}=+-_#,/AÁBCDEÉFGHIÍJKLMNOÓÖŐPQRSTUÚÜŰVWXYZaábcdeéfghiíjklmnoóöőpqrstuúüűvwxyz  ()_:;'\\*^%$@<>?'\"\'";
			/*checkOK = full_chars;*/
		} else if (type == 'alphanum') {
			checkOK = "0123456789_AÁBCDEÉFGHIÍJKLMNOÓÖŐPQRSTUÚÜŰVWXYZabcdeéfghiíjklmnoóöőpqrstuúüűvwxyz "; 
			/*checkOK = alphanum_chars;*/
		} else if (type == 'email'){
			checkOK = "0123456789_-@.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
				if ( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7});+$/.test(checkStr) ){
				}else{
					ErrorCount++;
					ErrorMsg[ErrorCount] = strMsg ;
				}
		} else if (type == 'phone') {
			checkOK = "0123456789-+";
		} else if (type == 'URL') {
			checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:/\\";
		} else if (type == 'path') {
			checkOK = "0123456789.+-_#,/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz () \\ ";
		}		

  		for (i = 0;  i < checkStr.length;  i++)
  		{
    		ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++) {
	      		if (ch == checkOK.charAt(j)) {
					break; }
				if (j == checkOK.length-1 ){
					
					allValid = false;
					break;
				}
			}
		
			if (type == 'decimal') /* for decimal type */
			{
				for (t = 0;  t < checkStr.length;  t++){	
				
					dot = checkStr.charAt(t)
					if (dot =='.' && flagDot == false) {
						flagDot=true;
					} else if (dot =='.' && flagDot == true){
					
						ErrorCount++;
						ErrorMsg[ErrorCount] = strMsg ;
						break;
					}
				}
			}
				
			if (!allValid){
			
				ErrorCount++;
				ErrorMsg[ErrorCount] = strMsg ;
				break;
			}
     	}
  	}
}


