function doSearch(type) {
    document.forms[0].action = "Search/Boat";
    document.forms[0].orderBy.value = "";
    
    var grpcb = document.getElementsByName('boat_type_list');
    for (i=0 ; i<grpcb.length ; i++ ) {
        grpcb[i].checked = false;
	}
    if(type >= 0) {
    	
        document.forms[0].boat_type_list[type-1].checked = true;
    }
    document.forms[0].submit();
}

function doSearchRegion(region) {
    document.forms[0].action = "Search/Shop";
    document.forms[0].orderBy.value = "";
    //alert(region);
    var grpcb = document.getElementsByName('chkare');
    for (i=0 ; i<grpcb.length ; i++ ) {
        grpcb[i].checked = false;
	}
    document.getElementById("regioncheckbox" + region).checked = true;
    
    document.forms[0].submit();
}

function doSearchShop() {
    document.forms[0].action = "Search/Shop";
    document.forms[0].orderBy.value = "";
    document.forms[0].submit();
}

function doSearchMarina() {
    document.forms[0].action = "Search/Marina";
    document.forms[0].orderBy.value = "";
    document.forms[0].submit();
}




function setVisibility(id1, id2, id3, visibility1, visibility2, svalue) {
    document.getElementById(id1).style.display = visibility1;
    document.getElementById(id2).style.display = visibility2;
    document.getElementById(id3).value = svalue;

}
function mouseOver() {
    document.getElementById("down").src = "/Content/Images/V1000/SelectMarkBlue.png";
    document.getElementById("Up").src = "/Content/Images/V1000/SelectMarkBlue2.png";


}
function mouseOut() {
    document.getElementById("down").src = '/Content/Images/V1000/SelectMarkBlue2.png';
    document.getElementById("Up").src = '/Content/Images/V1000/SelectMarkBlue.png';

}

function Disable(id1, id2) {
    var ctrl1 = document.getElementById(id1);
    var ctrl2 = document.getElementById(id2);
    $('#japan').val('cx'); $('#outJapan').val('cx');
    ctrl1.disabled = true;
    ctrl2.disabled = false;
}

function doReset() {
    var gmAsk = document.getElementsByName("ask_flg");
    var gmLoa = document.getElementsByName("loa_list");


    for (var i = 1; i <= gmAsk.length; i++) {
        gmAsk.checked = true;
        var objWrapAsk = document.getElementById("checkbox0Wrap");
        objWrapAsk.className = "styledCheckboxWrap wrapChecked";
    }
    for (var i = 1; i <= gmLoa.length; i++) {
        var objWrapLoa = document.getElementById("checkbox" + i + "Wrap");
        objWrapLoa.className = "styledCheckboxWrap";
    }
    document.forms[0].reset();
    //initBoatSearch();
    $("#japan").val("cx");
    $("#outJapan").val("cx");
    //Disable('outJapan', 'japan');
    $("#radBothNihonKaigai").trigger('click');
    //document.getElementById("japan").selectedValue = "cx";
    //document.getElementById("outJapan").selectedValue = "cx";
}

function changeMaker(obj) {
    if (obj.id == "japan") {
        setCookieForFieldA('japan');
        putOnTop('japan');
    } else {
        setCookieForFieldA('outJapan');
        putOnTop('outJapan');
    }
    
}
//window.onload = initBoatSearch;
//alert('abc');

$(document).ready(function () {
    MM_preloadImages('/content/images/V1000/ButtonBoatSearch_N.png', '/content/images/V1000/ButtonBoatSearch_O.png', '/content/images/V1000/ButtonBoatSearch_D.png',
					 '/content/images/V1000/ButtonConditionClear_N.png', '/content/images/V1000/ButtonConditionClear_O.png', '/content/images/V1000/ButtonConditionClear_D.png',
					 '/content/images/V1000/ButtonSearch_N.png', '/content/images/V1000/ButtonSearch_O.png', '/content/images/V1000/ButtonSearch_D.png',
					 '/content/images/V1000/TypePleasureBoat_N.png', '/content/images/V1000/TypePleasureBoat_O.png', '/content/images/V1000/TypePleasureBoat_D.png',
		             '/content/images/V1000/TypeYacht_N.png', '/content/images/V1000/TypeYacht_O.png', '/content/images/V1000/TypeYacht_D.png',
					 '/content/images/V1000/TypeFishingBoat_N.png', '/content/images/V1000/TypeFishingBoat_O.png', '/content/images/V1000/TypeFishingBoat_D.png',
					 '/content/images/V1000/TypePwc_N.png', '/content/images/V1000/TypePwc_O.png', '/content/images/V1000/TypePwc_D.png',
		             '/content/images/V1000/TypeJetBoat_N.png', '/content/images/V1000/TypeJetBoat_O.png', '/content/images/V1000/TypeJetBoat_D.png',
		             '/content/images/V1000/ButtonHopeBoatInfoMail_N.png', '/content/images/V1000/ButtonHopeBoatInfoMail_O.png', '/content/images/V1000/ButtonHopeBoatInfoMail_D.png',
		             '/content/images/V1000/ButtonSellHope_N.png', '/content/images/V1000/ButtonSellHope_O.png', '/content/images/V1000/ButtonSellHope_D.png'
					 );

    addImgMotion(document.getElementById("hopeBoatBtn"), "/content/images/V1000/ButtonHopeBoatInfoMail_O.png", "/content/images/V1000/ButtonHopeBoatInfoMail_D.png");
    addImgMotion(document.getElementById("hopeSaleBtn"), "/content/images/V1000/ButtonSellHope_O.png", "/content/images/V1000/ButtonSellHope_D.png");
    addImgMotion(document.getElementById("boatType1Btn"), "/content/images/V1000/TypePleasureBoat_O.png", "/content/images/V1000/TypePleasureBoat_D.png");
    addImgMotion(document.getElementById("boatType2Btn"), "/content/images/V1000/TypeYacht_O.png", "/content/images/V1000/TypeYacht_D.png");
    addImgMotion(document.getElementById("boatType3Btn"), "/content/images/V1000/TypeFishingBoat_O.png", "/content/images/V1000/TypeFishingBoat_D.png");
    addImgMotion(document.getElementById("boatType4Btn"), "/content/images/V1000/TypePwc_O.png", "/content/images/V1000/TypePwc_D.png");
    addImgMotion(document.getElementById("boatType5Btn"), "/content/images/V1000/TypeJetBoat_O.png", "/content/images/V1000/TypeJetBoat_D.png");

    scanAllWarterMark();
    doFlashPlugin();
});

function doFlashPlugin() {
    //alert(FlashPlayerVer());
    if (FlashPlayerVer() == '0') 
    {
        var addedImage = '<img src="/content/images/V1000/TopBanner.png" />';
        $('object#FlashID').replaceWith($(addedImage));
    }
}

function FlashPlayerVer() {
    //初期設定
    var flashplayer_ver = 0;
    //IE以外の場合
    if (navigator.plugins && navigator.mimeTypes['application/x-shockwave-flash']) {
        var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
        //Flash Playerがインストールされている場合
        if (plugin) { flashplayer_ver = parseInt(plugin.description.match(/\d+\.\d+/)); }
    }
    //IEの場合、もしくはFlash Playerがインストールされていない場合
    else {
        var flashOCX;
        try {
            flashOCX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7").GetVariable("$version").match(/([0-9]+)/);
        } catch (e) {
            try {
                flashOCX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").match(/([0-9]+)/);
            } catch (e) { }
        }
        //IEでFlash Playerがインストールされている場合
        if (flashOCX) { flashplayer_ver = parseInt(flashOCX[0]); }
    }
    //Flash Playerがインストールされていない、もしくはバージョンが6以下の場合
    if (flashplayer_ver <= 6) { flashplayer_ver = 0; }
    return flashplayer_ver;
} 

