/**
 * @Copyright CSSJockey - Web Design and Development
 * @Website: http://www.cssjockey.com
 * @Terms of Use: http://www.cssjockey.com/terms-of-use
 * If you change the contents below sky will fall on your head!
 */
$(document).ready(function(){

    /* Featured Posts */

    $('#featured-cycle')
    .before('<div id="nav">')
    .cycle({
	fx:     'fade',
	speed:  '500',
	timeout: 4000,
	pager:  '#featured-nav'
    });

$('.upload-pic').hide(0);

$("#profile_pic_img").live('click', function(){
    $('.upload-pic').slideToggle(200);
})

$('.tabs').addClass('hidden');
$('#tab1').removeClass('hidden');

$('.tab1').live('click', function(){
    $('.tabs').addClass('hidden');
    $('#tab1').removeClass('hidden');
})

$('.tab2').live('click', function(){
    $('.tabs').addClass('hidden');
    $('#tab2').removeClass('hidden');
})
$('.tab3').live('click', function(){
    $('.tabs').addClass('hidden');
    $('#tab3').removeClass('hidden');
})
$('.tab4').live('click', function(){
    $('.tabs').addClass('hidden');
    $('#tab4').removeClass('hidden');
})
$('.tab5').live('click', function(){
    $('.tabs').addClass('hidden');
    $('#tab5').removeClass('hidden');
})
$('.tab6').live('click', function(){
    $('.tabs').addClass('hidden');
    $('#tab6').removeClass('hidden');
})


/* Profile Info */
    $('.profile-cat ul li a').live('click', function(){
        $('.profile-cat ul li a').removeClass('pactive');
        $(this).addClass('pactive');
        return false;
    })
    $('.tab1').addClass('pactive');
    $('.transparent').attr('readonly', 'readonly');
    $('.edit').live('click', function(){
        $('.transparent').removeAttr('readonly');
        $('.input').toggleClass('transparent');
        $('.save').toggleClass('hidden');
        $(this).toggle(0)
        return false;
    })
    $("#addspecialities").live('click', function(){
        $('.addspecialities').removeClass('hidden');
    })
    $("#addbio").live('click', function(){
        $('.addbio').removeClass('hidden');
    })
    $("#addtestimonials").live('click', function(){
        $('.addtestimonials').removeClass('hidden');
    })

/**
 $('#cancel').live('click', function(){
        $('.input').toggleClass('transparent');
        $('.save').toggleClass('hidden');
        $('.edit').toggle(0)
        return false;
    })
*/

$('#badgecode').click(function(){
    $(this).select();
})

$('#aform').submit(function(){
        var name = $('#name').val();
        var email = $('#emailadd').val();
        var cap = $('#cap').val();
        var emailFormat = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

        if(name == ''){
            $('#name').css('border-color','#cc0000');
            $('.name-er').html('Required Field');
            $('#name').focus();
            return false;
        }
        if(email == ''){
            $('#emailadd').css('border-color','#cc0000');
            $('.email-er').html('Required Field');
            $('#emailadd').focus();
            return false;
        }
        if(cap == ''){
            $('#cap').css('border-color','#cc0000');
            $('.cap-er').html('Required Field');
            $('#cap').focus();
            return false;
        }
        if(email != ""){
            if(email.search(emailFormat) == -1) {
            $('#emailadd').css('border-color','#cc0000');
            $('.email-er').html('Not a Valid Email');
            $('#emailadd').focus();
            return false;
            }
        }
        if(cap != ""){
            if(cap != 7) {
            $('#cap').css('border-color','#cc0000');
            $('.cap-er').html('Wrong Answer');
            $('#cap').focus();
            return false;
            }
        }
});


})

DD_roundies.addRule('.round5', 5, true);
