﻿window.onerror = myError;

function myError(message, url, line) {
	return true;
}


$(function () {

    $('#searchbox').focus(
        function () {
            if ($('#searchbox').val() == 'Search our site') { $('#searchbox').val(''); }
            $('#searchbox').css('color', 'black');
            $('#searchbox').css('font-style', 'normal');
        }
    )
    $('#searchbox').blur(
        function () {
            $('#searchbox').val(jQuery.trim($('#searchbox').val()));
            if ($('#searchbox').val() == 'Search our site' || $('#searchbox').val() == '') {
                $('#searchbox').val('Search our site');
                $('#searchbox').css('color', '#777777');
                $('#searchbox').css('font-style', 'italic');
            }
        }
    )

    $('#searchbox').bind('keypress', function (e) {
        if (e.keyCode == 13) {
            doSearch();
            return false;
        }
    });

});

function doSearch() {
    $('#searchbox').val(jQuery.trim($('#searchbox').val()));

    var criteria = $('#searchbox').val();
    if (criteria.length > 0) {
        document.location.href = '/Search.aspx?q=' + encodeURIComponent(criteria);
    }
}
function openChatWin(DEPT, S) {

    S = 0;

    var popupWin = null;
    var LeftPosition = (screen.width) ? (screen.width - 400) / 2 : 0;
    var TopPosition = (screen.height) ? (screen.height - 350) / 2 : 0;

    popupWin = window.open('/chat/chat.asp?dpt=' + DEPT + '&r=' + Math.random() + '&school=futurebuilder', 'ChatWin', 'height=350,width=400,top=' + TopPosition + ',left=' + LeftPosition);
}


