function init_pops() 
{
	/* hide using opacity on page load */
	if ( $('popup-comments-container') )
	{
		$('popup-comments-container').setStyles({
			opacity:0,
			display:'block'
		});
	
		/* hiders */
		if ( $('popup-comments-close') )
		{
			$('popup-comments-close').addEvent('click',function(e) { $('popup-comments-container').fade('out'); });
			window.addEvent('keypress',function(e) { if(e.key == 'esc') { $('popup-comments-container').fade('out'); } });
		}
		
		/* click to show */
		if ( $('popup-comments-trigger') )
		{
			$('popup-comments-trigger').addEvent('click',function() {
				$('popup-comments-container').fade('in');
			});
		}
		/* click to send comment */
		$('popup-comments-send').addEvent('click',function() {
			var data = GLOBALS['sitevars']['detail'];
			
			for(var i=0;i<document.form_comment.elements.length;i++)
				if ( document.form_comment.elements[i].type == 'radio' )
					if ( document.form_comment.elements[i].checked )
						data[document.form_comment.elements[i].name] = document.form_comment.elements[i].value;
			if ( data['slot'] > 0 )
			{
				var req = new Request({
					method: 'get',
					url: '/media/add_comment.php5',
					data: data,
					onComplete: function(response) { $('popup-comments-container').fade('out');$('popup-comments-trigger-c').innerHTML = GLOBALS['dict']['thanks_comment'];}
				}).send();
			}
		});
	
	
		/* hide using opacity on page load */
		$('popup-commented-container').setStyles({opacity:0,display:'block'});
		
		/* hiders */
		$('popup-commented-close').addEvent('click',function(e) { $('popup-commented-container').fade('out'); });
		window.addEvent('keypress',function(e) { if(e.key == 'esc') { $('popup-commented-container').fade('out'); } });
		/* click to show */
		$('popup-commented-trigger').addEvent('click',function() {
			$('popup-commented-container').fade('in');
		});
		$('popup-commented-trigger-a').addEvent('click',function() {
			$('popup-commented-container').fade('in');
		});
	}
	
	$$('.number').each(function(element,i){
		element['detail'] = GLOBALS['sitevars']['detail'];
		element.addEvent('click', function(){
			element['detail']['vote'] = element.innerHTML;
			var req = new Request({
				method: 'get',
				url: '/media/add_vote.php5',
				data: element['detail'],
				onComplete: function(response) {
					element.className="number-done-sel";
					$$('.number').each(function(element2,i2){if(element2.className!="number-done-sel"){element2.fade('out');}});
				}
			}).send();
		});
	});
	
	if ( $('popup-sendfriend-container') )
	{
		$('popup-sendfriend-container').setStyles({
			opacity:0,
			display:'block'
		});
	
		/* hiders */
		if ( $('popup-sendfriend-close') )
		{
			$('popup-sendfriend-close').addEvent('click',function(e) { $('popup-sendfriend-container').fade('out'); });
			window.addEvent('keypress',function(e) { if(e.key == 'esc') { $('popup-sendfriend-container').fade('out'); } });
		}
		
		/* click to show */
		if ( $('popup-sendfriend-trigger') )
		{
			$('popup-sendfriend-trigger').addEvent('click',function() {
				$('popup-sendfriend-container').fade('in');
			});
		}
		
		/* click to send friend */
		$('popup-sendfriend-send').addEvent('click',function() {
			var form = document.form_sendfriend;
			if ( send_friend_check_form(form) )
			{
				var data = new Object();
				data['aj'] = 1;
				for(var i=0;i<form.elements.length;i++)
					data[form.elements[i].name] = form.elements[i].value;
				if ( data['friend_email'] )
				{
					var req = new Request({
						method: 'get',
						url: '/users/send_friend.php5',
						data: data,
						onComplete: function(response)
						{
							if ( response > 0 )
							{
								alert(GLOBALS['dict']['performed_operation']);
								document.form_sendfriend.reset();
								document.getElementById('send_friend_capimg').src='/captcha.php5?op=send_friend&nocache='+Math.floor(Math.random()*1000000); 
							}
							else if ( response == -2 )
							{
								alert(GLOBALS['dict']['invalid_security_code']);
							}
							else if ( response == -3 )
							{
								alert(GLOBALS['dict']['wrong_mail']);
							}
							else
							{
								alert(GLOBALS['dict']['not_performed_operation']);
							}
						}
					}).send();
				}
			}
		});	
	}
}

