


function popup(URL, name, width, height){
	var day = new Date();
	var id = day.getTime();
	var left = (screen.width/2)-(width/2);
	var top = (screen.height/2)-(height/2)-50;
	eval("page" + id + " = window.open(URL, name, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top);");
}


function popupws(URL, name, width, height){
	var day = new Date();
	var id = day.getTime();
	var left = (screen.width/2)-(width/2);
	var top = (screen.height/2)-(height/2)-50;
	eval("page" + id + " = window.open(URL, name, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top);");
}


function clickIE4(){
	if (event.button==2){
		return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			return false;
		}
	}
}

if (document.layers){
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS4;
}else if (document.all&&!document.getElementById){
	document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function('return false');

String.prototype.htmlEntities = function () { 
	return this
		.replace(/&/g,'&amp;')
		.replace(/</g,'&lt;')
		.replace(/>/g,'&gt;')
		.replace(/á/g,'&aacute;')
		.replace(/é/g,'&eacute;')
		.replace(/í/g,'&iacute;')
		.replace(/ó/g,'&oacute;')
		.replace(/ú/g,'&uacute;')
		.replace(/Á/g,'&Aacute;')
		.replace(/É/g,'&Eacute;')
		.replace(/Í/g,'&Iacute;')
		.replace(/Ó/g,'&Oacute;')
		.replace(/Ú/g,'&Uacute;')
		.replace(/ñ/g,'&ntilde;')
		.replace(/Ñ/g,'&Ntilde;')
		.replace(/à/g,'&aacute;')
		.replace(/è/g,'&eacute;')
		.replace(/ì/g,'&iacute;')
		.replace(/ò/g,'&oacute;')
		.replace(/ù/g,'&uacute;')
		.replace(/À/g,'&Aacute;')
		.replace(/È/g,'&Eacute;')
		.replace(/Ì/g,'&Iacute;')
		.replace(/Ò/g,'&Oacute;')
		.replace(/Ù/g,'&Uacute;')
		.replace(/°/g,'&deg;')
		.replace(/¡/g,'&iexcl;')
		.replace(/¿/g,'&iquest;')
		.replace(/´/g,'&acute')
		.replace(/¨/g,'&uml;')
		.replace(/Â/g,'&Acirc;')
		.replace(/Ã/g,'&Atilde;')
		.replace(/Ä/g,'&Auml;')
		.replace(/Ê/g,'&Ecirc;')
		.replace(/Ë/g,'&Euml;')
		.replace(/Î/g,'&Icirc;')
		.replace(/Ï/g,'&Iuml;')
		.replace(/Ô/g,'&Ocirc;')
		.replace(/Õ/g,'&Otilde;')
		.replace(/Ö/g,'&Ouml;')
		.replace(/Û/g,'&Ucirc;')
		.replace(/Ü/g,'&Uuml;')
		.replace(/â/g,'&acirc;')
		.replace(/ã/g,'&atilde;')
		.replace(/ä/g,'&auml;')
		.replace(/ê/g,'&ecirc;')
		.replace(/ë/g,'&euml;')
		.replace(/î/g,'&icirc;')
		.replace(/ï/g,'&iuml;')
		.replace(/ô/g,'&ocirc;')
		.replace(/õ/g,'&otilde;')
		.replace(/ö/g,'&ouml;')
		.replace(/û/g,'&ucirc;')
		.replace(/ü/g,'&uuml;');
}; 

var utf8 = {
 
	// public method for url encoding
	encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// public method for url decoding
	decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
 
}