

var helpwin;
/*
* Function: showHelp()
*/
function showHelp(id) {
    if (helpwin) helpwin.close();
    helpwin = window.open("ychelp.php?id=" + id, "HELP", "width=640,height=400,menubar=no,scrollbars=yes,resizable=yes,left=20,top=20,status=no");
    return false;

}

/*
* Function: getel()
*/
function getel(id) {  return document.getElementById(id); }

function setv( el, v ) {
    var el = getel(el);
    if (el) el.value = v;
}

/*
* Function: clearFilters()
*/
function clearFilters() {
    var el;
    setv('idFLDYCODE1', '');
    setv('idFLDYCODE2', '');
    setv('idFLDYAUTHOR', '');
    setv('idFLD_ORDERBY',  0);
    if ((el = getel('idFLD_UNSOLVED'))) el.checked = false;
    setv('idFLD_GAMETYPE', '');
    setv('idFLD_YTYPE', '');
    setv('idFLDYSTATUS', '*');
    setv('idFLD_DIFFICULTY',  0);
    return false;
}

function jumpTo(url) {
    location.href = url;
}

/*
* String functions
*/
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

var fbwin = false;
function showFacebook(num, desc) {
    if (fbwin) fbwin.close();
    var url = encodeURIComponent("http://www.ciunga.it/youciu/index.php?mn=view&num="+num+"&fb=1");    
    //alert(num + ' ' + desc );
    desc = encodeURIComponent( desc );
    fbwin = window.open("http://www.facebook.com/sharer.php?u=" + url + "&t=" + desc, "FACEBOOK", "width=630,height=460,menubar=no,scrollbars=no,resizable=no,left=20,top=20,status=no");
    return false;
}
