$(function () {

	flashembed('slogan', { src: const_service_url+'/static/media/slogan.swf', wmode: 'transparent' })

	var imagesArray = {
		// klasa : id_zdjecia, id_efektu
		'link-1': [0, 0],
		'link-2': [1, 1],
		'link-3': [1, 0],
		'link-4': [1, 1],
		'link-5': [1, 0],
		'link-6': [1, 1],
		'link-7': [1, 0],
		'link-8': [1, 1],
		'link-9': [1, 0],
		'link-10': [2, 0],
		'link-11': [3, 1],
		'link-12': [4, 0],
		'link-13': [4, 0]
	}

	flashembed('banner', { src: const_service_url+'/static/media/banner.swf', wmode: 'transparent' }, {
		xmlLocation: const_service_url + '/banner.xml',
		serviceURL: const_service_url,
		photoId: imagesArray[$('body').attr('class')][0],
		effectId: imagesArray[$('body').attr('class')][1]
	})
		
	$('#cp').val(6).parent().parent().hide()
	
	$('div.partner').hover(
		function () {
			$(this).find('dt, dd:not([class*="vcard"])')
				.stop()
				.animate({'paddingLeft': '+=5'}, 'fast')
			$(this).find('dd.vcard').addClass('hover')
		},
		function () {
			$(this).find('dt, dd:not([class*="vcard"])')
				.stop()
				.animate({'paddingLeft': '50'}, 'fast')
			$(this).find('dd.vcard').removeClass('hover')
		}
	)
	
	$('body.link-2 #content ul.rounded li').hover(
		function () {
			$(this).find('a')
				.stop()
				.animate({'paddingLeft': '+=5'}, 'fast')
		},
		function () {
			$(this).find('a')
				.stop()
				.animate({'paddingLeft': '50'}, 'fast')
		}
	)
	
	$('ul li.' + $('body').attr('class')).addClass('active')
		
	var offer_active = $('#left ul.offer li.active')
	if (offer_active.length == 1) {
		$('ul.pages li.link-2').addClass('active')
	}
	
	lift()
})

function lift() {
	$('#page').css({position: 'absolute', width: '560px', top: '0px'}).wrap('<div id="lift"></div>')
	//435
	$('#lift').data('height', $('#page').height()).css({height: $(window).height()-460}).prepend('<a href="#" id="lift-up">góra</a><a href="#" id="lift-down">dół</a>')
	//$('#lift').animate({height: $('#page').height()}, 1000)

	$('#lift-up').hover(function () {$(this).addClass('hover')}, function () {$(this).removeClass('hover')})
	$('#lift-up').mousedown(function () {$(this).addClass('down')})
	$('#lift-up').mouseup(function () {$(this).removeClass('down')})

	$('#lift-up').click(function () {
		var top = parseInt($('#page').css('top').replace("px", ""))
		var height = parseInt($('#lift').height())
		if (top !== 0)
		{
			var go = top+height
			if ((top+height) >= 0) { go = 0 }
			
			$('#page').stop().animate({top: go+'px'}, 1000, "easeOutSine")
		}
		return false
	})

	$('#lift-down').hover(function () {$(this).addClass('hover')}, function () {$(this).removeClass('hover')})
	$('#lift-down').mousedown(function () {$(this).addClass('down')})
	$('#lift-down').mouseup(function () {$(this).removeClass('down')})

	$('#lift-down').click(function () {
		//var bottom = parseInt($('#page').css('bottom').replace("px", ""))
		var top = parseInt($('#page').css('top').replace("px", ""))
		var lift_height = parseInt($('#lift').height())
		var page_height = parseInt($('#page').height())

		if ((-top-page_height) < -lift_height)
		{
			$('#page').stop().animate({top: '-='+lift_height+'px'}, 1000, "easeOutSine")
		}
		return false
	})
	return false
}

