﻿function ChangeImage(id, url) {
    document.getElementById(id).src = url;
}
function show_hide_tab(id, resetID) {
    document.getElementById(id).style.display = ''
    document.getElementById(resetID).style.display = 'none'
}
function navigate_to(webpage, qs) {
    location.href = 'default.aspx?s=' + webpage + '&' + qs;
    return true;
}

function goto() {
    var serieslist = document.getElementById("ddlMediaList");
    if (serieslist.selectedIndex > -1) {
        var destpage = serieslist[serieslist.selectedIndex].value
        location.href = 'default.aspx?s=' + destpage;
    }
    return true;
}

objects = document.getElementsByTagName("object");
for (var i = 0; i < objects.length; i++) {
    objects[i].outerHTML = objects[i].outerHTML;
}

/*Onload Image resize*/
function resize(which, max) {
    $("#" + which).hide();
    var elem = document.getElementById(which);
    if (elem == undefined || elem == null) return false;
    if (max == undefined) max = 100;
    if (elem.width > elem.height) {
        if (elem.width > max) elem.width = max; $("#" + which).show();
    } else {
        if (elem.height > max) elem.height = max;
    }

}

$j(document).ready(function () {

    $j("li.menuitem").bind("mouseenter", function () {
        $j('ul', this).show().animate({ opacity: 1 }, 200);
    }).bind("mouseleave", function () {
        $j('ul', this).animate({ opacity: 0 }, 200, function () { $j(this).hide(); });
    });

//    $j('#sponsor-carousel').carouFredSel({
//        visibleItems: 6,
//        width: 960,
//        height: 120,
//        direction: 'right',
//        scroll: {
//            items: 3,
//            speed: 4000,
//            pauseOnHover: true
//        }
//    });

    $j("#sponsors").smoothDivScroll({
        autoScroll: "always",
        autoScrollDirection: "endlessloopright",
        autoScrollStep: 1,
        autoScrollInterval: 10,
        scrollableArea: "#sponsor-carousel",
        scrollWrapper: "#sponsor-carousel-container"
    });

    // Logo parade event handlers	
    $j("#sponsors").bind("mouseover", function () {
        $j(this).smoothDivScroll("stopAutoScroll");
    }).bind("mouseout", function () {
        $j(this).smoothDivScroll("startAutoScroll");
       });


       // Reset Font Size
       var originalFontSize = $j('.story-wrapper').css('font-size');
       $j(".resetFont").click(function () {
       	$j('.story-wrapper').css('font-size', originalFontSize);
       });
       // Increase Font Size
       $j(".increaseFont").click(function () {
       	var currentFontSize = $j('.story-wrapper').css('font-size');
       	var currentFontSizeNum = parseFloat(currentFontSize, 10);
       	var newFontSize = currentFontSizeNum * 1.2;
       	$j('.story-wrapper').css('font-size', newFontSize);
       	return false;
       });
       // Decrease Font Size
       $j(".decreaseFont").click(function () {
       	var currentFontSize = $j('.story-wrapper').css('font-size');
       	var currentFontSizeNum = parseFloat(currentFontSize, 10);
       	var newFontSize = currentFontSizeNum * 0.8;
       	$j('.story-wrapper').css('font-size', newFontSize);
       	return false;
       });
    
});
