// function definition - default
// UNITEAIR Co.,Ltd.


// CSS SELECTION +++++++++++++++++++++++++++++++++++++++++//
//document.write('<link rel="stylesheet" href="common/style/default.css" media="screen,print" type="text/css"><link rel="stylesheet" href="../common/style/default.css" media="screen,print" type="text/css">');


// INITIAL PROCESS +++++++++++++++++++++++++++++++++++++++//
function initFocus(){
	document.search.searchBox.focus();
}


// SUBWINDOW(Lsize) ++++++++++++++++++++++++++++++++++++++//
function SubWindowL(href,target) {
	EboWindowL=window.open(href,target,'toolbar=1,location=0,status=0,scrollbars=1,resizable=1,width=720,height=660');
	EboWindowL.focus();
}


// SUBWINDOW(Msize) ++++++++++++++++++++++++++++++++++++++//
function SubWindowM(href,target) {
	EboWindowM=window.open(href,target,'toolbar=0,location=0,status=0,scrollbars=1,resizable=1,width=580,height=660');
	EboWindowM.focus();
}


// SUBWINDOW(Ssize) ++++++++++++++++++++++++++++++++++++++//
function SubWindowS(href,target) {
	EboWindowS=window.open(href,target,'toolbar=1,location=0,status=0,scrollbars=1,resizable=1,width=500,height=500');
	EboWindowS.focus();
}


// SUBWINDOW +++++++++++++++++++++++++++++++++++++++++++++//
function printView(url) {
	var printWidth = 676;
	var printHeight = 580;
	EboWindowPrint=window.open(url,"printView","width="+printWidth+",height="+printHeight+",toolbar=0,location=0,status=0,menubar=1,scrollbars=1,resizable=1");
	EboWindowPrint.focus();
}


// ALERT +++++++++++++++++++++++++++++++++++++++++++++++++//
function zipcodeCheck(obj){ 
	var url = location.href;
	var postal1 = obj.parentNode.getElementsByTagName("input")[0].value.length;
	var postal2 = obj.parentNode.getElementsByTagName("input")[1].value.length;
	if (7 > postal1 + postal2){
		alert("郵便番号は7桁入力してください。");
	}else{
		location.href=url;
	}
}

// SEARCH CMDTY +++++++++++++++++++++++++++++++++++++++++++++++++//
function searchAllCmdty(searchFlg, ebLocation, ebCtgryCd, ebLRackCd, ebSetFlg){
	var slocation = "";
	var objForm =document.forms[0];
	var itemKbn = "";

	if (searchFlg=='1'){
		itemKbn = "H";
	}else{
		itemKbn = "F";
	}
	//if ((objForm.item("txtAllSearchBox" + itemKbn).value).replace(/^\s+|\s+$|　/g, "")=="") {
	//
        var str1 = objForm.item("txtAllSearchBox" + itemKbn).value;
        var rgexp = new RegExp("　", "g");
        var str2 =str1.replace(rgexp, " ");
	if (str2.replace(/^\s+|\s+$|　/g, "")=="") {
	//
		//条件が未入力の場合
		alert("検索条件を入力してください。");
		objForm.item("txtAllSearchBox" + itemKbn).focus();

	} else {
		//条件が入力されていた場合
		slocation = slocation + ebLocation;
		
		slocation = slocation + "/hdnAllSearchFlg/" + searchFlg;

		if (ebCtgryCd.length>0){
			slocation = slocation + "/Ctgry/" + ebCtgryCd;
		} else {
			slocation = slocation + "/Ctgry/*";
		}

		if (ebLRackCd.length>0){
			slocation = slocation + "/LRack/" + ebLRackCd;
		} else {
			slocation = slocation + "/LRack/*";
		}

		if (ebSetFlg.length>0){
			slocation = slocation + "/SetFlg/" + ebSetFlg;
		} else {
			slocation = slocation + "/SetFlg/";
		}

		objForm.action = slocation;
		objForm.submit();
	}
	
}
// SEARCH Photo +++++++++++++++++++++++++++++++++++++++++++++++++//
function searchPhoto(ebLocation, ebCtgryCd, ebLRackCd){
	var slocation = "";
	var objForm =document.forms[0];
	var itemKbn = "";

	if ((objForm.item("authorName").value).replace(/^\s+|\s+$|　/g, "")=="") {

		//条件が未入力の場合
		alert("検索条件を入力してください。");
		objForm.item("authorName").focus();

	} else {
		//条件が入力されていた場合
		slocation = slocation + ebLocation;
		
		slocation = slocation + "/hdnSearchFlg/1";

		if (ebCtgryCd.length>0){
			slocation = slocation + "/Ctgry/" + ebCtgryCd;
		} else {
			slocation = slocation + "/Ctgry/*";
		}

		if (ebLRackCd.length>0){
			slocation = slocation + "/LRack/" + ebLRackCd;
		} else {
			slocation = slocation + "/LRack/*";
		}

		objForm.action = slocation;
		objForm.submit();
	}
	
}

