/*

	Filename             screen-script.js
	Detail               Screen functionality
	Author:              thunder::tech inc.
	License:             CLIENT is defined as the owner of online property from which this file resides or this code is referenced in.
						 ADDITIONAL PARTY is defined as anyone other than thunder::tech or CLIENT.
						 No right is granted to ADDITIONAL PARTY to sell, distribute, modify or otherwise transfer the following source code without explicit written permission by CLIENT or thunder::tech.

*/

/*  ================================
     Sitewide JavaScript
    ================================ */

var ua = {}, Project = {};

ua.window = $(window);
ua.document = $(document);

Project.pageReady = function () {
    //thunder.client.project.flashReplace();
    //thunder.client.modify.rollImages();
    //thunder.client.modify.linkOptions();
    //thunder.client.modify.tabSet();
    thunder.client.modify.treeMenu(false);
    //thunder.client.modify.treeMenu(false, [thunder.client.modes.separatorTreeMenu]);
    //thunder.client.modify.treeMenu(false, [thunder.client.modes.imageTreeMenu]);
    thunder.client.modify.selfLabelFields();
    //thunder.client.modify.requireFields();
    //thunder.client.modify.dropSelector(true);
    //thunder.client.modify.scrollFeature(640, 3000, 500);
    Project.enableEnterKey();
    var menu = $('#menu');
    Project.initialMenuHeight = menu.height() + 92;
    Project.initialPageHeight = $('#page').height();

    if (Project.initialMenuHeight > Project.initialPageHeight) {
        $('#page').css({ 'height': Project.initialMenuHeight });
        Project.initialPageHeight = $('#page').height() + 92;
    }

    $('.menu-item').mouseenter(Project.handleMenuMouse).mouseleave(Project.handleMenuMouse);
}

Project.handleMenuMouse = function(evt)
{
	var addHeight = $('#menu').height() - Project.initialMenuHeight;
	$('#page').css({'height':( Project.initialPageHeight + addHeight )});
}
Project.search = function () {

    window.location = '/search.aspx?search=' + $("#search-input").val();

}
Project.flashReplace = function()
{
	var so;
	so = new SWFObject("flash/swf1.swf", "swf-obj-1", "300", "250", "9", "");
	so.addParam("quality", "high");
	so.addParam("wmode", "transparent");
	so.write("swf-holder-1");
}
Project.enableEnterKey = function () {

    ///ENTER KEY FOR LOCATOR

    var enterglobe=false;
    var $search = $("#search-button");
    $("#search-input").keypress(function (e) {
        if (e.which == 13 && enterglobe == false) {
            enterglobe = true;
            $search.click();
            return false;
        }
    });






}
$(Project.pageReady);
