OperateShogi=function(){};OperateShogi.prototype={viewBord:null,type:null,bordClickColor:"#ff0000",bordOverColor:"#00ff7f",posClickColor:"#0000ff",posOverColor:"#7f7f7f",bef_click_map:null,bef_over_map:null,bef_click_pos:null,bef_over_pos:null,message_select_nari:"成りますか?",init:function(E,B,G,A,C,F,D){if(isNull(B)){return }this.viewBord=B;if(isNull(E)){E=null}this.type=E;if(isNull(G)==false){this.bordClickColor=G}if(isNull(A)==false){this.bordOverColor=A}if(isNull(C)==false){this.posClickColor=C}if(isNull(F)==false){this.posOverColor=F}if(isNull(D)==false){this.message_select_nari=D}},click_map:function(A,F){if(this.bef_click_map!=null){this.clear_view_map_click(true);if(A==this.bef_click_map[0]&&F==this.bef_click_map[1]){this.bef_click_map=null;return false}var B=false;if(this.viewBord.isUseKomaXY(this.bef_click_map[0],this.bef_click_map[1])==true){var E=this.viewBord.isUpKomaXY(this.bef_click_map[0],this.bef_click_map[1]);if((E!=this.viewBord.isUpKomaXY(A,F)||this.viewBord.isUseKomaXY(A,F)==false)&&this.viewBord.isMoveKoma(this.bef_click_map[0],this.bef_click_map[1],A,F)==true){var D=false;if((this.viewBord.isBordByNari(E,A,F)==true||this.viewBord.isBordByNari(E,this.bef_click_map[0],this.bef_click_map[1])==true)&&this.viewBord.isNariXY(this.bef_click_map[0],this.bef_click_map[1])==true){if(window.confirm(this.message_select_nari)){D=true}this.viewBord.refreshColor()}var C=this.viewBord.moveKoma(this.bef_click_map[0],this.bef_click_map[1],A,F,D);if(C==null||C>=0){this.viewBord.pushPosByGetKoma(E,C);this.viewBord.refreshPosKoma(true);this.viewBord.refreshPosKoma(false);B=true}}this.bef_click_map=null}else{this.bef_click_map=null}if(B==false){this.clear_view_map_over(this.bordClickColor,true)}return B}else{if(this.viewBord.isUseKomaXY(A,F)==false&&this.bef_click_pos!=null){var C=this.viewBord.posKomaToInsertBord(this.bef_click_pos[0],this.bef_click_pos[1],A,F);this.clear_view_pos_click();if(C!=-1){return true}return false}}if(this.isTypeByXY(A,F)==false){return false}if(this.viewBord.isUseKomaXY(A,F)==true){this.clear_view_pos_click();this.viewBord.setBordChipColor(A,F,this.bordClickColor);this.bef_click_map=[A,F]}else{this.bef_click_map=null}return false},over_map:function(A,B){if(this.bef_click_map==null&&this.bef_click_pos==null&&(this.viewBord.isUseKomaXY(A,B)==false||this.isTypeByXY(A,B)==false)){this.clear_view_pos_over(this.bordOverColor);return }if(this.bef_over_map!=null){if(this.bef_click_map!=null&&this.bef_click_map[0]==this.bef_over_map[0]&&this.bef_click_map[1]==this.bef_over_map[1]){this.viewBord.setBordChipColor(this.bef_click_map[0],this.bef_click_map[1],this.bordClickColor)}else{this.clear_view_map_over(this.bordClickColor,true)}}this.clear_view_pos_over(this.bordOverColor);this.viewBord.setBordChipColor(A,B,this.posClickColor);this.bef_over_map=[A,B]},click_pos:function(B,A){if(this.isTypeByPos(B)==false){return }if(this.bef_click_pos!=null&&this.bef_click_pos[0]==B&&this.bef_click_pos[1]==A){this.clear_view_pos_click();return }if(this.viewBord.isPosKomaToInsertBord(B,A)==false){if(this.bef_click_pos!=null){this.clear_view_pos_click()}return }if(this.bef_click_pos!=null){this.clear_view_pos_click(true)}this.viewBord.setPosColor(B,A,this.bordOverColor);this.bef_click_pos=[B,A];this.clear_view_map_click()},over_pos:function(B,A){if(this.isTypeByPos(B)==false){return }if(this.viewBord.isPosKomaToInsertBord(B,A)==true){if(this.bef_over_pos!=null){if(this.bef_click_pos!=null&&this.bef_click_pos[0]==this.bef_over_pos[0]&&this.bef_click_pos[1]==this.bef_over_pos[1]){this.viewBord.setPosColor(this.bef_click_pos[0],this.bef_click_pos[1],this.bordOverColor)}else{this.clear_view_pos_over(this.bordOverColor,true)}}this.clear_view_map_over(this.bordClickColor);this.viewBord.setPosColor(B,A,this.posOverColor);this.bef_over_pos=[B,A]}},clear_view_map_click:function(A){if(this.bef_click_map!=null){this.viewBord.clearBordChipColor(this.bef_click_map[0],this.bef_click_map[1]);if(A!=true){this.bef_click_map=null}}},clear_view_map_over:function(A,B){if(this.bef_over_map!=null){this.viewBord.clearBordChipColor(this.bef_over_map[0],this.bef_over_map[1]);if(this.bef_click_map!=null){this.viewBord.setBordChipColor(this.bef_click_map[0],this.bef_click_map[1],A)}if(B!=true){this.bef_over_map=null}}},clear_view_pos_click:function(A){if(this.bef_click_pos!=null){this.viewBord.clearPosColor(this.bef_click_pos[0],this.bef_click_pos[1]);if(A!=true){this.bef_click_pos=null}}},clear_view_pos_over:function(A,B){if(this.bef_over_pos!=null){this.viewBord.clearPosColor(this.bef_over_pos[0],this.bef_over_pos[1]);if(this.bef_click_pos!=null){this.viewBord.setPosColor(this.bef_click_pos[0],this.bef_click_pos[1],A)}if(B!=true){this.bef_over_pos=null}}},isTypeByXY:function(A,B){if(this.type==null){return true}if(this.viewBord.isUseKomaXY(A,B)==false||this.viewBord.isUpKomaXY(A,B)==this.type){return true}return false},isTypeByPos:function(A){if(this.type==null){return true}if(this.type==A){return true}return false}}