$(document).ready(function(){
	/*$('#flash2').hide();
	$('#flash3').hide();
	$('#flash4').hide();*/
})


function popup1() {

	function getClientWidth() {
		return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
	}

	function getClientHeight() {
		return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
	}
	
	$('#flash2').hide();
	/*$('#flash3').hide();
	$('#flash4').hide();*/
	
	$('#fl').css({
		'position' : 'absolute' ,
		'top' : 0 ,
		'left' : 0 ,
		'z-index' : 1000 ,
		'height' : '1000px' ,
		'width' : getClientWidth() ,
		'background-color' : '#000000' ,
		'opacity' : '0.5'
	});
	$('#flash1 #close').css({
		'position' : 'absolute' ,
		'top' : 5 ,
		'right' : 2 ,
		'z-index' : 111000 ,
		'background-image' : "url('/templates/images/close.png')" ,
		'width' : 120 ,
		'height' : 28 ,
		'font-size' : 2 ,
		'cursor' : 'pointer'
	});
	$('#flash1 img').css({
		'max-height' : getClientHeight()-100
	});
	if($.browser.msie) {
		$('#fl').css({
			'top' : document.body.scrollTop ,
			'height' : document.body.clientHeight
		});
		$('#flash1 img#th').css({
			'height' : '358'
		});
		$(window).scroll(function() {
			$('#fl').css({
				'top' : document.body.scrollTop
			});
		});
	}
	$('#flash1').css({
		'position' : 'absolute' ,
		'top' : 50 ,
		'left' : (getClientWidth()-$('#flash1').width())/2 ,
		'z-index' : 110000 ,
		'opacity' : '1.0'
	});
	$('#fl').fadeIn('slow');
	$('#flash1').fadeIn('slow');
	
	$('#to_afisha a').click(function() {
		$('#flash2').stop(true, true);
		$('#f2').stop(true, true);
	});

	/*$('#fl').click(function() {
		$('#flash1').fadeOut('slow');
		$('#fl').fadeOut('slow');
		$('#flash2').fadeIn('slow');
	});*/
	/*$('#flash1').click(function() {
		$('#flash1').fadeOut('slow');
		$('#fl').fadeOut('slow');
		$('#flash2').fadeIn('slow');
	});*/
	$('#flash1 #close').click(function() {
		$('#flash1').fadeOut('slow');
		$('#fl').fadeOut('slow');
		$('#flash2').fadeIn('slow');
		document.location.href = '/index.php?section=18';
		return false;
	});
}
function popup2() {

	function getClientWidth() {
		return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
	}

	function getClientHeight() {
		return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
	}

	var de = document.documentElement;
	$('#flash2 img').css({
		'max-height' : getClientHeight()-100
	});
	if($.browser.msie) {
		$('#flash2 img').css({
			'height' : document.body.clientHeight-100
		});
		$(window).scroll(function() {
			$('#f2').css({
				'top' : document.body.scrollTop
			});
		});
	}
	$('#flash2').css({
		'position' : 'absolute' ,
		'top' : 50 ,
		'left' : (getClientWidth()-$('#flash2').width())/2 ,
		'z-index' : 110000 ,
		'opacity' : '1.0'
	});

	//$('#flash2').fadeIn('slow');

	$('#f2').css({
		'position' : 'absolute' ,
		'top' : 0 ,
		'left' : 0 ,
		'z-index' : 10000 ,
		'height' : getClientHeight() ,
		'width' : getClientWidth() ,
		'background-color' : '#000000' ,
		'opacity' : '0.6'
	});	
	
	$('#flash2 #close').css({
		'position' : 'absolute' ,
		'top' : 10 ,
		'right' : 10 ,
		'z-index' : 111000 ,
		'background-image' : "url('/templates/images/close.png')" ,
		'width' : 16 ,
		'height' : 16 ,
		'cursor' : 'pointer'
	});
	
	$('#f2').fadeIn('slow');
	
	$('#f2').click(function() {
		$('#flash2').fadeOut('slow');
		$('#f2').fadeOut('slow');
		$('#flash3').fadeIn('slow');
	});
	$('#flash2').click(function() {
		$('#flash2').fadeOut('slow');
		$('#f2').fadeOut('slow');
		$('#flash3').fadeIn('slow');
	});
	$('#flash2 #close').click(function() {
		$('#flash2').fadeOut('slow');
		$('#f2').fadeOut('slow');
		$('#flash3').fadeIn('slow');
		document.location.href = '/index.php?section=20';
	});
}



function popup3() {

	function getClientWidth() {
		return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
	}

	function getClientHeight() {
		return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
	}

	var de = document.documentElement;
	$('#flash3 img').css({
		'max-height' : getClientHeight()-100
	});
	if($.browser.msie) {
		$('#flash3 img').css({
			'height' : document.body.clientHeight-100
		});
		$(window).scroll(function() {
			$('#f3').css({
				'top' : document.body.scrollTop
			});
		});
	}
	$('#flash3').css({
		'position' : 'absolute' ,
		'top' : 50 ,
		'left' : (getClientWidth()-$('#flash3').width())/2 ,
		'z-index' : 110000 ,
		'opacity' : '1.0'
	});

	//$('#flash3').fadeIn('slow');

	$('#f3').css({
		'position' : 'absolute' ,
		'top' : 0 ,
		'left' : 0 ,
		'z-index' : 10000 ,
		'height' : document.height ,
		'width' : getClientWidth() ,
		'background-color' : '#000000' ,
		'opacity' : '0.6'
	});	
	
	$('#flash3 #close').css({
		'position' : 'absolute' ,
		'top' : 10 ,
		'right' : 10 ,
		'z-index' : 111000 ,
		'background-image' : "url('/templates/images/close.png')" ,
		'width' : 16 ,
		'height' : 16 ,
		'cursor' : 'pointer'
	});
	
	$('#f3').fadeIn('slow');
	
	$('#f3').click(function() {
		$('#flash3').fadeOut('slow');
		$('#f3').fadeOut('slow');
		$('#flash4').fadeIn('slow');
	});
	$('#flash3').click(function() {
		$('#flash3').fadeOut('slow');
		$('#f3').fadeOut('slow');
		$('#flash4').fadeIn('slow');
	});
	$('#flash3 #close').click(function() {
		$('#flash3').fadeOut('slow');
		$('#f3').fadeOut('slow');
		$('#flash4').fadeIn('slow');
	});
}




function popup4() {

	function getClientWidth() {
		return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
	}

	function getClientHeight() {
		return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
	}

	var de = document.documentElement;
	$('#flash4 img').css({
		'max-height' : getClientHeight()-100
	});
	if($.browser.msie) {
		$('#flash4 img').css({
			'height' : document.body.clientHeight-100
		});
		$(window).scroll(function() {
			$('#f4').css({
				'top' : document.body.scrollTop
			});
		});
	}
	$('#flash4').css({
		'position' : 'absolute' ,
		'top' : 50 ,
		'left' : (getClientWidth()-$('#flash4').width())/2 ,
		'z-index' : 110000 ,
		'opacity' : '1.0'
	});

	//$('#flash4').fadeIn('slow');

	$('#f4').css({
		'position' : 'absolute' ,
		'top' : 0 ,
		'left' : 0 ,
		'z-index' : 10000 ,
		'height' : document.height ,
		'width' : getClientWidth() ,
		'background-color' : '#000000' ,
		'opacity' : '0.6'
	});	
	
	$('#flash4 #close').css({
		'position' : 'absolute' ,
		'top' : 10 ,
		'right' : 10 ,
		'z-index' : 111000 ,
		'background-image' : "url('/templates/images/close.png')" ,
		'width' : 16 ,
		'height' : 16 ,
		'cursor' : 'pointer'
	});
	
	$('#f4').fadeIn('slow');
	
	$('#fl').click(function() {
		$('#flash4').fadeOut('slow');
		$('#f4').fadeOut('slow');
	});
	$('#flash4').click(function() {
		$('#flash4').fadeOut('slow');
		$('#f4').fadeOut('slow');
	});
	$('#flash4 #close').click(function() {
		$('#flash4').fadeOut('slow');
		$('#f4').fadeOut('slow');
	});
}
