function setInactiveNavi(image) {
	$$('.image-navigation-active').erase('class').set('class', 'image-navigation-inactive');
	$$('.image-navigation-inactive').setStyles({
	  opacity:0.7
	});
	$$('#image-navigation-'+ image).setStyles({
	  opacity:1
	}).erase('class').set('class', 'image-navigation-active');
	
}
function insertContent(script,anys,update) {
	// var myHTMLRequest = new Request.HTML({url:script,update:update, data:anys}).send();
	
		
	var req = new Request.HTML({url:script, data:anys, 
			onSuccess: function(html) {
				//Clear the text currently inside the results div.
				$(update).set('text', '');
				//Inject the new DOM elements into the results div.
				$(update).adopt(html);
			},
			//Our request will most likely succeed, but just in case, we'll add an
			//onFailure method which will let the user know what happened.
			onFailure: function() {
				$(update).set('text', 'The request failed.');
			}
		}).send(); 
}

function addNavigationJs() {
	var elements = $('image-navigation').getElements('a');
	
	elements.each(function(el,index){
		el.addEvent('click', function() { setImage(index+1); return false; });
	});
	
}
function setImage(i) {
	$('ext-image-image').set('html', '<img class="loader" src="/files/templates/main/gfx/ajax-loader.gif">');
	insertContent("files/templates/main/res/dynamic.php",{'image':i, 'cat':cat,'type':type},"ext-image-image");
	setInactiveNavi(i);
}
