function addFavorite(){

	var brw_v = navigator.appVersion.charAt(0);
	var brw_n = navigator.appName.charAt(0);

	if((brw_v >= 4)&&(brw_n == "M")){
		window.external.AddFavorite(location.href, document.title);
	}else{
		window.alert("インターネットエキスプローラーVer4以上以外をご利用の方は、恐れ入りますが、使用されているブラウザのお気に入りに追加・ブックマーク登録機能をご利用くださいませ。");
	}
}



function disKWD(){

	var num = document.klist.elements.length-1; //num of kwd;
	var str = "";
	var j = 0;

	for(i=0;i<num;i++){

		if(document.klist.elements[i+1].checked == 1){
			j++;
			if(j!=1)str+=" ";
			str+= document.klist.elements[i+1].value;
		}
	}

	document.klist.kwd.value = str;
}

function chEncode(){

	document.charset = "EUC-JP";

}


function googleCopy(){
	document.google.q.value = document.klist.kwd.value;
	document.charset = "Shift_JIS";
	document.google.submit();
}


function copyKWD(x){
		
	var kwd = document.klist.kwd.value;

	if(x==1){
		document.rakuten.kwd.value=kwd;
	}else if(x==2){
		document.bidders.keyword.value=kwd;
		document.charset = "Shift_JIS";
	}else if(x==3){
		document.livedoor.kwd.value=kwd;
	}else if(x==2){
		document.yahoo.kwd.value=kwd;
	}else{
		document.amazon.keyword.value=kwd;
		document.charset = "Shift_JIS";
	}

}


function chCA(x,y,z){
	if(x==1){
		var canum = opener.document.bidders.categ_id.length-1;
		opener.document.bidders.categ_id.options[canum].text = y;
		opener.document.bidders.categ_id.options[canum].value = z;
		opener.document.bidders.categ_id.selectedIndex = canum;
	}else{
		var canum = opener.document.rakuten.g.length-1;
		opener.document.rakuten.g.options[canum].text = y;
		opener.document.rakuten.g.options[canum].value = z;
		opener.document.rakuten.g.selectedIndex = canum;
	}
}

function disList(x,areaID) {

if(x==1){

  if (document.getElementById(areaID).style.display=='none'){
  
    	document.getElementById(areaID).style.display='';
    	document.getElementById(areaID+'_i').src='../images/diy_cityhide.gif';

		
  } else {
    	document.getElementById(areaID).style.display='none';
    	document.getElementById(areaID+'_i').src='../images/diy_cityshow.gif';
		
  }

}else{

  if (document.getElementById(areaID).style.display=='none'){
  
    	document.getElementById(areaID).style.display='';
    	document.getElementById(areaID+'_i').src='../images/diy_hide.gif';

		
  } else {
    	document.getElementById(areaID).style.display='none';
    	document.getElementById(areaID+'_i').src='../images/diy_show.gif';
		
  }

}
  
}

function LinkTo(x){

if(x=="coun"){
var num = document.colist.colink.selectedIndex;
location.href = '?country='+document.colist.colink.options[num].value;
}

}

function afflink(y){

if(y=="sgair"){
var num = document.sgair.cid.selectedIndex;
var url = "http://ck.jp.ap.valuecommerce.com/servlet/referral?sid=2117868&pid=872901193&vc_url=http://www.skygate.co.jp/cgi-bin/dpkg/cty.cgi%3Fcd%3D"+document.sgair.cid.options[num].value;
	window.open(url,'','');
}

if(y=="apple"){
var num = document.apple.cid.selectedIndex;
var ccord = document.apple.ccord.value;
var acord = document.apple.acord.value;
var url = "http://ck.jp.ap.valuecommerce.com/servlet/referral?sid=2117868&pid=873346031&vc_url=http://appleworld.com/affiliate/vc2.php%3Fstep%3D3%26areaCode%3D"+acord+"%26countryCode%3D"+ccord+"%26cityCode%3D"+document.apple.cid.options[num].value;
window.open(url,'','');
}

if(y=="look"){
var num = document.look.cid.selectedIndex;
var url = "http://ck.jp.ap.valuecommerce.com/servlet/referral?sid=2117868&pid=873393694&vc_url=http://www.jtb.co.jp/lookjtb/sc/list.aspx%3FCityCD%3D"+document.look.cid.options[num].value;
	window.open(url,'','');
}

if(y=="etour"){
var num = document.etour.cid.selectedIndex;
var url = "http://ck.jp.ap.valuecommerce.com/servlet/referral?sid=2117868&pid=872745367&vc_url=http://www.etour.co.jp/discount_list_city.php3%3Fair_class%3DDE%26airline_name%3DNONE%26ticket%3DROUND%26arr_city%3D"+document.etour.cid.options[num].value;
	window.open(url,'','');
}

}

function kakaku(x){

	x = String(x);
	var len = x.length;
	var num = parseInt(len/3);
	var j = len%3;

	y = "";

	if(j!=0){	
		y += x.substr(0,j);
	}

	if(j!=0&&len>2){
		y += ",";
	}
	
	for(i=0;i<num;i++){
		y += x.substr(j,3);
		if(i!=num-1){
			y += ",";
		}
		j = j+3;
	}

	return y;
}