// JavaScript Document

/**

 * if flvplayer page was called  directly, redirect it. 
*/

function goBackTo(url, hash) {
    if (!location.search.match(/tb=1/)) {
        if (location.href.match(/flvplayer\/([^\/]+)/) 
        || location.href.match(/ooh\/([^\/]+)/)) {
//            location.href = "/jp/virtual-console/#movie=" + RegExp.$1;
            location.href = url + '#' + hash + '=' + RegExp.$1;
        } else {
	var params = parseQuery(location.href.replace(/^[^\?]+\??/,''));
        location.href = url + '#' + hash + '=' + params[hash];
        }
    }
}


function parseQuery ( query ) {
   var Params = new Object ();
   if ( ! query ) return Params; // return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) continue;
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}


