indicez=1;
indicezz=100;
selected=0;


MainBackground=new Image();
MainBackground.src="images/project-new4.jpg";

if (!MainBackground.addEventListener)
	MainBackground.attachEvent('load', function(){document.getElementById('contenedor').style.display="block";});
else
	MainBackground.addEventListener('load', function(){document.getElementById('contenedor').style.display="block";}, false);

var $JQ = jQuery.noConflict();

$JQ(document).ready(function() {
   	$JQ("#draggable1").draggable();
	document.getElementById("draggable1").onmousedown=function(){start_drag(1)};		
	$JQ("#draggable2").draggable();
	document.getElementById("draggable2").onmousedown=function(){start_drag(2)};		
	$JQ("#draggable3").draggable();
	document.getElementById("draggable3").onmousedown=function(){start_drag(3)};	
});

function start_drag(id_drag){
	if (selected!=id_drag){
		indicez++;
		document.getElementById("texto_campania_1").style.display="none";
		document.getElementById("texto_campania_2").style.display="none";
		document.getElementById("texto_campania_3").style.display="none";
		
		 $JQ('#texto_campania_'+id_drag).fadeIn("slow");
		 //document.getElementById("texto_campania_"+id_drag).style.display="block";
		
		
		document.getElementById("draggable"+id_drag).style.zIndex=indicez;
		selected=id_drag;
	}
}
function show_foto(id_foto){
	texto='';
	document.getElementById('texto_polaroid').innerHTML='';
	$JQ('#foto_polaroid').fadeOut("slow",function(){
		switch(id_foto){
			case 1:
				archivo='images/galeria/1.png';
				texto="Evento E.N.R";
			break;
			case 2:
				archivo='images/galeria/2.png';
				texto="Sampling en universidades";
			break;		
			case 3:
				archivo='images/galeria/3.png';
				texto="Acci&oacute;n nocturna en pubs y bares";
			break;
			case 4:
				archivo='images/galeria/4.png';
				texto="Acci&oacute;n costa atlantica";
			break;						
			case 5:
				archivo='images/galeria/5.png';
				texto="Sampling plazas y parques";
			break;
			case 6:
				archivo='images/galeria/6.png';
				texto="Camioneta promocional";
			break;		
			case 7:
				archivo='images/galeria/7.png';
				texto="Acci&oacute;n en v&iacute;a p&uacute;blica vacaciones de invierno";
			break;
			case 8:
				archivo='images/galeria/8.png';
				texto="Promotoras para eventos";
			break;						
			case 9:
				archivo='images/galeria/9.png';
				texto="Degustaci&oacute;n en supermercados";
			break;
			case 10:
				archivo='images/galeria/10.png';
				texto="Acci&oacute;n en opticas";
			break;		

		}
		document.getElementById('foto_polaroid').innerHTML='<img src="'+archivo+'" width="333" height="237" />';
		$JQ('#foto_polaroid').fadeIn("slow",function(){
			document.getElementById('texto_polaroid').innerHTML=texto;
		});
	});
}
function agranda(id_objeto){
	document.getElementById('postit_img_1').style.zIndex=-1;
	document.getElementById('postit_img_2').style.zIndex=-1;
	document.getElementById('postit_img_3').style.zIndex=-1;
	document.getElementById('postit_img_4').style.zIndex=-1;

	document.getElementById('postit_img_'+id_objeto).style.zIndex=1;

//	$JQ("#postit_div_"+id_objeto).find('img').animate({width:'160px', height:"224px", marginTop: "-30px", marginLeft: "-20px" },{queue:false,duration:500});
	$JQ("#postit_div_"+id_objeto).find('img').animate({width:'140px', height:"196px", marginTop: "-15px", marginLeft: "-15px" },{queue:false,duration:200});
}
function achica(id_objeto){
	$JQ("#postit_div_"+id_objeto).find('img').animate({width:'112px', height:"157px", marginTop: "0px", marginLeft: "0px"},{queue:false,duration:200});
}
function shake(id_objeto,move){
/*		switch(move){
			case 1:
				direccion="up";
			break;
			case 2:
				direccion="down";
			break;				
			case 3:
				direccion="left";
			break;
			case 4:
				direccion="right";
			break;
		}
		$JQ("#pin_"+id_objeto).effect("shake",{times:1,distance:2,direction:direccion}, 100);
}*/
$JQ("#pin_"+id_objeto).find('img').animate({width:'82px', height:"82px", marginTop: "-2px", marginLeft: "-2px" },{queue:false,duration:200});
}
function agranda_pin_chico(id_objeto){
	$JQ("#pin_"+id_objeto).find('img').animate({width:'77px', height:'77px'},{queue:false,duration:200});
}
function achica_pin_chico(id_objeto){
	$JQ("#pin_"+id_objeto).find('img').animate({width:'72px', height:"72px"},{queue:false,duration:200});
}


