//////////////////////////////////////////////////////////////////////////
// Открывает/закрывает все сообщение
// todo: 1 - expand, 0 - collapse;
function openAll( todo)
{
    if( todo)
    {
        stylename="block";
        imname="/i/i_close.gif";
    }
    else
    {
        stylename="none";
        imname="/i/i_open.gif";
    }
    divColl = document.getElementsByTagName("div");
    for (i = 0; i < divColl.length; i++) 
    {
        if (divColl[i].className == "child") 
        {
            id = divColl[i].id;
            el = id.substring(0, id.length-5);
            whichIm = document.getElementById(el+"Img");
            divColl[i].style.display = stylename;
            whichIm.src = imname;
		}
    }
}
//////////////////////////////////////////////////////////////////////////
function expandIt(el) 
{ 
	whichEl = document.getElementById(el + "Child");
	whichIm = document.getElementById(el + "Img");
    if (whichEl.style.display == "none" || whichEl.style.display=="") 
    {
		whichEl.style.display = "block";
		whichIm.src = "/i/i_close.gif";
    }
    else 
    {
		whichEl.style.display = "none";
		whichIm.src = "/i/i_open.gif";
    }
    event.cancelBubble = true;
}

function expandIt2(el) 
{ 
	whichEl = document.getElementById(el + "Child");
//	whichIm = document.getElementById(el + "Img");
    if (whichEl.style.display == "none" || whichEl.style.display=="") 
    {
		whichEl.style.display = "block";
//		whichIm.src = "/i/i_close.gif";
    }
    else 
    {
		whichEl.style.display = "none";
//		whichIm.src = "/i/i_open.gif";
    }
//    event.cancelBubble = true;
}
//////////////////////////////////////////////////////////////////////////


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function WindowOpen (vUrl, vWidth, vHeight, vScroll, vResize) {
	var left = (screen.availWidth - vWidth) / 2;
	var top = (screen.availHeight - vHeight) / 2;
	if (!vScroll) vScroll = "no";
	if (!vResize) vResize = "no";
	wId = window.open (vUrl, "NewWin"+GetRand(), "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+vScroll+",resizable="+vResize+",left="+left+",top="+top+",width="+vWidth+",height="+vHeight);
	wId.focus ();
}

function GetRand () {
	result = "";
	result = Math.random()+"1";
	result = result.split(".");
	return result[1];
}

function PopUp(url, winname, w, h) {
		s = screen;	
		win = window.open('',winname,'width='+w+',height='+h +',scrollbars=auto');	
		win.document.writeln('<html>');
		win.document.writeln('<head>');
		win.document.writeln('<title></title>');
		win.document.writeln('<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">');
		win.document.writeln('<A href="javascript:window.close()"><img src='+ url + ' border=0></a>');
		win.document.writeln('</body>');
		win.document.writeln('</html>');
		win.focus(); 
		win.moveTo(Math.ceil(s.width/2 - w/2),Math.ceil(s.height/2 - h/2 - 20));
		return false;
	}
	
	function PopUp2(url, winname, w, h) {
		s = screen;	
		win = window.open(url,winname,'width='+w+',height='+h +',scrollbars=auto');	
		win.focus(); 
		win.moveTo(Math.ceil(s.width/2 - w/2),Math.ceil(s.height/2 - h/2 - 20));
		return false;
	}
	
	function PopUp3(url, winname, w, h) {
		s = screen;	
		win = window.open(url,winname,'width='+w+',height='+h +',scrollbars=1');	
		win.focus(); 
		win.moveTo(Math.ceil(s.width/2 - w/2),Math.ceil(s.height/2 - h/2 - 20));
		return false;
	}