var OBJ_CNTR=0; function KekomiSkelet()
{ this.s_prefix="./Kekomi/Style/Img/"; this.arr_Div=new Array(), this.ID=0, this.kLayout="", this.kSetPrefix=function(s_prefix)
{ this.s_prefix=s_prefix;}
this.kCrtConstruction=function(way)
{ this.ID=OBJ_CNTR++; this.arr_Div[0]=this.kCrtObjct("div","id=>skelet"+this.ID+"|class=>skelet"); if(way)
{ document.getElementById(way).appendChild(this.arr_Div[0]);}
else
{ document.body.appendChild(this.arr_Div[0]);}
this.arr_Div[1]=this.kCrtObjct("div","id=>com-top"+this.ID+"|class=>com-top"); this.arr_Div[0].appendChild(this.arr_Div[1]); this.arr_Div[2]=this.kCrtObjct("div","id=>com-left"+this.ID+"|class=>com-left"); this.arr_Div[1].appendChild(this.arr_Div[2]); this.arr_Div[3]=this.kCrtObjct("div","id=>com-right"+this.ID+"|class=>com-right"); this.arr_Div[1].appendChild(this.arr_Div[3]); this.arr_Div[4]=this.kCrtObjct("div","id=>sub-left"+this.ID+"|class=>sub-left"); this.arr_Div[3].appendChild(this.arr_Div[4]); this.arr_Div[5]=this.kCrtObjct("div","id=>sub-right"+this.ID+"|class=>sub-right"); this.arr_Div[3].appendChild(this.arr_Div[5]); this.arr_Div[6]=this.kCrtObjct("div","id=>com-center"+this.ID+"|class=>com-center"); this.arr_Div[0].appendChild(this.arr_Div[6]); this.arr_Div[7]=this.kCrtObjct("div","id=>com-bottom"+this.ID+"|class=>com-bottom"); this.arr_Div[0].appendChild(this.arr_Div[7]); this.arr_Div[8]=this.kCrtObjct("div","id=>com-bottom-left"+this.ID+"|class=>com-bottom-left"); this.arr_Div[7].appendChild(this.arr_Div[8]); this.arr_Div[9]=this.kCrtObjct("div","id=>com-bottom-right"+this.ID+"|class=>com-bottom-right"); this.arr_Div[7].appendChild(this.arr_Div[9]); this.arr_Div[10]=this.kCrtObjct("div","id=>com-bottom-left-sub"+this.ID+"|class=>com-bottom-left-sub"); this.arr_Div[9].appendChild(this.arr_Div[10]); this.arr_Div[11]=this.kCrtObjct("div","id=>com-bottom-right-sub"+this.ID+"|class=>com-bottom-right-sub"); this.arr_Div[9].appendChild(this.arr_Div[11]);}
this.kSetLayout= function(layout)
{ if(layout.match(/hiratai/))
{ this.kLayout=layout; this.arr_Div[0].setAttribute("style","border-bottom:none"); this.arr_Div[1].setAttribute("style","border-bottom:none"); this.arr_Div[2].setAttribute("style","border:none;background-image:url("+this.s_prefix+"HhirataiFunctions.png);background-repeat:no-repeat;"); this.arr_Div[3].setAttribute("style","border-bottom:none"); this.arr_Div[4].setAttribute("style","background:url("+this.s_prefix+"HhirataiCenterTop.png) repeat-x;border:none;"); this.arr_Div[5].setAttribute("style","background:url("+this.s_prefix+"HhirataiRightTop.png) no-repeat;border:none;"); this.arr_Div[6].setAttribute("style","background-color:#fffffb;background-image:url("+this.s_prefix+"HhirataiRight.png);background-repeat:repeat-y;background-position:right;border-left:1px #979797 solid;border-bottom:none;"); this.arr_Div[7].setAttribute("style","border-bottom:none"); this.arr_Div[8].setAttribute("style","background:url("+this.s_prefix+"HhirataiBottomLeft.png) no-repeat;border:none;"); this.arr_Div[9].setAttribute("style","border-bottom:none"); this.arr_Div[10].setAttribute("style","background-color:#fffffb;background-image:url("+this.s_prefix+"HhirataiCenterBottom.png);background-repeat:repeat-x;background-position:bottom;border:none;"); this.arr_Div[11].setAttribute("style","background:url("+this.s_prefix+"HhirataiBottomRight.png) no-repeat;border:none;");}
if(layout.match(/keiko/))
{ this.kLayout=layout; this.arr_Div[2].setAttribute("style","background:url("+this.s_prefix+"HkekomiFunctions.png) no-repeat;"); this.arr_Div[4].setAttribute("style","background:url("+this.s_prefix+"HkekomiCenterTop.png) repeat-x;"); this.arr_Div[5].setAttribute("style","background:url("+this.s_prefix+"HkekomiRightTop.png) no-repeat;"); this.arr_Div[6].setAttribute("style","background-image:url("+this.s_prefix+"HkekomiBodyCenterTop.png);background-repeat: repeat-x;background-color:#fffffe;border-left:1px #dfdfdf solid;border-right:1px #dfdfdf solid;"); this.arr_Div[8].setAttribute("style","background:url("+this.s_prefix+"HkekomiBottomLeft.png) no-repeat;"); this.arr_Div[10].setAttribute("style","background-color:#ffffff;border-bottom:1px solid #dfdfdf;"); this.arr_Div[11].setAttribute("style","background:url("+this.s_prefix+"HkekomiBottomRight.png) no-repeat;");}
}
this.kSetInner=function(innerHtml)
{ document.getElementById("com-center"+this.ID).innerHTML=innerHtml;}
this.kResetInner= function()
{ document.getElementById("com-center"+this.ID).innerHTML="";}
this.kGetLayout= function()
{ return this.kLayout;}
this.kSetSize=function(wdth,hght)
{ this.arr_Div[0].style.width=(wdth+4)+"px"; this.arr_Div[0].style.height=(hght+40)+"px"; this.arr_Div[1].style.width=(wdth+2)+"px"; this.arr_Div[3].style.width=(wdth-157)+"px"; this.arr_Div[4].style.width=(wdth-189)+"px"; this.arr_Div[6].style.width=wdth+"px"; this.arr_Div[6].style.height=hght+"px"; this.arr_Div[7].style.width=(wdth+2)+"px"; this.arr_Div[10].style.width=(wdth-8)+"px"; this.arr_Div[9].style.width=(wdth-3)+"px";}
this.kGetSize= function()
{ }
this.kSetAlpha= function(s_alpha)
{ }
this.kGetAlpha= function()
{ }
this.kSetPosition= function()
{ if(arguments.length==2)
{ if(typeof arguments[0]=="number")
{ this.arr_Div[0].style.left=arguments[0]+"px";}
else
{ kSetRecPos(this.arr_Div[0],arguments[0]);}
if(typeof arguments[1]=="number")
{ this.arr_Div[0].style.top=arguments[1]+"px";}
else
{ kSetRecPos(this.arr_Div[0],arguments[1]);}
}
else if(arguments.length==1)
{ if(typeof arguments[0]=="number")
{ this.arr_Div[0].style.left=arguments[0]+"px";}
else
{ kSetRecPos(this.arr_Div[0],arguments[0]);}
}
function kSetRecPos(o_base,_pos)
{ o_base.style.position="absolute"; if(_pos.match(/HOR_CENTER/))
{ o_base.style.left=(screen.width/2-o_base.offsetWidth/2)+"px";}
else if(_pos.match(/VER_CENTER/))
{ o_base.style.top=(screen.height/2-o_base.offsetHeight/2)+"px";}
else if(_pos.match(/TOP_RIGHT/))
{ o_base.style.top="0px"; o_base.style.left=(screen.width-o_base.offsetWidth)+"px";}
else if(_pos.match(/BOT_RIGHT/))
{ o_base.style.top=(window.innerHeight-(o_base.offsetHeight+16))+"px"; o_base.style.left=(window.innerWidth-o_base.offsetWidth)+"px";}
else if(_pos.match(/TOP_LEFT/))
{ o_base.style.top="0px"; o_base.style.left="0px";}
else if(_pos.match(/CENTER/))
{ o_base.style.left=(screen.width/2-o_base.offsetWidth/2)+"px"; o_base.style.top=(screen.height/3-o_base.offsetHeight/2)+"px";}
}
}
this.kCrtElement= function(s_element_C,s_attrb_S,s_property_P)
{ var o_el_C=document.createElement(s_element_C); o_el_C.setAttribute(s_attrb_S,s_property_P); return o_el_C;}
this.kCrtObjct= function(element_C,str_in)
{ var el_C=document.createElement(element_C); if(str_in.search(/\|/))
{ var tmp_arr_glbl=str_in.split("|"); for(var i=0;i<tmp_arr_glbl.length;i++)
{ var tmp_arr=tmp_arr_glbl[i].split("=>"); el_C.setAttribute(tmp_arr[0],tmp_arr[1]);}
}
else
{ var tmp_arr=str_in.split("=>"); el_C.setAttribute(tmp_arr[0],tmp_arr[1]);}
return el_C;}
this.kGetPosX= function()
{ curleft=this.arr_Div[0].offsetLeft; return curleft;}
this.kGetPoxY= function()
{ curtop=this.arr_Div[0].offsetTop; return curtop;}
}
function KekomiMech()
{ this.isDragging=false; this.kAddControls= function(s_args)
{ if(s_args.search(/\|/))
{ var tmp_arr_glbl=s_args.split("|"); for(var i=0;i<tmp_arr_glbl.length;i++)
{ kSetAction(this.arr_Div[0],this.arr_Div[2],tmp_arr_glbl[i],this.s_prefix);}
}
else
{ kSetAction(this.arr_Div[0],this.arr_Div[2],s_args);}
function kSetAction(o_base,o_close_attach,tmp_arr,s_prefix)
{ var sa_tmp=tmp_arr.split("=>"); if(sa_tmp[0]=="onClick")
{ var o_img=document.createElement("img"); o_img.setAttribute("src",s_prefix+"closeIe.png"); o_img.setAttribute("style","float:left;padding:6px 6px 6px 6px;"); o_img.setAttribute("class","controls"); o_close_attach.appendChild(o_img);}
if(sa_tmp[1].match("Close"))
{ if(sa_tmp[1].search(/:/))
{ var sa_actions=sa_tmp[1].split(":"); o_img.addEventListener('click',function()
{ document.body.removeChild(o_base); eval(sa_actions[1]);},false);}
else
{ o_img.addEventListener('click',function()
{ var o_base_div=document.getElementById(o_base.getAttributeNode("id").value); document.body.removeChild(o_base);},false);}
}
}
}
this.kReSize= function(){}, this.kSetDragDrop= function(k_boolean,posX,posY)
{ var Drag=false; if(k_boolean)
{ this.arr_Div[0].style.position="absolute"; this.arr_Div[0].style.left=posX!='undefined' ? posX+"px" : 0+"px"; this.arr_Div[0].style.top=posY!='undefined' ? posY+"px" : 0+"px"; var Drag = { obj : null, init :
function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
{ o.onmousedown = Drag.start; o.hmode= bSwapHorzRef ? false : true ; o.vmode= bSwapVertRef ? false : true ; o.root = oRoot && oRoot != null ? oRoot : o ; if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px"; if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px"; if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px"; if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px"; o.minX = typeof minX != 'undefined' ? minX : null; o.minY = typeof minY != 'undefined' ? minY : null; o.maxX = typeof maxX != 'undefined' ? maxX : null; o.maxY = typeof maxY != 'undefined' ? maxY : null; o.xMapper = fXMapper ? fXMapper : null; o.yMapper = fYMapper ? fYMapper : null; o.root.onDragStart = new Function(); o.root.onDragEnd = new Function(); o.root.onDrag = new Function();}, start : function(e)
{ var o = Drag.obj = this; e = Drag.fixE(e); var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); o.root.onDragStart(x, y); o.lastMouseX = e.clientX; o.lastMouseY = e.clientY; if (o.hmode) { if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;} else { if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;}
if (o.vmode) { if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;} else { if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;}
document.onmousemove=Drag.drag; document.onmouseup=Drag.end; return false;}, drag : function(e)
{ e = Drag.fixE(e); var o = Drag.obj; var ey = e.clientY; var ex = e.clientX; var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); var nx, ny; if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX); if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX); if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY); if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY); nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1)); ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1)); if (o.xMapper) nx = o.xMapper(y)
else if (o.yMapper) ny = o.yMapper(x)
Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px"; Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px"; Drag.obj.lastMouseX = ex; Drag.obj.lastMouseY = ey; Drag.obj.root.onDrag(nx, ny); return false;}, end : function()
{ document.onmousemove = null; document.onmouseup = null; Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"])); Drag.obj = null;} ,fixE : function(e)
{ if (typeof e == 'undefined') e = window.event; if (typeof e.layerX == 'undefined') e.layerX = e.offsetX; if (typeof e.layerY == 'undefined') e.layerY = e.offsetY; return e;}
}; Drag.init(this.arr_Div[1],this.arr_Div[0]);}
else
{ alert("not draggable"); delete Drag;}
}
this.kAddTabs= function()
{ if(arguments.length<1)
{ return false
}
var i_base_width=this.arr_Div[10].offsetWidth; this.arr_Div[12]=this.kCrtObjct("div","id=>tabs-bottom"+this.ID+"|style=>padding: 4px 0px 0px 0px;width:"+i_base_width+";"); this.arr_Div[10].appendChild(this.arr_Div[12]); var o_div_tab=new Array(); var o_div_tab_left=new Array(); var o_div_tab_right=new Array(); var o_div_tab_right_left=new Array(); var o_div_tab_right_right=new Array(); var o_div_tab_right_right_left=new Array(); var o_div_tab_right_right_right=new Array(); var sa_div_id=new Array(); var sa_span_id=new Array(); var _a_box=new Array(); var ID=this.ID; var s_prefix=this.s_prefix; for(var i=0;i<arguments.length;i++)
{ _a_box[i]=arguments[i][1]; sa_div_id[i]=("tab-bottom"+this.ID)+i; sa_span_id[i]=("txt-len"+this.ID)+i; o_div_tab[i]=this.kCrtObjct("div","id=>"+sa_div_id[i]); var o_span=this.kCrtObjct("span","id=>"+sa_span_id[i]+"|style=>padding-left:16px;"); var o_txt=document.createTextNode(arguments[i][0]); o_span.appendChild(o_txt); o_div_tab_left[i]=document.createElement("div"); o_div_tab_left[i].appendChild(o_span); o_div_tab[i].appendChild(o_div_tab_left[i]); o_div_tab_right[i]=document.createElement("div"); o_div_tab_right_left[i]=document.createElement("div"); o_div_tab_right_right[i]=document.createElement("div"); o_div_tab_right_right_left[i]=document.createElement("div"); o_div_tab_right_right_right[i]=document.createElement("div"); o_div_tab_right_right[i].appendChild(o_div_tab_right_right_left[i]); o_div_tab_right_right[i].appendChild(o_div_tab_right_right_right[i]); o_div_tab_right[i].appendChild(o_div_tab_right_right[i]); o_div_tab_right[i].appendChild(o_div_tab_right_left[i]); o_div_tab[i].appendChild(o_div_tab_right[i]); this.arr_Div[12].appendChild(o_div_tab[i]);}
kSetActive(0,sa_span_id,ID,this.s_prefix); function kSetOnClick(i)
{ o_div_tab_left[i].onclick=function()
{ kSetActive(i,sa_span_id,ID,s_prefix);};}
for(var i=0;i<sa_div_id.length;i++)
{ kSetOnClick(i);}
function kSetActive(i_actv,s_span_id,ID,s_prefix)
{ var o_div_inner=document.getElementById("com-center"+ID); if(typeof _a_box[i_actv]=="string")
{ o_div_inner.innerHTML=_a_box[i_actv];}
else if(typeof _a_box[i_actv]=="object")
{ while(o_div_inner.firstChild)
{ o_div_inner.removeChild(o_div_inner.firstChild);}
o_div_inner.appendChild(_a_box[i_actv]);}
var i_span_width=document.getElementById(s_span_id[i_actv]).offsetWidth+16; o_div_tab[i_actv].setAttribute("style","width:"+i_span_width+"px"); o_div_tab[i_actv].setAttribute("class","tab-bottom-active"); o_div_tab_left[i_actv].setAttribute("style","width:"+(i_span_width-2)+"px"); o_div_tab_left[i_actv].setAttribute("class","tab-bottom-active-left"); o_div_tab_right[i_actv].setAttribute("style","width:"+i_span_width+"px");/*x*/
o_div_tab_right[i_actv].setAttribute("class","tab-bottom-active-right"); o_div_tab_right_left[i_actv].setAttribute("class","tab-bottom-active-right-left"); o_div_tab_right_left[i_actv].setAttribute
( "style","background:url("+s_prefix+"HtabsActiveBottomLeft.png) no-repeat" ); o_div_tab_right_right[i_actv].setAttribute("style","width:"+(i_span_width-7)+"px"); o_div_tab_right_right[i_actv].setAttribute("class","tab-bottom-active-right-right"); o_div_tab_right_right_left[i_actv].setAttribute("style","width:"+(i_span_width-14)+"px"); o_div_tab_right_right_left[i_actv].setAttribute("class","tab-bottom-active-right-right-left"); o_div_tab_right_right_right[i_actv].setAttribute("class","tab-bottom-active-right-right-right"); o_div_tab_right_right_right[i_actv].setAttribute
( "style","background:url("+s_prefix+"HtabsActiveBottomRight.png) no-repeat" ); var i_actv_left=i_actv-1; var i_actv_right=i_actv+1; for(i_actv_left;i_actv_left>=0;i_actv_left--)
{ i_span_width=document.getElementById(s_span_id[i_actv_left]).offsetWidth+16; o_div_tab[i_actv_left].setAttribute("style","width:"+i_span_width+"px"); o_div_tab[i_actv_left].setAttribute("class","tab-bottom-deactive"); o_div_tab_left[i_actv_left].setAttribute("class","tab-bottom-deactive-left"); o_div_tab_left[i_actv_left].setAttribute
( "style","width:"+(i_span_width-2)+"px;" ); o_div_tab_right[i_actv_left].setAttribute("class","tab-bottom-deactive-right"); o_div_tab_right[i_actv_left].setAttribute
( "style","width:"+i_span_width+"px;"+ "background:url("+s_prefix+"HtabsDeActiveBottomLeft.png) no-repeat" ); o_div_tab_right_left[i_actv_left].setAttribute("class","tab-bottom-deactive-right-left"); o_div_tab_right_left[i_actv_left].setAttribute
( "style","background:url("+s_prefix+"HtabsDeActiveBottomLeft.png) no-repeat" ); o_div_tab_right_right[i_actv_left].setAttribute("class","tab-bottom-deactive-right-right"); o_div_tab_right_right[i_actv_left].setAttribute
( "style","width:"+(i_span_width-7)+"px;"+ "background:url("+s_prefix+"HtabsDeActiveBottomRight.png) no-repeat" ); o_div_tab_right_right_left[i_actv_left].setAttribute("class","tab-bottom-deactive-right-right-left"); o_div_tab_right_right_left[i_actv_left].setAttribute
( "style","width:"+(i_span_width-14)+"px;" ); o_div_tab_right_right_right[i_actv_left].setAttribute("class","tab-bottom-deactive-right-right-right"); o_div_tab_right_right_right[i_actv_left].setAttribute
( "style","background:url("+s_prefix+"HtabsDeActiveBottomRight.png) no-repeat" );}
for(i_actv_right;i_actv_right<o_div_tab.length;i_actv_right++)
{ i_span_width=document.getElementById(s_span_id[i_actv_right]).offsetWidth+16; o_div_tab[i_actv_right].setAttribute("style","width:"+i_span_width+"px"); o_div_tab[i_actv_right].setAttribute("class","tab-bottom-deactive"); o_div_tab_left[i_actv_right].setAttribute("style","width:"+(i_span_width-2)+"px"); o_div_tab_left[i_actv_right].setAttribute("class","tab-bottom-deactive-left"); o_div_tab_right[i_actv_right].setAttribute("style","width:"+i_span_width+"px");/*x*/
o_div_tab_right[i_actv_right].setAttribute("class","tab-bottom-deactive-right"); o_div_tab_right_left[i_actv_right].setAttribute("class","tab-bottom-deactive-right-left"); o_div_tab_right_left[i_actv_right].setAttribute
( "style","background:url("+s_prefix+"HtabsDeActiveBottomLeft.png) no-repeat" ); o_div_tab_right_right[i_actv_right].setAttribute("style","width:"+(i_span_width-7)+"px"); o_div_tab_right_right[i_actv_right].setAttribute("class","tab-bottom-deactive-right-right"); o_div_tab_right_right_left[i_actv_right].setAttribute("class","tab-bottom-deactive-right-right-left"); o_div_tab_right_right_left[i_actv_right].setAttribute
( "style","width:"+(i_span_width-14)+"px;" ); o_div_tab_right_right_right[i_actv_right].setAttribute("class","tab-bottom-deactive-right-right-right"); o_div_tab_right_right_right[i_actv_right].setAttribute
( "style","background:url("+s_prefix+"HtabsDeActiveBottomRight.png) no-repeat" );}
}
}
this.kAddTabsAction= function(i_tab_pos,s_action_type,s_code)
{ var o_tab=document.getElementById(("tab-bottom"+this.ID)+i_tab_pos); switch(s_action_type)
{ case "click":
{ o_tab.addEventListener(s_action_type,function()
{ eval(s_code);},false); break;}
case "mousedown":
{ break;}
case "mouseup":
{ break;}
case "mouseover":
{ break;}
case "mousemove":
{ break;}
case "mouseout":
{ break;}
}
}
}
KekomiMech.prototype=new KekomiSkelet; function Kekomi()
{ this.kHandle=function(_id)
{ var o_Com_Center=document.getElementById("com-center"+this.ID); if(typeof _id=="object")
{ o_Com_Center.appendChild(_id); return true;}
else if(typeof _id=="string")
{ try
{ var o_Plug=document.getElementById(_id); o_Com_Center.appendChild(o_Plug); return true;}
catch(e)
{ return false;}
}
return false;}
this.kPlug=function()
{ return document.getElementById("com-center"+this.ID);}
this.kGetTopNodeIdAttr=function()
{ return "skelet"+this.ID;}
this.kSetInnerPosition= function(i_posx,i_posy)
{ }
}
Kekomi.prototype=new KekomiMech; 