// Di seguito le funzioni utilizzate all'interno del sito Fiordo 2006
// commento per indicare la funzionalitą e le pagine in cui viene richiamata la funzione
// SONO IN ORDINE ALFABETICO PER FUNZIONE!!


// GAB - 16 giugno 2010
function os_newFlv(my_video,my_w,my_h)
{
	my_h = my_h+40;
	window.open('com/swf/os_videonew.asp?my_video='+my_video+'&my_w='+my_w+'&my_h='+my_h, 'Video', "menubar=no,toolbar=no,status=no,width="+my_w+",height="+my_h);	
}




// GAB - 27 novembre 2008

function guardaVideo2008()
{
	window.open('com/swf/video.asp', 'Video', 'menubar=no,toolbar=no,status=no,width=512,height=288');	
}

function newFlv(my_video,my_w,my_h)
{
	my_h = my_h+40;
	window.open('com/swf/videonew.asp?my_video='+my_video+'&my_w='+my_w+'&my_h='+my_h, 'Video', "menubar=no,toolbar=no,status=no,width="+my_w+",height="+my_h);	
}

//









// RollOver pulsanti
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
// Fine rollOver pulsanti

function myResize() {
	window.resizeTo (900, 675);
	x=(screen.availWidth/2)-(900/2);
	y=(screen.availHeight/2)-(675/2);
	window.moveTo(x,y);
//	alert (document.body.clientHeight);
//	alert (document.documentElement.clientHeight);
}

function open640(ind) {
	window.open(ind,'Cotto','scrollbars=no,resizable=no,width=760,height=480,status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=0,screenX=0');
}

function openAmb(ind){
	x=(screen.availWidth/2)-330;
	y=(screen.availHeight/2)-350;
	window.open(ind,'','scrollbars=no,resizable=no,width=600,height=457,status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=10,screenX=50');
}

function openBanner(ind, dimw, dimh, lang){
	x=(screen.availWidth/2.8)-dimw;
	//x=(screen.availWidth/2)-dimw;
	y=80;//(screen.availHeight/2)-dimh;
	//y=180;//(screen.availHeight/2)-dimh;
	indirizzo = "../com/banner.asp?lang=" + lang + "&banner=" + ind;
	window.open(indirizzo,'','scrollbars=no,resizable=no,width='+dimw+',height='+dimh+',status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=10,screenX=50');
}

function openPopUp(ind, dimw, dimh){
	x=(screen.availWidth/2.8)-dimw;
	y=(screen.availHeight/2)-dimh;
	window.open(ind,'','scrollbars=yes,resizable=no,width='+dimw+',height='+dimh+',status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=10,screenX=50');
}

function openCred(ind){
	x=(screen.availWidth/2)-220;
	y=(screen.availHeight/2)-220;
	window.open(ind,'','scrollbars=yes,resizable=no,width=450,height=450,status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=10,screenX=50');
}

function openfin(ind){
	window.open(ind,'','scrollbars=yes,resizable=no,width=790,height=530,status=no,location=no,toolbar=no, menubar=no,top=10,left=20,screenY=10,screenX=50');
}

function openUpload(ind){
	window.open(ind,'','scrollbars=yes,resizable=no,width=600,height=200,status=no,location=no,toolbar=no, menubar=no,top=10,left=20,screenY=10,screenX=50');
}

function openMov(ind){
	x=(screen.availWidth/2)-330;
	y=(screen.availHeight/2)-350;
	window.open(ind,'','scrollbars=no,resizable=no,width=483,height=550,status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=10,screenX=50');
}

function openProd(id){
	var page = "prod.asp?id=" + id;
	window.opener.document.location = page;
	window.close();
}

function openQTVR(ind){
	x=(screen.availWidth/2)-250;
	y=(screen.availHeight/2)-340;
	window.open(ind,'','scrollbars=no,resizable=no,width=500,height=630,status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=10,screenX=50');
}

function openref(ind) {
	x=(screen.availWidth/2)-330;
	y=(screen.availHeight/2)-350;
	window.open(ind,'Cotto','scrollbars=no,resizable=no,width=650,height=550,status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=0,screenX=0');
}

function openRiv(ind){
	x=(screen.availWidth/2)-275;
	y=(screen.availHeight/2)-210;
	window.open(ind,'','scrollbars=yes,resizable=no,width=550,height=420,status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=10,screenX=50');
}

function openRivSite(ind){
	x=(screen.availWidth/2)-400;
	y=(screen.availHeight/2)-300;
	window.open(ind,'','scrollbars=yes,resizable=no,width=800,height=600,status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=10,screenX=50');
}

function opentab(ind){
	x=(screen.availWidth/2)-330;
	y=(screen.availHeight/2)-350;
	window.open(ind,'','scrollbars=yes,resizable=no,width=470,height=270,status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=10,screenX=50');
}

function linkBanner(ind){
	window.opener.location = ind;
	window.close();
}

function enlargeDefault() {
	window.resizeTo (screen.availWidth, screen.availHeight);
	window.moveTo(0,0);
//	alert (document.body.clientHeight);
//	alert (document.documentElement.clientHeight);
}

function openMain(ind) {
	ns4 = (document.layers)? true:false
	ie4 = (document.all)? true:false
	var os, largh, altez;
	if(navigator.appVersion.indexOf('Mac')>=0){
		os = 'mac';
	}else{
		os = 'win';
	}
	if(screen.availWidth>2000){
		largh=1280;
	} else {
//		if (ie4){
//			largh = (document.documentElement.offsetWidth);
//		} else {
//			largh = (window.innerWidth);
//		}
		largh = (screen.availWidth)-5;
	}
	if (screen.availHeight>1024){
		altez = 1024;
	} else {
//		if (ie4){
//			altez = (document.documentElement.offsetHeight) + ((screen.availHeight - document.documentElement.offsetHeight)/2);
//			altez = (screen.availHeight);
//		} else {
			altez = (screen.availHeight)-25;
//		}
	}
	x=(screen.availWidth/2)-(largh/2);
	y=(screen.availHeight/2)-(altez/2);
	window.open(ind,'Site','scrollbars=no,resizable=no,width='+largh+',height='+altez+',status=no,location=no,toolbar=no, menubar=no,top=0,left=0,screenY=0,screenX=0');
}

function mlFormCheck(form){
	var ffocus, Char, Char2;
	var theForm = eval ("document." + form);
	var msgErr = "";
	if (theForm.mail.value == "") {
		msgErr = "Devi indicare un indirizzo e-mail valido";
	}
	if (theForm.phone.value == "") {
		msgErr = "Devi indicare un numero di telefono";
	}
	if (theForm.state.value == "") {
		msgErr = "Devi indicare lo Stato";
	}
	if (theForm.prov.value == "") {
		msgErr = "Devi indicare la provincia";
	}
	if (theForm.city.value == "") {
		msgErr = "Devi indicare la cittą";
	}
	if (theForm.cap.value == "") {
		msgErr = "Devi indicare il C.A.P.";
	}
	if (theForm.address1.value == "") {
		msgErr = "Devi indicare l'indirizzo";
	}
	if (theForm.company.value == "") {
		msgErr = "Devi indicare il nome dell'Azienda";
	}
	if (theForm.surname.value == "") {
		msgErr = "Devi indicare il Cognome";
	}
	if (theForm.nome.value == "") {
		msgErr = "Devi indicare il Nome";
	}
	if (msgErr == "") {
		alert("La sua richiesta č stata inoltrata correttamente.");
		theForm.submit();
	} else {
		alert (msgErr);
	}
}

function mlChangeImg(img){
//	myImage = "com/img/prodotti/" + img;
//	document.logoSrc.src = myImage;
	document.logoSrc.src = img;
}

function jsTrim(myStr){
	i = 0;
	while (myStr.charCodeAt(i) == 160){ i++;}
	myStr = myStr.substring(i);
	
	i = myStr.length;
	while (myStr.charCodeAt(i) == 160){
		if (myStr.charCodeAt(i) != 160) break;
		i--;
	}
	if (i <= myStr.length) myStr = myStr.substring(0, i);

	return (myStr);
}

function changeYear(){
//	alert ("-" + document.selectYear.year.value + "-");
//	alert (document.location);
	myYear = document.selectYear.year.value;
//	alert(jsTrim(myYear));
//	alert("-" + jsTrim(myYear) + "-");
	myValue = "sponsor.asp?page=7&year=" + jsTrim(myYear);
	document.location = myValue;
}

function mlVisLayer(layer, img, path){
	dimW = screen.availWidth;
	dimH = screen.availHeight;
	document.all['imgLayer'].src = "com/img/zoom.gif";
	document.all['imgLayer'].src = "com/img/" + path + "/big_" + img;
	document.all[layer].style.left = (dimW/2) - 328;
	document.all[layer].style.top = (dimH/2) - 300;
	document.all[layer].style.display = 'inline';
}

function mlHideLayer(layer){
	document.all[layer].style.display = 'none';
	document.all['imgLayer'].src = "com/img/zoom.gif";
}

function Certy(layer){
//	alert (layer);
//	alert (document.all[layer].style.display);
//	if (document.all[layer].style.display == 'none'){
//		document.all[layer].style.display = 'inline';
//	} else {
//		document.all[layer].style.display = 'none';
//	}
//	document.all[layer].style.display = 'inline';
	if (document.all[layer].style.display == 'none'){
		document.all[layer].style.display = 'inline';
	} else {
		document.all[layer].style.display = 'none';
	}
}

function mlStatus(){
//	alert("Prova");
	window.status='Fiordo Industrie Ceramiche';
	return true;
}

function mlSubmitYear(){
	myData = document.archivioNews.myData.value;
	mYear = myData.substring(0, 4);
	mMonth = myData.substring(5);
	window.location.href="news.asp?page=10&mm=" + mMonth + "&my=" + mYear;
//	alert (mYear + " - " + mMonth);
}

function mlSubmit(form){
//	alert(form);
	var theForm = eval ("document." + form);
	theForm.submit();
}

function mlChekjOpt(form){
	var theForm = eval ("document." + form);
	if (theForm.acconsento.checked){
//		alert("CONFERMATO");
	} else {
		theForm.info.value = 2;
		alert("E' necessario fornire il proprio consenso al trattamento dei dati personali");
	}	
}

//-->
