function test2(cont) {
	$('esempio').src='http://www.seital.it/images/esempio'+cont+'.jpg';
	Effect.Grow('esempio',{duration:1});
	timer=setTimeout("test("+cont+")",4000);
}

function test(cont) {
	Effect.Shrink('esempio',{duration:.6});
	num=Math.round(Math.random()*10)+1; if(num==cont) num=Math.round(Math.random()*10)+1; if(num==cont) num=Math.round(Math.random()*10)+1;
	cont=num;
	timer=setTimeout("test2("+cont+")",700);
}

function contatta(testo) {
	stato=true;
	for (i=1;i<=8;i++)
		if ($('ric'+i).value=='') {stato=false; break}
	if (stato==false) alert(testo);
	return stato;
}

function lingua(lang) {
	var url='';
	if(lang=='it') url='http://www.seital.it/';
	else if(lang='en') url='http://www.seital.com/';
	else url='http://www.seital.com/'+lang+'/';
	document.location=url;
}

function msgbox(testo,width,button,value,onsubmit,otherbtn) {
	if (width==null || width=='auto' || width=='') width=400;
	if (testo==null) {$('msgbox').hide(); return false;}
	if (onsubmit==null) onsubmit=''; else onsubmit+=';';
	var scrollwidth=getScrollWidth();
	$('msgbox').show();
	var str='<div style="text-align:right"><br />';
	if (button!=null) {
		if (button=='submit')
			str+='<input type="button" class="btn" id="msgboxsubmit" onclick="'+onsubmit+'$(\'msgbox_form\').submit()" value="'+value+'" /> &nbsp; ';
		if (button=='button')
			str+='<input type="button" class="btn" id="msgboxsubmit" onclick="'+onsubmit+'" value="'+value+'" /> &nbsp; ';
	}
	if(otherbtn!=null) str+=otherbtn+'  &nbsp; ';
	str+='<input type="button" id="msgboxclosebutton" class="btn" onclick="msgbox()" value="Chiudi" /></div>';
	$('msgbox').innerHTML=testo+str;
	$('msgbox').style.top=(scrollwidth[0]+130)+'px';
	$('msgbox').style.width=width+'px';
	$('msgbox').style.left=Math.ceil((scrollwidth[1]-width)/2)+'px';
	if ($('msgbox').offsetHeight>300) {
		var margintop=Math.ceil((scrollwidth[2]-$('msgbox').offsetHeight)/2);
		if (margintop<10) margintop=10;
		margintop+=scrollwidth[0];
		$('msgbox').style.top=margintop+'px';
	}
	return false;
}

function getScrollWidth() {
  var scrOfY=0,myWidth=0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    scrOfY = document.documentElement.scrollTop;
  }
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth; myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    myWidth = document.body.clientWidth; myHeight = document.body.clientHeight;
  }
  return [scrOfY,myWidth,myHeight];
}

