/******************************************************************************
 *
 * Purpose: IAL plugin
 * Author:  Thomas Raffin, SIRAP
 *
 ******************************************************************************
 *
 * Copyright (c) 2007 SIRAP
 *
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. See the COPYING file.
 *
 * The software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with p.mapper; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 ******************************************************************************/

$.extend(PM.Map,
{
	// click map : IAL batiment
	sirap_ial_bati_start: function(imgxy) {
		PM.Plugin.SirapIAL.sirap_ial_start(imgxy);
	},
	
	// click map : IAL parcelle
	sirap_ial_parc_start: function(imgxy) {
		PM.Plugin.SirapIAL.sirap_ial_start(imgxy);
	},
	
	// click map : IAL commune
	sirap_ial_com_start: function(imgxy) {
		PM.Plugin.SirapIAL.sirap_ial_start(imgxy); 
	}
});


$.extend(PM.Plugin,
{
	SirapIAL:
    {
		// click bouton: IAL batiment
		bati_click: function() {
			sirap_generic_click('sirap_ial_bati', 'click', 'sirap_ial_bati', 'sirap_ial_bati_help');
		},
	
		// click bouton: IAL parcelle
		parc_click: function() {
			sirap_generic_click('sirap_ial_parc', 'click', 'sirap_ial_parc', 'sirap_ial_parc_help');
		},
		
		// click bouton: IAL commune
		com_click: function() {
			sirap_generic_click('sirap_ial_com', 'click', 'sirap_ial_com', 'sirap_ial_com_help');
		},
		
		// click map: IAL generic
		sirap_ial_start: function(imgxy) {
			var ialtype = PM.Map.mode;
		    var pixccoords = imgxy.split('+');
		    var pixX = pixccoords[0];
		    var pixY = pixccoords[1];
		
			var urlcalc = PM_PLUGIN_LOCATION + '/sirap_ial/ial.phtml?' + SID + '&mode=iquery' + '&ialtype=' + ialtype + '&imgxy=' + pixX + '+' + pixY;
			openResultwin(urlcalc);
		}	
    }
});
