﻿function open_order(){
	//現在のディレクトリ名を取得してappli.phpにリンク

	var myURL_a = document.URL;
	//alert(myURL_a);
        myURL = myURL_a.split('/');
	
	var dirnm=myURL[myURL.length-2];
	var file="http://www.test-telecom.com/agency/dairi_order/appli.php/" + dirnm;

	subWin = window.open(file,"order","status=yes,toolbar=no,scrollbars=yes,resizable=no,width=700,height=720,top=50,left=50");
}

function open_order2(dirnm){
	var file="http://www.test-telecom.com/agency/dairi_order/appli.php/" + dirnm;
	subWin = window.open(file,"order","status=yes,toolbar=no,scrollbars=yes,resizable=no,width=700,height=720,top=50,left=50");
}

/*
 *フッター関連
 */


function footer_cb(kbn){
	//フッターの挙動
	//kbn	0:close
	//    default:back

	switch(kbn){
		case "0":
			window.close();
			break;

		default:
			history.back();
			break;
	}


}

/*
 *別画面の表示
 */

function openappli(prm){
	var file = "http://www.telecomsquare.co.jp/agency/common/appli/appli.php/" + prm ;
	subWin = window.open(file,"order","status=yes,toolbar=no,scrollbars=yes,resizable=no,width=800,height=720,top=50,left=50");
}

function openappli_en(prm){
	var file = "https://www.telecomsquare.co.jp/agency/common/order/" + prm ;
	subWin = window.open(file,"order","status=yes,toolbar=no,scrollbars=yes,resizable=no,width=800,height=720,top=50,left=50");
}

function openappli_sim(prm){
	var file = "http://www.telecomsquare.co.jp/agency/common/appli/appli_sim.php/" + prm ;
	subWin = window.open(file,"order","status=yes,toolbar=no,scrollbars=yes,resizable=no,width=800,height=720,top=50,left=50");
}

function openwin(kbn,prm){
	//　固定ページを別Windowで表示
	//	kbn  1:サイトポリシー　2:プライバシーポリシー
	//			 3:ソフトバングテレコム価格表 4:法人登録
	//			 5:エリアマップ
	//			 6:問合せ先メール
	//			 7:サービスポリシー(prmにてページを区別)
	//			 8:WEB割のご連絡
	//	※100番台は英語
	//  ※900はパラメーターに指定


	var file,w,h,resizable;

	w = 640;		h = 500; resizable="no";

	switch(kbn){
		case 1:
			file = "/sitepolicy/sitepolicy.html";
			break;
		case 2:
			file = "/privacypolicy/privacypolicy.html";
			break;
		case 3:
			file = "http://tm.softbank.jp/consumer/tariff/inter_call/pdf/mobile_phs.pdf";
			w = 700;		h = 700;
			break;
		case 4:
			file = "";
			break;
		case 5:
			file = "/service/foreign/openwin/area.html" + prm;
			break;
		case 6:
			file = "mailto:info@telecomsquare.co.jp";
			break;
		case 7:
			file = "http://www.telecomsquare.co.jp/openwin/why_ts.html";
			if(prm!=""){
				file ="http://www.telecomsquare.co.jp/openwin/why_ts" + prm + ".html";
			}
			h = 640;
			break;
		case 8:
			file ="http://www.telecomsquare.co.jp/openwin/news_release/060929_release_01.html";
			w = 750;		h = 750; resizable="yes";
			break;

		case 101:
			file = "/sitepolicy/sitepolicy_en.html";
			break;
		case 102:
			file = "/privacypolicy/privacypolicy_en.html";
			break;
		case 111:
			file = "/en/appli/agree_e.html";
			break;
		case 900:
			var prm2
			prm2=prm.split(",")
			file=prm2[0];
			w=prm2[1];
			h=prm2[2];
			resizable=prm2[3];
			if(w==-1){w=640;}
			if(h==-1){h=500;}
		break;
	}

	subWin = window.open(file,"info","status=yes,toolbar=no,scrollbars=yes,resizable=" + resizable + ",width=" + w + ",height=" + h + ",top=50,left=50");
}

/* id pass 申込機能呼出 */
function open_order_idpass(id, pass, cid) {
	var url = "https://www.telecomsquare.co.jp/wb_sys/wb_login100.php?id=" + id + "-" + pass + "&cid=" + cid;
	subWin = window.open(url,"order", "status=yes,toolbar=no,scrollbars=yes,resizable=yes,width=770,height=800,top=50,left=50");
}

/* 申込 pdf 呼出 */
 function open_order_pdf(url, file){
  var urlfile= "http://www.telecomsquare.co.jp/agency/"+ url + "/" + file;
  subWin = window.open(urlfile,"order","status=yes,toolbar=no,scrollbars=yes,resizable=no,width=700,height=600,top=50,left=50");
}

/* 申込フォーム 20100227 */
function ordersubmit(opvalue) { 

	if(opvalue == "foreign") {
		popup = window.open("https://www.telecomsquare.co.jp/appli/form_abr.php", "popUp", "width=800, height=800, top=50,left=50, status=yes, toolbar=no, scrollbars=yes, resizable=no");
	} else if(opvalue == "domestic"){ 
		popup = window.open("https://www.telecomsquare.co.jp/appli/form_do.php", "popUp", "width=800, height=800, top=50,left=50, status=yes, toolbar=no, scrollbars=yes, resizable=no");
	}
}
