var IE = /*@cc_on!@*/false;
var IE5 = (IE && (navigator['appVersion'].indexOf('MSIE 5') > 0)) ? true : false;
var IE6 = (IE && (navigator['appVersion'].indexOf('MSIE 6') > 0)) ? true : false;
var IE7 = (IE && (navigator['appVersion'].indexOf('MSIE 7') > 0)) ? true : false;
var IE8 = (IE && (navigator['appVersion'].indexOf('MSIE 8') > 0)) ? true : false;

var site = function() {

	$(document).ready(function() {
		site.initialize();
	});

	$(window).load(function() {
	});

	return {

		// IE fixes
		IEfix: function() {
			if (IE) {
				setTimeout(function() {
				}, 10);
			}
			return false;
		},
		IE6fix: function() {
			if (IE6) {
			}
			return false;
		},
		// /IE fixes

		// initialize
		initialize: function() {

			var tmp = null;

			// common settings
			$('a._blank').click(function() {
				window.open(this.href);
				this.blur();
				return false;
			});
			// /common settings

			// setashomepage
			$('div.setashomepage a').click(function() {
				if (IE) {
					this.style.behavior = 'url(#default#homepage)';
					this.setHomePage(this.href);
				} else {
					alert('A kezdőlap beállításához az URL bar-ban lévő ikont a házikó ikonra kell húzni!');
				}
				return false;
			});
			// /setashomepage
			
			// addtofavorites
			$('div.addtofavorites a').click(function() {
				if (window.sidebar) {
					window.sidebar.addPanel(document.title, this.href, "");
				} else if(window.external) {
					window.external.AddFavorite(this.href, document.title);
				}
				return false;
			});
			// /addtofavorites
			
			// head - search
			tmp = $('div.head div.search input[type=text]').eq(0);
			if (tmp.length > 0) {
				if (tmp.get(0).value == '') {
					tmp.get(0).value = tmp.get(0).title;
				}
				tmp.focus(function() {
					if (this.value == this.title) {
						this.value = '';
					}
				});
				tmp.blur(function() {
					if (this.value == '') {
						this.value = this.title;
					}
				});
			}
			// /head - search

			// tabsheet handling
			$('.tabsheetHandler .tab').click(function() {
				this.blur();
				var ts0 = $(this).parents('.tabsheetHandler').eq(0).attr('class').split('ts')[1];
				ts0 = (ts0) ? ts0.substr(0,1) : '';
				var ts1 = $(this).attr('class').split('tab t')[1];
				ts1 = (ts1) ? ts1.substr(0,1) : '';
				$(this).parents('.tabsheetHandler').eq(0).removeClass('ts'+ts0);
				$(this).parents('.tabsheetHandler').eq(0).addClass('ts'+ts1);
				site.IEfix();
				return false;
			});
			// /tabsheet handling

			site.IEfix();
			site.IE6fix();

		} // /initialize

	} // /return

}(); // /site


