 function deleteEntry(entryType, entryId) {
	if (confirm("Are you sure you want to delete this " + entryType + "?"))
		//makeRequestForDelete("/community/delete_ajax.php", "entry_type=" + entryType + "&entry_id=" + entryId, entryType);
		document.location = "/community/delete_new.php?type=" + entryType + "&id=" + entryId;
 }


 function makeRequestForDelete(urlToOpen, paramsToSend, entryType) {
	var http_request = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) http_request.overrideMimeType('text/xml');
	}
	else if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); }
		catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); }
			catch (e) {}
		}
	}

	if (!http_request) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; }
	
	http_request.onreadystatechange = function (  ) {
		if (http_request.readyState == 4) {
			var entryTypeUpper = (entryType.charAt(0).toUpperCase()) + entryType.substr(1);
			alert(entryTypeUpper + " deleted successfully!");
			//history.go(0);
			if (http_request.responseText.length > 4 && http_request.responseText.length < 15)
				document.location.href = '/community/users/' + http_request.responseText + '/';
			else
				document.location.href = '/community/';
		}
	}

	http_request.open("GET", urlToOpen + "?" + paramsToSend, true);
	http_request.send(null);
 }


 // class for getting the windows inner (currently visible) width and height
 function WindowSize() {
	var wWidth = 0, wHeight = 0;
	this.getMaxWidth = function () { return wWidth; }
	this.getMaxHeight = function () { return wHeight; }
	this.getScrollWidth = getScrollWidth;
	this.getScrollHeight = getScrollHeight;
	calcSize();


	function calcSize() {
		if (typeof( window.innerWidth )=="number") {
			//Non-IE
			wWidth = window.innerWidth;
			wHeight = window.innerHeight;
		} else if( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight) ) {
			//IE 6+ in 'standards compliant mode'
			wWidth = document.documentElement.clientWidth;
			wHeight = document.documentElement.clientHeight;
		} else if( document.body && (document.body.clientWidth || document.body.clientHeight) ) {
			//IE 4 compatible
			wWidth = document.body.clientWidth;
			wHeight = document.body.clientHeight;
		}
	}

	function getScrollWidth() {
		var w = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
		return w ? w : 0;
	}

	function getScrollHeight() {
		var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
		return h ? h : 0;
	}
 }


function urlencode(str) {
	var histogram = {}, histogram_r = {}, code = 0, tmp_arr = [];
    var ret = str.toString();

    var replacer = function(search, replace, str) {
        var tmp_arr = [];
        tmp_arr = str.split(search);
        return tmp_arr.join(replace);
    };

    // The histogram is identical to the one in urldecode.
    histogram['!']   = '%21';
    histogram['%20'] = '+';

    // Begin with encodeURIComponent, which most resembles PHP's encoding functions
    ret = encodeURIComponent(ret);

    for (search in histogram) {
        replace = histogram[search];
        ret = replacer(search, replace, ret) // Custom replace. No regexing
    }

    // Uppercase for full PHP compatibility
    return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
        return "%"+m2.toUpperCase();
    });

    return ret;
}