var DOMAIN_FLVS="http://www.mmxlive.com/flvs/";

  $(document).ready(function(){

    $("div.cam_box").hover(
      function () {
        $(this).addClass("cam_box_active"); 
      }, 
      function () {
        $(this).removeClass("cam_box_active");
      }
    );
    
    $("div.ama_box").hover(
      function () {
        $(this).addClass("ama_box_active"); 
      }, 
      function () {
        $(this).removeClass("ama_box_active");
      }
    );   
    
      $("div#top_video_play a, div#top_video_play img").click(
      function(event) {
      event.preventDefault();
         //playTrailer("trailer/16_1.flv", 'top_video_play', '290', '228');
         playTrailerNeu("trailer/16_1.flv", 'top_video_play', false);
      }
    );      
    
      $("a.liveshows_links,a.liveshows_rechts").click(
      function(event) {
      event.preventDefault();
      var WelcheShow=str_replace("#", "", $(this).attr("href"));
      
               $.ajax({
                 type: "GET",
                 url: "ajax/top/"+WelcheShow+".php",
                 cache: false,                 
                 //data: "name="+escape(mmx_liveshow["name"])+"&id_setcard="+mmx_liveshow["id_setcard"]+"&tag="+mmx_liveshow["tag"]+"&y="mmx_liveshow["y"]+"&m="mmx_liveshow["m"]+"&d="mmx_liveshow["d"]+"&h="mmx_liveshow["h"]+"&i="mmx_liveshow["i"],
data: "name="+escape(mmx_liveshow["name"])+"&id_setcard="+mmx_liveshow["id_setcard"]+"&tag="+mmx_liveshow["tag"]+"&y="+mmx_liveshow["y"]+"&m="+mmx_liveshow["m"]+"&d="+mmx_liveshow["d"]+"&h="+mmx_liveshow["h"]+"&i="+mmx_liveshow["i"],
             //    dataType: "html",
                 success: function(Content){
                    $("div#liveshow_infos").html(Content);
                 }
               });         
      
          $("div#liveshow_infos").hide();
          $("div#liveshow_infos").fadeIn("slow");
          $("div#top_infos_box").hide();
          
          if(WelcheShow=="auktionen" || WelcheShow=="spycam")
          {
               $.ajax({
                 type: "GET",
                 url: "ajax/top/"+WelcheShow+"_rechts.php",
                 cache: false,
             //    data: "",
             //    dataType: "html",
                 success: function(Content){
                    $("div#top_video_container").hide();
                    $("div#top_video_auktion").html(Content);
                    $("div#top_video_auktion").fadeIn("slow");
                    $("input#live_auktion_aktiv").val("1");                    
                 }
               });           
          }
          else
          {
            //ist eine live-auktion im video-kasten aktiv?
            if($("input#live_auktion_aktiv").val()=="1")
            {
              $("div#top_video_auktion").hide();
              $("div#top_video_auktion").html('');
              $("div#top_video_container").fadeIn("slow");
              $("input#live_auktion_aktiv").val("0");
            }          
          }
      }
    );  
    
    $(".textfelder").focus(
      function () {
        $(this).addClass("textfelder_focus"); 
      }
    );    
    $(".textfelder").blur(
      function () {
        $(this).removeClass("textfelder_focus");
      }
    );       
    
    $("div.payment_box").click(
      function () {
        $(this).find("input").attr("checked", "checked"); 
        $("div.payment_box").removeClass("payment_box_aktiv");
        $(this).addClass("payment_box_aktiv"); 
      }
    );   
    
    $("div.payment_box").hover(
      function () {
        $(this).addClass("payment_box_hover"); 
      }, 
      function () {
        $(this).removeClass("payment_box_hover");
      }
    );     
    
    
    $("input.payment_button").hover(
      function () {
        $(this).attr("src", str_replace(".gif", "-hover.gif", $(this).attr("src"))); 
      }, 
      function () {
        $(this).attr("src", str_replace("-hover.gif", ".gif", $(this).attr("src"))); 
      }
    );   
    
         
      $("a.show_hide").click(
      function(event) {
      event.preventDefault();
         var hidden_id=str_replace("_link", "_hidden", $(this).attr("id")); 
         
         if($("#"+hidden_id).css("display")=="none")
         {
           $("#"+hidden_id).fadeIn("fast");
         }
         else
         {
          $("#"+hidden_id).fadeOut("fast");
         }
      }
    );      
    
    $("div.voice_box").hover(
      function () {
        $(this).addClass("voice_box_active"); 
      }, 
      function () {
        $(this).removeClass("voice_box_active");
      }
    );      
    
    
      $("div.voice_box").click(
      function(event) {
      event.preventDefault();
          var voice_href=$(this).find("a.voice_play").attr("href");
          
          if(voice_href[0]=="#")
          {
            var voice_href_arr=voice_href.split("_");
            voice_href=voice_href_arr[0];
            
            var sounddatei="/sex-geschichten/"+voice_href_arr[1]+"/"+str_replace("#", "", voice_href)+".mp3";
            
            $("div#voice_container").css({'display': 'block'});
    document.getElementById("voice_container").innerHTML='<p><object type="application/x-shockwave-flash" data="/sex-geschichten/voice_player/emff_standard.swf" height="34" width="110"><param name="movie" value="/sex-geschichten/voice_player/emff_standard.swf"><param name="quality" value="high"><param name="bgcolor" value="#000000"><param name="FlashVars" value="src='+sounddatei+'&amp;autostart=yes"></object></p>';  
  
           $(this).find("a").attr({ href: "index.php?page=sex-geschichten&id="+voice_href_arr[1] });       
           $(this).find("a.voice_play").hide();
           
    $(this).find("a.voice_play").delay(1000,function(){
      $("a.voice_play").fadeIn("slow");      
    });
    
    $(this).find("a.voice_play").find("p").html("Komplett Anh&ouml;ren &raquo;");

         }
         else
         {
           window.location.href = voice_href;
         }
      }
    );     
    
    
    
      $("a.voice_erklaerung").click(
      function(event) {
      event.preventDefault();
          var sounddatei=escape($(this).attr("href"));
          
          if($("#voice_mp3_aktiv").val()!=sounddatei)
          {
            $("div#voice_container").css({'display': 'block'});
            document.getElementById("voice_container").innerHTML='<p><object type="application/x-shockwave-flash" data="/sex-geschichten/voice_player/emff_standard.swf" height="34" width="110"><param name="movie" value="/sex-geschichten/voice_player/emff_standard.swf"><param name="quality" value="high"><param name="bgcolor" value="#000000"><param name="FlashVars" value="src='+sounddatei+'&amp;autostart=yes&amp;volume=500"></object></p>';  
            $("#voice_mp3_aktiv").val(sounddatei);
            
            var abstand_left=(event.pageX-300);
            if(abstand_left<0){ abstand_left=30; }
            $("#voice_container_msg").css({ 'left': abstand_left+'px', 'top': (event.pageY+20)+'px' });
            $("#voice_container_msg").fadeIn("fast");
            
            $("#voice_container_msg").delay(4000,function(){
              $("#voice_container_msg").fadeOut("fast");
            });
            
            //alle anderen auf mute stellen
            var alle_erklaerungen=$("a.voice_erklaerung").children("img"); 
             
            for(var b=0;b<alle_erklaerungen.length;b++)
            {
               alle_erklaerungen[b].src=str_replace("-mute.gif", "-animiert.gif", alle_erklaerungen[b].src);
            }              
            
            $(this).find("img").attr({src: $(this).attr("rel")+"-mute.gif" });
          }
          else
          {
            $("#voice_container_msg").fadeOut("fast");
            $(this).find("img").attr({src: $(this).attr("rel")+"-animiert.gif" });
            $("div#voice_container").css({'display': 'none'});
            $("div#voice_container").html('');
            $("#voice_mp3_aktiv").val("");
          }
      }
    );         
    
    
    
    $("div#flash_animation_overlay_msg").click(
      function () {
        $("div#flash_animation_overlay_msg").fadeOut("slow");
      }
    );  

});




    function liveshow_schliessen()
    {
     $(document).ready(function(){    
          $("div#liveshow_infos").hide();
          $("div#top_infos_box").fadeIn("slow");
          
          //ist eine live-auktion im video-kasten aktiv?
          if($("input#live_auktion_aktiv").val()=="1")
          {
            $("div#top_video_auktion").hide();
            $("div#top_video_auktion").html('');
            $("div#top_video_container").fadeIn("slow");
            $("input#live_auktion_aktiv").val("0");
          }
     });          
    }  
    
  function anmelden_zum_anschauen()
  {
     $(document).ready(function(){
       $("div#anmelden_zum_anschauen").hide();
       $("div#anmelden_zum_anschauen").fadeIn("slow");
     });
  }    
  
  function show_animation()
  {
     $(document).ready(function(){
       $("div#flash_animation_schatten").fadeIn("slow");     
       $("div#flash_animation_overlay_swf").fadeIn("slow");
       $("div#flash_animation_overlay").fadeIn("slow");
     });  
  }   
  
  function hide_animation()
  {
     $(document).ready(function(){
       $("div#flash_animation_schatten").hide();     
       $("div#flash_animation_overlay_swf").fadeOut("slow");
       $("div#flash_animation_overlay").fadeOut("slow");
       $("div#flash_animation_overlay_msg").fadeIn("slow");
       
       window.setTimeout("overlay_msg_schliessen()", 3000);
     });  
  }      
  
jQuery.fn.delay = function(time,func){
	this.each(function(){
		setTimeout(func,time);
	});
	
	return this;
};     
  
  function overlay_msg_schliessen()
  {
     $(document).ready(function(){
       $("div#flash_animation_overlay_msg").fadeOut("slow");
     });  
  }     

function str_replace(search, replace, subject) {
    return subject.split(search).join(replace);
}       


    function online_cams_navi_or_footer()
    {
    
    $(document).ready(function(){
      var inhalt_height=$("div#inhalt").innerHeight();
      var cams_string='';
      var c=0;
      var mmx_Cams_arr = mmx_Cams.split(",");
      var mmx_Cams_Setcard_arr = mmx_Cams_Setcard.split(",");
      var mmx_Cams_Namen_arr = mmx_Cams_Namen.split(","); 
      
      if(inhalt_height>1140)
      { // vertikale cams in der sidebar
      
        $("div#sidebar").css({ 'height': inhalt_height-10+'px' });
        
        //CAMS aufbauen
        var sidebar_height=900;
    //    alert(inhalt_height+" DEBUG");
        while((sidebar_height)<=inhalt_height)
        {
          if(mmx_Cams_Setcard_arr[c])
          {
            sidebar_height+=123;
            cams_string+='<a href="setcard.php?id='+mmx_Cams_Setcard_arr[c]+'"><p>'+mmx_Cams_Namen_arr[c]+'</p><img src="media/livecam/'+mmx_Cams_arr[c]+'/pic.jpg" /></a>';
            
            c++;
          }
          else
          {
            break;
          }
        }
        $("div#sidebar").css({ 'overflow': 'hidden' });
        //<img src="img/sidebar/mehr-girls.gif" alt="Mehr Maschinen Girls" style="margin-top: 3px;" />
        $("div#mehr_girls_vertikal").html('<div id="sidebar_mehr" class="sidebar_box"><p class="sidebar_headline">SENDERINNEN</p><center>'+cams_string+'</center></div>');
      }
      else //horizontale CAMS
      {
        var no_margin='';
        for(c=0;c<5;c++)
        {
          if(c==4){ no_margin=' style="margin-right: 0;"'; }        
          
          cams_string+='<a href="setcard.php?id='+mmx_Cams_Setcard_arr[c]+'"'+no_margin+'><p>'+mmx_Cams_Namen_arr[c]+'</p><img src="media/livecam/'+mmx_Cams_arr[c]+'/pic.jpg" /></a>';
        }
        $("div#mehr_girls_horizontal").html('<div class="inhalt_boxen" style="margin-top: 25px;"><div class="content_display" style="text-align: center; position: relative;"><p style="margin-bottom: 6px; font-size: 12pt; color: #FE8886; display: none;"><b><i>Diese Senderinnen sind jetzt mit ihrer Fickmaschine online:</i></b></p>'+cams_string+'<div class="clearf"></div></div></div>');      
      }
    
    });
 }
