function openComments(baseurl, pht_key)
{
    window.open(baseurl+'/commenti.php?pht_key='+pht_key,'commenti'+pht_key, 'width=480,height=480,scrollbars=yes,status=yes'); 
}

desc = 0;
function getEl(id)
{
    if (document.all) return document.all[id];
    else if (document.getElementById) return document.getElementById(id);
}
function viewdesc()
{
    if (desc == 0)
    {
        el = getEl("div_photo");
        el.style.display = "none";
        el = getEl("div_desc");
        el.style.display = "block";
        desc = 1;
    }
    else
    {
        el = getEl("div_photo");
        el.style.display = "block";
        el = getEl("div_desc");
        el.style.display = "none";
        desc = 0;
    }
}

function flash(el, out)
{
    el.id = randomString();
    if (out==1) el.timeOut = window.setTimeout("flash__('"+el.id+"', 149)", 50);
    else        el.timeOut = window.setTimeout("flash_('"+el.id+"', 126)", 50);
}

function flash_(elid, i)
{
    i=i+5;
    el = document.getElementById(elid);
    if (el != null)
    {
        el.style.backgroundColor="RGB("+i+", "+i+", "+i+")";
        if (i<149) el.timeOut = window.setTimeout("flash_('"+elid+"', "+i+")", 50);
    }
}
function flash__(elid, i)
{
    i=i-5;
    el = document.getElementById(elid);
    if (el != null)
    {
        el.style.backgroundColor="RGB("+i+", "+i+", "+i+")";
        if (i>126) el.timeOut = window.setTimeout("flash__('"+elid+"', "+i+")", 50);
    }
}

function randomString() {
	var chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var string_length = 5;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return randomstring;
}
// 126 -> 145