// JavaScript Document

var XMLHttpGallerySend=null;

function requestGallery(gallery){
	//alert(workflow+" "+state);
	XMLHttpGallerySend.open("GET", "galleryCatList.php?id="+gallery+"&RandomId="+Math.floor(Math.random()*320000), true);
	XMLHttpGallerySend.onreadystatechange=ListRecived;
	XMLHttpGallerySend.send(null);
	var galleryObj = document.getElementById("galleryWrap");
	galleryObj.innerHTML = "";
}


function ListRecived(){
	if (XMLHttpGallerySend.readyState==4 || XMLHttpGallerySend.readyState=="complete"){ 
	  if (XMLHttpGallerySend.status==200){
	  		var galleryObj = document.getElementById("galleryWrap");
			galleryObj.innerHTML = XMLHttpGallerySend.responseText;
			//alert("stiglo!!\n"+XMLHttpGallerySend.responseText);
			//objChatBoxTekst.innerHTML = XMLHttpRecive.responseText
	  }
	  else {
	  	alert(XMLHttpGallerySend.status+" - "+XMLHttpGallerySend.statusText)
	  }
	}
}

	
function galleryConnect(){
	try	{
		XMLHttpGallerySend= new ActiveXObject("Msxml2.XMLHTTP");
		}
	catch(e) {
		}
	if (XMLHttpGallerySend==null)	{
		XMLHttpGallerySend=new XMLHttpRequest();
	}
	if (XMLHttpGallerySend==null)	{
		alert ("Browser does not support HTTP Request");
	} 
}


function loadImage(value){
	var flashMovie=getFlashMovieObject("flashGalleryObj");
	flashMovie.SetVariable("loadGallery",value);
}

function getFlashMovieObject(movieName){
  if (window.document[movieName]) {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1){
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else {
    return document.getElementById(movieName);
  } 	
}
