function deleteMedia(path,album) {
    document.location.href = "page/admin/internal/deleteMedia.php?path="+path+"&album="+album;
}

function deleteDownload(file) {
    document.location.href = "page/admin/internal/deleteDownload.php?file="+file;
}

function displayImage(src) {
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth-16;
			winH = window.innerHeight-16;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth-20;
			winH = document.body.offsetHeight-20;
		}
	}

	document.getElementById('video').style.display = "none";
	document.images["img"].style.display = "block";
	document.images["img"].src = "img/loader.gif";
	document.images["img"].height = 32;
	document.images["img"].width = 32;
	document.getElementById('displayingImage').style.top = winH/2 - 32/2-20;
	document.getElementById('displayingImage').style.left = winW/2 - 32/2;
	document.getElementById('transbg').style.display = 'block';
	document.getElementById('displayingImage').style.display = 'block';
	var img = new Image;
	img.onload = function(){
		document.images["img"].src = img.src;
		document.images["img"].height = img.height;
		document.images["img"].width = img.width;
		var ratio = img.height/img.width;
		if (document.images["img"].height > winH-60) {
			document.images["img"].width = document.images["img"].width*(winH-60)/document.images["img"].height;
			document.images["img"].height = winH-60;
		}
		document.getElementById('displayingImage').style.top = winH/2 - document.images["img"].height/2-20;
		document.getElementById('displayingImage').style.left = winW/2 - document.images["img"].width/2;
	}
	img.src = src; 
}

function displayVideo(src) {
	/*document.getElementById('transbg').style.display = 'block';
	document.getElementById('displayingImage').style.display = 'block';

	document.getElementById('img').style.display = 'none';
	var html = '<object> <embed type="video/x-ms-asf-plugin" src="'+src+'" autostart="true" showcontrols="true" width="320" height="310"></embed></object>';
	//var html = '<div id="container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div><script type="text/javascript">';
    html += 'var s1 = new SWFObject("../core/video_viewer/player.swf","ply","400","300","9","#FFFFFF");';
    html += 's1.addParam("allowfullscreen","true");';
    html += 's1.addParam("allowscriptaccess","always");';
    html += 's1.addParam("flashvars","file='+src+'&image=../core/video_viewer/preview.jpg");';
    html += 's1.write("container");';
    html += '</script>';
    document.getElementById('video').innerHTML = html;
	document.getElementById('video').style.display = "block";
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth-16;
			winH = window.innerHeight-16;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth-20;
			winH = document.body.offsetHeight-20;
		}
	}
	document.getElementById('displayingImage').style.top = winH/2 - 310/2-20;
	document.getElementById('displayingImage').style.left = winW/2 - 320/2;
    */window.open("core/video_viewer/video.php?video="+src, "video", "menubar=no, status=no, scrollbars=no, menubar=no, width=500, height=400");
}

function display(src, type) {
	if (type=='P') {
		displayImage(src);
	} else if (type=='V') {
		displayVideo(src);
	}
}


function hideImage() {
	document.getElementById('transbg').style.display = 'none';
	document.getElementById('displayingImage').style.display = 'none';
	document.images["img"].src = "img/loader.gif";
}

