window.onload = sendbutton_handler;

function sendbutton_handler(){
		Event.observe( 'sousinbutton',
			'click',
			request_cmd
		);
		Event.observe(
			'mailsend',
			'click',
			function(){
				mailJump();
			}
		);

}

function request_cmd(){
	RequestURL = './Php/ContactUs.php';
	new Ajax.Request(
		RequestURL,
	{
		method	 : 'post'
		,
		parameters : Form.serialize( 'contactus' )
		,
		onSuccess  : function( objHTTP ){
			$( 'Result' ).style.backgroundColor = 'white';
//			$( 'Result' ).innerHTML = objHTTP.responseText;
			alert(objHTTP.responseText);
		}
		,
		onFailure  : function() {
			 alert( 'サーバーへのリクエストが失敗しました' );
		}
	}
  );
}
function mailJump() {
	RequestURL = './Php/kenovelmailto.php';
	new Ajax.Request(
		RequestURL,
	{
		method	 : 'post'
		,
		parameters : Form.serialize( 'contactus' )
		,
		onSuccess  : function( objHTTP ){
			$( 'Result' ).innerHTML =objHTTP.responseText;
		}
		,
		onFailure  : function() {
			 alert( 'メール送信に失敗しました' );
		}
	}
  );
}


