/**
* 郵便番号検索
*/
AjaxZip2.JSONDATA = 'lib/jquery.zip/data';
function search_address(obj) {
AjaxZip2.zip2addr(obj, 'pref', 'address');
}
/**
* ファイルアップロード
*/
function go_upload(index) {
$("#default-upload"+index+", #error-upload"+index+", #success-upload"+index).hide();
$("#now-upload"+index).show();
$("#upload_file"+index).upload('contact.php?mode=filetest&name=upload_file'+index, function(res) {
$("#now-upload"+index).hide();
if (res < 0) {
if (res == -1) $("#error-upload"+index).html("ファイルの送信に失敗しました(-1)").show();
if (res == -2) $("#error-upload"+index).html("添付できないファイルです").show();
if (res == -3) $("#error-upload"+index).html("ファイルの送信が失敗しました(-3)").show();
} else
{
var filesize = res.split(":")[0];
var filename = res.split(":")[1];
if ( filesize > 3) {
$("#error-upload"+index).html("添付できる容量を超えています。").show();
} else
{
$("#error-upload"+index).hide();
if (filename != "nofile") {
$("#success-upload"+index).html('' + filename + 'を追加しました
ファイル名が正しく表示されない場合は半角英数でファイル名を付け直して添付してみてください').show();
}
}
}
}, 'html');
}
/**
* 確認画面へ
*/
function go_confirm() {
$.post("contact.php", {
mode: "go_confirm",
subject:$("input[name=subject]:checked").val(),
message: $("#message").val(),
name: $("#name").val(),
kana: $("#kana").val(),
email: $("#email").val(),
email2: $("#email2").val(),
tel: $("#tel").val(),
zipcode: $("#zipcode").val(),
pref: $("#pref").val(),
address: $("#address").val(),
dogname: $("#dogname").val(),
dog: $("#dog").val(),
weight: $("#weight").val(),
age: $("#age").val(),
sex: $("input[name=sex]:checked").val(),
operation: $("input[name=operation]:checked").val(),
wheelchair: $("input[name=wheelchair]:checked").val(),
message2: $("#message2").val()
}, function(text){
if (text == "error") {
location.href = "index.php";
} else
{
location.href = "confirm.php";
}
});
}
/**
* メール送信アンド完了ページ
*/
function go_thanks() {
$.post("contact.php", {
mode: "go_thanks"
}, function(text){
// if (text != "") {
// alert("このメッセージが表示された場合は、内容をお知らせください\n" + text);
// return;
// }
location.href = "thanks.php";
});
}
/**
* キャンセル
*/
function go_cancel() {
$.post("contact.php", {
mode: "go_cancel"
},function(){
location.href = "index.php";
});
}
/**
* 戻る
*/
function go_back() {
location.href = "index.php";
}