/**
 * Created by SonicK.
 * User: vadim.lyahovic
 * Date: 5/16/11
 * Time: 6:18 PM
 * To change this template use File | Settings | File Templates.
 */
 
function ClientValidateInformationRegarding(source, arguments) {
    arguments.IsValid = $(".rblInformationRegarding input:checked").length > 0;
}
 
function ClientValidate(source, arguments) {
    arguments.IsValid = $(".cboInterestedIn input:checked").length > 0;
}
 
$(document).ready(function() {
    /*
     *  Setup Hero
     */
    $(".hero").Hero();
    /*
     *  Setup Tabs
     */
    if (jQuery('#MSOSPWebPartManager_DisplayModeName').val() == 'Browse') {
        $(".tabBox").TabBox();
    } else {
        /*
        In Edit/Design mode, don't highlight any tabs but draw all their content so we can work with their
        web part zones
        */
        $('.tabBox ul.tabs li').each(function() {
            $(this).removeClass('selected');
        });
        $('.tabBox div.contentItem').each(function() {
            $(this).addClass('selected');
        });
    }
    /*
     *  Setup Rotator Gallery
     */
    $(".accolades").RotatorGallery();
    
    
    /*
    * Nav hover
    */
    $(document).ready(function() {
		$(".navItems li").mouseenter(function() {
			$(this).children(".navSub").stop(true, true).show();
		});
		$(".navItems li").mouseleave(function() {
			$(this).children(".navSub").stop(true, true).hide();
		});
	});
    
    $('#btnContactUsRedesign').click(function(e) {
        $(".questions .checkbox input").each(function(i){
            //this is not safe if someone changes the checkboxes in the code
            var match = $('#lbRedesignContactForm .rblInformationRegarding input:checkbox')[i];
            if($(this).attr('checked')) {
                $(match).attr('checked', 'checked');
            } else {
                $(match).attr('checked', '');
            }
        });
    
        $('#lbRedesignContactForm').modal({
		    appendTo:'form',
		    opacity: 90,
		    onShow: function(dialog) {
		        $(".LightboxContents .tabBox").TabBox();
		    },
            onClose: function(dialog) {
			    $.modal.close();
            }
        });
        
        e.preventDefault();
        return false;
    });
    
    $('#btnContactUsCancelRedesign').click(function() {
        $.modal.close();
        e.preventDefault();
        return false;
    });
    
	$('.navItems li').mouseover(function() {
	    $(this).addClass("sfhover");
	});
	
	$('.navItems li').mouseout(function() {
	    $(this).removeClass("sfhover");
	});
});
