var spotAlerts = {
	showEroAlert: function(){
		this.hideAjaxLoad();
		this.hideCommonAlert();
		var cont = new Element('div').addClassName('SAD_Ero');
		cont.innerHTML = '<h1 class="mb15">Предупреждение</h1><div id="warning">	<p>Вы  зашли в раздел нашего сервиса Фото@Mail.Ru, содержащий фотоснимки, отнесенные к категории "для взрослых". В силу специфики данной категории, эти снимки могут  шокировать вас, оскорбить ваши чувства или повредить вашему нравственному развитию.</p>	<p>Если вы все-таки намереваетесь посетить данный раздел, для продолжения просмотра вам необходимо нажать кнопку "Войти в раздел". Тем самым вы подтверждаете, что:</p>	<ul>		<li>вам уже исполнилось 18 лет;</li>		<li>вы полностью берете на себя ответственность за законность ваших действий в отношении фотоснимков, отнесенных к категории "для взрослых";</li>		<li>вы не будете иметь претензий к Администрации сервиса за качество и содержание фотоснимков, помещенных в данном разделе, а также за их соответствие вашим ожиданиям.</li>	</ul>		<p>Если вы НЕ хотите продолжать просмотр — нажмите кнопку «Отказаться от просмотра».</p></div>';
		
		var dd = new Element('div').setStyle({'textAlign': 'center'});
		var sh_s = new Element('input', {'type': 'button'})
			.setValue('Войти в раздел')
			.addClassName('SAD_Submit')
			.setStyle({'width': '135px', 'marginRight': '5px'})
			.observe('click', function(){
				var date = new Date();
				date.setTime(date.getTime()+(365*24*60*60*1000));
				var expires = "; expires="+date.toGMTString();
				document.cookie = "ero_accept=1"+expires+"; path=/; domain=." + location.host;
				this.hideCommonAlert();
				this.spotGo(null, this.hash);
			}.bind(this));
		var sh_r = new Element('input', {'type': 'button'})
			.setValue('Отмена')
			.setStyle({'width': '135px', 'marginLeft': '5px'})
			.addClassName('SAD_Reset');
		if(this.prevHash == ''){
			sh_r.observe('click', function(){
				document.location.href = location.protocol + '//' + location.host;
			}.bind(this));
		} else {
			sh_r.observe('click', function(){
				this.hideAjaxLoad();
				this.hideCommonAlert();
				document.location.hash = this.prevHash;
			}.bind(this));
		}
		
		dd.appendChild(sh_s);
		dd.appendChild(sh_r);
		cont.appendChild(dd);
		this.showCommonAlert(cont);
	},
	
	showPasswordAlert: function(){
		this.hideAjaxLoad();
		this.hideCommonAlert();
		PhotoEmail = this.AccessStatus.to;
		var cont = new Element('div').addClassName('SAD_Pass');
		var sh_p = new Element('p').update('Для доступа к следующему фото введите пароль.').addClassName('SAD_Title');
		var sh_i = new Element('input', {'type': 'text', 'id': 'SAD_PassInput'}).addClassName('SAD_Input');
		var sh_d = new Element('div').addClassName('SAD_Div');
		var sh_s = new Element('input', {'type': 'button'})
			.setValue('Ок')
			.addClassName('SAD_Submit')
			.observe('click', function(){
				ajax_call('perl_check_album_password',this.AccessStatus.album,$('SAD_PassInput').getValue(),'',function(s, r){
					if(s == 1){
						this.hideCommonAlert();
						this.spotGo(null, this.hash);
					} else {
						$('SAD_PassInput').setValue('').focus();
					}
				}.bind(this));
			}.bind(this));;
		var sh_r = new Element('input', {'type': 'button'})
			.setValue('Отмена')
			.addClassName('SAD_Reset');
		if(this.prevHash == ''){
			sh_r.observe('click', function(){
				document.location.href = location.protocol + '//' + location.host;
			}.bind(this));
		} else {
			sh_r.observe('click', function(){
				this.hideAjaxLoad();
				this.hideCommonAlert();
				document.location.hash = this.prevHash;
			}.bind(this));
		}
			
		sh_d.appendChild(sh_s);
		sh_d.appendChild(sh_r);
		cont.appendChild(sh_p);
		cont.appendChild(sh_i);
		cont.appendChild(sh_d);
		
		this.showCommonAlert(cont);
		
	},
	
	show404Alert: function(descr){
		this.hideAjaxLoad();
		this.hideCommonAlert();
		//spotOnError('SPOTERROR: 404 found.' + ((typeof descr != 'undefined') ? descr : ''), this.reportLog(), this.srnd);
		var cont = new Element('div').addClassName('SAD_404');
		var sh_p = new Element('p').update('Данная страница не найдена на нашем сервере.').addClassName('SAD_Title');
		var sh_d = new Element('div').addClassName('SAD_Div');
		var sh_r = new Element('input', {'type': 'button'})
			.setValue('Ок')
			.addClassName('SAD_Reset');
		if(this.prevHash == ''){
			sh_r.observe('click', function(){
				document.location.href = location.protocol + '//' + location.host;
			}.bind(this));
		} else {
			sh_r.observe('click', function(){
				this.hideAjaxLoad();
				this.hideCommonAlert();
				document.location.hash = this.prevHash;
			}.bind(this));
		}
		sh_d.appendChild(sh_r);
		cont.appendChild(sh_p);
		cont.appendChild(sh_d);
		this.showCommonAlert(cont);
	},
	
	show500Alert: function(descr){
		this.hideAjaxLoad();
		this.hideCommonAlert();
		if(typeof descr != 'undefined' && descr == 'timeout'){
			spotOnError('SPOTERROR: 500 found.' + ((typeof descr != 'undefined') ? descr : ''), this.reportLog('q'), this.srnd);
		} else {
			spotOnError('SPOTERROR: 500 found.' + ((typeof descr != 'undefined') ? descr : ''), this.reportLog(), this.srnd);
		}
		var cont = new Element('div').addClassName('SAD_500').setStyle({'fontSize': '75%'});
		var sh_p = new Element('p').update('Уважаемый пользователь!<br /><b>Наш проект временно не доступен</b><br />Возможно сейчас мы вводим какую-то новую функцию или пытаемся справиться с возникшей проблемой.<br />Пожалуйста, попробуйте повторить попытку через несколько минут.<br />Приносим извинения за доставленные неудобства.		<br />');
		var sh_d = new Element('div').addClassName('SAD_Div').setStyle({'textAlign': 'center'});
		var sh_r = new Element('input', {'type': 'button'})
			.setValue('Ок')
			.addClassName('SAD_Reset');
			
		if(this.prevHash == ''){
			sh_r.observe('click', function(){
				document.location.href = location.protocol + '//' + location.host;
			}.bind(this));
		} else {
			sh_r.observe('click', function(){
				this.hideAjaxLoad();
				this.hideCommonAlert();
				document.location.hash = this.prevHash;
			}.bind(this));
		}
		sh_d.appendChild(sh_r);
		cont.appendChild(sh_p);
		cont.appendChild(sh_d);
		this.showCommonAlert(cont);
	},	
	
	showCommonAlert: function(obj){
		this.hideAjaxLoad();
		this.hideCommonAlert();
		var ofc = $('spot-foto-main').cumulativeOffset();
		var d = new Element('div')
			.addClassName('SAD_Alert')
			.setStyle({'left': ofc[0] + 210 + 'px', 'top': ofc[1] + 50 + 'px'});
		d.appendChild(obj);
		document.body.appendChild(d);
		
	},

	showDeniedAlert: function(){
		if(ActiveUserMail() == "") {
			window.location.href = location.protocol + '//' + location.host + '/cgi-bin/login?page=' + escape(window.location.href);
		}
		else {
			this.hideAjaxLoad();
			this.hideCommonAlert();
			var cont = new Element('div').addClassName('SAD_Denied').setStyle({'fontSize': '75%'});
			var p1 = new Element('p').setStyle({'color': '#369', 'fontWeight': 'bold', 'margin': '6px 0'});
			var p2 = new Element('p').update('У вас нет прав для просмотра следующего фото. Очевидно оно находится в закрытом альбоме. Вы можете <a href="http://win.mail.ru/cgi-bin/sentmsg?To=' + this.AccessStatus.to + '" style="color: #369" target="_blank">написать</a> пользователю и попросить его дать вам доступ в альбом.');
			cont.appendChild(p1);
			cont.appendChild(p2);
			this.showCommonAlert(cont);
		}
	},

	
	hideCommonAlert: function(){
		$$('.SAD_Alert').each( function(s){ s.remove(); });
	}
}

Object.extend(spotCreate.prototype, spotAlerts);