// JavaScript Document
PositionX = 300;
		PositionY = 300;
		
		defaultWidth  = 800;
		defaultHeight = 600;
		
		var AutoClose = false;
		
		// Do not edit below this line...
		// ================================
		if (parseInt(navigator.appVersion.charAt(0))>=4){
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
		var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
		var optIE='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
		function open_site(imageURL,imageTitle){
		if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isIE){imgWin=window.open('about:blank','',optIE);}
		with (imgWin.document){
		writeln('<html><head><title>Caricamento Immagine...</title><style>body{margin:0px;}</style>');
		writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');
		writeln('if (isIE){');
		writeln('window.resizeTo(200,100);');
		writeln('width=250-(document.body.clientWidth-document.images[0].width);');
		writeln('height=100-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');
		writeln('if (isNN){');       
		writeln('window.innerWidth=document.images["George"].width;');
		writeln('window.innerHeight=document.images["George"].height;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
			if (!AutoClose) 
			writeln('</head><body bgcolor=ffffff scroll="no" style="background-image:url(../../img/caricamento.gif); background-position:center; background-repeat:no-repeat;" onload="reSizeToImage();doTitle();self.focus()">')
			else 
			writeln('</head><body bgcolor=000000 scroll="no" style="background-image:url(/img/loadingimg.gif); background-position:center; background-repeat:no-repeat;" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
			writeln('<a href="javascript:window.self.close();"><img name="George" border="0" src='+imageURL+' style="display:block"></a></body></html>');
		close();		
		}

	}
// SERVIZI

// MENU
function menuOver(id) {
	document.getElementById(id).style.backgroundImage = 'url(images/template/over.png)';
}

function menuOut(id) {
	document.getElementById(id).style.backgroundImage = 'none';
}

function mostra(id) {
	if (document.getElementById('partner'+id).style.display != 'block') {
		//document.getElementById('partner'+id).style.height = '0px';
		document.getElementById('partner'+id).style.display = 'block';
	} else {
		document.getElementById('partner'+id).style.display = 'none';
	}
}


function showImage(id, html, width, height, left, top) { 
	var posY = screen.height;
	var posX=screen.width; //larghezza pagina 
	alert(posY);
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id', id)   
	newdiv.style.width = '420px';
	newdiv.style.height = 'auto';
	newdiv.style.zIndex = '1000';
	newdiv.style.position = "absolute";
	newdiv.style.left = (posX - 420) / 2;
	newdiv.style.top = posY;
	newdiv.style.background = "#ffffff";
	newdiv.style.border = "4px solid #999999";   
	if (html) {
		newdiv.innerHTML = html;
	} else {
		newdiv.innerHTML = "nothing";
	}   
	document.body.appendChild(newdiv);
}

function showImage2(id, html, width, height, left, top) { 
	
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id', id)   
	if (width) {
		newdiv.style.width = 300;
	}   
	if (height) {
		newdiv.style.height = 300;
	}   
	if ((left || top) || (left && top)) {
		newdiv.style.position = "absolute";
		if (left) {
			newdiv.style.left = left;
		}

		if (top) {
			newdiv.style.top = top;
		}
	}   
	newdiv.style.background = "#00C";
	newdiv.style.border = "4px solid #000";   
	if (html) {
		newdiv.innerHTML = html;
	} else {
		newdiv.innerHTML = "nothing";
	}   
	document.body.appendChild(newdiv);
}


function getMousePosition(e) {
        var IE = document.all?true:false;
        if ( IE ) { // grab the x-y pos.s if browser is IE
                tempX = event.clientX + document.body.scrollLeft;
                tempY = event.clientY + document.body.scrollTop;
        } else {  // grab the x-y pos.s if browser is NS
                tempX = e.pageX;
                tempY = e.pageY;
        }
        //pos['left'] = tempX;
        //pos['top'] = tempY;
		return tempY;
}
// FILTRO CATALOGO
function checkFilter() {
	if ((document.frmFilter.ricMarca.value == '')&&(document.frmFilter.ricCategoria.value == '')) {
		alert('Selezionare MARCA o CATEGORIA.');
		return;
	}
	document.frmFilter.method = "post";
    document.frmFilter.action = "filter.php";
    document.frmFilter.submit();
}
//===================================
function sendMail() {
	if (document.frmContatti.cognome.value == '') {
		alert('Inserire il cognome.');
		document.frmContatti.cognome.focus();
		return;
	}
	if (document.frmContatti.email.value == '') {
		alert('Inserire l\'email.');
		document.frmContatti.email.focus();
		return;
		
	}
		var str = document.frmContatti.email.value;
		var esp = /^[a-z0-9]+([_a-z0-9\.-]{1,100})+[@]+([_a-z0-9\.-]{3,50})+[\.]+([_a-z0-9\.-]{2,10})$/;
		if (!esp.test(str)) {
			alert('Formato email errato.');
			document.frmContatti.email.focus();
			return;
		}
	if (document.frmContatti.telefono.value == '') {
		alert('Inserire il telefono.');
		document.frmContatti.telefono.focus();
		return;
	}
		var str = document.frmContatti.telefono.value;
		var esp = /^[\d+]+[\d\s]+\d$/;
		if (!esp.test(str)) {
			alert('Formato telefono errato.\n(es. +39 0000 12233)');
			document.frmContatti.telefono.focus();
			return;
		}
	if (document.frmContatti.oggetto.value == '') {
		alert('Inserire l\'oggetto.');
		document.frmContatti.oggetto.focus();
		return;
	}
	if (document.frmContatti.testo.value == '') {
		alert('Inserire il testo.');
		document.frmContatti.testo.focus();
		return;
	}
	document.frmContatti.method = "post";
    document.frmContatti.action = "sendMail.php";
    document.frmContatti.submit();
}
