var flashvars = {};
var params = { menu: "false",  scale: "noScale",  allowFullscreen: "true",  allowScriptAccess: "always",  bgcolor: "#FFFFFF",wmode: "transparent"};
var attributes = {id:"altContent"};
swfobject.embedSWF("rammbock.swf", "altContent", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);



function rewriteUrls(id){
    loc = String(this.location);
    loc = loc.substring(0,loc.indexOf("?") );
    $("#"+id + ' a').each(function(){
        nHref = this.href;
        nHref = nHref.substring(loc.length+1);
        nHref = nHref.substring(nHref.indexOf("=")+1);
        this.href = "javascript:loadContent("+nHref+")";    
    });
}

function closeContent(){
    loadContent(-100);
    $('#contentBox').empty();
}


function flashClick(msg) {
    if(msg == "main"){
        closeContent();
    }else{
        if(msg == "radioansage.mp3"){
            playAudio(msg);
            return;
        }
        if(msg == "gallery_1" || msg == "gallery_2" || msg == "gallery_3"){
            playGallery(msg);
            return;
        }   
        
        playTrailer(msg);
       return;
     }
    return false;
}

function loadContent(id){   
    $("#menu h3").each(function(){
        if(   ($(this).attr("id")) == "m_"+id ) {
            if(($(this).hasClass("active") == false)){
                $(this).addClass('active');
                $("#contentBox").load("contentLoader.php?p="+id);
            }else{
                $(this).removeClass('active');
                $('#contentBox').empty();
            }  
        }else{
           $(this).removeClass('active'); 
        }
    }
    );
}
 function playGallery(msg){ 
     if(msg == "gallery_1"){
         $("a#first_fbg1").trigger('click');
         return;
     }
     if(msg == "gallery_2"){
         $("a#first_fbg2").trigger('click');
         return;
     }
     if(msg == "gallery_3"){
         $("a#first_fbg3").trigger('click');
         return;
     }          
 }
 
  function playTrailer(msg){
     file = msg+".flv";
     $.fancybox({
            'title'         : this.title,
            'padding'       : 1,
            'href' : "player_flv.swf",
            'type'          : 'swf',
            'width'         : 700,
            'height'        : 394,
            'swf'           : {
                 'wmode'        : 'transparent',
                'allowfullscreen'   : 'true',
                'flashVars' : "flv=media/"+file+"&amp;autoplay=1&amp;margin=0&amp;width=700&amp;height=394"
            }
        });
     //return false;
 }
 


  function playAudio(msg){
   
      
        $.fancybox({
          
            'width'     : 400,
            'height'        : 30,
             'padding'       : 1,
 
                'href' : "player_mp3_maxi.swf",
            'type'          : 'swf',
            'swf'           : {
                 'wmode'        : 'transparent',
                'allowfullscreen'   : 'true',
                'flashVars' : "mp3=media/"+msg+"&amp;autoplay=1&amp;width=400&amp;height=30&amp;bgcolor=111111&amp;bgcolor1=111111&amp;bgcolor2=111111"
            }
        }); 
 // return false;
 }


