﻿function stretch() {
    var height = $("#main_center").innerHeight();
    if (height > 460) {
        $(".stretch").css('height', height);
    }
}

function loader(url) {
    $("#imgLoading").show();
    $('#main_center').load(url, "",
        function(responseText, textStatus, XMLHttpRequest) {
            if (textStatus == 'error') {
                $('#main_center').html(responseText);
            }
            stretch();
            $("#imgLoading").hide();          
        }
    );    
}
function showProgress(hide) {
    var img = $("#imgLoading");
    if (hide)
        img.hide();
    else
        img.show();
}

$(document).ready(function() {
    stretch();
    loader("Blog2.aspx");
    $("a#bloglink").click(function(event) {
        event.preventDefault();
        loader("Blog2.aspx");
    });
    $("a#biolink").click(function(event) {
        event.preventDefault();
        loader("Bio2.aspx");
    });
    $("a#medialink").click(function(event) {
        event.preventDefault();
        loader("Media2.aspx");
    });
    $("a#gallerylink").click(function(event) {
        event.preventDefault();
        loader("Gallery2.aspx");
    });
    $("a#gigslink").click(function(event) {
        event.preventDefault();
        loader("Gigs2.aspx");
    });
    $("a#gigslink2").click(function(event) {
        event.preventDefault();
        loader("Gigs2.aspx");
    });    
    $("a#presslink").click(function(event) {
        event.preventDefault();
        loader("Press2.aspx");
    });
    $("a#contactlink").click(function(event) {
        event.preventDefault();
        loader("Contact2.aspx");
    });
    $("a#linkslink").click(function(event) {
        event.preventDefault();
        loader("Links2.aspx");
    })
    $("a#creditslink").click(function(event) {
        event.preventDefault();
        loader("Credits2.aspx");
    });
    $("a#shoplink").click(function(event) {
        event.preventDefault();
        loader("Shop2.aspx");
    });
    
    $("a#test1").click(function(event) {
        event.preventDefault();
        loader("Blog3.aspx");
    });
    $("a#test2").click(function(event) {
        event.preventDefault();
        loader("Blog2.aspx");
    });
        
    $(".combutton").click(function() {
        $(this).delay(1000,function(){
            stretch();
        });
    });
    //      $("a.group img").animate({
    //        'opacity': 0.7
    //      });
    $("a.group img").hover(function() {
        $(this).stop().animate({ 'opacity': 0.8 });
    }, function() {
        $(this).stop().animate({ 'opacity': 1.0 });
    });
    $("a.group").fancybox({
        'hideOnContentClick' : false,
        'frameWidth' : 470,
        'frameHeight' : 386,
        'overlayShow': false,
        'zoomSpeedIn': 600,
        'zoomSpeedOut': 500,
        'easingIn': 'easeOutBack',
        'easingOut': 'easeInBack'
    });
    
    swapValues = [];
    $(".wm").each(function(i) {
        swapValues[i] = $(this).val();
        $(this).focus(function() {
            if ($(this).val() == swapValues[i]) {
                $(this).val("").removeClass("watermark")
            }
        }).blur(function() {
            if ($.trim($(this).val()) == "") { $(this).val(swapValues[i]).addClass("watermark") } 
        })
    })

});
