//	JavaScript Document
//	filename: jquery-isp_overview.js
//	author: j.wessel
//
//	purpose: handle isp overview navigation and stage in the Alice Lounge - Mein Kundencenter
//	initial version, release date: 01.02.08
//	last edited, 01.02.08 by j.wessel

//	removed fades
jQuery(
	function($) {
		//	how many elements are available?
		isp_ovwstg_cnt = $('div.isp_overview_stage').size();
		//	console.log(isp_ovwstg_cnt);
		
		//	create new array and push elements into the array
		//	not necessary at this point, but maybe useful later
		isp_ovwstgs = new Array();
		
		for(var i=0;i<isp_ovwstg_cnt;i++) {
			isp_ovwstgs.push($('div.isp_overview_stage:eq('+i+')'));
			isp_ovwstgs[i].css('display','none');	//	hide all elements
		}
		
		var rnd = 1 + isp_ovwstg_cnt*(Math.random());
		rnd = Math.round(rnd);

		
		//	display specific element
		//	isp_ovwstgs[0].css('display','block');
		
		//	for optional use: display random element
		//	isp_ovwstgs[rnd].css('display','block');
		

		//	Loggedin = true
		//	variables for different roles to follow
		//	DeluxeISDN = 'true/false'; 
		//	LightSuper2000 = 'true/false';
		//	FunDeluxeAnalogSuper6000ISDNSpeedkomplettISDN = 'true/false';

		//	Sind alle auf false gesetzt, handelt es sich um ein anderes Produkt, dann Fallback-Anzeige.

		
		//	link handling
		$('div#sub_stage_isp_overview_bot_m ul li a.trigISPFeat').each(
			function() {
				$(this).click(
					function() {
						//	swap image of the other list elements
						$('div#sub_stage_isp_overview_bot_m ul li a.trigISPFeat').not($(this)).each(
							function() {
								if($(this).children('img').hasClass('act')) {
									var filename_off = $(this).children('img').attr('src').replace(/off/,"norm");
									$(this).children('img').attr('src',filename_off).removeClass('act').addClass('hasRO');
								}
							}
						);
	
						//	swap image of this particular list element
						var filename_off = $(this).children('img').attr('src').replace(/act/,"off");
						$(this).children('img').attr('src',filename_off).removeClass('hasRO').addClass('act');						


						$('div#isp_overview_intro').hide();	//	.css('display','none');
						var showID = $(this).attr('id').split('-');
						showID = showID[1];
						
						//	link - stage connection
						$('div.isp_overview_stage:visible').hide();	//	.css('display','none');
						$('div.isp_overview_stage#'+showID).show();	//	.css('display','block');
					}
				);
			}
		);
	}
);