var dataURL = "index.php?eID=autoCheckData&lang="+lang+"&sys_langauge_uid="+sys_language_uid;

$(document).ready(function() {
	/**
	 * Ajax call to get teaser list elements
	 * @deprecated: Disable ajax call. Use list elements as static html instead.
	 * @author: mha
	 */
//	$.ajax({
//		url: (dataURL),
//		data: 'type=marken',
//		type: 'GET',
//		timeout: 10000,
//		dataType: 'json',
//		error: function() {
//			alert(loading_error);
//		},
//		success: function(json){
//			var output = "";
//			for (var rowId=1; rowId<json.length;rowId++) {
//				if(json[rowId].marcode==act_marcode) {
//					json[0].marverkbz = json[rowId].marverkbz;
//				}
//				output += '<li title=\"' + json[rowId].marcode + '\">' + json[rowId].marverkbz + '</li>\n';
//			}
//			$("#autoCheckMarkeTeaserList li").each(function() {
//				$(this).click(function(){
//					$('#autoCheckMarkeTeaser p').text($(this).text());
//					location.href = "/index.php?id=41&L="+sys_language_uid+"&tx_vsbfuautocheck_pi1[marcode]="+this.title;
//				});
//				$(this).mouseover(function() {
//					$(this).attr("class","active");
//				});
//				$(this).mouseout(function() {
//					$(this).attr("class","");
//				});
//			})
//		}
//	});

	/**
	 * Bind events to each teaser list element
	 * @author mha
	 */
	$("#autoCheckMarkeTeaserList li").each(function() {
		// click: change location
		$(this).click(function(){
			$('#autoCheckMarkeTeaser p').text($(this).text());
			location.href = "/index.php?id=41&L="+sys_language_uid+"&tx_vsbfuautocheck_pi1[marcode]="+this.title;
		});
		// mouseover: add class "active"
		$(this).mouseover(function() {
			$(this).attr("class","active");
		});
		// mouseout: clear class
		$(this).mouseout(function() {
			$(this).attr("class","");
		});
	})

	/**
	 * Bind click event to teaser list: toggle hide/show
	 */
	$('#autoCheckMarkeTeaser').click(function() {
		if($('#autoCheckMarkeTeaserList').is(':visible')) {
			$('#autoCheckMarkeTeaserList').hide();
		}
		else {
			$('#autoCheckMarkeTeaserList').show();
		}
	});
});
