﻿var xmlhttp;

function LoadImages()
{
	showThumbnails('0');
	showNewsThumbs('0');
}

function showThumbnails(page)
{
	url='Gallery/load_images.php?pagenum='+ page;
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null)
 	{
 		alert ("Browser does not support HTTP Request");
  		return;
  	}
	xmlhttp.onreadystatechange=ThumbNailLoad;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function ThumbNailLoad()
{
	if (xmlhttp.readyState==4)
	{
		document.getElementById('divGallery').innerHTML =xmlhttp.responseText;
	}
}

function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
  		return new XMLHttpRequest();
  	}
	if (window.ActiveXObject)
	{
  		return new ActiveXObject("Microsoft.XMLHTTP");
  	}
	return null;
}

function changeImg(SRC, ID)
{
	document.getElementById('MainGalleryImg').src = SRC;
	document.getElementById('divDesc').innerHTML = document.getElementById('des'+ID).value;
	document.getElementById('divTitle').innerHTML = document.getElementById('tit'+ID).value;
}

function showPopup(page, image)
{ 
url='Gallery/main_images.php?pagenum='+ page+'&image='+image;
document.getElementById("disPopup").style.display='';
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
xmlhttp.onreadystatechange=stateChangedPop;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChangedPop()
{
	if (xmlhttp.readyState==4)
	{
		document.getElementById("popup").innerHTML =xmlhttp.responseText;
	}
}

function closePop()
{
	document.getElementById("popup").innerHTML = '';
	document.getElementById("disPopup").style.display='none';
}

function roll_over(img_name, img_src)
{
   document.getElementById(img_name).src = img_src;
}
