var xmlHttp

var boxID

function selectCatagory(str){ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
	alert ("Browser does not support HTTP Request")
	return
}
var url="/functions/pictsdisp.php"
url=url+"?function=catagory&catagory="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}






function myThumbSelect(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

var url="/functions/pictsdisp.php"
url=url+"?function=thumbSelect&thumb="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}





function pictsPerPage(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

var url="/functions/pictsdisp.php"
url=url+"?function=pictsPerPage"
url=url+"&ppp="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}





function fnGoToPage(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/functions/pictsdisp.php"
url=url+"?function=goToPage"
url=url+"&goToPage="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}





function fnPageNavigation(currentPage,totalPages)
//function pageNavigation(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
//var frmCatagory = document.getElementById('catagory').value
//alert ("hello")
//alert ("hello" + frmCatagory)
var url="/functions/pictsPageNavigation.php"
url=url+"?jsCurrentPage="+currentPage
url=url+"&jsTotalPages="+totalPages
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=myStateChanged
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}




function fnShowCaptionEditBox(pictID)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/functions/pictscaption.php"
url=url+"?capFunction=loadTextBox"
url=url+"&pictID="+pictID
url=url+"&sid="+Math.random()
boxID="caption"+pictID
//alert ("entering javascript");
xmlHttp.onreadystatechange=pictCaptionStateChanged
//xmlHttp.onreadystatechange=pictCaptionStateChanged(boxid)
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}




function fnDirectLink()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var frmCat = document.getElementById('frmCat').value;
var frmPageNum = document.getElementById('frmPageNum').value;
var frmPPP = document.getElementById('frmPPP').value;

var url="/functions/pictsdisp.php"
url=url+"?function=directPage"
url=url+"&catagory="+frmCat
url=url+"&page="+frmPageNum
url=url+"&ppp="+frmPPP
url=url+"&sid="+Math.random()
//alert(url);
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}




function fnWriteNewCaption()
//function fnWriteNewCaption(pictID,newCaption)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var pictID = document.getElementById('frmID').value;
var newCaption = document.getElementById('frmCaption').value;
//alert (pictID+"    "+newCaption);
var url="/functions/pictscaption.php"
url=url+"?capFunction=writeNewCaption"
url=url+"&pictID="+pictID
url=url+"&newCaption="+newCaption
//url=url+"&newCaption="+newCaption
url=url+"&sid="+Math.random()
boxID="caption"+pictID
xmlHttp.onreadystatechange=pictCaptionStateChanged
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}




function fnSelectMgmt(str){ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
	alert ("Browser does not support HTTP Request")
	return
}
//alert ("showManagement");
var url="/functions/pictsmgmt.php"
url=url+"?mgmtFunction="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("POST",url,true)
xmlHttp.send(null)
}





function fnResetMgmt(){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
	alert ("Browser does not support HTTP Request")
	return
}
document.getElementById('selectMgmt').value='blank';
//	document.forms['formMgmt'].elements['selectMgmt'].value='blank';
}



















function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
 } 
}

function myStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("pageNavigation").innerHTML=xmlHttp.responseText 
 } 
}



function pictCaptionStateChanged() 
{ 
//alert (boxID);
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById(boxID).innerHTML=xmlHttp.responseText 
 } 
}

function pictStateManagement() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("pictManagement").innerHTML=xmlHttp.responseText 
 } 
}




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



var done=false; 
var dispObject; 
//var StatusBarPrefixText='Please Wait. Searching'; 
var StatusBarPrefixText='<br><br><br><div class="statusBar">working: <img src="/images/js/burn_animated2.gif" width="16" height="17"></div>'; 
function timeout(counter){ 
	if(!done) { dispObject.innerHTML = dispObject.innerHTML+ '.';
		if(counter==7) { dispObject.innerHTML = StatusBarPrefixText; counter=-1; } 
		counter++; window.setTimeout('timeout('+counter+')', counter*100); 
	} 
} 
function InitStatusBar() { 
	done=false; dispObject=document.getElementById("txtHint"); 
//	done=false; dispObject=document.getElementById("StatusBar"); 
	dispObject.innerHTML = StatusBarPrefixText; 
}
