/* KP Technology Java Scripting - by Fatal-INK.co.uk */

var doit = true
function showm(ob,pict) {
  if(doit) {
    document.getElementById(ob).style.height = '125'
    document.getElementById(pict).src = 'images/arrowl.gif'
    doit = false
  }
  else {
    document.getElementById(ob).style.height = '20'
    document.getElementById(pict).src = 'images/arrowd.gif'
    doit = true
  }
}
function toggleMe(a){
  var e=document.getElementById(a);
  if(!e)return true;
  if(e.style.display=="none"){
    e.style.display="block"
  } else {
    e.style.display="none"
  }
  return true;
}

/*Call Request Form*/

function CallFormFieldValidator(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter your Name.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.email.value == "")
  {
    alert("Please enter your Email Address.");
    theForm.email.focus();
    return (false);
  }
  if (theForm.Organisation.value == "")
  {
    alert("Please enter the name of your Organisation.");
    theForm.Organisation.focus();
    return (false);
  }
  if (theForm.Telephone.value == "")
  {
    alert("Please enter your telephone number.");
    theForm.Telephone.focus();
    return (false);
  }
}

/*Consumables Request Form*/

function ConsumablesFormFieldValidator(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter your Name.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.email.value == "")
  {
    alert("Please enter your Email Address.");
    theForm.email.focus();
    return (false);
  }
  if (theForm.Organisation.value == "")
  {
    alert("Please enter the name of your Organisation.");
    theForm.Organisation.focus();
    return (false);
  }
  if (theForm.Request.value == "")
  {
    alert("Which product are you interested in?");
    theForm.Request.focus();
    return (false);
  }
}

/*Change Form*/

function ChangeFormFieldValidator(theForm)
{
  if (theForm.Comments.value == "")
  {
    alert("Please leave a comment.");
    theForm.Comments.focus();
    return (false);
  }
  if (theForm.Name.value == "")
  {
    alert("What is your name?");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.email.value == "")
  {
    alert("What is your e-mail address?.");
    theForm.email.focus();
    return (false);
  }

if (theForm.Customer_History.selectedIndex == 0)
  {
   	alert("Are you a new customer to KP Technology?.");
    theForm.Customer_History.focus();
    return (false);
  }
if (theForm.Found_Through.selectedIndex == 0)
  {
   	alert("Where did you hear about us");
    theForm.Found_Through.focus();
    return (false);
  }
}

/* Quick Quote Form */

function QuickFormFieldValidator(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter your Name.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.email.value == "")
  {
    alert("Please enter your Email Address.");
    theForm.email.focus();
    return (false);
  }
  if (theForm.Organisation.value == "")
  {
    alert("Please enter the name of your Organisation.");
    theForm.Organisation.focus();
    return (false);
  }
  if (theForm.Phone.value == "")
  {
    alert("Please enter a contact telephone number.");
    theForm.Phone.focus();
    return (false);
  }
  if (theForm.Application.value == "")
  {
    alert("Please enter your field of research.");
    theForm.Application.focus();
    return (false);
  }
}

/*Technical Support Form*/

function TechFormFieldValidator(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter your Name.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.email.value == "")
  {
    alert("Please enter your Email Address.");
    theForm.email.focus();
    return (false);
  }
  if (theForm.Organisation.value == "")
  {
    alert("Please enter the name of your Organisation.");
    theForm.Organisation.focus();
    return (false);
  }
  if (theForm.Generation.selectedIndex == 0)
  {
   	alert("Which 'Series Number' is displayed on the front of the Digital Control Unit?.");
    theForm.Generation.focus();
    return (false);
  }
  if (theForm.Problem.value == "")
  {
    alert("Please state your problem.");
    theForm.Problem.focus();
    return (false);
  }
}

/*Quote Form*/

function QuoteFormFieldValidator(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter your Name.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.email.value == "")
  {
    alert("Please enter your Email Address.");
    theForm.email.focus();
    return (false);
  }
  if (theForm.Organisation.value == "")
  {
    alert("Please enter your Organisation name.");
    theForm.Organisation.focus();
    return (false);
  }
  if (theForm.Country.value == "")
  {
    alert("Please enter the Country you are in.");
    theForm.Country.focus();
    return (false);
  }
   if (theForm.Phone.value == "")
  {
    alert("Please enter a contact telephone number.");
    theForm.Phone.focus();
    return (false);
  }
  if (theForm.Reason.selectedIndex == 0)
  {
    alert("Please select a reason for the quote.");
    theForm.Reason.focus();
    return (false);
  }
  if (theForm.Heard.selectedIndex == 0)
  {
   	alert("Please specify where you heard about us.");
    theForm.Heard.focus();
    return (false);
  }
  if (theForm.Specify.value == "")
  {
    alert("Please specify where you heard about us.");
    theForm.Specify.focus();
    return (false);
  }
}

/*Hide/Show Element - Quote Form*/

function CheckVisibility()
{
  if (document.getElementById('Heard').selectedIndex == 0)
  {
	document.getElementById('hideshow').style.visibility = 'hidden';
  }
  else
  {
  	document.getElementById('hideshow').style.visibility = 'visible';

  	document.getElementById('Specify').focus();
  }
}

/*Image Swap*/

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}





/**/


/*Index - Products - Bespoke Services*/

function popUp1(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 420,top = 200');");
}
function popUp2(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 420,top = 200');");
}
function popUp3(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600,left = 420,top = 100');");
}

function popUp4(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=480,left = 420,top = 200');");
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 420,top = 200');");
}