﻿// JavaScript Document

/*イベントトラッキングを仕込む*/
var EventTrack = new String();
var UrlSplit = location.pathname;
var	 US = UrlSplit.split('/');
var funcCartNumber=(function(){
    var n = new Number();
	return function (){
		return n++;
    };
})();
function getEventTrack(){
	if ((UrlSplit=='/titles/bs/')||(UrlSplit=='/titles/kyosoku/')||(UrlSplit=='/titles/pdf/')||(UrlSplit=='titles/sys/107670/cart.html')){
		var	EventTrack ='onclick="javascript:gaEt(\''+US[2]+'\',\'07_cart_'+funcCartNumber()+'\',\'cart_data\');"'
//		mAlert(UrlSplit);
	}else{
		var	EventTrack = '';
	}
	return EventTrack;
}
/*イベントトラッキングを仕込む*/


function titles(name,genre,sentences,code,note,series,lineUp,price,os,pack,license,hatsubaibi,yomi) {
	this.name		= name.replace(/(ソースネクストセレクションコミックス)/,'$1&reg;');			//製品名
	this.genre		= genre;		//色分類
	this.sentences	= sentences;	//中文類
	this.code		= code;			//製品コード
	this.note		= note;			//1行キャッチ
	this.series		= series;		//シリーズ名
	this.lineUp		= lineUp;		//ラインアップ名
	this.price		= price;		//価格
	this.os			= os;			//対応OS
	this.pack		= pack;			//パッケージ内容
	this.license	= license		//ライセンス
	this.hatsubaibi	= hatsubaibi;	//発売日
	this.yomi		= yomi;	//発売日

	this.priceEC	= price;
	//製品ページURL
    this.uri		= function() {
		if(this.genre=='cho'){
			return ('http://www.chou-jimaku.com/titles/products/index.html?temp=index_temp&code=i'+this.code);
		}else{
	        return ('/titles/'+this.genre+'/'+this.code+'/');
		}
    }
	//パッケージページ用、パッケージ詳細HTML出力
    this.toPacklist	= function() {
        return ('<a href="/titles/'+this.genre+'/'+this.code+'/">'+this.name+'<img src="/img/common_img/next.gif" width="15" height="15" align="absmiddle" border="0"></a>');
    }
	//価格
	this.toPackName	= function() {
		return ('<h4>'+this.name+'</h4><p class="caption">標準価格　'+this.price.replace(/r/ig,'')+'円</p>');
	}
	//新規製品チェック
	this.newTitles	= function() {
		var lUrl	= (this.genre=='cho')? 'http://www.chou-jimaku.com/titles/products/index.html?temp=index_temp&code=i'+this.code:'/titles/'+this.genre+'/'+this.code+'/';
		var HTML	=	new String();
			HTML	+=	'<div class="nBox">';
			HTML	+=	'<div class="nImg">\n';
			HTML	+=	('<img src="/img/product_img/'+this.code+'_m.gif" width="60" height="80"  border="0">').link(lUrl)+'\n';
			HTML	+=	'<div ID="agr'+this.code+'"></div>\n'
			HTML	+=	'</div>';
			HTML	+=	'<p class="nHatsubaibi">'+this.hatsubaibi.replace(/(.*?)\/(.*?)\/(.*)/ig,'$1年$2月$3日')+'</p>';
			if(this.series.length>0){
				HTML	+=	(this.genre=='cho')?'<h2>'+this.series.link(lUrl)+'</h2>':'<h2>'+this.series.link(lUrl)+'</h2>';
				var p	='\uFF5E'
			}else{
				HTML	+=	(this.genre=='cho')?'<h2>'+this.name.link(lUrl)+'</h2>':'<h2>'+this.name.link(lUrl)+'</h2>';
				var p	=''
			}
			HTML	+=	'<p>標準価格'+this.price.replace(/r/ig,'')+'円(税込)'+p+'</p>';
			HTML	+=	'<p class="nNote">'+this.note+'</p>';
			HTML	+=	'</div>';
		return(HTML);
	}
	//製品名出力（シリーズ名考慮）
	this.seriesname	= function(){
		if(series.length>1)	return(series);
		else				return(name);
	}
	//
	this.w50HTML	=function(bln){
		var	HTML	= new String();
		var	myName	= new String();
		if(series.length>1)	myName	= series;
		else				myName	= name;
		if(bln){
			HTML += '<tr valign="top" nowrap class="'+fncColor()+'">';
			HTML += '<th>'+myName+'</th>';
			HTML += '<td>'+sentences+'</td>';
			HTML += '<td>'+note+'</td>';
			if(genre=='cho'){
				HTML += '<td class="ssi" nowrap>'+'<img src="/img/common_img/next.gif" width="15" height="15" align="absmiddle" border="0">詳細'.link('http://www.chou-jimaku.com/titles/products/index.html?temp=index_temp&code=i'+code)+'</td></tr>';
			}else{
				HTML += '<td class="ssi" nowrap>'+'<img src="/img/common_img/next.gif" width="15" height="15" align="absmiddle" border="0">詳細'.link('/titles/'+genre+'/'+code+'/')+'</td></tr>';
			}
			return(HTML);
		}else{
			return('');
		}
	}
}
var wArray	= new Array();
	wArray['kid'] = 'ジャンルに関係なく、幼児から高校生までを対象とするソフト。<br>一般用の学習ソフトは水色の「知識・技能の習得」をお探しください。'
	wArray['sel'] = '語学、知識、スキル、資格などの自己啓発ソフト。<br>お子様向けの学習ソフトはピンク色の「幼児～高校生向け」をお探しください。'
	wArray['sys'] = 'セキュリティやシステムユーティリティなどパソコンそのものを目的とするソフト。'
	wArray['use'] = '個人の嗜好が関わりなく、誰もが使う実用的なソフト。<br>キャラクターものや趣味が強く関係するソフトは緑色の「趣味」をお探しください。'
	wArray['hob'] = 'さまざまな分野の趣味のソフト。<br>実用的なソフトでもキャラクターものや嗜好の関わりが強いものはこちらです。'
	wArray['ent'] = 'ゲーム、コミック、マルチメディアなど、娯楽を目的とするソフト。<br>タイピングゲームもこちらです。'
	wArray['pack'] = ''

var objArray	= new Array();
function func_lineUp(xml){
//	alert('ok')
//		var	HTML	= get_response_text(lineUp_xmlhttp.responseText);
		HTMLarray	= new Array();
		HTMLarray	= get_response_text(xml.responseText).replace(/\r/g,'\n').replace(/\n\n+/g,'\n').replace(/\n$/g,'').replace(/）/g,')').replace(/（/g,'(').replace(/\"/g,'').split('\n');
		HTMLarray.shift();
		var	chksum		= false;
		for(var i=0; i<HTMLarray.length; i++){
			HTMLarray[i]	= HTMLarray[i].split('\t');
			objArray[HTMLarray[i][0]]	= new titles(HTMLarray[i][6],HTMLarray[i][1],HTMLarray[i][2],HTMLarray[i][0],HTMLarray[i][8],HTMLarray[i][4],HTMLarray[i][5],HTMLarray[i][9],HTMLarray[i][10],HTMLarray[i][11],HTMLarray[i][12].length,HTMLarray[i][3],HTMLarray[i][7]);
			HTMLarray[i].unshift(HTMLarray[i].splice(7,1));
		}
		var	myPort	=	window.location.port;

		if(!window['sn']){
			create_50List();
		}else if(sn=='license'){
			create_Licenset();
		}else if(sn=='pack'){
			create_packList();
		}else if(sn=='new'){
			create_newList();
		}else if(sn=='vista'){
			vistaLineup('vista');
		}else if(sn=='win7'){
			vistaLineup('win7');
		}else if(sn.length>=5){
			if(objArray[sn]){
				create_lineUpList(objArray[sn].lineUp);
			}
		}else{
			create_colorList(gen);
		}
}
var c	=	true;
function fncColor(){
	c = !c;
	if(c) return('ca') ;else return('cb');
}
/*製品ページラインアップ*/
function create_lineUpList(myLineup){
	var array	=	new Array();
	if(myLineup.length>0){
		for(var i=0; i<HTMLarray.length; i++){
			if(HTMLarray[i][6]==myLineup){
				var HTML  = new String();
					HTML += '<div>'+('<img src="/img/product_img_dl/'+HTMLarray[i][1]+'_m.gif" width="60" height="80" border="0">')+'</div>';
					HTML += '<h3>'+objArray[HTMLarray[i][1]].name.replace(/　$/g,'')+'</h3>';
					HTML += '<p>'+objArray[HTMLarray[i][1]].price.replace(/\\|r/ig,'').replace(/"/g,'')+'円(税込)</p>';
				array.push(HTML);
			}
		}
		if($('lineUp')){
			$('lineUp').innerHTML	+= ('<div class="luBox">'+array.join('</div><div class="luBox">')+'</div>');
			$('lineUp').style.display='block';
		}
	}
}
/*パック製品ラインアップ*/
function create_packList(){
	var a	=	new Array();
	var	n	=	new Number();
	var h	=	new String();
	c	=	true;
	for(var i=0; i<HTMLarray.length; i++){
		if(HTMLarray[i][11].length>0){
			a[n++]	=	HTMLarray[i][1];
		}
	}
	for(var i=0; i<a.length; i++){
		h	+=	'<tr class="'+fncColor()+'"><td>'+objArray[a[i]].toPackName()+'</td><td>';
		h	+=	'<ul class="caption">';
		var l	= objArray[a[i]].pack.split(',');
		for(var j=0; j<l.length; j++){
			if(objArray[l[j]]){
			h	+=	'<li>'+objArray[l[j]].toPacklist()+'</li>';
			}else{
//			alert(l[j]);
			}
		}
		h	+=	'</ul></td></tr>';
	}
	var	hh	='<table width="100%" border="0" cellspacing="1" cellpadding="0" id="pack">';
	var	hf	='</td></tr></table><div style="text-align:right; margin:3px 0 0;" class="caption"><a href="#top">▲上に戻る</a></div>';
	$('lineUp').innerHTML	+= hh+h+hf;
	$('lineUp').style.display='block';
}
/*新製品一覧*/
function create_newList(){
	var array	=	new Array();
	for(var i=0; i<HTMLarray.length; i++){
		if(HTMLarray[i][4].length>0){
			var a	= new Array(HTMLarray[i][4],HTMLarray[i][1]);
			array.push(a);
		}
	}
	array.reverse();
	var HTML	= new String();
	var mm		= new String();
	var	num		= new Number();
	var chk		= new Number();
	for(var i=0; i<array.length; i++){
		if(mm!=array[i][0].replace(/(.*?)\/(.*?)\/.*/ig,'$1/$2')){
				mm	=	array[i][0].replace(/(.*?)\/(.*?)\/.*/ig,'$1/$2');
			var	num		= new Number();
				chk++;
			if(chk>3) break;
			HTML+='<h2 class="mm">'+array[i][0].replace(/(.*?)\/(.*?)\/.*/ig,'$1年$2月発売製品')+'</h2>';
		}
		HTML	+= objArray[array[i][1]].newTitles();
		if(num++%2==1){
		HTML	+= '<div style="clear:both;"></div>';
		}
	}
	$('lineUp').innerHTML	+= HTML;
	$('lineUp').style.display='block';
	$('loading').style.display='none';
}
/*ジャンル一覧*/
var c	=	true;
var color	=new Array()
color['kid']	= new Array('#FFF','#ffcfe7','#ff9ace')
color['sel']	= new Array('#FFF','#bdd3e7','#84bade')
color['sys']	= new Array('#FFF','#decfe7','#c59ece')
color['use']	= new Array('#FFF','#ffba9c','#ff7552')
color['hob']	= new Array('#FFF','#ceeb94','#9cd342')
color['ent']	= new Array('#FFF','#ffdb73','#ffb200')
color['pack']	= new Array('#FFF','#bdd3e7','#84bade')
function fncColorURL(URL){
	c = !c;
	if(c){
		var	colorNum="0"
	}else{
		var	colorNum="1"
	}
return('style="background-color:'+color[gen][colorNum]+'; cursor:pointer; " onMouseOver="this.style.backgroundColor=\''+color[gen][2]+'\'" onMouseOut="this.style.backgroundColor=\''+color[gen][colorNum]+'\'" onClick="location.href=\''+URL+'/\'"');
// onClick="location.href=\'http:\/\/www.sourcenext.com/'"') 
}
function create_colorList(myColor){
	$('janru-word').innerHTML=wArray[gen];
	c	=	true;
	var array		=	new Array();
	var tempArray	=	new Array();
	var imgArray	=	new Array();
	var n			=	new Number();
	HTMLarray.sort();
	for(var i=0; i<HTMLarray.length; i++){
		if((HTMLarray[i][8].length >= 1)&&(HTMLarray[i][2]==myColor)){
			array[n++] = new Array(HTMLarray[i][3],HTMLarray[i][5],HTMLarray[i][7],HTMLarray[i][8],HTMLarray[i][2],HTMLarray[i][1]);
		}
	}
	array.sort();
	for(var i=0; i<array.length; i++){
		var HTML  = new String();
		if(array[i][4]=='cho'){
			HTML += '<tr valign="top" nowrap '+fncColorURL('http://www.chou-jimaku.com/titles/products/index.html?temp=index_temp&code=i'+array[i][5])+'><td>'+array[i][0]+'</td>';
		}else{
			HTML += '<tr valign="top" nowrap '+fncColorURL('/titles/'+array[i][4]+'/'+array[i][5])+'><td>'+array[i][0]+'</td>';
		}
		if(array[i][1].length>1){
			HTML += ('<th>'+array[i][1]+'シリーズ</th>').replace(/\)シリーズ/,')');
		}else{
			HTML += '<th>'+array[i][2]+'</th>';
		}
		HTML += '<td>'+array[i][3]+'</td>';
		HTML += '<td nowrap>'+objArray[array[i][5]].price+'円</td>';
		HTML += '<td class="ssi" nowrap><img src="/img/common_img/next.gif" width="15" height="15" align="absmiddle" border="0">詳細</td></tr>';
		tempArray.push(HTML);
		imgArray.push(array[i][5]);
	}
	var img		=	new String();
	for(i=0; i<5; i++){
		var tmp	=	imgArray.splice(Math.floor(Math.random()*imgArray.length),1);
		img		+=	'<img src="/img/product_img_dl/'+tmp[0]+'_m.gif" width="60" height="80" border="0" img="ｐ">';
	}
	if($('lineUp')){
		$('lineUp').innerHTML	+= ('<div id="lisImgBox">'+img+'</div><table border="0" cellspacing="1" cellpadding="0">'+tempArray.join('\n')+'</table>');
		$('lineUp').style.display='block';
	}
}
function make50Array(){
	var	w		= new Array();
		w[0]	=  new Array('<table border="0" cellspacing="0" cellpadding="0" class="tbl50"><tr><td colspan="4"><a name="a"></a><h2>あ</h2></td></tr>\n',true);
		w[1]	=  new Array('<tr><td colspan="4" nowrap valign="bottom"><a name="k"></a><h2>か<a href="#top">▲上に戻る</a></h2></td></tr>\n',true);
		w[2]	=  new Array('<tr><td colspan="4" nowrap valign="bottom"><a name="s"></a><h2>さ<a href="#top">▲上に戻る</a></h2></td></tr>\n',true);
		w[3]	=  new Array('<tr><td colspan="4" nowrap valign="bottom"><a name="t"></a><h2>た<a href="#top">▲上に戻る</a></h2></td></tr>\n',true);
		w[4]	=  new Array('<tr><td colspan="4" nowrap valign="bottom"><a name="n"></a><h2>な<a href="#top">▲上に戻る</a></h2></td></tr>\n',true);
		w[5]	=  new Array('<tr><td colspan="4" nowrap valign="bottom"><a name="h"></a><h2>は<a href="#top">▲上に戻る</a></h2></td></tr>\n',true);
		w[6]	=  new Array('<tr><td colspan="4" nowrap valign="bottom"><a name="m"></a><h2>ま<a href="#top">▲上に戻る</a></h2></td></tr>\n',true);
		w[7]	=  new Array('<tr><td colspan="4" nowrap valign="bottom"><a name="y"></a><h2>や<a href="#top">▲上に戻る</a></h2></td></tr>\n',true);
		w[8]	=  new Array('<tr><td colspan="4" nowrap valign="bottom"><a name="r"></a><h2>ら<a href="#top">▲上に戻る</a></h2></td></tr>\n',true);
		w[9]	=  new Array('<tr><td colspan="4" nowrap valign="bottom"><a name="w"></a><h2>わ<a href="#top">▲上に戻る</a></h2></td></tr>\n',true);
	return(w)
}
function chkLine(str){
//	myPort	=	window.location.port;
//	if(myPort=='9001')	alert(str);
	var j		= new Number();
	var cap	= str.charCodeAt(0);
		if(cap>=12431)		j	= 9;
		else if(cap>=12425)	j	= 8;
		else if(cap>=12420)	j	= 7;
		else if(cap>=12414)	j	= 6;
		else if(cap>=12399)	j	= 5;
		else if(cap>=12394)	j	= 4;
		else if(cap>=12383)	j	= 3;
		else if(cap>=12373)	j	= 2;
		else if(cap>=12363)	j	= 1;
		else	j	= 0;
	return(j);
}

//50音順リスト出力
function create_50List(){
	var	w	= make50Array();

	var array	=	new Array();
	var sName	= new String();
	HTMLarray.sort();

	for(var i=0; i<HTMLarray.length; i++){
		if(objArray[HTMLarray[i][1]].note && ((objArray[HTMLarray[i][1]].series != sName)||!objArray[HTMLarray[i][1]].series)){
		//「一行キャッチ」と「シリーズ名」を確認して、参照データとして一時的に格納
			array.push(HTMLarray[i][1]);
			sName = objArray[HTMLarray[i][1]].series;
		}
	}
	for(var i=0; i<array.length; i++){
		var j		= chkLine(objArray[array[i]].yomi);
		var HTML	= new String();
		if(w[j][1]){
			HTML	+=	w[j][0];
			w[j][1]	=	false;
			c		=	true;
		}
		HTML	+=	objArray[array[i]].w50HTML(true);
		array[i]	=	HTML;
		$('loading').innerHTML	= '処理中：'+i+'件/'+array.length+'件';
	}
	$('lineUp').innerHTML	= ('<div id="w50">'+array.join('\n')+'</table>\n</div>');
	$('loading').style.display='none';
}

//ライセンスページ
function create_Licenset(){
	var	w	= make50Array();

	var array	=	new Array();
	var sName	= new String();
	HTMLarray.sort();

myPort	=	window.location.port;
//if(myPort=='9001')	alert(HTMLarray[27][7]+'/'+HTMLarray[27][5]);

	for(var i=0; i<HTMLarray.length; i++){
		if(objArray[HTMLarray[i][1]].note && ((objArray[HTMLarray[i][1]].series != sName)||!objArray[HTMLarray[i][1]].series)){
		//「一行キャッチ」と「シリーズ名」を確認して、参照データとして一時的に格納
			array.push(HTMLarray[i][1]);
			sName = objArray[HTMLarray[i][1]].series;
		}
	}
	for(var i=0; i<array.length; i++){
		var j		= chkLine(objArray[array[i]].yomi);
		var HTML	= new String();
		if(w[j][1]){
			HTML	+=	w[j][0];
			w[j][1]	=	false;
			c		=	true;
		}
		HTML	+=	objArray[array[i]].w50HTML(objArray[array[i]].license);
		array[i]	=	HTML;
		$('loading').innerHTML	= '処理中：'+i+'件/'+array.length+'件';
	}
	$('lineUp').innerHTML	= ('<div id="w50">'+array.join('\n')+'</table>\n</div>');
	$('loading').style.display='none';
}

function vistaLineup(os){
	var	tempAry	= new String();
	var	testAry	= new String();
	var	flag		= true
	HTMLarray.sort();
	for(var i=0; i<HTMLarray.length; i++){
		if(os.match(/win7/ig)){
			if(HTMLarray[i][10].match(/win7/gi)&&HTMLarray[i][8]){
				tempAry	+=	objArray[HTMLarray[i][1]].w50HTML(flag);
			}
		}else{
			if(HTMLarray[i][10].match(/vista/gi)&&HTMLarray[i][8]){
				tempAry	+=	objArray[HTMLarray[i][1]].w50HTML(flag);
			}

		}
	}
	$('lineUp').innerHTML	= '<div id="w50"><table class="tbl50" border="0" cellpadding="0" cellspacing="0">'+tempAry+'</table></div>';
/*	$('lineUp').innerHTML	= testAry;*/
	$('lineUp').style.display='block';
}

/**************************************************************************************/
/*ランキング*/
function makeRanking(xmlData){
	loadingStatus = {
		"rank": false,
		"txt" : false,
		"xml" : false
	};
	if((w.port>0)&&!(w.search.match(/_c/))){
/*
		var	xmlData		=	'/eshop/xml/ranking_t.xml';
		var	priceData	=	'/eshop/xml/price_.xml'
		var	titleFile	=	'/titles/test/titlelist_t.txt'
		tAlert('テスト用データを読み込んでいます。')
*/
		var	xmlData		=	'/eshop/xml/ranking.xml';
		var	priceData	=	'/eshop/xml/price.xml'
		var	titleFile	=	'/titles/titlelist.txt'
	}else{
		var	xmlData		=	'/eshop/xml/ranking.xml';
		var	priceData	=	'/eshop/xml/price.xml'
		var	titleFile	=	'/titles/titlelist.txt'
		tAlert('正式なデータを読み込んでいます。')
	}
	requestFile(xmlData,'rankingXML','rank',loadingStatus,'makeObj');
	requestFile(titleFile,'title_list','txt',loadingStatus,'makeObj');
	requestFile(priceData,'cart','xml',loadingStatus,'makeObj');

}

/*ランキングデータの処理*/
function func_rankingXML(xml,ID,obj,callback){
	//mAlert('確認用（テストでのみ表示されます）');
	itemsXMLobj	= xml.responseXML.getElementsByTagName('items')[0];
	commonmXMLobj	= xml.responseXML.getElementsByTagName('commonm')[0];
	ikiPXMLobj		= xml.responseXML.getElementsByTagName('ikiP')[0];
	sokuXMLobj		= xml.responseXML.getElementsByTagName('soku')[0];
	tokuXMLobj		= xml.responseXML.getElementsByTagName('toku')[0];
	gameXMLobj		= xml.responseXML.getElementsByTagName('game')[0];
	iPodXMLobj		= xml.responseXML.getElementsByTagName('iPod')[0];
	disneyXMLobj	= xml.responseXML.getElementsByTagName('disney')[0];
	kidXMLobj		= xml.responseXML.getElementsByTagName('kid')[0];
	selXMLobj		= xml.responseXML.getElementsByTagName('sel')[0];
	sysXMLobj		= xml.responseXML.getElementsByTagName('sys')[0];
	useXMLobj		= xml.responseXML.getElementsByTagName('use')[0];
	hobXMLobj		= xml.responseXML.getElementsByTagName('hob')[0];
	entXMLobj		= xml.responseXML.getElementsByTagName('ent')[0];
	vistaXMLobj		= xml.responseXML.getElementsByTagName('vista')[0];
	obj[ID]=true;
	(confirmation(obj))?	eval(callback)():void(0);
}

/*読み込み完了時のコールバック関数*/
function makeObj(){
	var	HTML	= new String()
	ec_myXML	= ec_makeXml(eval(myObj+'XMLobj'));
	for(var i=0; ec_myXML.length>i; i++){
			HTML	+= makeHTML(ec_myXML[i],i+1)
	}
	HTML+='<p>'+xmlTag(itemsXMLobj,myObj,0,'date')+'</P>'
	HTML+=(xmlTag(eval(myObj+'XMLobj'),'text'))?'<p class="ec_notice">'+xmlTag(eval(myObj+'XMLobj'),'text')+'</P>':''
	HTML	=HTML.match(/com_id=/)? 	'<p style="margin:1em 0; font-size:80%; text-align:left;">ご購入前に必ず各製品の使用許諾をお読みください。</p>'+HTML:HTML;
	HTML	= '<div id="EC_CART_TOP_Message"><img src="/img/common_img/clear.gif" width="1" height="1" onload="func_EC_CART_TOP_Message();"></div>'+HTML;
	
	reWrite('ec_ranking',HTML);
	for(var i in ec_myXML){
		var	_obj	= ec_titles[ec_myXML[i].cID];
		var	obj		= cartItem[ec_myXML[i].cID];
		var	agreFile	= _obj.dsURL;
//		mAlert(xmlTag(obj.dsXML,'ID')+'/'+_obj.ID)
		(xmlTag(obj.dsXML,'ID'))? exChk(agreFile,'funcDSmini',_obj.ID):void(0);
/*		if(ec_myXML[i].cID){
			mAlert(ec_myXML[i].cID)
			mAlert(xmlTag(obj.dsXML,'ID'))
			(xmlTag(obj.dsXML,'ID'))? exChk(agreFile,'funcDSmini',_obj.ID):void(0);
		}*/
	}

}
/*ランキングデータのObject化*/
function ec_makeXml(xml){
	var	temp = xml.getElementsByTagName('products');
	var	lng = xml.getElementsByTagName('product');
	var	obj	= new Array()
	for(var i=0; lng.length>i; i++){
		obj[i]= new ec_xmlObj(temp,i);
	}
	return(obj);
}

/*ランキングデータのObject化関数実体*/
function ec_xmlObj(xml,num){
	var	ID		= xmlTag(xml[0],'product',num,'code');
	
	try{
		var	cartXML	= cartItem['i'+ID].lankingXML;
		var	dlXML	= cartItem['i'+ID].dlXML;
		var	dsXML	= cartItem['i'+ID].dsXML;
		
		try{
			var	bPrice	= ec_titles['i'+ID].price.toString().replace(/[^\d]/ig,'');
		}catch( e ){
			mAlert(this.name+'の製品コードを確認してください')
		}
	
	
		var	myPrice	= xmlTag(cartXML,'ID',0,'price');
		var att			= xmlTag(dlXML,'attention',0);
		var	myOff	= Math.floor((1-myPrice/bPrice)*100);
		var myName	= xmlTag(xml[0],'product',num);
	
		this.ID		= ID;
		this.cID	= 'i'+ID;
		this.text	= att;
		this.name	= xmlTag(xml[0],'product',num);
		var	_cart	= (xmlTag(xml[0],'product',num,'ID'))? xmlTag(cartXML,'ID'):false;
		this.cart	= 	(_cart)? _cart.split('|')[0]:false;
		this.hatsubai	= 	(_cart)? (_cart.split('|')[1])? _cart.split('|')[1]:false:false;
		
		var	_pName		=(xmlTag(cartXML,'ID',0,'pName'))? xmlTag(cartXML,'ID',0,'pName')+' ': '標準価格 ';
		var	pName		=(this.cart)? _pName:'標準価格';
	
		var	_ds	= (xmlTag(xml[0],'product',num,'ID'))?xmlTag(dsXML,'ID'):false;
		this.size	= xmlTag(cartItem['i'+ID].XML,'file',0,'sizeW');
		this.off	= (myOff>0&&!pName.match(/謝恩価格/))?'【'+myOff+'％OFF】<br />':'';
		try{
			this.price	= (xmlTag(xml[0],'product',num,'price'))?this.off+pName+ketatori(myPrice)+'円':pName+ketatori(bPrice)+'円';
		}catch( e ){
			this.price	= '製品コードを確認してください';
		}
		this.img	= '<img src="/img/product_img_dl/'+this.ID+'_m.gif" width="60" border="0" height="80" title="'+this.name+'" alt="'+this.name+'">';
		this.DSag	='<div ID="agr'+ID+'" style="font-size:70%; text-align:center;"></div>'
	
		try{
			this.URL	= ec_titles['i'+this.ID].URL;
		}catch( e ){
			mAlert(this.name+'の製品コードを確認してください')
			this.URL	= '/titles/';
		}
		
	/*超割非表示*/
	/*	this.cho	= (this.cart)? '<div style="font-size: 12px; font-weight:bold; text-align: center; color: #e00;"><a href="'+cartItem['i'+ID].choPackURL(this.cart,(bPrice),'ch_rnk')+'">超割加入者<span style="color:#e00;">なら<br />'+ketatori(bPrice/2)+'円（50%OFF）</span></a></div>\n<p style="font-size: 80%; line-height: 100%; margin-bottom: 3px; text-align: center;"><img src="/dl/img/yajirushi.gif" width="12" align="absmiddle" height="12"><a href="/dl/?i=cho_pro" target="_top" style="text-decoration: underline ! important;">超割とは</a></p>':'';*/
	/*
		var chOff	= (myName.match(/超字幕/))? 30:50;
		this.cho	= (this.cart)? '<div style="font-size: 12px; text-align: center; color: #e00;">超割価格'+ketatori(Math.floor(bPrice*(100-chOff)/100))+'円（'+chOff+'%OFF）</div>\n<p style="font-size: 80%; line-height: 100%; margin-bottom: 3px; text-align: center;"><img src="/dl/img/yajirushi.gif" width="12" align="absmiddle" height="12"><a href="/dl/?i=cho_pro" target="_top" style="text-decoration: underline ! important;">超割とは</a></p>':'';
	*/
		var	fileSize= (this.size)? '（<a href="javascript:sizeWindow('+this.size+');">'+this.size+'</a>MB）':''
		this._dl	= (this.cart)? '<div style="margin: 3px 0pt 1px; font-size: 10px; text-align: center;">ダウンロード版'+fileSize+'</div>':'';
		var	ds		= (_ds)?	'&campaignID=DS0000000001':'&quantity=1'
		var	_hatsubai	= (this.hatsubai)? this.hatsubai*100:ec_titles[this.cID].hatsubaiNum*100;
		var BTN	= (time>_hatsubai)? 'cartBtnS':'yoyakuS';
		var atp	= (xmlTag(cartXML,'attention'))? makeAtP(xmlTag(cartXML,'attention')):'';
		this.atp=(this.cart)? atp:"";
	
	
		this._cart	= (this.cart)? '<div style="text-align:center;"	><div class="'+BTN+'" style="text-align: center; width: 109px; margin:0 auto;"><a href="http://www.sourcenext.com/eshop/es_cartadd/?com_id='+this.cart+ds+'&tk=ec_ranking/code--'+this.cart+'" '+getEventTrack()+' ><img src="/img/common_img/clear.gif" width="109" border="0" height="19"></a></div></div>':'<div style="text-align: center;"><div style="text-align: center; margin:0 auto;"><a href="'+this.URL+'?i=ranking"><img src="/img/ec_img/kochira.jpg" width="72" border="0" height="20"></a></div></div>';
		tAlert(myOff)
		if(this.price){
			this._price	= ((myOff>0)&&!(myOff==100)&&this.cart)? '<div style="font-size: 12px; text-align: center; color: #e00;">'+this.price+'</div>':'<div style="font-size: 12px; text-align: center;">'+this.price+'</div>';
		}else{
			this._price	='<div style="font-size: 12px; text-align: center;">標準価格'+ec_titles['i'+ID].price+' 円</div>';
		}
		this._name	= '<a href="'+this.URL+'?i=ranking">'+xmlTag(xml[0],'product',num)+'</a>';
		this._img	= '<a href="'+this.URL+'?i=ranking"><img src="/img/product_img_dl/'+ID+'_m.gif" width="60" border="0" height="80" title="'+this.name+'" alt="'+this.name+'"></a>';
	}catch( e ){
		this.ID		= ID;
		this.cID	= '';
		this.name	= '';
		this.cart	= '';
		this.size	= '';
		this.off	= '';

		this.img	='';
		this.DSag	=''
		this._price	='';
		this._name	='';
		this._img	=false;
	}
	
}

function makeHTML(obj,num){
	HTML	= new String();

	try{
		if(obj._img){
			/*
			var array	= new Array();
			for(var i in obj){
				array.push(i+':'+obj[i])
			}
			mAlert(array.join('\n'));
			*/
			if(obj.cart){
				var gien =(obj.cart.match(/義援/))? true:false;
			}else{
				var gien =false;
			}
			HTML	+= '<div class="ec_rItem" id="r_'+num+'">\n';
			HTML	+= '<div class="ec_rankImg">\n';
			HTML	+= '<h2>第'+num+'位</h2>\n';
			HTML	+= obj._img+'\n';
			HTML	+= obj.DSag+'\n';
			HTML	+= '</div>\n';
			HTML	+= '<div class="ec_text">\n'
			HTML	+= (time>ec_titles[obj.cID].hatsubaiNum*100)?'':'<p style="margin:0 0 2px; text-align:center; color:#e00;">'+ec_titles[obj.cID]._hatsubaibi+'新発売</p>';
			HTML	+= '<h3>'+obj._name+'</h3>\n';
			if(!gien){
				HTML	+= obj._price+'\n';
		/*超割非表示*/
		//	HTML	+= obj.cho+'\n';
				HTML	+= obj._dl+'\n';
				HTML	+= obj._cart+'\n';
			}
			HTML	+= (obj.text)? makeAtP(obj.text):'';
			HTML	+= '</div>';
			HTML	+= '<div style="clear: both;"></div>';
			HTML	+= obj.atp+'\n';
			HTML	+= '</div>';
		}
	}catch( e ){
	//エラー時の処理
	}


	return HTML;
}

/*色別リスト説明文*/
function showLayer(objId){
	if (document.getElementById){
		tar=document.getElementById(objId);
		tar.style.visibility="visible";
		tar.style.display="inline";
	}
}

function hideLayer(objId){
	if (document.getElementById){
		tar=document.getElementById(objId);
		tar.style.visibility="hidden";
		tar.style.display="none";
	}
}
