var apl_path = "www.ntt-at.co.jp";
var ruby_path = "rubifuri.ntt-at.co.jp";
var start_path = "/ntt-at/cv";
var stop_path = "/ntt-at/cv/stop";

function get_ks(){
	var pathname = location.pathname;
	var ks=1;

	if(pathname.indexOf(stop_path) != -1){
		ks=1;
	}else{
		ks=0;
	}
	return ks;
}

function ruby_sv(flg){
	var     pathname = location.pathname;
	var 	newurl = "";
	var 	ks = get_ks();
if(location.hostname != apl_path){
	if(flg == 1){
		if(ks == 1){
			pathname = pathname.substring(stop_path.length, pathname.length);
		}else{
			pathname = pathname.substring(start_path.length, pathname.length);
		}
		new_url = location.protocol + "//" + ruby_path + start_path + pathname + location.search + location.hash;
	}
	else{
		if(ks == 1){
			pathname = pathname.substring(stop_path.length, pathname.length);
		}else{
			pathname = pathname.substring(start_path.length, pathname.length);
		}
		new_url = location.protocol + "//" + ruby_path + stop_path + pathname + location.search + location.hash;
	}
}else{
	if(flg == 1){
		new_url = location.protocol + "//" + ruby_path + start_path + pathname + location.search + location.hash;
	}else{
		new_url = "";
	}
}
	
	if(new_url != ""){
		window.top.location = new_url;
	}
	return true;
}

function ruby_chk(){
	if(location.hostname == apl_path){
		document.ruby_form.trigger[1].checked = true;
	}else if(location.hostname == ruby_path){
		if(location.pathname.indexOf(stop_path) != -1){
			document.ruby_form.trigger[1].checked = true;
		}else{
			document.ruby_form.trigger[0].checked = true;
		}
	}
}
