﻿$(document).ready(function () {


    var $addComment = $("div.addComment");
    $addComment.css('display', 'inline').mouseover(function () { $(this).addClass('hover'); }).mouseout(function () { $(this).removeClass('hover'); });
    $addComment.click(function () { $('.boxComment').slideToggle(); });
    $("div.boxComment").hide();


    //VIDEO CAROUSEL
    $("#videoCarousel").CloudCarousel(
		{
		    reflHeight: 56,
		    reflGap: 2,
		    xPos: 150,
		    yPos: 20,
		    buttonLeft: $(".left-but"),
		    buttonRight: $(".right-but"),
		    //altBox: $("#alt-text"),
		    titleBox: $("#title-text")
		}
	);

    if ($("#videoCarousel")) {
        Shadowbox.init({
            overlayColor: '#000',
            overlayOpacity: '0.75',
            language: 'en',
            modal: true,
            players: ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv'],
            onFinish: function (element) {
                window.setTimeout(function () {
                    $('#sb-content').attr('accesskey', 'M').focus();
                }, 500);
            }
        });
    };
});


function doSearchKey(buttonName, e) {//the purpose of this function is to allow the enter key to point to the correct button to click.
    var key;

    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if (key == 13) {
        //Get the button the user wants to have clicked
        var btn = document.getElementById(buttonName);
        if (btn != null) { //If we find the button click it
            btn.click();
            event.keyCode = 0
        }
    }
}


