startList = function() {
SubmenuCount = 5;

for (x=0; x<SubmenuCount; x++) {

if (document.all&&document.getElementById) {
	navRoot = document.getElementById("nav"+x);
	for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
			node.onmouseover=function() {
				this.className+=" over";
  			}
  			node.onmouseout=function() {
  				this.className=this.className.replace(" over", "");
   			}
   		}
  	}
 }
 
 }
 
}
window.onload=startList;


$(document).ready(function(){
	
	var PlusMinus = $(".icoPlus, .detail");
	AllWinOpen = $(".WinOpen,.WinOpenProg");
	
	PlusMinus.click(function(){
		$(this).parents("dd").find('a:first').toggleClass("icoMinus").parent().find('.detail:first').toggleClass("hide").parents("dd").find('#AllCont').toggleClass("show");
		return false;});


	IfrmaeSRC = "";
	
// Script polnocennyh okon
AllWinOpen.click(function(){
		$(document.body).toggleClass("OfHide");
		//WinShow = $("#"+$(this).attr("id")+"Win");
		//WinShow.toggleClass("DBlock");
	
	$("#BGFix").toggleClass("DBlock");
		
if ($(this).attr("id")=="Prog")		
	{$("#"+$(this).attr("id")+"DPMailBox").toggleClass("DBlock");
	$("#"+$(this).attr("id")+"SRequest").contents().find("#subject").attr("value", $(this).attr("title"));
	
	IfrmaeSRC = $("#"+$(this).attr("id")+"SRequest").attr("src");
	
	return false;}
	else
	{
		if ($(this).attr("id")=="mailpost")		
			{$("#"+$(this).attr("id")+"DPMailBox").toggleClass("DBlock");
			$("#"+$(this).attr("id")+"SRequest").contents().find("#subject").attr("value", $(this).attr("title"));
			
			IfrmaeSRC = $("#"+$(this).attr("id")+"SRequest").attr("src");
			
			return false;}
			else
			{$("#DPMailBox").toggleClass("DBlock");
			$("#SRequest").contents().find("#subject").attr("value", $(this).attr("title"));
			
			IfrmaeSRC = $("#SRequest").attr("src");	
			
				}
			return false;}
			
			});
	
						
$(".WinCloze").click(function(){
		
		$(this).parents("table:first").find("iframe:first").attr("src",IfrmaeSRC);
		
		$(document.body).toggleClass("OfHide");
		$(this).parents(".JaoWinPos").toggleClass("DBlock");
		$("#BGFix").toggleClass("DBlock");
				
		return false;});
// End of Script polnocennyh okon
	
//Inner Menu action
AllNameMenu = $("#InnerMenu").find("a:nth-child");
AllGoods = $("#GDContent div.Goods:nth-child");

//alert(AllGoods.length);

AllNameMenu.click(function(){
		//alert($(this).parents("li").attr("class","Sel"));
		$("#InnerMenu").find("li:nth-child.Sel").removeClass("Sel"); //add select to tab
		$(this).parents("li").attr("class","Sel"); //removie select from tab
		AllGoods.addClass("DNone"); //Hide all goods elements
		
		switch ($(this).attr("id")) 
			{ case "AllGoods":
				AllGoods.removeClass("DNone");
				break;  
			default:
				//AllGoods.find("."+$(this).attr("id")).removeClass("DNone");
				$("#GDContent div."+$(this).attr("id")+":nth-child").removeClass("DNone");
				break; 
				}
		return false;
	});

//End of Inner menu action
});
