var kiskepdiv;
var ii =100;
var clicked = 0;
$(document).ready(function() {
   //$("input, textarea, select").focus(function (){$(this).addClass('active'); $(this).parent("div").addClass('activeback')});
   //$("input, textarea, select").blur(function (){$(this).removeClass('active'); $(this).parent("div").removeClass('activeback')});
   $("#attach-button").click(function(){
      startupload();
   });

   /*$("#edit-upload").blur(function(){
      startupload();
   })*/

   $(".contenthelp").click(function() {
      var x= this.offsetLeft;
      var y= this.offsetTop;
      $(this).find("div").css({top:y, left:x, "background-color": "white", border:"1px solid black"}).toggle();
      return false;
   });
   /*$(".contenthelp").mouseout(function() {
      $(this).find("div").hide();
   });*/

   //favorites
   $.get("/hun/favorites/getfavorite", function(data){
     $('#fav').html(data);
   });
   $("#addfav, #addfav2").click(function(){
     var name = document.title;
     $.get("/hun/favorites/setfavorite/"+cid+"/"+ctitle);
     $.get("/hun/favorites/getfavorite", function(data){
           $('#fav').html(data);
     });
     return false;
   });

   $(".classaddthum").click(function(){
    $("#classaddbig").attr("src", "/hun/pic/" + $(this).attr("id"));
    return false;
   });

   /*$("#listmenu a").click(function(){
    $("#listmenu a").removeClass('active');
    $(this).addClass('active');
    $("#center").removeClass('classadd');
    var hrr = $(this).attr("id");
    if (hrr == 'foto') {hrr = 1}
    else if (hrr == 'film_video') {hrr = 2}
    else if (hrr == 'kepek') {hrr = 4}
    else return true;
    $.get("/" + lng + "/categories/index/"+hrr+"/ajax", function(data){
     $('#center').html(data);
   });
    return false;
   })*/
})

startupload = function() {
     if (clicked == 1) return;
     clicked = 1;
     jsUpload.createIframe();
     jsUpload.start($("#classaddform"));

     clicked = 0;
     //$(a).click(function(){ $(div).modalContent(null, 'show', 'slow'); return false; });
}
mb_get_list = function(currelement, nextelement) {
  //console.log(currelement);
  $(nextelement)[0].options.length = 0;
  if (nextelement == '#ClassaddFocsoport') {
    $('#ClassaddCategoryId')[0].options.length = 1;
  }

  if (currelement.value) {
    $.post("/hun/classadds/getlist", {parent: currelement.value}, function(xml) {
      eval(xml);
    } );
    $(nextelement).get(0).focus();
  }
}


