$(function () {
	$('a').focus(function () {
		this.blur();
	});
//	SI.Files.stylizeAll();
//	slider.init();
	$('input.text-default').each(function () {
		$(this).attr('default', $(this).val());
	}).focus(function () {
		if ($(this).val() == $(this).attr('default')) $(this).val('');
	}).blur(function () {
		if ($(this).val() == '') $(this).val($(this).attr('default'));
	});
	$('input.text,textarea.text').focus(function () {
		$(this).addClass('textfocus');
	}).blur(function () {
		$(this).removeClass('textfocus');
	});
	var popopenobj = 0,
		popopenaobj = null;
	$('a.popup').click(function () {
		var pid = $(this).attr('rel').split('|')[0],
			_os = parseInt($(this).attr('rel').split('|')[1]);
		var pobj = $('#' + pid);
		if (!pobj.length) return false;
		if (typeof popopenobj == 'object' && popopenobj.attr('id') != pid) {
			popopenobj.hide(50);
			$(popopenaobj).parent().removeClass(popopenobj.attr('id').split('-')[1] + '-open');
			popopenobj = null;
		}
		return false;
	});
	$('p.images img').click(function () {
		var newbg = $(this).attr('src').split('bg/bg')[1].split('-thumb')[0];
		$(document.body).css('backgroundImage', 'url(' + _siteRoot + 'images/bg/bg' + newbg + '.jpg)');
		$(this).parent().find('img').removeClass('on');
		$(this).addClass('on');
		return false;
	});
	});
	window.onerror = function (desc, page, line, chr) {
		alert('JavaScript error occurred! \n' + '\nError description: \t' + desc + '\nPage address:      \t' + page + '\nLine number:       \t' + line);	}

