var behaviour = { 
	/* change gallery image from preview */
	'ul.galleryPreview li a img.preview' : function(element) {
		 element.onclick = function() {
		 	if(element.src.indexOf("www.") == -1)
				$('view').src = "http://www.funkyblog.de/img/gallery/"+element.src.substr(38);
			else
				$('view').src = "http://www.funkyblog.de/img/gallery/"+element.src.substr(42);
			
			return false;
         }
	},
	
	/* list gallery preview */
	'ul.galleryPreview a.arrow' : function(element) {
		element.onclick = function() {
			var e = element.href.split("/"); 
			
			if(e.length==6)
				str = "start="+e[4];
				
			else
				str = "column="+e[4]+"&start="+e[5];
		
			new Ajax.Updater('galleryPreviewBox','/galleryPreviewBox.php?'+str, {method:'post',onComplete: Behaviour.apply});
			return false;
		}
	},
	
	/* list gallery column */
	'ul.galleryColumn a' : function(element) {
		element.onclick = function() {
			var a = element.pathname.split("/");
			var s1 = a[1];
			
			if(s1=='gallery')
				var s1 = a[2];
			
			new Ajax.Updater('galleryPreviewBox','/galleryPreviewBox.php?column='+s1, {method:'post',onComplete: Behaviour.apply});
			return false;
		}
	},
	
	/* autocomplete */
	'div.auto_complete' : function() {
		new Ajax.Autocompleter('contact_name','contact_name_auto_complete','/autocomplete.php', {paramName: "search"});
	}
}
Behaviour.register(behaviour);
