﻿function PadInFront(Val, nZeroes)
{
	retVal = "" + Val; //convert to string
	while(retVal.length < nZeroes)
		retVal = "0" + retVal;
		
	return retVal;
}

function gEBI(str){//shortcut for document.getElementById(strID)
	if((str!="")&&(str!=null)) return document.getElementById(str);
	else		return null;
}

function NavigateMoveOverMenu(oDiv)
{
if(oDiv.getAttribute('select')==null)
{
	oDiv.color='#FF0099';
}
else
{
	if(oDiv.getAttribute('select')=='1') oDiv.style.color='#16D7DE';
}
}

function NavigateMoveOutMenu(oDiv)
{
if(oDiv.getAttribute('select')==null)
{
	oDiv.color='#FFFFFF';
}
else
{
	if(oDiv.getAttribute('select')=='1') oDiv.style.color='#D6DFFE';
}
}

function NavigateMoveOutSubMenu(oDiv)
{
if(oDiv.getAttribute('select')==null)
{
	//oDiv.style.color='Navy';
}
else
{
	if(oDiv.getAttribute('select')=='1') oDiv.style.color='Red';
}
}

function NavigateMoveOutSubSubMenu(oDiv)
{
if(oDiv.getAttribute('select')==null)
{
	oDiv.style.color='Navy';
}
else
{
	if(oDiv.getAttribute('select')=='1') oDiv.style.color='#D6DFFE';
}
}

function ShowMenu(oDiv,action,ID)
{
	 oDiv.style.color='#D6DFFE';
	 oDiv.setAttribute('select','1');
	 if(action!="")
	 {
	 window.location = action;
	 }
	 else
	 {
	 gEBI("Menu"+ID).style.display="block";
	 oDiv.style.background="url(Images/Menu/level0_round.gif)";
	 oDiv.style.margin="0px";
	 oDiv.style.marginLeft="15px";
	 }
	 return false;
}

function ShowSubMenu(oDiv,action,ID)
{
	 oDiv.style.color='Red';
	 oDiv.setAttribute('select','1');
	 if(action!="")
	 {
	 window.location = action;
	 }
	 else
	 {
	 gEBI("SubMenu"+ID).style.display="block";
	 }
}

function ChangeLanguage(Ln)
{
    var path="";
    var old_path=""+window.location;
    if(old_path.indexOf("aspx")==-1) path="Index.aspx";
    if(old_path.indexOf("lang")!=-1) 
    {
     path=old_path;
     path=path.replace("lang=ro","lang="+Ln);
     path=path.replace("lang=ru","lang="+Ln);
     path=path.replace("lang=en","lang="+Ln);
     window.location=path;
     return;
    }
    else path+='?lang='+Ln;
    if(old_path.indexOf("aspx")==-1) window.location=path;
    else window.location+=path;
}

function NavigateMoveOverNews(oTR)
{
	oTR.style.color='red';
}

function NavigateMoveOutNews(oTR)
{
	oTR.style.color='#000000';
}

function HideConfirmation(ControlID) {
    if ($("#" + ControlID).length == 0)
        return;

    $('#' + ControlID).dialog("close");
}

