function openPopup(url,name,width,height) {
var popupWin = top[name];
if (popupWin != null && typeof(popupWin) == 'object' && !popupWin.closed) {
if (popupWin.document.location.href != url) {
popupWin.document.location.href = url;
}
} else {
popupWin = window.open(url, name, 'width=' + width + ',height=' + height + 'status=yes,menubar=yes,resizable=yes,scrollbars=no,left=0,top=0');
}
popupWin.focus();
}
function closePopup(url) {
if (opener) {
if (opener.closed) window.open(url, "");
self.close();
return false;
}
return true;
}
var last_id = 0;
function show_id(id){
if(last_id != 0){
document.getElementById('id'+last_id).style.display = 'none';
document.getElementById('id_'+last_id).style.display = 'block';
}
document.getElementById('id'+id).style.display = 'block';
document.getElementById('id_'+id).style.display = 'none';
last_id = id;
}
function check() {
p_name = document.reg_form.name.value.toString();
if(p_name != "") {
if(p_name.length<4 || p_name.length>120) {
alert ("Укажите ваше имя фамилию отчество !");
document.reg_form.name.focus();
}
} else {
alert("Необходимо ввести имя!");
document.reg_form.name.focus();
return false;
}
p_email = document.reg_form.email.value.toString();
if (p_email != "") {
t = p_email.indexOf("@");
if((p_email.indexOf(".") == -1) || (t == -1) || (t < 1) || (t > p_email.length - 5) || (p_email.charAt(t - 1) == '.') || (p_email.charAt(t + 1) == '.')) {
alert("Некорректно указан E-mail !");
document.reg_form.email.focus();
return false;
}
} else {
alert("Необходимо ввести E-mail !");
document.reg_form.email.focus();
return false;
}
return true;
}
function sendmail(){
/*
if ($("#nm").val()=='' || $("#ph").val()=='' || $("#kv").val()=='' || $("#mon1").val()=='' || $("#mon2").val()==''){
alert('Все поля обязательны к заполнению!');
return false;
}
*/
alert('Ваше сообщение отправлено');
$.ajax({
type: "POST",
url: "/sendmail.php",
data: "name="+$("#nm").val()+"&phone="+$("#ph").val()+"&comment="+$("#cm").val()+"&count="+$("#kv").val()+"&money_from="+$("#mon1").val()+"&money_to="+$("#mon2").val(),
success: function(msg){
//
}
});
return true;
}
function sendmail2(){
name = document.getElementById('cname').value;
phone = document.getElementById('cphone').value;
//alert('name='+name+'\n'+'phone='+phone);
if( name == '' || phone == ''){
alert('Не заполнены поля!');
return false;
} else {
alert('Отправка заявки!');
$("#csend").html('Ваша заявка принята.');
$.ajax({
type: "POST",
url: "/sendmail.php?calc=1",
data: "name="+name+"&phone="+phone,
success: function(msg){
//
if(msg == 1){
$("#csend").html('Ваша заявка принята.');
} else {
$("#csend").html('Ошибка отправления заявки!');
}
//
}
});
}
document.ff2.submit();
return true;
}