//URLパラメータ取得
function getParameter(key) {
	var str = location.search.split("?");
	if (str.length < 2) {
		return "";
	}
	
	var params = str[1].split("&");
	for (var i = 0; i < params.length; i++) {
		var keyVal = params[i].split("=");
		if (keyVal[0] == key && keyVal.length == 2) {
			return decodeURIComponent(keyVal[1]);
		}
	}
	return "";
}

var getMedia = getParameter("media");
var getAgencyId = getParameter("agency_id");
var getUserId = getParameter("userid");

function domestic_air_update(n,media,etc,type){

//-----------------------------------------------------------------------------------------------------------
//	▼　国内航空券　特集(sp)　var01　旅キャピサーバにリンク　▼
//-----------------------------------------------------------------------------------------------------------


	//　■(A)写真データのファイル名（大きい写真1つ小2つあるタイプ）
	var sample_l = new Array(n) ; 
	sample_l[0] = "air_sp01_01.jpg" ;
	sample_l[1] = "air_sp01_02.jpg" ;
	sample_l[2] = "air_sp01_03.jpg" ;
	sample_l[3] = "" ;


	//　■(A)写真データのファイル名（全て小さい写真のタイプ）
	var sample_sp = new Array(n) ; 
	sample_sp[0] = "air_sp02_01.jpg" ;
	sample_sp[1] = "air_sp02_02.jpg" ;
	sample_sp[2] = "air_sp02_03.jpg" ;
	sample_sp[3] = "" ;


	//　■(A)写真データのファイル名（中サイズ写真のタイプ[ネットマイル/travel3テンプレート]）
	var sample_m = new Array(n) ; 
	sample_m[0] = "air_sp03_01.jpg" ;
	sample_m[1] = "air_sp03_02.jpg" ;
	sample_m[2] = "air_sp03_03.jpg" ;
	sample_m[3] = "air_sp03_04.jpg" ;
	

	//　■(A)写真データのファイル名（ちょびりっち専用195*51）
	var sample_chobi = new Array(n) ; 
	sample_chobi[0] = "196_51_1.jpg" ;		//左上
	sample_chobi[1] = "196_51_2.jpg" ;		//中上
	sample_chobi[2] = "196_51_4.jpg" ;		//左下
	sample_chobi[3] = "196_51_5.jpg" ;		//中下
	

	//　■(A)写真データのファイル名（新travel3テンプレート おすすめ特集 大575*77 ･中275*70 ･中275*70）
	var sample_newtravel3 = new Array(n) ; 
	sample_newtravel3[0] = "air_sp04_01.gif" ;		//上
	sample_newtravel3[1] = "air_sp04_02.gif" ;		//左
	sample_newtravel3[2] = "air_sp04_03.gif" ;		//右


	//　■(A)写真データのファイル名（328*170 ジャスベル）
	var sample_jb = new Array(n) ; 
	sample_jb[0] = "328_170.jpg" ;
	sample_jb[1] = "" ;
	sample_jb[2] = "" ;
	sample_jb[3] = "" ;


	//　■(B)リンク先アドレス※旅キャピサーバのみ※アドレスのみ指定
	var link_sp = new Array(n) ; 
	link_sp[0] = "http://www.tabicapital.jp/special/sp18/"; 
	link_sp[1] = "http://www.tabicapital.jp/special/sp40/" ;
	link_sp[2] = "http://tabicapital.jp/airjp/arrive/" ;
	link_sp[3] = "http://www.tabicapital.jp/airjp/ek_list_kanto.html" ;


	var title_sp = new Array(n) ;

	//　■(C)タイトルデータ
	title_sp[0] = "6月まで購入可能な航空券！" ;		//先行予約
	title_sp[1] = "新券種〜早割り航空券〜" ;	//東京発着
	title_sp[2] = "人気都市行き国内航空券特集" ;	//地方発
	title_sp[3] = "＜東京発着＞格安航空券特集！" ;		//特集



	var sentence_sp = new Array(n) ; 

	//　■(D)説明文データ
	sentence_sp[0] = "6月まで購入可能な航空券！新券種発売！55日前までの予約で更にお得に！" ;
	sentence_sp[1] = "早期予約でオトクな国内航空券！" ;
	sentence_sp[2] = "人気都市行き国内航空券特集！お得な地方発航空券は今がチャンス！" ;
	sentence_sp[3] = "＜東京発着＞東京からの全ての路線を一覧から検索！" ;

	
	var price_sp = new Array(n) ; 

	//　■(E)料金データ
	price_sp[0] = "" ;
	price_sp[1] = "" ;
	price_sp[2] = "" ;
	price_sp[3] = "" ;





//-----------------------------------------------------------------------------------------------------------
//	▼　国内航空券　e航空券にリンク(_re)　var01　▼
//-----------------------------------------------------------------------------------------------------------


	//　■(A)写真データのファイル名
	var sample_re = new Array(n) ; 
	sample_re[0] = "air_re01_01.jpg" ;
	sample_re[1] = "air_re01_02.jpg" ;
	sample_re[2] = "air_re01_03.jpg" ;


	//　■(B)リンク先アドレス※アドレスのみ指定 IDはなし
	var link_re = new Array(n) ; 
	link_re[0] = "http://www.e-koukuuken.com/s/user/search/?date1=0&dep1=CTS&arr1=HND";
	link_re[1] = "http://www.e-koukuuken.com/s/user/search/?date1=0&dep1=OKA&arr1=HND" ;
	link_re[2] = "http://www.e-koukuuken.com/s/user/search/?date1=0&dep1=KOJ&arr1=HND" ;


	//　■(C)タイトルデータ
	var title_re = new Array(n) ; 
	title_re[0] = "≪札幌（千歳）⇒東京（羽田）≫" ;
	title_re[1] = "≪那覇⇒東京（羽田）≫" ;
	title_re[2] = "≪鹿児島⇒東京（羽田）≫" ;
	



	//　■(D)説明文データ
	var sentence_re = new Array(n) ; 
	sentence_re[0] = "札幌から羽田への格安航空券！" ;
	sentence_re[1] = "那覇から羽田への格安航空券！" ;
	sentence_re[2] = "鹿児島から羽田への格安航空券！" ;


	//　■(E)料金データ
	var price_re = new Array(n) ; 
	price_re[0] = "" ;
	price_re[1] = "" ;
	price_re[2] = "" ;



//-----------------------------------------------------------------------------------------------------------

	//↓国内航空券　特集大きい画像あり(旅キャピリンク)↓
	
	if( type == 1){



		if( media == getAgencyId ){
			media = "";
		}

		for(cnt=0;cnt<n;cnt++){
		
			html = '<dl id="air_sp01_'
			+ (cnt+1)
			+ '">'
			+ '<dt class="photo">'
			+ '<a href="'
			+ link_sp[cnt]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ '<img src="http://www.tabicapital.jp/special/images/'
			+ sample_l[cnt]
			+ '">'
			+ '</a>'
			+ '</dt>'
			+ '<dd class="title">'
			+ '<a href="'
			+ link_sp[cnt]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ title_sp[cnt]
			+ '</a>'
			+ '</dd>'
			+ '<dd class="sentence">'
			+ sentence_sp[cnt]
			+ '</dd>'
			+ '<dd class="price">'
			+ price_sp[cnt]
			+ '</dd>'
			+ '</dl>'
	    	document.write( html )
		}

	}
	
	
	//↓国内航空券　特集大きい画像なし(旅キャピリンク)↓

	else if( type == 2 ){

		if( media == getMedia ){
			media = "";
		}
		
		for(cnt=0;cnt<n;cnt++){
		
			html = '<dl id="air_sp02_'
			+ (cnt+1)
			+ '">'
			+ '<dt class="photo">'
			+ '<a href="'
			+ link_sp[cnt]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ '<img src="http://www.tabicapital.jp/special/images/'
			+ sample_sp[cnt]
			+ '">'
			+ '</a>'
			+ '</dt>'
			+ '<dd class="title">'
			+ '<a href="'
			+ link_sp[cnt]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ title_sp[cnt]
			+ '</a>'
			+ '</dd>'
			+ '<dd class="sentence">'
			+ sentence_sp[cnt]
			+ '</dd>'
			+ '<dd class="price">'
			+ price_sp[cnt]
			+ '</dd>'
			+ '</dl>'
	    	document.write( html )
		}

	}
	

	//↓国内航空券　おすすめ(e航空券リンク)↓
	
	
	else if( type == 3 ){
		if( media == getAgencyId ){
			media = "";
		}
		
		for(cnt=0;cnt<n;cnt++){
		
			html = '<dl id="air_re01_'
			+ (cnt+1)
			+ '">'
			+ '<dt class="photo">'
			+ '<a href="'
			+ link_re[cnt]
			+ '&agency_id='
			+ media
			+ getAgencyId
			+ '" '
			+ etc
			+ '>'
			+ '<img src="http://www.tabicapital.jp/special/images/'
			+ sample_re[cnt]
			+ '">'
			+ '</a>'
			+ '</dt>'
			+ '<dd class="title">'
			+ '<a href="'
			+ link_re[cnt]
			+ '&agency_id='
			+ media
			+ getAgencyId
			+ '" '
			+ etc
			+ '>'
			+ title_re[cnt]
			+ '</a>'
			+ '</dd>'
			+ '<dd class="sentence">'
			+ sentence_re[cnt]
			+ '</dd>'
			+ '<dd class="price">'
			+ price_re[cnt]
			+ '</dd>'
			+ '</dl>'
	    	document.write( html )
		}

	}



	//↓国内航空券　特集中画像(旅キャピリンク)↓

	else if( type == 4 ){

		if( media == getMedia ){
			media = "";
		}
		
		for(cnt=0;cnt<n;cnt++){
		
			html = '<dl id="air_sp03_'
			+ (cnt+1)
			+ '">'
			+ '<dt class="photo">'
			+ '<a href="'
			+ link_sp[cnt]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ '<img src="http://www.tabicapital.jp/special/images/'
			+ sample_m[cnt]
			+ '">'
			+ '</a>'
			+ '</dt>'
			+ '<dd class="title">'
			+ '<a href="'
			+ link_sp[cnt]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ title_sp[cnt]
			+ '</a>'
			+ '</dd>'
			+ '<dd class="sentence">'
			+ sentence_sp[cnt]
			+ '</dd>'
			+ '<dd class="price">'
			+ price_sp[cnt]
			+ '</dd>'
			+ '</dl>'
	    	document.write( html )
		}

	}


// 新travel3テンプレート

	else if( type == 5){



		if( media == getMedia ){
			media = "";
		}

		for(cnt=0;cnt<n;cnt++){
		
			html = '<dl id="air_sp04_'
			+ (cnt+1)
			+ '">'
			+ '<dt class="photo">'
			+ '<a href="'
			+ link_sp[cnt]
			+ '?media='
			+ media
			+ getMedia
			+ '&userid='
			+ getUserId
			+ '" '
			+ etc
			+ '>'
			+ '<img src="http://www.tabicapital.jp/special/images/'
			+ sample_newtravel3[cnt]
			+ '">'
			+ '</a>'
			+ '</dt>'
			+ '<dd class="sentence">'
			+ sentence_sp[cnt]
			+ '</dd>'
			+ '<dd class="price">'
			+ price_sp[cnt]
			+ '</dd>'
			+ '</dl>'
	    	document.write( html )
		}

	}




	//↓テキスト+画像↓（ちょびりっち型）
		
	//左上　航空券季節特集
	else if( type == "t1" ){
			
			if( media == getMedia ){
			media = "";
		}
	
			html = '<a href="'
			+ 'http://tabicapital.jp/special/sp1/' //link_sp[0]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ '<img alt="特集" src="http://www.tabicapital.jp/special/images/'
			+ sample_chobi[0]
			+ '"></a> '
			+ '<div class="text_sp">'
			+ '<a target="support" href="'
			+ 'http://tabicapital.jp/special/sp1/' //link_sp[0]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ 'FDA特集'//title_sp[0]
			+ '</a></div>'
			document.write( html )
	}
	
	//中上　特集
	else if( type == "t2" ){
			
			if( media == getMedia ){
			media = "";
		}
	
			html = '<a href="'
			+ link_sp[0]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ '<img alt="特集" src="http://www.tabicapital.jp/special/images/'
			+ sample_chobi[1]
			+ '"></a> '
			+ '<div class="text_sp">'
			+ '<a target="support" href="'
			+ link_sp[0]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ title_sp[0]
			+ '</a></div>'
			document.write( html )
	}
	
	
	//左下　地方発特集
	else if( type == "t3" ){
			
			if( media == getMedia ){
			media = "";
		}
	
			html = '<a href="'
			+ link_sp[2]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ '<img alt="特集" src="http://www.tabicapital.jp/special/images/'
			+ sample_chobi[2]
			+ '"></a> '
			+ '<div class="text_sp">'
			+ '<a target="support" href="'
			+ link_sp[2]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ title_sp[2]
			+ '</a></div>'
			document.write( html )
	}


	//中下　東京発特集
	else if( type == "t4" ){
			
			if( media == getMedia ){
			media = "";
		}
	
			html = '<a href="'
			+ 'http://www.tabicapital.jp/airjp/ek_list_kanto.html'
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ '<img alt="特集" src="http://www.tabicapital.jp/special/images/'
			+ sample_chobi[3]
			+ '"></a> '
			+ '<div class="text_sp">'
			+ '<a target="support" href="'
			+ 'http://www.tabicapital.jp/airjp/ek_list_kanto.html'
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ '国内航空券〜全国空港発着〜'
			+ '</a></div>'
			document.write( html )
	}
	
	
	//画像【328*170】+リンク　（ジャスベル）
	else if( type == 6 ){

		if( media == getMedia ){
			media = "";
		}
		
		for(cnt=0;cnt<n;cnt++){
		
			html = '<li><a href="'
			+ link_sp[cnt]
			+ '?media='
			+ media
			+ getMedia
			+ '" '
			+ etc
			+ '>'
			+ '<img src="http://www.tabicapital.jp/special/images/'
			+ sample_jb[cnt]
			+ '">'
			+ '</a>'
			+ '</li>'
	    	document.write( html )
		}

	}
	
}
