function openLightbox(type, title, url)
{
	$('body').append("<div id='gMapModal-overlay'></div><div id='gMapModal-text'></div><div id='gMapModal-box'></div><div id='gMapModal-preLoad'></div>");
	$('#gMapModal-text').append('<p class="mapText"></p><a id="gMapModal-closeButton"></a>');
	
	//objHidden = $('embed, object, select').css({ 'visibility' : 'hidden' });
	
	
	//Hidding the elements
	$('#gMapModal-overlay, #gMapModal-box, #gMapModal-text').hide();
	
	
	if(type == 'html')
	{
		t_width = $('body').width() - 60;
		t_height = $('body').height() - 80;
	}
	else if(type == '360')
	{
		t_width = 640;
		t_height = 480;
	}
	else
	{
		t_width = 300;
		t_height = 200;
	}
	
		settings = {
					bgColor: '#000',
					bgOpacity: 0.8,
					mapWidth: t_width,
					mapHeight: t_height,
					mapText:title,
					mapUrl: url
					}
				
				
				
				
	
	
	$('.mapText').text(settings.mapText);
	
	if(type == 'html' || type == '360')
	{
		$('#gMapModal-box').append('<iframe width="' + settings.mapWidth + '" height="' + settings.mapHeight + '" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="' + settings.mapUrl + '"></iframe>');
	}
	else
	{
		
		$('#gMapModal-preLoad').append('<img src="' + settings.mapUrl + '" />');
		$('#gMapModal-preLoad img').load(function()
		{
			
			
		 	
			width = $(this).width();
			height = $(this).height();
			
			mgLeft = ((width/2) * -1);
			mgTop = 10;
			
			
			$('#gMapModal-box').animate({
				'width'			: width + "px",
				'height'		: height + "px",
				'marginLeft'	: mgLeft + "px"
			});
			
			
			mgTop = mgTop + height;
	
			// The text CSS
			$('#gMapModal-text').css({
				'width'			: width + "px",
				'margin-left'	: mgLeft + "px",
				'top'			: mgTop + "px"	 
			});
			
			
				
			setTimeout(function(){
				$('#gMapModal-box').append($('#gMapModal-preLoad img'));
				$('#gMapModal-text').slideDown();
			}, 500);
			
		});
		
	}
	
	
	
	// The Background CSS
	$('#gMapModal-overlay').css({
		'position' 	: 'absolute',
		'top' 		: 0,
		'left' 		: 0,
		'width' 	: '100%',
		'height' 	: $('body').height(),
		
		'background-color' : settings.bgColor,
		'opacity' 			: settings.bgOpacity
	});
	
	
	
	mgLeft = ((settings.mapWidth/2) * -1);
	mgTop = 10;
	
				
	// The Map Box CSS
	$('#gMapModal-box').css({
		'position'		: 'absolute',
		'left'			: '50%',
		'width'			: settings.mapWidth + "px",
		'height'		: settings.mapHeight + "px",
		'margin-left'	: mgLeft + "px",
		'top'			: mgTop + "px"
	});
	
	
	mgTop = mgTop + settings.mapHeight;
	
	// The text CSS
	$('#gMapModal-text').css({
		'position'		: 'absolute',
		'left'			: '50%',
		'width'			: settings.mapWidth + "px",
		'margin-left'	: mgLeft + "px",
		'top'			: mgTop + "px"	 
	});
	
	
	//Calling the setActions Function
	_setActions();
	
	
	$('#gMapModal-overlay, #gMapModal-box').show();
	
	if(type == 'html' || type == '360')
	{
		setTimeout(function(){
			$('#gMapModal-text').slideDown();
		}, 500);
	}
}



/*
 * Set the buttons actions
 * @return boolean false
 */
function _setActions(){
	
	$('#gMapModal-overlay').bind('click', closeModal);
	$('#gMapModal-closeButton').bind('click', closeModal);
	
	return false;
}




/*
 * Closing the Modal
 * @return boolean false
 */
closeModal = function(){
	$('#gMapModal-overlay').remove();
	$('#gMapModal-box').remove();
	$('#gMapModal-text').remove();
	$('#gMapModal-preLoad').remove();
	
	
	$(objHidden).css({ 'visibility' : 'visible' });
	
	return false;
}

var objHidden = [];
