// GDF HÖK JS
//HÍRLEVÉL FELIRATKOZÁS
$(document).ready(function(){
    
   $('#emoticons').click(function() {
    $("#show_emoticons").toggle(1500);
   });   
    
$("form#newsletter").submit(function() {  
            // we want to store the values from the form input box, then send via ajax below  
            var email     = $('#email').attr('value');  
          
                $.ajax({  
                    type: "POST",  
                    url:  "newsletter.php",  
                    data: "email="+ email, 
                      success: function(response)
                        {
                          if (response == "0") alert("Hibásan adtad meg az e-mail címedet");
                          if (response == "1") alert("Sikeresen feliratkozott a hírlevél listánkra. \nKöszönjük.");
                          if (response == "2") alert("Hiba történt, kérjük próbálja meg később");
                          if (response == "3") {
                                              var valasz = confirm("Ez az e-mail cím már szerepel a hírlevél listánkba !\nLeiratkozik a hírlevél listánkról ?");
                                              if (valasz){
                                                          $.ajax({  
                                                                  type: "POST",  
                                                                  url:  "newsletter.php",  
                                                                  data: "act=leiratkozas&email="+email,
                                                                  success: function(response)
                                                                    {
                                                                     if (response == "0") alert("Sikertelen leiratkozás.\nIsmeretlen hiba !");
                                                                     if (response == "1") alert("Sikeresen leiratkozott a hírlevél listánkról !");
                                                                     if (response == "8") alert("Kakker !");
                                                                    }
                                                          }); 
                                                          } 
                                               else{}
                                              }
                                                  
                        }
                });  
            return false;  
            });
//BETŰMÉRET         
var originalFontSize = $('#content').css('font-size');
$(".reset").click(function(){
$('#content').css('font-size', originalFontSize);
});
// BETŰMÉRET NÖVELÉSE
$(".increase").click(function(){
	var currentFontSize = $('#content').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
  var newFontSize = currentFontSizeNum*1.2;
$('#content').css('font-size', newFontSize);
return false;
});
// BETŰMÉRET CSÖKKENTÉSE
$(".decrease").click(function(){
	var currentFontSize = $('#content').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
  var newFontSize = currentFontSizeNum*0.8;
$('#content').css('font-size', newFontSize);
return false;
});            
        });
  function mutat(mit)
  {
    if ($("#hidden_"+ mit).is(":hidden")) {
        $('#hidden_'+ mit).fadeIn(500);
    }
    else {
    $('#hidden_'+ mit).fadeOut(500);
    }
  }
function gyik(mit)
  {
    if ($("#content_"+ mit).is(":hidden")) {
        $('#content_'+ mit).slideDown(1000);
    }
    else {
    $('#content_'+ mit).slideUp(1000);
    }   
  } 
  function delBook(book_id)
        {
          var reply = confirm('Törlöd a bejegyzést ?');
          if(reply) {
                    $.ajax({
                                  type: "POST",  
                                  url:  "mod/del_book.php",  
                                  data: "act=del_book&id="+book_id+"", 
                                  success: function(response)
                                    {
                                    if (response == "0") { $('#book_'+book_id).slideUp(2000); }                                         
                                    if (response == "1") { alert("Nem sikerült törölni a bejegyzést !"); }                       
                                    }                            
                            });
                    }
        } 
  function del_gcomm(comm_id)
        {
          var reply = confirm('Törlöd a hozzászólást ?');
          if(reply) {
                    $.ajax({
                                  type: "POST",  
                                  url:  "mod/del_gcomm.php",  
                                  data: "act=del_comm&id="+comm_id+"", 
                                  success: function(response)
                                    {
                                    if (response == "0") { $('#comm_'+comm_id).fadeOut(1000); }                                         
                                    if (response == "1") { alert("Nem sikerült törölni a bejegyzést !"); }                       
                                    }                            
                            });
                    }
        }        
   function show_comm(id) 
     {
      $('#comm_div_'+ id).toggle(2000);
    }
   function add_warn(id) 
     {
      
      $(function(){
       $.ajax({
            url: "pages/user_warn.php?uid="+id+"",
            success: function(data){
                $.facybox(data);
            }
        });
        })

    }    
     function modShout(shout_id)
        {
          var reply = prompt("A moderálás indoka: ", "");
          if(reply) {
                    $.ajax({
                                  type: "POST",  
                                  url:  "mod/mod_shout.php",  
                                  data: "act=mod_shout&id="+shout_id+"&prompt="+reply, 
                                  success: function(response)
                                    {
                                    if (response == "0") { 
                                       $('#shout_'+shout_id).fadeOut(1000);
                                       location.reload(true);
                                           
                                       }                                         
                                    if (response == "1") { alert("Nem sikerült törölni az üzenetet !"); }                       
                                    }                            
                            });
                    }
        }
   function delShout(shout_id)
        {
          var reply = confirm('Végleg törlöd a hozzászólást ?');
          if(reply) {
                    $.ajax({
                                  type: "POST",  
                                  url:  "mod/del_shout.php",  
                                  data: "act=del_shout&id="+shout_id+"", 
                                  success: function(response)
                                    {
                                    if (response == "0") { 
                                       $('#shout_'+shout_id).slideUp(1000);
                                       }                                         
                                    if (response == "1") { alert("Nem sikerült törölni az üzenetet !"); }                       
                                    }                            
                            });
                    }
        }      
function addFav(fav_type,file_id,url)
        {
          var reply = confirm('Kedvenceidhez teszed ?');
          if(reply) {
                    $.ajax({
                                  type: "POST",  
                                  url:  "mod/add_fav.php",  
                                  data: "act=add_fav&fav_type="+fav_type+"&id="+file_id+"", 
                                  success: function(response)
                                    {
                                    if (response == "0") { 
                                      alert("A kedvenceidbe tettük !");
                                      window.location = "index.php?"+url+"#shoutbox";                                    
                                       }                                         
                                    if (response == "1") { alert("Nem sikerült a kedvenceidhez adni !"); } 
                                    if (response == "2") { alert("Nem adtuk a kedvenceidhez !\nEz már szerepel a kedvenceid között!");}                      
                                    }                            
                            });
                    }
        }

 function delFav(fav_type,file_id,url)
        {
          var reply = confirm('Törlöd a kedvenceid közül ?');
          if(reply) {
                    $.ajax({
                                  type: "POST",  
                                  url:  "mod/add_fav.php",  
                                  data: "act=del_fav&fav_type="+fav_type+"&id="+file_id+"", 
                                  success: function(response)
                                    {
                                    if (response == "0") { 
                                    $('#fav_'+file_id).fadeOut(1000);
                                       }                                         
                                    if (response == "1") { alert("Nem sikerült törölni a kedvenceidből !"); }                       
                                    }                            
                            });
                    }
        }        
         
//Hozzászólás értékelése        
$(function(){  
$("a.vote_up").click(function(){  
 //get the id  
 the_id = $(this).attr('id');  
   
 // show the spinner  
 $(this).parent().html("<img src='themes/images/spinner.gif'/>");  
   
 //fadeout the vote-count   
 $("span#votes_count"+the_id).fadeOut("fast");  
   
 //the main ajax request  
  $.ajax({  
   type: "POST",  
   data: "action=vote_up&id="+$(this).attr("id"),  
   url: "mod/votes.php",  
   success: function(msg)  
   {  
    
    $("span#votes_count"+the_id).html(msg);  
    //fadein the vote count  
    $("span#votes_count"+the_id).fadeIn();  
    //remove the spinner  
    $("span#vote_buttons"+the_id).remove();  
   }  
  });  
 });
$("a.vote_down").click(function(){  
 //get the id  
 the_id = $(this).attr('id');  
   
 // show the spinner  
 $(this).parent().html("<img src='themes/images/spinner.gif'/>");  
   
 //fadeout the vote-count   
 $("span#votes_count"+the_id).fadeOut("fast");  
   
 //the main ajax request  
  $.ajax({  
   type: "POST",  
   data: "action=vote_down&id="+$(this).attr("id"),  
   url: "mod/votes.php",  
   success: function(msg)  
   {  
    $("span#votes_count"+the_id).html(msg);  
    //fadein the vote count  
    $("span#votes_count"+the_id).fadeIn();  
    //remove the spinner  
    $("span#vote_buttons"+the_id).remove();  
   }  
  });  
 });   
});    
