var vEnabled=true;

function despliega(vDiv){
if (vEnabled){
	vEnabled = false;
	jvDiv="#"+vDiv;
	jButon = "#"+"b_"+vDiv;
	if($(jvDiv).height() < 270 ){ //NO ESTA ABIERTO	
		$(".jContenido").each(function(){
			if($("#"+this.id).height() > 100){ //SI ESTA ABIERTO
				$("#"+this.id).empty();
				$("#"+this.id).animate({height:0}, 200, "linear", function(){$("#"+this.id).removeAttr("style");} );
				
			}
		
		});
		
		$(".sites").each(function(){
			var bLeft = $("#"+this.id).css("left").replace(/px/, "") * 1;
			if(bLeft > -300){//SI ESTA EXTENDIDO
				$("#"+this.id).animate({left:-345}, 200, "linear");
			}
		});
		$(jButon).animate({left:0}, 200, "linear");
		$(jvDiv).animate({height:270}, 300, "linear", function(){lls(vDiv);} );
	}
	else { //ESTA ABIERTO
		$(jvDiv).empty();
		$(jvDiv).animate({height:0}, 200, "linear", function(){$(jvDiv).removeAttr("style");} );
		$(jButon).animate({left:-345}, 200, "linear");
		vEnabled=true;
	}
 }
 else{

 }
}
function lls(vDiv){
	jvDiv="#"+vDiv;
	$(jvDiv).load('archivos/'+ vDiv +'.php','',function()
	{
		setSc();
		vEnabled = true;
		//$("#footer").text(vEnabled);
	});
}
function setSc(){
	stepcarousel.setup({
	galleryid: 'mygallery', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content
	autostep: {enable:false, moveby:1, pause:3000},
	panelbehavior: {speed:500, wraparound:true, persist:false},
	defaultbuttons: {enable: false, moveby: 1, leftnav: ['http://i34.tinypic.com/317e0s5.gif', -5, 80], rightnav: ['http://i38.tinypic.com/33o7di8.gif', -20, 80]},
	statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
	contenttype: ['inline'], //content setting ['inline'] or ['external', 'path_to_external_file']
	onpanelclick:function(target){
		stepcarousel.stepBy('mygallery', 1);
	}
});
}


$(function() {
		$("#accordion").accordion({	event: "mouseover", animated: false, autoheight: false});
		
	});
