
/***************************	Menu Hide/Show		****************************/

function menuCollapseAll()
{
	var expandMenuObj = document.getElementById('menuEx');
	if(expandMenuObj)
	{
		var elementsToHide = expandMenuObj.getElementsByTagName('DIV');
		
		for(var i=0; i<elementsToHide.length; i++)
		{
			if(elementsToHide[i].className == 'menuKategoriaAkcji' || elementsToHide[i].className == 'menuKategoriaAkcjiHide')
				elementsToHide[i].className = 'menuKategoriaAkcjiHide';
		}
	}
}

function menuAddEvent()
{
	var expandMenuObj = document.getElementById('menuEx');
	if(expandMenuObj)
	{
		var clickedElement = expandMenuObj.getElementsByTagName('P');
		var clickedElementTitle = new Array();
		
		for(var i=0; i<clickedElement.length; i++)
		{
			if (clickedElement[i].className == "menuImgKategoria")
				clickedElementTitle.push(clickedElement[i]);
		}
		
		for(var i=0; i<clickedElementTitle.length; i++)
		{
			clickedElementTitle[i].onclick = menuShowHideThis;
		}
	}
}

function menuShowHideThis()
{
	var thisParent = this.parentNode;
	var subMenu = thisParent.getElementsByTagName('DIV');

	if(subMenu[0].className == 'menuKategoriaAkcjiHide')
	{
		menuCollapseAll();
		subMenu[0].className = 'menuKategoriaAkcji'; //show this
	}
	else if(subMenu[0].className == 'menuKategoriaAkcji')//close opened submenu
	{
		menuCollapseAll();
	}
}

function menuActivThisOne(iActive)
{

	if(iActive != 'undefined')
	{

		var expandMenuObj = document.getElementById('menuEx');
		var colMenuElements = expandMenuObj.getElementsByTagName('DIV');// ul element
		
		var elemHigh = 'menuColor_'+ iActive + '';
		var elemExp = 'menuEx_'+ iActive + '';
		
		var elementToHighlight = document.getElementById(elemHigh);
			elementToHighlight.className = 'menuImgKategoriaActive';

		var elementToHighlight = document.getElementById(elemExp);
			elementToHighlight.className = 'menuKategoriaAkcji';		
	}

}

/***************************	Imagie Gallery	******************************/

function gallery()
{
	if(document.getElementById('imgGallery'))
	{
		var objGallery = document.getElementById('imgGallery');
		var colA = objGallery.getElementsByTagName('A');

		for(var i=0; i<colA.length; i++)
			colA[i].onclick = changePhoto;
	}
}

function changePhoto()
{
	var smallImgSource = this.getElementsByTagName('IMG')[0].src;
	var tempSrc = smallImgSource.substring(0, smallImgSource.length - 1)
	var newImgSource = tempSrc + 'n' ;
	var normalOldImg = document.getElementById('bigPhoto');
	normalOldImg.src = newImgSource;
	return false;
}

/***************************	onLoad Action	******************************/

function initMenu()
{
	gallery();
}

window.onload = initMenu;


/***************************	Show img in new Window	******************************/


var newWindow = '';
function zoom(img,w,h)
{
	if(newWindow != '' && newWindow.closed == false)
	{
		newWindow.close();
	}


	config="width="+w+","+"height="+h+","+"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no";

	newWindow=window.open("","windowName",config);
	newWindow.document.open();
	newWindow.document.clear();
	newWindow.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"');
	newWindow.document.write('"http://www.w3.org/TR/html4/strict.dtd">');
	newWindow.document.write('<html>');
	newWindow.document.write('<title>Image</title>');
	newWindow.document.write('<body style="margin: 0px; padding: 0px; overflow:hidden;">');
	newWindow.document.write('<a href="#" onclick="window.close(); return false;" title="Zamknij okno"><img src='+img+' alt="Wyroznianie ogloszeń" style="border: 0px;" ></a>');
	newWindow.document.write('</body>');
	newWindow.document.write('</html>');
	newWindow.document.close();
}


/*
function usunOpisKosza()
{
	if(document.getElementById('listaOgloszen'))
	{
		objOgloszenia = document.getElementById('listaOgloszen');
		colHref = objOgloszenia.getElementsByTagName('DIV');

		for(var i=0; i<colHref.length; i++)
		{
			if(colHref[i].className == 'ogRegulamin' || colHref[i].className == 'ogRegulamin' || colHref[i].className == 'ogRegulamin')
			{
				colHref[i].getElementsByTagName('A')[0].childNodes.item(1).nodeValue = '';
				colHref[i].onmouseover = opisKoszaTak;
				colHref[i].onmouseout = opisKoszaNie;
			}
		}
	}
}

function opisKoszaTak()
{
	this.getElementsByTagName('A')[0].childNodes.item(1).nodeValue = 'Ogłoszenie łamie regulamin? Zgłoś do weryfikacji!';
}

function opisKoszaNie()
{
	this.getElementsByTagName('A')[0].childNodes.item(1).nodeValue = '';
}

//window.onload=usunOpisKosza;
*/

