
$(document).ready(function() {
	initLogin();
	initSearch();
	//initDropShadows();
	initSkyscraper();
});

function initSearch() {

	var sTxt = $('#lblSearch').text();
	$('#inpSearch').attr('value', sTxt);

	$('#inpSearch').focus(function() {
		if ($(this).attr('value') == sTxt) {
			$(this).attr('value', '');
		}
	});
	$('#inpSearch').blur(function() {
		if ($(this).attr('value') == '') {
			$(this).attr('value', sTxt);
		}
	});
}

function initDropShadows() {

	if (jQuery.browser.msie) {

		$('a.lnkMM > span, a.lnkMMSel > span').each(function() {
			$(this).css({
				'display': 'block',
				'width': $(this).parent().width() + 'px'
			});
		});

		$('a.lnkMM > span, a.lnkMMSel > span').dropShadow({
			left: 1,
			top: 1,
			blur: 2,
			opacity: 1,
			color: '#888888',
			swap: false
		});

		$('#submenuBoxTitle > span').dropShadow({
			left: 1,
			top: 1,
			blur: 2,
			opacity: 1,
			color: '#888888',
			swap: false
		});

		$('.divTeaserBlau > h4 > span').dropShadow({
			left: 1,
			top: 1,
			blur: 2,
			opacity: 1,
			color: '#888888',
			swap: false
		});

		$(window).load(function() {

			$('a.lnkMM > span, a.lnkMMSel > span').redrawShadow();
			$('#submenuBoxTitle > span').redrawShadow();
			$('.divTeaserBlau > h4 > span').redrawShadow();
		});
	}
}

function initSkyscraper() {

	if ($('#skyad')) {

		$(window).scroll(setSkyscraper);
		$(window).resize(setSkyscraper);

		setSkyscraper();

		$('#skyad').css('display', 'block');
	}
	
	if ($('#skyad_left')) {

		$(window).scroll(setSkyscraper);
		$(window).resize(setSkyscraper);

		setSkyscraper();

		$('#skyad').css('display', 'block');
	}
}

function setSkyscraper() {

	if ($('#skyad')) {

		$('#skyad').css({
			'top': $(window).scrollTop() + 47,
			'left': $('#screen').offset().left + 870
		});
	}
	if ($('#skyad_left')) {

		$('#skyad_left').css({
			'top': $(window).scrollTop() + 47,
			'left': $('#screen').offset().left - 200
		});
	}
}

function initLogin() {

	if ($('#tsrLoginUser') && $('#lblLoginUser')) {

		var sTxtL = $('#lblLoginUser').text();
		$('#tsrLoginUser').attr('value', sTxtL);

		$('#tsrLoginUser').focus(function() {
			if ($(this).attr('value') == sTxtL) {
				$(this).attr('value', '');
			}
		});
		$('#tsrLoginUser').blur(function() {
			if ($(this).attr('value') == '') {
				$(this).attr('value', sTxtL);
			}
		});
	}

	if ($('#tsrLoginPass') && $('#lblLoginPass')) {

		var sTxtP = $('#lblLoginPass').text();
		$('#tsrLoginPass').attr('value', sTxtP);

		$('#tsrLoginPass').focus(function() {
			if ($(this).attr('value') == sTxtP) {
				$(this).attr('value', '');
			}
		});
		$('#tsrLoginPass').blur(function() {
			if ($(this).attr('value') == '') {
				$(this).attr('value', sTxtP);
			}
		});
	}

	if ($('#tsrForgotMail') && $('#lblForgotMail')) {

		var sTxtM = $('#lblForgotMail').text();
		$('#tsrForgotMail').attr('value', sTxtM);

		$('#tsrForgotMail').focus(function() {
			if ($(this).attr('value') == sTxtM) {
				$(this).attr('value', '');
			}
		});
		$('#tsrForgotMail').blur(function() {
			if ($(this).attr('value') == '') {
				$(this).attr('value', sTxtM);
			}
		});
	}
}

