function Trim(StrToTrim) {
    if (typeof StrToTrim != "string") return StrToTrim;
    var StrBlank = StrToTrim.substring(0, 1);
    while (StrBlank == " ") {
        StrToTrim = StrToTrim.substring(1, StrToTrim.length);
        StrBlank = StrToTrim.substring(0, 1);
    }
    StrBlank = StrToTrim.substring(StrToTrim.length - 1, StrToTrim.length);
    while (StrBlank == " ") {
        StrToTrim = StrToTrim.substring(0, StrToTrim.length-1);
        StrBlank = StrToTrim.substring(StrToTrim.length-1, StrToTrim.length);
    }
    while (StrToTrim.indexOf("  ") != -1) {
        StrToTrim = StrToTrim.substring(0, StrToTrim.indexOf("  "));
        StrToTrim += StrToTrim.substring(StrToTrim.indexOf("  ") + 1, StrToTrim.length);
    }
    return StrToTrim;
}
function urlencode(CODE){
	var plaintext = CODE;

	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()’‘";					
	var HEX = "0123456789ABCDEF";
	
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	// VALORE CODIFICATO
	return encoded;
}
function mostradiv(div) {
	if(document.getElementById(div).style.display=="none") document.getElementById(div).style.display="block";
 	 else document.getElementById(div).style.display="none";
}
function controlla_login() {
	if(document.form_login.username.value=="" || document.form_login.password.value=="") {
		alert("Inserire username e password");
		return false;
	}
	return true;
}
function info_certificata() {
	alert("Tutte le cam girls presenti sul sito sono certificate dallo staff di MondoCamGirls, ovvero vi garantiamo che sono ragazze realmente esistenti. La redazione non ha nessuna relazione con le cam girls, pertanto nessuna responsabilità potrà essere fatta valere nei confronti del titolare del servizio.");
	return;
}
function info_garantita(pid) {
	finestra = window.open('http://www.mondocamgirls.com/garantita.php?id='+pid,'Garantita','scrollbars=yes,resizable=no,width=400,height=380,status=no,location=no,toolbar=no');
	return;
}
