
//  new
function focus_s(el)
{
el.style.background = '#ED1A3B url(http://www.companion.ua/i/s2_bg.gif)';
}

function blur_s(el)
{
if(el.value == "")
{
el.style.background = '#ED1A3B url(http://www.companion.ua/i/s3_bg.gif)';
}
}

//  /new

var browser=true;
if (document.layers && !document.getElementById) browser=false;

function createObj(obj) {
if (document.all) obj=document.all['SubMenu_'+obj];
else obj=document.getElementById('SubMenu_'+obj);
return obj;
}

function showSubMenu(obj) {
    if (browser)
    {
    var point = document.getElementById('menuimg_' + obj).offsetLeft + (Math.floor((document.body.clientWidth - 772)/2));
    obj=createObj(obj);
    obj.style.visibility='visible';
    obj.style.left	= point;
    }
     
}
function check(e,subItem, obj, defolt, toRoll) {
        var t = 168;
        var b = 214;
        if(baner == 0)
        { 
            t = 71;
            b = 117;
        }
        var bottom = b - getScroll();
        var top = t - getScroll();
        var width = getWidth()/2 - 386;     
        
        if (document.all) 
        {   if(navigator.userAgent.indexOf("Opera") != -1)
            {
                bottom = bottom -2;
            }
        //alert(e.y +"->"+ bottom)
        if ((e.y <= top)||(e.y >= bottom)||(e.x <= width) )
            {//alert(subItem+"->"+defolt+"->"+toRoll)
            hideSubMenu(subItem);
            if(toRoll != 0)
            {
                
                if(subItem != defolt)
                menuRoll(obj);
            }
                
            
            
            if(defolt != 0)
            {
                if(toRoll != 2)
                showSubMenu(defolt);
            } 
                
            
            }
        }
    else {  
        if ((e.clientY-2 <= top)||(e.clientY + 2>= bottom)||(e.clientX <= width - 1))
            {
            hideSubMenu(subItem);
            if(toRoll != 0)
            {
                
                if(subItem != defolt)
                menuRoll(obj);
            }
                
            
            
            if(defolt != 0)
            {
                if(toRoll != 2)
                showSubMenu(defolt);
            } 
                    
            }
        }
    
}
function hideAllSubs()
{
    for(i=0;i<subs.length;i++)
    {
        obj=createObj(subs[i]);
        obj.style.visibility = 'hidden';
    }
}

function hideSubMenu(obj) {
    if (browser)
    {
    obj=createObj(obj);
    obj.style.visibility='hidden';
    }
}
function hideMain(noHide)
{
if (browser)
    {
    if (document.all)
    {
            
         for(j=0;j < pics.length;j++ )
                {
                img = "menuimg_"+noHide;
                if(img != pics[j].id)
                document.all[pics[j].id].src = pics[j].src;
    
                }
    }
    else {  
            for(var j=0;j < pics.length;j++)
            {
                img = "menuimg_"+noHide;
                if(img != pics[j].id)
                document.getElementById(pics[j].id).src = pics[j].src;
            }
        }
    }
    
}

function menuRoll(obj)
{
    for(i = 0;i < picsOn.length;i++)
    { 
        if(obj.id == picsOn[i].id)
        {
            if(obj.src == picsOn[i].src)
                obj.src = pics[i].src;               
            else
                obj.src = picsOn[i].src;
        }
    }
}

function getScroll()
{
return document.body.scrollTop;
}

function getWidth()
{
    return document.body.clientWidth;
}

function todayDate()
{
var data = new Date();
var m = data.getMonth(), d = data.getDate(), y = data.getFullYear(), w = data.getDay();

return d+' '+monthNames[m]+' '+y+', '+weekdayNames[w];
}

var today = todayDate();

function test()
{
    var check = false;
    for(i=0;i<document.forms('VoteForm').elements.length;i++)
    {
        if(document.forms('VoteForm').elements(i).checked )
        {
            check = true;
        }
    }
return check;
} 

function showImage(imgUrl){
  var imgWin = new Object();
  imgWin=window.open('imageShow.html?'+spath+imgUrl,'imgPreview','height=500,width=468,status=0,statusbar=0,toolbar=0,menubar=0,location=no,resizable=yes,scrollbars=no');
//imgWin.document.write('<html><head><title>Просмотр картинки</title></head><script language="JavaScript" type="text/javascript">function GetLayer(name) {return ((eval(document.all))?(document.all[name]):(document.getElementById(name)))} function doR () { window.resizeTo(GetLayer(\'pimg\').width+13,GetLayer(\'pimg\').height+37)}</script><body onload="//doR();" bgcolor="#ffffff" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0"><a href="#" onclick="window.close()"><img src="'+spath+imgUrl+'" name="pimg" id="pimg" alt="Close window" border="0"/></a></body></html>');
}

function clickGraph(imgG) {
	var wind;
	
	wind = window.open("", "Graph", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
	wind.moveTo(20, 20);
	wind.document.open();
	wind.document.write(showGraph(imgG));
	wind.document.close();
	wind.focus();

}

function showGraph(imgG) {
	var str;

	str=	"<div align=\"center\">\n" +
		" <center>\n" +
		"    <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#E00919\">\n" +
		"     <tr><td width=\"100%\">\n" +
		"      <table border=\"0\" width=\"100%\" cellspacing=\"1\" bgcolor=\"#E00919\" cellpadding=\"3\">\n" +
		"       <tr><td bgColor=\"#D7D7D7\" width=\"100%\" valign=\"middle\" align=\"center\">" +
		"        <p style=\"font-family: 'MS Sans Serif', Arial, Verdana; font-size: 15px; font-weight: bold; color: #990000\">\n" + 

		"<" + "script" + ">\n" +
		"<!--\n" +
		"var str = \"" + escape(graphArray[imgG][0]) + "\";\n" +
		"document.write(unescape(str));\n" +
		"//-->\n" +
		"<" + "/script" + ">\n" +

		"        </p>" +
		"       </td></tr>\n" +
		"       <tr><td bgColor=\"#FFFFFF\" width=\"100%\" valign=\"middle\" align=\"center\"><img border=\"0\" src=\"" + graphArray[imgG][1] + "\" onload=\"ResizeOnLoad()\"></td></tr>\n" +
		"      </table>\n" +
		"     </td></tr>\n" +
		"    </table>\n" +
		" </center>\n" +
		"</div>\n" +
		"<" + "script" + ">\n" +
		"<!--\n" +
		"function ResizeOnLoad() {\n" +
		"	window.resizeTo(Math.max(Math.floor(screen.width / 2), (document.images[0].width + 60)), (document.images[0].height + 110));\n" +
		"}\n" +
		"ResizeOnLoad();\n" +
		"//-->\n" +
		"</" + "script" + ">\n";
		
	return str;
}

function convMonth(Month) 
{
	if (Month.substr(0,1)=='0')
		Month=Month.substr(1,1);
	var number 	= parseInt(Month);
	return monthNames[number-1].toLowerCase();
}


function show(b,r,u,i,s){
	if (u.style.display=='none')
	{
		for (c=0;c<=i;c++)
		{
			setTimeout(r.id+'.style.height='+c+';if('+c+'=='+i+'){'+u.id+'.style.display=\'\'}',s*c)
			if (c==i){ b.src="http://www.companion.ua/images/k_2.gif" }
		}
	}
	else
	{
		u.style.display='none'
		for (c=i;c>0;c--)
		{
			setTimeout('tt('+c+','+r.id+')',s*(i-c))
		}
		if (c==0){ b.src="http://www.companion.ua/images/k_1.gif" }
	}
}
function tt(c,r){
	r.style.height=c}
