$(document).ready(function() {
  
  $('#prompt').bind('click', function(){
		$.prompt('Example 1');
	});

/*----*/	   
  if ($("input[@name=weight]").val() == ''){
	 $('#l_weight').addClass('show');
	 	$('#weight').bind('blur',function(){
		if (this.value == '')
			$('#l_weight').show();	
  	});
  	
  	$('#weight').focus(function(){
     $('#l_weight').hide();	
    });
	}else{
    $('#l_weight').hide();	
  } 
/*--------*/
  if ($("input[@name=height]").val() == ''){
	 $('#l_height').addClass('show');  	
	 	$('#height').bind('blur',function(){
		if (this.value == '')
			$('#l_height').show();	
  	});
  	
  	$('#height').focus(function(){
     $('#l_height').hide();	
    });
	}else{
	  $('#l_height').hide();	
  } 
/*------*/

  if ($("input[@name=name]").val() == ''){
  
  	 $('#l_name').addClass('show');
  	 	$('#name').bind('blur',function(){
  		if (this.value == '')
  			$('#l_name').show();	
  	});
  	
  	$('#name').focus(function(){
     $('#l_name').hide();	
    });
  }else{
    $('#l_name').hide();
  }
 /*-----------*/
 
    
  if ($('#name2').val() == ''){
	 $('#l_name2').addClass('show');
	 	$('#name2').bind('blur',function(){
		if (this.value == '')
			$('#l_name2').show();	
  	});
  	
    $('#name2').focus(function(){
     $('#l_name2').hide();	
    });
	}else{
	  $('#l_name2').hide();
  } 
   
/*------*/

  if ($('#name3').val() == ''){
	 $('#l_name3').addClass('show');
	 	$('#name3').bind('blur',function(){
		if (this.value == '')
			$('#l_name3').show();	
  	});
  	
    $('#name3').focus(function(){
     $('#l_name3').hide();	
    });
	}else{
	  $('#l_name3').hide();
  } 
  
/*----------*/

  if ($('#name4').val() == ''){
	 $('#l_name4').addClass('show');
	 	$('#name4').bind('blur',function(){
		if (this.value == '')
			$('#l_name4').show();	
  	});
  	
    $('#name4').focus(function(){
     $('#l_name4').hide();	
    });
	}else{
	  $('#l_name4').hide();
  }
/*-----------*/

  if ($("input[@name=email]").val() == ''){
	 $('#l_email').addClass('show');
	 	$('#email').bind('blur',function(){
		if (this.value == '')
			$('#l_email').show();	
  	});
  	
  	$('#email').focus(function(){
     $('#l_email').hide();	
    });
	}else{
    $('#l_email').hide();
  } 
/*-----------*/


  if ($('#email2').val() == ''){
	 $('#l_email2').addClass('show');
	 	$('#email2').bind('blur',function(){
		if (this.value == '')
			$('#l_email2').show();	
  	});
  	
  	$('#email2').focus(function(){
     $('#l_email2').hide();	
    });
	}else{
    $('#l_email2').hide();
  } 
/*-----------*/

  if ($('#email3').val() == ''){
	 $('#l_email3').addClass('show');
	 	$('#email3').bind('blur',function(){
		if (this.value == '')
			$('#l_email3').show();	
  	});
  	
  	$('#email3').focus(function(){
     $('#l_email3').hide();	
    });
	}else{
    $('#l_email3').hide();
  } 
/*-----------*/

  if ($('#email4').val() == ''){
	 $('#l_email4').addClass('show');
	 	$('#email4').bind('blur',function(){
		if (this.value == '')
			$('#l_email4').show();	
  	});
  	
  	$('#email4').focus(function(){
     $('#l_email4').hide();	
    });
	}else{
    $('#l_email4').hide();
  } 
/*-----------*/

  if ($("input[@name=phone]").val() == ''){
	 $('#l_phone').addClass('show');
	   $('#phone').bind('blur',function(){
		if (this.value == '')
			$('#l_phone').show();	
  	});
  	
    $('#phone').focus(function(){
     $('#l_phone').hide();	
    });
  }else{
      $('#l_phone').hide();
  }
  	
/*--*/

  if ($("input[@name=date]").val() == ''){
	 $('#l_date').addClass('show');
	 	$('#date').bind('blur',function(){
		if (this.value == '')
			$('#l_date').show();	
  	});
  	
    $('#date').focus(function(){
     $('#l_date').hide();	
    });
	}else{
	  $('#l_date').hide();
  } 
/*------------*/   	 

	if ($("textarea[@name=body]").val() == ''){
	 $('#l_body').addClass('show');
	 	$('#body').bind('blur',function(){
		if (this.value == '')
			$('#l_body').show();	
  	});
  	
    $('#body').focus(function(){
     $('#l_body').hide();	
    });
	}else{
	  $('#l_body').hide();
  } 
 /*------*/

	$('label.show').bind('click', function(){
		$(this).hide();
	});

/*-----*/
  $('table div.hide').hide();
  $('table a.show').bind('click', function(){
    var elementClicked = this.hash;
    if($(this).hasClass('selected')){
      $(this).removeClass('selected');
      $(elementClicked).slideUp();
    }else{
      $('table div.hide').hide();
      $('table a.show').removeClass('selected');
      $(this).addClass('selected');
      $(elementClicked).slideDown();
    }
    return false;
   
  });
 
  
});



/* ------------------------ GMAPS ---------------------------------------- */


//var side_bar_html = "";
var map ;

function createMarker(point, number , icon ) 
{  
	var marker = new GMarker(point,icon);  
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(number);
	});

	return marker;
}

function load_map(lat, lng, zoom) {
	if (GBrowserIsCompatible()) {

		
    	var map = new GMap2(document.getElementById("map"),
								{ size:new GSize(425,350),
								     draggableCursor:"move",
								     draggingCursor:"crosshair"
								} 
							);   

    	map.enableScrollWheelZoom(); 
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.addControl(new GOverviewMapControl());
		
		    	map.setCenter(new GLatLng(lat, lng), zoom); 

   
		map.hideControls();  
		GEvent.addListener(map, "mouseover", function(){map.showControls();});  
		GEvent.addListener(map, "mouseout", function(){map.hideControls();});  
		
				
		var point = new GLatLng(lat, lng); 


		var icon = new GIcon();  				
		icon.image = "/images/frontend/marker.png";			
    				 
				icon.iconSize = new GSize(66, 78);
				icon.iconAnchor = new GPoint(33, 78);
				icon.infoWindowAnchor = new GPoint(33, 78);
		
               
		var marker	=	createMarker (point, 'Poradnia dietetyczna Food & Diet<br>ul. Pasaż Ursynowski  7 lok. 64<br>02-784 Warszawa', icon );
		map.setCenter(point, zoom);
		map.addOverlay(marker);
	}
}


function GUload(lat, lng, zoom, marker) 
{ 
    if (GBrowserIsCompatible()) 
	{ 
    	 map = new GMap2(document.getElementById("map")); 
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.addControl(new GMapTypeControl());
		map.addControl(new GOverviewMapControl());
      	map.setCenter(new GLatLng(lat, lng), zoom);
		
		if (marker)
		{
			var point = new GLatLng(lat, lng);  
			var marker = new GMarker(point); 
			map.addOverlay(marker);
		}
    } 
}



