/*
Основное меню для CMS системы
*/



// Начало меню
function CMS_MainMenu_GetBegin()
{
	document.write("<div style=\"margin-top:5;\"></div><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td width=\"20\"><img src=\"images/dot.gif\" width=\"20\" height=\"1\" border=\"0\"></td>");
}



// Конец меню
function CMS_MainMenu_GetEnd()
{
	document.write("<td width=\"14\"><img src=\"images/dot.gif\" width=\"14\" height=\"1\" border=\"0\"></td></tr></table>");
}



// Элемент меню
function CMS_MainMenu_GetItem(piId, psName, psUrl, psDesc, psTarget, iconURL, psIconWidth, psIconHeight, pbIsCurrMenuItem, pbIsFirstPage)
{
	document.write("<td  align=\"left\"");
	if(pbIsCurrMenuItem) document.write("><a href=" + psUrl + " title='" + psDesc + "' target='" + psTarget + "'>" +
		 CMS_MenuItem_GetIcon(piId,  psName, iconURL, psIconWidth, psIconHeight, pbIsCurrMenuItem) +
		 "</a></td><td width=\"20%\"><img src=\"images/dot.gif\" width=\"1\" height=\"1\" border=\"0\"></td>");
	else
		document.write("><a href=" + psUrl + " title='" + psDesc + "' target='" + psTarget + "'>" + CMS_MenuItem_GetIcon(piId,  psName, iconURL, psIconWidth, psIconHeight, pbIsCurrMenuItem) +
			"</a></td><td width=\"20%\"><img src=\"images/dot.gif\" width=\"1\" height=\"1\" border=\"0\"></td>");

}



// Формирование кода для иконки меню
function CMS_MenuItem_GetIcon(piId,  psName, iconURL, psIconWidth, psIconHeight, isCurrentItem)
{
        // Параметры иконки на главную страницу
        HomeIconPath = "/images/icons/homePage.gif";



        if (isCurrentItem)
                return "<img src=\"/images/mainMenu/" + piId + ".gif\" border=\"0\" alt=\"" + psName + "\">";

        if (piId == 0 && HomeIconPath != "")
                return "<img src=\"" + HomeIconPath + "\" alt=\"" + psName + "\">";
        else if (psIconWidth != "")
                return "<img src=\"" + iconURL + "\" border=\"0\" width=\"" + psIconWidth + "\" height=\"" + psIconHeight + "\" alt=\"" + psName + "\">";
                
        return "";
}
