tweet_no=0;
tweet_total_count = 0;
$(document).ready(function(){

    $('#servicesLinkContainer').hover(function(){
        $(this).children('#servicesLinks').css('display','inline')
    }, function(){
        if ($('.pageType').text() != 'Services') {
            $(this).children('#servicesLinks').css('display','none')
        }
    });
    
    $('.testimonial_text').hide().fadeIn(3000);

    
    $('#tweet_list li').each(function() {
        tweet_total_count++;
    });
    
    interval = window.setInterval(function(){ 
        tweet_no = tweet_no + 1;
        if(tweet_no >= tweet_total_count){
            tweet_no = 0;
        }                      
        tweet_slide_up(tweet_no);
   }, 5000);  
   
   
   //$('style').remove();
   //$('http://cdn.mlcalc.com/themes/mlcalc/images/top-panel-mortgage.png').remove();
   //$('http://cdn.mlcalc.com/themes/mlcalc/images/top-panel-loan.png').remove();
   
   
   $('.zeroHeight IMG').each(function () {
        var src = $(this).attr('src');
        $(this).attr('src', src.replace("http://cdn.mlcalc.com/themes/mlcalc/images/", "/images/"));
        //$(this).attr('src', src.replace('http://cdn.mlcalc.com/themes/mlcalc/images/', '/images/$1'));
    });
    
    //$('#mlcalcWidgetHolder').text('Powered By').remove();


   
   //$('.zeroHeight .panelItem').attr({'src' : 'http://cdn.mlcalc.com/themes/mlcalc/images/top-panel-mortgage.png'}).replaceWith('<img height="44" width="300" class="panelItem" usemap="#MLCalcFormMortgage" alt="" src="/images/top-panel-mortgage.png">');
   //$('.zeroHeight .panelItem').attr({'src' : 'http://cdn.mlcalc.com/themes/mlcalc/images/top-panel-loan.png'}).replaceWith('<img height="44" width="300" class="panelItem" usemap="#MLCalcFormMortgage" alt="" src="/images/top-panel-loan.png">');
                
})

function tweet_slide_up(tweet_no){
    
        tweet_top = (tweet_no) * 34;  //extra 3px for top left image margin
        tweet_top = tweet_top * -1;
        if(tweet_no == 0){
            $("#tweet_list").animate({"top": "0px"}, 500);
        }
        else{
            $("#tweet_list").animate({"top": + tweet_top +"px"}, "slow");
        }    
}
