
document.oncontextmenu=new Function("return false");






function mapaStart()     
{    
    if(GBrowserIsCompatible())  // sprawdzamy, czy przegl�darka jest kompatybilna     
    {    
    	var map = new GMap2(document.getElementById("map_canvas"));
    	var center = new GLatLng(52.318173,20.949705);
    	map.setCenter(center, 15);

        var mapControl = new GMapTypeControl();
        map.addControl(mapControl);
        map.addControl(new GLargeMapControl());

        var marker = new GMarker(center, {draggable: false});

        GEvent.addListener(marker, "dragstart", function() {
        	map.closeInfoWindow();  
        	});
        GEvent.addListener(marker, "click", function() {
        	marker.openInfoWindowHtml("<h3>Magiczny Świat Dziecka</h3><br>Warszawa - Białołęka<br>Osiedle Leliwitów<br>03-128, Warszawa<br>ul. Świderska 104/2");
        	});

        map.addOverlay(marker);
        
    }     
    
}

//najazd textu
var delay=40;
var nextm=0;

var msg=new Array
	('Już od 4 maja zapraszamy dzieci w wieku 1-4 lat',
	'Liczba miejsc ograniczona');

function start_ticker()
{
	do_ticker(msg[0], 0, 1);
}

function do_ticker(text, pos, dir)
{
	var out='<font face="Arial, Helvetica" color=darkyellow size="3px">[ <font color=red><strong>'+text.substring(0, pos)+'</font></font></strong> ]</font>';
	if(navigator.appName=="Netscape")
	//with(document.ticker.document)
	with(document.getElementById('ticker').document)
	{
		open(); 
		write(out); 
		close();
	}
	else
		ticker.innerHTML=out;

	pos+=dir;

	if(pos>text.length)
		setTimeout('do_ticker("'+text+'",'+pos+','+(-dir)+')', delay*10);
	else
	{
		if(pos<0)
		{
			if(++nextm>=msg.length)
				nextm=0;
				text=msg[nextm];
				dir=-dir;
		}
		setTimeout('do_ticker("'+text+'",'+pos+','+dir+')', delay);
	}
}



//Przyciemnianie tekstu


nereidFadeObjects = new Object();
nereidFadeTimers = new Object();



function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){  //do this so I can take a string too
        setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }
        
    clearTimeout(nereidFadeTimers[object.sourceIndex]);
    //alert(object.filters.alpha.opacity);
    diff = destOp-object.filters.alpha.opacity;
    
    direction = 1;
   
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;

    if (object.filters.alpha.opacity != destOp){
        nereidFadeObjects[object.sourceIndex]=object;
        nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}





//Funkcja �aduj�ca skrypty - onload
function function_Load()
{ 
	  if(document.getElementById("map_canvas")!=null)
	  {
		  mapaStart();		  
	  }  
	  //if(document.getElementById("ticker")!=null)
	  //{
		  //start_ticker();
		  
	  //}	
	
}






//walidacja

function error(tekst) {
	if (errfound) return;
		//window.alert(tekst);
	elem=document.getElementById('err').value=tekst;
errfound = true;
return ;
}
function validate(typ) {
	errfound = false;
	var bledy = "";
	
	if(typ=="zgl")
	{
		
		var color="#ffff66";
		
		with (document.forms[0]) {
			//imie_r.style.backgroundColor=color;
			//nazwisko_r.style.backgroundColor=color;
			//imie_d.style.backgroundColor=color;	
			//email.style.backgroundColor=color;
			//telefon.style.backgroundColor=color;
			//data.style.backgroundColor=color;
			//info.style.backgroundColor=color;
			if (trim(imie_r.value) == "")
			{
				bledy += "Proszę uzupełnić pole Imię rodzica. \n";			
				imie_r.style.backgroundColor="#eac49f";
			}
			else
			{
				if(imie_r.value.length>30) bledy += "Przekroczona liczba znaków w polu Imię rodzica. \n";
				imie_r.style.backgroundColor="#eac49f";
			}
			if (trim(nazwisko_r.value) == "")
			{			
				bledy += "Proszę uzupełnić pole Nazwisko rodzica.\n";
				nazwisko_r.style.backgroundColor="#eac49f";
			}
			else
			{
				if(nazwisko_r.value.length>50) bledy += "Przekroczona liczba znaków w polu Imię rodzica. \n";
				nazwisko_r.style.backgroundColor="#eac49f";
			}
	        if (trim(email.value)=="" && trim(telefon.value)=="") 
	        {
	        	bledy += "Proszę podać kontakt - telefon lub mail\n";
	        	email.style.backgroundColor="#eac49f";
	        	telefon.style.backgroundColor="#eac49f";
	        }
	        if (trim(email.value)=="" && trim(telefon.value)!="")
	        {
	        	if(telefon.value.length>20) 
	        		{
	        			bledy += "Przekroczona liczba znaków w polu telefon. \n";
	        			telefon.style.backgroundColor="#eac49f";
	        		}
	        }
	        if (trim(email.value)!="" && trim(telefon.value)=="")
	        {
	        	if(email.value.length>80) 
	        	{
	        		bledy += "Przekroczona liczba znaków w polu e-mail. \n";
	        		email.style.backgroundColor="#eac49f";
	        	}
	        }
	        if (trim(imie_d.value) == "")
	        {
	        	bledy += "Proszę uzupełnić pole Imię dziecka. \n";
	        	imie_d.style.backgroundColor="#eac49f";
	        }
	        else
	        {
	        	if(imie_d.value.length>30) bledy += "Przekroczona liczba znaków w polu Imię dziecka. \n";		
	        	imie_d.style.backgroundColor="#eac49f";
	        }
	        if (trim(data.value) == "") 
	        {
	        	bledy += "Proszę uzupełnić pole data urodzenia dziecka. \n";
	        	data.style.backgroundColor="#eac49f";
	        }
	        if(info.value.length>500)  
	        {
	        	bledy += "Przekroczona liczba znaków w polu dodatkowe informacje \n";
	        	info.style.backgroundColor="#eac49f";
	        }
	        
			if (bledy != "")  error(bledy); 
		}
		return !errfound;
	}
	
	if(typ=='form')
	{
		
		with (document.forms[0]) 
		{
			
			
			if(trim(imie_nazwisko.value)=="")  
	        {
				bledy +="- Wypełnić imię i nazwisko\n";
	        }
			if(trim(email.value)=="" && trim(telefon.value)=="")  
	        {
				bledy +="- Wypełnij co najmniej jeden z możliwych kontaktów: telefon lub e-mail\n";
	        }
			if(trim(info.value)=="")
			{
				bledy +="- Wprowadź treść wiadomości\n";	
			}
			if(kopia.checked == true && email.value=="" )				
			{
				bledy +="- Aby otrzymać kopię wiadomości, wprowadź adres e-mail\n";
			}
			
		}
		if (bledy != "")
		{
			errfound = true;
			alert("Formularz jest niekompletny. Proszę wprowadzić wymagane dane:\n\n"+bledy);
			return !errfound;		
		}
	}
	
}

function trim(string)
{
    return string.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}



//kalendarz
/*
var cal_obj2 = null;

//var format = '%j %M %Y %H:%i';
var format = '%j %M %Y';
 
// show calendar
function show_cal(el) {

	if (cal_obj2) return;
 
var text_field = document.getElementById("data");

	cal_obj2 = new RichCalendar();
	
	cal_obj2.start_week_day = 2;
	cal_obj2.show_time = true;
	cal_obj2.language = 'en';
	
	cal_obj2.user_onchange_handler = cal2_on_change;
	cal_obj2.user_onclose_handler = cal2_on_close;
	cal_obj2.user_onautoclose_handler = cal2_on_autoclose;
	
	cal_obj2.parse_date(text_field.value, format);
	
	cal_obj2.show_at_element(text_field, "adj_right-top");
	cal_obj2.change_skin('alt');
	
}
 
// user defined onchange handler
function cal2_on_change(cal, object_code) {
	if (object_code == 'day') {
		document.getElementById("data").value = cal.get_formatted_date(format);
		cal.hide();
		cal_obj2 = null;
	}
}
 
// user defined onclose handler (used in pop-up mode - when auto_close is true)

function cal2_on_close(cal) {
	if (window.confirm('Are you sure to close the calendar?')) {
		cal.hide();
		cal_obj2 = null;
	}
}
 
// user defined onautoclose handler
function cal2_on_autoclose(cal) {
	cal_obj2 = null;
}
*/


var menuids=["sidebarmenu1"] //Enter id(s) of each Side Bar Menu's main UL, separated by commas

             function initsidebarmenu(){
             for (var i=0; i<menuids.length; i++){
               var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
                 for (var t=0; t<ultags.length; t++){
                 ultags[t].parentNode.getElementsByTagName("a")[0].className+=" subfolderstyle"
               if (ultags[t].parentNode.parentNode.id==menuids[i]) //if this is a first level submenu
                ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
               else //else if this is a sub level submenu (ul)
                 ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
                 ultags[t].parentNode.onmouseover=function(){
                 this.getElementsByTagName("ul")[0].style.display="block"
                 }
                 ultags[t].parentNode.onmouseout=function(){
                 this.getElementsByTagName("ul")[0].style.display="none"
                 }
                 }
               for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
               ultags[t].style.visibility="visible"
               ultags[t].style.display="none"
               }
               }
             }

             if (window.addEventListener)
             window.addEventListener("load", initsidebarmenu, false)
             else if (window.attachEvent)
             window.attachEvent("onload", initsidebarmenu)



