function selected(href, pagina) {
	if (href == pagina) {
		return 'id="selected"';
	} else {
		return '';
	}

}


function menu(pagina) {

	// home
        document.write('<div id="menu"> 					');
        document.write('  <ul> 							');
        document.write('    <li><a '+selected('index.html', pagina)+' href="index.html">Home</a></li> ');
        document.write('  </ul>							');
        document.write('</div>							');

	// azienda
        document.write('<div id="menu">						');
        document.write('  <h1>Azienda</h1>					');
        document.write('  <ul>							');
        document.write('    <li><a '+selected('chisiamo.html', pagina)+' href="chisiamo.html">Chi siamo</a></li>		');
        document.write('    <li><a '+selected('contatti.html', pagina)+' href="contatti.html">Contatti</a></li>		');
        document.write('  </ul>							');
        document.write('</div>							');
        

	// servizi
	document.write('<div id="menu">						');
        document.write('  <h1>Servizi</h1>					');
        document.write('  <ul>							');
        document.write('    <li><a  '+selected('strumenti.html', pagina)+' href="strumenti.html">Strumenti musicali</a></li>	');
        document.write('    <li><a  '+selected('christie.html', pagina)+' href="christie.html">Installatore Christie</a></li>');
        document.write('    <li><a  '+selected('juke.html', pagina)+' href="juke.html">Juke-box</a></li>	');
        document.write('    <li><a  '+selected('apparati.html', pagina)+' href="apparati.html">Apparati elettronici</a></li>	');
        document.write('  </ul>							');
        document.write('</div>							');

	// show room
        document.write('<div id="menu">						');
        document.write('  <h1>Show room</h1>					');
        document.write('  <ul>							');
        document.write('    <li><a '+selected('showroom.html', pagina)+' href="showroom.html">Visita la show room</a></li>');
        document.write('    <li><a '+selected('bcv3.html', pagina)+' href="bcv3.html">Hammond BCV3</a></li>');
        document.write('    <li><a '+selected('shownova.html', pagina)+' href="shownova.html">Hammond Novachord</a></li>');
        document.write('  </ul>							');
        document.write('</div>							');

	// articoli
        document.write('<div id="menu">						');
        document.write('  <h1>Appunti di laboratorio</h1>					');
        document.write('  <ul>							');
        document.write('    <li><a '+selected('telef569.html', pagina)+' href="telef569.html">Restauro Telefunken Mod.569</a></li>		');
        document.write('    <li><a '+selected('eletnova.html', pagina)+' href="eletnova.html">L\'elettronica del Novachord</a></li>		');
        document.write('    <li><a '+selected('restnova.html', pagina)+' href="restnova.html">Il restauro del Novachord</a></li>		');
        document.write('  </ul>							');
        document.write('</div>							');

	// links
        document.write('<div id="menu"> 					');
        document.write('  <ul> 							');
        document.write('    <li><a '+selected('links.html', pagina)+' href="links.html">Links</a></li> ');
        document.write('  </ul>							');
        document.write('</div>							');

	// news
        document.write('<div class="sidebaritem">');
        document.write('  <h1>News</h1>');
        document.write('	<iframe src="news.html" width="100%" height="250" style="border-width: thin;">');
        // document.write('	<iframe src ="" width="100%" height="250" style="border-width: thin;">');
        document.write('	</iframe>');
        document.write('</div>');
}


function footer() {
	// footer
        document.write('<div id="footer">');
	document.write('	&copy 2009 RadioMeccanica 01614430997 | <a href="#">info@radiomeccanica.com</a>');
	document.write('</div>');
}



function addCaption( oImgElem, bUseCaptionMarker )
{
  // Insert Caption
  var oCaptionElem = document.createElement("div");
  oCaptionElem.className = "caption";

  if( bUseCaptionMarker)
  {
    var oCaptionMarkerElem = document.createElement("div");
    oCaptionMarkerElem.className = "caption-marker";
    var oCaptionMarkerTextElem = document.createTextNode("\u00bb");
    oCaptionMarkerElem.appendChild(oCaptionMarkerTextElem);
    oCaptionElem.appendChild(oCaptionMarkerElem );
  }

  var oCaptionTextElem = document.createElement("div");
  oCaptionTextElem.className = "caption-text";
  var oCaptionText = document.createTextNode( oImgElem.alt );
  oCaptionTextElem.appendChild(oCaptionText );
  oCaptionElem.appendChild(oCaptionTextElem);



  if(oImgElem.nextSibling) 
    oImgElem.parentNode.insertBefore(oCaptionElem,
      oImgElem.nextSibling);
  else
    oImgElem.parentNode.appendChild(oCaptionElem);

  with(oImgElem.style)
  {
    oCaptionElem.style.width = (oImgElem.width+borderLeft+
      borderRight+paddingLeft+paddingRight)+"px";
  }

  return true; 
}


function goImgWin(myImage,myWidth,myHeight,origLeft,origTop) {
	myHeight += 85;
	myWidth += 24;
	TheImgWin = window.open(myImage,'image','height=' +
	myHeight + ',width=' + myWidth +
	',toolbar=no,directories=no,status=no,' +
	'menubar=no,scrollbars=no,resizable=no');
	TheImgWin.resizeTo(myWidth+2,myHeight+30);
	TheImgWin.moveTo(origLeft,origTop);
	TheImgWin.focus();
}


function showImage(imgName, tumbName, pWidth, pHeight, caption, popup) {
// <a href="" target="_blank" onclick="goImgWin('img/BCV3.jpg',800,600,100,50); return false;"><img class="photo" onload="javascript:addCaption(this,true)" src="img/BCV3_t.jpg" alt="Hammond BCV3"/></a>
	if (popup)
		document.write('<a href="" target="_blank" onclick="goImgWin(\''+imgName+'\','+pWidth+','+pHeight+',100,50); return false;">');
		document.write('<img class="photo" onload="javascript:addCaption(this,true)" ');
		document.write('src="'+tumbName+'" alt="'+caption+'"/>');

	if (popup)
		document.write('</a>');

	/*
        document.write('<a href="" target="_blank" onclick="goImgWin(\'img/BCV3.jpg\',800,600,100,50); return false;">');
        document.write('<img class="photo" onload="javascript:addCaption(this,true)" ');
        document.write('src="img/BCV3_t.jpg" alt="Hammond BCV3"/>');
        document.write('</a>');
	*/

}

