var LightboxRoundedCornerStyle = '<style type="text/css">.lightbox {border-top-left-radius: 12px 12px;-moz-border-radius-topleft: 12px;-webkit-border-top-left-radius: 12px;border-top-right-radius: 12px 12px;-moz-border-radius-topright: 12px;-webkit-border-top-right-radius: 12px;border-bottom-left-radius: 12px 12px;-moz-border-radius-bottomleft: 12px;-webkit-border-bottom-left-radius: 12px;border-bottom-right-radius: 12px 12px;-moz-border-radius-bottomright: 12px;-webkit-border-bottom-right-radius: 12px;}</style>';
var DirListLightbox = new Object({
	'ContentXml':	'<div style="margin:auto;text-align:center;width:\'+(DirListLightbox.Lightbox.Width-16)+\'px;height:\'+(DirListLightbox.Lightbox.Height-48)+\'px">'+
			'<iframe id="LightboxIFrame" name="LightboxIFrame" src="\'+DirListLightbox.ReadmeUri+\'?\'+ContentUri+\'" style="border:0;margin:24px auto auto auto;width:\'+(DirListLightbox.Lightbox.Width-48)+\'px;height:\'+(DirListLightbox.Lightbox.Height-80)+\'px">'+
			'</iframe><br />'+
			'<input type="button" value="Done" onclick="lightboxNotification(false,0,0)" /><br />',
	'ReadmeUri':'/dirlist/readme.php',
	'Lightbox':{
		'Height':520,
		'Width':800
	},
	'Create': function(ContentUri){
		var ContentXml = DirListLightbox.ContentXml;
		eval("document.getElementById('lightbox').innerHTML = '" + LightboxRoundedCornerStyle + ContentXml + "';\n");
		//alert(document.getElementById('lightbox').innerHTML);
		/* Render Lightbox */
		lightboxNotification(true, DirListLightbox.Lightbox.Width, DirListLightbox.Lightbox.Height);
		/* Exit the function */
		return false;
	}
});

function ajax(){
	if(window.XMLHttpRequest){return new XMLHttpRequest()}
	if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP")}
	return undefined;
}

function lightboxNotification(flag,w,h){
	if(flag == true){
		document.getElementsByTagName('html')[0].style.overflow='hidden';
		document.getElementById('lightbox').style.height=h+'px';
		document.getElementById('lightbox').style.width=w+'px';
		document.getElementById('lightboxOver').style.visibility='visible';
		return false;
	}
	document.getElementsByTagName('html')[0].style.overflow='auto';
	document.getElementById('lightboxOver').style.visibility='hidden';
	document.getElementById('lightbox').style.height='1px';
	document.getElementById('lightbox').style.width='1px';
	document.getElementById('lightbox').innerHTML='&nbsp;';
	return false;
}

function getDocHeight(){
	var D = document;
	return Math.max(
		Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
		Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
		Math.max(D.body.clientHeight, D.documentElement.clientHeight)
	);
}

function randomHexidecimal(n){
	var text = "";
	var chars = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
	for(var c = 0; c < n; c++){
		text += chars[Math.floor(Math.random()*16)];
	}
	return(text);
}


