function open_window(msg,w,h)
{
        win = window.open("", "win", "width="+w+",height="+h+",screenX=3,left=3,screenY=3,top=3");
        win.focus();
        win.document.open("text/html");
        win.document.write("<HTML><HEAD><TITLE>Preview image</TITLE></HEAD><BODY onLoad='window.focus();' marginwidth=0 marginheight=0 topmargin=0 leftmargin=0  bgcolor=#ffffff>"+
        msg+"</BODY></HTML>");
        win.document.close();
}

function popWin(loc,w,h) {
        window.open(loc, "ppup", "scrollbars=1,width="+w+",height="+h);
}

// Generic function for submenu toggle
function menu_actions(_target, _submenu){
	// Select main menu button
	var target = jQuery(_target);
	// Select submenu
	var submenu = jQuery(_submenu);
	// Define local timer
	var timer;
	
	// Assign button actions
	target.hover(function(e){
		clearTimeout(timer);
		submenu.show();
	}, function(e){
		timer = setTimeout(function(){
			submenu.hide();
		}, 300);
	});
	
	// Assign submenu actions
	submenu.hover(function(e){
		clearTimeout(timer);
	}, function(e){
		timer = setTimeout(function(){
			submenu.hide();
		}, 300);
	});
}