$(document).ready(function () {
    // JQ - Cufon
    //Cufon.replace('.nav, .top_link, .menu, h1, h2, h3');

    // JQ - Lightbox	
    jQuery('.light_box_pic').click(function () {
        var relAttr = $(this).attr('rel')
        screenWidth = document.documentElement.clientWidth
        screenHeight = document.documentElement.clientHeight
        jQuery.blockUI({
            message: ($('#light_box' + relAttr)),
            css: {
                border: 'none',
                padding: '0px',
                left: (screenWidth / 2) - (jQuery('#light_box').outerWidth() / 2) + 'px',
                top: (screenHeight / 2) - (jQuery('#light_box').outerHeight() / 2) + 'px',
                backgroundColor: 'transparent',
                color: '#b2b2b2'
            }
        });
    });

    if ($('CampusMap')) utwenteMap.initialize('CampusMap', campusMapOptions);

    if ($.browser.msie && $.browser.version.substr(0, 1) < 8) {
        $('a img').each(function () {
            var hyperlinkTitle = $(this).parent('a').attr('title');
            if (hyperlinkTitle != '') { $(this).attr('alt', hyperlinkTitle); }
        });
    }

    $('.top_link .custom_search_text.nl-NL').each(function () {
        if ($(this).val() == '') {
            $(this).css('background', 'url("http://www.google.com/coop/intl/nl/images/google_custom_search_watermark.gif") no-repeat scroll left center #FFFFFF')
        }
    });
    $('.top_link .custom_search_text.en-US').each(function () {
        if ($(this).val() == '') {
            $(this).css('background', 'url("http://www.google.com/coop/intl/en/images/google_custom_search_watermark.gif") no-repeat scroll left center #FFFFFF')
        }
    });
    $('.top_link .custom_search_text').focus(function () {
        $(this).css('background', 'none #FFFFFF')
    });
    $('.top_link .custom_search_text.nl-NL').blur(function () {
        if ($(this).val() == '') {
            $(this).css('background', 'url("http://www.google.com/coop/intl/nl/images/google_custom_search_watermark.gif") no-repeat scroll left center #FFFFFF')
        }
    });
    $('.top_link .custom_search_text.en-US').blur(function () {
        if ($(this).val() == '') {
            $(this).css('background', 'url("http://www.google.com/coop/intl/en/images/google_custom_search_watermark.gif") no-repeat scroll left center #FFFFFF')
        }
    });
});

function openNewWindow(url, width, height) {
    
    if (width > 0 && height > 0) {
        window.open(url, 'Utwente.nl new window', 'status=0,toolbar=0,location-0,menubar=0,directories=0,resizable=1,scrollbars=0,width=' + width + ',height=' + height);
    }
    else {
        window.open(url, 'Utwente.nl new window', 'status=0,toolbar=0,location-0,menubar=0,directories=0,resizable=1,scrollbars=0');
    }
}
