$(document).ready(pageInit);

function pageInit(){
	aggiustaMenu();//per IE
	
	if($(".slideshow").is("div")){
		slideBox();
		}
	
	
//  $('#contentWrapper').after('<img src="../www.delfinvacuums.it/img/ombra.jpg" class="ombra" />');
  $('#contentWrapper').append('<img src="/www.delfinvacuums.it/img/ombra.jpg" class="ombra" />');

  $('#mainMenu li:first').addClass('first');

  $('#mainMenu li:last').addClass('last');

//  menuAccordion();

  /*tabella confronta*/
  $('table#confronto').css('width',(142.5*$('table#confronto tr:first td').length)+'px');
  $('#ripristina').click(function() {$('table#confronto').remove(); $('#repository').after($('table#back').attr('id','confronto'))});
  $('.remove_btn').click(function(){
    var header = $('table#confronto tr.header td');
	if($('#repository table#back').length==0) $('#repository').append($('table#confronto').clone(true).attr('id','back'));
    var del = $(this).parent();
	for (var i = 0; i<header.length; i++) if ($(header[i]).html()==del.html()) var pos=i;
	var tr = $('table#confronto tr');
	for (var i = 0; i<tr.length; i++) {var td = $(tr[i]).find('td'); $(td[pos]).remove();}
	$('table#confronto').css('width',(142.5*$('table#confronto tr:first td').length)+'px');
  });
  $('.scrollLeft').click(function() {var tr = $('table#confronto tr'); for (var i=0; i<tr.length; i++) $(tr[i]).find('td:eq(1)').appendTo($(tr[i]));});
  $('.scrollRight').click(function() {var tr = $('table#confronto tr'); for (var i=0; i<tr.length; i++) $(tr[i]).find('td:eq(1)').before($(tr[i]).find('td:last'));});
  /*fine tabella confronta*/

  if ($('.tabs').length>0) tabsInit();

  var h = $(document).height()

  var t = $('#footer').offset().top

  $('#footer').css('height',parseInt(h-t)+'px');

  if ($('.new').length>0) newsHoverInit();

  if ($('#inviaForm').length>0) $('#inviaForm').click(function(){$('#contattaci').submit();});

  //if ($('#flash-home').length>0) FlashReplace.replace("flash-home", "/www.delfinvacuums.it/swf/flash/temp.swf", "flashId", 924, 261, 7, {wmode : "transparent", flashvars : "langCode="+langXml});

  if ($('#confronta').length>0) confrontaInit();

  if($('#elencoNews').length>0) getNewsList();

  var today = new Date();
	var expires = new Date();

  if ($('.applicazioni').length>0) expandMenu();

  $('#login_btn').click(login);
  $('#logout_btn').click(logout);
  if ($('#login').length>0) loginInit();
  openFormLayer();
}



