function trim(str) {
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

function closeAll() {
    for (i=0;i<WinId.length;i++) {
        if (WinId[i] && !WinId[i].closed) WinId[i].close();
    }
}

function PNGfile(sfile) {
return sfile;
}

function ajaxcall(method, vars, async) {
	$.ajax({
		type: "POST",
		url: "methods/" + method +".php",
		async: async,
		data: "force=" + dummy.getTime() + '&' + vars,
		datatype: "json",
		success: function(msg) {
			eval('response_' + method + '(msg)');
		}
	});
}

function error_popup(msg) {
	alert(msg);
}

debug = (window.console && window.console.error);
$(document).ajaxError(function(){
	if (debug) {
		console.error(arguments);
	}
});
dummy = new Date();