
function pictureCheckAgree(terms_url){if(document.frm.pic.value){if(document.frm.agree.checked){document.frm.submit();}else{var str='You must certify that you have permission to upload this picture and that it does not violate our <a href="'+terms_url+'">Terms of Use</a>.';var exp='Please click the checkbox to certify.';show_editor_error(str,exp);window.location.hash="errors_hash";}}}
var mouseDown=false;var squarePicture=null;var squareX=null;var squareY=null;var downMouseX;var downMouseY;var newSquarePicturePosX=0;var newSquarePicturePosY=0;var squareDisplaySize;var narrowGive;var squareSwitched=false;var squarePictureLoaded=false;function squarePictureOnLoad()
{squarePictureLoaded=true;}
function squarePictureSave()
{if(squareSwitched==false)
return false;ge('squareform').submit();}
function squarePictureInit()
{squarePicture=ge('squarepicture');squareX=ge('squarex');squareY=ge('squarey');halfNarrowGive=narrowGive*-0.5;if(squarePicture.height>squarePicture.width){squarePicture.width=squareDisplaySize+narrowGive;newSquarePicturePosX=halfNarrowGive;newSquarePicturePosY=squareDisplaySize*0.5-squarePicture.height*0.3;if(newSquarePicturePosY>halfNarrowGive)
newSquarePicturePosY=halfNarrowGive;}
else{squarePicture.height=squareDisplaySize+narrowGive;newSquarePicturePosY=halfNarrowGive;newSquarePicturePosX=(squareDisplaySize-squarePicture.width)*0.5;}
squarePicture.style.left=newSquarePicturePosX+'px';squarePicture.style.top=newSquarePicturePosY+'px';addEventBase(document.body,'mousemove',squarePictureMouseMove);addEventBase(document.body,'mouseup',squarePictureMouseUp);mouseDown=true;squarePictureMouseUp();squarePictureStart=ge('squarepicturestart');squarePictureStart.style.display='none';squarePicture.style.visibility='visible';}
function squarePictureMouseDown(event)
{if(squarePictureLoaded==false)
return;if(squareSwitched==false){squarePictureInit();squareSwitched=true;}
mouseDown=true;downMouseX=mousePosX(event);downMouseY=mousePosY(event);squarePictureMouseMove(event);}
function squarePictureMouseOver()
{if(mouseDown==false)
return;squarePictureMouseUp();}
function squarePictureMouseUp()
{if(mouseDown==false)
return;mouseDown=false;squareX.value=parseFloat(-100*newSquarePicturePosX/squarePicture.width);if(squareX.value<0.1)
squareX.value=0;squareY.value=parseFloat(-100*newSquarePicturePosY/squarePicture.height);if(squareY.value<0.1)
squareY.value=0;}
function squarePictureMouseMove(event)
{if(mouseDown==false)
return;diffMouseX=mousePosX(event)-downMouseX;diffMouseY=mousePosY(event)-downMouseY;posX=diffMouseX-parseFloat(squareX.value*squarePicture.width*0.01);posY=diffMouseY-parseFloat(squareY.value*squarePicture.height*0.01);if(posY>0){posY=0;}
else if(posY+squarePicture.height<squareDisplaySize){posY=-1*squarePicture.height+squareDisplaySize;}
if(posX>0){posX=0;}
else if(posX+squarePicture.width<squareDisplaySize){posX=-1*squarePicture.width+squareDisplaySize;}
newSquarePicturePosX=posX;newSquarePicturePosY=posY;squarePicture.style.left=posX+'px';squarePicture.style.top=posY+'px';}
