function showitems (i,max) {
	if (i < max) {
		$('#image_container .int_container:eq('+i+')').show (400);
		$('#image_container .int_container:eq('+i+') IMG').fadeIn(3000);
		$('#image_container .int_container:eq('+i+') p').animate( {backgroundPosition: "0 0"}, function() { showitems(++i,max) })
	}
}

function setHeight() {
	var pino= $('#cntSx').height();
	var gino= $('#cntDx').height();
	if (pino>gino){
		$('#cntDx').height(pino);
		$('#cntSx').height(pino);
		}else{
		$('#cntSx').height(gino);
		$('#cntDx').height(gino);
		};
};


function divGrow(){	
		$('#image_container .int_container').mouseenter(function() {
		/*CONTENITORE*/$(this).animate({width: "+=150px",height:"+=150px"});
		/*SPAN INTERNI*/$(this).find('p span').css('display','block')
		/*PARAGRAFO*/$(this).find('p').animate({backgroundPosition:"0 -70px",height:"160px"});
		/*LINK TITOLO*/$(this).find('a').animate ({color:"black",fontSize:"12px",padding:"15px 15px 0 15px" ,margin:"0"})
	}).mouseleave(function() {
		/*SPAN INTERNI*/$(this).find('p span').css({display:'none'})
		/*CONTENITORE*/$(this).animate({width: "-=150px",height:"-=150px"});
		/*PARAGRAFO*/$(this).find('p').animate({backgroundPosition:"0 0",height:"30px",overflow:"hidden"});
		/*LINK TITOLO*/$(this).find('a').animate ({color:"white",fontSize:"11px",padding:"2px 5px",margin:"0 5px"})
		
	});	 
};

function backCursor(){$('#cursor').delay(1000).animate({left:'-=430px'}, 1000, function(){moveCursor();})};
function moveCursor() {$('#cursor').delay(1500).animate({left:'+=430px'},1000, function(){backCursor();})};


var wdt = '';
function zoomImg(){
	if( wdt == '') {
		$('#scm_img').animate({width:'+=578px',height:'+=401px',top:'-=300',left:'-=40px'});
		wdt = 'zio';
		}
	else {
		$('#scm_img').animate({width:'-=578px',height:'-=401px',top:'+=300',left:'+=40px'});
		wdt = '';
	}
}


function openEle(){
	if ($(".ele").is(":hidden")) {
	$(".ele").slideDown("slow");
	} else {
	$(".ele").hide();
	}
};


function openBio() {
		$('#bio').click(function() {
			  $('.bio').toggle("show");
			}
	)};


$(document).ready(function() {
	setHeight();
	moveCursor();
	if ($('#mygallery').length != 0) {
		$("#mygallery IMG").center();
	}
	if ($('#image_container').length != 0) {
		showitems(0,$('#image_container .int_container').length);
		divGrow();
	}
	if ($('#mediaspace').length != 0) {
		createPlayer();
	}
	if ($('#bio').length != 0) {
		openBio();
	}
	$('.elm_top_right ul li:last').css('border-right','0');
	
	if($('textarea').is('.wysiwyg')){
		$('.wysiwyg').each(function(){
			$(this).wysiwyg({
			controls: {
			  strikeThrough : { visible : true },
			  underline     : { visible : true },
			  separator00 : { visible : true },
			  justifyLeft   : { visible : true },
			  justifyCenter : { visible : true },
			  justifyRight  : { visible : true },
			  justifyFull   : { visible : true },
			  separator01 : { visible : true },
			  indent  : { visible : true },
			  outdent : { visible : true },
			  separator02 : { visible : true },
			  subscript   : { visible : true },
			  superscript : { visible : true },
			  separator03 : { visible : true },
			  undo : { visible : true },
			  redo : { visible : true },
			  separator04 : { visible : true },
			  insertOrderedList    : { visible : true },
			  insertUnorderedList  : { visible : true },
			  insertHorizontalRule : { visible : true },
			  h4mozilla : { visible : true && $.browser.mozilla, className : 'h4', command : 'heading', arguments : ['h4'], tags : ['h4'], tooltip : "Header 4" },
			  h4 : { visible : true && !( $.browser.mozilla ), className : 'h4', command : 'formatBlock', arguments : ['<H4>'], tags : ['h4'], tooltip : "Header 4" },
			  separator07 : { visible : true },
			  cut   : { visible : true },
			  copy  : { visible : true },
			  paste : { visible : true }
			}
		  });								
										
										
		})
		
	}
	if($('.proposte').is('UL')){
		$('.proposte LI:last').css({'background':'none','padding-bottom':'0'});
		
		}
});

