
	// SHOP FORM CONTROL
function onEnter() {
    var evt  = (evt) ? evt : ((event) ? event : null);
    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
  }
  document.onkeypress = onEnter

function checkDesign() {
	quan = 0
if(desg ==''){alert('Please select your design\nby clicking its image.');return false}
	else
	{updtOn()}
}

function update(id) {
	window.scrollTo(0,552)
  if (moz){window.scrollTo(0,550)}
  if (ns) {window.scrollTo(0,575)}
  if (opr){window.scrollTo(0,550)}
  if (saf){window.scrollTo(0,560)}
  if (goo){window.scrollTo(0,552)}

  el = document.getElementById(id)

 if (id == 'qty') {
	updtOff()
   if (desg!='all'&&quan!='') {
       tota = parseInt(quan)*parseFloat(price)
       totb = (parseFloat(post1)+(parseInt(quan-1)*parseFloat(post2)))
       totc = tota + totb
       amnt = (tota/parseInt(quan)).toFixed(2)
       tot1.innerHTML = tota.toFixed(2)
       tot2.innerHTML = totb.toFixed(2)
       tot3.innerHTML = '<a class="shopPrice" style="line-height:15pt" href="#" onClick="return false" onMouseOver="cost=\'' +totc.toFixed(2)+ '\' ;menuOn(event,\'conv\',\'GBP\')" onMouseout="dlayhide()">&pound;' +totc.toFixed(2)+ '</a>'
	}
   if (desg=='all'&&quan!='') {
	tota = parseInt(quan)*parseFloat(price_all)
          tot1.innerHTML = tota.toFixed(2)
	totb = (parseFloat(pst1_all)+(parseInt(quan-1)*parseFloat(pst2_all)))
          tot2.innerHTML = totb.toFixed(2)
	totc = (tota + totb)
          tot3.innerHTML = '<a class="shopPrice" style="line-height:15pt" href="#" onClick="return false" onMouseOver="cost=\'' +totc.toFixed(2)+ '\' ;menuOn(event,\'conv\',\'GBP\')" onMouseout="dlayhide()">&pound;' +totc.toFixed(2)+ '</a>'
	}
    }

 if (id == 'clr') {el.innerHTML = colr}

 if (id == 'color'){ colr=''
   if (desg=='Design-1'){colr='White / Yellow'}
   if (desg=='Design-2'){colr='Blue / Red'}
  	el.innerHTML = colr}

 if (id == 'desn'){el.innerHTML = desg

   if(desg.indexOf('-')!=-1) {
         el.innerHTML = desg.substring(0,desg.indexOf('-')) +' '+ desg.substring(desg.indexOf('-')+1)
	ord = el.innerHTML
	}
	if (last!=''){
	document.getElementById(last).style.background = 'white'
	document.getElementById(last).style.border = '2px solid white'
	}
 if(desg!=''){
	document.getElementById(desg).style.border = '2px solid #4386d1'
	document.getElementById(desg).style.background = '#eef3fc'
	last = desg 
	}
    }

 if (id == 'colr'){el.innerHTML = tone + ' wood'
  var tn = '' 
   if(tone=='Light'){tn=''}else{tn='d'}	
	for (i=0; i<item.length; ++i){
	document.getElementById(item[i]).style.background = 'white'
	document.getElementById(item[i]).style.border = '2px solid white'
	document.getElementById(item[i]+'d').style.background = 'white'
	document.getElementById(item[i]+'d').style.border = '2px solid white'
		}
if(desg!=''){
	document.getElementById(desg + tn).style.border = '2px solid #4386d1'
	document.getElementById(desg + tn).style.background = '#eef3fc'
	}
      }

 if (id == 'txtOn'){
          if(face=='Front' && text.length >10) {
	alert('Your message is too long for the front.\n\nPlease select Rear Face or alter your message\n(max 10 letters including spaces)')
	return false
	}
    if(text == ''){
	text = 'Felin Bach'
	document.data.txt.value = 'Felin Bach'}
      }
 if (id == 'txtOn2'){
    if(text == ''){
	text = 'none'
	document.data.txt.value = 'none'}
    if(text.length >10) {
	alert('Your message is too long.\n\nPlease alter your message\n(max 10 letters including spaces)')
	document.data.txt.value=''
	document.data.txt.focus()}
      }
 if (id == 'txtOn3'){
    if(text == ''){
	text = 'Felin Bach'
	document.data.txt.value = 'Felin Bach'}
    if(text.length >20) {
	alert('Your message is too long.\n\nPlease alter your message\n(max 20 letters including spaces)')
	document.data.txt.value=''
	document.data.txt.focus()}
      }

 if (id == 'badg'){ badge=''
   if (desg=='Design-1'){badge='Felin Bach logo'}
   if (desg=='Design-2'){badge='County Badge'}
  	el.innerHTML = badge
	}

 if (id == 'pencil'){ 
  if (desg != 'all'&& quan>0) {update('qty')}
  if (desg == 'all'){ 
	document.getElementById('desn').innerHTML = 'All 4 colours'
       if (parseInt(quan)>0) {update('qty')}
        }
     }
}

function updtOn() {
   document.getElementById('updt').style.visibility = 'visible'
}
function updtOff() {
   document.getElementById('updt').style.visibility = 'hidden'
}

