function initialize() {
	var infowindow = new google.maps.InfoWindow();
    var fenway = new google.maps.LatLng(21.000488,-89.599345);
    var mapOptions = {
      center: fenway,
      zoom: 15,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map( document.getElementById("map_canv"), mapOptions);
	var marker = new google.maps.Marker({
			position: fenway,
			map: map,
			html: "<div id='content'><div id='siteNotice'></div><h1 id='firstHeading' class='firstHeading'>Luminica</h1><div id='bodyContent'><p></p><br/><p>Calle 21 #164 x 36 y 38 Col. Buenavista.      &nbsp; .&nbsp;</p><p>C.P. 97130 Mérida, Yucatan, México.</p></div></div>",
			id: "1",
			title: "Luminica"
	});
	google.maps.event.addListener(marker, 'click', function() {
		load_content(map,this,infowindow);
	});
}
function load_content(map,marker,infowindow){
	infowindow.setContent(marker.html);
	infowindow.open(map,marker);
} 
$(window).load(function() {
	if ( $('#contenido').height() + 138 < $(window).height() ) {
		positionFooter('#footer');
	}
	$('.loading').remove();
});
$(function() {
	dimensionCapa('.columna2','830','705');
	$('#imagen #news').innerfade({ speed: 900, timeout: 8000, type: 'sequence', containerheight: '259px' });
	initialize();
	var rango_superior = 30;  
	var rango_inferior = 1;  
	var aleatorio = Math.floor(Math.random()*(rango_superior-(rango_inferior-1))) + rango_inferior;  
	$.getJSON('http://gdata.youtube.com/feeds/api/videos?q=lighting+design&alt=json-in-script&callback=?&max-results=5&start-index='+aleatorio, function(data) {
		var i=0;
		$.each(data.feed.entry, function(i, item) {
			var title = item['title']['$t'];
			var video = item['id']['$t'];
			var desc = item['content']['$t'];
			video = video.replace('http://gdata.youtube.com/feeds/api/videos/','http://www.youtube.com/watch?v=');
			videoID = video.replace('http://www.youtube.com/watch?v=','http://www.youtube.com/v/');
			$('#mybox').append('<a href="'+videoID+'" class="videos" title="'+title+'" rel="'+desc+'"> > '+title+'</a><br/> ');
			if(i==0){
				$('#mybox2').html('<object width="455" height="282"><param name="movie" value="'+videoID+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><embed src="'+videoID+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="455" height="282" wmode="transparent"></object>');
				$('.video h5').html(title);
				$('.video p').html(desc);
			}
			i++;
		});
	});
	
	$('.videos').live("click",function(e){
		e.preventDefault();
		var videolink = $(this).attr('href');
		videolink = videolink.replace();
		var desc = $(this).attr('rel');
		var titulo = $(this).attr('title');
		//console.log(desc);
		$('#mybox2').html('<object width="455" height="282"><param name="movie" value="'+videolink+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+videolink+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="455" height="282"></object>');
		$('.video h5').html(titulo);
		$('.video p').html(desc);
	});
	
	if ( $('#contenido').height() + 138 < $(window).height() ) {
		positionFooter('#footer');
	}
});
