var back,doll,cloth,toy; back=1; doll=1; cloth=1; toy=1; img_cnt=1; var back_max,doll_max,cloth_max,toy_max; toy_max=39; back_max=9; cloth_max=14; doll_max=16; back_max=6; doll_max=13; toy_max=34; cloth_max=12; function post_init() { var backs=new Array(); add_text('navdiv','

Back

');var heads=new Array(); add_text('navdiv','

Head

');var cloths=new Array(); add_text('navdiv','

Body

');var toys=new Array(); add_text('navdiv','

Toy

');}; var selected=false; function change_text(id,text) { if (!document.getElementById) { document.all[id].innerHTML = text } else { var obj = document.getElementById(id); obj.innerHTML=text; } } function add_text(id,text) { if (!document.getElementById) { document.all[id].innerHTML += text } else { var obj = document.getElementById(id); obj.innerHTML+=text; } } function find_by_id(id) { if (!document.getElementById) { return document.images[id] } else { return document.getElementById(id); } } var dragapproved=false var z,x,y function move_item(obj,x,y) { units="px"; if (parseInt(navigator.appVersion) >= 5 || navigator.appVersion.indexOf["MSIE 5"] != -1) { obj.style.position = "absolute"; obj.style.left = x + units; obj.style.top = y + units; } // update_url(); } function move_item_bad(i,x,y) { // if (!i.style.pixelLeft) // { // alert('hi'+x+' '+y); i.style.pixelLeft=x i.style.pixelTop=y i.setAttribute("style","position:absolute;top:"+y+"px;left:"+x+"px"); //i.style.left=x+"px"; //i.style.top=y+"px"; // } // else // { // alert('hi'+x+' '+y); // i.style.pixelLeft=x // i.style.pixelTop=y // } } function move(evt){ evt = (evt) ? evt : ((window.event) ? window.event : "") var button = evt.button ? evt.button == 1: true if (dragapproved){ w=temp1+evt.clientX-x h=temp2+evt.clientY-y move_item(z,w,h); return false } } function dstop(evt){ evt = (evt) ? evt : ((window.event) ? window.event : "") button = evt.button ? evt.button == 1 : evt.which == 1 if (button) { dragapproved=false; update_url() } } var f,t function myContext(evt) { evt = (evt) ? evt : ((window.event) ? window.event : "") if (evt) { var elem if (evt.target) { elem = (evt.target.nodeType == 3) ? evt.target.parentNode : evt.target } else { elem = evt.srcElement } if (elem) { if (elem.className=="dragable"){ t=find_by_id("append"); t.removeChild(elem); delete elem; update_url(); selected=false; } } } return false; } document.oncontextmenu = myContext; function cancelRefresh() { // keycode for F5 function if (window.event && window.event.keyCode == 116) { window.event.keyCode = 8; } // keycode for backspace if (window.event && window.event.keyCode == 8) { // try to cancel the backspace window.event.cancelBubble = true; window.event.returnValue = false; return false; } } document.onkeydown=cancelRefresh; function drags(evt){ evt = (evt) ? evt : ((window.event) ? window.event : "") if (evt) { var elem if (evt.target) { elem = (evt.target.nodeType == 3) ? evt.target.parentNode : evt.target } else { elem = evt.srcElement } if (elem) { // process event here f=false; if (elem.className=="drag"){ f=true; t=find_by_id("append"); z=document.createElement('img'); z.src=elem.src; z.className='dragable'; z.onmousedown=drags; t.appendChild(z); move_item(z,evt.clientX-20,evt.clientY-20); img_cnt++; } if (elem.className=="dragable"){ z=elem; f=true; } if (f) { // if (selected) // { selected.style.border="1px none"; } // selected=z; // selected.style.border="1px dotted"; //alert('hi') dragapproved=true if (!document.all) { temp1=parseInt(z.style.left.replace(/px/g,"")); temp2=parseInt(z.style.top.replace(/px/g,"")); x=evt.clientX y=evt.clientY } else { temp1=z.style.pixelLeft temp2=z.style.pixelTop x=evt.clientX y=evt.clientY } document.onmousemove=move document.onmouseup=dstop } } } } var did=false; var timerId=0; function tclear() { //alert('hi'); if (timerId) { clearTimeout(timerId); timerId=0; } } function tset(tstr) { tclear(); eval(tstr); timerId=setTimeout('tset("'+tstr+'")',1000); } function update_text() { //change_text("bgnum","Background "+back+"/"+back_max);; //change_text("dnum","Head "+doll+"/"+doll_max);; //change_text("cnum","Body "+cloth+"/"+cloth_max);; //change_text("tnum","Item
"+toy+"/"+toy_max);; } function update_url(){ var child,i,txt,type,pre,tmp; t=find_by_id("append"); // crawl the children, add the visible ones i=0 txt="" child=t.firstChild; while(child) { tmp=child.src; file=tmp.substring(tmp.lastIndexOf('/')+1,tmp.length); file=file.substring(0,file.lastIndexOf('.')); tmp=tmp.substring(0,tmp.lastIndexOf('/')+1); pre=tmp.substring(0,tmp.lastIndexOf('/')); type=pre.substring(pre.lastIndexOf('/')+1,pre.lastIndexOf('/')+2); if (i++>0) { txt += "X"; } txt += type + file txt += "Z" + child.style.left.replace(/px/g,"") txt += "Z" + child.style.top.replace(/px/g,"") child=child.nextSibling; } if (document.all) { find_by_id('i').value=txt; } else { document.forms['send'].i.value=txt; } if (document.all) { document.all['b'].value=back; } else { document.forms['send'].b.value=back; } update_text(); } function to_front() { return false; } function to_back() { return false; } function vflip() { return false; } function hvflip() { return false; } function set_back_src(nBack) { back=nBack; document.images['back'].src=nBack; update_url(); return false; } function set_doll_src(nSrc){ doll=nSrc; document.images['doll'].src=nSrc; update_text(); return false; } document.onmousedown=drags document.onmouseup=new Function("dragapproved=false")