//lightbox franka
function obraz(src,tytul)
{
$('#obraz').css('top',$(document).scrollTop()+20+'px').show();
$('#obraz h1').html(tytul);
$('#obraz .obraz_src').hide().attr('src',src);
$('#obraz h1,#obraz h2').hide();
$('#obraz .czekaj').show();
$('#obraz .obraz_src').one('load',function()
	{	$('#obraz .czekaj').hide();$('#obraz h1,#obraz h2').show();$('#obraz').height($('#obraz .obraz_src').height());$('#obraz').width($('#obraz .obraz_src').width());$('#obraz .obraz_src').fadeIn(500);});
}

//pokazywanie obrazka bez efektów
function publikacja(img_src)
{obraz(img_src,'');}

function pokaz_reklame_pl()
{obraz('euro_gfx/reklamy/nsi_pokaz_2010_pl.jpg','Pokaz szkoleniowy NSI');}

function pokaz_reklame_en()
{publikacja('euro_gfx/reklamy/nsi_pokaz_2010_eng.jpg','NSI - demo-workshop-seminar');}

function pokaz_reklame2()
{obraz('euro_gfx/reklamy/nail_art_poland_2010.jpg','Nail Art Poland 2010');}

function pokaz_reklame3()
{document.location='http://forum-ef.pl/viewtopic.php?t=13343';}

//sprawdzenie danych txt
function sprawdz_txt(dane)
{
wyj=false;
if($(dane).val().length>0)
	{
	if(dane=='form[name=powiad] input[name=mail_news]')
		{
		var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
		if(regex.test($(dane).val())) {if(confirm(regulka)) wyj=true;else wyj=false;} 
		}
	else wyj=true;	
	}
if(wyj) $(dane).removeClass('err');else $(dane).addClass('err');
return wyj;
}	
//rotator
function rotator(baner)
{
if($('img').hasClass('rotator'))
	{
	baner=baner>1?0:baner;
	var img_src='';
	switch(baner)
		{
		case 0:
			img_src='promocja_szkolenia.jpg';
			$('img.rotator').click(function() {document.location='http://www.eurofashion.com.pl/pl/szkolenia';});
			break;
		case 1:
			img_src='promocje_ap_mini.jpg';
			$('img.rotator').click(function() {obraz($(this).attr('src').slice(0,-9)+'.jpg',$(this).attr('alt'));});
			break;
		default:baner=0;
		}
	var tab_img=$('img.rotator').attr('src').split('/');
	tab_img[tab_img.length-1]=img_src;
	$('img.rotator').css('opacity',0);
	$('img.rotator').attr('src',tab_img.join('/'));
	$('img.rotator').load(function() {$('img.rotator').css('opacity',1);});
	baner++;
	setTimeout("rotator("+baner+")",5000);
	}
}

	
//zdarzenia
$(document).ready(function()
	{
//form newslettera
	$('form[name=powiad]').submit(function() {if(sprawdz_txt('form[name=powiad] input[name=mail_news]')) return true;else return false;});
	$('form[name=powiad] input[name=mail_news]').focus(function() {$(this).val('');});
	$('form[name=powiad] input[name=mail_news]').blur(function() {if($(this).val().length==0) $(this).val(mail_tekst);});
//ramki zaokrąglone
	$('.ramka').each(function()	{$(this).before('<div class="gora_l"></div><div class="gora"></div><div class="gora_p"></div>').after('<div class="dol_l"></div><div class="dol"></div><div class="dol_p"></div>');});
//menu główne
	$('#menu_glowne li').hover(function() {$(this).find('ul').stop(false,true).fadeIn(200);},function() {$(this).find('ul').stop(false,true).fadeOut(200);});
//video	
	$('.video').click(function()	{window.open($(this).attr('longdesc'),'TV',"toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=no, copyhistory=no, width=300, height=250, top=100, left=100");});
//obrazek lightboxa
	$('.obraz_duzy').drag(function(event) {var x=event.offsetX<0?0:event.offsetX;var y=event.offsetY<0?0:event.offsetY;$(this).css({top:y,left:x});});
	$('.obraz_duzy').find('.obraz_src').click(function() {$(this).fadeOut(300,function() {$('#obraz').hide();});});
	$('.obraz_duzy').find('h2').click(function() {$(this).parent().fadeOut(300,function() {$(this).hide();});});
//mapa pogody
	$('.mapa_pogody').click(function() {obraz($(this).attr('longdesc'),$(this).attr('alt'));});
//reklamy
	$('.ramka img.reklama_img').click(function() {obraz($(this).attr('src').slice(0,-9)+'.jpg',$(this).attr('alt'));});
//pasek facebooka
	$('#fb_ramka').hover(function(){$(this).stop(true, false).animate({right:0},"medium");},function() {$(this).stop(true, false).animate({right:"-200"},"medium")});
//zmieniacz banerów
	//rotator(0);
	});


