$(document).ready(function(){

     $('#toggle_testimonials').click(function(){
          //$('#testimonials_page_container').css('display', 'block');
          $('#clients_page_container').css('display', 'none');
          $('#testimonials_page_container').fadeIn('slow');
          //$('#clients_page_container').fadeOut('fast');
          $(this).css('color', '#297931').css('font-size', '16px'); 
          $('#toggle_clients').css('font-size', '12px');
     });


     $('#toggle_clients').click(function(){
          $('#testimonials_page_container').css('display', 'none');
          //$('#testimonials_page_container').fadeOut('fast');
          //$('#clients_page_container').css('display', 'block');
          $('#clients_page_container').fadeIn('slow');
          $(this).css('color', '#297931').css('font-size', '16px');
          $('#toggle_testimonials').css('font-size', '12px');
     }).css('font-size', '16px');

    //PORTFOLIO PAGE
    $("div.portfolio_nav a").click(function(){
      openwhatp = $(this).attr("class"); //get the table to open
      //alert("open page: "+openwhatp); //debug
      $("table.p_page").fadeOut(); //fade out all the tables
      $("table."+openwhatp).fadeIn(); //fade in the page to open
      $("div.portfolio_nav a").css('font-size', '13px').css('font-weight', 'normal');
      $("a."+openwhatp).css('font-size', '15px').css('font-weight', 'bolder');
      
    });


    //CONTACT FORM 
    $("#contactform").submit(function(){
        var errors = 0;
        $('.required').each(function(i){
            if($(this).val() == ''){
                $('.required').css('border', 'solid 1px red');
                $("#errormsg").text('Please fill up all of the required fields (*) first before submitting.');
                errors = 1;
                return false;
            }
        });
        if(errors == 1){
            return false;
        } else {
            return true;
        }
    });

    $("a[@rel*=lightbox]").lightBox();

});