v_player='/site/swf/flvplayer.swf';

function getLang () {               
    var url= window.location.toString();
    
    var lang = 'ita';
    if (url.indexOf('/eng/')>0) {
      lang = 'eng';
    }
    if (url.indexOf('/ita/')>0) {
      lang = 'ita';
    }
    return lang;
} 

$(document).ready(function(){

    var url = window.location.toString();
    var domain = url.split('/')[2];
    
    var anteprime=$('#anteprime-ul');
    
    
    if ($('#anteprime').is('div')){
        overBoxes('el_anteprima','bg_anteprime_over','bg_anteprime','#fcfdfd');
    }
    
    if ((anteprime.is('ul')) )
        /*&&  (domain != '192.168.137.100') && (domain != '213.215.213.40') && (domain != 'web-cms.juventus.priv') && (domain != '213.215.213.144')*/   
        if (anteprime.find("li").get().length>4)    
        {
            var top=0;/*** il top dell'ul - the position of the ul ***/
            var direction=-1;/*** la direzione della rotazione -1=su, 1=giù - the rotate direction -1=up, 1=down ***/
            var heightLi=65;/*** altezza di un singolo elemento li - height of single li ***/
            var stateRotation;/*** è l'istanza che determina lo start/stop dell'ul - instance for star/stop ul element ***/
            
            /*** RR=Round-Robin ***/
            function startRotate() /*** la funzione che fa partire la rotazione - the function to start RR-rotation ***/
            {
                stateRotation = setInterval ( function () {
                    rotate_RR();
                }, 40 );
            }
            
            startRotate(); /*** la rotazione RR parte - start the RR-Rotation ***/
            
            /*** Comportamento del rotate_RR - Rotate_RR behaviour ***/
            /*** Gli elementi che ruotano, dovranno ricomparire al termine del "giro", sia se questo e' verso l'alto, sia verso il basso. ***/
                                                /*** La soluzione più facile (ma piu' idiota) sarebbe aggiungere semplicemente in coda all'elenco degli elementi una copia ***/
            /*** degli elementi già scomparsi dal video. Dopo qualche minuto si avrebbe una lista enorme ***/
            /*** Ho adottato la soluzione piu' sensata, ovvero clonarli, cancellarli e aggiungere i cloni alla fine della lista ***/
            /*** RR-rotating elements, will be showed at the end of the round-robin, even if the rotation is forward or backward. ***/
            /*** The silly solution is to add at the end of li list every time, a copy of disappeared li. After a few minutes will be ***/
            /*** have a wide ul ***/
            /*** The clever solution is to clone disappeared li, remove its and append clones at the end/prepend clones at the top of ***/
            /*** the list ***/
            function rotate_RR() {/*** RR=Round-Robin ***/
                top += direction;/*** incrementa/decrementa il top - increment/decrement the top***/
                if (top%heightLi==0) {
                    var li_el; /*** l'elemento da clonare dell'ul - the element to be clone in the ul ***/
                    
                    /*** se la direzione è verso l'alto - if is an up-direction
                    /***  li_el sarà il primo li - li_el will be the first li ***/
                    /*** altrimenti li_el sarà l'ultimo li - else li_el will be the last li ***/
                    if (direction==-1) li_el=anteprime.find("li:first"); 
                    else li_el=anteprime.find("li:last");
                    
                    var first_last_Li=li_el.clone(); /*** Clono li_el - I clone li_el ***/
                    
                    /*** se la direzione è verso l'alto, first_last_Li verrà accodato - if is an updirection, first_last_Li will be appended ***/
                    /*** altrimenti, first_last_Li verrà messo in testa alla lista - else, first_last_Li will be prepended ***/
                    if (direction==-1) anteprime.append(first_last_Li); /*** accodato - appended ***/
                    else anteprime.prepend(first_last_Li); /*** messo in testa - prepended ***/
                    
                    /*** prima di cancellare li_el, devo ri-settare il top poiché cancellando un elemento, l'ul scrollerà verso l'alto. ***/
                    /*** Quindi l'offset dello scroll sarà la direzione per l'altezza del singolo elemento li ***/
                    /*** before  li_el.remove, I must reset the top because, after the removing, the ul will scroll-up ***/
                    /*** by an height equal to direction*height of single li ***/
                    top-=(direction*heightLi);/*** setto il top - correct the top ***/
                    li_el.remove();/*** cancello l'li - removing li_el li ***/
                    
                    /*** il clone deve ereditare gli eventi(specificati più in basso) assegnati agli li originari ***/
                    /*** altrimenti, essendo nuovi li, non catturano nessun evento ***/
                    /*** clone must inherits events(defined after rotate_RR) captured by primal lis, otherwise, because lis are new ***/
                    /*** and don't have any captured events ***/
                    first_last_Li.mouseover(
                        function()
                        {
                            /*** Se sono sull'elemento, la rotazione si ferma ***/
                            /*** If I'm on a li, the RR-rotation must be stop ***/
                            clearInterval(stateRotation); 
                        }
                    ).mouseout(
                        function()
                        {
                            /*** Se sposto il mouse fuori dall'elemento, la rotazione riparte ***/
                            /*** If I leave a li, the RR-rotation must restart ***/
                            startRotate();
                        }
                    );
    
                    overBoxes('el_preview','bg_anteprime_over','bg_anteprime','#fcfdfd');

                }
                anteprime.css({"margin-top":top});/*** setto il top - the top is set ***/
            }
            
            $("#anteprime-up").mouseover(
                function()
                {
                    /*** se sono sulla freccia verso l'alto, la rotazione viene settata ad 1. ***/
                    /*** Potevo mettere un if (direction!=1) prima, ma un if è dispendioso e per una semplice assegnazione ***/
                    /*** preferisco non usarla. Oltretutto l'evento è mouseover e l'if si ripeterrebbe continuamente ***/
                    /*** If I am over the arrow-up, direction is set to 1. ***/
                    /*** I can also write an if (direction!=1) after the setting, but the set is more cheaper than an if. ***/
                    /*** On top of that, the event mouseover will execute the if...very heavy ***/
                    direction=1;
                }
            );
            
            $("#anteprime-down").mouseover(
                function()
                {
                    /*** se sono sulla freccia verso il basso, la rotazione viene settata a -1. ***/
                    /*** If I am over the arrow-dow, direction is set to -1. ***/
                    direction=-1;
                }
            );
            
            $('#anteprime-ul *').mouseover(
                function()
                {
                    /*** se sono su qualunque elemento dell'ul, la rotazione si ferma ***/
                    /*** If I am over an ul element, the RR stop ***/
                    clearInterval(stateRotation);
                }
            );
            
            $('#anteprime-ul li').mouseout(
                function()
                {
                    /*** se "abbandono" l'li, la rotazione riprende. N.B.: è meglio assegnare il mouseout solo ***/
                    /*** all'intero li, anziché a tutto ciò che in esso è contenuto(e come faccio sul mouseover) ***/
                    /*** altrimenti lo startRotate viene assegnato diverse volte e la rotazione da una brusca accelerata ***/
                    /*** if I leave the li, the RR start. Is better to assign this event to li, not to the li.* because ***/
                    /*** startRotate will set for all object in li and RR speed grows up! ***/
                   startRotate();
                }
            );
            
            overBoxes('el_preview','bg_anteprime_over','bg_anteprime','#fcfdfd');
        }
    


        if($('#layout-prehp').is('div')){
          initOverPreHp();
            }
        if($('#firstlevel').is('ul')){
          menutTop();
           menuSecondLevel();
            }   
        if($('#topbar').is('div')){
            $('#fuser').focus( function() { this.value=""; });
            $('#fpassword').focus( function() {this.value="";});
            $('#fkeyword').focus( function() {this.value="";});
            }
        
        if ($('#elenco_primavera').is('div')){
                if($('#elenco_primavera').attr('class') != 'no_overlist'){
                overBoxes('el_primavera','bg_anteprime_over','bg_anteprime','#fcfdfd');
                }
            }
        if ($('#elenco_organigramma').is('div')){
                if($('#elenco_organigramma').attr('class') != 'no_overlist'){
                overBoxes('el_organigramma','bg_anteprime_over','bg_anteprime_dark','#000');
                }
            }
        if ($('#elenco_parolebianconere').is('div')){
            overBoxes('el_parolebianconere','bg_anteprime_over','bg_anteprime','#fcfdfd');
            }       
        if ($('.banner343').is('div')){
        
            if ($('#coldx_nero .banner343').is('div')){
                overBanner343nero();
                }
            else
            {
                overBanner343();
                }
            }
//      if ($('#coldx_nero .banner343').is('div')){
//            overBanner343nero();
//            }
        if ($('.banner232').is('div')){
            overBanner232();
            }       
        if ($('.xc').is('div')){
            goRound();
            }
        if ($('.xctop')){
            goRoundTop();
            }   
        if($('#box_palmares').is('div')){
            overPalmares();
            }   
        if($('#cont_gallerygiocatore').is('div')){
            mngGallery();
        }
        if($('#cont_coppe').is('div')){
            switchTabs();
            }
        if($('#bnr_classris343').is('div')){
            switchTabs343();
            initSlider();
        }
        if($('#bnr_classris343').is('div')){
            cutPostTxt();
        }               

        if($('#selgiocatore').is('select')){
            previewPlayer();
            }
        if($('#txt_risultaticlassifica').is('div')){
            switchTabs598.init();
            mngSelectResult();
            getResults();
            }   
        if($('#box_sedeprincipale').is('div')){
            initMaps();
            }
        if($('#selects_selcategoria').is('select')){
            goPageFromMenu('selects_selcategoria','btn_go_catgiovani');
            }   
        if($('#selects_selpubfin').is('select')){
            goPageFromMenu('selects_selpubfin','btn_go_prospinf');
            }
        if($('#fsel_competizione').is('select')){
            goPageFromMenu('fsel_competizione','btn_go_ticket');
            }       
        if($('#infoinvestitori').is('table')){
            alternaterows('#infoinvestitori');
            }
        if($('#tabprezzi').is('table')){
            alternaterows('#tabprezzi');
            }   
        if($('#palinsesto').is('div')){
            altrowLis();
            switchTabsDays();
            }   
        if($('.btn_mover').is('img')||$('.btn_mover').is('input')){
            btnMover();
            }
        if($('#box_entertainment').is('div')){
            btnMoverEntertainment();
            }
        if($('#els_gallery').is('div')){
            overBoxes('el_gallery','bg_gall_on','bg_gall_off','#fcfdfd');
            }   
        if($('.els_faq_questions').is('div')){
            scrollFaq();
            }
        if($('#obj_slshowpro').is('div')){
            loadGallery('#obj_slshowpro');
            }
        if($('#gallery_banner').is('div')){
            mngGallBannerNews();
            }
        if($('#fotogiocatore').is('div')){  
        loadSwf('#fotogiocatore','206','285',swf_fname,'#ffffff','opaque'); 
        }
        if($('#gall_jplaces').is('div')){   
        loadGallery('#gall_jplaces');
        }
        if($('#bnr_videohighlight').is('div')){
            highLightVideo();
        }
        if($('#body').is('div')&&$('#body').attr('class')=='body_hp'){
            window.setTimeout('hp_chngImgPP.createImg()',7000);
            loadBnrHp();
            }
        if($('#content_browsematchprogram').is('div')){
            loadFlipObj();
            }
        if($('#content_browsehurra').is('div')){
            loadFlipObj();
            }
        if($('#lm_bar_up').is('p')){
            insl_LMHP();
            }
        if($('#choose_year').is('p')){
            swicthNewsArchive();
        }
        if($('#txt_calendario').is('div')){
            swicthCalendar();
        }
        if($('#content_socifondatori').is('div')){
            writeSociFondatori();
        }
        if($('#box_betclick').is('div')){
            writebox_betclick();
        }
        if($('#slideshow_primasquadra').is('div')){
            loadGallery('#slideshow_primasquadra');
        }   
        if($('#f_fjm').is('div')){
            clearInputValue('#f_fjm');
        }
        if($('#f_fjm_r').is('div')){
            clearInputValue('#f_fjm_r');
        }
        //if(!($.cookie('subscribed')) && ($('#box_primopiano').is('div'))){
        if(!($.cookie('subscribed')) && ($('#hp_layer').is('div')) && (domain != '192.168.137.100') && (domain != '213.215.213.40') && (domain != 'web-cms.juventus.priv')){
            handleHpLayer(getLang());
        }
        if($('#audio_news').is('p')){
            handleAudioNews();
        }
        if($('#lang').is('div')){
            handleLang();
        }
        if($('#nuovo_stadio_swf').is('div')){writeNuovoStadioSwf();}
        if($('#box_video_le_stelle').is('div')){writeStelle();}
});




function writeStelle(){
//  src:       v_player,
//  flashvars: { file:'/site/eng/styleJuventusCom/stelle/JuventusStars_WebVersion.flv', image:'/site/eng/styleJuventusCom/stelle/snapshot_stelle.png', frontcolor:'0xAAAAAA', backcolor:'0x000000', lightcolor:'0xEEEEEE'},
//            src:       'styleJuventusCom/stelle/flvplayer.swf',
//            flashvars: { file:'JuventusStars_WebVersion.flv', image:'styleJuventusCom/stelle/snapshot_stelle.png', frontcolor:'0xAAAAAA', backcolor:'0x000000', lightcolor:'0xEEEEEE'},

    if(getLang ()=="eng")
    {
        $('#video_le_stelle').media({ 
            width:     595,
            height:    334,
                                    autoplay:  true,
            attrs:     {wmode : 'transparent',scale:'noscale',bgcolor : 'none'}, 
            params:    {wmode : 'transparent',scale:'noscale',bgcolor : 'none'},  
            src:       v_player,
            flashvars: { file:'/site/eng/styleJuventusCom/stelle/JuventusStars_WebVersion.flv', image:'/site/eng/styleJuventusCom/stelle/snapshot_stelle.png', frontcolor:'0xAAAAAA', backcolor:'0x000000', lightcolor:'0xEEEEEE'},
            caption:   false
        }); 
    }
    else
    {
        $('#video_le_stelle').media({ 
            width:     597,
            height:    335,
                                    autoplay:  true,
            attrs:     {wmode : 'transparent',scale:'noscale',bgcolor : 'none'}, 
            params:    {wmode : 'transparent',scale:'noscale',bgcolor : 'none'},  
            src:       v_player,
            flashvars: { file:'/site/ita/styleJuventusCom/stelle/JuventusStars_WebVersion.flv', image:'/site/ita/styleJuventusCom/stelle/snapshot_stelle.png', frontcolor:'0xAAAAAA', backcolor:'0x000000', lightcolor:'0xEEEEEE'},
            caption:   false
        }); 
    }
}

function writeNuovoStadioSwf(){
    $('#nuovo_stadio_swf').media({ 
        width:     343, 
        height:    82,  
        attrs:     {wmode : 'transparent',scale:'noscale',bgcolor : 'none'}, 
        params:    {wmode : 'transparent',scale:'noscale',bgcolor : 'none'},  
        src:       'styleJuventusCom/swf/bannerStadio.swf',     
        caption:   false
    }); 
}


function cutPostTxt(){
  $('.el_ultimopost p').each(function(){
    var oldTxt = $(this).text().replace(/[\s\t]+/g ,' ');
    if (oldTxt.length > 95){
      var cutTxt = oldTxt.substring(0,93);
      var newTxt = cutTxt.lastIndexOf(' ');
      var myTxt = cutTxt.substring(0,newTxt);
      $(this).text(myTxt + "...");
    }
  });
}

/******************************flag hp****************************/
function handleLang(){
    $("#lang_flag p").hover(function(){ 
         var img = ($(this).find('img').attr('src')).split('_')[0];
         var imgOn = img+'_on.gif';
         var imgTxt = img+'_txt.gif'
         $(this).find('img').attr({'src':imgOn});
         $('#mylang_txt').append('<img src="'+imgTxt+'" alt=""/>');
         
         var startPoint=(($('body').width())-994)/2;
         var left=(($(this).offset().left)-startPoint)-837;
         $('#mylang_txt img').css({'padding-left':left-14});
         
    },function(){ 
         var img = ($(this).find('img').attr('src')).split('_')[0];
         var imgOff = img+'_off.gif';   
         $(this).find('img').attr({'src':imgOff});
         $('#mylang_txt').children('img').remove();
    });
}
/******************************flag hp****************************/


/******************************************************Audio News****************************************************/
function handleAudioNews(){
    $('#audio_news a').click(function(){
        $('#box_betclick').css({'visibility' : 'hidden'});                            
        $('#layout').append('<div id="fdr">&nbsp;</div>');
        $('#fdr').css({height:$('#layout').height()});
        $('#layout').append('<div id="audio_news_wrap"><a href="#">chiudi</a><div id="audio_news_player">&nbsp;</div></div>');      
        var pathAudioMp3 = $('input[@name=path_audio_mp3]').attr('value');
        var pathAudioImg = $('input[@name=path_audio_img]').attr('value');
        $('#audio_news_player').media({         
            width:     350, 
            height:    250, 
            autoplay:  true, 
            attrs:     {bgColor : '#000000'}, 
            params:    {bgColor : '#000000'},  
            src:       v_player,
            flashvars:  { file: pathAudioMp3, image:pathAudioImg,frontcolor : '0xAAAAAA',backcolor : '0x000000',lightcolor:'0xEEEEEE'}, 
            caption:   false
        });
        $('#audio_news_wrap a').click(function(){
            $('#fdr').remove();
            $('#audio_news_wrap').remove();
            $('#box_betclick').css({'visibility' : 'visible'});
        })
    })
}
/********************************************************************************************************************/


/***************************************************************GESTISCE LAYER HP (REGISTRAZIONE)***********************************************************/
var arrayName = ['attribute2','attribute4','attribute14','attribute15','attribute26','email'];
var arrayValuesIta = ['Nome','Cognome',"Citta' di residenza",'Provincia di residenza','Nazione','E-mail'];
var arrayValuesEng = ['Name','Surname','City','State','Country','E-mail'];

function handleHpLayer(lang){
  var fromForm = GetUrlParam( 'sub' );
  $('#close img').attr({'src':'./styleJuventusCom/img/hp_layer/close_'+lang+'.gif'});
  $('#subscribe_first img').attr({'src':'./styleJuventusCom/img/hp_layer/subscribe_'+lang+'.jpg'});
  $('#subscribe_second img').attr({'src':'./styleJuventusCom/img/hp_layer/subscribe2_'+lang+'.gif'});
  $('#hp_layer #second').css({'backgroundImage':'url(./styleJuventusCom/img/hp_layer/second_bg_'+lang+'.jpg)'});
  $('#hp_layer #third').css({'backgroundImage':'url(./styleJuventusCom/img/hp_layer/third_bg_'+lang+'.jpg)'});
   $('#hp_layer #third #privacy input#form_submit').css({'backgroundImage':'url(./styleJuventusCom/img/hp_layer/go_'+lang+'.gif)'});
   $('#hp_layer #thank_page').css({'backgroundImage':'url(./styleJuventusCom/img/hp_layer/thank_page_'+lang+'.jpg)'});
  $('#hp_layer .txt_'+lang).show();

  $('#layout').append('<div id="fdr">&nbsp;</div>');
  $('#fdr').css({height:$('#layout').height()});    
  $('#bnr_videohighlight').css({'visibility':'hidden'});
  $('#box_jm_hp').css({'visibility':'hidden'});
  $('#hp_layer').css({'display':'block'});


  $('#close').click(function(){
    $('#fdr').remove();
    $('#hp_layer').remove();
    $('#bnr_videohighlight').css({'visibility':'visible'});
    $('#box_jm_hp').css({'visibility':'visible'}); 
  });  
   
  if(fromForm == 'true'){
    $('#thank_page').css({'display':'block'});
    var COOKIE_NAME = 'subscribed';
    var date = new Date();
    date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
    $.cookie(COOKIE_NAME, '1', { path: '/', expires: date });
    return false; 
  }

  else{
    $('#first').css({'display':'block'});
    $('#gallery').cycle();
    //if(($('#first').css('display'))=='block'){
       window.setTimeout('goToSecond();',11000);
   // }
    
    $('#subscribe_first').click(function(){
       $('#first').fadeOut();
       $('#second').fadeIn();    
    });
    $('#subscribe_second').click(function(){
       $('#second').fadeOut();
       $('#third').fadeIn();
       $('#hp_layer').css({'height':'auto'});
       
    });
    handleHpLayerForm(lang);
  }
}

function goToSecond(){
    if(($('#first').css('display'))=='block'){
        $('#first').fadeOut();
        $('#second').fadeIn(800); 
    }
}

function GetUrlParam( paramName )
{
   var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
   var oMatch = oRegex.exec( window.top.location.search ) ;

   if ( oMatch && oMatch.length > 1 )
       return decodeURIComponent( oMatch[1] ) ;
   else
       return '' ;
} 

function handleHpLayerForm(lang){
  var myArr = lang == 'eng' ? arrayValuesEng : arrayValuesIta; 

  $('#third form').find('input[@class*=clear_value]').each(function(){
    $(this).val(myArr[arrayKey(arrayName,$(this).attr('name'))]);
  });
  if(lang=='eng'){
    $('#third form').attr({'action':'http://lists.juventuspartnerclub.com/lists/?p=subscribe&id=5'});
    $('#third form').append('<input type="hidden" name="list[17]" value="signup" class="hidden_input">');
    $('#third form').append('<input type="hidden" name="listname[17]" value="juventus.com EN" class="hidden_input"/>');                                            
  }
  if(lang=='ita'){
    $('#third form').attr({'action':'http://lists.juventuspartnerclub.com/lists/?p=subscribe&id=4'});
    $('#third form').append('<input type="hidden" name="list[16]" value="signup" class="hidden_input">');
    $('#third form').append('<input type="hidden" name="listname[16]" value="juventus.com IT" class="hidden_input"/>');
  }

    
    clearValue('#third .form_row',lang); 
  
  $('#third form').submit(function(){              
    var myArr = lang == 'eng' ? arrayValuesEng : arrayValuesIta;
    var f = document.subscribeform;
    var hasDot = $('input[@name=email]').val().indexOf(".");
    var hasAt = $('input[@name=email]').val().indexOf("@");
      for(i=0;i<f.length;i++){
        if(f.elements[i].type == 'text' && (f.elements[i].value == '' || myArr.inArray(f.elements[i].value)) ){
        if(lang=='ita'){
            alert('Compilare correttamente il campo');
        }
        if(lang=='eng'){
            alert('Please, complete this field');
        }
          
          f.elements[i].focus();
          return false;
        }  
      } 
      if(hasDot == -1 || hasAt == -1){
      
        if(lang=='ita'){alert('Indirizzo email non valido.');}        
        if(lang=='eng'){alert('Invalid email');}        
        $('input[@name=email]').focus();
        return false;
      }    
      if($('.privacy_consent_'+lang).attr('checked') != true){
        if(lang=='ita'){alert('Accettare il consenso ');}
        if(lang=='eng'){alert('Confirm terms and conditions');}
        $('.privacy_consent_'+lang).focus();
        return false;
      }
  });
}

function handleSelect(id,elementi){
  try{
    for (i=0; i<elementi.length; i++){
     $(id).append('<option>'+elementi[i]+'</option>');
    }   
  }catch(e){
   void(0);
  }
}
function arrayKey(arr,value){
 try{
  for(i in arr){
     if(arr[i] == value){
      return i;
     }
    }
    return false;
 }catch(e){
  void(0);
 }
}


function clearValue(id,lang){
    var myArr = lang == 'eng' ? arrayValuesEng : arrayValuesIta; 
    var nametext;
    $(id).find('input[@class*=clear_value]').each(function(){
/*       $(this).focus( function() { 
            if(arrayName.inArray($(this).attr('name')) && myArr.inArray($(this).val())){
                $(this).val('');
            }
        });

        $(this).blur( function() { 
            if($(this).val()==''){
                $(this).val(myArr[arrayKey(arrayName,$(this).attr('name'))]);       
            }
        }); */
        $(this).click( function() { 
            $(this).focus();
            if(arrayName.inArray($(this).attr('name')) && myArr.inArray($(this).val())){
                $(this).val('');
                 nametext=$(this).attr('name');             
            }

            $(id).find('input[@class*=clear_value]').each(function(){
                if($(this).attr('name')!=nametext && !myArr.inArray($(this).val()) && $(this).val()==''){
                    $(this).val(myArr[arrayKey(arrayName,$(this).attr('name'))]);                   
                }                                                      
            }); 
        });     
    });     
}

Array.prototype.inArray = function (value) {
    var i;
    for (i=0; i < this.length; i++) {
      if (this[i] === value) {
        return true;
      }
    }
    return false;
  };
/********************************************************************************************************************************************************/  


function clearInputValue(id){
    $(id).find('input[@class*=clear_value]').each(function(){
        $(this).focus( function() { 
            if( ($(this).val()=='NickName') || ($(this).val()=='Nome') || ($(this).val()=='Cognome') || ($(this).val()=='Name') || ($(this).val()=='Surname')){                 
                $(this).val('');
            }
        });
        $(this).blur( function() { 
            if($(this).val()==''){
                var url= window.location.toString();
                var lang = 'ita';
                if (url.indexOf('/eng/')>0) {
                    lang = 'eng';
                }
                if (url.indexOf('/ita/')>0) {
                    lang = 'ita';
                }
                if($(this).attr('name')=='NickName'){
                    $(this).val('NickName');
                }
                if($(this).attr('name')=='Nome'){
                    if(lang=='ita'){
                        $(this).val('Nome');
                    }
                    if(lang=='eng'){
                        $(this).val('Name');
                    }                   
                }               
                if($(this).attr('name')=='Cognome'){
                    if(lang=='ita'){
                        $(this).val('Cognome');
                    }
                    if(lang=='eng'){
                        $(this).val('Surname');
                    }
                }               
            }
        });
    });
}



/*******************GESTISCE TUTTI GLI OVER DELLA PREHP**************/

function initOverPreHp(){
    $('#fuser').focus( function() {this.value=""; });
    $('#fpassword').focus( function() {this.value=""; });
    
    var src_bt_store = $('#bnr_store_prehp>a').attr('href');
    $('#bt_store>a').attr({'href' : src_bt_store});
    $('#bt_store>a').attr({'target' : "_blank"});
    
    $('#box1').hover(function(){$(this).animate({'backgroundColor': '#f0c650'}, 'fast');
                                        /*      
                                        var pfi_bmbr=$('#bt_bemember>img').attr('src');
                                        var bmbrld=pfi_bmbr.lastIndexOf('.');      
                                        var bmbrlu=pfi_bmbr.lastIndexOf('_');
                                           if(pfi_bmbr.substring(bmbrlu+1,bmbrld)=='en'){
                                            $('#bt_bemember>img').attr({src:pathassoluto+'/img/shared/btns/btn_bememb_on_en.gif'});
                                           }
                                           else{
                                               $('#bt_bemember>img').attr({src:pathassoluto+'/img/shared/btns/btn_bememb_on.gif'});
                                               }
                                             */  
                                         },
                            function(){$(this).animate({'backgroundColor': '#fff'}, 'fast');
                            /*
                                            var pfi_bmbr=$('#bt_bemember>img').attr('src');
                                            var bmbrld=pfi_bmbr.lastIndexOf('.');      
                                            var bmbrlu=pfi_bmbr.lastIndexOf('_');
                                            if(pfi_bmbr.substring(bmbrlu+1,bmbrld)=='en'){
                                            $('#bt_bemember>img').attr({src:pathassoluto+'/img/shared/btns/btn_bememb_off_en.gif'});
                                            }else{
                                            $('#bt_bemember>img').attr({src:pathassoluto+'/img/shared/btns/btn_bememb_off.gif'});   
                                                }
                                */              
                                         });
    $('#box2').hover(function(){$(this).animate({'backgroundColor': '#f0c650'}, 'fast');
                                         },
                            function(){$(this).animate({'backgroundColor': '#fff'}, 'fast');
                                            });
    
    $('#box3').hover(function(){$('#box3').animate({'backgroundColor': '#f0c650'}, 'fast');
                                            var pfi_bmstr=$('#bt_store>img').attr('src');
                                            var strld=pfi_bmstr.lastIndexOf('.');      
                                            var strlu=pfi_bmstr.lastIndexOf('_');
                                            if(pfi_bmstr.substring(strlu+1,strld)=='en'){          
                                                  $('#bt_store>img').attr({src:pathassoluto+'/img/shared/btns/btn_vaistore_on_en.gif'});
                                            }else{
                                                 $('#bt_store>img').attr({src:pathassoluto+'/img/shared/btns/btn_vaistore_on.gif'});
                                            }
                                        
                                         },
                         function(){$(this).animate({'backgroundColor': '#fff'}, 'fast');
                                            var pfi_bmstr=$('#bt_store>img').attr('src');
                                            var strld=pfi_bmstr.lastIndexOf('.');      
                                            var strlu=pfi_bmstr.lastIndexOf('_');
                                            if(pfi_bmstr.substring(strlu+1,strld)=='en'){       
                                            $('#bt_store>img').attr({src:pathassoluto+'/img/shared/btns/btn_vaistore_off_en.gif'});
                                            }else{
                                             $('#bt_store>img').attr({src:pathassoluto+'/img/shared/btns/btn_vaistore_off.gif'});
                                            }
                                         });
    $('#box4').hover(function(){$('#box4').animate({'backgroundColor': '#f0c650'}, 'fast');
                                            var pfi_tckt=$('#bt_store>img').attr('src');
                                            var tcktld=pfi_tckt.lastIndexOf('.');      
                                            var tcktlu=pfi_tckt.lastIndexOf('_');
                                            if(pfi_tckt.substring(tcktlu+1,tcktld)=='en'){      
                                                $('#bt_ticket>img').attr({src:pathassoluto+'/img/shared/btns/btn_ticketonline_on_en.gif'});
                                            }else{
                                            $('#bt_ticket>img').attr({src:pathassoluto+'/img/shared/btns/btn_ticketonline_on.gif'});
                                            }
                                         },
                        function(){$(this).animate({'backgroundColor': '#fff'}, 'fast');
                                            var pfi_tckt=$('#bt_store>img').attr('src');
                                            var tcktld=pfi_tckt.lastIndexOf('.');      
                                            var tcktlu=pfi_tckt.lastIndexOf('_');
                                            if(pfi_tckt.substring(tcktlu+1,tcktld)=='en'){      
                                             $('#bt_ticket>img').attr({src:pathassoluto+'/img/shared/btns/btn_ticketonline_off_en.gif'});
                                            }else{
                                                 $('#bt_ticket>img').attr({src:pathassoluto+'/img/shared/btns/btn_ticketonline_off.gif'});
                                                }
                                         });
}

/*******************GESTISCE I MENU DI PRIMO E SECONDO LIVELLO TOP**************/
function menutTop(){
    if(!($.browser.safari)){
        setTimeout('chtImg.createImg()',1000);
        }
    $('#firstlevel>li>a').each(function(){
                                var idLink=this.id; 
                                var newSrc=idLink.split('_');
                                $(this).hover(function(){
                                            if($(this).parent().attr('class')=='on') return;           
                                            $(this).children().attr({src:pathassoluto+'/img/shared/menutop/'+newSrc[1]+'_on.gif'});
                                    },
                                    function(){
                                                if($(this).parent().attr('class')=='on') return;
                                                $(this).children().attr({src:pathassoluto+'/img/shared/menutop/'+newSrc[1]+'_off.gif'});
                                              });
                                        });
}

function menuSecondLevel(){             
    $('#firstlevel>li>ul>li>a').each(function(i){
                        var ramo=$(this).parent().parent().parent().find('a').attr('id').split('_');        
                        $(this).mouseover(function(){
                                                    if($(this).parent().attr('class')=='on') return;
$(this).children().attr({src:pathassoluto+'/img/shared/menutop/'+ramo[1]+'/on/'+$(this).children().attr('src').substring($(this).children().attr('src').lastIndexOf('/')+1,$(this).children().attr('src').lastIndexOf('.'))+'.gif'});
                                                });
                        $(this).mouseout(function(){
                                                  if($(this).parent().attr('class')=='on') return;
    $(this).children().attr({src:pathassoluto+'/img/shared/menutop/'+ramo[1]+'/off/'+$(this).children().attr('src').substring($(this).children().attr('src').lastIndexOf('/')+1,$(this).children().attr('src').lastIndexOf('.'))+'.gif'});
                                                });         
                                        });

    }



var chtImg={
    jcp : 0,
    picTop  :  null,
    timer   :  null,
    createImg : function(){
                    if(chtImg.jcp>=jpt.length){
                        chtImg.jcp=0;
                        }
                    chtImg.picTop = new Image();
                    jpicTop=$(chtImg.picTop);
                    jpicTop.attr({id:'jpictop_'+chtImg.jcp});
                    jpicTop.hide();
                    jpicTop.load(function(){
                                          chtImg.showImg();
                                          });
                    jpicTop.attr({src:jpt[chtImg.jcp]});
                },
        showImg : function(){
                    $('#logo>img').fadeOut(500,function(){
                                                           chtImg.delImg();
                                                           });
            },
        delImg  : function(){
                     $('#logo>img').remove();
                     $('#logo').append(chtImg.picTop);
                     $(chtImg.picTop).fadeIn(500,function(){
                                                              chtImg.jcp++;
                                                              chtImg.timer=setTimeout('chtImg.createImg()',5000);
                                                             });
            },  
        pause : function(){
                    clearTimeout(chtImg.timer);
                    chtImg.timer=null;
                    //chtImg.picTop=null;
                    chtImg.jcp=0;
                    return;
            }
    };


var hp_chngImgPP={
    jcp : 0,
    hp_picTop   :  null,
    hp_timer    :  null,
    createImg : function(){
                    if(hp_chngImgPP.jcp>=j_pphp.length){
                        hp_chngImgPP.jcp=0;
                        }
                    hp_chngImgPP.picTop = new Image();
                    jpicTop=$(hp_chngImgPP.picTop);
                    jpicTop.attr({id:'hpjpictop_'+hp_chngImgPP.jcp});
                    jpicTop.hide();
                    jpicTop.load(function(){
                                          hp_chngImgPP.showImg();
                                          });
                    jpicTop.attr({src:j_pphp[hp_chngImgPP.jcp]});
                },
        showImg : function(){
                    $('#dettaglio_pp>img').fadeOut(500,function(){
                                                           hp_chngImgPP.delImg();
                                                           });
            },
        delImg  : function(){
                     $('#dettaglio_pp>img').remove();
                     $('#dettaglio_pp').append(hp_chngImgPP.picTop);
                     $(hp_chngImgPP.picTop).fadeIn(500,function(){
                                                              hp_chngImgPP.jcp++;
                                                              hp_chngImgPP.timer=setTimeout('hp_chngImgPP.createImg()',5000);
                                                             });
            },  
        pause : function(){
                    clearTimeout(hp_chngImgPP.timer);
                    hp_chngImgPP.timer=null;
                    //chtImg.picTop=null;
                    hp_chngImgPP.jcp=0;
                    return;
            }
    };

/*******************GESTISCE I MOUSEOVER SU DIVERSI ELEMENTI DI BOX**************/

/*overBoxes è una funzione generica per tutte le liste che necessitano di over: ad es. anteprime news o elenco giocatori etc*/
function overBoxes(nomeBox,imgOver,imgOut,bgColor){
    $('.'+nomeBox).hover(function(){
                            if(nomeBox=='el_organigramma'){
                                 $(this).find('p.dati').find('span').css({color:'#000'});
                                }
                                 if(nomeBox=='el_gallery'){
                                 $(this).find('p.data').css({color:'#000'});
                                }   
                           $(this).css({background:'url('+pathassoluto+'/img/shared/'+imgOver+'.gif) repeat-x left bottom'});
                           },
                         function(){
                             if(nomeBox=='el_organigramma'){
                                 $(this).find('p.dati').find('span').css({color:'#FCBC24'});
                                }
                                 if(nomeBox=='el_gallery'){
                                 $(this).find('p.data').css({color:'#cc9900'});
                                }   
                            $(this).css({background:'url('+pathassoluto+'/img/shared/'+imgOut+'.gif) repeat-x left bottom '+bgColor+''});
                              });
    }   

    
/*mouseover su tutti i banner della colonna di destra*/ 
function overBanner343(){
    $('.banner343').each(function(){
                                $(this).hover(function(){ 
                                                     $(this).animate({'backgroundColor': '#f0c650'}, 'fast');
                                                        },
                                              function(){
                                                    $(this).animate({'backgroundColor': '#fff'}, 'fast');
                                                        });
                                  });
    }
function overBanner343nero(){
    $('#coldx_nero .banner343').each(function(){
                                $(this).hover(function(){ 
                                                     $(this).animate({'backgroundColor': '#f0c650'}, 'fast');
                                                        },
                                              function(){
                                                    $(this).animate({'backgroundColor': '#272727'}, 'fast');
                                                        });
                                  });
    }

/*banner 232px sono presenti nel template wide in basso (hurra juventus, storia etc)*/
function overBanner232(){
    $('.banner232').each(function(i){ 
                                 $(this).mouseover(function(){
                                        $(this).animate({'backgroundColor': '#f0c650'}, 'fast');
                                        });
                                  $(this).mouseout(function(){$(this).css({background:'#fff'});
                                      });
                                  });
    
    }   
/*******************GESTISCE CORNERS SU TUTTI I BOX**************/
function goRound(){
    var els2Round=$('.xc');
    els2Round.each(function(i){ 
                            $(this).corner("5px");
                            });
    
    }
    
function goRoundTop(){
    var els2Round=$('.xctop');
    els2Round.each(function(i){ 
                            $(this).corner("tl tr 5px");
                            });
    }   
    
/*******************GESTISCE MOUSEOVER SU PULSANTI GIALLI**************/    
var c_nf=null;
var c_lang=null;
function btnMover(){
    $('.btn_mover').each(function(){
                                  $(this).mouseover(function(){
                                                             var pfi=$(this).attr('src');
                                                             var ld=pfi.lastIndexOf('.');
                                                             var lu=pfi.lastIndexOf('_');
                                                             var ls=pfi.lastIndexOf('/');
                                                            
                                                                if(pfi.substring(lu+1,ld)!='en'){
                                                                    var nf=pfi.substring(ls+1,lu);
                                                                    c_nf=nf;
                                                                    var lang='';
                                                                    c_lang=lang;
                                                                    if(pfi.substring(lu+1,ld)=='sel'){
                                                                            $(this).parent().addClass('on');
                                                                            return;
                                                                            }
                                                                    }
                                                                else{
                                                                    var nf=pfi.substring(ls+1,lu-4);
                                                                    var lang='_en';
                                                                    c_nf=nf;
                                                                    c_lang=lang;
                                                                    if(pfi.substring(lu-3,lu)=='sel'){
                                                                                    $(this).parent().addClass('on');
                                                                                    return;
                                                                                     }
                                                                    
                                                                    }
                                                                 $(this).attr({src:pathassoluto+'/img/shared/btns/'+nf+'_on'+lang+'.gif'});
                                                            
                                                             });
                                   $(this).mouseout(function(){
                                                             if($(this).parent().attr('class')=='on') return;
                                                              $(this).attr({src:pathassoluto+'/img/shared/btns/'+c_nf+'_off'+c_lang+'.gif'});   
                                                             });
                                  });
    
    }   

function btnMoverEntertainment(){
    $('.els_entertainment').mouseover(function(event){
                                          var el=handleClick(event);
                                          if($(el).is('a')){
                                                  if($(el).attr('class')=='guarda'){
                                                      $(el).parents().eq(0).css({background:'url('+pathassoluto+'/img/shared/btns/btn_lifrecciadwnload_on.gif) no-repeat'});
                                                    }
                                                else{
                                                $(el).parents().eq(0).css({background:'url('+pathassoluto+'/img/shared/btns/btn_lifreccia_on.gif) no-repeat'});
                                                }
                                           }});
    $('.els_entertainment').mouseout(function(event){
                                          var el=handleClick(event);
                                           if($(el).is('a')){
                                                if($(el).attr('class')=='guarda'){
                                                      $(el).parents().eq(0).css({background:'url('+pathassoluto+'/img/shared/btns/btn_lifrecciadwnload_off.gif) no-repeat'});
                                                    }
                                                else{
                                                    $(el).parent().eq(0).css({background:'url('+pathassoluto+'/img/shared/btns/btn_lifreccia_off.gif) no-repeat'});
                                                    }
                                           }});
    }


/*Effettuano cambio stato sui pulsanti dei tempi di CronacaLive*/
function mngCl(){
    var tempi=$('.btns_tempi','#container_cl').find('a');
    $.each(tempi,function(i,n){
                          $(this).click(function(){
                                                  var pfi=$(this).children().attr('src');
                                                             var ld=pfi.lastIndexOf('.');
                                                             var lu=pfi.lastIndexOf('_');
                                                             var ls=pfi.lastIndexOf('/');
                                                                if(pfi.substring(lu+1,ld)!='en'){
                                                                    var nf=pfi.substring(ls+1,lu);
                                                                    c_nf=nf;
                                                                    var lang='';
                                                                    c_lang=lang;
                                                                        if(pfi.substring(lu+1,ld)=='sel'){
                                                                            return;
                                                                            }
                                                                    }
                                                                else{
                                                                    var nf=pfi.substring(ls+1,lu-3);
                                                                    var lang='_en';
                                                                    c_nf=nf;
                                                                    c_lang=lang;
                                                                    }
                                                                resetMatchTimes();
                                                                $(this).addClass('on');
                                                                 $(this).children().attr({src:pathassoluto+'/img/shared/btns/'+c_nf+'_sel'+c_lang+'.gif'});
                                                 });
                          });
    }   
    
function resetMatchTimes(){
    var tempi=$('.btns_tempi','#container_cl').find('a');
    $.each(tempi,function(i,n){
                             var res_pfi=$(this).children().attr('src');
                             var res_ld=res_pfi.lastIndexOf('.');
                             var res_lu=res_pfi.lastIndexOf('_');
                             var res_ls=res_pfi.lastIndexOf('/');
                                if(res_pfi.substring(res_lu+1,res_ld)!='en'){
                                    var res_nf=res_pfi.substring(res_ls+1,res_lu);
                                    res_c_nf=res_nf;
                                    var res_lang='';
                                    res_c_lang=res_lang;
                                    }
                                else{
                                    var res_nf=res_pfi.substring(res_ls+1,res_lu-4);
                                    var res_lang='_en';
                                    res_nf=res_nf;
                                    res_lang=res_lang;
                                    }       
                            $(this).children().attr({src:pathassoluto+'/img/shared/btns/'+res_nf+'_off'+res_lang+'.gif'});  
                            $(this).removeClass('on');
                    });
    }   

/*test per event delegation*/

function handleClick(e) {
    var element = $(e.target) ? $(e.target) : $(e.srcElement);
    return element;
}
    
/*******************GESTISCE MOUSEOVER SU BOX PALMARES**************/   
function overPalmares(){
    $('#box_palmares>ul>li>a').each(function(i){ 
                                 $(this).hover(function(){
                                        $(this).next().show('fast');
                                      },
                                  function(){
                                        $(this).next().hide('slow');
                                      });
                                  });   
    }       


/*******************GESTISCE VIDEO HIGHLIGHT**************/
var videoLoaded=null;
var currentPosition;
function getUpdate(typ,pr1,pr2,pid){
        if(typ == "time") {currentPosition = pr1;}
        else if(typ == "state") {currentPosition = 0;}
        if(currentPosition>0){
            videoLoaded=true;
            chtImg.pause();
            hp_chngImgPP.pause();
        }
        else if(videoLoaded==true&&currentPosition==0){
            videoLoaded=false;
            chtImg.createImg();
            hp_chngImgPP.createImg();
        }
    };

function highLightVideo(){
    $('#bnr_videohighlight>img').media({ 
                width:     343, 
                height:    276, 
                autoplay:  true,
                params:     {bgcolor : '#ffffff'},  
                attrs:     {bgcolor : '#ffffff'}, 
                src:       v_flv,
                flashvars:  {image:v_pic, height : 276,width :343,frontcolor : 0x666666,backcolor : 0xFFFFFF,lightcolor : 0xFFFFFF,overstretch : true,bufferlength : 5,usefullscreen : false,enablejs : true,javascriptid : "mpl"  }, 
                caption:   false
            }); 
    
    }
/*******************GESTISCE BANNER FLASH HP**************/
function loadBnrHp(){
    var rootmov=mvs_hp.mov;
    if(rootmov.length>0){
    $.each(rootmov,function(i){
                               container=rootmov[i].idcnt;
                               filename=rootmov[i].src;
                               switch(container){
                                   case 'box_jstore_hp':
                                   w=206;h=133;background='#000000';
                                   break;
                                   case 'box_jc_hp':
                                   w=206;h=133;background='#000000';
                                   break;
                                   case 'box_hurrajuve_hp':
                                   w=206;h=133;background='#000000';
                                   break;
                                   case 'box_soccersc_hp':
                                   w=206;h=133;background='#ffffff';
                                   break;
                                   case 'box_jm_hp':
                                   w=138;h=313;background='#000000';
                                   break;
                                   case 'box_jclubdoc_hp':
                                   w=138;h=109;background='#000000';
                                   break;
                                   
                                   /* sponsor header hp */
                                   case 'sponsor_top_nh':
                                   w=60;h=27;background='#000000';
                                   break;
                                   case 'sponsor_top_nike':
                                   w=45;h=27;background='#000000';
                                   break;   
                                   case 'sponsor_top_airone':
                                   w=50;h=27;background='#000000';
                                   break;                                  
                                   case 'sponsor_top_bp':
                                   w=40;h=27;background='#000000';
                                   break;                                      
                                   case 'sponsor_top_betClic':
                                   w=50;h=27;background='#000000';
                                   break;                                      
                                   case 'sponsor_top_sonyEricsson':
                                   w=70;h=27;background='#000000';
                                   break;                                      
                                   case 'sponsor_top_tim':
                                   w=50;h=27;background='#000000';
                                   break;                                  
                                   case 'sponsor_top_telecom':
                                   w=50;h=27;background='#000000';
                                   break;                                      
                                   case 'sponsor_top_trentino':
                                   w=50;h=27;background='#000000';
                                   break;                                  
                                   /* fine sponsor header hp */
                                   
                                   }
                               loadSwf('#'+container+'>p',w,h,filename,background,'opaque');    
                               });
    }

}


/*******************CARICA SWF**************/

function loadFlipObj(){
    $('#c_obj_pageflip').media({ 
    width:     600, 
    height:    406, 
    autoplay:  true, 
    attrs:     {wmode : 'transparent',scale:'noscale',bgcolor : 'none'}, 
    params:    {wmode : 'transparent',scale:'noscale',bgcolor : 'none'},  
    src:       srcflipobj,
    flashvars:  { xmlConfig: xmlcnfg}, 
    caption:   false
}); 
    
}
    
function writeSociFondatori(){
    $('#content_socifondatori').media({ 
    width:     964, 
    height:    453, 
    autoplay:  true, 
    attrs:     {wmode : 'transparent',scale:'noscale',bgcolor : 'none'}, 
    params:    {wmode : 'transparent',scale:'noscale',bgcolor : 'none'},  
    src:       srcflipobj,     
    caption:   false
}); 
    
}

function writebox_betclick(){
    $('#box_betclick').media({ 
    width:     343, 
    height:    166, 
    autoplay:  true, 
    attrs:     {wmode : 'transparent',scale:'noscale',bgcolor : 'none'}, 
    params:    {wmode : 'transparent',scale:'noscale',bgcolor : 'none'},  
    src:       srcflipobj,     
    caption:   false
}); 
    
}


function loadSwf(container,w,h,filename,bgc,wmd){
    if(typeof(bgc)=='undefined'){
        bgc='#000000';
        }
    if(typeof(wmd)=='undefined'){
        wmd='transparent';
        }
    $(container).media({ 
    width:     w, 
    height:    h, 
    autoplay:  true, 
    attrs:     {wmode : wmd,bgcolor : bgc}, 
    params:    {wmode : wmd,bgcolor : bgc}, 
    src:       filename,
    caption:   false
});     
}

/*******************CARICA GALLERY NON IN LAYER**************/
function loadGallery(container){
    $(container).media({ 
    width:     598, 
    height:    377, 
    autoplay:  true, 
    attrs:     {bgColor : '#000000'}, 
    params:    {bgColor : '#000000'},  
    src:       pathsspro,
    flashvars:  { xmlFile: xmlssp}, 
    caption:   false
});     
}

/*******************GESTISCE LA GALLERY DEL GIOCATORE**************/
function mngGallery(){
    $('#cont_gallerygiocatore>a').click(function(){
                                                 // detect se sono su mac attivo il pausa delle immagini...ma solo per FF..per ora safari è del tutto disabilitato.
                                                var currnav=navigator.userAgent.toLowerCase();
                                                /*
                                                if(currnav.indexOf('mac')!=-1){
                                                    chtImg.pause();
                                                 }
                                                 */
                                                 chtImg.pause();
                                                 $('#box_selgiocatore').css({display:'none'});
                                                 $('#layout').append('<div id="cgallery_ssp"></div>');
                                                 $('#cgallery_ssp').height($('#body').height());
                                                 $('#layout').append('<div id="gallery_ssp"></div>');
                                                 $('#gallery_ssp').html('<h1></h1><div id="contgallery" style="background:#000000">&nbsp;</div><p><a href="#" id="btnclose_gallery"><img src="'+pathassoluto+'/img/shared/btns/btn_chiudi_off.gif" /></a></p>');
                                                 
                                                 $('#btnclose_gallery').click(function(){
                                                                                $('#gallery_ssp').css({display:'block'});
                                                                                $('#gallery_ssp').remove();
                                                                                $('#cgallery_ssp').remove();       
                                                                                    $('#box_selgiocatore').css({display:'block'});
                                                                                    // detect se sono su mac riattivo animazioni delle immagini...ma solo per FF..per ora safari è del tutto disabilitato.
                                                                                    /*
                                                                                    if(currnav.indexOf('mac')!=-1){
                                                                                                 //chtImg.createImg();
                                                                                             }
                                                                                    */       
                                                                                     chtImg.createImg();
                                                                                         });
                                                 
                                                 loadGallery('#contgallery');                                                
                                                 $('#cgallery_ssp').css({display:'block'});
                                                 $('#cgallery_ssp').fadeTo('fast',0.8,function(){
                                                                                               $('#gallery_ssp').fadeIn();
                                                                                               });
                                                 return false;
                                                 });
     
    
    }
    
function mngGallBannerNews(){
    $('#pics_gall>a').click(function(){
                                     chtImg.pause();
                                      $('#layout').append('<div id="cgallery_ssp"></div>');
                                      $('#cgallery_ssp').height($('#body').height());
                                     $('#layout').append('<div id="gallery_ssp"><h1></h1><div id="contgallery" style="background:#000000"></div></div>');
                                      $('#gallery_ssp').append('<p><a href="#" id="btnclose_gallery"><img src="'+pathassoluto+'/img/shared/btns/btn_chiudi_off.gif" /></a></p>');
                                      
                                      $('#btnclose_gallery').click(function(){
                                                                chtImg.createImg();         
                                                                $('#gallery_ssp').css({display:'block'});      
                                                                $('#gallery_ssp').fadeOut('fast',function(){
                                                                                                    $('#cgallery_ssp').fadeOut();
                                                                                                    $('#cgallery_ssp').remove();
                                                                                                    $('#gallery_ssp').remove();
                                                                                                          });
                                                                });
                                                                                
                                                 loadGallery('#contgallery');                                                
                                                 $('#cgallery_ssp').css({display:'block'});
                                                 $('#cgallery_ssp').fadeTo('fast',0.8,function(){
                                                                                               $('#gallery_ssp').fadeIn();
                                                                                               });
                                     });
}   

/*******************GESTISCE SWITCH TRA I DIVERSI TAB NEI BOXES: il numero rappresenta la larghezza in pixel**************/

function switchTabs(){
    $('#btn_coppe').click(function(){
                                   if($('#cont_coppe').css('display')=='display') return;
                                   var pfi=$('#btn_coppe').parent().css('backgroundImage');
                                    var ld=pfi.lastIndexOf('.');       
                                    var lu=pfi.lastIndexOf('_');
                                   if(pfi.substring(lu+1,ld)=='en'){
                                        $('#box_schedacarriera>h2').css({background:'url('+pathassoluto+'/img/teamstaff/tabs_coppe_on_en.gif)'});  
                                        }
                                    else{   
                                        $('#box_schedacarriera>h2').css({background:'url('+pathassoluto+'/img/teamstaff/tabs_coppe_on.gif)'});
                                        }
                                    $('#cont_coppe').css({display:'block'});
                                   $('#cont_campionato').css({display:'none'});
                                    return false;
                                   });
    
    $('#btn_campionato').click(function(){
                                    if($('#cont_campionato').css('display')=='display') return;
                                     if($('#btn_campionato').css('display')=='display') return;
                                   var pfi=$('#btn_campionato').parent().css('backgroundImage');
                                    var ld=pfi.lastIndexOf('.');       
                                    var lu=pfi.lastIndexOf('_');
                                   if(pfi.substring(lu+1,ld)=='en'){
                                   $('#box_schedacarriera>h2').css({background:'url('+pathassoluto+'/img/teamstaff/tabs_campionato_on_en.gif)'});
                                   }
                                   else{
                                         $('#box_schedacarriera>h2').css({background:'url('+pathassoluto+'/img/teamstaff/tabs_campionato_on.gif)'});
                                       }
                                   $('#cont_coppe').css({display:'none'});
                                   $('#cont_campionato').css({display:'block'});
                                    return false;
                                   });
    }   
    
function switchTabs343(){
    $('#btn_classifica343').click(function(){      
                                    var pfi=$('#btn_classifica343').parent().css('backgroundImage');
                                    var ld=pfi.lastIndexOf('.');       
                                    var lu=pfi.lastIndexOf('_');
                                    if(pfi.substring(lu+1,ld)=='en'){
                                        $('#bnr_classris343>h1').css({background:'url('+pathassoluto+'/img/shared/btn_classifica343_on_en.gif)'});    
                                        }
                                    else{   
                                        $('#bnr_classris343>h1').css({background:'url('+pathassoluto+'/img/shared/btn_classifica343_on.gif)'});
                                        }
                                    $('#cont_classifica343').css({display:'block'});
                                   $('#cont_risultati343').css({display:'none'});
                                    return false;
                                   });
    
    $('#btn_risultati343').click(function(){
                                    if($('#cont_risultati343').css('display')=='block') return;
                                    var pfi=$('#btn_classifica343').parent().css('backgroundImage');
                                    var ld=pfi.lastIndexOf('.');       
                                    var lu=pfi.lastIndexOf('_');
                                    if(pfi.substring(lu+1,ld)=='en'){
                                          $('#bnr_classris343>h1').css({background:'url('+pathassoluto+'/img/shared/btn_risultati343_on_en.gif)'});   
                                        }
                                    else{   
                                          $('#bnr_classris343>h1').css({background:'url('+pathassoluto+'/img/shared/btn_risultati343_on.gif)'});
                                        }
                                   $('#cont_risultati343').css({display:'block'});
                                   $('#cont_classifica343').css({display:'none'});
                                    return false;
                                   });  
    }   
    
var switchTabs598 = {
    init    : function(){
        $('#btn_classifica598').click(function(){
                                    switchTabs598.showHit();
                                    return false;
                                   });
        $('#btn_risultati598').click(function(){
                                    switchTabs598.showRes();
                                    return false;
                                   });
        },
    showHit : function(){
            $('#barra_classifica').css({display:'block'});
            $('#barra_risultati').css({display:'none'});
            $('#container_classifica').css({display:'block'});
            $('#container_risultati').css({display:'none'});
                    },
    showRes : function(){
             $('#barra_classifica').css({display:'none'});
             $('#barra_risultati').css({display:'block'});
             $('#container_classifica').css({display:'none'});
             $('#container_risultati').css({display:'block'});
        }
    };
    
    
/*valido solo per i pulsanti dei giorni in palinsesto*/
var prevday=null;
var currentday=null;
var currentSelected=null;
var days_nf=null;
var days_lang=null;
function switchTabsDays(){
initTabDays();
$('#cont_days>a').each(function(i){
                                    $(this).click(function(){   
                                                        var idel=$(this).attr('id').substr(4,3);
                                                        currentday=idel;
                                                        restoreStateDays();
                                                        $(this).children().attr({src:pathassoluto+'/img/shared/btns/'+days_nf+'_sel'+days_lang+'.gif'});
                                                        $('#els_'+currentday).show();
                                                        prevday=idel;
                                                        return false;
                                                        });
                                    $(this).mouseover(function(){
                                                               var idel=$(this).attr('id').substr(4,3);
                                                               currentday=idel;
                                                               if(prevday==idel){return};
                                                               var pfi=$(this).children().attr('src');
                                                               var ld=pfi.lastIndexOf('.');
                                                               var lu=pfi.lastIndexOf('_');
                                                               var ls=pfi.lastIndexOf('/');
                                                               if(pfi.substring(lu+1,ld)!='en'){
                                                                    var nf=pfi.substring(ls+1,lu);
                                                                    days_nf=nf;
                                                                    var lang='';
                                                                    days_lang=lang;
                                                                        if(pfi.substring(lu+1,ld)=='sel'){
                                                                            $(this).parent().addClass('on');
                                                                            return;
                                                                            }
                                                                    }
                                                                else{
                                                                    var nf=pfi.substring(ls+1,lu-4);
                                                                    var lang='_en';
                                                                    days_nf=nf;
                                                                    days_lang=lang;
                                                                    }
                                                                $(this).children().attr({src:pathassoluto+'/img/shared/btns/'+nf+'_on'+lang+'.gif'});
                                                              
                                                               });
                                    $(this).mouseout(function(){
                                                                var idel=$(this).attr('id').substr(4,3);
                                                                 if(prevday==idel){return};
                                                                currentday=idel;
                                                                $(this).children().attr({src:pathassoluto+'/img/shared/btns/'+days_nf+'_off'+days_lang+'.gif'});
                                                               });
                                    });
}

function restoreStateDays(){
    if(prevday==null) return;
    $('#btn_'+prevday).children().attr({src:pathassoluto+'/img/shared/btns/btn_'+prevday+'_off'+days_lang+'.gif'});
    $('#els_'+prevday).hide();
    };
    
function initTabDays(){
    var elstab=$('#cont_days>a');
    indiceGiorno=today-2;
        if(today==7){
            indiceGiorno=5;
            }
        if(today==1){
            indiceGiorno=6;
            }   
    var idEl=$(elstab[indiceGiorno]).attr('id').substr(4,3);
    var pfi=$(elstab[indiceGiorno]).children().attr('src');
   var ld=pfi.lastIndexOf('.');
   var lu=pfi.lastIndexOf('_');
   var ls=pfi.lastIndexOf('/');
   if(pfi.substring(lu+1,ld)!='en'){
        var nf=pfi.substring(ls+1,lu);
        days_nf=nf;
        var lang='';
        days_lang=lang;
   }
    else{
        var nf=pfi.substring(ls+1,lu-4);
        var lang='_en';
        days_nf=nf;
        days_lang=lang;
        }   
    
    $(elstab[indiceGiorno]).children().attr({src:pathassoluto+'/img/shared/btns/'+days_nf+'_sel'+days_lang+'.gif'});
    $('#els_'+idEl).show();
    prevday=idEl;
    }   
    
/*******************GESTISCE SCELTA DA SELECT PER GO TO PAGE**************/

function goPageFromMenu(els,btn){
    $('#'+btn).click(function(){
            if($('#'+els).attr('value')==0) return;           
            location.href=$('#'+els).attr('value'); 
                });
    }   
    
/******** GESTIONE RISULTATI IN PAGINE RISULT/CLASS*******/
function loading(eltoblock,action){
    if(action){
        $.extend($.blockUI.defaults.overlayCSS, { backgroundColor: '#000' });
        $(eltoblock).block('<h1>Loading...</h1>', {color: '#000',backgroundColor: '#fff', border: '2px solid #e0aa27',opacity: '1',width: '200px', height: '20px', top:'50%', left:'50%'  });
        }
    if(!action){
        $(eltoblock).unblock({fadeTime:1000});
        }
    }

function mngSelectResult(){
    if(typeof(opt2load)=='undefined'){
        $('#circuito>option')[0].selected=true;
                loading('#selects_selrisultati',true);   
                $.ajax({ 
                  type: "GET", 
                  url: $('#circuito>option')[0].value, 
                  success: function(msg){
                            writeSelectGiornate(msg,true);
                    } 
                });
    }
    else{
            switchTabs598.showRes();
            $.each($('#circuito>option'),function(i,n){
                                                  if(n.value==opt2load){
                                                      n.selected=true;
                                                      }
                                                  });
            
            loading('#container_risultati',true);   
            $.ajax({ 
                      type: "GET", 
                      url: opt2load, 
                      success: function(msg){
                                writeSelectGiornate(msg,true);
                        } 
                    });
        }
    $('#circuito').change(function(){
                                    loading('#selects_selrisultati',true);   
                                    $.ajax({ 
                                      type: "GET", 
                                      url: this.value, 
                                      success: function(msg){
                                                writeSelectGiornate(msg,false);
                                        } 
                                    });
                            }); 
}

function writeSelectGiornate(msg,init){
    $('#giornate').html(msg);
    loading('#selects_selrisultati',false); 
    if(init){
        $.ajax({ 
              type: "GET", 
              url: $('#giornate>option')[0].value, 
              success: function(msg){
                        writeResults(msg);
                } 
            });
        }
    }

function getResults(){
    $('#btn_selrisultati').click(function(){
                                    if($('#giornate').attr('value')=='0') return;
                                    loading('#container_risultati',true);   
                                          $.ajax({ 
                                          type: "GET", 
                                          url: $('#giornate').attr('value'), 
                                          success: function(msg){
                                                    writeResults(msg);
                                            } 
                                        });
                                    return false;
                                  });
    
    }
    
function writeResults(msg){
    $('#cont_risultati598').html(msg);
    loading('#container_risultati',false); 
    }   

/***SLIDER PER BOX CLASSIFICA RISULTATI 343 (banner su colonna di destra)***/
function initSlider(){
    $('#btn_barup').click(function(){
                         sl_move('up');
                         return false;
                         });
    $('#btn_bardown').click(function(){
                         sl_move('dwn');
                         return false;
                         });
    }



var distance=1;
function sl_move(dir){
    (dir=='up'?sign='+':sign='-');
    var els=$('#cont_tab>table').find('tr');
    //15 è l'altezza di ogni elemento (tr) mentre 8 è il numero visibile di default
    maxlength=((els.length*15)-8*15);
    if(dir=='up'){
        if(distance>=0) return;
        distance+=105;
        }
    if(dir=='dwn'){
        if(distance!=1&&distance<=(sign+maxlength)) return;
        distance+=-105;
        }
    $('#cont_tab>table').animate({top: (distance)});
}

/***SLIDER PER BOX LAST MATCH HP***/

function insl_LMHP(){
    var els=$('#pic_lmhp>div').find('img').length;
    var mxl=$('#pic_lmhp>div').height();
    $('#lm_btn_barup').click(function(){
                         lm_slmove('up',els,mxl-170);
                         return false;
                         });
    $('#lm_btn_bardown').click(function(){
                         lm_slmove('dwn',els,mxl-170);
                         return false;
                         });
    }


var lm_dist=1;
function lm_slmove(dir,els,mxl){
    (dir=='up'?sign='+':sign='-');
    var stepper=Math.round(mxl/els);
    if(dir=='up'){
        if(lm_dist>=1) {
            $('#pic_lmhp>div').animate({top:(18)});
            return
            };
        lm_dist+=stepper+80;
        }
    if(dir=='dwn'){
        if(lm_dist!=1&&lm_dist<=(sign+mxl)) return;
        lm_dist+=-stepper-80;
        }
    $('#pic_lmhp>div').animate({top:(lm_dist)});
    if(lm_dist>=1) {
            $('#pic_lmhp>div').animate({top:(18)});
            return
            }
}

/************GMAPS SU Contati************/
function initMaps(){
    createMaps();
     $('#box_sedeprincipale').css({ backgroundColor: '#fed992' });
                                                     
    $('#btn_show_sedeprincipale').click(function(){
                                                 $('#box_sedeprincipale').animate({ 
                                                      'backgroundColor': '#fed992' 
                                                    }, 'fast');
                                                 $('#box_sedeallenamento').animate({ 
                                                      'backgroundColor': '#f9f8f8' 
                                                    }, 'fast');
                                        juve_map.setCenter(new GLatLng(45.06389,7.669475), 14, G_HYBRID_MAP);
                                        juve_point = new GPoint(7.669475, 45.06389);
                                        juve_html = "<div style=\"width:250px\"><p>C.so Galileo Ferraris 32<br />10128 Torino (TO)<br />Tel. 011 65631<br />Fax 011 5119214</p></div>";
                                        mark = new GMarker(juve_point);         
                                        GEvent.addListener(mark, 'click', function() {
                                        mark.openInfoWindowHtml(juve_html);
                                        });
                                        juve_map.addOverlay(mark);
                                        return false;
                                        });
    $('#btn_show_sedeallenamento').click(function(){
                                                 $('#box_sedeprincipale').animate({ 
                                                      'backgroundColor': '#f9f8f8' 
                                                    }, 'fast');
                                                 $('#box_sedeallenamento').animate({ 
                                                      'backgroundColor': '#fed992' 
                                                    }, 'fast');
                                        juve_map.setCenter(new GLatLng(44.964153,7.621793), 14, G_HYBRID_MAP);  
                                        juve_point = new GPoint(7.621793, 44.964153);
                                        juve_html = "<div style=\"width:250px\"><p>Via Stupinigi 182<br />10128 Vinovo (TO)<br />Tel. 011 65631<br />Fax 011 5119214</p></div>";
                                        mark = new GMarker(juve_point);         
                                        GEvent.addListener(mark, 'click', function() {
                                        mark.openInfoWindowHtml(juve_html);
                                        });
                                        juve_map.addOverlay(mark);
                                        return false;
                                        });
    

    }
var juve_map=null;
var juve_point=null;
var juve_html=null;

function createMaps(){
 if (GBrowserIsCompatible()) {
            juve_map = new GMap2(document.getElementById('mappa_sedi'),G_HYBRID_MAP);
            juve_map.addControl(new GSmallMapControl());
            juve_map.addControl(new GMapTypeControl());
            juve_map.addControl(new GOverviewMapControl());
            juve_map.setCenter(new GLatLng(45.06389,7.669475), 14, G_HYBRID_MAP);
            juve_point = new GPoint(7.669475, 45.06389);
            juve_html = "<div style=\"width:250px\"><p>C.so Galileo Ferraris 32<br />10128 Torino (TO)<br />Tel. 011 65631<br />Fax 011 5119214</p></div>";
            mark = new GMarker(juve_point);         
            GEvent.addListener(mark, 'click', function() {
            mark.openInfoWindowHtml(juve_html);
            });
            juve_map.addOverlay(mark);
    }
}



/********** MOSTRA PREVIEW GIOCATORE SU SELECT IN SCHEDA GICATORE ************/

function previewPlayer(){
    $('#selgiocatore').change(function(){
                                      var dato=giocatori_scheda.datianteprima[this.selectedIndex];
                                      $('#prev_giocatore>img').attr({src:dato.foto});
                                      $('#prev_giocatore>p').html(dato.descrizione);
                                      $('#prev_giocatore>a').attr({href:dato.url});
                                       });
    }


function alternaterows(el){
$(el+" tr:odd").addClass("bgpari");
}

function altrowLis(){
$("#palinsesto li:odd").addClass("bgdispari");
}


/********** ESEGUE SCROLL SULLE FAQ ************/
function scrollFaq(){
var anchors=$('.els_faq_questions').find('a');
var btns_gotop=$('.gotop>a');
    $.each(anchors,function(i,n){
                                $(this).click(
                                           function(){
                                              var answer=$('a').filter('[name='+$(this).attr('href').split("#")[1]+']');
                                                 answer.scrollTo(500);
                                                 return false;
                                               });
                                });
    $.each(btns_gotop,function(i,n){
                                $(this).click(
                                           function(){
                                                 $('#box_faq').scrollTo(500);
                                                 return false;
                                               });
                                });

}

/********** ESEGUE SWITCH ANNI ARCHIVIO NEWS ************/
function swicthNewsArchive(){
    $("#btn_switch_archive").click( function() { 
        location.href = $("#sel_switch_archive").val();
    });
}

/********** ESEGUE SWITCH SERIEA - TIMCUP - CHAMPIONS LEAGUE CALENDARIO ************/
function swicthCalendar(){
    $("#table_calendario_seriea tr:odd").addClass('odd');
    $("#table_calendario_seriea tr:even").addClass('even');
    $("#table_calendario_timcup tr:odd").addClass('odd');
    $("#table_calendario_timcup tr:even").addClass('even');
    $("#table_calendario_championsleague tr:odd").addClass('odd');
    $("#table_calendario_championsleague tr:even").addClass('even');
    $("#btn_ris_timcup").click( function() {                                         
        $("#cont_calendario_timcup").css({display: "block"});
        $("#cont_calendario_campionato").css({display: "none"});
        $("#cont_calendario_championsleague").css({display: "none"});
        $("#barra_ris_timcup").css({display: "block"});
        $("#barra_ris_seriea").css({display: "none"});
        $("#barra_ris_championsleague").css({display: "none"});
        return false;
    });
    $("#btn_ris_seriea").click( function() {                                         
        $("#cont_calendario_campionato").css({display: "block"});
        $("#cont_calendario_timcup").css({display: "none"});
        $("#cont_calendario_championsleague").css({display: "none"});
        $("#barra_ris_seriea").css({display: "block"});
        $("#barra_ris_timcup").css({display: "none"});
        $("#barra_ris_championsleague").css({display: "none"});
        return false;
    });
    $("#btn_ris_championsleague").click( function() {                                        
        $("#cont_calendario_championsleague").css({display: "block"});
        $("#cont_calendario_campionato").css({display: "none"});
        $("#cont_calendario_timcup").css({display: "none"});
        $("#barra_ris_championsleague").css({display: "block"});
        $("#barra_ris_timcup").css({display: "none"});
        $("#barra_ris_seriea").css({display: "none"});
        return false;
    });
}

/********** GESTISCE SCRITTURA BANNER ADV SERVER ************/
function loadBnrAdv(ZoneID){
var browName = navigator.appName;
var SiteID = 1; 
var browDateTime = (new Date()).getTime();
        if (browName=='Netscape'){
            document.write('<s'+'cript lang' + 'uage="jav' + 'ascript" src="http://adv.domino.it/banman/a.aspx?ZoneID=' + ZoneID + '&amp;Task=Get&amp;IFR=False&amp;Browser=NETSCAPE4&amp;PageID=55888&amp;SiteID=' + SiteID + '&amp;Random=' + browDateTime  + '">'); document.write('</'+'scr'+'ipt>');
        }
        if (browName!='Netscape'){
document.write('<s'+'cript lang' + 'uage="jav' + 'ascript" src="http://adv.domino.it/banman/a.aspx?ZoneID=' + ZoneID + '&amp;Task=Get&amp;IFR=False&amp;PageID=55888&amp;SiteID=' + SiteID + '&amp;Random=' + browDateTime  + '">'); document.write('</'+'scr'+'ipt>');
        }
}

/**************************UTILS**************************/

jQuery.fn.extend({
  scrollTo : function(speed, easing) {
    return this.each(function() {
      var targetOffset = $(this).offset().top;
      $('html,body').animate({scrollTop: targetOffset}, speed, easing);
    });
  }
});


/*
 * jQuery corner plugin
 *
 * version 1.9 (9/10/2007)
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

/**
 * The corner() method provides a simple way of styling DOM elements.  
 *
 * corner() takes a single string argument:  $().corner("effect corners width")
 *
 *   effect:  The name of the effect to apply, such as round or bevel. 
 *            If you don't specify an effect, rounding is used.
 *
 *   corners: The corners can be one or more of top, bottom, tr, tl, br, or bl. 
 *            By default, all four corners are adorned. 
 *
 *   width:   The width specifies the width of the effect; in the case of rounded corners this 
 *            will be the radius of the width. 
 *            Specify this value using the px suffix such as 10px, and yes it must be pixels.
 *
 * For more details see: http://methvin.com/jquery/jq-corner.html
 * For a full demo see:  http://malsup.com/jquery/corner/
 *
 *
 * @example $('.adorn').corner();
 * @desc Create round, 10px corners 
 *
 * @example $('.adorn').corner("25px");
 * @desc Create round, 25px corners 
 *
 * @example $('.adorn').corner("notch bottom");
 * @desc Create notched, 10px corners on bottom only
 *
 * @example $('.adorn').corner("tr dog 25px");
 * @desc Create dogeared, 25px corner on the top-right corner only
 *
 * @example $('.adorn').corner("round 8px").parent().css('padding', '4px').corner("round 10px");
 * @desc Create a rounded border effect by styling both the element and its parent
 * 
 * @name corner
 * @type jQuery
 * @param String options Options which control the corner style
 * @cat Plugins/Corner
 * @return jQuery
 * @author Dave Methvin (dave.methvin@gmail.com)
 * @author Mike Alsup (malsup@gmail.com)
 */
(function($) { 

$.fn.corner = function(o) {
    function hex2(s) {
        var s = parseInt(s).toString(16);
        return ( s.length < 2 ) ? '0'+s : s;
    };
    function gpc(node) {
        for ( ; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode ) {
            var v = $.css(node,'backgroundColor');
            if ( v.indexOf('rgb') >= 0 ) { 
                if ($.browser.safari && v == 'rgba(0, 0, 0, 0)')
                    continue;
                var rgb = v.match(/\d+/g); 
                return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            if ( v && v != 'transparent' )
                return v;
        }
        return '#ffffff';
    };
    function getW(i) {
        switch(fx) {
        case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
        case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
        case 'sharp':  return Math.round(width*(1-Math.cos(Math.acos(i/width))));
        case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
        case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
        case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
        case 'curl':   return Math.round(width*(Math.atan(i)));
        case 'tear':   return Math.round(width*(Math.cos(i)));
        case 'wicked': return Math.round(width*(Math.tan(i)));
        case 'long':   return Math.round(width*(Math.sqrt(i)));
        case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
        case 'dog':    return (i&1) ? (i+1) : width;
        case 'dog2':   return (i&2) ? (i+1) : width;
        case 'dog3':   return (i&3) ? (i+1) : width;
        case 'fray':   return (i%2)*width;
        case 'notch':  return width; 
        case 'bevel':  return i+1;
        }
    };
    o = (o||"").toLowerCase();
    var keep = /keep/.test(o);                       // keep borders?
    var cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);  // corner color
    var sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);  // strip color
    var width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10; // corner width

    var re = /round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;
    var fx = ((o.match(re)||['round'])[0]);
    var edges = { T:0, B:1 };
    var opts = {
        TL:  /top|tl/.test(o),       TR:  /top|tr/.test(o),
        BL:  /bottom|bl/.test(o),    BR:  /bottom|br/.test(o)
    };
    if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
        opts = { TL:1, TR:1, BL:1, BR:1 };
    var strip = document.createElement('div');
    strip.style.overflow = 'hidden';
    strip.style.height = '1px';
    strip.style.backgroundColor = sc || 'transparent';
    strip.style.borderStyle = 'solid';
    return this.each(function(index){
        var pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if ($.browser.msie) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        var cssHeight = $.curCSS(this, 'height');

        for (var j in edges) {
            var bot = edges[j];
            strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
            var d = document.createElement('div');
            $(d).addClass('jquery-corner');
            var ds = d.style;

            bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

            if (bot && cssHeight != 'auto') {
                if ($.css(this,'position') == 'static')
                    this.style.position = 'relative';
                ds.position = 'absolute';
                ds.bottom = ds.left = ds.padding = ds.margin = '0';
                if ($.browser.msie)
                    ds.setExpression('width', 'this.parentNode.offsetWidth');
                else
                    ds.width = '100%';
            }
            else {
                ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                    (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
            }

            for (var i=0; i < width; i++) {
                var w = Math.max(0,getW(i));
                var e = strip.cloneNode(false);
                e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
            }
        }
    });
};

$.fn.uncorner = function(o) { return $('.jquery-corner', this).remove(); };
    
})(jQuery);



/*
 * jQuery blockUI plugin
 * Version 1.33  (09/14/2007)
 * @requires jQuery v1.1.1
 *
 * $Id$
 *
 * Examples at: http://malsup.com/jquery/block/
 * Copyright (c) 2007 M. Alsup
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
 (function($) {
/**
 * blockUI provides a mechanism for blocking user interaction with a page (or parts of a page).
 * This can be an effective way to simulate synchronous behavior during ajax operations without
 * locking the browser.  It will prevent user operations for the current page while it is
 * active ane will return the page to normal when it is deactivate.  blockUI accepts the following
 * two optional arguments:
 *
 *   message (String|Element|jQuery): The message to be displayed while the UI is blocked. The message
 *              argument can be a plain text string like "Processing...", an HTML string like
 *              "<h1><img src="busy.gif" /> Please wait...</h1>", a DOM element, or a jQuery object.
 *              The default message is "<h1>Please wait...</h1>"
 *
 *   css (Object):  Object which contains css property/values to override the default styles of
 *              the message.  Use this argument if you wish to override the default
 *              styles.  The css Object should be in a format suitable for the jQuery.css
 *              function.  For example:
 *              $.blockUI({
 *                    backgroundColor: '#ff8',
 *                    border: '5px solid #f00,
 *                    fontWeight: 'bold'
 *              });
 *
 * The default blocking message used when blocking the entire page is "<h1>Please wait...</h1>"
 * but this can be overridden by assigning a value to $.blockUI.defaults.pageMessage in your
 * own code.  For example:
 *
 *      $.blockUI.defaults.pageMessage = "<h1>Bitte Wartezeit</h1>";
 *
 * The default message styling can also be overridden.  For example:
 *
 *      $.extend($.blockUI.defaults.pageMessageCSS, { color: '#00a', backgroundColor: '#0f0' });
 *
 * The default styles work well for simple messages like "Please wait", but for longer messages
 * style overrides may be necessary.
 *
 * @example  $.blockUI();
 * @desc prevent user interaction with the page (and show the default message of 'Please wait...')
 *
 * @example  $.blockUI( { backgroundColor: '#f00', color: '#fff'} );
 * @desc prevent user interaction and override the default styles of the message to use a white on red color scheme
 *
 * @example  $.blockUI('Processing...');
 * @desc prevent user interaction and display the message "Processing..." instead of the default message
 *
 * @name blockUI
 * @param String|jQuery|Element message Message to display while the UI is blocked
 * @param Object css Style object to control look of the message
 * @cat Plugins/blockUI
 */
$.blockUI = function(msg, css, opts) {
    $.blockUI.impl.install(window, msg, css, opts);
};

// expose version number so other plugins can interogate
$.blockUI.version = 1.33;

/**
 * unblockUI removes the UI block that was put in place by blockUI
 *
 * @example  $.unblockUI();
 * @desc unblocks the page
 *
 * @name unblockUI
 * @cat Plugins/blockUI
 */
$.unblockUI = function(opts) {
    $.blockUI.impl.remove(window, opts);
};

/**
 * Blocks user interaction with the selected elements.  (Hat tip: Much of
 * this logic comes from Brandon Aaron's bgiframe plugin.  Thanks, Brandon!)
 * By default, no message is displayed when blocking elements.
 *
 * @example  $('div.special').block();
 * @desc prevent user interaction with all div elements with the 'special' class.
 *
 * @example  $('div.special').block('Please wait');
 * @desc prevent user interaction with all div elements with the 'special' class
 * and show a message over the blocked content.
 *
 * @name block
 * @type jQuery
 * @param String|jQuery|Element message Message to display while the element is blocked
 * @param Object css Style object to control look of the message
 * @cat Plugins/blockUI
 */
$.fn.block = function(msg, css, opts) {
    return this.each(function() {
        if (!this.$pos_checked) {
            if ($.css(this,"position") == 'static')
                this.style.position = 'relative';
            if ($.browser.msie) this.style.zoom = 1; // force 'hasLayout' in IE
            this.$pos_checked = 1;
        }
        $.blockUI.impl.install(this, msg, css, opts);
    });
};

/**
 * Unblocks content that was blocked by "block()"
 *
 * @example  $('div.special').unblock();
 * @desc unblocks all div elements with the 'special' class.
 *
 * @name unblock
 * @type jQuery
 * @cat Plugins/blockUI
 */
$.fn.unblock = function(opts) {
    return this.each(function() {
        $.blockUI.impl.remove(this, opts);
    });
};

/**
 * displays the first matched element in a "display box" above a page overlay.
 *
 * @example  $('#myImage').displayBox();
 * @desc displays "myImage" element in a box
 *
 * @name displayBox
 * @type jQuery
 * @cat Plugins/blockUI
 */
$.fn.displayBox = function(css, fn, isFlash) {
    var msg = this[0];
    if (!msg) return;
    var $msg = $(msg);
    css = css || {};

    var w = $msg.width()  || $msg.attr('width')  || css.width  || $.blockUI.defaults.displayBoxCSS.width;
    var h = $msg.height() || $msg.attr('height') || css.height || $.blockUI.defaults.displayBoxCSS.height ;
    if (w[w.length-1] == '%') {
        var ww = document.documentElement.clientWidth || document.body.clientWidth;
        w = parseInt(w) || 100;
        w = (w * ww) / 100;
    }
    if (h[h.length-1] == '%') {
        var hh = document.documentElement.clientHeight || document.body.clientHeight;
        h = parseInt(h) || 100;
        h = (h * hh) / 100;
    }

    var ml = '-' + parseInt(w)/2 + 'px';
    var mt = '-' + parseInt(h)/2 + 'px';

    // supress opacity on overlay if displaying flash content on mac/ff platform
    var ua = navigator.userAgent.toLowerCase();
    var opts = {
        displayMode: fn || 1,
        noalpha: isFlash && /mac/.test(ua) && /firefox/.test(ua)
    };

    $.blockUI.impl.install(window, msg, { width: w, height: h, marginTop: mt, marginLeft: ml }, opts);
};


// override these in your code to change the default messages and styles
$.blockUI.defaults = {
    // the message displayed when blocking the entire page
    pageMessage:    '<h1>Please wait...</h1>',
    // the message displayed when blocking an element
    elementMessage: '', // none
    // styles for the overlay iframe
    overlayCSS:  { backgroundColor: '#fff', opacity: '0.5' },
    // styles for the message when blocking the entire page
    pageMessageCSS:    { width:'250px', margin:'-50px 0 0 -125px', top:'50%', left:'50%', textAlign:'center', color:'#000', backgroundColor:'#fff', border:'3px solid #aaa' },
    // styles for the message when blocking an element
    elementMessageCSS: { width:'250px', padding:'10px', textAlign:'center', backgroundColor:'#fff'},
    // styles for the displayBox
    displayBoxCSS: { width: '400px', height: '400px', top:'50%', left:'50%' },
    // allow body element to be stetched in ie6
    ie6Stretch: 1,
    // supress tab nav from leaving blocking content?
    allowTabToLeave: 0,
    // Title attribute for overlay when using displayBox
    closeMessage: 'Click to close',
    // use fadeOut effect when unblocking (can be overridden on unblock call)
    fadeOut:  1,
    // fadeOut transition time in millis
    fadeTime: 400
};

// the gory details
$.blockUI.impl = {
    box: null,
    boxCallback: null,
    pageBlock: null,
    pageBlockEls: [],
    op8: window.opera && window.opera.version() < 9,
    ie6: $.browser.msie && /MSIE 6.0/.test(navigator.userAgent),
    install: function(el, msg, css, opts) {
        opts = opts || {};
        this.boxCallback = typeof opts.displayMode == 'function' ? opts.displayMode : null;
        this.box = opts.displayMode ? msg : null;
        var full = (el == window);

        // use logical settings for opacity support based on browser but allow overrides via opts arg
        var noalpha = this.op8 || $.browser.mozilla && /Linux/.test(navigator.platform);
        if (typeof opts.alphaOverride != 'undefined')
            noalpha = opts.alphaOverride == 0 ? 1 : 0;

        if (full && this.pageBlock) this.remove(window, {fadeOut:0});
        // check to see if we were only passed the css object (a literal)
        if (msg && typeof msg == 'object' && !msg.jquery && !msg.nodeType) {
            css = msg;
            msg = null;
        }
        msg = msg ? (msg.nodeType ? $(msg) : msg) : full ? $.blockUI.defaults.pageMessage : $.blockUI.defaults.elementMessage;
        if (opts.displayMode)
            var basecss = jQuery.extend({}, $.blockUI.defaults.displayBoxCSS);
        else
            var basecss = jQuery.extend({}, full ? $.blockUI.defaults.pageMessageCSS : $.blockUI.defaults.elementMessageCSS);
        css = jQuery.extend(basecss, css || {});
        var f = ($.browser.msie) ? $('<iframe class="blockUI" style="z-index:1000;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="javascript:false;"></iframe>')
                                 : $('<div class="blockUI" style="display:none"></div>');
        var w = $('<div class="blockUI" style="z-index:1001;cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
        var m = full ? $('<div class="blockUI blockMsg" style="z-index:1002;cursor:wait;padding:0;position:fixed"></div>')
                     : $('<div class="blockUI" style="display:none;z-index:1002;cursor:wait;position:absolute"></div>');
        w.css('position', full ? 'fixed' : 'absolute');
        if (msg) m.css(css);
        if (!noalpha) w.css($.blockUI.defaults.overlayCSS);
        if (this.op8) w.css({ width:''+el.clientWidth,height:''+el.clientHeight }); // lame
        if ($.browser.msie) f.css('opacity','0.0');

        $([f[0],w[0],m[0]]).appendTo(full ? 'body' : el);

        // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
        var expr = $.browser.msie && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
        if (this.ie6 || expr) {
            // stretch content area if it's short
            if (full && $.blockUI.defaults.ie6Stretch && $.boxModel)
                $('html,body').css('height','100%');

            // fix ie6 problem when blocked element has a border width
            if ((this.ie6 || !$.boxModel) && !full) {
                var t = this.sz(el,'borderTopWidth'), l = this.sz(el,'borderLeftWidth');
                var fixT = t ? '(0 - '+t+')' : 0;
                var fixL = l ? '(0 - '+l+')' : 0;
            }

            // simulate fixed position
            $.each([f,w,m], function(i,o) {
                var s = o[0].style;
                s.position = 'absolute';
                if (i < 2) {
                    full ? s.setExpression('height','document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + "px"')
                         : s.setExpression('height','this.parentNode.offsetHeight + "px"');
                    full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
                         : s.setExpression('width','this.parentNode.offsetWidth + "px"');
                    if (fixL) s.setExpression('left', fixL);
                    if (fixT) s.setExpression('top', fixT);
                }
                else {
                    if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
                    s.marginTop = 0;
                }
            });
        }
        if (opts.displayMode) {
            w.css('cursor','default').attr('title', $.blockUI.defaults.closeMessage);
            m.css('cursor','default');
            $([f[0],w[0],m[0]]).removeClass('blockUI').addClass('displayBox');
            $().click($.blockUI.impl.boxHandler).bind('keypress', $.blockUI.impl.boxHandler);
        }
        else
            this.bind(1, el);
        m.append(msg).show();
        if (msg.jquery) msg.show();
        if (opts.displayMode) return;
        if (full) {
            this.pageBlock = m[0];
            this.pageBlockEls = $(':input:enabled:visible',this.pageBlock);
            setTimeout(this.focus, 20);
        }
        else this.center(m[0]);
    },
    remove: function(el, opts) {
        var o = $.extend({}, $.blockUI.defaults, opts);
        this.bind(0, el);
        var full = el == window;
        var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el);
        if (full) this.pageBlock = this.pageBlockEls = null;

        if (o.fadeOut) {
            els.fadeOut(o.fadeTime, function() {
                if (this.parentNode) this.parentNode.removeChild(this);
            });
        }
        else els.remove();
    },
    boxRemove: function(el) {
        $().unbind('click',$.blockUI.impl.boxHandler).unbind('keypress', $.blockUI.impl.boxHandler);
        if (this.boxCallback)
            this.boxCallback(this.box);
        $('body .displayBox').hide().remove();
    },
    // event handler to suppress keyboard/mouse events when blocking
    handler: function(e) {
        if (e.keyCode && e.keyCode == 9) {
            if ($.blockUI.impl.pageBlock && !$.blockUI.defaults.allowTabToLeave) {
                var els = $.blockUI.impl.pageBlockEls;
                var fwd = !e.shiftKey && e.target == els[els.length-1];
                var back = e.shiftKey && e.target == els[0];
                if (fwd || back) {
                    setTimeout(function(){$.blockUI.impl.focus(back)},10);
                    return false;
                }
            }
        }
        if ($(e.target).parents('div.blockMsg').length > 0)
            return true;
        return $(e.target).parents().children().filter('div.blockUI').length == 0;
    },
    boxHandler: function(e) {
        if ((e.keyCode && e.keyCode == 27) || (e.type == 'click' && $(e.target).parents('div.blockMsg').length == 0))
            $.blockUI.impl.boxRemove();
        return true;
    },
    // bind/unbind the handler
    bind: function(b, el) {
        var full = el == window;
        // don't bother unbinding if there is nothing to unbind
        if (!b && (full && !this.pageBlock || !full && !el.$blocked)) return;
        if (!full) el.$blocked = b;
        var $e = $(el).find('a,:input');
        $.each(['mousedown','mouseup','keydown','keypress','click'], function(i,o) {
            $e[b?'bind':'unbind'](o, $.blockUI.impl.handler);
        });
    },
    focus: function(back) {
        if (!$.blockUI.impl.pageBlockEls) return;
        var e = $.blockUI.impl.pageBlockEls[back===true ? $.blockUI.impl.pageBlockEls.length-1 : 0];
        if (e) e.focus();
    },
    center: function(el) {
        var p = el.parentNode, s = el.style;
        var l = ((p.offsetWidth - el.offsetWidth)/2) - this.sz(p,'borderLeftWidth');
        var t = ((p.offsetHeight - el.offsetHeight)/2) - this.sz(p,'borderTopWidth');
        s.left = l > 0 ? (l+'px') : '0';
        s.top  = t > 0 ? (t+'px') : '0';
    },
    sz: function(el, p) { return parseInt($.css(el,p))||0; }
};

})(jQuery);
 
 /*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

    // We override the animation for all of these color styles
    jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
        jQuery.fx.step[attr] = function(fx){
            if ( fx.state == 0 ) {
                fx.start = getColor( fx.elem, attr );
                fx.end = getRGB( fx.end );
            }

            fx.elem.style[attr] = "rgb(" + [
                Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
                Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
                Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
            ].join(",") + ")";
        }
    });

    // Color Conversion functions from highlightFade
    // By Blair Mitchelmore
    // http://jquery.offput.ca/highlightFade/

    // Parse strings looking for color tuples [255,255,255]
    function getRGB(color) {
        var result;

        // Check if we're already dealing with an array of colors
        if ( color && color.constructor == Array && color.length == 3 )
            return color;

        // Look for rgb(num,num,num)
        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

        // Look for rgb(num%,num%,num%)
        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
            return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

        // Look for #a0b1c2
        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
            return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

        // Look for #fff
        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
            return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

        // Otherwise, we're most likely dealing with a named color
        return colors[jQuery.trim(color).toLowerCase()];
    }
    
    function getColor(elem, attr) {
        var color;

        do {
            color = jQuery.curCSS(elem, attr);

            // Keep going until we find an element that has color, or we hit the body
            if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
                break; 

            attr = "backgroundColor";
        } while ( elem = elem.parentNode );

        return getRGB(color);
    };
    
    // Some named colors to work with
    // From Interface by Stefan Petre
    // http://interface.eyecon.ro/

    var colors = {
        aqua:[0,255,255],
        azure:[240,255,255],
        beige:[245,245,220],
        black:[0,0,0],
        blue:[0,0,255],
        brown:[165,42,42],
        cyan:[0,255,255],
        darkblue:[0,0,139],
        darkcyan:[0,139,139],
        darkgrey:[169,169,169],
        darkgreen:[0,100,0],
        darkkhaki:[189,183,107],
        darkmagenta:[139,0,139],
        darkolivegreen:[85,107,47],
        darkorange:[255,140,0],
        darkorchid:[153,50,204],
        darkred:[139,0,0],
        darksalmon:[233,150,122],
        darkviolet:[148,0,211],
        fuchsia:[255,0,255],
        gold:[255,215,0],
        green:[0,128,0],
        indigo:[75,0,130],
        khaki:[240,230,140],
        lightblue:[173,216,230],
        lightcyan:[224,255,255],
        lightgreen:[144,238,144],
        lightgrey:[211,211,211],
        lightpink:[255,182,193],
        lightyellow:[255,255,224],
        lime:[0,255,0],
        magenta:[255,0,255],
        maroon:[128,0,0],
        navy:[0,0,128],
        olive:[128,128,0],
        orange:[255,165,0],
        pink:[255,192,203],
        purple:[128,0,128],
        violet:[128,0,128],
        red:[255,0,0],
        silver:[192,192,192],
        white:[255,255,255],
        yellow:[255,255,0]
    };
    
})(jQuery);


/*
 * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php
 *
 * Uses the built In easIng capabilities added In jQuery 1.1
 * to offer multiple easIng options
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

// t: current time, b: begInnIng value, c: change In value, d: duration

jQuery.extend( jQuery.easing,
{
    easeInQuad: function (x, t, b, c, d) {
        return c*(t/=d)*t + b;
    },
    easeOutQuad: function (x, t, b, c, d) {
        return -c *(t/=d)*(t-2) + b;
    },
    easeInOutQuad: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t + b;
        return -c/2 * ((--t)*(t-2) - 1) + b;
    },
    easeInCubic: function (x, t, b, c, d) {
        return c*(t/=d)*t*t + b;
    },
    easeOutCubic: function (x, t, b, c, d) {
        return c*((t=t/d-1)*t*t + 1) + b;
    },
    easeInOutCubic: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t + b;
        return c/2*((t-=2)*t*t + 2) + b;
    },
    easeInQuart: function (x, t, b, c, d) {
        return c*(t/=d)*t*t*t + b;
    },
    easeOutQuart: function (x, t, b, c, d) {
        return -c * ((t=t/d-1)*t*t*t - 1) + b;
    },
    easeInOutQuart: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
        return -c/2 * ((t-=2)*t*t*t - 2) + b;
    },
    easeInQuint: function (x, t, b, c, d) {
        return c*(t/=d)*t*t*t*t + b;
    },
    easeOutQuint: function (x, t, b, c, d) {
        return c*((t=t/d-1)*t*t*t*t + 1) + b;
    },
    easeInOutQuint: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
        return c/2*((t-=2)*t*t*t*t + 2) + b;
    },
    easeInSine: function (x, t, b, c, d) {
        return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
    },
    easeOutSine: function (x, t, b, c, d) {
        return c * Math.sin(t/d * (Math.PI/2)) + b;
    },
    easeInOutSine: function (x, t, b, c, d) {
        return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
    },
    easeInExpo: function (x, t, b, c, d) {
        return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
    },
    easeOutExpo: function (x, t, b, c, d) {
        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
    },
    easeInOutExpo: function (x, t, b, c, d) {
        if (t==0) return b;
        if (t==d) return b+c;
        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
    },
    easeInCirc: function (x, t, b, c, d) {
        return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
    },
    easeOutCirc: function (x, t, b, c, d) {
        return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
    },
    easeInOutCirc: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
        return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
    },
    easeInElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
    },
    easeOutElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
    },
    easeInOutElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
        return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
    },
    easeInBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c*(t/=d)*t*((s+1)*t - s) + b;
    },
    easeOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
    },
    easeInOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158; 
        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
    },
    easeInBounce: function (x, t, b, c, d) {
        return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
    },
    easeOutBounce: function (x, t, b, c, d) {
        if ((t/=d) < (1/2.75)) {
            return c*(7.5625*t*t) + b;
        } else if (t < (2/2.75)) {
            return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
        } else if (t < (2.5/2.75)) {
            return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
        } else {
            return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
        }
    },
    easeInOutBounce: function (x, t, b, c, d) {
        if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
        return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
    }
});



/*
 * jQuery Media Plugin for converting elements into rich media content.
 *
 * Examples and documentation at: http://malsup.com/jquery/media/
 * Copyright (c) 2007 M. Alsup
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * @author: M. Alsup
 * @version: 0.70 (7/05/2007)
 * @requires jQuery v1.1.2 or later
 *
 * Supported Media Players:
 *    - Flash
 *    - Quicktime
 *    - Real Player
 *    - Silverlight
 *    - Windows Media Player
 *    - iframe
 *
 * Supported Media Formats:
 *   Any types supported by the above players, such as:
 *     Video: asf, avi, flv, mov, mpg, mpeg, mp4, qt, smil, swf, wmv, 3g2, 3gp
 *     Audio: aif, aac, au, gsm, mid, midi, mov, mp3, m4a, snd, rm, wav, wma
 *     Other: bmp, html, pdf, psd, qif, qtif, qti, tif, tiff, xaml
 *
 * Thanks to Mark Hicken and Brent Pedersen for helping me debug this on the Mac!
 */
(function($) {

/**
 * Chainable method for converting elements into rich media.
 *
 * @name media
 * @param Object options Options object
 * @param Function callback fn invoked for each matched element before conversion
 * @param Function callback fn invoked for each matched element after conversion
 * @cat Plugins/media
 */
$.fn.media = function(options, f1, f2) {
    return this.each(function() {
        if (typeof options == 'function') {
            f2 = f1;
            f1 = options;
            options = {};
        }
        var o = getSettings(this, options);
        // pre-conversion callback, passes original element and fully populated options
        if (typeof f1 == 'function') f1(this, o);
        
        var r = getTypesRegExp();
        var m = r.exec(o.src) || [''];
        o.type ? m[0] = o.type : m.shift();
        for (var i=0; i < m.length; i++) {
            fn = m[i].toLowerCase();
            if (isDigit(fn[0])) fn = 'fn' + fn; // fns can't begin with numbers
            if (!$.fn.media[fn]) 
                continue;  // unrecognized media type
            // normalize autoplay settings
            var player = $.fn.media[fn+'_player'];
            if (!o.params) o.params = {};
            if (player) {
                var num = player.autoplayAttr == 'autostart';
                o.params[player.autoplayAttr || 'autoplay'] = num ? (o.autoplay ? 1 : 0) : o.autoplay ? true : false;
            }
            var $div = $.fn.media[fn](this, o);

            $div.css('backgroundColor', o.bgColor).width(o.width);
            
            // post-conversion callback, passes original element, new div element and fully populated options
            if (typeof f2 == 'function') f2(this, $div[0], o, player.name);
            break;
        }
    });
};

/**
 * Chainable method for preparing elements to display rich media with
 * a page overlay.
 *
 * @name mediabox
 * @param Object options Options object
 * @param Object css values for the media div
 * @cat Plugins/media
 */
$.fn.mediabox = function(options, css) {
    return this.click(function() {
        if (typeof $.blockUI == 'undefined' || typeof $.blockUI.version == 'undefined' || $.blockUI.version < 1.26) {
            if (typeof $.fn.mediabox.warning != 'undefined') return this; // one warning is enough
            $.fn.mediabox.warning = 1;
            alert('The mediabox method requires blockUI v1.26 or later.');
            return false;
        }
        var o, p, div=0, $e = $(this).clone();
        $e.appendTo('body').hide().css({margin: 0});
        options = $.extend({}, options, { autoplay: 1 }); // force autoplay in box mode
        $e.media(options, function(){}, function(origEl, newEl, opts, player) {
            div = newEl;
            o = opts;
            p = player;
        });

        if (!div) return false;
        // don't pull element from the dom on Safari
        var $div = $.browser.safari ? $(div).hide() : $(div).remove();

        if (o.loadingImage)
            $div.css({
                backgroundImage:    'url('+o.loadingImage+')',
                backgroundPosition: 'center center',
                backgroundRepeat:   'no-repeat'
            });
        if (o.boxTitle)
            $div.prepend('<div style="margin:0;padding:0">' + o.boxTitle + '</div>');
        
        if (css) $div.css(css);

        $div.displayBox( { width: o.width, height: o.height }, function(el) {
            // quirkiness; sometimes media doesn't stop when removed from the DOM (especially in IE)
            $('object,embed', el).each(function() {
                try { this.Stop();   } catch(e) {}  // quicktime
                try { this.DoStop(); } catch(e) {}  // real
                try { this.controls.stop(); } catch(e) {} // windows media player
            });
        }, p == 'flash'); // <-- mac/ff workaround
        return false;
    });
};

  
/**
 * Non-chainable method for adding or changing file format / player mapping
 * @name mapFormat
 * @param String format File format extension (ie: mov, wav, mp3)
 * @param String player Player name to use for the format (one of: flash, quicktime, realplayer, winmedia, silverlight or iframe
 */
$.fn.media.mapFormat = function(format, player) {
    if (!format || !player || !$.fn.media.defaults.players[player]) return; // invalid
    format = format.toLowerCase();
    if (isDigit(format[0])) format = 'fn' + format;
    $.fn.media[format] = $.fn.media[player];
};


// global defautls; override as needed
$.fn.media.defaults = {
    width:         400,
    height:        400,
    preferMeta:    1,         // true if markup metadata takes precedence over options object
    autoplay:      0,         // normalized cross-player setting
    bgColor:       '', // background color
    params:        {},        // added to object element as param elements; added to embed element as attrs
    attrs:         {},        // added to object and embed elements as attrs
    flashvars:     {},        // added to flash content as flashvars param/attr
    flashVersion:  '7',       // required flash version
    
    // MediaBox options
    boxTitle:      null,      // MediaBox titlebar
    loadingImage:  null,      // MediaBox loading indicator
    
    // default flash video and mp3 player (@see: http://jeroenwijering.com/?item=Flash_Media_Player)
    flvPlayer:     v_player,
    mp3Player:     'mediaplayer.swf',
    
    // @see http://msdn2.microsoft.com/en-us/library/bb412401.aspx
    silverlight: {
        inplaceInstallPrompt: 'true', // display in-place install prompt?
        isWindowless:         'true', // windowless mode (false for wrapping markup)
        framerate:            '24',   // maximum framerate
        version:              '0.9',  // Silverlight version
        onError:              null,   // onError callback
        onLoad:               null,   // onLoad callback
        initParams:           null,   // object init params
        userContext:          null    // callback arg passed to the load callback
    }
};

// Media Players; think twice before overriding
$.fn.media.defaults.players = {
    flash: {
        name:         'flash',
        types:        'flv,mp3,swf',
        oAttrs:   {
            classid:  'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
            type:     'application/x-oleobject',
            codebase: 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + $.fn.media.defaults.flashVersion
        },
        eAttrs: {
            type:         'application/x-shockwave-flash',
            pluginspage:  'http://www.adobe.com/go/getflashplayer'
        }        
    },
    quicktime: {
        name:         'quicktime',
        types:        'aif,aiff,aac,au,bmp,gsm,mov,mid,midi,mpg,mpeg,mp4,m4a,psd,qt,qtif,qif,qti,snd,tif,tiff,wav,3g2,3gp',
        oAttrs:   {
            classid:  'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
            codebase: 'http://www.apple.com/qtactivex/qtplugin.cab'
        },
        eAttrs: {
            pluginspage:  'http://www.apple.com/quicktime/download/'
        }
    },
    realplayer: {
        name:         'real',
        types:        'ra,ram,rm,rpm,rv,smi,smil',
        autoplayAttr: 'autostart',
        oAttrs:   {
            classid:  'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'
        },
        eAttrs: {
            type:         'audio/x-pn-realaudio-plugin',
            pluginspage:  'http://www.real.com/player/'
        }
    },
    winmedia: {
        name:         'winmedia',
        types:        'asf,avi,wma,wmv',
        autoplayAttr: 'autostart',
        oUrl:         'url',
        oAttrs:   {
            classid:  'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6',
            type:     'application/x-oleobject'
        },
        eAttrs: {
            type:         'application/x-mplayer2',
            pluginspage:  'http://www.microsoft.com/Windows/MediaPlayer/'
        }        
    },
    // special cases
    iframe: {
        name:  'iframe',
        types: 'html,pdf'
    },
    silverlight: {
        name:  'silverlight',
        types: 'xaml'
    }
};

//
//  everything below here is private
//


var counter = 1;

for (var player in $.fn.media.defaults.players) {
    var types = $.fn.media.defaults.players[player].types;
    $.each(types.split(','), function(i,o) {
        if (isDigit(o[0])) o = 'fn' + o;
        $.fn.media[o] = $.fn.media[player] = getGenerator(player);
        $.fn.media[o+'_player'] = $.fn.media.defaults.players[player];
    });
};

function getTypesRegExp() {
    var types = '';
    for (var player in $.fn.media.defaults.players) {
        if (types.length) types += ',';
        types += $.fn.media.defaults.players[player].types;
    };
    return new RegExp('\\.(' + types.replace(/,/g,'|') + ')\\b');
};

function getGenerator(player) {
    return function(el, options) {
        return generate(el, options, player);
    };
};


function isDigit(c) {
    return '0123456789'.indexOf(c) > -1;
};

// flatten all possible options: global defaults, meta, option obj
function getSettings(el, options) {
    options = options || {};
    var $el = $(el);
    
    var cls = el.className || '';
    var meta = $.meta ? $el.data() : {};
    var w = meta.width  || parseInt(((cls.match(/w:(\d+)/)||[])[1]||0));
    var h = meta.height || parseInt(((cls.match(/h:(\d+)/)||[])[1]||0));
    if (w) meta.width  = w;
    if (h) meta.height = h;
    if (cls) meta.cls = cls;

    var a = $.fn.media.defaults;
    var b = $.meta && $.fn.media.defaults.preferMeta ? options : meta;
    var c = b == options ? meta : options;

    var p = { params: { bgColor: options.bgColor || $.fn.media.defaults.bgColor } };
    var opts = $.extend({}, a, b, c);
    $.each(['attrs','params','flashvars','silverlight'], function(i,o) {
        opts[o] = $.extend({}, p[o] || {}, a[o] || {}, b[o] || {}, c[o] || {});
    });

    if (typeof opts.caption == 'undefined') opts.caption = $el.text();

    // make sure we have a source!
    opts.src = opts.src || $el.attr('href') || $el.attr('src') || 'unknown';
    return opts;
};

//
//  Flash Player
//

// generate flash using SWFObject if possible
$.fn.media.swf = function(el, opts) {
    if (typeof SWFObject == 'undefined') {
        // roll our own
        if (opts.flashvars) {
            var a = [];
            for (var f in opts.flashvars)
                a.push(f + '=' + opts.flashvars[f]);
            if (!opts.params) opts.params = {};
            opts.params.flashvars = a.join('&');
        }
        return generate(el, opts, 'flash');
    }

    var id = el.id ? (' id="'+el.id+'"') : '';
    var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
    var $div = $('<div' + id + cls + '>');
    $(el).after($div).remove();

    var so = new SWFObject(opts.src, 'movie_player_' + counter++, opts.width, opts.height, opts.flashVersion, opts.bgColor);
    for (var p in opts.params)
        if (p != 'bgColor') so.addParam(p, opts.params[p]);
    for (var f in opts.flashvars)
        so.addVariable(f, opts.flashvars[f]);
    so.write($div[0]);

    if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
    return $div;
};

// map flv and mp3 files to the swf player by default
$.fn.media.flv = $.fn.media.mp3 = function(el, opts) {
    var src = opts.src;
    var player = /\.mp3\b/i.test(src) ? $.fn.media.defaults.mp3Player : $.fn.media.defaults.flvPlayer;
    opts.src = player;
    opts.src = opts.src + '?file=' + src;
    opts.flashvars = $.extend({}, { file: src }, opts.flashvars );
    return $.fn.media.swf(el, opts);
};

//
//  Silverlight
//
$.fn.media.xaml = function(el, opts) {
    if (!window.Sys || !window.Sys.Silverlight) {
        if ($.fn.media.xaml.warning) return;
        $.fn.media.xaml.warning = 1;
        alert('You must include the Silverlight.js script.');
        return;
    }

    var props = {
        width: opts.width,
        height: opts.height,
        background: opts.bgColor,
        inplaceInstallPrompt: opts.silverlight.inplaceInstallPrompt,
        isWindowless: opts.silverlight.isWindowless,
        framerate: opts.silverlight.framerate,
        version: opts.silverlight.version
    };
    var events = {
        onError: opts.silverlight.onError,
        onLoad: opts.silverlight.onLoad
    };

    var id1 = el.id ? (' id="'+el.id+'"') : '';
    var id2 = opts.id || 'AG' + counter++;
    // convert element to div
    var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
    var $div = $('<div' + id1 + cls + '>');
    $(el).after($div).remove();
    
    Sys.Silverlight.createObjectEx({
        source: opts.src,
        initParams: opts.silverlight.initParams,
        userContext: opts.silverlight.userContext,
        id: id2,
        parentElement: $div[0],
        properties: props,
        events: events
    });

    if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
    return $div;
};

//
// generate object/embed markup
//
function generate(el, opts, player) {
    var $el = $(el);
    var o = $.fn.media.defaults.players[player];
    
    if (player == 'iframe') {
        var o = $('<iframe' + ' width="' + opts.width + '" height="' + opts.height + '" >');
        o.attr('src', opts.src);
        o.css('backgroundColor', o.bgColor);
    }
    else if ($.browser.msie) {
        var a = ['<object width="' + opts.width + '" height="' + opts.height + '" '];
        for (var key in opts.attrs)
            a.push(key + '="'+opts.attrs[key]+'" ');
        for (var key in o.oAttrs || {})
            a.push(key + '="'+o.oAttrs[key]+'" ');
        a.push('></ob'+'ject'+'>');
        var p = ['<param name="' + (o.oUrl || 'src') +'" value="' + opts.src + '">'];
        for (var key in opts.params)
            p.push('<param name="'+ key +'" value="' + opts.params[key] + '">');
        var o = document.createElement(a.join(''));
        for (var i=0; i < p.length; i++)
            o.appendChild(document.createElement(p[i]));
    }
    else {
        var a = ['<embed width="' + opts.width + '" height="' + opts.height + '" style="display:block"'];
        if (opts.src) a.push(' src="' + opts.src + '" ');
        for (var key in opts.attrs)
            a.push(key + '="'+opts.attrs[key]+'" ');
        for (var key in o.eAttrs || {})
            a.push(key + '="'+o.eAttrs[key]+'" ');
        for (var key in opts.params)
            a.push(key + '="'+opts.params[key]+'" ');
        a.push('></em'+'bed'+'>');
    }
    // convert element to div
    var id = el.id ? (' id="'+el.id+'"') : '';
    var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
    var $div = $('<div' + id + cls + '>');
    $el.after($div).remove();
    ($.browser.msie || player == 'iframe') ? $div.append(o) : $div.html(a.join(''));
    if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
    return $div;
};


})(jQuery);



/*
 * jQuery Cycle Lite Plugin
 * http://malsup.com/jquery/cycle/lite/
 * Copyright (c) 2008 M. Alsup
 * Version: 1.0 (06/08/2008)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.2.3 or later
 */
;(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery);

        //pngfix
        eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(s($){3.1s.1k=s(j){j=3.1a({12:\'1m.1j\'},j);8 k=(n.P=="r 10 Z"&&U(n.v)==4&&n.v.E("14 5.5")!=-1);8 l=(n.P=="r 10 Z"&&U(n.v)==4&&n.v.E("14 6.0")!=-1);o(3.17.16&&(k||l)){3(2).L("1r[@m$=.M]").z(s(){3(2).7(\'q\',3(2).q());3(2).7(\'p\',3(2).p());8 a=\'\';8 b=\'\';8 c=(3(2).7(\'K\'))?\'K="\'+3(2).7(\'K\')+\'" \':\'\';8 d=(3(2).7(\'A\'))?\'A="\'+3(2).7(\'A\')+\'" \':\'\';8 e=(3(2).7(\'C\'))?\'C="\'+3(2).7(\'C\')+\'" \':\'\';8 f=(3(2).7(\'B\'))?\'B="\'+3(2).7(\'B\')+\'" \':\'\';8 g=(3(2).7(\'R\'))?\'1d:\'+3(2).7(\'R\')+\';\':\'\';8 h=(3(2).1c().7(\'1b\'))?\'19:18;\':\'\';o(2.9.y){a+=\'y:\'+2.9.y+\';\';2.9.y=\'\'}o(2.9.t){a+=\'t:\'+2.9.t+\';\';2.9.t=\'\'}o(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}8 i=(2.9.15);b+=\'<x \'+c+d+e+f;b+=\'9="13:11;1q-1p:1o-1n;O:W-V;N:1l;\'+g+h;b+=\'q:\'+3(2).q()+\'u;\'+\'p:\'+3(2).p()+\'u;\';b+=\'J:I:H.r.G\'+\'(m=\\\'\'+3(2).7(\'m\')+\'\\\', D=\\\'F\\\');\';b+=i+\'"></x>\';o(a!=\'\'){b=\'<x 9="13:11;O:W-V;\'+a+h+\'q:\'+3(2).q()+\'u;\'+\'p:\'+3(2).p()+\'u;\'+\'">\'+b+\'</x>\'}3(2).1i();3(2).1h(b)});3(2).L("*").z(s(){8 a=3(2).T(\'N-S\');o(a.E(".M")!=-1){8 b=a.X(\'1g("\')[1].X(\'")\')[0];3(2).T(\'N-S\',\'1f\');3(2).Q(0).Y.J="I:H.r.G(m=\'"+b+"\',D=\'F\')"}});3(2).L("1e[@m$=.M]").z(s(){8 a=3(2).7(\'m\');3(2).Q(0).Y.J=\'I:H.r.G\'+\'(m=\\\'\'+a+\'\\\', D=\\\'F\\\');\';3(2).7(\'m\',j.12)})}1t 3}})(3);',62,92,'||this|jQuery||||attr|var|style|||||||||||||src|navigator|if|height|width|Microsoft|function|padding|px|appVersion|margin|span|border|each|class|alt|title|sizingMethod|indexOf|scale|AlphaImageLoader|DXImageTransform|progid|filter|id|find|png|background|display|appName|get|align|image|css|parseInt|block|inline|split|runtimeStyle|Explorer|Internet|relative|blankgif|position|MSIE|cssText|msie|browser|hand|cursor|extend|href|parent|float|input|none|url|after|hide|gif|pngFix|transparent|blank|line|pre|space|white|img|fn|return'.split('|'),0,{}));


    /**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};