﻿PositionX = 100;
PositionY = 100;
defaultWidth = 800;
defaultHeight = 600;
var AutoClose = true;
function popImage(imageURL,imageTitle){
var imgWin = window.open('','_blank','scrollbars=no,resizable=1 ,width='+defaultWidth+',height='+defaultHeight+',l eft='+PositionX+',top='+PositionY);
if( !imgWin ) { return true; } //popup blockers should not cause errors
imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><style>body{margin:6px 20px 20px 20px;background-image: url(IMG/BG_righenere.gif)}</style><script type="text\/javascript">\n'+
'function resizeWinTo() {\n'+
'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
'var oH = document.images[0].height, oW = document.images[0].width;\n'+
'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
'window.doneAlready = true;\n'+ //for Safari and Opera
'var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+
'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
'x.resizeTo( oW = oW + ( ( oW + 240 ) - myW ), oH = oH + ( (oH + 290 ) - myH ) );\n'+
'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
'}\n'+
'<\/script>'+
'<\/head><body onload="resizeWinTo();"'+(AutoClose?'onblur="self.close();"':'')+'>'+
(document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:20px;top:6px">'))+
'<div align=center><div id=titolo style=width:256px;height:25px;background-image:url(IMG/BG_righenere_titolo.gif)></div><div id=cornicesopra style=width:100%;height:7px;background-image:url(IMG/CORNICE.gif)><span style=font-size:7px;line-height:7px>&nbsp;</span></div><a href=javascript:window.close();><img src='+imageURL+' alt="Loading image ..." title="chiudi | fermer" border=0 onload="resizeWinTo();"></a><div id=cornicesotto style=width:100%;height:7px;background-image:url(IMG/CORNICE.gif)><img src=IMG/x.gif height=7 width=7></div><br style=font-size:6px;height:6px><div align=center><span style=color:#fff;font-size:12px;font-family:Arial,SunSans-Regular,sans-serif;line-height:12px>'+imageTitle+'</span></div></div>'+
(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
imgWin.document.close();
}



PositionX = 100;
PositionY = 100;
defaultWidth = 800;
defaultHeight = 600;
var AutoClose = true;
function popImagegigli(imageURL,imageTitle){
var imgWin = window.open('','_blank','scrollbars=no,resizable=1 ,width='+defaultWidth+',height='+defaultHeight+',l eft='+PositionX+',top='+PositionY);
if( !imgWin ) { return true; } //popup blockers should not cause errors
imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><style>body{margin:6px 20px 20px 20px;background-image: url(IMG/BG_righenere.gif)}</style><script type="text\/javascript">\n'+
'function resizeWinTo() {\n'+
'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
'var oH = document.images[0].height, oW = document.images[0].width;\n'+
'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
'window.doneAlready = true;\n'+ //for Safari and Opera
'var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+
'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
'x.resizeTo( oW = oW + ( ( oW + 240 ) - myW ), oH = oH + ( (oH + 290 ) - myH ) );\n'+
'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
'}\n'+
'<\/script>'+
'<\/head><body onload="resizeWinTo();"'+(AutoClose?'onblur="self.close();"':'')+'>'+
(document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:20px;top:6px">'))+
'<div align=center><div id=titolo style=width:256px;height:25px;background-image:url(IMG/BG_righenere_titolo.gif)></div><div id=cornicesopra style="width:100%;height:7px;background-image:url(IMG/CORNICE_GIGLI_GRIGI.gif);border-bottom:1px solid #000"><span style=font-size:7px;line-height:7px>&nbsp;</span></div><a href=javascript:window.close();><img src='+imageURL+' alt="Loading image ..." title="chiudi | fermer" border=0 onload="resizeWinTo();"></a><div id=cornicesotto style="width:100%;height:7px;background-image:url(IMG/CORNICE_GIGLI_GRIGI.gif);border-top:1px solid #000"><img src=IMG/x.gif height=7 width=7></div><br style=font-size:6px;height:6px><div align=center><span style=color:#fff;font-size:12px;font-family:Arial,SunSans-Regular,sans-serif;line-height:12px>'+imageTitle+'</span></div></div>'+
(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
imgWin.document.close();
}



function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) /4;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=yes'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
function switchToPrivate(){

	document.getElementById("customer_type").value='0';
	document.getElementById('titolo_dati').innerHTML='NOMINATIVO (i campi contrassegnati con * sono obbligatori)';
	document.getElementById('first_field').innerHTML='Nome *';
	document.getElementById('second_field').innerHTML='Cognome *';
	document.getElementById('third_field').innerHTML='Codice fiscale *';
}

function switchToCompany(){

	document.getElementById("customer_type").value='1';
	document.getElementById('titolo_dati').innerHTML='AZIENDA (i campi contrassegnati con * sono obbligatori)';
	document.getElementById('first_field').innerHTML='Ragione sociale *';
	document.getElementById('second_field').innerHTML='Nominativo *';
	document.getElementById('third_field').innerHTML='Partita IVA *';
}

function mostra(id) {
if (document.getElementById) {
document.getElementById(id).style.display="block";
} else if (document.all) {
document.all[id].style.display="block";
} else if (document.layers) {
document.layers[id].display="block";
}
}

function togli(id) {
if (document.getElementById) {
document.getElementById(id).style.display="none";
} else if (document.all) {
document.all[id].style.display="none";
} else if (document.layers) {
document.layers[id].display="none";
}
}


window.onerror=null;
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

	if(browserName=="Netscape" && browserVer >= 3) ver = "yes";
	else ver = "yes";
	if(ver == "yes") {

	italiano1 = new Image(); italiano1.src ="img/B_ITALIANO_ON.gif";
	italiano2 = new Image(); italiano2.src ="img/B_ITALIANO_OFF.gif";
	francais1 = new Image(); francais1.src ="img/B_FRANCAIS_ON.gif";
	francais2 = new Image(); francais2.src ="img/B_FRANCAIS_OFF.gif";
	}

function flagsi(imgName){
	if (ver == "yes")  {
	img1 = eval(imgName + "1.src");
	document [imgName].src = img1;
	}}

function flagno(imgName){
	if (ver == "yes")  {
	img2 = eval(imgName + "2.src");
	document [imgName].src = img2;
	}
	}
function empty_td_status(id){
	var cmd="document.getElementById('td_status_"+id+"').innerHTML=''";
	window.setTimeout(cmd, 2000);
}


function update_quantity(file,id,field,table){
	document.getElementById('td_status_'+id).innerHTML='';
	var value=document.getElementById('quantita_'+ id).value;
	document.getElementById('frm_hidden').src=file+'&value='+ value +'&idcart='+id+'&sid='+ new Date();
}

function delRowCart(file,id,product){
	document.getElementById('frm_hidden').src=file+'&id_prodotto='+ id+'&sid='+ new Date();
}
function add_product(file,id_prodotto){
		document.getElementById('frm_hidden').src=file+'&dyn_insert=1&id_prodotto='+id_prodotto+'&sid='+new Date();
}
function switchToChange(){
	document.getElementById('changedelivery').style.display='';
	document.getElementById('delivery').style.display='none';
}

function switchToStatic(){
	document.getElementById('delivery').style.display='';
	document.getElementById('changedelivery').style.display='none';
}
function updateSelectIndirizzo(what, by){
	httpserver='http://dev.axterisko.it/axterisko/';
	if (what==1){
// regione

		document.getElementById("frm_hidden").src=httpserver+"query_comuni.php?regione="+by+"&sid="+new Date();
		document.getElementById('provincia').value='';
		document.getElementById('citta').value='';
	}else if (what==2){
// provincia
		document.getElementById("frm_hidden").src=httpserver+"query_comuni.php?provincia="+by+"&sid="+new Date();
		document.getElementById('provincia').value=by;
		document.getElementById('citta').value='';		

	}else{
// comuni
		document.getElementById('citta').value=by;
		document.getElementById("frm_hidden").src=httpserver+"query_comuni.php?citta="+by+"&sid="+new Date();
	}
	
}

