// JavaScript Document


window.addEvent('domready', function() {

	video	=	'<p><object wmode="transparent"><param name="wmode" value="transparent"/><param name="FlashVars" value="file=http://it-republik.de/develop/zonen/magazine/videos/psfile/videofile/51/Basta_Imag48c7f0e5cc91f.flv&amp;backcolor=0x000000&amp;frontcolor=0xCCCCCC&amp;lightcolor=0x557722&amp;image=http://it-republik.de/develop/zonen/magazine/videos/pspic/screenshot/85/basta_scre48c7f0df707a2.jpg"/><embed type="application/x-shockwave-flash" src="http://entwickler.de/zonen/magazine/videos/flvplayer.swf" style="" id="single" name="single" quality="high" allowfullscreen="true" flashvars="file=http://it-republik.de//develop/zonen/magazine/videos/psfile/videofile/51/Basta_Imag48c7f0e5cc91f.flv&amp;backcolor=0x000000&amp;frontcolor=0xCCCCCC&amp;lightcolor=0x557722&amp;image=http://it-republik.de/develop/zonen/magazine/videos/pspic/screenshot/85/basta_scre48c7f0df707a2.jpg" height="192" width="235"></object></p>';
							
													
	if ($('video-start'))	{
		$('video-start').setHTML(video);	
	}									 
										 

function scrolling(init) 
	{		
		if ( $(init) != null) 
			{
				var scroller = new Fx.Scroll(window); 
				var el = $(init).getElements('a');
				var index=0;for (var i=0;i<=el.length-1;i++)
					{
						var element = el[i];
						$(element).addEvent('click', function(){						
							scroller.toElement(this.href.substring(this.href.lastIndexOf('#')+1,this.href.length));								
						});
					}
			}
	}

				

	// Tool Tips		

	scrolling('col3_anchors');
	var Tips1 = new Tips($$('.tooltip'));
	var Tips2 = new Tips($$('.tooltip_arrow'), { className: 'arrow'	});
		
	
	if ( $('nav') != null) 
		{										 
			//$('_1').addEvent('mouseover', function(){ hide(); layer(); $('nav_sub_1').setStyle('display', 'block');  });
			$('_2').addEvent('mouseover', function(){ hide(); layer(); $('nav_sub_2').setStyle('display', 'block'); });
			$('_3').addEvent('mouseover', function(){ hide(); layer(); $('nav_sub_3').setStyle('display', 'block'); });
			$('_4').addEvent('mouseover', function(){ hide(); layer(); $('nav_sub_4').setStyle('display', 'block'); });
 			$('_5').addEvent('mouseover', function(){ hide(); layer(); $('nav_sub_5').setStyle('display', 'block'); });
			$('_6').addEvent('mouseover', function(){ hide(); layer(); $('nav_sub_6').setStyle('display', 'block'); });				
			$('closer-bottom').addEvent('mouseover', function(){	hide();	});	
			$('closer-top').addEvent('mouseover', function(){	hide();	});	
			$('header-out').addEvent('mouseover', function(){	hide();	});	
			
			$('first').addEvent('mouseover', function(){	hide();	});	
			$('first').setStyle('cursor','pointer');
			
			
		}
	
	
			
	if ( $('feed-icon') != null) 
		{		
			$('feed-icon').addEvent('mouseover', function()	{	this.src='http://webinale.de/konferenzen/webinale08/img/layout/feed-active.png';	});				
			$('feed-icon').addEvent('mouseout', function()	{	this.src='http://webinale.de/konferenzen/webinale08/img/layout/feed-inactive.png';	});				
			$('blog-icon').addEvent('mouseover', function()	{	this.src='http://webinale.de/konferenzen/webinale08/img/layout/blog-active.png';	});				
			$('blog-icon').addEvent('mouseout', function()	{	this.src='http://webinale.de/konferenzen/webinale08/img/layout/blog-inactive.png';	});				
			$('flickr-icon').addEvent('mouseover', function(){	this.src='http://webinale.de/konferenzen/webinale08/img/layout/blog-active.png';	});				
			$('flickr-icon').addEvent('mouseout', function(){	this.src='http://webinale.de/konferenzen/webinale08/img/layout/blog-inactive.png';	});				
			$('speaker-icon').addEvent('mouseover', function(){	this.src='http://webinale.de/konferenzen/webinale08/img/layout/blog-active.png';	});				
			$('speaker-icon').addEvent('mouseout', function(){	this.src='http://webinale.de/konferenzen/webinale08/img/layout/blog-inactive.png';	});		
	}			
	
	if ( $('toplink') != null) 	
		{			                   
			$('toplink').addEvent('click', function() { scroller.toTop();  	}); 
		}		
		
		var scroller = new Fx.Scroll(window);   
		var el	=	$('col1_content').getElements('a[name=top]');		
		for (var i=0;i<=el.length-1;i++)	
				{
					var element	= el[i];	
					$(element).addEvent('click', function() { scroller.toTop();  	}); 					
				}

	
			
	if ( $('teaser-front') != null) 
		{			
			$('teaser-front').addEvent('mouseover', function(){	hide();	});
		}
			
	function layer() 
		{
			$('closer-top').setStyle('display', 'block');
			$('closer-bottom').setStyle('display', 'block');			
			
		}
		
	function hide() 
		{
			$('closer-bottom').setStyle('display', 'none');
		   	$('closer-top').setStyle('display', 'none');
			//$('nav_sub_1').setStyle('display', 'none');
			$('nav_sub_2').setStyle('display', 'none');
			$('nav_sub_3').setStyle('display', 'none');
			$('nav_sub_4').setStyle('display', 'none');
			$('nav_sub_5').setStyle('display', 'none');
			$('nav_sub_6').setStyle('display', 'none');			
			
			
		}

	
	if ( $('col3_video') != null) 
		{	
			var el = $('col3_video').getElements('div[class=item]');
			
			var index=0;for (var i=0;i<=el.length-1;i++)	
				{				
					$(el[i]).setStyle('cursor', 'pointer');
					$(el[i]).addEvent('click', function()
							{	
								var request		=	this.lang;
								var length		=	request.length;	
								var spans =	$ES('span',this);			
								$ES('h2','col1_content').setHTML(spans[1].innerHTML);											
								$ES('p','col1_content').setHTML(spans[2].innerHTML);
								
								
								if (request.contains('sevenload')) 
									{
										var seperator	= 	request.lastIndexOf('::');														
										var videoid		=	request.substring(seperator-7,seperator);
										var res			=	(request.substring(seperator,length)).replace("::", "");
										var width		=	res.substring(0,3);
										var height		=	res.substring(4,7);	
										sevenload(videoid, width, height);	
									}
								else if (request.contains('ownplayer'))
									{ 
										
										
										//alert(this.lang);
										var seperatorEins	= 	(request.indexOf('::'))+2;										
											url				=	request.substring(seperatorEins,length);
										var seperatorZwei	= 	url.lastIndexOf('::');											
											url				=	url.substring(0, seperatorZwei);										
										ownplayer(url);
										
									}				
									
									
									
								$('teaser-front').setStyle('visibility', 'hidden');		
								$('teaser-front').setStyle('height', height+'px');														
								$('video-close').setStyle('display', 'block');
								$('video-close').addEvent('click', function()
									{		
										$('video-box').setHTML(" ");										  
										$('teaser-front').setStyle('visibility', 'visible');	
										$('teaser-front').setStyle('height', '365px');
										$('video-close').setStyle('display', 'none');
									});	
							});	
				}		
		}
  
  
  if (location.hash	== '#flashback')
  	{
		ownplayer();
	}
	
	function ownplayer(url, width, height) 
		{
			var video	=	'<object wmode="transparent"><param name="wmode" value="transparent"/><param name="FlashVars" value="apiHost=api.sevenload.com"/><embed type="application/x-shockwave-flash" src="http://entwickler.de/zonen/magazine/videos/flvplayer.swf" style="" id="single" name="single" quality="high" allowfullscreen="true" flashvars="file='+url+'&amp;backcolor=0x000000&amp;frontcolor=0xCCCCCC&amp;lightcolor=0x557722&amp;image=http://entwickler.com/konferenzen/webinale08/flash/webinale07.jpg" height="370" width="575"></object>';
			$('video-box').setHTML(video);		
			
		}
		


	function sevenload(videoid, width, height) 
		{
			var video	=	'<object width="' + width + '" height="' + height + '" wmode="transparent"><param name="wmode" value="transparent"/><param name="FlashVars" value="apiHost=api.sevenload.com"/><param name="movie" value="http://de.sevenload.com/pl/' + videoid + '/500x403/swf" /><embed wmode="transparent" src="http://de.sevenload.com/pl/' + videoid + '/500x403/swf" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" allowfullscreen="true" FlashVars="apiHost=api.sevenload.com"></embed></object>';
			$('video-box').setHTML(video);
		}	
		

	if ( $('shortlinks') != null) 
		{ 
			$('shortlinks').injectInside('col3_content'); 
		}
		
	
		
		
		if ( $('bookmark') != null) 
			{ 
				if ( $('teaser-front') != null) 		
					{
						if ( $('map') != null) 
							{	
								$('bookmark').injectAfter('teaser-front');			
								$('bookmark').setStyle('position', 'absolute');
								$('bookmark').setStyle('top', '395px');
								$('bookmark').setStyle('left', '440px');	
							} 
						else
							{
								$('bookmark').injectAfter('teaser-front');			
								$('bookmark').setStyle('position', 'absolute');
								$('bookmark').setStyle('top', '42px');
								$('bookmark').setStyle('left', '440px');						
								
							}
					}
				if ( $('teaser-location') != null) 		
					{
						$('bookmark').injectAfter('teaser-location');			
						$('bookmark').setStyle('position', 'absolute');
						$('bookmark').setStyle('top', '395px');
						$('bookmark').setStyle('left', '440px');
					}

				}	


	 if (navigator.appName.indexOf("Explorer") != -1)
			{
				var col1Height	=	$('col1').getStyle('height');
				var col3Height	=	$('col3').getStyle('height');	
				col1Height	=	col1Height.replace('px','');
				col1Height	=	parseInt(col1Height);
				col3Height	=	col3Height.replace('px','');
				col3Height	=	parseInt(col3Height);	
				if (col1Height >= col3Height)
					{
				 		$('col3').setStyle('height', col1Height); 
					}
			
			}



	
window.addEvent('load', function() {
	
	
	if ( $('col3_video') != null) {		
		(function()
			{
				$('col3_video').effect('opacity', {duration: 100, transition: Fx.Transitions.linear}).start(0.0,1.0);
			}).delay(350);
	}
	

	
	if ( $('teaser-location') != null) {		
		(function()
			{
				$('teaser-location').effect('opacity', {duration: 1500, transition: Fx.Transitions.linear}).start(0.0,1.0);
			}).delay(10);
	}	




});

// PopUp Script //

var pop = null;

function popdown() {
  //if (pop && !pop.closed) pop.close();
}

function popup(obj,w,h) {
  var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href;
  if (!url) return true;
  w = (w) ? w += 20 : 150;  // 150px*150px is the default size
  h = (h) ? h += 25 : 150;
  var args = 'width='+w+',height='+h+',resizable,'+'scrollbars=yes';
  popdown();
  pop = window.open(url,'',args);
  return (pop) ? false : true;
}

window.onunload = popdown;
window.onfocus = popdown;


/**
 * adds the title (second h1-tag) at the end of the url in the link-object
 */
function addTitle(linkObj) {
	linkObj.href += document.getElementsByTagName("h2")[0].innerHTML;
}

function createOffer(type, highlight) 
	{

			$('item-table').empty();
			
			var offer		=	[''];			    
			offer[0]			=	[''];
			offer[0]['label']	=	'2-Tages Pass';	
			offer[0]['EbKr']	=	'629';
			offer[0]['Eb']		=	'699';
			offer[0]['Kr']		=	'719';			
			offer[0]['St']		=	'799';
			
			offer[1]			=	[''];
			offer[1]['label']	=	'Power Workshop Tag';	
			offer[1]['EbKr']	=	'299';
			offer[1]['Eb']		=	'349';
			offer[1]['Kr']		=	'349';			
			offer[1]['St']		=	'399';		
			
			offer[2]			=	[''];
			offer[2]['label']	=	'Startup Day';	
			offer[2]['EbKr']	=	'149';
			offer[2]['Eb']		=	'149';
			offer[2]['Kr']		=	'149';			
			offer[2]['St']		=	'149';					
			
			offer[3]			=	[''];
			offer[3]['label']	=	'Online-Marketing Day';	
			offer[3]['EbKr']	=	'299';
			offer[3]['Eb']		=	'349';
			offer[3]['Kr']		=	'349';			
			offer[3]['St']		=	'399';					
			
			offer[4]			=	[''];
			offer[4]['label']	=	'Web \'n\' Mobile Day';	
			offer[4]['EbKr']	=	'299';
			offer[4]['Eb']		=	'349';
			offer[4]['Kr']		=	'349';			
			offer[4]['St']		=	'399';			
			
			
			offer[5]			=	[''];
			offer[5]['label']	=	'Online-Recht Day';	
			offer[5]['EbKr']	=	'299';
			offer[5]['Eb']		=	'349';
			offer[5]['Kr']		=	'349';			
			offer[5]['St']		=	'399';					
			
			offer[6]			=	[''];
			offer[6]['label']	=	'RIA Day';	
			offer[6]['EbKr']	=	'299';
			offer[6]['Eb']		=	'349';
			offer[6]['Kr']		=	'349';			
			offer[6]['St']		=	'399';				
			
			
			// creat Table
			table		=	new Element('table');		
			tbody		=	new Element('tbody', {'id':'item-table-tbody'});			
		
			
			/* Running through the Array an write the right prices
				EbKr | Eb | Kr | St
				/    | x  | /  | x 	
				
				
				- create the Table Row and pass the elements
			*/
		
			for (index=0; index <= (offer.length-1); index++)
				{
					
					tr	=	new Element('tr');
					new Element('td', {'class':'offer-label'}).setText(offer[index]['label']).injectInside(tr);
					new Element('td').setText(' ').injectInside(tr);
					
					
					
					if (index != 1) 
						{	
							new Element('td', {'class':'offer-price-1'}).setText(offer[index][type] + ',00 €').injectInside(tr);
						} 
					else
						{
							new Element('td', {'class':'offer-price-1'}).setHTML('<div id="offer">gratis</div>').injectInside(tr);	
						}
					
					
					
					
					
					
					if (offer[index]['St'] != offer[index]['Eb']) 
						{
							new Element('td', {'class':'offer-price-2'}).setText(offer[index]['St'] + ',00 €').injectInside(tr);
						}
					else 
						{
							new Element('td', {'class':'offer-price-2'}).setText(' ').injectInside(tr);
						}
					
					
					tr.injectInside(tbody); 
				
				if (index == 1) 
					{	
						tr		=	new Element('tr');
						new Element('td').setText(' ').injectInside(tr);
						new Element('td').setText(' ').injectInside(tr);
						new Element('td').setText(' ').injectInside(tr);
						new Element('td').setText(' ').injectInside(tr);
						tr.injectInside(tbody);
					}						
				}
			
		

			$('registration-kollegen').onkeypress = function(event){				

					
				(function()	{	
							  if ($('registration-kollegen').value >= 3) 
								{ 
									$('registration-kollegen').setStyle('background-color','#86BB2F');
									$('image-kr').src='http://it-republik.de/cod/webinale/img/layout/checked.png';
									
									createOffer('EbKr', 1);	
								} 
							  else
							  	{
									createOffer('Eb');
									$('registration-kollegen').setStyle('background-color','#FF5200');	
									$('image-kr').src='http://it-republik.de/cod/webinale/img/layout/unchecked.png';
								}
							}).delay(1);
		
		
				};
		

			table.setProperty('cellpadding', '0');
			table.setProperty('cellspacing', '0');
			table.setProperty('border', '0');
			
			
			// Pass all Tablerows inside the Table
	
			
			tbody.injectInside(table); 
			// Inject it into Source
			table.injectInside('item-table');	
			
			
	}

			/**
			 * Browser Bookmark
			 */
		function addBookmark(title,url) {
			if( document.all ) {
			var add = 'BASTA! 2008 ' + document.getElementsByTagName("h1")[0].innerHTML;	
			window.external.AddFavorite( url, add);
			}
			else if (window.sidebar) {		
			var add = 'BASTA! 2008 > ' + document.getElementsByTagName("h1")[0].innerHTML;	
			window.sidebar.addPanel(add, url,""); 
			} 
			else if( window.opera && window.print ) {
			return true;
			}
		}
		
});