$(document).ready(function()
{
    $('#nav').jmenu({animation:'fade',duration:50});

	setupPlaceholder('khuddr-khuddr');
	setupPlaceholder('Surname');
	setupPlaceholder('CompanyName');
	

});

	function setupPlaceholder(inputid) {
		if ($.browser.webkit) return false;
	 
		var target = $('#'+inputid);
		if (target.length==0) {
			target = $('input[type="text"], input[type="email"], input[type="search"]');
		}
	 
		target.each( function(i, el) {
			el = $(el);
			var ph = el.attr('placeholder');
			if (!ph) return true;
	 
			el.addClass('placeholder');
			el.attr('value', ph);
	 
			el.focus( function(e) {
				if( el.val()==ph ) {
					el.removeClass('placeholder');
					el.attr('value', '');
				}
			});
	 
			el.blur( function(e) {
				if( $.trim(el.val())=='' ) {
					el.addClass('placeholder');
					el.attr('value', ph);
				}
			});
		});
	}

function goPage(url){
	window.location=url;
}

function initialize() {
  var myOptions = {
    zoom: 9,
    center: new google.maps.LatLng(50.278809,-5.092163),
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  setMarkers(map, events);
}

function setMarkers(map, locations) {
  var image = new google.maps.MarkerImage('/images/layout/calendar-location-blue.png',
      new google.maps.Size(18, 29),
      new google.maps.Point(0,0),
      new google.maps.Point(18, 29));
  var shadow = new google.maps.MarkerImage('/images/layout/calendar-location-shadow.png',
      new google.maps.Size(27, 29),
      new google.maps.Point(0,0),
      new google.maps.Point(18, 29));
  var shape = {
      coord: [1, 1, 1, 20, 18, 20, 18 , 1],
      type: 'poly'
  };
	for (var i = 0; i < locations.length; i++) {
            var events = locations[i];
            var myLatLng = new google.maps.LatLng(events[1], events[2]);
            var marker = new google.maps.Marker({
                position: myLatLng,
				map: map,
				shadow: shadow,
				icon: image,
				shape: shape,
				title: events[0],
				zIndex: events[3],
				html: events[4]
            });
			
			if(events[4] != ''){
				google.maps.event.addListener(marker, "click", function () {
					goPage(this.html);
				});
			}else{
				google.maps.event.addListener(marker, "click", function () {
					map.setCenter(this.getPosition()); 
					map.setZoom(12); 
				});
			}
            
        }
}
