
//<!-- Begin POP-UP WITH CHOOSE 


function greg(tga)
{
switch (tga) {
 case 1:
   window.open("ethernet.htm","","noresize"); 
   break;
 case 2:
   window.open("fast.htm","","noresize");
   break;
 case 3:
   window.open("giga.htm","","noresize");
   break;
}
}

// End -->


//<!-- Begin Normal Pop Up

function gregpopup(addr) {
w=1024;
h=768;
  x = Math.ceil( (window.screen.width  - w) / 2 );
  y = Math.ceil( (window.screen.height  - h) / 2 );
  centra = 'top='+y+',left='+x+',';
  w = w+40;
  h = h+70;
  grg=window.open(addr,'',centra+'toolbar=no,status=no,scrollbars=yes,resizable=no,width='+w+',height='+h)
  grg.focus();
}

// End -->


<!-- Begin Auto Resize Pop Up
function gregpopupautoresize(addr,id) {
	 var w = document.getElementById(id).offsetWidth + 50;
	 var h = document.getElementById(id).offsetHeight + 80;
	 gregpopupresize(addr,w,h);
}
// End -->


//<!-- Begin Resize Pop Up
function gregpopupresize(addr,w,h) {
  x = Math.ceil( (window.screen.width  - w - 70) / 2 );
  y = Math.ceil( (window.screen.height  - h - 100) / 2 );
	 if (y <= 1) { y = 1; }
 if (h > window.screen.height) 
     { h=window.screen.height - 100;
       scrolls='yes';
       y=2;
      } else {
       scrolls='no';
       h = h+70; }
  	centra = 'top='+y+',left='+x+',';
    w = w+40;
  grg=window.open(addr,'',centra+'menubar=no,location=no,toolbar=no,status=no,scrollbars='+scrolls+',resizable=no,width='+w+',height='+h)
  grg.focus();
}
// End -->


function mostradiv(id,divimg,open,close)
{
//alert(document.getElementById(img));
    if (document.getElementById){
        if(document.getElementById(id).style.display == 'none'){
        document.getElementById(id).style.display = 'block';
        document.getElementById(divimg).innerHTML='<img src="' + close + '" border="0">'

        } else {
        document.getElementById(id).style.display = 'none';
        document.getElementById(divimg).innerHTML='<img src="' + open + '" border="0">'
        }
    }
}



//<!-- Begin Resize Pop Up

function gregpopupresizescroll(addr,w,h,scrolls) {
  x = Math.ceil( (window.screen.width  - w - 70) / 2 );
  y = Math.ceil( (window.screen.height  - h - 100) / 2 );

 if (scrolls == "yes") 
      { y=2; }
 else
      {
 		if (h > window.screen.height) 
 		    { h=700;
 		      scrolls='yes';
 		      y=2;
 		     } else {
 		      scrolls='no';
 		      h = h+70; }      
 	  }   
  centra = 'top='+y+',left='+x+',';
    w = w+40;
  grg=window.open(addr,'',centra+'menubar=no,location=no,toolbar=no,status=no,scrollbars='+scrolls+',resizable=no,width='+w+',height='+h)
  grg.focus();
}

// End -->


//<!-- Begin full screen

function fullScreen() {
  window.open(location.href,'fullscreen','fullscreen,scrollbars')
}
function calcola(stringa){
 var temp = 1
 for(i = 0; i < stringa.length; i++) {
 temp *= stringa.charCodeAt(i) + 21;
 }
 return temp;
}
// End -->


//<!-- Checkbox

function checkbocs(nameform,seldel)
{	
	tot=nameform.length;	
	if(isNaN(tot))
	 {	nameform.checked = seldel;	}
	 else
	 {		
	 	for(cont=0;cont<tot;cont++){			
	 	nameform[cont].checked = seldel;		}	
	 }
 }

// End -->


//<!-- Stampa documento

function stampa(){
	if (!window.print){
	alert("Browser non supportato!")
	return
}
window.print()
}

// End -->



//<!-- Invia email
function sendemailto(testo,addr,subj) {
	var sendurl = "";
	to = "webmaster@gregorys.it";
	var txt = "Inserisci qui il testo da inviare al Webmaster\n";	
	
	if (addr == "we") {	txt = "Write here to Webmaster\n"; }

	if ((addr != "w") && (addr != "we"))
	{ 
	to = "";
	txt = testo + "\n";
	sendurl = document.location.href; 
	}
	var foot = "\n\n*********************\nGregorys.it\nhttp://www.gregorys.it\nwebmaster@gregorys.it\n*********************\n"
	var body = escape(txt + sendurl + foot );
	var sendmail = window.open("mailto:" + to + "?subject=" + subj + "&body=" + body, "sendmail");
}

// End-->


//<!-- Colora input

function sel(id) {
 	 if (!document.getElementById) return;
  		selDiv = document.getElementById(id);
  		selDiv.style.backgroundColor = "#ffc";
}

function des(id) {
 	 if (!document.getElementById) return;
  		selDiv = document.getElementById(id);
  		selDiv.style.backgroundColor = "#fff";
}

function selcol(id,col,colfont) {
 	 if (!document.getElementById) return;
  		selDiv = document.getElementById(id);
  		selDiv.style.backgroundColor=col;
  		selDiv.style.color=colfont;
}

function descol(id,col,colfont) {
 	 if (!document.getElementById) return;
  		selDiv = document.getElementById(id);
  		selDiv.style.backgroundColor=col;
  		selDiv.style.color=colfont;  		
}

function selcolopen(id,col,colfont,n) {
 	 if (!document.getElementById) return;
  		selDiv = document.getElementById(id);
  		selDiv.style.backgroundColor=col;
  		selDiv.style.color=colfont;
		selDiv.style.width=n;
}

function descolopen(id,col,colfont,n) {
 	 if (!document.getElementById) return;
  		selDiv = document.getElementById(id);
  		selDiv.style.backgroundColor=col;
  		selDiv.style.color=colfont;
		selDiv.style.width=n;
}

// End-->


//<!-- Controllo data
function datavalida(day, month, year)
{
var mese = new Array("Gennaio", "Febbraio", "Marzo", "Aprile","Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"); 


 if (month == 2) maxDay = (!(year % 4) && ((year % 100) || !(year % 400))) ? 29 : 28;  else maxDay = (month == 4 || month == 6 || month == 9 || month == 11) ? 30 : 31;

 if (day < 1 || day > maxDay)    
	{      
	alert("- - - - - - - - - A T T E N Z I O N E - - - - - - - - -\nIl mese di " + mese[month - 1]+ " non ha " + day + " giorni.\nControllare il giorno e inserirne uno compreso tra 1 e " + maxDay + "!");       
	return(false);    
	}
 return true;
}
// End-->


//<!-- Href su pagina

function vai(pagina)
{
location.href=pagina;
}

function sendlinkfrie(tt)
{
var pgurl = document.location.href;
address = '../sef.asp?tit=' + tt + '&addr=' + pgurl;
gregpopupresize(address,600,380);
}

function sendlinkfrienu(tt,ll)
{
address = 'sef.asp?l=' + ll + '&tit=' + tt;
gregpopupresize(address,600,400);
}


// End-->

