var currentLayId='';function btnClick(ob){var id=ob.id;if(id=='btnPreview'){buildTargetLayoutPreview();buildTargetCirclePreview();}
else if(id=='btnBuild'||id=='btnBuild2'){if(disableBuildClick){return 0;}
else{disableBuildClick=1;setTimeout('disableBuildClick = 0',buildWaitTime);}
uc=false;if(uc){alert('Under Construction - back in a few minutes.   ');}
else{document.targetform.submit();}
$('PleaseWaitTop').show();setTimeout("$('PleaseWaitTop').hide()",buildWaitTime);$('PleaseWaitBottom').show();setTimeout("$('PleaseWaitBottom').hide()",buildWaitTime);}
else if(id=='btnIdeas'){contact('idea');}
else if(id=='btnClear'){clearTarget();}
else if(id=='btnA4Landscape'){clearTarget();setPageStyle(pagesize='A4',layout='landscape');buildTargetLayoutPreview();buildTargetCirclePreview();}
else if(id=='btnA4Portrait'){setPageStyle(pagesize='A4',layout='portrait');clearTarget();buildTargetLayoutPreview();buildTargetCirclePreview();}
else if(id=='btnOrder'){contact('order');}
else{alert('Button with id "'+id+'" is not handled by btnClick.');}}
function clearTarget(){c=document.getElementById('mycanvas');c.innerHTML='';return 1;}
function parseFormInputVals(){f=document.getElementById('targetform');cols=Math.round(Number(f.cols.value),0);rows=Math.round(Number(f.rows.value),0);if(cols<1)cols=1;if(rows<1)rows=1;cols-=(cols%1);rows-=(rows%1);cellw=cw/cols;cellh=ch/rows;}
function buildTarget(){innercirclewidth=Math.round(Number(f.innercirclewidth.value)*mminpix,1);numberofcircles=Math.round(Number(f.numberofcircles.value),0);spacebetweencircles=Math.round(Number(f.spacebetweencircles.value)*mminpix,1);linewidth=Math.round(Number(f.linewidth.value)*mminpix,1);cols=Math.round(Number(f.cols.value),0);rows=Math.round(Number(f.rows.value),0);}
function setLayout(size,lay,c,r){if(size=='A4'){pagesize=size;cwmm=297;chmm=210;cw=Math.round(cwmm*mminpix);ch=Math.round(chmm*mminpix);}
else{alert('Warning: Layout Size Not Supported!');}
if(lay=='ls'){}
else if(lay=='p'){layout='portrait';tmp=cwmm;cwmm=chmm;chmm=tmp;cw=Math.round(cwmm*mminpix);ch=Math.round(chmm*mminpix);}
else{alert('Warning: Layout Size Not Supported!');}
cols=c;rows=r;$('cols').value=c;$('rows').value=r;update('lay',(c*r));}
function update(opt,val,val2){if(opt=='ICW'){v=val+1;$('innercirclewidth').value=v;$('ICW_val').innerHTML=v;s=mminpix*v;$('ICW_pic').width=s;$('ICW_pic').height=s;}
else if(opt=='LW'){v=((val+2)/10);$('linewidth').value=v;$('LW_val').innerHTML=v;picH=(mminpix*v)*2.2;if(s<1){s=1;}
$('LW_pic').width="180";$('LW_pic').height=picH;}
else if(opt=='CH'){if(val==0){$('CH_pic').height=0;}
else{if(val2=='slider'){val=val/5;}
v=val*0.7;picH=(mminpix*v)*2.2;if(s<1){s=1;}
$('CH_pic').width="180";$('CH_pic').height=picH;}
$('crosshairLineWidth').value=val;}
else if(opt=='SBC'){v=((val/2)+1);$('spacebetweencircles').value=v;}
else if(opt=='CPT'){v=val+1;$('numberofcircles').value=v;}
else if(opt=='SBC-CPT-Preview'){v=$('spacebetweencircles').value;space=((v*mminpix)-(2*mminpix));if(space<0){space=0;}
v=$('numberofcircles').value;if(!v){}
else{html='';pad=space;if(pad<=0){pad=0;}
for(i=0;i<Number(v)&&i<30;i++){html+='<img style="padding-left: '+pad+'px" src="img/circle-edge.gif" alt="Circle Edge" />';}
$('CPT_preview').innerHTML=html;s=mminpix*v;}}
else if(opt=='lay'){if(currentLayId!==''){$(currentLayId).style.border="#FFFFFF 3px solid";}
currentLayId='layA4ls'+val;$(currentLayId).style.border="#CC0000 3px solid";}
else if(opt=='CTF'){$('circlestofill').value=val2;$('CTFPreviewImage').src='img/fill/'+val+'.png';}}
var prevdivLinkClickOb=null;function divLinkClick(divOb){if(prevdivLinkClickOb!==null){prevdivLinkClickOb.style.background="#FFFFFF";prevdivLinkClickOb.style.padding="0px 0px 0px 0px";}
divOb.style.background="#DDDDDD";divOb.style.padding="0px 0px 0px 12px";prevdivLinkClickOb=divOb;}
function contact(what){if(what=='Mindflow - Web Form Tiger'){$('contact-text').value='Hi, I would like to know more about Mindflow\'s - Web Form Tiger.';}
else if(what=='chris'){$('contact-text').value='Hi Chris, ';}
else if(what=='idea'){$('contact-text').value='Hi Chris, I have an idea for the Shooting Targets Web Form ... ';}
else if(what=='order'){$('contact-text').value='Hi Chris, I would like to enquire about getting Shooting Range Targets Printed and Delivered to us ... [ add your enquiry here ]';}
else{}
smoothScroll('contact-shooting-targets');$('contact-email').select();return false;}
function smoothScroll(id){var scroll=new Fx.Scroll(window,{wait:false,duration:700,transition:Fx.Transitions.Quad.easeInOut});scroll.toElement(id);}
function glowMe(id,switchOffDelay){$(id).style.display='';$(id).style.background="#FFFF33";if(switchOffDelay){setTimeout('$("'+id+'").style.background = "none"',switchOffDelay);}}
function scrollto(id){smoothScroll(id);}
window.addEvent('domready',function(){new SmoothScroll({duration:700},window);$('circlestofill_help').style.display='none';$('spacebetweencircles_help').style.display='none';$('numberofcircles_help').style.display='none';$('innercirclewidth_help').style.display='none';$('ICWsliderKnob').setOpacity(1);var mySlideICW=new Slider($('ICWsliderArea'),$('ICWsliderKnob'),{steps:39,offset:4,onChange:function(pos){update('ICW',pos);}}).set(8);$('LWsliderKnob').setOpacity(1);var mySlideLW=new Slider($('LWsliderArea'),$('LWsliderKnob'),{steps:50,offset:4,onChange:function(pos){update('LW',pos);}}).set(0);$('CHsliderKnob').setOpacity(1);var mySlideLW=new Slider($('CHsliderArea'),$('CHsliderKnob'),{steps:50,offset:0,onChange:function(pos){update('CH',pos,'slider');}}).set(0);$('SBCsliderKnob').setOpacity(1);var mySlideSBC=new Slider($('SBCsliderArea'),$('SBCsliderKnob'),{steps:40,offset:4,onChange:function(pos){update('SBC',pos);update('SBC-CPT-Preview',$('spacebetweencircles').value,$('numberofcircles').value);}}).set(14);$('CPTsliderKnob').setOpacity(1);var mySlideCPT=new Slider($('CPTsliderArea'),$('CPTsliderKnob'),{steps:14,offset:4,onChange:function(pos){update('CPT',pos);update('SBC-CPT-Preview',$('spacebetweencircles').value,$('numberofcircles').value);}}).set(3);setLayout('A4','ls',3,2);update('CTF','13','1,3');divLinkClick($('defaultCTF'));Element.implement({show:function(){this.setStyle('display','');},hide:function(){this.setStyle('display','none');}});$('submit-thanks').hide();$('imgCompatible').src="img/compatible-systems-browsers-1.png";});function setCalDiagColor(c){$('calDiagColor').value=c;$('calDiagThumb').src='images/calibration_diagram_shooting_'+c+'-w140.png';}
window.addEvent('domready',function(){$$('input[type=text]').each(function(el){el.addEvent('keypress',function(e){if(e.code==13){e=new Event(e).stop();}});});});
