// JScript source code
$(document).ready(InitPage);

function InitPage()
{
    $(".register-row .textbox").focus(TextboxFocus);
    $(".register-row .textbox").blur(TextboxBlur);
	
	$("#rollover-instruction-q4a").show();
	$(".unit-table").hide();
	$(".unit-table").css({position:"absolute",margin:"-36px 0px 0px 180px"});
	$(".showbutton-q4a").hover(function() {ShowUnitTable("q4a");}, function() {HideUnitTable("q4a");});
	
	$("#rollover-instruction-q4b").show();
	$(".showbutton-q4b").hover(function() {ShowUnitTable("q4b");}, function() {HideUnitTable("q4b");});
	
	$("#rollover-instruction-q5").show();
	$(".showbutton-q5").hover(function() {ShowUnitTable("q5");}, function() {HideUnitTable("q5");});
	
	$(".openClose-CampaignInfo").toggle(function(e) {HideDownloads(e,"campaign-info");},function(e) {ShowDownloads(e,"campaign-info");});
	$(".openClose-Email").toggle(function(e) {ShowDownloads(e,"email");}, function(e) {HideDownloads(e,"email");});
	$(".openClose-Logos").toggle(function(e) {ShowDownloads(e,"logos");}, function(e) {HideDownloads(e,"logos");});
	$(".openClose-Banner").toggle(function(e) {ShowDownloads(e,"banner");}, function(e) {HideDownloads(e,"banner");});
	$(".openClose-Powerpoint").toggle(function(e) {ShowDownloads(e,"powerpoint");}, function(e) {HideDownloads(e,"powerpoint");});
	$(".openClose-Questionnaire").toggle(function(e) {ShowDownloads(e,"questionnaire");}, function(e) {HideDownloads(e,"questionnaire");});
	$(".openClose-TShirt").toggle(function(e) { ShowDownloads(e, "tshirt"); }, function(e) { HideDownloads(e, "tshirt"); });
	$(".openClose-Video").toggle(function(e) { ShowDownloads(e, "video"); }, function(e) { HideDownloads(e, "video"); });
	$(".openClose-Posters").toggle(function(e) { ShowDownloads(e, "posters"); }, function(e) { HideDownloads(e, "posters"); });
	$(".downloadsPanel").hide();
	$(".downloadsPanel:first").show();
}

function TextboxFocus()
{
    if($(this).val() == $(this).prev(".register-label").text().replace(":",""))
    {
        $(this).val("");
    }
}

function TextboxBlur()
{
    if($(this).val() == "")
    {
        var label = $(this).prev(".register-label").text().replace(":", "");
        $(this).val(label);
    }
}


function ShowUnitTable(question)
{
	$("#unit-table-" + question).fadeIn();		
}

function HideUnitTable(question)
{
	$("#unit-table-" + question).fadeOut();		
}



function ShowDownloads(event,title)
{
    $("#Downloads-" + title).slideDown();

	$(event.target).parents(".categoryTitle").find(".showHide a img").attr({
		src:"/i/open.gif",
		alt:"Close",
		title:"Close"
	});
}

function HideDownloads(event,title)
{
	$("#Downloads-" + title).slideUp();
	$(event.target).parents(".categoryTitle").find(".showHide a img").attr({
		src:"/i/closed.gif",
		alt:"Open",
		title:"Open"
	});
}

