setTimeout('showInit()', 15000); function showInit(){ if (makerReady) return; if (document.getElementById("shInit")) document.getElementById("shInit").style.display=''; } function clearEventPROX(a) { if (!a) return; a.onabort = null; a.onblur = null; a.onclick = null; a.ondblclick = null; a.onfocus = null; a.onkeydown = null; a.onkeypress = null; a.onkeyup = null; a.onload = null; a.onmousedown = null; a.onmousemove = null; a.onmouseup = null; a.onmove = null; a.onreset = null; a.onresize = null; a.onselect = null; a.onunload = null; // IE-specific event handlers from // http://msdn.microsoft.com/workshop/author/dhtml/reference/events.asp a.onactivate = null; a.onafterprint = null; a.onafterupdate = null; a.onbeforeactivate = null; a.onbeforecopy = null; a.onbeforecut = null; a.onbeforedeactivate = null; a.onbeforeeditfocus = null; a.onbeforepaste = null; a.onbeforeprint = null; a.onbeforeunload = null; a.onbeforeupdate = null; a.onbounce = null; a.oncellchange = null; a.oncontextmenu = null; a.oncontrolselect = null; a.oncopy = null; a.oncut = null; a.ondataavailable = null; a.ondatasetchanged = null; a.ondatasetcomplete = null; a.ondeactivate = null; a.ondrag = null; a.ondragend = null; a.ondragenter = null; a.ondragleave = null; a.ondragover = null; a.ondragstart = null; a.ondrop = null; a.onfilterchange = null; a.onfinish = null; a.onfocusin = null; a.onfocusout = null; a.onhelp = null; a.onlayoutcomplete = null; a.onlosecapture = null; a.onmousewheel = null; a.onmoveend = null; a.onmovestart = null; a.onpaste = null; a.onpropertychange = null; a.onreadystatechange = null; a.onresizeend = null; a.onresizestart = null; a.onrowenter = null; a.onrowexit = null; a.onrowsdelete = null; a.onrowsinserted = null; a.onscroll = null; a.onselectionchange = null; a.onselectstart = null; a.onstart = null; a.onstop = null; } function clearAllEventPROX(a) { if (!a) return; clearEventPROX(a); a.onclick = null; a.ondblclick = null; a.onmouseover = null; a.onmouseout = null; a.onsubmit = null; a.onreset = null; a.onchange = null; a.onerror = null; } /* -------------------- no right click ------------------ */ var message=""; /////////////////////////////////// function clickIE() { hd=hidestatus(); if (document.all) { (message); return false; } } function clickNS(e) { hd=hidestatus(); if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) { (message); return false; } } } function hide_link_status(){ var links = document.links; for(var i = 0; i < links.length; i++) { links[i].attachEvent("onmouseover", hidestatus); } } function hidestatus(){ window.status=''; return true; } if (!(isdefined(window, "dms_skip_right_disable") && (dms_skip_right_disable==true))){ if (document.layers) { document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS; } else{ document.onmouseup=clickNS; document.oncontextmenu=clickIE; } document.oncontextmenu=new Function("return false"); if (document.layers) document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT); document.onmouseover=hidestatus; document.onmouseout=hidestatus; } /* ----------------- no right click end ------------------ */ /* ------------------- ns adjucent fix ------------------- */ if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){ HTMLElement.prototype.insertAdjacentElement = function (where,parsedNode){ switch (where){ case 'beforeBegin': this.parentNode.insertBefore(parsedNode,this) break; case 'afterBegin': this.insertBefore(parsedNode,this.firstChild); break; case 'beforeEnd': this.appendChild(parsedNode); break; case 'afterEnd': if (this.nextSibling) this.parentNode.insertBefore(parsedNode,this.nextSibling); else this.parentNode.appendChild(parsedNode); break; } } HTMLElement.prototype.insertAdjacentHTML = function (where,htmlStr) { var r = this.ownerDocument.createRange(); r.setStartBefore(this); var parsedHTML = r.createContextualFragment(htmlStr); this.insertAdjacentElement(where,parsedHTML) } HTMLElement.prototype.insertAdjacentText = function (where,txtStr) { var parsedText = document.createTextNode(txtStr) this.insertAdjacentElement(where,parsedText) } } /* ----------------- ns adjucent fix end ------------------ */ var ie=document.all; var ns6=document.getElementById&&!document.all; var dragapproved=false; var z,x,y; var makerReady=false; var dmsProps=new Array(); var dmsLayerIndex=new Array(); var tItemCounter; var loadInterrupCount=0; var show_color_flag=false; //images var m_banner="http://www.dollmakerscript.com/public/banners/banner_4.gif"; var m_wait="http://www.dollmakerscript.com/public/animated_hourglass_small.gif"; var m_bg="http://www.dollmakerscript.com/public/doll-background.gif"; if (!isdefined(window, "dms_color1")) dms_color1="orange"; if (!isdefined(window, "dms_color2")) dms_color2="#FFD530"; if (!isdefined(window, "dms_color3")) dms_color3="#862C00"; if (!isdefined(window, "dms_color4")) dms_color4="black"; if (!isdefined(window, "dms_text_embed")) dms_text_embed=""; if (!isdefined(window, "dms_text_popup")) dms_text_popup="Maker is ready"; if (!isdefined(window, "dms_width")) dms_width=150; if (!isdefined(window, "dms_height")) dms_height=200; if (!isdefined(window, "dms_background")) dms_background=false; if (!isdefined(window, "dms_text_embed_disable")) dms_text_embed_disable=false; if (!isdefined(window, "dms_drag_disable")) dms_drag_disable=false; if (!isdefined(window, "dms_hide_build")) dms_hide_build=false; if (!isdefined(window, "dms_file_type")) dms_file_type="gif"; function isdefined(object, variable) { return (typeof(eval(object)[variable]) != "undefined"); } function initMaker(){ if (makerReady) return; if (document.getElementById("shInit")) document.getElementById("shInit").style.display='none'; //make sure we still have all the handles document.onmousedown=drags; document.onmouseup=new Function("dragapproved=false"); document.ondblclick =move_top; iCount=document.images.length; for (var loop = 0; loop =3) { alert('Trying to initialize the maker now...\nYou will not be able to drag any items that are currently not loaded'); initMaker(); return; } alert('Please wait until the maker is completely loaded or press to skip load. #' + loadInterrupCount); return; } while (firedobj.tagName!=topelement&&firedobj.className!="drag"){ firedobj=ns6? firedobj.parentNode : firedobj.parentElement; } if (firedobj.className=="drag"){ //if dragged - add to dmsProps dmsProps[firedobj.id]=firedobj; dragapproved=true; z=firedobj; temp1=parseInt(z.style.left+0); temp2=parseInt(z.style.top+0); x=ns6? e.clientX: event.clientX; y=ns6? e.clientY: event.clientY; document.onmousemove=move; return false; } } function move_top(e){ if (!ie&&!ns6) return; var firedobj=ns6? e.target : event.srcElement; var topelement=ns6? "HTML" : "BODY"; if (!makerReady && firedobj.tagName=="IMG"){ loadInterrupCount++; if (loadInterrupCount>=3) { alert('Trying to initialize the maker now...\nYou will not be able to drag any items that are currently not loaded'); initMaker(); return; } alert('Please wait until the maker is completely loaded or press to skip load. #' + loadInterrupCount); return; } while (firedobj.tagName!=topelement&&firedobj.className!="drag"){ firedobj=ns6? firedobj.parentNode : firedobj.parentElement; } if (firedobj.className=="drag"){ processItem=false; //create duplicate of the items //if we have local build area - use it, otherwise try to use top (top frame area) if (document.getElementById("build_area_div")){ var z_id = "img_" + ++tItemCounter; var innerHtml = ""; document.getElementById("build_area_div").insertAdjacentHTML( "beforeEnd", innerHtml ) ; firedobj=document.getElementById(z_id); mPosX=findPosX(document.getElementById("build_area")); mPosY=findPosY(document.getElementById("build_area")); //if dragged - add to dmsProps dmsProps[z_id]=firedobj; //add layer dmsLayerIndex[z_id]=tItemCounter; processItem=true; } else { if (top.document.getElementById("build_area_div")){ var z_id = "img_" + ++top.tItemCounter; var innerHtml = ""; top.document.getElementById("build_area_div").insertAdjacentHTML( "beforeEnd", innerHtml ) ; firedobj=top.document.getElementById(z_id); mPosX=findPosX(top.document.getElementById("build_area")); mPosY=findPosY(top.document.getElementById("build_area")); //if dragged - add to dmsProps top.dmsProps[z_id]=firedobj; //add layer top.dmsLayerIndex[z_id]=top.tItemCounter; processItem=true; } } if (processItem){ z=firedobj; z.style.top=mPosY; z.style.left=mPosX; } return false; } } function changeWidth(wSelector){ if (document.getElementById("build_area") && wSelector) { document.getElementById("build_area").width=wSelector.options[wSelector.selectedIndex].value; } return true; } function changeHeight(hSelector){ if (document.getElementById("build_area") && hSelector) { document.getElementById("build_area").height=hSelector.options[hSelector.selectedIndex].value; } return true; } function findPosX(obj) { var curleft = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft obj = obj.offsetParent; } } else if (obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop; } function _PrepSubmit(){ if (!document.getElementById("build_area")){ alert('Could not process the request.\nMake sure you have build_area image defined.'); return false; } //make sure all the required elements exists if (!document.getElementById("buildWidth") || !document.getElementById("buildHeight")){ alert('Could not process the request.\nMake sure you have defined width and height.'); return false; } //populate document.dmMain.auto_url.value=top.location; //collect items info var item_counter=0; var dmsString=""; //add build area - always first element dmArea=document.getElementById("build_area"); dmsString += "-1**" + dmArea.src + "**" + findPosX(dmArea) + "**"+ findPosY(dmArea); for (im in dmsProps) { item_counter++; dmsString += "##" + dmsLayerIndex[dmsProps[im].id] + "**"+dmsProps[im].src + "**" + findPosX(dmsProps[im]) + "**"+ findPosY(dmsProps[im]); } if (item_counter==0) { alert('Please drag item to the build area and press \'Build\' to create the doll.'); return false; } document.dmMain.dmsString.value=dmsString; //prep window var moutputWindow=window.open("","_moutput"); moutputWindow.document.write("Drag and Drop Doll Maker Script Engine by dollmakerscript.com
Please wait while we are creating your image...
"); moutputWindow.focus(); document.dmMain.submit(); moutputWindow.document.getElementById("hour_glass").src="http://www.dollmakerscript.com/public/animated_hourglass_small.gif"; return false; } document.onmousedown=drags; document.onmouseup=new Function("dragapproved=false"); document.ondblclick =move_top; //drop styles document.write(""); if (document.images) { //preload some images for the popup window im_pop_wait = new Image; im_pop_bg = new Image; im_pop_banner = new Image; im_pop_wait.src=m_wait; im_pop_bg=m_bg; im_pop_banner.src=m_banner; } //create build area if (!dms_hide_build) document.write("
Powered by DollMakerScript
"); //get presets var cWidth=dms_width; var cHeight=dms_height; var cWidthSet=false; var cHeightSet=false; var buildWidthHTML=""; for (var i=50;i<350 ;i++ ) { if (cHeight==i) { buildHeightHTML +="
"); document.write(""); } function show_color(){ if (!show_color_flag){ //position the window document.getElementById("cwindow").style.left=findPosX(document.getElementById("save_button")); document.getElementById("cwindow").style.top=findPosY(document.getElementById("save_button")); document.getElementById("cwindow").style.display=''; show_color_flag=true; } } function hide_color(){ if (!dms_hide_build) document.getElementById("cwindow").style.display='none'; show_color_flag=false; } function set_bg(v){ document.dmMain.dms_BgColor.value=v; document.getElementById("build_area").src='http://www.dollmakerscript.com/public/spacer.gif'; document.getElementById("build_area_div").style.backgroundColor=v; hide_color(); } /* get field value */ function gf() { if (document.forms.form1) { var e = document.forms.form1.elements.field; if(e != undefined) { for (var i = 0; i < e.length; i++) { if (e[i].checked) { return e[i].value; } } } } /* we need this so this function becomes reusable * with ChooseColor.gxp */ var r = document.images; for (var i = 0; i < r.length; i++) { if (r[i].id=="build_area") { return r[i].id; } } } /* set field helper for onchange events */ function sf_oc(f, v) { if (f=="build_area"){ set_bg(v); } else { sf(f, v); } } /* set field valid value */ var sf_vv = /#[0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]/i; /* set field value */ function sf(f, v) { if (!sf_vv.test(v)) { document.getElementById(f).value=""; createAdvancedScript(); return false; } document.getElementById(f).value=v; createAdvancedScript(); } /* write swatch */ function ws(c, s, z) { var v = "#" + toHex(c); document.write( "
"); } /* write palette table */ function wt() { for(var r = 255; r >= 0; r -= 51) { document.write(""); for(var g = 255; g >= 0; g -= 51) { for(var b = 255; b >= 0; b -= 51) { ws([r, g, b], 1, "swatch"); } } document.write(""); } document.write(""); for(var l = 255; l >= 0; l -= 51) { ws([l, l, l], 6, "swatch2"); } document.write(""); } function toColor(h) { return [ parseInt(h.substring(0, 2), 16), parseInt(h.substring(2, 4), 16), parseInt(h.substring(4, 6), 16) ]; } function toHex(c) { var r, g, b; r = c[0].toString(16); if (c[0] < 0x10) { r = "0" + r; } g = c[1].toString(16); if (c[1] < 0x10) { g = "0" + g; } b = c[2].toString(16); if (c[2] < 0x10) { b = "0" + b; } return (r + g + b).toUpperCase(); } /* set field helper for keydown events */ function sf_ok(f, v) { if (window.event) { if (event.keyCode == 13) { sf_oc(f, v); // simulate onchange event.cancelBubble = true; } } } /* focus field */ function ff(f) { var v = document.forms.form1.elements; var e = v.field; for (var i = 0; i < e.length; i++) { if (e[i].value == f) { e[i].checked = true; v[f].focus(); break; } } }