function Map(mapCols, mapRows, mapQuadrantWidth, mapQuadrantHeight, quadrantCoordsList) {
	
	// variables
	this.mapCols = mapCols;
	this.mapRows = mapRows;
	this.mapQuadrantWidth = mapQuadrantWidth;
	this.mapQuadrantHeight = mapQuadrantHeight;
	this.quadrantCoordsList = quadrantCoordsList;
	this.cssUnit = "px";

	// public methods
	Map.prototype.getQuadrantBackgroundPositionCss = function(quadrantTitle) {
		
		var thisquadrantTitle= quadrantTitle;
		
		return parseInt(getPositionX(this.mapQuadrantWidth,this.quadrantCoordsList[thisquadrantTitle]["x"])) + this.cssUnit + ' ' + parseInt(getPositionY(this.mapQuadrantHeight,this.quadrantCoordsList[thisquadrantTitle]["y"])) + this.cssUnit;
	
	};
	
	// private methods
	function getPositionX(width,x) {
	
		return (x < 2) ? 0 : (x - 1) * width * (-1);
	
	};

	function getPositionY(height,y) {
	
		return (y < 2) ? 0 : (y - 1) * height * (-1);
	
	};	

};


var quadrantCoordsList = {

	praha : {
		x : 2,
		y : 1
	},
	
	stredocesky : {
		x : 3,
		y : 1
	},
	
	karlovarsky : {
		x : 1,
		y : 2
	},	
	
	ustecky : {
		x : 2,
		y : 2
	},		
	
	liberecky : {
		x : 3,
		y : 2
	},

	kralovehradecky : {
		x : 1,
		y : 3
	},

	pardubicky : {
		x : 2,
		y : 3
	},	

	olomoucky : {
		x : 3,
		y : 3
	},	

	moravskoslezsky : {
		x : 1,
		y : 4
	},		
	
	zlinsky : {
		x : 2,
		y : 4
	},	

	jihomoravsky : {
		x : 3,
		y : 4
	},

	vysocina : {
		x : 1,
		y : 5
	},

	jihocesky : {
		x : 2,
		y : 5
	},	

	plzensky : {
		x : 3,
		y : 5
	},	

};

// Initialization 
///////////////////////////////////////////////////////////////////////////
var smallMapObj = new Map(3,5,276,159, quadrantCoordsList);
var largeMapObj = new Map(3,5,354,204, quadrantCoordsList);
///////////////////////////////////////////////////////////////////////////

// JQuery Stuff
///////////////////////////////////////////////////////////////////////////
$(document).ready(function() {

	var smallMapDOM = $("div#interactive-map-small");
	var smallMapHeadingDOM = $("#interactive-map-small-heading");
	var largeMapDOM = $("div#interactive-map-large");
	var largeMapHeadingDOM = $("#interactive-map-large-heading");	
	
	$("map#map-small area").hover(function() {
		
		var areaID = ($(this).attr("id")) ? $(this).attr("id") : 'undefined';
		var areaTitle = ($(this).attr("title")) ? $(this).attr("title") : 'undefined';
		
		if (areaID == 'undefined') {
							
			alert(errorMsg);
							
		} else {

			smallMapDOM.css("background-position", "" + smallMapObj.getQuadrantBackgroundPositionCss(areaID) + "");
			smallMapHeadingDOM.text(areaTitle);
		
		}
			
	}, function() {
	
		smallMapDOM.css("background-position", "top left");
		smallMapHeadingDOM.text("Vyberte si kraj");
	
	});
	
	
	$("map#map-large area").hover(function() {
		
		var areaID = ($(this).attr("id")) ? $(this).attr("id") : 'undefined';
		var areaTitle = ($(this).attr("title")) ? $(this).attr("title") : 'undefined';
		
		if (areaID == 'undefined') {
							
			alert(errorMsg);
							
		} else {

			largeMapDOM.css("background-position", "" + largeMapObj.getQuadrantBackgroundPositionCss(areaID) + "");
			largeMapHeadingDOM.text(areaTitle);
		
		}
			
	}, function() {
	
		largeMapDOM.css("background-position", "top left");
		largeMapHeadingDOM.text("Vyberte si kraj");
	
	});	

});
///////////////////////////////////////////////////////////////////////////






