// オンラインDVDレンタル スタイル
// version 1.00
// Copyright(c) 2004 Ksc
getBrowser();
//―――――――――――――――――――――――――――――――――――――――――――――
//□ブラウザの取得
function getBrowser(){
	ua = new Object();
	var useragent = navigator.userAgent;

	// ▽ Opera ==> ua.Opera
	if ( useragent.match( /Opera[\/\s](\d+\.\d+)/ ) && RegExp.$1 >= 6 ){ ua.Opera = RegExp.$1; return true; }

	// ▽ Internet Explorer ==> ua.InternetExplorer
	if ( useragent.match( /MSIE (\d+\.\d+);/ ) && RegExp.$1 >= 5 ){ ua.InternetExplorer = RegExp.$1; return true; }

	// ▽ Netscape6 ==> ua.Netscape
	if ( useragent.match( /Netscape[6789]\/(\d+\.\d+)/ ) ){ ua.Netscape = RegExp.$1; return true; }

	// ▽ Mozilla ==> ua.Mozilla
	if ( useragent.match( /^Mozilla\/[56789]\.0.+rv:(\d+\.\d+).+Gecko/ ) && RegExp.$1 >= 1 ){ ua.Mozilla = RegExp.$1; return true; }

	ua.other = 1; return false; 
}
//―――――――――――――――――――――――――――――――――――――――――――――
//□ページ内スクロール
function Scroll( id , to , from , n ){
	if( !ua.InternetExplorer ){ return; }

	if( id ){
		if( id == "at-top" ){
			to = 0;
		} else {
			var obj = document.getElementById( id );
			var obj_parent = document.getElementById( 'area-main' );
			to = obj_parent.offsetTop + obj.offsetTop - 3 ;
			event.returnValue = false;
		}
		from = document.body.scrollTop;

		if( to == from ){ return false; } else { n = 0; }
	}
	var dy = n * n * 20;

	if( to > from ){
		if( dy >= ( to - from ) ){ dy = ( to - from ); }
		window.scrollTo( 0 , dy + from );
		if( dy < ( to - from ) ){ window.setTimeout( "Scroll( '' , " + to + " , " + from + " , " + ( n + 1 ) + " );" , 10 ); }
	} else {
		if( dy >= ( from - to ) ){ dy = ( from - to ); }
		window.scrollTo( 0 , from - dy );
		if( dy < ( from - to ) ){ window.setTimeout( "Scroll( '' , " + to + " , " + from + " , " + ( n + 1 ) + " );" , 10 ); }
	}

	return false;
}
//―――――――――――――――――――――――――――――――――――――――――――――
//□メールアドレス表示
function WriteMailaddress(){

	var mail1 = "ksc2";
	var mail2 = "movies.ne.jp";
	document.write( "( <a href=\"mailto:" + mail1 + "@" + mail2 + "\" class=\"navi-inlineLink02\">" + mail1 + "@" + mail2 + "</a> )" );
}
//―――――――――――――――――――――――――――――――――――――――――――――
jsdb_ref = "";
jsdb_imgurl_prefix = "http://images-jp.amazon.com/images/P/";	//JSDBの画像URLプレフィックス
jsdb_imgurl_suffix = ".09.THUMBZZZ.jpg";						//      〃     サシックス
//------------------------------------------------------------------------------------------
//□JSDBのセット
function setJSDB( ref  ){
	max = jsdb_max;
	if( ref == "-" ){ return true; }	//セパレートの場合

	//▽未指定の場合、ランダムに選択
	if( !ref ){
		refs = new Array( "pickup,1" , "rank_movie" , "rank_all" , "rank_movie,0" , "rank_movie,1" , "rank_all,0" , "rank_all,1" );
		ref  = refs[ Math.floor( Math.random() * refs.length ) ];
		document.getElementById( "jsdb_pulldown" ).value = ref;
	}

	//▽引数をグローバル変数に記録しておく
	jsdb_ref = ref;

	//▽引数を分解
	temp = ref.split( "," );
	type = temp[ 0 ];  sale = temp[ 1 ];


	//▽HTMLの作成
	data = dvdtitle[ type ];
	out_html  = "<table id=\"leftadbar\">\n";
	out_html += "<col id=\"leftadbar-col1\"><col id=\"leftadbar-col2\">\n";
	max = ( max ? max : data.length );	//最大値の決定
	j = 1;
	for( i = 0 ; i < data.length ; i++ ){
		if( sale === "0" && parseInt( data[ i ][ 1 ] ) != 0 ){ continue; }  //販売のみ
		if( sale === "1" && parseInt( data[ i ][ 1 ] ) != 1 ){ continue; }  //予約のみ

		out_html += "<tr><td class=\"leftadbar-col1\"><a href=\"./../detail.php?asin=" + data[ i ][ 0 ] + "\"><img src=\"" + jsdb_imgurl_prefix + data[ i ][ 0 ] + jsdb_imgurl_suffix + "\" border=\"0\" alt=\"\"></a></td><td class=\"leftadbar-col2\"><a href=\"./../detail.php?asin=" + data[ i ][ 0 ] + "\">" + data[ i ][ 2 ] + "</a></td></tr>";
		if( j < max ){ j++; } else { break; }
	}
	out_html += "</table>";

	//▽HTMLの書き換え
	document.getElementById( "jsdb" ).innerHTML = out_html;
}
//------------------------------------------------------------------------------------------
//□JSDBのプルダウンのセット
function setJSDB_pulldown(){

	out_html  = "<select id=\"jsdb_pulldown\" size=\"1\" onChange=\"setJSDB( this.value );\" style=\"width:190px;\">";
	out_html += "	<option value=\"pickup,1\">ピックアップ</option>";
	out_html += "	<option value=\"-\">━━━━━━━━━━</option>";
	out_html += "	<option value=\"rank_movie\">総合ランキング《映画》</option>";
	out_html += "	<option value=\"rank_all\">総合ランキング《全般》</option>";
	out_html += "	<option value=\"-\">--------------------</option>";
	out_html += "	<option value=\"rank_movie,1\">売上ランキング《映画》</option>";
	out_html += "	<option value=\"rank_all,1\">売上ランキング《全般》</option>";
	out_html += "	<option value=\"-\">--------------------</option>";
	out_html += "	<option value=\"rank_movie,0\">予約ランキング《映画》</option>";
	out_html += "	<option value=\"rank_all,0\">予約ランキング《全般》</option>";
	out_html += "</select>";

	document.write( out_html );
}







