//
// Wait for the DOM to be ready and then load some on-demand content.
//
$(document).ready(function() {
    $("#headerLocationsTab").click(function() {
        if ($("#locationsArea").height() == 8) {
            $("#locationsArea").animate({height: '160px'}, 600);
        }
        else {
            $("#locationsArea").animate({height: '8px'}, 600);
        }
    });

    $("img.bounceshadow").addClass('shadow');
    $("img.bounceshadow").mouseover(function() {
        $(this).removeClass('shadow').addClass('insetShadow');
    });
    $("img.bounceshadow").mouseout(function() {
        $(this).removeClass('insetShadow').addClass('shadow');
    });
});


//
// Turn all VideoPlay class hyperlinks into videos.
//
$(document).ready(function() {
    $('a.VideoPlayer').text('').each(function() {
	flowplayer(this, "/Custom/Website/Support/flowplayer.commercial-3.2.3.swf",
	{
		key: '#$ebe1ee548bc0ac4e393',
		clip: {
			autoPlay: false,
			scaling: 'fit'
		},
		plugins: {
			controls: {
				time: false
			}
		}
	}).ipad();
    });
});

//
// Turn all expander class elements into expanders.
//
$(function() {
    if (jQuery.isFunction($('div.accordion').accordion))
        $("div.accordion").accordion({collapsible: true, active: false, autoHeight: false});

    if (jQuery.isFunction($('div.tabs').tabs))
        $("div.tabs").tabs();
});

//
// Helper function to get the query string value.
//
function getQuerystring(key, default_)
{
  if (default_==null) default_=""; 
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
}


