



//////////////////////////////////////////
// Configure stuff below		//
//////////////////////////////////////////


// maximum width for finished image
var imageMaxWidth = 300;


// maximum height for finished image
var imageMaxHeight = 300;


// minimum width for finished image
var imageMinWidth = 25;


// minimum height for finished image
var imageMinHeight = 25;


// default width for finished image
var imageDefaultWidth = 150;


// default height for finished image
var imageDefaultHeight = 200;


// opacity for other doll pieces when one is right-clicked
// must be a number between 0 and 99, the lower the number, the more "see-through" it is
var dollDim = 30;


// info messages for the help message above the creation zone
// message when they rollover a clickable piece in the selection frame
var clickMessage = '<strong>Select Doll Piece</strong><br /> Click this piece to add it to the creation zone for your image.';


// message when they rollover a draggable piece in the creation zone
var dragMessage = '<strong>Arrange Doll Pieces</strong><br /> Click and hold down the mouse button to drag and arrange this piece to create your image. Release the mouse button to stop dragging. You can also right-click the piece for more options.';


// message when they rollover the trashcan
var trashMessage = '<strong>Trashcan</strong><br /> Drag your unwanted pieces over to the trashcan to delete them. You can also drag the trashcan to move it and right-click it for more options.';


//////////////////////////////////////////////////
// End config - edit below at your own risk!	//
//////////////////////////////////////////////////


var infoMessage=new Array(clickMessage, dragMessage, trashMessage);function A(){if(a.getElementById(f).childNodes.length>0&&a.getElementById(f).firstChild.id=='instruct'){a.getElementById(f).removeChild(a.getElementById(f).firstChild);}}function B(s){A();h[i]=new Image();h[i].src=s;h[i].className=b;h[i].style.position="absolute";h[i].style.zIndex=50;h[i].style.left="0px";h[i].style.top="0px";h[i].name="image"+i;a.getElementById(f).appendChild(h[i]);i++;return false;}a.onmousedown=D;function E(){if(g==true){g=false;}return false;}a.onmouseup=E;function F(){o=0;p=0;if(window.pageXOffset||window.pageYOffset){o=window.pageXOffset;p=window.pageYOffset;}else if(a.body&&(a.body.scrollLeft||a.body.scrollTop)){o=a.body.scrollLeft;p=a.body.scrollTop;}else if(a.documentElement&&(a.documentElement.scrollLeft||a.documentElement.scrollTop)){o=a.documentElement.scrollLeft;p=a.documentElement.scrollTop;}}function G(){A();if(a.resizeform.bgwide.value>0){var newWbWidth=parseInt(a.resizeform.bgwide.value);}else{a.resizeform.bgwide.value=imageDefaultWidth;var newWbWidth=imageDefaultWidth;}if(newWbWidth>imageMaxWidth){a.resizeform.bgwide.value=imageMaxWidth;newWbWidth=imageMaxWidth;}if(newWbWidth<imageMinWidth){a.resizeform.bgwide.value=imageMinWidth;newWbWidth=imageMinWidth;}if(a.resizeform.bgtall.value>0){var newWbHeight=parseInt(a.resizeform.bgtall.value);}else{a.resizeform.bgtall.value=imageDefaultHeight;var newWbHeight=imageDefaultHeight;}if(newWbHeight>imageMaxHeight){a.resizeform.bgtall.value=imageMaxHeight;newWbHeight=imageMaxHeight;}if(newWbHeight<imageMinHeight){a.resizeform.bgtall.value=imageMinHeight;newWbHeight=imageMinHeight;}a.getElementById(f).style.width=newWbWidth+"px";a.getElementById(f).style.height=newWbHeight+"px";a.makerform.bgwide.value=newWbWidth;a.makerform.bgtall.value=newWbHeight;return false;}function H(infon,s){a.getElementById('preview').src=s.src;if(s.width>s.height){a.getElementById('preview').style.width='100px';var percent=(s.width/100);a.getElementById('preview').style.height=Math.floor(s.height/percent)+'px';}else if(s.height>s.width){a.getElementById('preview').style.height='100px';var percent=(s.height/100);a.getElementById('preview').style.width=Math.floor(s.width/percent)+'px';}else{a.getElementById('preview').style.width='100px';a.getElementById('preview').style.height='100px';}a.getElementById('helptext').innerHTML=infoMessage[infon];return true;}function I(e){if(!e){var e=window.event;var eTar=e.srcElement;}else{var eTar=e.target;}if(g==false){if(eTar.className==b)H(1,eTar);if(eTar.className==d)H(2,eTar);}return;}a.onmouseover=I;function J(){if(a.getElementById(f).childNodes.length==0||a.getElementById(f).firstChild.id=='instruct'){return false;}var goThrough=0;var imagesJoined,imagesTall,imagesWide,imagesLeft,imagesTop,thisChild;var countImages=a.getElementById(f).childNodes.length;var imageParts=new Array(countImages);var imagesHeight=new Array(countImages);var imagesWidth=new Array(countImages);var imagesX=new Array(countImages);var imagesY=new Array(countImages);while((goThrough+1)<= countImages){imageParts[goThrough]=a.getElementById(f).firstChild.src;imagesHeight[goThrough]=a.getElementById(f).firstChild.height;imagesWidth[goThrough]=a.getElementById(f).firstChild.width;imagesX[goThrough]=parseInt(a.getElementById(f).firstChild.style.left);imagesY[goThrough]=parseInt(a.getElementById(f).firstChild.style.top);thisChild=a.getElementById(f).firstChild;a.getElementById(f).appendChild(thisChild);goThrough++;}a.makerform.imagessourcesform.value=imageParts.join(",");a.makerform.imagestallform.value=imagesHeight.join(",");a.makerform.imageswideform.value=imagesWidth.join(",");a.makerform.imagesleftform.value=imagesX.join(",");a.makerform.imagestopform.value=imagesY.join(",");}a.ondblclick=K;function U(){var thisChild=a.getElementById(f).firstChild;for(n=a.getElementById(f).childNodes.length;n>0;n--){thisChild.style.opacity='0.'+dollDim;thisChild.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+dollDim+')';thisChild=thisChild.nextSibling;}c.style.opacity='1.00';c.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity=100)';}function V(){var thisChild=a.getElementById(f).firstChild;for(n=a.getElementById(f).childNodes.length;n>0;n--){thisChild.style.opacity='1.00';thisChild.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity=100)';thisChild=thisChild.nextSibling;}}function W(){if(!e){var e=window.event;var eTar=e.srcElement;}else{var eTar=e.target;}if(eTar.className==q){eTar.className=r;}}function X(){if(!e){var e=window.event;var eTar=e.srcElement;}else{var eTar=e.target;}if(eTar.className==r){eTar.className=q;}}function Y(mX,mY){a.getElementById(t).style.left=mX+"px";a.getElementById(t).style.top=mY+"px";a.getElementById(t).style.visibility="visible";return false;}function Z(mX,mY){a.getElementById(u).style.left=mX+"px";a.getElementById(u).style.top=mY+"px";a.getElementById(u).style.visibility="visible";U();return false;}function AA(){if(a.getElementById(f).childNodes.length>0)V();a.getElementById(u).style.visibility="hidden";a.getElementById(t).style.visibility="hidden";}function BB(e){if(!e){var e=window.event;var eTar=e.srcElement;}else{var eTar=e.target;}if(eTar.className==b){F();c=eTar;Z(e.clientX+o,e.clientY+p);}else{F();c=eTar;Y(e.clientX+o,e.clientY+p);}return false;}a.oncontextmenu=BB;function CC(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){curleft += obj.offsetLeft;curtop += obj.offsetTop;}}return [curleft,curtop];}function loadMaker(){a.resizeform.bgwide.value=imageDefaultWidth;a.resizeform.bgtall.value=imageDefaultHeight;a.makerform.bgwide.value=imageDefaultWidth;a.makerform.bgtall.value=imageDefaultHeight;return;}



