function confirmDeleteArticles(cur) {
     var answer = confirm ("Вы хотите удалить эту статью?");
     if (answer)
     {
          window.location='/admin/cp_articles_delete/'+cur;
     } else
     {
          window.location='/admin/cp_articles/';
     }
   return false;
}

function confirmDeleteCottage(cur) {
     var answer = confirm ("Вы хотите удалить этот статью?");
     if (answer)
     {
          window.location='/admin/cp_cottage_delete/'+cur;
     } else
     {
          window.location='/admin/cp_cottage/';
     }
   return false;
}


function check_contacts_form() {
	if(!check_is_empty($('txt')) || !check_email($('email')))
		{
			if(!check_email($('email')) || !check_is_empty($('txt')))
			return false;
		}
	else
		return true;	
}

function check_client_form() {
	if(!check_is_empty($('foto')))
			return false;
		
	else
		return true;	
}


function check_email(email)
{
	var reg = new RegExp("[0-9a-z_]+@[0-9a-z_^.]+\\.[a-z]", 'i');
	if (!reg.test(email.value)) {
		
		$('email_error').style.display = 'block';
		
		return false;
	}
	else{
		
		$('email_error').style.display = 'none';
		
		return true;
	}
}


function check_is_empty(field)
{
	if (field.value=='') {
		
		
		
		$('text_error').style.display = 'block';
		return false;
	}
	else{
		
	
		$('text_error').style.display = 'none';
		return true;
	}
}



function popupimg(img, width, height) {
	var html = '<div align=left valign=top style="position: absolute; top:0.1px; left:0.1px; bottom:0.1px; right:0.1px; z-index: 4; width:100%; height:100%; cursor: pointer; cursor: hand; border: 1px #A3A4A4 solid; background-image: url(/i/icons/zoom_bg.gif); repeat;" onclick="javascript: this.style.display = \'none\';"><div style="position: absolute; top:'+((document.body.scrollHeight/2)-(height/2))+'; left:'+((document.body.scrollWidth/2)-(width/2))+'; background-color: #ffffff; z-index: 5; width:'+width+'px; height:'+height+'px; cursor: pointer; cursor: hand; border: 7px #ffffff solid;" onclick="javascript: this.style.display = \'none\';"><img src="'+img+'" border="0"></div></div>';
	var body = document.getElementsByTagName('body');
	body = body[0];
	body.innerHTML += html;
}
