jQuery.noConflict();

jQuery(document).ready(function(){

	jQuery('#column_right').find('div.select_city').find('select').change(function(){
	
              var current_form = jQuery(this).parent();

              //alert(current_form.attr('name'));
              current_form.submit();

		//jQuery('#column_right').find('div.select_city').find('form').submit();
		
	});

	
	jQuery('#city_map').find('ul').css('background', 'url(fileadmin/apassionata/design/tickets/map.png) no-repeat top left');

	jQuery('#city_map').find('li').css('background', 'url(fileadmin/apassionata/design/tickets/stadt_bg.png) no-repeat top left')
	
	jQuery('#city_map').find('li').find('a').css('background', 'url(fileadmin/apassionata/design/tickets/pin.png) no-repeat left');
	jQuery('#city_map').find('li').find('a').css('border', '0px');

	jQuery('#city_map').find('li').find('a').css('padding', '0px 5px 25px 30px');
	jQuery('#city_map').find('li').find('a').css('margin', '0px 0px 0px -10px');
	
	jQuery('#city_map').find('ul').find('li').each(function(){
	
		li = jQuery(this);
		
		li.css('position', 'absolute');
		li.css('margin', '0px');
		
	});
	
	
	jQuery('#city_info').hide();
	
	
	
	/* Kiel */
	jQuery('#city_kiel').css('margin', '-20px 0px 0px 288px');
	jQuery('#city_kiel').css('z-index', '10');
	
	jQuery('#city_kiel').mouseover(function(){
		jQuery('#city_info').css('margin', '-60px 0px 0px 288px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_kiel').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
		
	/* Hamburg */
	jQuery('#city_hambu').css('margin', '35px 0px 0px 285px');
	jQuery('#city_hambu').css('z-index', '11');
	
	jQuery('#city_hambu').mouseover(function(){
		jQuery('#city_info').css('margin', '-5px 0px 0px 285px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_hambu').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Bremen */
	jQuery('#city_breme').css('margin', '75px 0px 0px 223px');
	jQuery('#city_breme').css('z-index', '12');

	jQuery('#city_breme').mouseover(function(){
		jQuery('#city_info').css('margin', '35px 0px 0px 223px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_breme').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Hannover */
	jQuery('#city_hanno').css('margin', '132px 0px 0px 268px');
	jQuery('#city_hanno').css('z-index', '13');
	
	jQuery('#city_hanno').mouseover(function(){
		jQuery('#city_info').css('margin', '92px 0px 0px 268px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_hanno').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Berlin */
	jQuery('#city_berli').css('margin', '122px 0px 0px 457px');
	jQuery('#city_berli').css('z-index', '14');
	
	jQuery('#city_berli').mouseover(function(){
		jQuery('#city_info').css('margin', '82px 0px 0px 457px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_berli').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Bielefeld */
	jQuery('#city_biele').css('margin', '167px 0px 0px 205px');
	jQuery('#city_biele').css('z-index', '15');
	
	jQuery('#city_biele').mouseover(function(){
		jQuery('#city_info').css('margin', '127px 0px 0px 205px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_biele').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Muenster */
	jQuery('#city_muens').css('margin', '165px 0px 0px 80px');
	jQuery('#city_muens').css('z-index', '16');
	jQuery('#city_muens').find('a').css('background-position', 'right');
	jQuery('#city_muens').find('a').css('margin', '0px 0px 0px 0px');
	jQuery('#city_muens').find('a').css('padding', '0px 22px 25px 10px');
	
	jQuery('#city_muens').mouseover(function(){
		jQuery('#city_info').css('margin', '125px 0px 0px 80px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_muens').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Dortmund */
	jQuery('#city_dortm').css('margin', '210px 0px 0px 155px');
	jQuery('#city_dortm').css('z-index', '17');
	
	jQuery('#city_dortm').mouseover(function(){
		jQuery('#city_info').css('margin', '170px 0px 0px 155px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_dortm').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	/* Kassel */
	jQuery('#city_kasse').css('margin', '220px 0px 0px 258px');
	jQuery('#city_kasse').css('z-index', '18');
	
	jQuery('#city_kasse').mouseover(function(){
		jQuery('#city_info').css('margin', '180px 0px 0px 258px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_kasse').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Leipzig */
	jQuery('#city_leipz').css('margin', '220px 0px 0px 342px');
	jQuery('#city_leipz').css('z-index', '19');
	jQuery('#city_leipz').find('a').css('background-position', 'right');
	jQuery('#city_leipz').find('a').css('margin', '0px 0px 0px 0px');
	jQuery('#city_leipz').find('a').css('padding', '0px 22px 25px 10px');
	
	jQuery('#city_leipz').mouseover(function(){
		jQuery('#city_info').css('margin', '180px 0px 0px 342px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_leipz').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Riesa */
	jQuery('#city_riesa').css('margin', '213px 0px 0px 445px');
	jQuery('#city_riesa').css('z-index', '20');
	
	jQuery('#city_riesa').mouseover(function(){
	
		jQuery('#city_info').css('margin', '173px 0px 0px 445px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_riesa').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Duesseldorf */
	jQuery('#city_duess').css('margin', '220px 0px 0px 0px');
	jQuery('#city_duess').css('z-index', '21');
	jQuery('#city_duess').find('a').css('background-position', 'right');
	jQuery('#city_duess').find('a').css('margin', '0px 0px 0px 0px');
	jQuery('#city_duess').find('a').css('padding', '0px 22px 25px 10px');
	
	jQuery('#city_duess').mouseover(function(){
		jQuery('#city_info').css('margin', '180px 0px 0px 0px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_duess').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Koeln */
	jQuery('#city_koeln').css('margin', '245px 0px 0px 128px');
	jQuery('#city_koeln').css('z-index', '22');
	
	jQuery('#city_koeln').mouseover(function(){
		jQuery('#city_info').css('margin', '205px 0px 0px 128px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_koeln').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Erfurt */
	jQuery('#city_erfur').css('margin', '270px 0px 0px 325px');
	jQuery('#city_erfur').css('z-index', '23');
	
	jQuery('#city_erfur').mouseover(function(){
		jQuery('#city_info').css('margin', '230px 0px 0px 325px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_erfur').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Chemnitz */
	jQuery('#city_chemn').css('margin', '257px 0px 0px 425px');
	jQuery('#city_chemn').css('z-index', '24');
	
	jQuery('#city_chemn').mouseover(function(){
		jQuery('#city_info').css('margin', '217px 0px 0px 425px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_chemn').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Frankfurt */
	jQuery('#city_frank').css('margin', '308px 0px 0px 215px');
	jQuery('#city_frank').css('z-index', '25');
	
	jQuery('#city_frank').mouseover(function(){
		jQuery('#city_info').css('margin', '268px 0px 0px 215px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_frank').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Mannheim */
	jQuery('#city_mannh').css('margin', '358px 0px 0px 208px');
	jQuery('#city_mannh').css('z-index', '26');
	
	jQuery('#city_mannh').mouseover(function(){
		jQuery('#city_info').css('margin', '318px 0px 0px 208px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_mannh').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Saarbruecken */
	jQuery('#city_saarb').css('margin', '365px 0px 0px 10px');
	jQuery('#city_saarb').css('z-index', '27');
	jQuery('#city_saarb').find('a').css('background-position', 'right');
	jQuery('#city_saarb').find('a').css('margin', '0px 0px 0px 0px');
	jQuery('#city_saarb').find('a').css('padding', '0px 22px 25px 10px');
	
	jQuery('#city_saarb').mouseover(function(){
		jQuery('#city_info').css('margin', '325px 0px 0px 10px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_saarb').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Stuttgart */
	jQuery('#city_stutt').css('margin', '410px 0px 0px 240px');
	jQuery('#city_stutt').css('z-index', '28');
	
	jQuery('#city_stutt').mouseover(function(){
		jQuery('#city_info').css('margin', '370px 0px 0px 240px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_stutt').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* nuernberg */
	jQuery('#city_nuern').css('margin', '355px 0px 0px 340px');
	jQuery('#city_nuern').css('z-index', '29');
	
	jQuery('#city_nuern').mouseover(function(){
		jQuery('#city_info').css('margin', '315px 0px 0px 340px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_nuern').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Prag */
	jQuery('#city_prag').css('margin', '307px 0px 0px 510px');
	jQuery('#city_prag').css('z-index', '30');
	
	jQuery('#city_prag').mouseover(function(){
		jQuery('#city_info').css('margin', '267px 0px 0px 510px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_prag').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Muenchen */
	jQuery('#city_muenc').css('margin', '450px 0px 0px 355px');
	jQuery('#city_muenc').css('z-index', '31');
	
	jQuery('#city_muenc').mouseover(function(){
		jQuery('#city_info').css('margin', '410px 0px 0px 355px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_muenc').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Wien */
	jQuery('#city_wien').css('margin', '455px 0px 0px 502px');
	jQuery('#city_wien').css('z-index', '32');
	jQuery('#city_wien').find('a').css('background-position', 'right');
	jQuery('#city_wien').find('a').css('margin', '0px 0px 0px 0px');
	jQuery('#city_wien').find('a').css('padding', '0px 22px 25px 10px');
	
	jQuery('#city_wien').mouseover(function(){
		jQuery('#city_info').css('margin', '415px 0px 0px 502px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_wien').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* Zuerich */
	jQuery('#city_zueri').css('margin', '500px 0px 0px 205px');
	jQuery('#city_zueri').css('z-index', '33');
	
	jQuery('#city_zueri').mouseover(function(){
		jQuery('#city_info').css('margin', '460px 0px 0px 205px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_zueri').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* basel */
	jQuery('#city_basel').css('margin', '503px 0px 0px 107px');
	jQuery('#city_basel').css('z-index', '34');
	jQuery('#city_basel').find('a').css('background-position', 'right');
	jQuery('#city_basel').find('a').css('margin', '0px 0px 0px 0px');
	jQuery('#city_basel').find('a').css('padding', '0px 22px 25px 10px');
	
	jQuery('#city_basel').mouseover(function(){
		jQuery('#city_info').css('margin', '463px 0px 0px 107px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_basel').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* genf */
	jQuery('#city_genf').css('margin', '550px 0px 0px 135px');
	jQuery('#city_genf').css('z-index', '35');
	
	jQuery('#city_genf').mouseover(function(){
		jQuery('#city_info').css('margin', '510px 0px 0px 135px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_genf').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* amsterdam*/
	jQuery('#city_amste').css('margin', '90px 0px 0px 50px');
	jQuery('#city_amste').css('z-index', '36');
		
	jQuery('#city_amste').mouseover(function(){
		jQuery('#city_info').css('margin', '50px 0px 0px 50px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_amste').mouseout(function(){
		jQuery('#city_info').hide();
	});
		
		
	/* helsinki */
	jQuery('#city_helsi').css('margin', '-50px 0px 0px 480px');
	jQuery('#city_helsi').css('z-index', '37');
	
	jQuery('#city_helsi').mouseover(function(){
		jQuery('#city_info').css('margin', '-90px 0px 0px 480px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_helsi').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* antwerpen*/
	jQuery('#city_antwe').css('margin', '270px 0px 0px 10px');
	jQuery('#city_antwe').css('z-index', '38');
	
	jQuery('#city_antwe').mouseover(function(){
		jQuery('#city_info').css('margin', '230px 0px 0px 10px');
		jQuery('#city_info').find('h4').html(jQuery(this).find('a').html());	
		jQuery('#city_info').find('p').html(jQuery(this).find('a').attr('title').replace('|', '<br />'));	
		set_info_bgcolor(jQuery(this).find('a').attr('title'));
		jQuery('#city_info').show();
	});
	
	jQuery('#city_antwe').mouseout(function(){
		jQuery('#city_info').hide();
	});
	
	
	/* find the date for the city and display the info-box in a different color, if date is in next season */
	
	function set_info_bgcolor(title) {
	
		/* next seasons starts at 1.10.2010 */
		var next_season = Date.UTC(2010, 10, 1, 0, 0, 0);
		
		var strich = title.indexOf('|');
		
		if (strich != -1)
		{
			subtitle = title.substr(0,strich);
		}
		else
		{
			subtitle = title;
		}
		
		subtitle = subtitle.replace(' ', '');
		
		
		/* if date like 21./22.10.2010 */
		if (subtitle.length > 10)
		{
			/* 21./22.11.2009 */
			var slash = -1;
			slash = subtitle.indexOf('/');
			if (slash > -1)
			{
				subtitle = subtitle.substr((slash + 1),10); 
			}
			
			/* 24.-26.12.2009 */
			var minus = -1;
			minus = subtitle.indexOf('-');
			if (minus > -1)
			{
				subtitle = subtitle.substr((minus + 1),10);
			}
			
		}
		
		//alert(subtitle);
		
		var jahr = parseInt(subtitle.substr(6,4));
		var monat = parseInt(subtitle.substr(3,2));
		var tag = parseInt(subtitle.substr(0,2));
				
		var datum = Date.UTC(jahr, monat, tag, 0, 0, 0);
		
		//alert(datum);
		
		if (datum > next_season)
		{
			jQuery('#city_info').css('background', '#494949');
			jQuery('#city_info').css('border', '1px solid #808080');
		}
		else
		{
			jQuery('#city_info').css('background', '#831F10');
			jQuery('#city_info').css('border', '1px solid #A5625c');
		}
	
	}
	
	
});

