/*
	This website is powered by indual
	Copyright (c) 2009 indual GmbH (www.indual.ch)
*/

/* + toggle boxes -------------------------------------------------------------- */
function toggle_boxes (id) {
	// does the element exists?
	if ($("boxlink"+id)) {
		// on click event
		$("boxlink"+id).onclick = function () {
			// toggle box content (show/hide)
			Effect.toggle("boxcontent"+id, 'blind', { duration: 0.7 });
			// toggle box header (css style)
			$("boxhead"+id).toggleClassName('open');
		};
		return true;
	}
	return false;
}

/* + toggle object content ----------------------------------------------------- */
function toggle_object_content (show_div_id, hide_div_id) {
	// does the element exists?
	if ($(show_div_id) && $(hide_div_id)) {
		// toggle box content (show/hide)
		Effect.BlindDown(show_div_id, { duration: 0.7 });
		Effect.BlindUp(hide_div_id, { duration: 0.7 });
		return true;
	}
	return false;
}

/* + display object ------------------------------------------------------------ */
function display_object (we_class_id, object_div_id, limit, link_label_prev, link_label_next, category, sent_by_ajax) {
	url = '/we/php/ajax_handler.php?action=getObjectsByClassId&we_class_id='+we_class_id+'&object_div_id='+object_div_id+'&limit='+limit+'&link_label_prev='+link_label_prev+'&link_label_next='+link_label_next+'&category='+category+'&sent_by_ajax='+sent_by_ajax;
	new Ajax.Request(url, {
		method: 'get',
		onComplete: function(response) {
			$(object_div_id).innerHTML = response.responseText;
		}
	});
}
