function CountUSD(form){
val=form.amount.value;
amount=val.replace(",", ".")
if (isNaN(amount) == true) {alert('Введенные данные не являются числом');form.amount.value=""; form.amount.focus(); form.result.value=""; return false;} else {
	if (amount<=0) {form.result.value="";form.amount.value="";form.amount.focus();} else {
		if (amount>0 && amount<=10000){ 
			if ((amount>0)&&(amount<=100)) {form.result.value="$2"};
			if ((amount>100 )&&(amount<=200)) {form.result.value="$4"}; 
			if ((amount>200 )&&(amount<=300)) {form.result.value="$6"}; 
			if ((amount>300 )&&(amount<=400)) {form.result.value="$8"}; 
			if ((amount>400 )&&(amount<=500)) {form.result.value="$10"}; 
			if ((amount>500 )&&(amount<=600)) {form.result.value="$12"}; 
			if ((amount>600 )&&(amount<=700)) {form.result.value="$14"}; 
			if ((amount>700 )&&(amount<=800)) {form.result.value="$16"}; 
			if ((amount>800 )&&(amount<=900)) {form.result.value="$18"}; 
			if ((amount>900 )&&(amount<=1000)) {form.result.value="$20"}; 
			if ((amount>1000 )&&(amount<=1250)) {form.result.value="$25"}; 
			if ((amount>1250 )&&(amount<=1500)) {form.result.value="$30"}; 
			if ((amount>1500 )&&(amount<=1750)) {form.result.value="$35"}; 
			if ((amount>1750 )&&(amount<=2000)) {form.result.value="$40"}; 
			if ((amount>2000 )&&(amount<=2500)) {form.result.value="$50"}; 
			if ((amount>2500 )&&(amount<=3000)) {form.result.value="$60"}; 
			if ((amount>3000 )&&(amount<=3500)) {form.result.value="$70"}; 
			if ((amount>3500 )&&(amount<=4000)) {form.result.value="$80"}; 
			if ((amount>4000 )&&(amount<=4500)) {form.result.value="$90"}; 
			if ((amount>4500 )&&(amount<=5000)) {form.result.value="$100"}; 
			if ((amount>5000 )&&(amount<=5500)) {form.result.value="$110"}; 
			if ((amount>5500 )&&(amount<=6000)) {form.result.value="$120"}; 
			if ((amount>6000 )&&(amount<=6500)) {form.result.value="$130"}; 
			if ((amount>6500 )&&(amount<=7000)) {form.result.value="$140"}; 
			if ((amount>7000 )&&(amount<=7500)) {form.result.value="$150"}; 
			if ((amount>7500 )&&(amount<=8000)) {form.result.value="$160"}; 
			if ((amount>8000 )&&(amount<=8500)) {form.result.value="$170"}; 
			if ((amount>8500 )&&(amount<=9000)) {form.result.value="$180"}; 
			if ((amount>9000 )&&(amount<=9500)) {form.result.value="$190"}; 
			if ((amount>9500 )&&(amount<=10000)) {form.result.value="$200"}; 

		}else{
		alert("Суммы свыше $10000 отправлять нельзя");}
		}
	}
}


function CountEUR(form){
val=form.amount.value;
amount=val.replace(",", ".")
if (isNaN(amount) == true) {alert('Введенные данные не являются числом');form.amount.value=""; form.amount.focus(); form.result.value=""; return false;} else {
	if (amount<=0) {form.result.value="";form.amount.value="";form.amount.focus();} else {
		if (amount>0 && amount<=10000){ 
			if ((amount>0)&&(amount<=100)) {form.result.value="2 евро"};
			if ((amount>100 )&&(amount<=200)) {form.result.value="4 евро"}; 
			if ((amount>200 )&&(amount<=300)) {form.result.value="6 евро"}; 
			if ((amount>300 )&&(amount<=400)) {form.result.value="8 евро"}; 
			if ((amount>400 )&&(amount<=500)) {form.result.value="10 евро"}; 
			if ((amount>500 )&&(amount<=600)) {form.result.value="12 евро"}; 
			if ((amount>600 )&&(amount<=700)) {form.result.value="14 евро"}; 
			if ((amount>700 )&&(amount<=800)) {form.result.value="16 евро"}; 
			if ((amount>800 )&&(amount<=900)) {form.result.value="18 евро"}; 
			if ((amount>900 )&&(amount<=1000)) {form.result.value="20 евро"}; 
			if ((amount>1000 )&&(amount<=1250)) {form.result.value="25 евро"}; 
			if ((amount>1250 )&&(amount<=1500)) {form.result.value="30 евро"}; 
			if ((amount>1500 )&&(amount<=1750)) {form.result.value="35 евро"}; 
			if ((amount>1750 )&&(amount<=2000)) {form.result.value="40 евро"}; 
			if ((amount>2000 )&&(amount<=2500)) {form.result.value="50 евро"}; 
			if ((amount>2500 )&&(amount<=3000)) {form.result.value="60 евро"}; 
			if ((amount>3000 )&&(amount<=3500)) {form.result.value="70 евро"}; 
			if ((amount>3500 )&&(amount<=4000)) {form.result.value="80 евро"}; 
			if ((amount>4000 )&&(amount<=4500)) {form.result.value="90 евро"}; 
			if ((amount>4500 )&&(amount<=5000)) {form.result.value="100 евро"}; 
			if ((amount>5000 )&&(amount<=5500)) {form.result.value="110 евро"}; 
			if ((amount>5500 )&&(amount<=6000)) {form.result.value="120 евро"}; 
			if ((amount>6000 )&&(amount<=6500)) {form.result.value="130 евро"}; 
			if ((amount>6500 )&&(amount<=7000)) {form.result.value="140 евро"}; 
			if ((amount>7000 )&&(amount<=7500)) {form.result.value="150 евро"}; 
			if ((amount>7500 )&&(amount<=8000)) {form.result.value="160 евро"}; 
			if ((amount>8000 )&&(amount<=8500)) {form.result.value="170 евро"}; 
			if ((amount>8500 )&&(amount<=9000)) {form.result.value="180 евро"}; 
			if ((amount>9000 )&&(amount<=9500)) {form.result.value="190 евро"}; 
			if ((amount>9500 )&&(amount<=10000)) {form.result.value="200 евро"}; 

		}else{
		alert("Суммы свыше 10000 евро отправлять нельзя");}
		}
	}
}



function CountRUR(form){
vl=form.amount.value;
amnt=vl.replace(",", ".")
if (isNaN(amnt) == true)  {alert('Введенные данные не являются числом');form.amount.value=""; form.result.value=""; return false;} else {
	if (amnt<=0) {form.result.value="";form.amount.value="";form.amount.focus();} else {
		if ((amnt>=0)&&(amnt<=280000)){ 
			if ((amnt>0)&&(amnt<=1000)) {form.result.value="20 руб."}; 
			if ((amnt>1000)&&(amnt<=3000)) {form.result.value="40 руб."}; 
			if ((amnt>3000)&&(amnt<=5000)) {form.result.value="70 руб."}; 
			if ((amnt>5000)&&(amnt<=7000)) {form.result.value="110 руб."}; 
			if ((amnt>7000)&&(amnt<=10000)) {form.result.value="150 руб."}; 
			if ((amnt>10000)&&(amnt<=12000)) {form.result.value="180 руб."}; 
			if ((amnt>12000)&&(amnt<=15000)) {form.result.value="220 руб."}; 
			if ((amnt>15000)&&(amnt<=20000)) {form.result.value="300 руб."}; 
			if ((amnt>20000)&&(amnt<=25000)) {form.result.value="350 руб."}; 
			if ((amnt>25000)&&(amnt<=30000)) {form.result.value="430 руб."}; 
			if ((amnt>30000)&&(amnt<=40000)) {form.result.value="550 руб."}; 
			if ((amnt>40000)&&(amnt<=50000)) {form.result.value="700 руб."}; 
			if ((amnt>50000)&&(amnt<=60000)) {form.result.value="850 руб."}; 
			if ((amnt>60000)&&(amnt<=80000)) {form.result.value="1100 руб."}; 
			if ((amnt>80000)&&(amnt<=100000)) {form.result.value="1450 руб."}; 
			if ((amnt>100000)&&(amnt<=120000)) {form.result.value="1750 руб."}; 
			if ((amnt>120000)&&(amnt<=140000)) {form.result.value="2100 руб."}; 
			if ((amnt>140000)&&(amnt<=160000)) {form.result.value="2400 руб."}; 
			if ((amnt>160000)&&(amnt<=180000)) {form.result.value="2700 руб."}; 
			if ((amnt>180000)&&(amnt<=200000)) {form.result.value="3000 руб."}; 
			if ((amnt>200000)&&(amnt<=220000)) {form.result.value="3300 руб."}; 
			if ((amnt>220000)&&(amnt<=240000)) {form.result.value="3600 руб."}; 
			if ((amnt>240000)&&(amnt<=260000)) {form.result.value="3900 руб."}; 
			if ((amnt>260000)&&(amnt<=280000)) {form.result.value="4200 руб."}; 
		}else{
		alert("Суммы свыше рублевого эквивалента $10000 отправлять нельзя");}
		}
	}
}


function ValSearch(form){
if (form.townname.value.length == 0) {alert("Введите название города"); return false;} else {
	for (i=0; i<form.townname.value.length; i++) {
	var chr = form.townname.value.charAt(i);
		if (chr == "'" || chr == "%") {alert("Недопустимый символ: " + chr);return false;}} 
}
}

function validateSubscribe(form){

var email=document.forms["subscribe"].email;
var place=document.forms["subscribe"].place;
var reg= new RegExp("^[0-9a-z_.]+@[0-9a-z-^\\.]+\\.[a-z]{2,6}$", 'i');
	if (!reg.test(email.value) || email.value.length < 7)  {
alert("Неверно введен e-mail!");
email.style.border ="red 2px solid";
	email.focus();
	return false;}

if (place.style.display=='block') {
var rg= new RegExp("^[а-яa-z_.]", 'i');
	if (!rg.test(place.value) || place.value.length < 2) {
alert("Введите город");
place.style.border ="red 2px solid";
	place.focus();
	return false;}
}
}


function validateVoting(f){
fl=0;
for (i=0; i<(document.voting.length-2); i++) {
if (document.voting.vote[i].checked) {fl=1};
}
if (fl == 0) {alert("Выберите один из вариантов"); return false;};
}


function validateAnketaRUS(){
var monthNums = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
var now = new Date();
document.forms["anketa"].elements["DateOf"].value = now.getDate() + "." + monthNums[now.getMonth()] + "." + now.getYear();

for (i=0; i<(document.anketa.length-4); i++) {
	if (anketa.elements[i].value.length == 0) {
	alert("Не заполнено поле №"+(i+1));
	document.forms["anketa"].elements[i].focus();
	return false;
						  }
					     }
}


function openImg(imgName,flag)
{
var resW = "/actions/openpic.asp?iname=" + escape(imgName) + "&metro=" + flag;
window.open(resW,'newwin','scrollbars=yes, status=no, toolbar=yes, location=yes, resizable=yes, width=685, height=' + (document.body.offsetHeight-10) + ', left=0, top=10');
} 

