$(function ()
{
    //画像のプリロード
    $(document).ready(function(){
        var imageArray = new Array('/images/Search/Btn_RequestData_on.gif',
                                   '/images/Search/Btn_RequestQuestion_on.gif',
                                   '/images/Search/Btn_ShowDetail_on.gif'
                                  );
        for(i=0;i<imageArray.length;i++){
            new Image().src = imageArray[i];
        }
    });
    
    //アクションボタンのホバーアクション
    $(".RequestData").hover(function(){
        this.src = '/images/Search/Btn_RequestData_on.gif';
    },
    function(){
        this.src = '/images/Search/Btn_RequestData.gif';
    });
    $(".RequestReserve").hover(function(){
        this.src = '/images/Search/Btn_RequestReserve_on.gif';
    },
    function(){
        this.src = '/images/Search/Btn_RequestReserve.gif';
    });
    $(".RequestQuestion").hover(function(){
        this.src = '/images/Search/Btn_RequestQuestion_on.gif';
    },
    function(){
        this.src = '/images/Search/Btn_RequestQuestion.gif';
    });
    $(".SendShopDetai").hover(function(){
        this.src = '/images/Search/Btn_ShopDetailMail_on.gif';
    },
    function(){
        this.src = '/images/Search/Btn_ShopDetailMail.gif';
    });
    $(".ShowLargeMap").hover(function(){
        this.src = '/images/Search/Btn_ShowLargeMap_on.gif';
    },
    function(){
        this.src = '/images/Search/Btn_ShowLargeMap.gif';
    });
    
    //別ウインドウで開く
    //onclick="MM_openBrWindow('/shop_search/ShopMapPrint.php','ShopMapPrint','scrollbars=yes,resizable=yes,width=700,height=700,top=0')"
    $(".blank").click(function(){
         window.open(this.getAttribute('href'),
                     'ShopMapPrint',
                     'scrollbars=yes,resizable=yes,width=700,height=700,top=0'
                    );
        return false;
    });
    
    //ドレス検索
    $("#d_kind_1").click(function(){
        enableForm();
    });
    $("#d_kind_2").click(function(){
        enableForm();
    });
    $("#d_kind_3").click(function(){
        disableForm();
    });
    $("#d_kind_4").click(function(){
        disableForm();
    });
});


//あとでjQuery用に書き換える
function enableForm() {
    document.getElementById('SearchDressBox1').style.display = "block";
    for(i=3; i<7; i++){
        document.getElementById('SearchDressBox'+i).style.display = "block";
    }
    document.getElementById('SearchDressBox8').style.display = "block";
}

function disableForm() {
        document.getElementById('SearchDressBox1').style.display = "none";
    for(i=3; i<7; i++){
        document.getElementById('SearchDressBox'+i).style.display = "none";
    }
        document.getElementById('SearchDressBox8').style.display = "none";
}

//GoogleMap用
function addGmap(lng, lat, val ) {

    var map = new GMap(document.getElementById(val));
    map.addControl(new GSmallMapControl());
    map.centerAndZoom(new GPoint(lng, lat), 1);

    var point = new GPoint(lng, lat);
    var marker = new GMarker(point);
    map.addOverlay(marker);
}

//スリープ
function _sleep(time){
    var d1 = new Date().getTime();
    var d2 = new Date().getTime();
    while( d2 < d1 + time ){
        d2=new Date().getTime();
    }
    return;
}

