$(document).ready(function(){

     /*
var longness=0;
$(".head-link-li a").hover(function()
{
  $("#air-inner").text($(this).text());
  $("#air-message").css("top",$(this).attr("topvalue")+"px");
  $("#air-message").css("left",$(this).attr("leftvalue")+"px");
  $("#air-message").show();
  longness = $(this).text().length;
  longness =  (-1)*(Math.round(140-(longness*9.7)));
  $('#air-inner').animate({"left": longness+"px"},400,function(){});
},function()
{
  $('#air-inner').css("left","-140px");
  $("#air-message").hide();
});
        */






  function subMenuShow(mainMenuName){

  

     $("#sub_menu_box li").each(function(){

 

        if ($(this).attr("class") == mainMenuName){

        

          $(this).show();



        }



     });

  

  }

  



  



   $(".sub").hover(function(){

      

     $("#sub_menu_box li").hide();

     $("#sub_menu_box").show();

     var nm = $(this).attr("id").replace("menu_","").replace("_eng",""); 

     var a = "x";  

     for (i=0; i<menuLefts.length; i++){

     

        if (menuLefts[i].menu == nm){

         

         a = menuLefts[i].left + "px"; 

         

       $("#sub_menu_box").css("left",a);

      

        

        }

     

     }

      

     subMenuShow(nm);

   

   }

   

  

   

   );

     

  $("#head-linkmenu, .nosub, #left-pos").hover(function(){

   

      $("#sub_menu_box").hide();

      

   });

   

   $("#sub_menu_box, #page").hover(function(){},

   

   function(){

    

      $("#sub_menu_box").hide();

   

   });

   

   



   

   

  

   function sub2Loader(mainMenuName){

   

      $("#sub2_menu li").hide();

      

      $("."+$("#sub2_"+mainMenuName).attr("class")).show();

   

   }

   

   function changeContent(contID){

   

   $(".main-content-divs").hide();

   

   $("#cont_"+contID).show(); 

   $("#cont_"+contID + ' div').show();

   $("#cont_"+contID + ' div.loading-div').hide();

   };

 

            

   $(".nosub a, #sub_menu_box a, #sub2_menu ul li a, .inner_link").click(function(){

   

      var showDiv = $(this).attr("id").replace("link_","").replace("sub_","").replace("sub2l_","").replace("inner_","");

      

      changeContent(showDiv);

      $("div#instr_output, div#cont_zenekarok div#bands_output").html("");
      
      $('table#gear-select-table input').each(function(){
        
        $(this).removeAttr('checked');
      
      });
      
      $("div.profile-box").css("border-color","white");
      
      
      
      sub2Loader(showDiv); 

   

   });          

             

 

  

  

  $(".video-list td span").click(function(){

    

    var yt_id=$(this).attr("id").replace("video_link_","");

    

    var newVid = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/';

    

    newVid = newVid+yt_id;

    

    newVid = newVid+'=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/';

    

    newVid = newVid+yt_id;

    

    newVid = newVid+'&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br /><br /><a href="http://www.youtube.com/watch?v=';

    

    newVid = newVid+yt_id;

    

    newVid = newVid+'" target="_blank">A video Youtube-on</a>';

  

    $(".tv-screen").html(newVid);

    

    $(document).scrollTo( { top:100, left:0}, 800 );

    

  });

  

  
 
//videoplay



function videoclose(){

$("#videoplayerbox").hide();

$("#videoplayerbox").css("top","-400px");



}



 fadeVideoBoxes("div#content");


function fadeProfBoxes(wrapper){
    
      $(wrapper+' div.profile-text-box').fadeTo("fast",0.6);
    
    } 
    
    
     function fadeVideoBoxes(wrapper){
    
       $(wrapper+' div.showvideolink').each(function() {
        
        $(this).children('img').fadeTo(100,0.1);
        
        $(this).css("background-image","url("+ "http://i4.ytimg.com/vi/" + $(this).attr("videourl") + "/default.jpg)");
      
      });
    } 
   
    
    fadeProfBoxes("div#content");



 

$(".showvideolink img").hover( 


        

        function(){

          $(this).fadeTo(300, 0.5);

         

        },

        

        function(){

       $(this).fadeTo(300,0.1);

        

        }

        

        ); 

    

$(".showvideolink").live("click", function(){



var boxhtml = '<h2>BEZÁR</h2><object width="320" height="196"><param name="movie" value="http://www.youtube.com/v/';



boxhtml = boxhtml+$(this).attr('videourl')+'=en_US&fs=1&rel=0"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/';



boxhtml = boxhtml+$(this).attr('videourl')+'&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="320" height="196"></embed></object>';

 

$("#videoplayerbox").html('<div style="padding-top:90px;"><img src="http://mikibirta.com/images/loadingvideo.gif"></div>');

 

$("#videoplayerbox").show();

$(document).scrollTo( { top:0, left:0}, 600, function(){



  $("#videoplayerbox").animate({"top": "0px"},800,function(){



      $("#videoplayerbox").html(boxhtml);  

  

  });



} );





});



$("#videoplayerbox").click(function(){

  $(this).html(".");

  $("#videoplayerbox").animate({"top": "-400px"},600,function(){

   $(this).hide();

  });

});




//video



function langboxsize(){

  

  $("#chooselanguage").css("height", $(document).height());

  $("#chooselanguage").css("width", $(window).width());



}



  langboxsize();

  

  $(window).bind('resize', function() { 

    langboxsize();

  });



function googlepop(text){



  alert(text);

  var iframetext='http://maps.google.com/maps?f=q&source=s_q&hl=hu&geocode=&q='+text;

      

  

  

  my_window = window.open("","mywindow1","status=1,width=425,height=350");

  my_window.document.write(iframetext);  



}



$(".googlemapslink").click(function(){



  googlepop($(this).attr("address"));



});




var locPath=location.pathname;

function showLoc(stringStuff,_location,trueBack,falseBack){

    if (_location.match(stringStuff)!="magyar") {
          
          return falseBack; 
        
        } else {
            
            return trueBack;
            
            }

}

 

function menuLeft(_text,_leftNum){

   

      this.menu = _text;

      this.left = _leftNum;

   

   }

   

   var menuLefts = new Array();

   menuLefts[0]=new menuLeft(showLoc("magyar",locPath,"hirek","hirek"), showLoc("magyar",locPath,0,0));
   
   menuLefts[1]=new menuLeft(showLoc("magyar",locPath,"magamrol","magamrol"), showLoc("magyar",locPath,61,70));
   
   menuLefts[2]=new menuLeft(showLoc("magyar",locPath,"oktatas","oktatas"), showLoc("magyar",locPath,164,185)); 
   
   menuLefts[3]=new menuLeft(showLoc("magyar",locPath,"letoltesek","letoltesek"), showLoc("magyar",locPath,246,288));
   
   menuLefts[4]=new menuLeft(showLoc("magyar",locPath,"felszereles","felszereles"), showLoc("magyar",locPath,465,287));
   
   menuLefts[5]=new menuLeft(showLoc("magyar",locPath,"media","media"), showLoc("magyar",locPath,586,562));
   
   var mailcim = '<a';

mailcim += ' href="mailto:info@';

mailcim += 'mikibirta.com">'+showLoc("magyar",locPath,"üzenet küldése","send message")+'</a>';



$("#email-box").html(mailcim);



//PROFILE-BOX

    $('div.profile-text-box').fadeTo("fast",0.6);
      
      $('div.profile-box').hover(function(){
      
      $(this).children("div.profile-text-box").fadeTo("slow",0.1);  
      
    },function(){
    
    
    $(this).children("div.profile-text-box").fadeTo("slow",0.6);
     
    });
    
    $("div.profile-box").click(function(){
      
        $("div.profile-box").css("border-color","white");
      
        $(this).css("border-color","#4F4131");
      
     });

 

//BANDS

  $("div#cont_zenekarok div.profile-box").click(function(){
    $("div#cont_zenekarok div.loading-div").show();
    $('div#cont_zenekarok div#bands_output').html(""); 
    var dataID = $(this).children("input#data_id").val();
    var database = $(this).children("input#database").val();
    var langID = $(this).children("input#lang_id").val();
    
    $.post("http://mikibirta.com/subpages/ajax-sender.php", { dataID: dataID, database: database, langID: langID },
    function(data){
    $("div#cont_zenekarok div.loading-div").hide();
    
    $('div#cont_zenekarok div#bands_output').html(data);
    
    fadeVideoBoxes("div#cont_zenekarok div#bands_output");
     
   });
    
    $(document).scrollTo( { top:100, left:0}, 800 );

 });

 //GEAR
 
   $("div#cont_felszereles div.profile-box").click(function(){
    $("div#cont_felszereles div.loading-div").show();
    $('div#instr_output').html('');
    var dataID = $(this).children("input#data_id").val();
    var database = $(this).children("input#database").val();
    var langID = $(this).children("input#lang_id").val();
    
    $.post("http://mikibirta.com/subpages/ajax-sender.php", { dataID: dataID, database: database, langID: langID },
    function(data){
    $("div#cont_felszereles div.loading-div").hide();
     
    $('div#instr_output').html(data);
     
    fadeVideoBoxes('div#instr_output');
     
    
   });
   
    $(document).scrollTo( { top:100, left:0}, 800 );
 
  });
 


});
