// -----------------------------------------------------------------------------
//	Copyright © Viatgeaddictes.com
//	All Rights Reserved. We will take legal action against those who 
//	copy our HTML content, CSS style sheets and JavaScript functions.
// -----------------------------------------------------------------------------

// Canvi d'idioma
function canviIdioma (pagina, nouIdioma)
{
  dir = pagina + "?nl=" + nouIdioma;
  window.location.href = dir;
}

// Impressió
function imprimir()
{
  if (window.print)
      window.print()
  else
    alert ("Disculpe, su navegador no soporta esta opción.");
}

// Correu
function correu (nom,domini,stext)
{
  document.write ('<a class="mail" href=\"mailto:'+nom+'@'+domini+'\" target="_self" alt=\"'+nom+'@'+domini+'\" title=\"'+nom+'@'+domini+'\">');
  if (stext)
	 document.write (stext+'</a>');
  else
	 document.write (nom+'@'+domini+'</a>');
}

// Enviar
function enviar()
{
  str = "mailto:?subject= Envío de página de Viatgeaddictes.com";
  str += "&body= Título: " + document.title;
  str += " -- Leer página en: " + location.href; 
  location.href = str;
}

// Caixes amb les cantonades arrodonides
function caixaR (ample,ccap1,ccap2,ecap,tcap,cpeu1,cpeu2,epeu,tpeu,linia)
{
  document.write ('<div style="width:'+ample+'px">');
  document.write ('<div style="height:1px;margin-left:2px;margin-right:2px;border-left:1px solid '+ccap2+'; border-right:1px solid '+ccap2+';background-color:'+ccap2+';"><!-- --></div>');
  document.write ('<div style="height:1px;margin-left:1px;margin-right:1px;border-left:1px solid '+ccap2+'; border-right:1px solid '+ccap2+';background-color:'+ccap1+';"><!-- --></div>');
  document.write ('<div style="border-left:1px solid '+ccap2+'; border-right:1px solid '+ccap2+'; background-color:'+ccap1+'; padding:3px;'+ecap+'">'+tcap+'</div>');

  if (linia) document.write ('<div style="margin:0 0 1px 0;"></div>');

  if (tpeu != '') {
	document.write ('<div style="border-left:1px solid '+cpeu2+'; border-right:1px solid '+cpeu2+'; background-color:'+cpeu1+';'+epeu+';padding:3px;">'+tpeu+'</div>');
  }
  document.write ('<div style="height:1px;margin-left:1px;margin-right:1px;border-left:1px solid '+cpeu2+'; border-right:1px solid '+cpeu2+';background-color:'+cpeu1+';"><!-- --></div>');
  document.write ('<div style="height:1px;margin-left:2px;margin-right:2px;border-left:1px solid '+cpeu2+'; border-right:1px solid '+cpeu2+';background-color:'+cpeu2+';"><!-- --></div>');
  document.write ('</div>');
}

// Mostra text vertical
function textVertical (msg)
{
  cont =0;
  while (cont<msg.length)
  {
    letra = msg.substring(cont,cont+1);
    document.write(letra+"<br>");
    cont+=1;
  } 
}

// Mostrar un mapa 
function mmapa (nom,desc,x,y,xp,yp,idioma,i1,i2,i3,i4,i5)
{
  document.write ('<a href="JavaScript:' + "mmapa_w ('" + nom + "','"+ desc + "'," + x + "," + y + ",'" + idioma + "'");
  if (i1) document.write (',1'); else document.write (',0');
  if (i2) document.write (',1'); else document.write (',0');
  if (i3) document.write (',1'); else document.write (',0');
  if (i4) document.write (',1'); else document.write (',0');
  if (i5) document.write (',1'); else document.write (',0');
  document.write (")" +'" target="_self">');
  document.write ('<img src="'+nom+'" border=0 width='+xp+' height='+yp+' alt="'+desc+'" title="'+desc+'" class="foto" /></a>');
}

// Mostrar un mapa (subfunció)
function mmapa_w (nom,desc,x,y,idioma,l1,l2,l3,l4,l5)
{
  var y1 = y - (-23);
  msg = 'toolbar=no,location=no,directories=no,scrollbars=no,status=no,resizable=yes,width='+x+',height='+y1+',menubar=no';
  objWin = window.open ('','foto',msg,false);
  estil = "<style>.llegm {font-weight:bold;font-size:7pt;font-family:Tahoma;text-align:center;}</style>";
  msg = '<HEAD><TITLE>' + desc + '</TITLE>' + estil + '</HEAD>';
  objWin.document.write (msg);
  msg = '<BODY topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>';
  objWin.document.write (msg);

  msg = '<table style="background-color:#A4A4A4; width:'+x+'px; font-family: Verdana,Arial,Helvetica; font-size: 7.5pt;border-bottom:1px solid #000000" cellpadding=5 cellspacing=0><tr><td style="background-color:#f5deb3;color:#7A7A7A"><center><b>Mapa ruta</td>'
  if (idioma == "ca") { t1 = 'Avió'; t2 = 'Autobús/Cotxe'; t3 = 'Vaixell'; t5 = 'A peu/Bicicleta'; }
  else { t1 = 'Avión'; t2 = 'Autobús/Coche'; t3 = 'Barco'; t5 = 'A pie/Bicicleta'; }

  if (l1) { msg = msg + '<td><div class="llegm" style="color:#FFFFFF;">__ ' + t1 + '</div></td>'; }
  if (l2) { msg = msg + '<td><div class="llegm" style="color:#FFFF00">__ ' + t2 + '</div></td>'; }
  if (l3) { msg = msg + '<td><div class="llegm" style="color:#00FFFF">__ ' + t3 + '</div></td>'; }
  if (l4) { msg = msg + '<td><div class="llegm" style="color:#FF0000">__ Tren</div></td>'; }
  if (l5) { msg = msg + '<td><div class="llegm" style="color:#00ff00">__ ' + t5 + '</div></td>'; }

  msg = msg + '</tr></table><div><img src=' + nom + ' width=' + x + ' height=' + y +' alt='+desc+' /></div></BODY>'
  objWin.document.write (msg);
  objWin.document.close ();
}

// Finestra per a enviar correu
//function newWindow (mypage,myname,w,h,features) 
//{
//  if(screen.width){
//  var winl = (screen.width-w)/2;
//  var wint = (screen.height-h)/2;
//  }else{winl = 0;wint =0;}
//  if (winl < 0) winl = 0;
//  if (wint < 0) wint = 0;
//  var settings = 'height=' + h + ',';
//  settings += 'width=' + w + ',';
//  settings += 'top=' + wint + ',';
//  settings += 'left=' + winl + ',';
//  settings += features;
//  win = window.open(mypage,myname,settings);
//  win.window.focus();
//}


