function displayimage(myimage) {
 html = "<HTML><HEAD><TITLE>Photo</TITLE>" +
  "</HEAD><BODY LEFTMARGIN=0 " +
  "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER>" +
  "<IMG SRC='" + myimage + "' BORDER=0 NAME=image " +
  "onload='window.resizeTo(document.image.width,document.image.height)'></CENTER>" +
  "</BODY></HTML>";
 popup=window.open
   ('','image','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
 popup.document.open();
 popup.document.write(html);
 //popup.document.focus();
 popup.document.close()
 };

/****************************************************************************************
 Script to check a form is filled out correctly
 Version : 1.0.2 
*****************************************************************************************
//Example of use:

function someFunctionYouCreated( theForm ) {
	if( !isValidType( theForm.title, 'select' ) ) {
		window.alert( 'You have not selected a title.' );
		return false;
	}
	if( !isValidType( theForm.firstName, 'name' ) ) {
		window.alert( 'You have not given a valid first name.' );
		return false;
	}
	if( !isValidType( theForm.lastName, 'name' ) ) {
		window.alert( 'You have not given a valid last name.' );
		return false;
	}
	if( !isValidType( theForm.email, 'email' ) ) {
		window.alert( 'You have not given a valid email address.' );
		return false;
	}
	if( !isValidType( theForm.phoneNum, 'number' ) ) {
		window.alert( 'You have not given a valid phone number.' );
		return false;
	}
	return true; //don't forget this line
}

the form might contain the following attribute:
onsubmit="return someFunctionYouCreated(this);"

Datatypes that can be tested for are:
'select' - checks that something other that option 0 on a select box has been chosen
'name' - checks that a valid name type has been given, ie. me, henry, anne-marie, billy-joe-sue
'email' - checks that a valid email type has been given
'number' - checks that all characters given are numbers

Note, the email address check is not perfect. The correct pattern is far too much for some browsers
to handle, which is why I did not use it, but here it is if you want it:
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\"([^\"\\\r]|(\\[\w\W]))*\"))@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([a-z\-0-9áàäçéèêñóòôöüæøå]+\.)+[a-z]{2,}))$/i
_______________________________________________________________________________________*/
function isValidType( oInput, oType ) {
	switch( oType.toLowerCase() ) {
		case 'select':
			return oInput.selectedIndex;
		case 'number':
			if( !oInput.value ) { return false; }
			for( var mXi = 0; mXi < oInput.value.length; mXi++ ) {
				if( oInput.value.charAt( mXi ) != '' + parseInt( oInput.value.charAt( mXi ) ) + '' ) { return false; }
			} return true;
		case 'name':
			return ( oInput.value && !oInput.value.replace( /[a-záàäçéèêñóòôöüæøå]+( ?[-']?[a-záàäçéèêñóòôöüæøå]+)*/i, "" ) );
		case 'email':
			return ( oInput.value && !oInput.value.replace( /[\w\-\+]+(\.[\w\-\+]+)*@([\w\-áàäçéèêñóòôöüæøå]+\.)+[a-z]+/i, "" ) );
	}
 return false;
}

function progres_bar_next_step(pos){ 
 document.getElementById("progressbar").style.left = pos + 'px'; 
 if (pos >= 200){
  pos=50;
 }else{
  pos = pos + 2,5;
 } 
 timerID = setTimeout("progres_bar_next_step("+ pos +")", 15);
}

function show_wait_message(){ 
 var o = document.getElementById("WaitMessage");
 var count = 0; 
 o.style.left = '400px'; //(((document.getElementById("main").offsetWidth/2)-150)>>0)+"px";		
 o.style.top  = '200px';
 o.style.display = "block";
 o.style.visibility = "visible";
 document.getElementById("progressbar").style.visibility='visible';
}

function startwait_message(){
 show_wait_message(); 
 timerID  = setTimeout("progres_bar_next_step(50)", 15);
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
 return null;
}

function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}

function getCookie(name){
 var dc = document.cookie;
 var prefix = name + "=";
 var begin = dc.indexOf("; " + prefix);
 if (begin == -1){
  begin = dc.indexOf(prefix);
  if (begin != 0) return null;
 }else{
  begin += 2;
 }
 var end = document.cookie.indexOf(";", begin);
 if (end == -1){
  end = dc.length;
 }
 return unescape(dc.substring(begin + prefix.length, end));
}

function changeImages() {
 if (document.images && (preloadFlag == true)) {
	for (var i=0; i<changeImages.arguments.length; i+=2) {
	 if (document[changeImages.arguments[i]] !== undefined){
	  document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
	 }
	}
 } 
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		nav_wuerth_sopra = newImage("images/nav_wuerth-sopra.gif");
		nav_prodotti_sopra = newImage("images/nav_prodotti-sopra.gif");
		nav_servizi_sopra = newImage("images/nav_servizi-sopra.gif");
		nav_contatti_sopra = newImage("images/nav_contatti-sopra.gif");
		layout2005_09_sopra = newImage("images/layout2005_09-sopra.gif");
		tuv_nav_wuerth_sopra = newImage("images/tuv-nav_wuerth_sopra.gif");
		job_nav_wuerth_sopra = newImage("images/job-nav_wuerth_sopra.gif");
		giro_nav_wuerth_sopra = newImage("images/giro-nav_wuerth_sopra.jpg");
		preloadFlag = true;
	}
}


function filldates(from){
 form.fromdate = '01/01/2004';
}

function FormCheckArchive(form){ 
 if (checkdate(form.document.intlogin.fromdate.value) == false){
  return (false);
 }
   
 if (checkdate(form.document.intlogin.todate.value) == false){
  return (false);
 }
  
 if (form.document.fromdate.value == ""){
  alert("Avete dimenticato di riempire il campo\"Da data\"");
  form.fromdate.focus();
  return (false);
 }

 if (form.document.todate.value == ""){
  alert("Avete dimenticato di riempire il campo\"a data\"");
  form.todate.focus();
  return (false);
 }
 return (true);
}


function mailingListFormCheck(){
if ((document.getElementById('totalprice') != null) &&
    (parseInt(document.getElementById('totalprice').value) < 30)){
  alert("L'importo minimo per confermare un ordine è di 30,00 euro iva esclusa, il suo totale è " + document.getElementById('totalprice').value + " euro iva esclusa");  
  return (false);
 }

if (document.getElementById('corporatename').value == ""){
  alert("Avete dimenticato di riempire il campo\"Nome cliente o ragione sociale\"");
  document.getElementById('corporatename').focus();
  return (false);
 }
if (document.getElementById('email').value == ""){
  alert("Avete dimenticato di riempire il campo\"E-Mail\"");
  document.getElementById('email').focus();
  return (false);
 }
 return (true);
}

/* Gestione oggetti con compatibilita multi-browser */
function getObject(objectname){
 if (document.layers){
  return document.objectname;
 }else {  
  if (document.getElementById) {
   return document.getElementById(objectname);
  }else{
   if (document.all) {
    return document.all.objectname;
   }
  }
 }
 return false;
}

function getObjectStyle(objectname){
 if (document.layers){
  return document.objectname;
 }else {
  if (document.getElementById) {
   return document.getElementById(objectname).style;
  }else {
   if (document.all) {
    return document.all.objectname.style;
   }
  }
 }
return false;
}
/* Fine gestione oggetti con compatibilit… multi-browser */


/* Gestione del sistema di popup */

var NN4=document.layers?true:false;
var toggle=false,tipwindow=null,tipwindowStyle=null;

if (NN4){
 window.captureEvents(Event.MOUSEMOVE);
}

function StartTooltips(){
 tipwindow= getObject('tooltip');
 tipwindowStyle= getObjectStyle('tooltip');
}
  
function tipWrite(sTextToWrite){ 
 var maxLineLength = 0;
 var linesCount = 0;
 sLines = sTextToWrite.split('<br>');
 linesCount = sLines.length;
 for(icount = 1; icount < linesCount; icount++){
  actualLineLength = String(sLines[icount]).length;  
   if(actualLineLength > maxLineLength){
   maxLineLength = actualLineLength;
  }
 }
 
 maxLineLength = maxLineLength*4;
 tipwindowStyle.width= maxLineLength*1.5 + 'px';
 tipwindowStyle.height = linesCount * 20 + 'pt';
 if (NN4){
  tipwindow.document.open();
  tipwindow.document.write(sTextToWrite);
  tipwindow.document.close();
 }else{
 	tipwindow.innerHTML=sTextToWrite;
 }
}
	
function tip(sTipText){
 toggle=!toggle;
 if (toggle){
  tipWrite(sTipText);  
  NN4?window.onmousemove=ShowTip:document.onmousemove=ShowTip;
  tipwindowStyle.visibility='visible';
 }else{
  NN4?window.onmousemove=null:document.onmousemove=null;
  tipwindowStyle.visibility='hidden';
 }
}

function ShowTip(moved){  
 	// se il browser supporta la gestione dell'oggetto
 	// moved che contiene lo status attuale del mouse
 	// uso questo oggetto altrimenti uso l'hook che
 	// ho messo sull'evento MOUSEOVER
 if(moved!=undefined){
  tipwindowStyle.top = moved.pageY + 10 +'px';
  tipwindowStyle.left = moved.pageX + 10 +'px';
 }else{ 	
  tipwindowStyle.top = window.event.clientY + 10;
  tipwindowStyle.left = window.event.clientX + 10;
 }
}

/* fine sistema gestione tooltips*/


/* gestione news scroll*/

function verScroll(dir, spd) {
 direction = "up";
 speed = 10;
 scrolltimer = null;
 page = getObjectStyle('newslayer');
 direction = dir;
 speed = parseInt(spd);
 height_limit = parseInt(page.height);
 var y_pos = parseInt(page.top);   
 // for debug only
 //document.getElementById('DebugMessages').innerHTML = 'Limite:' + (height_limit*-1) + ' ' + 'Posizione:' + y_pos + '  ' + (y_pos < (height_limit*-1));
 if ((direction == "dn") && (y_pos >= ((height_limit+7)*-1))) {   
  page.top = ((y_pos - speed) + 'px');   
 }else{
  if ((direction == "up") && (y_pos < 0)) {
   page.top = (y_pos + speed) + 'px';
  }else{
   if (direction == "top") {
    page.top = 0 + 'px';
   }
  }
 }
 scrolltimer = setTimeout("verScroll(direction,speed)", 1); 
}

function stopScroll() { 
 clearTimeout(scrolltimer);
}

/* Fine gestione scroll news */


function checkAcrobat(){

 var acrobat=new Object();
 var x = 0;
 // Set some base values
 acrobat.installed=false;
 acrobat.version='0.0';

 if (navigator.plugins && navigator.plugins.length){
  for (x=0; x<navigator.plugins.length; x++){
	 if (navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1 || 
	     navigator.plugins[x].description.indexOf('Adobe Reader') != -1){
	  acrobat.version=parseFloat(navigator.plugins[x].description.split('Version ')[1]);
 	  if (acrobat.version.toString().length == 1){
		 acrobat.version+='.0';
	  }
	  acrobat.installed=true;
	  break;
	 }
  }
 }else{
  if (window.ActiveXObject){
   for (x=2; x<10; x++){
 	  try{
	   oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
	   if (oAcro){
		  acrobat.installed=true;
		  acrobat.version=x+'.0';
	   }
    }catch(e) {
   }
  }
 
  try{
   oAcro4=new ActiveXObject('PDF.PdfCtrl.1');
   if (oAcro4){
	  acrobat.installed=true;
	  acrobat.version='4.0';
   }
  }catch(e){
  }

  try{
   oAcro7=new ActiveXObject('acroPDF.PDF');
   if (oAcro7){
	  acrobat.installed=true;
	  acrobat.version='7.0';
   }
  }catch(e) {
  }
 
  try{
   oAcro8=new ActiveXObject('acroPDF.FDF.1');
   if (oAcro8){
	  acrobat.installed=true;
	  acrobat.version='8.0';
   }
  }catch(e) {
  }
 
  try{
   oAcroUnk=new ActiveXObject('AcroExch.Document');
   if (oAcroUnk){
	  acrobat.installed=true;
	  acrobat.version='99.0';
   }
  }catch(e) {
  }
 }
 }
 return acrobat.version;
}


function checkAcrobat_old(){
var acrobat=new Object();

 acrobat.installed=false;
 acrobat.version='0.0';

 if (navigator.plugins && navigator.plugins.length){
  for ( var x = 0, l = navigator.plugins.length; x < l; ++x ){
   if (navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1){
    acrobat.version=parseFloat(navigator.plugins[x].description.split('Version ')[1]);
    if (acrobat.version.toString().length == 1) acrobat.version+='.0';
    acrobat.installed=true;
    break;
   }
  }
 }else if (window.ActiveXObject){
 try{
  oAcro7=new ActiveXObject('AcroPDF.PDF.1');
  if (oAcro7){
   acrobat.installed=true;
   acrobat.version='7.0';
  }
 }catch(e) {}
  
 if (acrobat.version.toString == '0.0'){
 for (x=1; x<10; x++){
  try{
   oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
   if (oAcro){
    acrobat.installed=true;
    acrobat.version=x+'.0';
   }
  }catch(e) {}
 }
 }
}
return acrobat.version; 
}

function enhanceTable(){
 var elem = "tr";
  if(document.getElementsByTagName){
   var el = document.getElementsByTagName(elem);
    for(var i=0; i<el.length; i++){
      if(el[i].childNodes[0].tagName != "th"
      && el[i].parentNode.parentNode.className.indexOf("tbl") != -1){
     if(i%2 == 1){
      el[i].className = "on";
      el[i].onmouseout = "this.className = 'off'";
     } else {
      el[i].className = "off";
      el[i].onmouseout = "this.className = 'off'";
     }
      el[i].onmouseover = "this.className = 'hover'";    
    }
  }
 }
}

/* table higlight */
var highlightbehavior="TR"

var ns6=document.getElementById&&!document.all
var ie=document.all

function changeto(e,highlightcolor, defaultcolor){
 source=ie? event.srcElement : e.target
 if (source.tagName=="TABLE") return
 while(source.tagName!=highlightbehavior && source.tagName!="HTML")
  source=ns6? source.parentNode : source.parentElement
 if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore"){
  source.style.backgroundColor=highlightcolor
 }
}

function contains_ns6(master, slave) { //check if slave is contained by master
try{
 while (slave.parentNode)
  if ((slave = slave.parentNode) == master)
  return true;
 return false;
}catch(e) {}
return false;
}

function changeback(e,originalcolor,defaultcolor){
if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore")) return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source){
 source.style.backgroundColor=originalcolor
}
}
/* end table highlight */