// JavaScript Document
// JavaScript Document
var xmlHttp

function closediv()
{
	document.getElementById("pic").style.display='none';
	document.getElementById("fade").style.display='none';
}
function checkdownload(pictureid)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

xmlHttp.onreadystatechange=stateChangedDn;
xmlHttp.open("GET",'/picturedownload.php?pictureid='+pictureid,true);
xmlHttp.send(null);
}

function stateChangedDn() 
{ 
if (xmlHttp.readyState==4)
{ 
   if(xmlHttp.responseText != 0)
			{
			 
			  window.location='/download_picture.php?pictureid='+xmlHttp.responseText;
					}
				else	
				{
					document.getElementById('fade').style.display='block';
   document.getElementById("pic").innerHTML='<div id="fade" class="black_overlay"></div><table cellpadding="5" class="loginerrorDIV"><tr><td class="highlight"  align="center"><h2>Please Login To Download Pictures</h2></td></tr><tr><td align="center"><a href="javascript:void(0);" Onclick="closediv();" class=closebutton><div>CLOSE</div></a></td></tr></table>';
			document.getElementById("pic").style.display='block';
				}
}
}

function pressreleasedownload(documentID)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

xmlHttp.onreadystatechange=stateChangedPressDn;
xmlHttp.open("GET",'/picturedownload.php?pictureid='+documentID,true);
xmlHttp.send(null);
}

function stateChangedPressDn() 
{ 
if (xmlHttp.readyState==4)
{ 
   if(xmlHttp.responseText != 0)
			{
			 
			  window.location='/download_doc.php?event_id='+xmlHttp.responseText;
					}
				else	
				{
					document.getElementById('fade').style.display='block';
   document.getElementById("pic").innerHTML='<div id="fade" class="black_overlay"></div><table cellpadding="5" class="loginerrorDIV"><tr><td class="highlight"  align="center"><h2>Please Login To Download Pictures</h2></td></tr><tr><td align="center"><a href="javascript:void(0);" Onclick="closediv();" class=closebutton><div>CLOSE</div></a></td></tr></table>';
			document.getElementById("pic").style.display='block';
				}
}
}


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;
}