function $(id) {
	return document.getElementById(id);
}

function updatePage(xml) {
	with (xml.getElementsByTagName("zdjecie").item(0)) {
		Location = getAttribute("Location");
		ThumbnailMid = getAttribute("ThumbnailMid");
		CANT_ZOOM = getAttribute("CANT_ZOOM")
		
		// ustalanie czy wyswietli sie miniatorka czy duze zdjecie.
		if(CANT_ZOOM == false) {
				$('mainFoto').src = Location;
			OrigFile = getAttribute("OrigFile");
				$('linkFull').href = OrigFile;
		} else if (CANT_ZOOM == true) {
			$('mainFoto').src = ThumbnailMid;
		}

		Title = getAttribute("Title");
			$('photoTitle').innerHTML = Title;
		Counter = getAttribute("Counter");
			$('Counter').innerHTML = Counter;
		AuthorPreviousElement = getAttribute("AuthorPreviousElement");
			$('link_AuthorPreviousElement').href = "javascript:getZdjecieAutora("+AuthorPreviousElement+")";
		AuthorNextElement = getAttribute("AuthorNextElement");
			$('link_AuthorNextElement').href = "javascript:getZdjecieAutora("+AuthorNextElement+")";
		CategoryPreviousElement = getAttribute("CategoryPreviousElement");
			$('link_CategoryPreviousElement').href = "javascript:getZdjecieAutora("+CategoryPreviousElement+")";
		CategoryNextElement = getAttribute("CategoryNextElement");
			$('link_CategoryNextElement').href = "javascript:getZdjecieAutora("+CategoryNextElement+")";
		AverageRating = getAttribute("AverageRating");
			$('AverageRating').innerHTML = AverageRating;
		
	}
}

function getZdjecieAutora(element, mode) {
	advAJAX.get({
		url : "test_ajax_photos.php",
		photo : element,
    AJAX_Req : 'true',
    
			onInitialization : function(obj) {
				// wyszarza guziczki

			},
			onSuccess : function(obj) {
				// alert(obj.responseText);
				updatePage(obj.responseXML); 

			},
			onFinalization : function(obj) {
				
			}
	})
}