/* 
 * 
 */

 $(document).ready(function(){

    /* Navigation image rollover */
    $("#music_img").hover(function () {
       $(this).attr("src", "../images/nav_music_on.gif");
    },
    function() {
        $(this).attr("src", "../images/nav_music_off.gif");
    });

    $("#bio_img").hover(function () {
       $(this).attr("src", "../images/nav_bio_on.gif");
    },
    function() {
        $(this).attr("src", "../images/nav_bio_off.gif");
    });

    $("#contact_img").hover(function () {
       $(this).attr("src", "../images/nav_contact_on.gif");
    },
    function() {
        $(this).attr("src", "../images/nav_contact_off.gif");
    });

    $("#pict_img").hover(function () {
       $(this).attr("src", "../images/nav_pictures_on.gif");
    },
    function() {
        $(this).attr("src", "../images/nav_pictures_off.gif");
    });
    /* End of navigation image rollover */

    // IE browswer detection
    if($.browser.msie) {
        $("[id^=track_]").live("click", function() {
            var track = $(this).attr("href").replace('../mp3/', '');
            var trackEnd = track.replace('.mp3', '');
        	$('#playerBox').load('../IEmusic/'+trackEnd+'.php');
            var title = $(this).attr("title");
            var mp3 = "audioUrl="+$(this).attr("href")+"&autoPlay=true";

            $('#player1').attr("flashvars", mp3);
            $("#playerBox").dialog({
               modal: true,
               title: title,
               width: 540,
               height: 100
            });
            return false;
        });
    }
    
    $("[id^=track_]").live("click", function() {
        //var track = $(this).attr("id")substr(6);
        var title = $(this).attr("title");
        var mp3 = "audioUrl="+$(this).attr("href")+"&autoPlay=true";

        $('#player').attr("flashvars", mp3);
        $("#playerBox").dialog({
           modal: true,
           title: title,
           width: 540,
           height: 100
        });
        return false;
    });
    
    // Save button on the contact page.
    $("button").button();

    // Contact form submission

    $("button").live('click', function(){

    	var dataString = {
    			name: $("#name").val(),
    			email: $("#email").val(),
    			comments: $("#message").val(),
    			verify: $("#vercode").val()
    	};
    	
    	$.post('../php/process_contactform.php', dataString, function(ret){
    		$("#result").html(ret);
    		if($("#thankyou").text() == 'Thank You!') {
//    			$("#id").val() == '';
//    			$("#email").val == '';
//    			$("#message").val() == '';
        		window.location.reload(true);    			
    		}

    	});
    	return false;
    });
    

 });


