$(document).ready(function() {

	url = window.location.href;
	url = unescape(url);
	pos = url.indexOf("www")
	if(pos=="-1"){var base_domain="http://thecitylovesyou.com/"}else{var base_domain="http://www.thecitylovesyou.com/"}
	
	$.getJSON(base_domain+'feed_home/imgsConfig.json', function(data) {
	
	url = window.location.href;
	url = unescape(url);
	pos = url.indexOf("www")
	if(pos=="-1"){var base_domain="http://thecitylovesyou.com/"}else{var base_domain="http://www.thecitylovesyou.com/"}
			
		getUrban = function(img_default_urban){
			$.ajax({
				type: "POST",
				url: base_domain+"urban/ini_urban.php",
				data: "d_image="+img_default_urban,
				beforeSend: function(){	
				},
				success: function(datos){
					$("#cont-urban").append(datos).hide();
					$("#cont-urban").fadeIn(data.fadeIn);
					getFashion(data.fashion);
				},
				error: function(data, status, e){
								
				}
			});
		}
		getFashion = function(img_default_urban){
			$.ajax({
				type: "POST",
				url: base_domain+"fashion/ini_fashion.php",
				data: "d_image="+img_default_urban,
				beforeSend: function(){
					
				},
				success: function(datos){
					$("#cont-fashion").append(datos).hide();
					$("#cont-fashion").fadeIn(data.fadeIn);
					getCinerex(data.cinerex);		
				},
				error: function(data, status, e){
								
				}
			});
		}
		
		getCinerex = function(img_default_urban){
			$.ajax({
				type: "POST",
				url: base_domain+"cinerex/ini_cinerex.php",
				data: "d_image="+img_default_urban,
				beforeSend: function(){
								
				},
				success: function(datos){
					$("#cont-cinerex").append(datos).hide();
					$("#cont-cinerex").fadeIn(data.fadeIn);
					getEvents(data.events);	
				},
				error: function(data, status, e){
								
				}
			});
		}
		
		getEvents = function(img_default_urban){
			$.ajax({
				type: "POST",
				url: base_domain+"events/ini_events.php",
				data: "d_image="+img_default_urban,
				beforeSend: function(){
								
				},
				success: function(datos){
					$("#cont-events").append(datos).hide();
					$("#cont-events").fadeIn(data.fadeIn);	
					iniHoverEvent();	
				},
				error: function(data, status, e){
								
				}
			});
		}
		
		iniHoverEvent = function (){
			
		$('.cont-promoted-item').bind({
		  mouseleave: function() {
		    $(this).animate( { backgroundColor: '#000000' }, 500)
			$(".cont-promoted-title", this).css("font-weight","normal");
			//$(".cont-promoted-title", this).animate({'marginLeft':'80px'}, 300);
			 $(".cont-promoted-image", this).animate({height: 75,width: 75}, 300);
		  },
		  mouseenter: function() {
		  $(this).animate( { backgroundColor: '#0099ff' }, 300);
		  $(".cont-promoted-title", this).css("font-weight","bold");
		   //$(".cont-promoted-title", this).animate({'marginLeft':'100px'}, 300);
		   $(".cont-promoted-image", this).animate({height: 100,width: 100}, 300);
	
		  
		  }
		});
		
		}
		
		
		getUrban(data.fashion);
	});

});


