
function show(id, ic)
{
	if (document.getElementById('sub_'+id).style.display == 'none')
	{
		document.getElementById('icon_'+id).src='graph/'+ic+'.gif';
		document.getElementById('sub_'+id).style.display='';
	}
	else
	{
		document.getElementById('icon_'+id).src='graph/'+ic+'.gif';
		document.getElementById('sub_'+id).style.display='none';
	}
}

function showArea(id)
{
	if (document.getElementById(id).style.display == 'none')
		document.getElementById(id).style.display='';
	else
		document.getElementById(id).style.display='none';
}

function over(id)
{
	window.status=document.getElementById('icon_'+id).value;
}

function insertText(id, myValue, op)
{
var myField;
if(op)
	myField=opener.document.forms[0].elements[''+id];
else
{
	myField=document.forms[0].elements[''+id];
}

if (document.selection) {
var temp;
myField.focus();
sel = document.selection.createRange();
temp = sel.text.lenght;
sel.text = myValue;
if (myValue.length == 0) {
sel.moveStart('character', myValue.length);
sel.moveEnd('character', myValue.length);
} else {
sel.moveStart('character', -myValue.length + temp);
}
sel.select();
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
myField.selectionStart = startPos + myValue.length;
myField.selectionEnd = startPos + myValue.length;
} else {
myField.value += myValue;
}
}

function out()
{
    window.status='';
}

function confirmAction(message, loc, par)
{
	if(confirm(message))
	    if(par)
		    window.location=loc;
		else
            newWindow(loc);
	else
		return;
}

function popup(page, id, title, width, height, args, scroll, res)
{

    width+=2;
    height+=52;

    if(screen.width-20<width)
    {
        width=screen.width-20;
        scroll=true;
    }

    if(screen.height-50<height)
    {
        height=screen.height-50;
        scroll=true;
    }

	window.open("./index.php?page="+page+"&id="+id+"&title="+title+""+args,"","width="+width+",height="+height+",toolbar=no,scrollbars="+(scroll==true?"yes":"no")+",resizable="+(res==true?"yes":"no")+",menubar=no,directories=no,location=no,status=yes,screenX=5,left=5,screenY=5,top=5");
}

function getCaptcha(id)
{
	document.getElementById(id).src = "./?page=captcha";
}

