function hmenu(id,newClass)
{
	identity=document.getElementById(id);
	identity.className=newClass;
}

function delete_file(fileid)
{
    if(confirm('Delete this file?'))
    {
        window.open('popups/deletefile.php?file='+fileid,'','height=100,width=400');
    }
}

function entry(flagged,action,id,type,user)
{
    var targ='item';
    if(action=='warn' || action=='ban') targ='user';
    //if(confirm('Do you wish to '+action+' this '+targ+'?'))
    //{
        window.open('popups/moderator/flaggedentry.php?flagid='+flagged+'&action='+action+'&item='+id+'&type='+type+'&user='+user,'','height=400,width=500,resizable=yes,scrollbars=yes');
    //}
}

function togglecheckbox(boxid)
{
	if(document.getElementById(boxid).checked)
    {
    	document.getElementById(boxid).checked=false;
    } else {
    	document.getElementById(boxid).checked=true;
    }
}

function lockrow(rowid,lockname,unlockname)
{
	if(document.getElementById(rowid).name==lockname)
    {
    	document.getElementById(rowid).name=unlockname;
    } else {
    	document.getElementById(rowid).name=lockname;
    }
    hoverrow(rowid,document.getElementById(rowid).name,'');
}

function hoverrow(rowid,classname,mode)
{
	if(mode=='revert')
    {
	    document.getElementById(rowid).className=(document.getElementById(rowid).name);
    }
	else if(mode=='lock')
    {
    	document.getElementById(rowid).name=classname;
	    document.getElementById(rowid).className=(classname);
    }
    else
    {
	    document.getElementById(rowid).className=(classname);
	}
}

function inputjump(form_name,source_name,target_name,max_chars,validation_type)
{
	var dofinish=1;

	if(validation_type=='number')
    {
    	ch=document.forms[form_name].elements[source_name].value;
        chlen=ch.length;
        newchar=(ch.substring(chlen-1,chlen));
        if(newchar < "0" || newchar > "9")
	    {
        	ch=ch.substr(0,chlen-1);
            document.forms[form_name].elements[source_name].value=(ch);
            dofinish=0;
        }
    }

    else if(validation_type=='uppercase')
    {
    	ch=document.forms[form_name].elements[source_name].value;
       	ch=ch.toUpperCase();
        document.forms[form_name].elements[source_name].value=(ch);
    }

    else if(validation_type=='wordcase')
    {
    	ch=document.forms[form_name].elements[source_name].value;
        chlen=ch.length;
        if(chlen==1)
        {
	        ch=ch.toUpperCase();
	        document.forms[form_name].elements[source_name].value=(ch);
        }
    }

    if(dofinish>0)
    {
	    if((document.forms[form_name].elements[source_name].value.length) >= max_chars)
	    {
	        document.forms[form_name].elements[target_name].focus();
	    }
    }
}

function clearfield(form_name,field_name,focus_field)
{
	document.forms[form_name].elements[field_name].value=('');
    document.forms[form_name].elements[focus_field].focus();
}