/*//設定箇所//*/
var prefWindowWidth="680";//都道府県窓width
var prefWindowHeight="660";//都道府県窓heigth
var serviceWindowWidth="680";//診療科目width
var serviceWindowHeight="640";//診療科目height
var specialWindowWidth="806";//専門施設width
var specialWindowHeight="570";//専門施設height
//以下、ウインドウハンドラ格納用
var serviceWindow=new Array();//診療科目
var specialWindow=new Array(1);//診療科目
var prefWindow="";
//以下、open path
var servicePath='/search_service_big_category';//診療科目
var specialPath='/search_facility_special';//専門施設
var scheduleRoutinePath='/search_schedule_routine';//スケジュール:定期
var scheduleSpotPath='/search_schedule_spot';//スケジュール:短期
var prefPath='/search_area?area[area_id]=';//都道府県選択
//以下、window name
var serviceWindowName='search_service_big_category';//診療科目
var specialWindowName='search_facility_special';//専門施設
var schduleWindowName='search_schedule';//スケジュール
var prefWindowName='searchArea';//都道府県
//以下、テキスト挿入ボックスのID
var areaId="checkedArea";//エリアテキストID
var serviceId="service_small_category_id";//診療科目テキストID
var specialId="checkedSpecial";//専門施設テキストID
var partId="checkedSchedule";//期間指定
var spotId="checkedSpot";//カレンダー
//以下、テキストのデフォルト
var areaText="--地図から検索してください--";
var serviceText="未選択";
var specialText="未選択";
var partText="未選択";
var spotText="未選択";
//以下、募集区分name
var workTypeName="work_type_small_category_id";
//以下、inputのIDテキスト共通部分
var baseServiceCategoryId="service_small_category_id_id_";//診療科目
var baseSpecialCategoryId="facility_special_id_id_";//専門施設
var baseWorkTypeId="work_type_small_category_id_id_";//非常勤の定期・短期
//以下、open boxのID
var divSchduleBoxId="scheduleRoutine";//スケジュール非常勤定期
var divSpotBoxId="scheduleSpot";//スケジュール非常勤スポット
var windowX = 0;
var windowY = 0;
/*////*/

/*//スクリプト//*/
function windowOpen1(windowName,facilityId){//{[*window名を生かすため*]}{[*windowNameはidの共通部分を兼ねる*]}
	var tempServicePath="";
	if(facilityId){
		tempServicePath=servicePath+"?facility_id="+facilityId;
	}else{
		tempServicePath=servicePath;
	}
	serviceWindow[windowName]=window.open(tempServicePath,windowName,'left='+windowX+',top='+windowY+',width='+serviceWindowWidth+',height='+serviceWindowHeight+',status=0,scrollbars=1,menubar=0,location=0,toolbar=0,resizable=1');
}
function windowOpen2(windowName){//{[*window名を生かすため*]} 
	if(!windowName){
		windowName=specialWindowName;
	}
	specialWindow=window.open(specialPath,windowName,'left='+windowX+',top='+windowY+',width='+specialWindowWidth+',height='+specialWindowHeight+',status=0,scrollbars=1,menubar=0,location=0,toolbar=0,resizable=1');
}

function windowDisplay(openObj){
	if(openObj.display=="none"){
		openObj.display="block";
	}
	/*else{
		openObj.display="none";
	}*/
}

function windowTestOpen3(clickObj){//{[*window内*]} 
	var scheduleRoutineStyle=$(divSchduleBoxId).style;
	var scheduleSpotStyle=$(divSpotBoxId).style;
	var workTypeRoutineChecked=$(baseWorkTypeId+1).checked;
	var workTypeSpotChecked=$(baseWorkTypeId+2).checked;
	if(workTypeRoutineChecked){
		checkedStyle=scheduleRoutineStyle;
	}else{
		checkedStyle=scheduleSpotStyle;
	}
	windowDisplay(checkedStyle);
}

function windowPrefOpen(idFlg){
	var path=prefPath+idFlg;
	prefWindow=window.open(path,prefWindowName,'left='+windowX+',top='+windowY+',width='+prefWindowWidth+',height='+prefWindowHeight+',status=0,scrollbars=1,menubar=0,location=0,toolbar=0,resizable=1');
}

function setDefault(serviceLimit,specialLimit,windowName,buttonFlag){//{[*resetボタン*]} 
	if(buttonFlag){
		areaId="p";
		serviceId="c";
		specialId="s";
	}
	if(!opnerServiceCategoryId){
		opnerServiceCategoryId=baseServiceCategoryId;
		opnerSpecialCategoryId=baseServiceCategoryId;
	}
	var areaObj=$(areaId);
	var serviceObj=$(serviceId);
	var specialObj=$(specialId);
	if(prefWindow){//prefWindowが設定されている
		if(!prefWindow.closed){//prefWindowが閉じていない
			prefWindow.$("stringBox").innerHTML="--上の地域・都道府県を選択してください-";
		}
	}
	if(serviceWindow[windowName]){
		if(!serviceWindow[windowName].closed){
			var searchServiceFlag=true;
		}
	}
	for(var i=0;i<serviceLimit;i++){
		if(searchServiceFlag){
			serviceWindow[windowName].$(baseServiceCategoryId+(i+1)).checked=false;
		}
		$(opnerServiceCategoryId+(i+1)).checked=false;
	}
	if(specialWindow){
		if(!specialWindow.closed){
			var specialServiceFlag=true;
		}
	}
	if($(baseSpecialCategoryId+1)){
		for(i=0;i<specialLimit;i++){
			if(specialServiceFlag){
				specialWindow.$(baseSpecialCategoryId+(i+1)).checked=false;
			}
			$(opnerSpecialCategoryId+(i+1)).checked=false;
		}
		specialObj.innerHTML=specialText;
	}
	if($(partId)){
		$(partId).innerHTML=partText;
	}
	if($(spotId)){
		$(spotId).innertHTML=spotText;
	}
	areaObj.innerHTML=areaText;
	serviceObj.innerHTML=serviceText;
}

document.onmousemove = mmv;
function mmv(e){
    windowX = getMouseX(e);
    windowY = getMouseY(e);
}


function getMouseX(e){
  if(window.opera)   
      	return e.clientX;
  else if(document.all)
	  	return event.clientX;
  else if(document.layers||document.getElementById)
          return e.pageX;
}
function getMouseY(e){
  if(window.opera)   
          return e.clientY;
  else if(document.all)   
	  		return event.clientY;
  else if(document.layers||document.getElementById)
          return e.pageY;
}

/*//スクリプト//*/