// JavaScript
jQuery.noConflict();
jQuery(document).ready(function(){
	makeClickItem ('clickItemByFirstATag','a:first-child');
	makeClickItem ('ce-hLayout5','h3 a:first-child');
	makeClickItem ('listItem','h3 a:first-child');
	spielplanClickItem();
});

function makeClickItem(iClass, hrefItem) {
	jQuery('.' +iClass).each(function(index, obj) {
		var aHref = jQuery(obj).find(hrefItem).attr('href');
		if(aHref) {
			jQuery(obj).css('cursor','pointer');
			jQuery(obj).hover(
				function () {
					jQuery(this).css('background-color','#f6f6f6');
				},
				function () {
					jQuery(this).css('background-color','transparent');
				}
			);
			jQuery(obj).click(function(){
				if(aHref.indexOf('http') == 0) {
					location.href = aHref;
				} else {
					location.href = 'http://' + document.domain + '/' + aHref;
				}
			});
		}
	});
}

function spielplanClickItem() {
	jQuery('h4.playTitle').each(function(index, obj) {
		var aHref = jQuery(obj).find('span a:first-child').attr('href');
		var aTitle = jQuery(obj).text();

		if(aHref) {
			jQuery(obj).attr('title',aTitle);
			jQuery(obj).css('cursor','pointer');
			jQuery(obj).hover(
				function () {
					jQuery(this).css('background-color','#f1f2f2');
				},
				function () {
					jQuery(this).css('background-color','#e6e7e8');
				}
			);
			jQuery(obj).click(function(){
				if(aHref.indexOf('http') == 0) {
					location.href = aHref;
				} else {
					location.href = 'http://' + document.domain + '/' + aHref;
				}
			});
		}
	});

	jQuery('ul.shopItem li.inlineListFloatItem').each(function(index, obj) {
		var aHref = jQuery(obj).find('p a:first-child').attr('href');
		var aTitle = jQuery(obj).find('p.starticket').text();

		if(aHref) {
			jQuery(obj).attr('title',aTitle);
			jQuery(obj).css('cursor','pointer');
			jQuery(obj).hover(
				function () {
					jQuery(this).css('background-color','#CAABCA');
				},
				function () {
					jQuery(this).css('background-color','#E4CAE4');
				}
			);
			jQuery(obj).click(function(){
				if(aHref.indexOf('http') == 0) {
					location.href = aHref;
				} else {
					location.href = 'http://' + document.domain + '/' + aHref;
				}
			});
		}
	});


}
