function ShowHide(item, imgname)
{
	var obj = document.getElementById(item);
	var img = document.getElementById(imgname);
	if (img.src.indexOf("_minus") == -1 && img.src.indexOf("_plus") == -1) return;
	var style = obj.style.display == "none" ? "block" : "none";
	var newimg = style=="block" ? "minus" : "plus";
	obj.style.display = style;
	img.src = "img/node_"+newimg+".gif";
}

function ShowInsertImageWindow()
{
	openPopupWindow("insert_image.php", 610, 360);
}

function display_image(id, type)
{
	openPopupWindow("../req/display_image.php?id="+id+"&type="+type,400,300)
}

function display_item(id, type)
{
	openPopupWindow("../display_item.php?id="+id,460,380)
}

function display_movie(id)
{
	openPopupWindow("../display_movie.php?id="+id,700,560)
}

function display_image1(id, type)
{
	openPopupWindow("req/display_image.php?id="+id+"&type="+type,400,300)
}

function openPopupWindow(url,width,height){
	var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width='+(width+5)+',height='+(height+5);
	var tabWindow = window.open(url, '_blank', styleStr);
	tabWindow.location.href = url;
}

function open_preview(form_name,element_name) {
	if (window.document[form_name][element_name].value == ""){
    	return;
    }
	var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=600,height=600,left=10,top=10,screenX=10,screenY=10';
    var url = window.document[form_name][element_name].value;
//    window.alert(url);
	var tabWindow = window.open("", '_blank', styleStr);
    var out = "<html><title>Preview Image</title><body><img src='"+url+"'></img></body></html>"
    tabWindow.document.write(out);
//	tabWindow.location.href = url;
}

function displayImage(img_path, file_name)
{
	var img = window.document.getElementById("preview");
    img.src = img_path;
    var obj = window.document.getElementById("img");
    obj.innerText = file_name;
    var obj1 = window.document.getElementById("message");
    if (obj1 != undefined)
    {
    	obj1.innerText = "";
    }
}


