﻿var host = 'http://www.delfin.szczecin.pl';
var lang = '1';

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


new SmoothScroll({ duration:700 });



if($('input_email')) {
$('input_email').addEvent('focus', function(e){ $('input_email').value='';});
$('input_name').addEvent('focus', function(e){ $('input_name').value='';});

$('newsletter_form').addEvent('submit', function(e){ 
	new Event(e).stop();
	
	var req = new Request.HTML({
		method: 'post',
		url: host +"/newsletter.php",
		data: 'email=' + $('input_email').value + '&name=' + $('input_name').value,
		update: $('newsletter_div')
	}).send();

});
}


if($('menu')) {

	var tabs_li_a = $$('ul#menu li a');
	var tabs_li_span = $$('ul#menu li a span');

	tabs_li_a.each(function(ele, k){

			ele.addEvent('mouseover', function(e){
				tabs_li_span[k].tween('padding-left', '20px');
			});

			ele.addEvent('mouseout', function(e){
				tabs_li_span[k].tween('padding-left', '0px');
			});
			
	});
}



if($('tabs')) {

	var tabs_li_a = $$('ul#tablist li a');
	var tabs_li = $$('ul#tablist li');

	tabs_li_a.each(function(ele, k){
			ele.addEvent('click', function(e){
				new Event(e).stop();
				
				value = tabs_li_a[k].getProperty('id');

//				if(tabs_li_a[k].getProperty('id')=='tab1') $('tabs').setProperty('class', 'tab1');

				$('tabs').setProperty('class', value);

				tabs_li.each(function(ele2, j){
					ele2.removeProperty('class');  
				});

				tabs_li[k].setProperty('class', 'active');

				var req = new Request.HTML({
					method: 'post',
					url: host +"/controller.php",
					data: 'mod='+value + '&lang='+lang,
					update: $('tab_content')

				}).send();


			});
	});
}




});
		

