$(".colors").live("click", function () {
    changeColor($(this).attr("rel"));
});
$(".menu a").live("click", function () {
    hideSection($(this).attr("rel"));
});
// Changes the color of the input from grey to red on click
$('input').live('click', function () {
    if (this.value == $(this).attr('title'))
        this.value = '';
    $(this).css({ 'color': '#ff5962' });
});

// If the input is blank, it will change the value to the title value and grey out the input
$('input').live('focus', function () {
    if (this.value == $(this).attr('title'))
        this.value = '';
    $(this).css({ 'color': '#ff5962' });
});
$('input').live('blur', function () {
    if (this.value == '') {
        this.value = this.title;
        $(this).css({ 'color': '#999999' });
    }
});
$('textarea').live('click', function () {
    if (this.value == $(this).attr('title'))
        this.value = '';
    $(this).css({ 'color': '#ff5962' });
});
$('textarea').live('focus', function () {
    if (this.value == $(this).attr('title'))
        this.value = '';
    $(this).css({ 'color': '#ff5962' });
});
$('textarea').live('blur', function () {
    if (this.value == '') {
        this.value = this.title;
        $(this).css({ 'color': '#999999' });
    }
});
$(document).ready(function () {
    Cufon.replace('.home h1');
    Cufon.replace('.menu');
    Cufon.replace($('.menu a[rel="home"]'), {color:'#ff5962'});
    // randomly change bg color
    var rand = Math.floor(Math.random()*3) + 1;
    changeColor(rand+'');
});
// -------------------------------------------------------------------
/*      Purpose: Changes background color

        Parameters: Must be sent as strings
        1 = blue
        2 = green
        3 = orange
        4 = pink
*/
// --------------------------------------------------------------------
function changeColor(color)
{
    switch(color)
    {
        case "1":
            $("body").css("background-color","#31bbcc");
            break;
        case "2":
            $("body").css("background-color","#cce813");
            break;
        case "3":
            $("body").css("background-color","#fcb90f");
            break;
        case "4":
            $("body").css("background-color","#ff5962");
            break;
        default:
            $("body").css("background-color","#31bbcc");
    }
}
function hideSection(exclude) {
    switch (exclude) {
        case 'home':
            $('.about').hide();
            $('.contact').hide();
            var blah = $('.menu a[rel="about"]');//.css("color","#636363");
            Cufon.replace($('.menu a[rel="about"]'), {color:'#636363'});
            Cufon.replace($('.menu a[rel="contact"]'), {color:'#636363'});
            Cufon.replace($('.menu a[rel="home"]'), {color:'#ff5962'});
            $('.menu a[rel="home"]').css("color","#ff5962");
            $('.home').fadeIn("slow");
            break;
        case 'about':
            $('.home').hide();
            $('.contact').hide();
            Cufon.replace($('.menu a[rel="home"]'), {color:'#636363'});
            Cufon.replace($('.menu a[rel="contact"]'), {color:'#636363'});
            Cufon.replace($('.menu a[rel="about"]'), {color:'#ff5962'});
            $('.about').fadeIn("slow");
            break;
        case 'contact':
            $('.home').hide();
            $('.about').hide();
            Cufon.replace($('.menu a[rel="home"]'), {color:'#636363'});
            Cufon.replace($('.menu a[rel="about"]'), {color:'#636363'});
            Cufon.replace($('.menu a[rel="contact"]'), {color:'#ff5962'});
            $('.contact').fadeIn("slow");
            break;
    }
}
