// Make menu dropable
function initMenu(menuId){
	menu=document.getElementById(menuId);
//	if(menu.getElementsByTagName('li').length<1){menu.parentNode.parentNode.parentNode.parentNode.parentNode.style.display='none';}
	menuBlockChilds=menu.childNodes;
	for(var firstLIs in menuBlockChilds){if(menuBlockChilds[firstLIs].nodeType==1){
			thisObjLink=menuBlockChilds[firstLIs].getElementsByTagName('a')[0];
			thisObjULs=menuBlockChilds[firstLIs].getElementsByTagName('ul');
			thisObjUL_LIs=thisObjULs[0].getElementsByTagName('li');
			if(thisObjUL_LIs.length>1){
				viewObj=thisObjULs[0];
				thisObjLink.href='javascript:void(0)';
				thisObjLink.onclick=wrap;
			}
	}}
}
// Show/Hide menu item script
function wrap(){
	parallelNeedenObj=this.parentNode.getElementsByTagName('ul')[0];
	objArrow=this.getElementsByTagName('img')[0];
	if(parallelNeedenObj.style.display=='none'){parallelNeedenObj.style.display='block'; objArrow.src='/imgs/menu_folder_3.gif';}
	else{parallelNeedenObj.style.display='none'; objArrow.src='/imgs/menu_file_plus.gif';}
}
// Make map clicable
function initMap(coordSource, mapId, pointClass){
	ru_map=document.getElementById(mapId);
	if(ru_map){
		childsLi=document.getElementById(coordSource).getElementsByTagName('a');
		for(i=0; i<childsLi.length; i++){
			linkName=childsLi[i].innerHTML;
			coords=childsLi[i].name;
			cStart=coords.indexOf('[');
			cEnd=coords.indexOf(']');
			cArr=coords.substr(cStart+1, cEnd-cStart-1).split('.');
			X=cArr[0]; Y=cArr[1];
			if(!parseInt(X) || !parseInt(Y)){continue;}
			var point=document.createElement("a");
			point.className=pointClass;
			point.href='#'+coords;
			point.style.left=X+'px';
			point.style.top=Y+'px';
			point.title=linkName;
			ru_map.appendChild(point);
		}
	}
}
// Create prettyPhoto links by className
function makePrettyPhotoLinks(cName){
	$(cName).attr('rel', 'prettyPhoto[wirplast]');
}
