// qs.fooldal.js
var note;
var event_notes = new Array();
  
$(document).ready(function(){
  var div_id;
    
  $(".datum").datepicker({
    changeMonth: true,
    changeYear: true,
    showWeek: true,

    dateFormat: 'yy-mm-dd',
    firstDay: 1,
    dayNamesMin: ['V','H','K','Sz','Cs','P','Sz'],
    monthNames: ['Január','Február','Március','Április','Május','Június','Július','Augusztus','Szeptember','Október','November','December'],
  });
  
  $(".send_button").click(function(){    
    value = $(".datum").val();
    window.location.href="/Fooldal/datum/"+value;
  });
                    
  $(".tabla div").mouseover(function(){ 
    var class = $(this).attr("class");    
        
    $(".tabla div:not(."+class+")").css({opacity: 0.15});
  });
  $(".tabla div").mouseout(function(){
    var class = $(this).attr("class");    
    
    $(".tabla div:not(."+class+")").css({opacity: 1});
  });  
});  


function record_note_event(id){
  if(!event_notes['"'+id+'"']){
    event_notes['"'+id+'"'] = new Array();
  }
   
  var hossz = event_notes['"'+id+'"'].length;
    
  event_notes['"'+id+'"'][hossz] = $(".options_note").val();
  $(".options ul").prepend($(".options_note").val()+"<br />");
  
  //alert(event_notes['"'+id+'"']);
}
  
function note_event(id,element){
  if(!note){    
    $(".options").append("<input type='text' class='options_note' /><a onclick='record_note_event(\""+id+"\");'>record_note</a>");
    note = true;
  }
  else{
    $(".options_note").remove();
    note = false;
  }                                  
}

function remove(){
  $(".options").remove(); 
  note = false;
}
 
function div_content(esemeny, id, feladat, e, element){  
  remove();
  var content = $(element).attr("title");
  var class = $(element).attr("class");

  $("body").append("<div class=\"options\"><h4 onclick=\"$(this).parent().remove();\">Lehetőségek</h4><p>"+content+"</p><ul><li><a href=\"index.php?menu=Projektek_esemenyek&action=reszletek&id="+esemeny+"\">részletek</a></li><li onclick=\"start_event(\'"+id+"\',\'"+class+"\');remove();\">elkezd</li><li onclick=\"finish_event(\'"+id+"\',\'"+class+"\');remove();\">kész</li><li onclick=\"note_event(\'"+id+"\',this);\">megjegyzés rögzítése</li></ul></div>");          

  $(".options").css("top", e.pageY);
  $(".options").css("left", e.pageX); 
}
