/*

 $Name  : common.js, 20101212 © 1996-... pf;
 $Date  : Sat, 12 Dec 2010 10:00:00 GMT;
 $Lang  : js;
 $Type  : text/javascript;
 $Title : Common Functions;
 $Desc  : The common function for pf site on Tiscali;

 Programming and graphics by pf - All Rights Unreserved.
 You may use, copy, modify, distribute, or transmit this code for any purpose.
 Please send any questions to: pjoef@tiscali.it

*/

// ridimensionamento frames
if (window != window.top)
 top.document.getElementsByTagName('frameset')[0].rows='0,*,0';

// global vars.
var today = new Date();
var expires = new Date();
var nname = navigator.appName;
var nver  = parseInt(navigator.appVersion);


expires.setTime(today.getTime() + (1000 * 60 * 60 * 24 * 365));

//  Set a cookie with a value and an expire date  ********************
function setCookie(name, value, expire)
{ document.cookie = name + '=' + escape(value) +
    ((expire == null) ? '' : ('; expires=' + expire.toGMTString()))

/*
{ document.cookie = name + '=' + escape(value) +
    ((expire == null) ? ('; expires=' + expires.toGMTString()) :
      ('; expires=' + expire.toGMTString()));

  alert('debug from common.js, cookie set! ' +
        ' name     : ' + name +
        ' value    : ' + value +
        ' today    : ' + today +
        ' todayGMT : ' + today.toGMTString() +
        ' expire   : ' + expire +
        ' expireGMT: ' + expire.toGMTString() +
        ' expires  : ' + expires.toString() +
        ' cookies  : ' + document.cookie.toString());
*/
}

//  getCookie get a cookie value  ************************************
function getCookie(Name)
{ var search = Name + '=';

  //  if exist at least one cookie  **********************************
  if (document.cookie.length > 0)
  { offset = document.cookie.indexOf(search);

    //  if cookie really exist  **************************************
    if (offset != -1)
    { //  set the initial index  *************************************
      offset += search.length;

      //  set the end index  *****************************************
      end = document.cookie.indexOf(';', offset);

      if (end == -1) end = document.cookie.length
        return unescape(document.cookie.substring(offset, end));
    }
  }
}

// fn_css - load specific CSS.
// pitdt: [string] position in the directory tree.
function fn_css(pitdt)
{ if (pitdt == null) pitdt = 'http:\/\/web.tiscali.it\/pf\/';

/*
  if (window.name == 'slcntnt' && document.bgColor == '#ffffff')
  { document.writeln('<link rel="stylesheet"' +
      ' href="' + pitdt + 'css\/slcntnt.css" \/>');
  }
*/

  // CSS for Netscape < 5...
  if (nname == 'Netscape' && nver < 5)
  { document.writeln('<link rel="stylesheet"' +
      ' href="' + pitdt + 'css\/ns4.css" \/>');

    // Loading OSs specified CSS for Netscape < 5...

    // Netscape < 5 on Linux.
    if (navigator.userAgent.indexOf('inux') != -1)
      document.writeln('<link rel="stylesheet"' +
        ' href="' + pitdt + 'css\/ns4linux.css" \/>')

  // ...end of loading CSS for Netscape < 5.
  }
  else
  { // Netscape > 5 
    if (nname == 'Netscape' && nver > 4) document.writeln('<link rel="stylesheet"' +
      ' href="' + pitdt + 'css\/ns5.css" \/>');
    // Internet Explorer
    else if (name == 'Microsoft Internet Explorer') document.writeln('<link' +
      ' rel="stylesheet" href="' + pitdt + 'css\/ie.css" \/>');
/*
  else
    document.writeln('<link rel="stylesheet"' +
      ' href="' + pitdt + 'css\/ns.css" \/>');
*/

  }

  // css3 4 all
  document.writeln('<link rel="stylesheet"' +
    ' href="' + pitdt + 'css\/css3.css" \/>');
}
// end of fn_css




// prnttm7slnks - print TM7 sections links.
// tm7path: [string] tm7 position in the directory tree.
function prnttm7slnks(tm7path)
{ //if (tm7path == null) pitdt = 'http:\/\/web.tiscali.it\/pf\/tm7\/';
  //if (tm7path == null) pitdt = '';

  document.writeln('<tr class="bg820">');
  document.writeln('<td><div class="bg820">');
  document.writeln('<a href="' + tm7path + 'pf_videos.html">My Videos</a> <br>');
//  document.writeln(' &nbsp; <br>');
  document.writeln('<a href="' + tm7path + 'area.html">AreA & Demetrio Stratos</a> <br>');
  document.writeln('<a href="' + tm7path + 'bauhaus.html">Bauhaus</a> <br>');
  document.writeln('<a href="' + tm7path + 'cccp.html">CCCP+CSI-PGR</a> <br>');
  document.writeln('<a href="' + tm7path + 'the_clash.html">The Clash</a> <br>');
  document.writeln('<a href="' + tm7path + 'rino_gaetano.html">Rino Gaetano</a> <br>');
  document.writeln('<a href="' + tm7path + 'che_guevara.html">Ernesto "Che" Guevara</a> <br>');
  document.writeln('<a href="' + tm7path + 'jimi_hendrix.html">Jimi Hendrix</a> <br>');
  document.writeln('<a href="' + tm7path + 'billie_holiday.html">Billie Holiday</a> <br>');
  document.writeln('</div></td>');

  document.writeln('<td><div class="bg820">');
  document.writeln('<a href="' + tm7path + 'jefferson_airplane.html">Jefferson Airplane</a> <br>');
  document.writeln('<a href="' + tm7path + 'joy_division.html">Joy Division</a> <br>');
  document.writeln('<a href="' + tm7path + 'killing_joke.html">Killing Joke</a> <br>');
  document.writeln('<a href="' + tm7path + 'king_crimson.html">King Crimson</a> <br>');
  document.writeln('<a href="' + tm7path + 'led_zeppelin.html">Led Zeppelin</a> <br>');
  document.writeln('<a href="' + tm7path + 'bob_marley.html">Bob Marley</a> <br>');
  document.writeln('<a href="' + tm7path + 'the_stranglers.html">The Stranglers</a> <br>');
  document.writeln('<a href="' + tm7path + 'joe_strummer.html">J&#10026;E STRUMMER</a> <br>');
  document.writeln('<a href="' + tm7path + 'weather_report.html">Weather Report</a> <br>');
  document.writeln('</div></td>');

  document.writeln('<td><div class="bg820">');
  document.writeln('<a href="' + tm7path + 'the_who.html">The Who</a> <br>');
  document.writeln('<a href="' + tm7path + 'frank_zappa.html">Frank Zappa</a> <br>');
  document.writeln('<a href="' + tm7path + 'albums.html">Albums</a> <br>');
  document.writeln('<a href="' + tm7path + 'art.html">Art</a> <br>');
  document.writeln('<a href="' + tm7path + 'cinema_show.html">Cinema Show</a> <br>');
  document.writeln('<a href="' + tm7path + 'cover.html">Cover Versions</a> <br>');
  document.writeln('<a href="' + tm7path + 'docs.html">Docs</a> <br>');
  document.writeln('<a href="' + tm7path + 'edu.html">Edu</a> <br>');
  document.writeln('<a href="' + tm7path + 'fun.html">Fun</a> <br>');
  document.writeln('</div></td>');

  document.writeln('<td><div class="bg820">');
  document.writeln('<a href="' + tm7path + 'live.html">Live</a> <br>');
  document.writeln('<a href="' + tm7path + 'love_and_fear.html">Love & Fear</a> <br>');
  document.writeln('<a href="' + tm7path + 'mg.html">Music Genres</a> <br>');
  document.writeln('<a href="' + tm7path + 'music_videos.html">Music Videos</a> <br>');
  document.writeln('<a href="' + tm7path + 'songs.html">Songs</a> <br>');
  document.writeln(' &nbsp; <br>');
  document.writeln('<a href="http://www.youtube.com/view_play_list?p=DAB41453E5472072"');
  document.writeln(' target="_blank">&#8734;&#9829;4Mu$&#9834;&copy;</a> <br>');
  document.writeln('<a href="http://www.youtube.com/view_play_list?p=991A95D392DBC05A"');
  document.writeln(' target="_blank">me & YT (part I)</a> <br>');
  document.writeln('<a href="http://www.youtube.com/view_play_list?p=F6F38F16227D0801"');
  document.writeln(' target="_blank">me & YT (part II)</a> <br>');
  document.writeln('</ul></div></td>');
  document.writeln('</tr>');
}
// end of prnttm7slnks



//  openWin  open a window
function openWin(win_name, win_target, win_string)
{ if (parseInt(navigator.appVersion) <= 3 &&
      navigator.appName == 'Netscape')
  { //  if window features string is not the empty string
    if (win_string.length != 0)
    { var new_string = '';
      var new_ld = 0;
      var new_height = -35;
      var new_width  = -12;
      var srch_string = 'menubar=yes';
      var ofst = win_string.indexOf(srch_string);
      if (ofst != -1) new_height -= 24;

      srch_string = 'toolbar=yes';
      ofst = win_string.indexOf(srch_string);
      if (ofst != -1) new_height -= 49;

      srch_string = 'location=yes';
      ofst = win_string.indexOf(srch_string);
      if (ofst != -1)
      { new_height -= 46;
        new_ld = 1;
      }

      srch_string = 'directories=yes';
      ofst = win_string.indexOf(srch_string);
      if (ofst != -1)
      { new_height -= 38;
        new_ld += 1;
      }

      srch_string = 'status=yes';
      ofst = win_string.indexOf(srch_string);
      if (ofst != -1) new_height -= 24;

      if (new_ld == 2) new_height += 20;

      var w_search = 'width=';
      var h_search = 'height=';
      w_ofst = win_string.indexOf(w_search);
      h_ofst = win_string.indexOf(h_search);

      //  if the substrings  height= and  width=  really exist
      if (w_ofst != -1 || h_ofst != -1)
      { if (w_ofst < h_ofst)
        { if (w_ofst > 0)
            new_string = win_string.substring(0, w_ofst) + 'width='
          else new_string = 'width=';

          var oldw_ofst = w_ofst;
          var w1 = parseInt(win_string.substring((w_ofst + 6),
                                                 (w_ofst + 9)),
                            10);
          new_width += w1;
          new_string += new_width.toString();

          if ((w_ofst + 10) < h_ofst)
            new_string += win_string.substring((w_ofst + 9),
                                               h_ofst) + 'height='
          else new_string += ',height=';

          var h1 = parseInt(win_string.substring((h_ofst + 7),
                                                 (h_ofst + 10)),
                            10);
          new_height += h1;
          new_string += new_height.toString();

          if ((h_ofst + 11) < (win_string.length - 1))
            new_string += win_string.substring((h_ofst + 10),
                                               win_string.length);

        }
        else
        { if (h_ofst > 0)
            new_string = win_string.substring(0, h_ofst) + 'height='
          else new_string = 'height=';

          var oldh_ofst = h_ofst;
          var h1 = parseInt(win_string.substring((h_ofst + 7),
                                                 (h_ofst + 10)),
                            10);
          new_height += h1;
          new_string += new_height.toString();

          if ((h_ofst + 11) < w_ofst)
            new_string += win_string.substring((h_ofst + 10),
                                                w_ofst) + 'width='
          else new_string += ',width=';

          var w1 = parseInt(win_string.substring((w_ofst + 6),
                                                 (w_ofst + 9)),
                            10);
          new_width += w1;
          new_string += new_width.toString();

          if ((w_ofst + 10) < (win_string.length - 1))
            new_string += win_string.substring((w_ofst + 9),
                                               win_string.length);
        }

        win_string = new_string;

      }

    }

  }

/*
  if(confirm(' debug alert from common.js' + unescape(lfcr) +
             ' win_string: ' + win_string + unescape(lfcr) +
             ' new string: ' + new_string))
*/

  opnWin = window.open(win_name, win_target, win_string);

  if (navigator.appName == 'Microsoft Internet Explorer')
  { var win_width = 800;
    var win_width = 600;
    var win_screenX = 1;
    var win_screenY = 1;

    var i_search = 'idth=';
    var e_search = 'eight=';
    var i_ofst = win_string.indexOf(i_search);

    var e_ofst = win_string.indexOf(e_search);

    //  if the substrings 'eight=' and 'idth=' really exist
    if (i_ofst != -1 || e_ofst != -1)
    { win_width = parseInt(win_string.substring((i_ofst + 5),
                                                (i_ofst + 8)),
                           10);
      win_height = parseInt(win_string.substring((e_ofst + 6),
                                                 (e_ofst + 9)),
                            10);
    }
    else
    { win_width = 800;
      win_height = 600;
    }

    if (win_width < 64) win_width = 800;
    if (win_height < 48) win_height = 600;

    var X_search = 'creenX=';
    var Y_search = 'creenY=';
    var X_ofst = win_string.indexOf(X_search);
    var Y_ofst = win_string.indexOf(Y_search);

    //  if the substrings creenX= and creenY= really exist
    if (X_ofst != -1 || Y_ofst != -1)
    { win_screenX = parseInt(win_string.substring((X_ofst + 7),
                                                  (X_ofst + 10)),
                             10);
      win_screenY = parseInt(win_string.substring((Y_ofst + 7),
                                                  (Y_ofst + 10)),
                             10);
    }
    else
    { win_screenX = 1;
      win_screenY = 1;
    }

    if (win_screenX < 0) win_screenX = 1;
    if (win_screenY < 0) win_screenY = 1;

    if (win_target == '_self' || win_target == '_top' ||
        win_target == '_parent' || win_target == 'frame0' ||
        win_target == 'frame100' || win_target == 'frame101' ||
        win_target == 'frame11' || win_target == '')
    { top.resizeTo(win_width - 2, win_height - 2);
      top.moveTo(win_screenX, win_screenY);
    }
    else
    { opnWin.resizeTo(win_width - 2, win_height - 2);
      opnWin.moveTo(win_screenX, win_screenY);
    }
/*
    alert(' debug from index.html. win_name: ' + win_name + ', win_t' +
          'arget: ' + win_target + ', win_string: ' + win_string +
          ', win_width: ' + win_width + ', win_height: ' +
          win_height + ', win_screenX: ' + win_screenX + ', win_scr' +
          'eenY: ' + win_screenY);
*/
  }
}

/*
function openWin(win_name, win_target, win_string)
{ if (parseInt(navigator.appVersion) <= 3 &&
      navigator.appName == 'Netscape')
  { if (win_string.length != 0)
    { var new_string = '';
      var new_ld = 0;
      var new_height = -35;
      var new_width  = -12;
      var srch_string = 'menubar=yes';
      var ofst = win_string.indexOf(srch_string);
      if (ofst != -1) new_height -= 24;

      srch_string = 'toolbar=yes';
      ofst = win_string.indexOf(srch_string);
      if (ofst != -1) new_height -= 49;

      srch_string = 'location=yes';
      ofst = win_string.indexOf(srch_string);
      if (ofst != -1)
      { new_height -= 46;
        new_ld = 1;
      }

      srch_string = 'directories=yes';
      ofst = win_string.indexOf(srch_string);
      if (ofst != -1)
      { new_height -= 38;
        new_ld += 1;
      }

      srch_string = 'status=yes';
      ofst = win_string.indexOf(srch_string);
      if (ofst != -1) new_height -= 24;

      if (new_ld == 2) new_height += 20;

      var w_search = 'width=';
      var h_search = 'height=';
      w_ofst = win_string.indexOf(w_search);
      h_ofst = win_string.indexOf(h_search);

      if (w_ofst != -1 || h_ofst != -1)
      { if (w_ofst < h_ofst)
        { if (w_ofst > 0)
            new_string = win_string.substring(0, w_ofst) + 'width='
          else new_string = 'width=';

          var oldw_ofst = w_ofst;
          var w1 = parseInt(win_string.substring((w_ofst + 6),
                                                 (w_ofst + 9)),
                            10);
          new_width += w1;
          new_string += new_width.toString();

          if ((w_ofst + 10) < h_ofst)
            new_string += win_string.substring((w_ofst + 9),
                                               h_ofst) + 'height='
          else new_string += ',height=';

          var h1 = parseInt(win_string.substring((h_ofst + 7),
                                                 (h_ofst + 10)),
                            10);
          new_height += h1;
          new_string += new_height.toString();

          if ((h_ofst + 11) < (win_string.length - 1))
            new_string += win_string.substring((h_ofst + 10),
                                               win_string.length);

        }
        else
        { if (h_ofst > 0)
            new_string = win_string.substring(0, h_ofst) + 'height='
          else new_string = 'height=';

          var oldh_ofst = h_ofst;
          var h1 = parseInt(win_string.substring((h_ofst + 7),
                                                 (h_ofst + 10)),
                            10);
          new_height += h1;
          new_string += new_height.toString();

          if ((h_ofst + 11) < w_ofst)
            new_string += win_string.substring((h_ofst + 10),
                                                w_ofst) + 'width='
          else new_string += ',width=';

          var w1 = parseInt(win_string.substring((w_ofst + 6),
                                                 (w_ofst + 9)),
                            10);
          new_width += w1;
          new_string += new_width.toString();

          if ((w_ofst + 10) < (win_string.length - 1))
            new_string += win_string.substring((w_ofst + 9),
                                               win_string.length);
        }

        win_string = new_string;

      }
    }
  }

  opnWin = window.open(win_name, win_target, win_string);

  if (navigator.appName == 'Microsoft Internet Explorer')
  { var win_width = 800;
    var win_width = 600;
    var win_screenX = 1;
    var win_screenY = 1;

    var i_search = 'idth=';
    var e_search = 'eight=';
    var i_ofst = win_string.indexOf(i_search);
    var e_ofst = win_string.indexOf(e_search);

    if (i_ofst != -1 || e_ofst != -1)
    { win_width = parseInt(win_string.substring((i_ofst + 5),
                                                (i_ofst + 8)),
                           10);
      win_height = parseInt(win_string.substring((e_ofst + 6),
                                                 (e_ofst + 9)),
                            10);
    }
    else
    { win_width = 800;
      win_height = 600;
    }

    if (win_width < 64) win_width = 800;
    if (win_height < 48) win_height = 600;

    var X_search = 'creenX=';
    var Y_search = 'creenY=';
    var X_ofst = win_string.indexOf(X_search);
    var Y_ofst = win_string.indexOf(Y_search);

    if (X_ofst != -1 || Y_ofst != -1)
    { win_screenX = parseInt(win_string.substring((X_ofst + 7),
                                                  (X_ofst + 10)),
                             10);
      win_screenY = parseInt(win_string.substring((Y_ofst + 7),
                                                  (Y_ofst + 10)),
                             10);
    }
    else
    { win_screenX = 1;
      win_screenY = 1;
    }

    if (win_screenX < 0) win_screenX = 1;
    if (win_screenY < 0) win_screenY = 1;

    if (win_target == '_self' || win_target == '_top' ||
        win_target == '_parent' || win_target == 'frame0' ||
        win_target == 'frame100' || win_target == 'frame101' ||
        win_target == 'frame11' || win_target == '')
    { top.resizeTo(win_width - 2, win_height - 2);
      top.moveTo(win_screenX, win_screenY);
    }
    else
    { opnWin.resizeTo(win_width - 2, win_height - 2);
      opnWin.moveTo(win_screenX, win_screenY);
    }
  }
}
*/

//
function showInline (elName)
{ var thElmnt = document.getElementById(elName);

  if (thElmnt)
  { thElmnt.style.display = 'inline';
    //thElmnt.css.visibility = 'visible'
  }
}

//
function hideInline (elName)
{ var thElmnt = document.getElementById(elName);

  if (thElmnt)
  { thElmnt.style.display = 'none';
    //thElmnt.css.visibility = 'hidden'
  }
}



//  end of common.js script  *****************************************
