function changePicture(id, number)
{
  loadXMLDoc('/ajax/room.php?id='+id+'&numpic='+number);

  return false;
}


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);
}




      var w        = 800;
      var h        = 600;
      var title    = "";
      var url_c    = "";



function processReqChange(req) 
{
  if (req.readyState == 4) {
    if (req.status == 200) {

      response = req.responseXML.documentElement;

      var i=0;
      var img    = "";
      var img    = 0;
      var numpic = 0;

      img        = response.getElementsByTagName('img').item(0).firstChild.data;//[0].firstChild.data;
      id         = response.getElementsByTagName('id').item(0).firstChild.data;//[0].firstChild.data;
      numpic     = response.getElementsByTagName('numpic').item(0).firstChild.data;//[0].firstChild.data;
      
      
      document.getElementById("img_src"+id).value= "/imgs/"+img;
      document.getElementById("img_w"+id).value= response.getElementsByTagName('w').item(0).firstChild.data;;
      document.getElementById("img_h"+id).value= response.getElementsByTagName('h').item(0).firstChild.data;;
      document.getElementById("img_title"+id).value= response.getElementsByTagName('title').item(0).firstChild.data;;

      
      document.getElementById("set"+id).src= "/imgs/s_"+img;
//      document.getElementById("set"+id).alt= title;
//      document.getElementById("ref"+id).href= "/imgs/"+img;


      while(((document.getElementById(id+"Switch["+i+"]"))))
      {

	document.getElementById(id+"Switch["+i+"]").src = "/images/change_foto_off1.gif";  
	i++;
      }

      
      document.getElementById(id+"Switch["+numpic+"]").src = "/images/change_foto_on.gif";  




      } 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><base href="http://ildorf.ru"></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 imgOpen2(id) {
 imgWindow=window.open("","imgw","width="+document.getElementById("img_w"+id).value+",height="+document.getElementById("img_h"+id).value+",status=no,toolbar=no,menubar=no,resizable=yes");
 imgWindow.document.open();
 imgWindow.document.write('<html><head><title>'+document.getElementById("img_title"+id).value+'</title><base href="http://ildorf.ru"></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="'+document.getElementById("img_src"+id).value+'" border="0" alt="Закрыть"></a></div></body></html>');
 imgWindow.document.close();
 imgWindow.focus;
}


function imgOpen3(url, title, wpic, hpic) {
 imgWindow=window.open("","imgw","width="+wpic+",height="+hpic+",status=no,toolbar=no,menubar=no,resizable=yes");
 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><br><a href="javascript:print()">Распечатать</a></div></body></html>');
 imgWindow.document.close();
 imgWindow.focus;
}


function foo()
{
  return 0;
}