﻿// Browser objektum
browser = new
(
    function()
    {
        this.msie = false;
        this.firefox = false;
        this.chrome = false;
        this.safari = false;
        this.opera = false;
        this.app = null;
        this.version = null;
        this.main_version = null;
        var ver;
        if(/\bMSIE\b/.test(navigator.userAgent))
        {
            this[this.app = 'msie'] = true;
            ver = /\bMSIE\s([\d.]+)/.exec(navigator.userAgent);
        }
        else if(/\bFirefox\b/.test(navigator.userAgent))
        {
            this[this.app = 'firefox'] = true;
            ver = /\bFirefox\/([\d.]+)/.exec(navigator.userAgent);
        }
        else if(/\bChrome\b/.test(navigator.userAgent))
        {
            this[this.app = 'chrome'] = true;
            ver = /\bChrome\/([\d.]+)/.exec(navigator.userAgent);
        }
        else if (/\bSafari\b/.test(navigator.userAgent)) {
            this[this.app = 'safari'] = true;
            ver = /\bVersion\/([\d.]+)/.exec(navigator.userAgent);
        }
        else if (/\Opera\b/.test(navigator.userAgent)) {
            this[this.app = 'opera'] = true;
            ver = /\bOpera\/([\d.]+)/.exec(navigator.userAgent);
        }
        if (ver)
        {
            this.version = ver[1];
            this.main_version = parseInt(this.version, 10);
        }
    }
)();

// CSS linkek
if(browser.msie)
{
    link_css('global_msie.css');
    if(browser.main_version)
    {
        if (browser.main_version <= 9) {
            link_css('global_msie_9.css');
        }
        if (browser.main_version <= 8)
        {
            link_css('global_msie_8.css');
        }
        if(browser.main_version <= 7)
        {
            link_css('global_msie_7.css');
        }
        if(browser.main_version <= 6)
        {
            link_css('global_msie_6.css');
        }
    }
}
else
{
    link_css('global_not_msie.css');
}
if(browser.firefox)
{
    link_css('global_firefox.css');
}
if(browser.chrome)
{
    link_css('global_chrome.css');
}
if (browser.safari) {
    link_css('global_safari.css');
}
if (browser.opera) {
    link_css('global_opera.css');
}

// Google keresés
textSiteSearch_helper =
{
    empty_val: 'Keresés...',
    empty_style: {'color':'#404040', 'font-style':''},
    normal_style: {'color':'#808080', 'font-style':'italic'}
};
$(
    function()
    {
        var input = $('#ctl00_textSiteSearch');
        if(input.val() == textSiteSearch_helper.empty_val)
        {
            input.css(textSiteSearch_helper.normal_style);
        }
        else
        {
            input.css(textSiteSearch_helper.empty_style);
        }
    }
);
function textSiteSearch_GotFocus(s, e)
{
    if(s.GetText() == textSiteSearch_helper.empty_val)
    {
        s.SetText('');
        $(s.GetInputElement()).css(textSiteSearch_helper.empty_style);
    }
}
function textSiteSearch_LostFocus(s, e)
{
    if(s.GetText() == '')
    {
        s.SetText(textSiteSearch_helper.empty_val);
        $(s.GetInputElement()).css(textSiteSearch_helper.normal_style);
    }
    else
    {
        $(s.GetInputElement()).css(textSiteSearch_helper.empty_style);
    }
}
function buttonSiteSearch_Click(s, e)
{
	$('#sitesearch_hidden [name="q"]').val($('#ctl00_textSiteSearch').val());
	$('#sitesearch_hidden').get(0).submit();
}

