var swellCoreshopGMaps = new Class({
	Implements: [Options, Events],
	options: {
		mapCanvas: $empty,
		mapCenterPointLat: $empty,
		mapCenterPointLong: $empty
	},
	initialize: function(options) {
		//alert('here');
		this.setOptions(options);
		this.setUpIcons();
	},
	
	
	setUpIcons: function() {
			var inactiveShopIcon = new GIcon();
			inactiveShopIcon.image = "/images/layout/shopBlueGmapsIcon.png";
			inactiveShopIcon.shadow = "/images/layout/shopShadow.png";
			inactiveShopIcon.transparent = "/images/layout/shopBlueGmapsIcon2.png";
			inactiveShopIcon.iconSize = new GSize(30.0, 33.0);
			inactiveShopIcon.shadowSize = new GSize(47.0, 33.0);
			inactiveShopIcon.iconAnchor = new GPoint(15.0, 32.0);
			inactiveShopIcon.infoWindowAnchor = new GPoint(14.0, 0.0);
			this.mapIcons['inactiveShop'] = inactiveShopIcon;
			
			var activeShopIcon = new GIcon();
			activeShopIcon.image = "/images/layout/shopTanGmapsIcon.png";
			activeShopIcon.shadow = "/images/layout/shopShadow.png";
			activeShopIcon.transparent = "/images/layout/shopBlueGmapsIcon2.png";
			activeShopIcon.iconSize = new GSize(30.0, 33.0);
			activeShopIcon.shadowSize = new GSize(47.0, 33.0);
			activeShopIcon.iconAnchor = new GPoint(15.0, 32.0);
			activeShopIcon.infoWindowAnchor = new GPoint(14.0, 0.0);
			activeShopIcon.image = "/images/layout/shopTanGmapsIcon.png";
			this.mapIcons['activeShop'] = activeShopIcon;
			
		var activeEventIcon = new GIcon();
		activeEventIcon.image = "/images/layout/shopEventGmapsIcon.png";
		activeEventIcon.shadow = "/images/layout/shopEventGmapsIconShadow.png";
		activeEventIcon.transparent = "/images/layout/shopEventGmapsIcon2.png";
		activeEventIcon.iconSize = new GSize(28.0, 38.0);
		activeEventIcon.shadowSize = new GSize(48.0, 38.0);
		activeEventIcon.iconAnchor = new GPoint(14.0, 19.0);
		activeEventIcon.infoWindowAnchor = new GPoint(14.0, 0.0);
		this.mapIcons['event'] = activeEventIcon;
	},
	displayMap: function(data) {
			
			this.bounds = new GLatLngBounds();
			
			this.map = new GMap2($(this.options.mapCanvas));
			
			//var ct = new GLatLng(parseFloat(this.options.mapCenterPointLat), parseFloat(this.options.mapCenterPointLong));
			var ct = new GLatLng(37.4419, -122.1419);
			//alert(this.options.mapCenterPointLat);
			this.map.setCenter(ct, 10);
			
			this.map.addControl(new GSmallMapControl());
			this.map.addControl(new GMapTypeControl());
	},
	mapIcons: [],
	map: $empty,
	markers: [],
	locations: [],
	bounds: $empty
});

function getClientSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return new Array(myWidth, myHeight);
}	
		
function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} 
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	}
	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}

function findPosX(obj) {
	var curleft = 0;
	if(obj.offsetParent) {
		while(1) {
			curleft += obj.offsetLeft;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if(obj.offsetParent) {
		while(1) {
			curtop += obj.offsetTop;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
}
