
//Function alerts the index of the selected option within form
function goToevent(){
	
myref = document.form1.eventType.options[document.form1.eventType.selectedIndex].value


location.href = "page.aspx?page=2&type=" + myref
}

function goToevent2(){
	
myref = document.form1.eventType2.options[document.form1.eventType2.selectedIndex].value


location.href = "page.aspx?page=2&type=" + myref


}

function goToevent3(){
	
myref = document.form1.eventType2.options[document.form1.eventType2.selectedIndex].value


location.href = "page.aspx?page=295&type=" + myref


}



startList = function() {
	


if (document.all&&document.getElementById) {
	
navRoot = document.getElementById("nav");


for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];



if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";

  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");

   }
   }
  }
 }
}

window.onload=startList;

function searcher() {
	window.location.href = "search.aspx?search=" + document.form1.search.value ;
	
}

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];}
}


function view(){

namer = document.form1.vRecipient.value;
amount = document.form1.vAmount.value;
line1 = document.form1.vMessage1.value;
line2 = document.form1.vMessage2.value;
line3 = document.form1.vMessage3.value;

mylink = "cv/vouchers/view_voucher.asp?name=" + namer + "&amount=" + amount + "&line1=" + line1 + "&line2=" + line2 + "&line3=" + line3;

window.open(mylink,'','width=640; height=400;');


}




function validatevoucher(){


error = ""
goto = 0
col = "red"

if (document.form1.vRecipient.value == "") {goto = 1; error = error + 'Please enter a recipient for the voucher \n'; }
if (document.form1.vRecipientEmail.value == "") {goto = 1; error = error + 'Please enter an email address for the recipient \n'; }
if (document.form1.vAmount.value == "") {goto = 1; error = error + 'Please enter an amount for the voucher \n'; }
if (document.form1.vAmount.value < 10) {goto = 1; error = error + 'Please enter at least £10 \n'; }


if (document.form1.vAmount.value != parseInt(document.form1.vAmount.value)) {goto = 1; error = error + 'Please enter a number \n'; }


if (goto == 0) {document.form1.submit();}
if (goto == 1) {alert(error)}

}

