// toiawase*********************************************

function mySubmit() {
  if (check()) {
    document.mailForm.submit();
  }  
}

function isValid() {
  for(var i=0; i < document.mailForm.elements.length; i++) {
    if (document.mailForm.elements[i].type == "text" ) {
      if (document.mailForm.elements[i].value=="") {
        if ( i != "10" && i != "12" ) {
          document.mailForm.elements[i].focus();
          if( !alert(document.mailForm.elements[i].name 
            + "を入力してください。") ){
            return false;
          }
        }

      }
    }
	
  }

  return true;
}

function check(){

  if (!isValid()) {
    return false;
  }

  return true;
		//if((document.mailForm."お名前".value == "")||(document.mailForm.E-MAIL.value == "") ||(document.mailForm."申込者電話".value == "")) [
		//if( (document.mailForm.EMAIL.value == "") ) { 
}

//** gallary***************************************************

function clickHandler() {
  var targetId, srcElement, targetElement;
  srcElement = window.event.srcElement;

  if (srcElement.className == "Outline") {
     targetId = srcElement.id + "d";
     targetElement = document.all(targetId);
     if (targetElement.style.display == "none") {
        targetElement.style.display = "";
     } else {
        targetElement.style.display = "none";
     }
  }

    if (srcElement.className == "Outline1") {
     targetId = srcElement.id + "d";
     targetElement = document.all(targetId);
     if (targetElement.style.display == "none") {
        targetElement.style.display = "";
        srcElement.src = "./img/opened_folder.gif";
     } else {
        targetElement.style.display = "none";
        srcElement.src = "./img/closed_folder.gif";
     }
  }

}

document.onclick = clickHandler;

//** gallary***************************************************

//** webservice page - *************************************

function call_1() {
	document.webphone.callto("210.146.37.110/111")
}

function call_2() {
	document.webphone.callto("210.146.37.110/112")
}

function call_3() {
	document.webphone.callto("210.146.37.110/113")
}

function call_4() {
	document.webphone.callto("210.146.37.110/114")
}

function call_5() {
	document.webphone.callto("210.146.37.110/115")
}

function call_6() {
	document.webphone.callto("210.146.37.110/116")
}

function call_close() {
	document.webphone.close()
}

//**********************************************************

//**open window*********************************************

	//**catalog window***************
	function openWindow(url)
	{
		popupWin = window.open(url, "newwin", "toolbar=no, scrollbars=yes, scrolling=yes,resizable=yes, menubar=yes,width=720,height=450");
	}

	//**docodemo window***************gps flash window***************
	function docoWin(url)
	{
		temp = window.open(url,"docowin", "toolbar=no, scrollbars=yes, scrolling=yes ,resizable=yes, menubar=yes,width=800,height=450");
	}
	
	//**download window************
	
	function downWin(url)
	{
		temp = window.open(url,"downloadWin", "toolbar=no, scrollbars=yes, scrolling=yes ,resizable=yes, menubar=yes,width=750,height=450");
	}
	//**explain window**************
	function explainWin(url)
	{
		temp = window.open(url,"explainwin", "toolbar=no, scrollbars=yes, scrolling=yes ,resizable=yes, menubar=yes,width=600,height=450");
	}
	
	//**catalog window***************
	function linkWin(url)
	{
		temp = window.open(url, "newwin", "toolbar=no, scrollbars=no, scrolling=yes ,resizable=yes, menubar=no,width=600,height=350");
	}

	//**gps flash window***************
	function gpsWin(url)
	{
		temp = window.open(url, "gpswin", "toolbar=no, scrollbars=no, scrolling=no ,resizable=yes, menubar=no,width=720,height=535");
	}

	//**gps flash window***************
	function autoCallWin(url)
	{
		temp = window.open(url, "autoCallWin", "toolbar=no, scrollbars=no, scrolling=no ,resizable=yes, menubar=no,width=850,height=570");
	}
	//**その他 flash window***************
	function printWin(url)
	{
		temp = window.open(url, "print", "toolbar=no, scrollbars=no, scrolling=no ,resizable=yes, menubar=no,width=810,height=610");
	}
//**********************************************************

//** CTI window ******************
function naviWindow(url,width,height)
	{
		popupWin = window.open(url, "newwin", "'toolbar=no, scrollbars=yes, scrolling=yes,resizable=yes, menubar=no,width="+width+",height="+height+",left=5,top=5'");
                popupWin.focus();
	}

function openWindow1(url,width,height)
	{
		popupWin = window.open(url, "newwin", "'toolbar=no, scrollbars=yes, scrolling=yes,resizable=yes, menubar=no,width="+width+",height="+height+",left=5,top=5'");
	}

function naviWindow2(url,width,height)
	{
		popupWin = window.open(url, "newWin1", "'toolbar=no, scrollbars=yes, scrolling=yes,resizable=yes, menubar=no,width="+width+",height="+height+",left=5,top=5'");
	}

//**********************************************************

//Flashバナー連続表示
var i = 1;
var timeID;

function slid_swf(){
	clearInterval(timeID);
	if(i == 1){	slid_swf01(); }
	else if(i == 2){ slid_swf02(); }
	else if(i == 3){ slid_swf03(); }
	else if(i == 4){ slid_swf04(); }
	else if(i >= 5){
		i = 1;
		slid_swf();
	}
	
	// なぜか #〜 が連続して入ってしまうので対策
	// 2007/09/10 adachi
	s = document.title;
	pt = s.indexOf("#", 0);
	if (pt > 0) {
		document.title = s.substr(0, pt);
	}
}

//eセールスマネージャー
function slid_swf01(){
	document.getElementById("bana").innerHTML = "<embed src='/cti/img/esm_navi.swf' width='739' height='75' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	i++;
	timeID=setInterval("slid_swf()",14000);
}

//どこDEMO
function slid_swf02(){
	document.getElementById("bana").innerHTML = "<embed src='/cti/img/dokodemobana.swf' width='739' height='75' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	i++;
	timeID=setInterval("slid_swf()",8000);
}

//接客ナビ
function slid_swf03(){
	document.getElementById("bana").innerHTML = "<embed src='/cti/img/new_navi.swf' width='739' height='75' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	i++;
	timeID=setInterval("slid_swf()",18000);
}

//タイプH
function slid_swf04(){
	document.getElementById("bana").innerHTML = "<embed src='/cti/img/type_h.swf' width='739' height='75' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	i++;
	timeID=setInterval("slid_swf()",21000);
}

//Flashバナーランダム表示
function random_swf(){
	var flashurl = ["/cti/img/esm_navi.swf","/cti/img/dokodemobana.swf","/cti/img/semina.swf","/cti/img/new_navi.swf","/cti/img/type_h.swf"];
	flashurl = flashurl[Math.floor(Math.random() * flashurl.length)];
	document.write('<embed src="' + flashurl + '" width="739" height="75" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
}

document.write('<link rel="shortcut icon" href="/cti/favicon.ico">');


// サブウィンドウを開く処理 
function disp_main(url){
	sub_window = window.open(url,"subwindow","width=180,height=200,scrollbars=0,resizable=0,status=0"); 
//	sub_window.moveTo(0,0);
	sub_window.focus();
}

// リンクの処理 
function disp_sub(url){ 
	if(!window.opener || window.opener.closed){ // メインウィンドウの存在をチェック 
		window.alert('メインウィンドウがありません'); // 存在しない場合は警告ダイアログを表示 
	} 
	else{
		window.opener.location.href = url; // 存在する場合はページを切りかえる 
	}
} 
// リンクの処理終了 
