


function getContents () {
    var map_movie3 = window.document.map_movie3;
    if (map_movie3.GetVariable("sname")) {
     var metro_str = map_movie3.GetVariable("sname");
     return metro_str;
    } else {
     alert('Вы не выбрали ни одной станции метро на карте');
     return false;
    }
}

 function disableds (rad, inp)
     {
     	var inputs = document.getElementById(inp);
     	var radios = document.getElementById(rad);
        if (radios.checked) inputs.disabled=0;
        else inputs.disabled=1;
     }
 function checkForm (form)
     {
		var text = '';
		var c = 0;
		while (form[c])
		 {
		    //alert(form[c].name +' - ' + form[c].type +' - ' + form[c].value);
		    if (form[c].type == 'text' || form[c].type == 'textarea' || form[c].type == 'select-one' || form[c].type == 'hidden' || form[c].type == 'radio' || form[c].type == 'checkbox')
		     {
                  if (form[c].id=='yes' && form[c].value=='')
                   {
                   	   alert('Заполние поле "'+ form[c].title +'"');
                   	   form[c].style.background='#F7E920';
                   	   form[c].focus();
                   	   return 0;
                   }
                  else if (form[c].id=='yes') form[c].style.background='#ffffff';
		     	  //alert(form[c].name + ' - ' + form[c].id);
		     	  if (form[c].type == 'radio')
		     	   {
		     	   	if (form[c].checked) text += form[c].title + ':\t' + form[c].value + '\n';
		     	   }
		     	  else
		     	   {
		     	  	if (!form[c].disabled) text += form[c].title + ':\t' + form[c].value + '\n';
		     	   }
		     }
			c++;
		 }
		 post_mail(text, form);
	 }
 function post_mail (text, form)
          {
                 var url = '/mail.php';
                 var param = null;
                 this.http = get_http();
                 this.working = false;

                 // Запрос
		         if (!this.working && this.http)
		          {
		            var http = this.http;
					var method = "POST";
					this.http.open(method, url, true);
					if (method == "POST")
					{
					  param = 'text=' + text + '&title=' + form.title;
					  param = encodeURI(param);
					  this.http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					  this.http.setRequestHeader("Content-length", param.length);
					  this.http.setRequestHeader("Connection", "close");
					}
		            //прикрепляем к запросу функцию-обработчик
		            //событий
		            this.http.onreadystatechange = function()
		             {
			            // 4 - данные готовы для обработки
		                if (http.readyState == 4)
		                  {
		                    value = http.responseText;
		                    this.working = false;

                                form.style.display = 'block';
			                	form.innerHTML = value;

		                  }else
		                  {
                             form.innerHTML = '<center><img src="/images/ProgressBar.gif"></center>';
		                  }
		             }
		            this.working = true;
		            this.http.send(param);
		          }
		         if(!this.http)
		          {
		              alert('Ошибка при создании XMLHTTP объекта!')
		          }

          }


          function get_http()
		  {
		    if (window.XMLHttpRequest) {
		        try {
		            return new XMLHttpRequest();
		        } catch (e){}
		    } else if (window.ActiveXObject) {
		        try {
		            return new ActiveXObject('Msxml2.XMLHTTP');
		        } catch (e){}
		        try {
		            return new ActiveXObject('Microsoft.XMLHTTP');
		        } catch (e){}
		    }
		    return null;
		  }