function mywrite(flash)
{
//	alert(flash);
	document.write(flash)
}

function mainPage()
{
	window.location.href="index.php";
	return false;
}

function $(name)
{
	obj =  document.getElementById(name);
	return obj;
}

function ShowHide(id)
{
//	alert
	if ($(id).style.display == "none")
		$(id).style.display = "block"
	else
		$(id).style.display = "none";
}

function SetValue(id, value)
{
	 $("input_"+id).innerHTML = value;
	 $("select_"+id).style.display = "none";
}




function Nadpisz(obj, value)
{
	 $(obj).innerHTML = value;
}

function PrintPage()
{
	window.print();
}



function CheckEMail(address) {
	return address != "" 	&& address.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/);	
}


var podaj_imie = "";
var podaj_email = "";
var podaj_poprawnie_email = "";
var podaj_tresc = "";

function checkKontakt()
{


	if (!$("nazwisko").value)
	{
		alert(podaj_imie);
		$("nazwisko").focus();
		return false;
	}


	if (!$("email").value && !$("telefon").value)
	{
		alert(podaj_email);
		f.email.focus();
		return false;
	}


	if ($("email").value && !CheckEMail($("email").value))
	{
		alert(podaj_poprawnie_email);
		$("email").focus();
		return false;
	}


	if (!$("tresc").value)
	{
		alert(podaj_tresc);
		$("tresc").focus();
		return false;
	}

	return true;
}





function checkKontakt()
{


	if (!$("email").value)
	{
		alert(podaj_email);
		f.email.focus();
		return false;
	}


	if ($("email").value && !CheckEMail($("email").value))
	{
		alert(podaj_poprawnie_email);
		$("email").focus();
		return false;
	}


	if (!$("adresat").value || $("adresat").value.indexOf("@")<1)
	{
		alert(podaj_adresata);
		$("adresat").focus();
		return false;
	}

	return true;
}




function wnd(file, s, w)
{
	wys = w + 5;
	szer = s + 25;

	  if(window.screen){
		aw=screen.availWidth;
		ah=screen.availHeight;
	  }else{
		aw=640;
		ah=450;
	  }

	var win = window.open(file,"zoom","width="+szer+", height="+wys+", left="+(aw-szer)/2+", top="+ (ah-wys)/2+", titlebar=no, status=no, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=yes, fullscreen=no");
	win.focus();

}




function flex_showmenu(object)
{
	var start  = $("s_start_"+object);
	var poz  = $("s_poz_"+object);
	var menuobj = $("s_menu_"+object);
	
	if (start) start.className=start.className +' sel_start';
//	if (poz) poz.className='sel';
	if (menuobj) menuobj.style.display = "block";
//	alert("menu_"+object);

	return false
}

function flex_hidemenu(object)
{

	var start  = $("s_start_"+object);
	var poz  = $("s_poz_"+object);
	var menuobj = $("s_menu_"+object);


	if (start) start.className = start.className.replace(' sel_start', '');
//	if (poz) poz.className='';
	if (menuobj) menuobj.style.display = "none";

}






var lat_all = new Array();
var lng_all = new Array();
var name_all = new Array();
var opis_all = new Array();


function Show()
{

		map = new GMap2($("mapa"));
		map.setCenter(new GLatLng(50, 13), 5);
		var customUI = map.getDefaultUI();
		customUI.controls.maptypes = true;
		customUI.maptypes.hybrid = true;
		customUI.maptypes.satellite = true;
		customUI.maptypes.physical  = true;
		map.setUI(customUI);
//		map.setMapType(G_HYBRID_MAP);

		
		// Deklaracja ikonek
		var ikona0 = new GIcon();   
		ikona0.image = "images/google.png";   
		ikona0.shadow = "";//"images/blue-pushpin-s.png";   
		ikona0.iconSize = new GSize(146, 57);
		ikona0.shadowSize = new GSize(59, 32); 
		ikona0.infoWindowAnchor = new GPoint(25,50);   
		ikona0.iconAnchor = new GPoint(25,50);   


		//Skalowanie obszaru
		var obszar = new GLatLngBounds();  


		var punkty = new Array();
		var markery = new Array();


    	function createMarker(point, info, title, icon) {   
          var marker = new GMarker(point, {title: title, icon: icon});   
          GEvent.addListener(marker, "click", function() {   
            marker.openInfoWindowHtml(info);//   ,{maxWidth:400}
          });   
          return marker;   
        } 
		
		
		punkty[0] = new GLatLng(lat_all[0], lng_all[0]);
		marker = createMarker(punkty[0], opis_all[0], name_all[0],ikona0);
		map.addOverlay(marker);
		//marker.openInfoWindowHtml(opis_all[0]); 
		obszar.extend(punkty[0]);  	
		

		var nowyZoom = map.getBoundsZoomLevel(obszar);  
		var nowyZoom = 13;
		var nowyPunkt = obszar.getCenter();   
		map.setCenter(nowyPunkt,nowyZoom);  
	
	
	}



function setashome(){
	document.body.style.behavior='url(#default#homepage)';
	document.body.setHomePage('http://www.adampol.com.pl');
}


