function show_info(url, title) {
	var event = new Object();	
	makePopup(event, 'info', 500, 400, title, '#DDD29C', '#000', url + '&popup=yes');
}

var is,xmlhttp,popupEls=[],nrSteps=15,dragObj,dragX,dragY,dragZ=1,close_n=new Image(13,13),close_h=new Image(13,13);

//document.onmouseup = function() {
	//dragObj = document.onselectstart = document.onmousemove = null
//};

close_h.src = 'skin/kunstpakhuis/img/close.gif';
close_n.src = 'skin/kunstpakhuis/img/close.gif';

function sniff(){
	var t=this,T=true,F=false,n=navigator,ua=n.userAgent.toLowerCase();
	t.ver=parseInt(n.appVersion);
	t.mac=ua.indexOf('mac')!=-1;
	t.win=!t.mac&&ua.indexOf('wind')!=-1||ua.indexOf('16bit')!=-1;
	t.safari=ua.indexOf('safari')!=-1&&t.mac;
	t.konq=ua.indexOf('konqueror')!=-1;
	t.khtml=t.safari||t.konq;
	t.opera=window.opera?T:F;
	t.opera5=ua.indexOf('opera 5')!=-1||ua.indexOf('opera/5')!=-1;
	t.opera6=ua.indexOf('opera 6')!=-1||ua.indexOf('opera/6')!=-1;
	t.opera7=t.opera&&document.createComment?T:F;
	t.ie5=t.ie55=t.ie6=F;
	t.ie=document.all&&!t.opera&&ua.indexOf('msie')!=-1?T:F;
	if(t.ie){
		t.ieBox=document.compatMode!='CSS1Compat';
		t.ie5=!document.fireEvent?T:F;
		t.ie55=document.fireEvent&&!document.createComment?T:F;
		t.ie6=document.fireEvent&&document.createComment?T:F
	}
	t.gecko=!t.khtml&&!document.all&&!t.opera&&document.getElementById?T:F;
	t.ns4=n.appName=='Netscape'&&t.ver==4
}
is=new sniff();
op=is.opera;

function gE(e) { 
	if(document.getElementById)
		return document.getElementById(e);
	if(document.all)
		return document.all[e]
}

function sE(e) {
	e.style.visibility='visible'

}

function hE(e) {
	e.style.visibility='hidden'
}

function SE(e) {
	e.style.display=''
}

function HE(e) { 
	e.style.display='none'
}

function sX(e,x) {
	op?e.style.pixelLeft=x:e.style.left=x+'px';
}

function sY(e,y) {
	op?e.style.pixelTop=y:e.style.top=y+'px'
}

function sZ(e,z) {	
	e.style.zIndex=z
}

function sW(e,w) {	
	op?e.style.pixelWidth=w:e.style.width=w+'px'
}

function sH(e,h) {
	op?e.style.pixelHeight=h:e.style.height=h+'px'
}

function wH(e,h) { 
	e.innerHTML=h
}

function getWinSize(what) {
	if (what == 'height')
		return (is.ie) ? (is.ieBox) ? document.body.clientHeight : document.documentElement.clientHeight : window.innerHeight;
	if (what == 'width')
		return (is.ie) ? (is.ieBox) ? document.body.clientWidth : document.documentElement.clientWidth : window.innerWidth;
}

function setEvent(el,evt,state,fn) {
	if(state) {
		if(el.addEventListener)
			el.addEventListener(evt,fn,false);
		if(el.attachEvent)
			el.attachEvent('on'+evt,fn);
	}
	else {
		if(el.removeEventListener)
			el.removeEventListener(evt,fn,false);
		if(el.detachEvent)
			el.detachEvent('on'+evt,fn);
	}
}



function makePopup(e, name, width, height, title, bgcolor, bordercolor, url) {
	if(popupEls[name]) killPopup(name,1);		
	
	e = (e) ? e : new Object();
/*	height += 30; */
	height += 150;
	var left = (screen.availWidth - width) / 2;
	var top = (screen.availHeight - height) / 3; 	
	var wh = getWinSize('height'), ww = getWinSize('width'), st, sl;
	
	if(is.ie) {
		sl = (is.ieBox) ? document.body.scrollLeft : document.documentElement.scrollLeft;
		st = (is.ieBox) ? document.body.scrollTop  : document.documentElement.scrollTop;
	}
	else {
		sl = window.pageXOffset;
		st = window.pageYOffset;
	}
	if(e.clientX + width > ww)
		left = ww-width-5;
	if(e.clientY + height > wh)
		top = wh-height-5;

	var popupEl = document.createElement('div');
//	popupEl.onmousedown = function(event) { dragStart(event,this) };
	popupEl.className = 'popup';
	popupEl.style.border = '1px solid ' + bordercolor;
	sZ(popupEl, 50);
	document.body.appendChild(popupEl);
	
	popupEls[name] = popupEl;
	sizePopup(name, title,url,left+sl,top+st,width,height,bgcolor,nrSteps);
}

function sizePopup(name, title,url,left,top,width,height,bgcolor,step) {
	var html, mouse, popupEl = popupEls[name];
	if(step < 0) {
		if(is.ie) {
			sW(popupEl, width+2);
			sH(popupEl, height+2);
		}
		mouse = (is.ie) ? 'onmouseover="this.src=close_h.src" onmouseout="this.src=close_n.src"' : '';
		html  = '<table class="popupCaption" style="background:'+bgcolor+'" cellpadding="0" cellspacing="3"><tr>';
		html += '<td width="99%" align="left"><h5 style="margin:0px;">'+title+'</h5></td>';
		html += '<td width="1%" align="right"><img src="skin/kunstpakhuis/img/close.gif" class="ptr" width="13" height="13" vspace="2" alt="Sluiten" onclick="killPopup(\''+name+'\',0)" '+mouse+' /></td>';
		html += '</tr></table>';
		html = '<table class="popupCaption" style="background:'+bgcolor+'" cellpadding="0" cellspacing="3"><tr>';
		html += '<td width="99%" align="right"><img src="skin/kunstpakhuis/img/close.gif" class="ptr" width="13" height="13" vspace="2" alt="Sluiten" onclick="killPopup(\''+name+'\',0)" '+mouse+' /></td>';
		html += '</tr></table>';
		wH(popupEl, html+'<iframe frameborder="0" src="'+url+'" style="width:'+width+'px;height:'+(height-20)+'px"></iframe>');
		return;
	}
	sX(popupEl, left + step*width/nrSteps/2);
	sY(popupEl, top + step*height/nrSteps/2);
	sW(popupEl, width - step*width/nrSteps);
	sH(popupEl, height - step*height/nrSteps + (is.safari?2:0));
	setTimeout("sizePopup('"+name+"', '"+title+"','"+url+"',"+left+","+top+","+width+","+height+",'"+bgcolor+"',"+(step-1)+")",0);	
}


var activePopupEl = '';
function killPopup(name,now) {
	activePopupEl = popupEls[name];
	if(activePopupEl) {
		var code = 'document.body.removeChild(activePopupEl);activePopupEl=\'\';popupEls[\''+name+'\']=null';
		if(now) {
			eval(code);
		} else {
			setTimeout(code, 10);
		}
	}
}


function dragStart(e,el) {
	if (!e)e=window.event;
	dragObj = el;
	dragObj.style.zIndex = dragZ++;
	dragX = e.clientX - dragObj.offsetLeft;
	dragY = e.clientY - dragObj.offsetTop;
	//document.onmousemove=dragMove;
	document.onselectstart=function(){return false};
}

function dragMove(e) {
	if (!e)e=window.event;
	if(dragObj) {
		sX(dragObj,e.clientX - dragX);
		sY(dragObj,e.clientY - dragY);
	}
}