function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}
function w_open_alt(myobj){
	winName=myobj.name;
	var win1 = window.open("","winName","scrollbars=no");
	win1.document.write('<html><body>');
	win1.document.write('<img src="'+ myobj.src + ' ">');
	win1.document.write('</body></html>');
	var ww = win1.document.images[0].width;
	var hh = win1.document.images[0].height;
	win1.resizeTo(ww+10,hh+35);
	exit;
}
function w_open(myobj){
	img1 = new Image();
	img1.src = myobj.src;
	var ww = img1.width;
	var hh = img1.height;
	winName=myobj.name;
	features="width = "+ ww + ",height = " + hh + ",scrollbars=no";
	//alert(features);
	window.open(img1.src,winName,features);
}

function check(){
    if(document.myform.onamae.value==""){
        alert("お名前を入力してください。");
        return false;
    }
    if(document.myform.email.value==""){
        alert("Ｅメールアドレスを入力してください。");
        return false;
    }else if(!is_mail(document.myform.email.value)){
        alert("Ｅメールアドレスが正しくありません。");
        return false;
    }
    if(document.myform.denwa.value){
    	if(!is_tel(document.myform.denwa.value)){
        	alert("電話番号が正しくありません。");
        	return false;
    	}
    }
    if(document.myform.message.value==""){
        alert("メッセージを入力してください。");
        return false;
    }
    return check2();
    //return true;
}

function check2(){
	naiyo = "以下の内容で送信します。\n\nお名前：";
	naiyo += document.myform.onamae.value+"\nＥメール：";
	naiyo += document.myform.email.value+"\nメッセージ：";
	naiyo += document.myform.message.value;
	if(document.myform.denwa.value){
		naiyo += "\n電話番号：";
		naiyo += document.myform.denwa.value;
	}
	naiyo += "\n\nよろしいですか？";
	if(confirm(naiyo)){
		return true;
	}else{
		return false;
	}
}
function is_mail(mymail){
    if(mymail.match(/^[-_0-9a-z]+@[-_0-9a-z.]+\.[-_0-9a-z.]+$/)){
    //if (true){
        return true;
    }else{
        return false;
    }
}
function is_tel(mytel){
    if(mytel.match(/^[-+()0-9]+$/)){
    //if (true){
        return true;
    }else{
        return false;
    }
}
function tgl(imgid,capid){
	myimg=document.getElementById(imgid);
	mycap=document.getElementById(capid);
	for (i=0; i<imgAr.length; i++){
		reg = new RegExp(imgAr[i],"i");
		if(myimg.src.match(reg)){
			break;
		}
	}
	i++;
	if (i>=imgAr.length){i=0}
	myimg.src = imgAr[i];
	mycap.innerHTML=capAr[i];
}

function init(){
	imgAr=new Array();
	capAr=new Array();
}
function setup(myimg,mycap){
	if(myimg){
		imgAr.push(myimg);
		capAr.push(mycap);
	}
}
function setkeyword(){
	listn = document.form_g01.kw02.selectedIndex;
	naiyo = document.form_g01.kw02.options[listn].text;
	res = naiyo.split(" ");
	naiyo2 = res[0];
	//alert(res[0]);
	str=document.form_g01.gkeyword.value;
	reg1 = new RegExp(".+","i");
	reg2 = new RegExp(naiyo2,"i");
	if(str.match(reg1)){
		if(!str.match(reg2)){
			str=str+";"+naiyo2;
		}
	}else{
		str=str+naiyo2;	
	}
	document.form_g01.gkeyword.value=str;
	//alert(naiyo);

}
