/***************************************************************************
 *            script.js
 *
 *  Sat Jul 22 21:25:36 MSD 2006
 *  Copyright (C) 2006 Anton Y. Yakovlev <yakovlev@jnf.ru>
 ****************************************************************************/

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

function getCookie ( name ) {

  var prefix = name + "=";
  var cookieStartIndex = document.cookie.indexOf( prefix );

  if ( cookieStartIndex == -1 ) {
    return null;
  }

  var cookieEndIndex = document.cookie.indexOf( ";", cookieStartIndex + prefix.length );

  if ( cookieEndIndex == -1 ) {
    cookieEndIndex = document.cookie.length;
  }

  cookieValue = unescape( document.cookie.substring( cookieStartIndex + prefix.length, cookieEndIndex ) );

  if ( cookieValue.charAt( 0 ) == "\"" ) {
    cookieValue = cookieValue.substring( 1, cookieValue.length - 1 );
  }

  return cookieValue;

}

function get_lang () {

  var lang = "";
  var url = window.location.href;

  i = url.indexOf( "lang=" );
  if ( i != -1 ) {
    i += 5;
    lang = url.substring( i, i + 2 );
  } else {
    lang = getCookie( "LOCALIZER_LANGUAGE" );
    if ( lang == null ) {
      lang = "ru";
    }
  }

  return lang;

}

function contacts_page (url) {

  window.open(url, 'contacts_page', 'width=670,height=200,resizable=no,dependent');

}

function logo_enow() {

  document.write( "<a target=_blank href='http://e-now.ru' class='link'>" );
  document.write( "<img height='31' width='88' border='0' src='http://e-now.ru/img/mp3express_88x31.gif' alt='[E-Now]' />" );
  document.write( "</a>" );

}

function logo_roms () {

  lang = get_lang();

  if ( lang == "ru" ) {
    alt_text = "[Лицензия РОМС]"
  } else {
    alt_text = "[ROMS license]"
  }

  document.write( "<a href='http://www.roms.ru/cgi-bin/license.pl?site=mp3snake.com&v=1' class='link'>" );
  document.write( "<img height=31 width=88 border=0 src='http://www.roms.ru/cgi-bin/license.pl?site=mp3snake.com&t=0&r=" + Math.random() + "' alt='" + alt_text + "' />" );
  document.write( "</a>" );

}

function logo_hotlog () {

  document.cookie = "hotlog=1; path=/";

  hotlog_r = "" + Math.random() + "&s=380902&im=16&r=" + escape(document.referrer) + "&pg=" + escape(window.location.href);
  hotlog_r += "&c=" + (document.cookie ? "Y" : "N");
  hotlog_r += "&j=" + (navigator.javaEnabled() ? "Y" : "N");
  hotlog_r += "&wh=" + screen.width + 'x' + screen.height + "&px=" + (((navigator.appName.substring(0, 3) == "Mic")) ? screen.colorDepth : screen.pixelDepth);
  hotlog_r += "&js=1.3";

  document.write("<a href='http://click.hotlog.ru/?380902' target='_top' class='link'>");
  document.write("<img src='http://hit18.hotlog.ru/cgi-bin/hotlog/count?" + hotlog_r + "' border='0' width='88' height='31' alt='[HotLog]' />");
  document.write("</a>");

}

function logo_mail_ru () {

  var a = "";

  a += ";r=" + escape(document.referrer);
  a += ";j=" + navigator.javaEnabled();
  a += ";s=" + screen.width + "*" + screen.height;
  a += ";d=" + (screen.colorDepth ? screen.colorDepth : screen.pixelDepth);

  document.write("<a href='http://top.mail.ru/jump?from=1100589' target='_top' class='link'>");
  document.write("<img src='http://db.cc.b0.a1.top.list.ru/counter?id=1100589;t=240;js=13" + a + ";rand=" + Math.random() + "' alt='[Рейтинг@Mail.ru]' border='0' height='31' width='88'/>");
  document.write("</a>");

}

function logo_w3c_validator () {

  document.write("<a href='http://validator.w3.org/check?uri=referer' class='link'>");
  document.write("<img src='http://www.w3.org/Icons/valid-xhtml10' alt='[Valid XHTML 1.0 Transitional]' height='31' width='88' border='0' />");
  document.write("</a>");

}

