// JavaScript Document

function clicker(){
	
	//only do this if image not locked
	//if ((lockimage != 1) && (lockfins != 1)){
	
	var thediv=document.getElementById('displaybox');
	if(thediv.style.display == "none"){
		thediv.style.display = "inline";
		//document.getElementById('iewrap').display = "inline";
		//thediv.innerHTML = "<table width='100%' height='100%'><tr><td align='center' valign='middle' width='100%' height='100%'>test<br><br><a href='#' onclick='return clicker();'>CLOSE WINDOW</a></td></tr></table>";
	}else{
		thediv.style.display = "none";
		//document.getElementById('iewrap').display = "none";
		//thediv.innerHTML = '';
	}
	return false;
	
	//}
}

function openClose(popid,status){
	document.getElementById(popid).style.display = status;
}


//clears the selected text field
function clearField(fields){
	document.getElementById(fields).value = "";
}

var xmlHttp;
//gallery show pic
var imagex;
var nextpic;
var prevpic;
var aquire;
var galpostat = "block";
var picblurb;
function showPic(pic,numberx,dir){ 


if (dir == 1){
	aquire = nextpic;
} else if (dir == 2){
	aquire = prevpic;
} else {
	aquire = numberx;
}

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="includes/gallery_ajax.php"
url=url+"?imid="+aquire
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=getPic
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function getPic() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	eval(xmlHttp.responseText);
	document.getElementById("gallerypopwrap").style.display = galpostat;
	document.getElementById("poppic").src = "pics/gallery/"+imagex;
	document.getElementById("caption").innerHTML = picblurb;
	
	if (galpostat == "none"){
		clicker();
	}
}

}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}


