      var w        = 800;
      var h        = 600;
      var title    = "";
      var url_c    = "";

function loadXMLDoc(url) {

	var req = false;

        if (window.XMLHttpRequest) { 
            req = new XMLHttpRequest();
            if (req.overrideMimeType) {
                req.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { 
            try {
                req = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    req = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!req) {
            alert('Can`t create XMLHTTP request.');
            return false;
        }
        req.onreadystatechange = function() { processReqChange(req); };
        req.open('GET', url, true);
        req.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
        req.send(null);
}

function processReqChange(req) 
{
  if (req.readyState == 4) {
    if (req.status == 200) {

      response = req.responseXML.documentElement;

      var name        = "";
      var question    = "";
      var phone       = 0;
      var email       = "";
      var result      = "";


      name      = response.getElementsByTagName('name').item(0).firstChild.data;//[0].firstChild.data;
      question  = response.getElementsByTagName('question').item(0).firstChild.data;//[0].firstChild.data;
      phone     = response.getElementsByTagName('phone').item(0).firstChild.data;//[0].firstChild.data;
      email     = response.getElementsByTagName('email').item(0).firstChild.data;//[0].firstChild.data;
      result    = response.getElementsByTagName('result').item(0).firstChild.data;//[0].firstChild.data;
      
      
      if(phone != "ok") 
      {
        alert(phone);
        document.getElementById("inputPhone").focus();
      }else
      if(name != "ok") 
      {
        alert(name);
        document.getElementById("inputName").focus();
      }else
      if(question != "ok") 
      {
        alert(question);
        document.getElementById("inputQuestion").focus();
      }else
      if(email != "ok") 
      {
        alert(email);
        document.getElementById("inputEmail").focus();
      }

//      alert(result);
      
      if(result != "no") 
      {
      	//alert(result+"!");
        document.getElementById("result").innerHTML = result;
        //document.getElementById("ask").setAttribute("class","hidden");  //don`t work with IE ;(
        document.getElementById("ask").className = "hidden";
        document.getElementById("ast").innerHTML = "";
         
      }
      



      } else {
            alert("There was a problem retrieving the XML data:\n" + req.statusText);
    }
  }
}


function imgOpen(url, title, wpic, hpic) {
w=screen.width-50;h=screen.height-70;
if (wpic > w) {left_w=20;wscroll=1;} else {left_w=((w-wpic)/2);w=wpic;wscroll=0;};
if (hpic > h) {top_w=5;wscroll=1;} else {top_w=((h-hpic)/2);h=hpic;if (!wscroll) wscroll=0;};
imgWindow=window.open("","imgw","width="+w+",height="+h+",status=no,toolbar=no,menubar=no,resizable=yes,scrollbars="+wscroll+",left="+left_w+",top="+top_w);
imgWindow.document.open();
imgWindow.document.write('<html><head><title>'+title+'</title></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#000000" vlink="#000000" alink="#000000" bgcolor="#ffffff"><div align=center><a href="javascript:window.close();"><img src="'+url+'" border="0" alt="Закрыть"></a></div></body></html>');
imgWindow.document.close();
imgWindow.focus;
}


String.prototype.trim = function () {
  return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
}

function foo()
{
  return 0;
}
