
$(document).ready(
	function(){

		$("a.lightbox img").click(
			function(){
				$("a.lightbox img").css('border','2px solid white');
				$("a.lightbox img").css('opacity', '0.5');
				$(this).css('border','2px solid #e4b63b');
				$(this).css('opacity', '1');
			}
		);
	}
);
//http://blog.stevenlevithan.com/archives/faster-trim-javascript
//функция удаляет пробелы по краям строки
function trim(str) {	//trim12
	var	str = str.replace(/^\s\s*/, ''),
		ws = /\s/,
		i = str.length;
	while (ws.test(str.charAt(--i)));
	return str.slice(0, i + 1);
}
//проверка корректности e-mail
function checkEmail(email){
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if(reg.test(email) == false) {
		return false;
	}
	return true;
}

//функция проверки формы
function u1_checkVotForm( form ){
	var result = true;
	if( typeof(form) === 'undefined' || form === null ){
		alert('Ошибка формы');
		result = false;
	}
	//проверяем значения полей
	if( trim(form.name.value) == '' ){
		alert("Вы не заполнили поле ФИО.");
		form.name.focus();
		result = false;
	}else if( trim(form.phone.value) == '' ){
		alert("Вы не заполнили поле Тел.");
		form.name.focus();
		result = false;
	}
	else if( trim(form.email.value) == '' ){
		alert("Вы не заполнили поле E-mail.");
		form.email.focus();
		result = false;
	}else if( checkEmail(form.email.value) === false ){
		alert("Пожалуйста, введите корректный E-mail.");
		form.email.focus();
		result = false;
	}
	return result;
}

function u1_sendVotForm(){
	var form = document.forms['votForm'];
	if( u1_checkVotForm(form) ){
		form.submit();
	}
}

function loadPNG(obj)
{
if( obj.runtimeStyle && obj.src.match( /\.png$/ ) ){
                    obj.runtimeStyle.filter
                        = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src='
                        + obj.src
                        + ', sizingMethod=scale)';
                   obj.src = '/images/union/0.gif';
                }

}
//---------------------------------------------------------------
function showBigGalleryImage(obj)
{
	document.getElementById('photoimg').setAttribute('src',obj.src.replace(".jpg","_large.jpg"));
	document.getElementById('photoimga').setAttribute('href',obj.src.replace(".jpg","_large.jpg"));
}
//-----------------------------------------------------
function showPrint()
{
 window.open("/print.php","_blank","width=540,height=450,location=no,status=no,toolbar=no,menubar=no");
}
//---------------------------------------------------------
function f()
{
 document.getElementById('pbutton').style.display = 'none';
 setInterval("pr()",2000);
}
//--------------------------------------------------------
function pr()
{
 window.print();
 window.close();
}

