function ShowWindow(urllink,wx,hx,id,table){
	var w=wx+84;
	var hdiv = document.getElementById("popup");
	hdiv.style.width=204+"px";
	vvvv=document.getElementById("popupContent");
	vvvv.style.height=40+"px";
	vvvv.style.width=120+"px";
	vvvv.innerHTML='<img id="preloader" src="graphics/preloader.gif" alt="Loading Image"  />&nbsp;Loading...';
	var darkdiv = document.getElementById("darkover");
	closediv = document.getElementById("close");
	var navdiv = document.getElementById("navigator");
	hdiv.style.marginLeft=-102+'px';
	darkdiv.style.display='block';
	hdiv.style.display='block';
	urllink=urllink;
	iniH=18;
	var heightt=hx;
	imgObjects = new Image();
	imgObjects.onload = function(){
		var speed=2500;
		popupResize(heightt, wx,urllink, speed);
		getCovers(id, table);
		nextpreviouse(id, table);
		findCurrentPic(id);
		showUser(id,table);
	}
	imgObjects.src = urllink;
}
function findCurrentPic(id){
	var next='';
	var prev='';
	var thumbsD=getElementsByClassName(document, "div", "nextThumbs")[0];
	var anchors=thumbsD.getElementsByTagName("a");
	var curra=getElementsByAttribute("name", id)[0];
	for (var i=0; i<anchors.length; i++){
		if (curra==anchors[i]){
			next=i+1;
			prev=i-1;
		}
	}
	if(next>(anchors.length-1)){
		next=anchors.length-1;
	}
	if(prev<0){
		prev=0;
	}
	preloadSiblings(prev,next);
}
function preloadSiblings(prev, next){
	var thumbsD=getElementsByClassName(document, "div", "nextThumbs")[0];
	var anchors=thumbsD.getElementsByTagName("a");
	var imgObjectPrev = new Image();
	imgObjectPrev.src = anchors[Number(prev)].href;
	var imgObjectNext = new Image();
	imgObjectNext.src = anchors[Number(next)].href;
}
function getStatus(id){
	xmlHttpC=GetXmlHttpObject()
	if (xmlHttpC.readyState==4 || xmlHttpC.readyState=="complete"){getCovers(id)}
}
function popupResize(toHeight, toWidth, urllink, speed){
	var hdiv = document.getElementById("popup");
	var vvvv=document.getElementById("popupContent");
	var closediv = document.getElementById("close");
	var navdiv = document.getElementById("navigator");
	
	var fromWidth=vvvv.offsetWidth;
	var fromHeight=vvvv.offsetHeight;
	
	vvvv.innerHTML='';
	closediv.style.display='block';
	navdiv.style.display="block";
	_sm1 = new Animator({transition: Animator.makeEaseOut(2), duration: speed});    
	_sm1.addSubject(new NumericalStyleSubject(vvvv, 'height', fromHeight, toHeight));
	_sm1.addSubject(new NumericalStyleSubject(vvvv, 'width', fromWidth, (toWidth+2)));
	_sm1.addSubject(new NumericalStyleSubject(hdiv, 'margin-left', -((fromWidth+84)/2), -((toWidth+84)/2)));
	_sm1.addSubject(new NumericalStyleSubject(hdiv, 'width', (fromWidth+84), (toWidth+84)));
	_sm1.seekTo(1);
	_sm1.options.onComplete=function(){injectPicture(urllink);};
}
function injectPicture(urllink){
	resultPic="<img src="+urllink+" />";
	vvvv.innerHTML=resultPic;
}
function HideWindow(){
	var hdiv = document.getElementById("popup");
	var darkdiv = document.getElementById("darkover");
	var navdiv = document.getElementById("navigator");
	hdiv.style.display='none';
	darkdiv.style.display='none';
	closediv.style.display='none';
	navdiv.style.display='none';
	document.getElementById("info").style.display='none';
	document.getElementById("popupThumbs").innerHTML="";
}

function showUser(str,table){
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="inc/getinfo1.inc.php"
	url=url+"?q="+str
	url=url+"&table="+table
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function getCovers(covid, table){ 
	xmlHttpC=GetXmlHttpObject()
	if (xmlHttpC==null){
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="inc/getcover1.inc.php"
	url=url+"?c="+covid
	url=url+"&table="+table
	url=url+"&sid="+Math.random()
	xmlHttpC.onreadystatechange=stateChangedCover 
	xmlHttpC.open("GET",url,true)
	xmlHttpC.send(null)
}
function stateChangedCover(){
	if (xmlHttpC.readyState==4 || xmlHttpC.readyState=="complete"){
		document.getElementById("popupThumbs").innerHTML=xmlHttpC.responseText;
		
	} 
}
function stateChanged(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById("info").innerHTML=xmlHttp.responseText;
		document.getElementById("info").style.display='block';
	} 
}
function getThumbs(thumbid, table){
	xmlHttpT=GetXmlHttpObject()
	if (xmlHttpT==null){
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="inc/checkit.inc.php"
	url=url+"?t="+thumbid
	url=url+"&table="+table
	url=url+"&sid="+Math.random()
	xmlHttpT.onreadystatechange=stateChangedThumb
	xmlHttpT.open("GET",url,true)
	xmlHttpT.send(null)
}
function stateChangedThumb(){
	if (xmlHttpT.readyState==4 || xmlHttpT.readyState=="complete"){
		document.getElementById("popupThumbs").innerHTML=xmlHttpT.responseText;
	} 
}
function Nextthumb(thumbsrc,newH,newW,table,id){
	vvvv=document.getElementById("popupContent");
	smallD=document.getElementById("smallthumbs");
	allimgs=smallD.getElementsByTagName("img");
	for(var imgs=0; imgs<allimgs.length; imgs++){
		allimgs[imgs].style.border="solid 3px #000000";
	}
	selimg=document.getElementById(id);
	selimg.style.border="solid 3px #37584F";
	var resultPic="<img src="+thumbsrc+" />";
	var hdiv = document.getElementById("popup");
	hdiv.style.width=newW+83+"px";
	hdiv.style.marginLeft=-(newW+83)/2+'px';
	vvvv.style.width=newW+"px";
	vvvv.style.height=newH+"px";
	vvvv.innerHTML=resultPic;
	showUser(id,table);
}
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;
}