
var formlocked=false;

function resultAjax(formid, ajaxURL) {
	$('#'+formid).submit(function() {
		if (!formlocked) {
			formlocked=true;
			$('#result').hide().removeClass("resultOK").html('<div class="ajaxLoading"></div>').show();
			$.ajax({
				type: "GET",
				url: ajaxURL,
				data: $('#'+formid).serialize(),
				success: function(resultHTML){
					$('#result').hide().addClass("resultOK").html(resultHTML).slideDown(500);
					formlocked=false;
				}
			});
		}
		return false;
	});
}

function selectAll(el) {
	$("#"+el.id).focus();
	$("#"+el.id).select();
}

function qrcodeActions() {
	$(".actions_hide").each(function() {
		$("#"+this.id).hide();
	});
	var show=$("#action").val();
	$(".actions_"+show).each(function() {
		$("#"+this.id).show();
	});
}

function activateGoogleMaps() {
	var zoom=1;
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("editgooglemap"));
		map.enableDragging();
  	if ($('#action_gpslat').val()!='' && $('#action_gpslon').val()!='') {
  		var temppoint=new GLatLng(jQuery('#action_gpslat').val(), jQuery('#action_gpslon').val());
  		map.setCenter(temppoint, zoom);
  		
  		//marker
  		point=new GLatLng(jQuery('#action_gpslat').val(), jQuery('#action_gpslon').val());
			marker = new GMarker(point, {draggable: true});
			marker.enableDragging();
			GEvent.addListener(marker, "dragend", function() {
			  var temppoint = marker.getLatLng();
				$('#action_gpslat').val(temppoint.y);
				$('#action_gpslon').val(temppoint.x);
				map.setCenter(temppoint);
			});
			map.addOverlay(marker);
  		map.checkResize();
  		
  		markerSet=true;
  		
  		map.setUIToDefault();
  		map.setMapType(G_HYBRID_MAP);
  		map.checkResize();
  	}
	}
}