var receiveReq=getXmlHttpRequestObject();
function getXmlHttpRequestObject(){
  if(window.XMLHttpRequest){
          return new XMLHttpRequest();
  }else if(window.ActiveXObject){
          return new ActiveXObject("Microsoft.XMLHTTP");
  }
}

function checkForm(obj){	for(var i=1;i<obj.length;i++){ 		if(obj[i].value==''){ 			alert('Заполнены не все поля'); 			obj[i].focus();
 			return false;
 		}
 	}
 	return true;}

function showOnlineForm(obj){	var add_online=document.getElementById('add_online');
	add_online.style.display='inline';
  add_online.style.visibility='visible';}

function getGalleryPhotos(gallery_id,page){	  document.getElementById('gallery_photo').innerHTML='Загрузка...';
    receiveReq.open("GET",'/test/gallery.php?gallery_id='+gallery_id+'&page='+page,true);
    receiveReq.onreadystatechange = handleGetGalleryPhotos;
    receiveReq.send(null);
}

function handleGetGalleryPhotos(){
  if (receiveReq.readyState==4){
    document.getElementById('gallery_photo').innerHTML=receiveReq.responseText;
  }
}

var photos = new Array();

function gallery(slide){	document.getElementById('gphoto').innerHTML='<img id="gimg" src="/images/Centre/'+photos[0]+'&w=723" width="713" />';
	if(slide) setInterval('rgallery()',3000);}

var gi=1;
function rgallery(){
  if(gi>(photos.length-1)) gi=0;
  document.getElementById('gimg').src='/images/Centre/'+photos[gi]+'&w=723';
  gi++;}