function f_open_window_max( aURL, aWinName )
{
   var wOpen;
   var sOptions;

   sOptions = 'status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no';
   sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

   wOpen = window.open( '', aWinName, sOptions );
   wOpen.location = aURL;
   wOpen.focus();
   wOpen.moveTo( 0, 0 );
   wOpen.resizeTo( screen.availWidth, screen.availHeight );
   return wOpen;
}

function playmedia(link) {
   MediaListen = f_open_window_max( link, "jpop_player" );
}



function CreateBookmarkLink() {
   title = "jpop4u.com";
   url = "http://www.jpop4u.com/";

   if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)
   {
      //google chrome
      alert ('Press <Control> + D to bookmark in Chrome');
   }
   else if (window.sidebar)
   {
      // firefox
      alert ('Press <Control> + D to bookmark in Firefox');
   }
   else if(window.opera && window.print)  // opera
   {
      var elem = document.createElement('a');
      elem.setAttribute('href',url);
      elem.setAttribute('title',title);
      elem.setAttribute('rel','sidebar');
      elem.click();
   }
   else if(document.all) // ie
      window.external.AddFavorite(url, title);
}


var pictisshow=false;
function getScrollY() {
      var scrOfY = 0;
      if( typeof( window.pageYOffset ) == 'number' ) {
        //Netscape compliant
        scrOfY = window.pageYOffset;
      } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
      } else if( document.documentElement &&
          (document.documentElement.scrollTop ) ) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
      }
      return scrOfY;
    }
document.onmousemove=function (e)
{
   if(pictisshow)
   {
      var o=document.getElementById('pict');

      if (!e) e = window.event;
      if (e.pageX || e.pageY)
      {
         x = e.pageX;
         y = e.pageY;
      }
      else if (e.clientX || e.clientY)
      {
         x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
         y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
      }
      o.style.left = x + 30 + "px";
      o.style.top = y + "px";
      //o.style.display = "block";
   }
}

function sp(id)
{
   pictisshow=true;
   var tnF = '';
   var url = "http://www.jpop4u.com/album/japanese/";

   var obj=document.getElementById('pict');
   obj.style.position='absolute';

   obj.innerHTML= '<img src="'+url+id + '/cover.jpg" style="margin:5px;" />';
   obj.style.visibility='visible';

}

function hp()
{
   pictisshow=false;
   var obj=document.getElementById('pict');
   obj.style.visibility='hidden';
}

function show_listen_track ()
{
   var obj = document.getElementById('listen_track');

   if (obj.style.display == "none")
      obj.style.display = "block";
   else
      obj.style.display = "none";
}

var last_tr_obj = '';
function ttr_change (id)
{
   var obj = document.getElementById('tl_tr_' + id);

   obj.bgColor = '#FFFFE8';

   if (last_tr_obj != '')
      last_tr_obj.bgColor = '#EAEAFF';

   last_tr_obj = obj;
}

function make_request (mode, url, parameters)
{
   var http_request = false;
   if (window.XMLHttpRequest) { // Mozilla, Safari,...
      http_request = new XMLHttpRequest();
      if (http_request.overrideMimeType) {
              // set type accordingly to anticipated content type
         //http_request.overrideMimeType('text/xml');
         http_request.overrideMimeType('text/html');
      }
   } else if (window.ActiveXObject) { // IE
      try {
         http_request = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
         try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
         } catch (e) {}
      }
   }
   if (!http_request) {
      alert('Cannot create XMLHTTP instance');
      return false;
   }


   http_request.onreadystatechange = function() { print_contents(mode, http_request); };
   http_request.open('POST', url + parameters, true);
   http_request.send(null);
}


function print_contents (mode, http_request)
{

   if (http_request.readyState == 4)
   {
      if (http_request.status == 200)
      {
         request_output = http_request.responseText;

         if (document.getElementById(mode))
            change_text(mode, request_output);

      }

   }
}

function change_text(id, text){
   var thisobj = document.getElementById(id);
   if (thisobj)
      thisobj.innerHTML = text;
}

