<!--//

/**
 *
 * ロールオーバー等のヘルパー関数郡
 *
 */
var LSHelper;
LSHelper = {
	/**
	 * ロールオーバーの追加
	 */
	addRollover: function(img, rolloverURL) {
		if (typeof img == "string") {  // If img is a string,
			var id = img;              // it is an id, not an image
			img = null;                // and we don't have an image yet.

			// First try looking the image up by id
			if (document.getElementById) img = document.getElementById(id);
			else if (document.all) img = document.all[id];

			// If not found by id, try looking the image up by name.
			if (!img) img = document.images[id];

			// If we couldn't find the image, do nothing and fail silently
			if (!img) return;
		}

		// If we found an element but it is not an <img> tag, we also fail
		if (img.tagName.toLowerCase() != "img") return;

		// Remember the original URL of the image
		var baseURL = img.src;
		img.baseURL = baseURL;

		// Preload the rollover image into the browser's cache
		(new Image()).src = rolloverURL;

		LSHelper.observe(img,'mouseover',function(){ img.src = rolloverURL; });
		LSHelper.observe(img,'mouseout',function(){ img.src = baseURL; });
	},

	/**
	 * ターゲットロールオーバーの追加
	 */
	addTargetRollover: function(triger, img, rolloverURL) {
		if (typeof triger  == "string") {  // If triger is a string,
			var tid = triger;              // it is an id, not an image
			triger = null;                // and we don't have an image yet.

			// First try looking the image up by id
			if (document.getElementById) triger = document.getElementById(tid);
			else if (document.all) img = document.all[tid];

			// If we couldn't find the image, do nothing and fail silently
			if (!triger) return;
		}
		if (typeof img == "string") {  // If img is a string,
			var id = img;              // it is an id, not an image
			img = null;                // and we don't have an image yet.

			// First try looking the image up by id
			if (document.getElementById) img = document.getElementById(id);
			else if (document.all) img = document.all[id];

			// If not found by id, try looking the image up by name.
			if (!img) img = document.images[id];

			// If we couldn't find the image, do nothing and fail silently
			if (!img) return;
		}

		// If we found an element but it is not an <img> tag, we also fail
		if (img.tagName.toLowerCase() != "img") return;

		// Remember the original URL of the image
		var baseURL = img.src;
		img.baseURL = baseURL;

		// Preload the rollover image into the browser's cache
		(new Image()).src = rolloverURL;

		if(triger.onmouseover){
			LSHelper.observe(triger,'mouseover',function(){ img.src = rolloverURL; });
		}else{
			LSHelper.observe(triger,'mouseover',function(){ img.src = rolloverURL; });
		}
		LSHelper.observe(triger,'mouseout',function(){ img.src = baseURL; });
	},

	/**
	 * rollover属性を探してロールオーバーを追加
	 */
	initRollovers: function() {
    		var images = document.getElementsByTagName("img");
	    	for(var i = 0; i < images.length; i++) {
    		    var image = images[i];
    		    var rolloverURL = image.getAttribute("rollover");
    		    if (rolloverURL) LSHelper.addRollover(image, rolloverURL);
    		    var targetRolloverURL = image.getAttribute("targetrollover");
		    if (targetRolloverURL){
		    	var targetsplit = targetRolloverURL.split(":");
    		    	LSHelper.addTargetRollover(image, targetsplit[0], targetsplit[1]);
		    }
    		}
    		var areas = document.getElementsByTagName("area");
		for(var i = 0; i < areas.length; i++) {
			var area = areas[i];
    		    	var originalRolloverURL = area.getAttribute("rollover");
			var areasplit = originalRolloverURL.split(":");
			image = document.getElementById(areasplit[0]);
			if(image){
				var rolloverURL = areasplit[1];
			}
			if (rolloverURL) LSHelper.addTargetRollover(area, image, rolloverURL);
    		    	var targetRolloverURL = area.getAttribute("targetrollover");
		        if (targetRolloverURL){
		   	 	var targetsplit = targetRolloverURL.split(":");
    		    		LSHelper.addTargetRollover(area, targetsplit[0], targetsplit[1]);
		    	}
		}
	},

	/**
	 * css指定によるロールオーバーの追加
	 */
	addRolloverByCss: function(css, rolloverImg){
    		var images = document.getElementsByTagName("img");
	    	for(var i = 0; i < images.length; i++) {
    		    var image = images[i];
    		    var rolloverURL = image.getAttribute("class");
    		    if (rolloverURL == css) LSHelper.addRollover(image, rolloverImg);
    		}
	},

	/**
	 * イベントの追加
	 */
	observe: function(element, eventName, handler){
		if (element.addEventListener) {
			element.addEventListener(eventName, handler, false);
		} else {
			element.attachEvent("on" + eventName, handler);
		}
	},

	/**
	 * 手動でのロールオーバー設定
	 * HTML validator 対応のためrollover属性を使用しないため
	 */
	initRolloversByHand: function(){

		//-- ▼importantMenu --
		LSHelper.addRollover('btn_event', '../images/btn_event_o.png');

		LSHelper.addRollover('btn_storeinfo', '../images/btn_storeinfo_o.png');

		LSHelper.addTargetRollover('btn_contact', 'btn_contact', '../images/btn_contact_o.png');

		LSHelper.addTargetRollover('btn_contact', 'copy_contact', '../images/copy_contact_o.png');

		LSHelper.addTargetRollover('copy_contact', 'btn_contact', '../images/btn_contact_o.png');

		LSHelper.addTargetRollover('copy_contact', 'copy_contact', '../images/copy_contact_o.png');


		//-- ▼topMenu --
		LSHelper.addRollover('btn_aboutus', '../images/btn_aboutus_o.png');

		LSHelper.addRollover('btn_labo', '../images/btn_labo_o.png');

		LSHelper.addRollover('btn_bank', '../images/btn_bank_o.png');

		LSHelper.addRollover('btn_salons', '../images/btn_salons_o.png');

		LSHelper.addRollover('btn_qa', '../images/btn_qa_o.png');

		LSHelper.addRollover('btn_voice', '../images/btn_voice_o.png');


		//-- ▼Button --
		LSHelper.addRollover('btn_contact2', '../images/2ndCommon/btn_contact2_o.png');

		LSHelper.addRollover('btn_recruit', '../images/2ndCommon/btn_recruit_o.png');


	}

}
LSHelper.observe(window,"load", LSHelper.initRolloversByHand);


//-----------------------------------------------
//--▼[F] SelectMenu Visible--
//-----------------------------------------------

function setChkBox(OBJ) {

	for (i=1;i<=4;i++) {

		document.getElementById("bc_chkbox"+i).style.visibility="hidden";

		document.getElementById("bc_chkbox"+i).style.display="none";

	}

	n=OBJ.selectedIndex+1;

	document.getElementById("bc_chkbox"+n).style.visibility="visible";

	document.getElementById("bc_chkbox"+n).style.display="block";

}

function pulmenu(OBJ) {

	s=OBJ.selectedIndex+1;

	if (window.ActiveXObject) {

		if (s==3) {

			document.getElementById("bc_THT").style.visibility="visible";

			document.getElementById("bc_THT").style.display="block";

		} else {

			document.getElementById("bc_THT").style.visibility="hidden";

			document.getElementById("bc_THT").style.display="none";

		}

	} else {

		if (s==3) {

			document.getElementById("bc_THT").style.visibility="visible";

			document.getElementById("bc_THT").style.display="table-row";

		} else {

			document.getElementById("bc_THT").style.visibility="hidden";

			document.getElementById("bc_THT").style.display="none";

		}

	}

}

//-----------------------------------------------



//-----------------------------------------------
//--▼[F] Form Chang Color--
//-----------------------------------------------


function ChgFC() {

	function chBa () {

		this.style.backgroundColor="#EFF";

	}

	function chCa () {

		this.style.backgroundColor="#DDDDDD";

	}

	n=document.forms[1].elements.length;

	for(i=0;i<n;i++) {

		document.forms[1].elements[i].onfocus=chBa;

		document.forms[1].elements[i].onblur=chCa;

	}

}

//-----------------------------------------------



//-----------------------------------------------
//--▼[F] Wait Alert--
//-----------------------------------------------

function SorryAlert() {

	alert("ただ編集・開発中です。\nどうか、もう少しお待ちください。");

}

//-----------------------------------------------



//-----------------------------------------------
//--▼[F] New Window Open--
//-----------------------------------------------
function newWinOpen(fName,wNo) {

	var wName;

	wName="win" + wNo;

	window.open(fName,wName,"screenX=50,screenY=50,left=50,top=50,width=550,height=500,scrollbars=yes,resizable=yes,menubar=no,toolbar=no");
}

//-----------------------------------------------



//-----------------------------------------------
//--▼[F] Page Back--
//-----------------------------------------------
function gotoURL() {

	var i, args=gotoURL.arguments;

	document.returnValue=false;

	for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");

}

//-----------------------------------------------



//-----------------------------------------------
//--▼[F] Check Kana--
//-----------------------------------------------

function CheckKana(OBJ) {

	var str=OBJ.value;

	var check=/[^ァ-ヶ|^ー|^\-|^－|^ｰ|^―|^　|^ ]/g;

	if (str.match(check)) {

		if (window.ActiveXObject) {

			errTxt="ヨミガナはカタカナで入力してください。";

			positon=document.getElementById("err_nameY");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_nameY").style.visibility="visible";

			document.getElementById("bc_e_nameY").style.display="block";

		} else {

			errTxt="ヨミガナはカタカナで入力してください。";

			positon=document.getElementById("err_nameY");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_nameY").style.visibility="visible";

			document.getElementById("bc_e_nameY").style.display="table-row";

		}

	} else {

		document.getElementById("bc_e_nameY").style.visibility="hidden";

		document.getElementById("bc_e_nameY").style.display="none";

	}

}

//-----------------------------------------------



//-----------------------------------------------
//--▼[F] Check Zip--
//-----------------------------------------------
function CheckZip() {

	c=String.fromCharCode(event.keyCode);

	if ("0123456789\b\r".indexOf(c,0)<0) return false;

	return true;

}

function CheckZip2(OBJ) {

	var str=OBJ.value;

	var check=/[^0-9|^〇|^０|^１|^２|^３|^４|^５|^６|^７|^８|^９]/g;

	if (str.match(check)) {

		if (window.ActiveXObject) {

			errTxt="郵便番号は数字で入力してください。";

			positon=document.getElementById("err_YubinNo");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_YubinNo").style.visibility="visible";

			document.getElementById("bc_e_YubinNo").style.display="block";

		} else {

			errTxt="郵便番号は数字で入力してください。";

			positon=document.getElementById("err_YubinNo");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_YubinNo").style.visibility="visible";

			document.getElementById("bc_e_YubinNo").style.display="table-row";

		}

	} else {

		document.getElementById("bc_e_YubinNo").style.visibility="hidden";

		document.getElementById("bc_e_YubinNo").style.display="none";

	}

}

//-----------------------------------------------



//-----------------------------------------------
//--▼[F] Check Zip--
//-----------------------------------------------

var target = new Array();

target[0]="bc_YubinNo";

target[1]="bc_YubinNo2";

target[2]="bc_Place1";


var focus=new Array();

focus[0]=3;

focus[1]=4;

function next(n) {

	if (document.getElementById){

		f = document.getElementById(target[n]).value;

		if (f.length < focus[n]) return true;

		document.getElementById(target[n]).blur();

		document.getElementById(target[n+1]).focus();

	}

}

//-----------------------------------------------



//-----------------------------------------------
//--▼[F] Check TEL&FAX--
//-----------------------------------------------

function CheckTelFax() {

	c=String.fromCharCode(event.keyCode);

	if ("0123456789\b\rー-－ｰ―".indexOf(c,0)<0) return false;

	return true;

}

function CheckTel(OBJ) {

	var str=OBJ.value;

	var check=/[^0-9|^〇|^０|^１|^２|^３|^４|^５|^６|^７|^８|^９|^ー|^-|^－|^ｰ|^―|^-]/g;

	if (str.match(check)) {

		if (window.ActiveXObject) {

			errTxt="TELは数字で入力してください。";

			positon=document.getElementById("err_Tel");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_Tel").style.visibility="visible";

			document.getElementById("bc_e_Tel").style.display="block";

		} else {

			errTxt="TELは数字で入力してください。";

			positon=document.getElementById("err_Tel");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_Tel").style.visibility="visible";

			document.getElementById("bc_e_Tel").style.display="table-row";

		}

	} else {

		document.getElementById("bc_e_Tel").style.visibility="hidden";

		document.getElementById("bc_e_Tel").style.display="none";

	}

}

function CheckFax(OBJ) {

	var str=OBJ.value;

	var check=/[^0-9|^〇|^０|^１|^２|^３|^４|^５|^６|^７|^８|^９|^ー|^-|^－|^ｰ|^―|^-]/g;

	if (str.match(check)) {

		if (window.ActiveXObject) {

			errTxt="Faxは数字で入力してください。";

			positon=document.getElementById("err_Fax");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_Fax").style.visibility="visible";

			document.getElementById("bc_e_Fax").style.display="block";

		} else {

			errTxt="Faxは数字で入力してください。";

			positon=document.getElementById("err_Fax");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_Fax").style.visibility="visible";

			document.getElementById("bc_e_Fax").style.display="table-row";

		}

	} else {

		document.getElementById("bc_e_Fax").style.visibility="hidden";

		document.getElementById("bc_e_Fax").style.display="none";

	}

}

//-----------------------------------------------



//-----------------------------------------------
//--▼[F] Check Length--
//-----------------------------------------------

function LimitChars(OBJ) {

	n=document.forms[1].bc_Message.value.length;

	if (n>OBJ) {

		if (window.ActiveXObject) {

			errTxt="メッセージは"+OBJ+"文字以内で入力してください。";

			positon=document.getElementById("err_Message");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_Message").style.visibility="visible";

			document.getElementById("bc_e_Message").style.display="block";

		} else {

			errTxt="メッセージは"+OBJ+"文字以内で入力してください。";

			positon=document.getElementById("err_Message");

			positon.innerHTML=errTxt;

			document.getElementById("bc_e_Message").style.visibility="visible";

			document.getElementById("bc_e_Message").style.display="table-row";

		}

	} else {

		document.getElementById("bc_e_Message").style.visibility="hidden";

		document.getElementById("bc_e_Message").style.display="none";

	}

}

//-----------------------------------------------

//-->
