function hover(box) {
	document.getElementById('box'+box).className = 'menuHover';
}
function hoverOut(box) {
	document.getElementById('box'+box).className = 'menuOption';
}
function pagehover(box) {
	document.getElementById('page'+box).className = 'textLinkHvr';
}
function pagehoverOut(box) {
	document.getElementById('page'+box).className = 'textLink';
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
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_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 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_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_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function enter() {
	var check = alert("You entered an incorrect username / password.");
}
function myAlert(message) {
	alert(message);
}

var http = getHTTPObject();
function getHTTPObject(){
  var xmlHttp=null;
  try{ xmlHttp=new XMLHttpRequest(); }
  catch(err){
    try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
    catch(err){
    }
  } return xmlHttp;
}

function Search(){
  var searchWords = document.getElementById('searchBar').value;
  var url="ajax_search.php?searchWords="+searchWords;
  var myRandom=parseInt(Math.random()*99999999);
  http.abort();
  http.open("GET", url+'&rand='+myRandom, true);
  http.onreadystatechange=ajaxReceive;
  http.send(null);
  http.close;
}

function ajaxReceive(){
  if(http.readyState==4){
	  var returncode = http.responseText;
      document.getElementById('contacts').innerHTML = returncode;
  }
}
function add_note() {
	$(document).ready(function(){

	  $("#Addnote").animate({opacity: "0.1", width: "807"}, "slow")
	  .animate({opacity: "1", height: "140"}, "slow")
	  return false;

});
};
function shrink_note() {
	$(document).ready(function(){

	  $("#Addnote").animate({opacity: "1", height: "30"}, "slow")
	  .animate({opacity: "1", width: "120"}, "slow")
	  return false;

});
};
function scrollDown() {
	for (i=0;i<window.screen.availHeight;i+=10) {window.scroll(0,i); }
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
 
function showPlayer(id){  
  solgilbert = window.open ('training_select.php?id='+id, 'solgilbert', config=' width=682, height=317, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
}

function showHomeWorkout(){  
  solgilbert = window.open ('training_homeworkout.php', 'solgilbert', config=' width=682, height=317, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
}
 
function book(id){
  if(!readCookie('solgilbertpopup')){
    showPlayer(id);
  } else {
	  var oldWin = window.open("training_select.php?id="+id,"solgilbert");
	  oldWin.focus();
  }
}
function homeworkout(){
  if(!readCookie('solgilbertpopup')){
    showHomeWorkout();
  } else {
	  var oldWin = window.open("training_homeworkout.php?","solgilbert");
	  oldWin.focus();
  }
}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function selectP(person) {
	if(person == 'gary') {
		document.getElementById('p1').src = 'images/Training/Testimonials/GaryTurnerHover.jpg';
		document.getElementById('p2').src = 'images/Training/Testimonials/JohnHathaway.jpg';
		document.getElementById('p3').src = 'images/Training/Testimonials/KatiePrice.jpg';
		document.getElementById('p4').src = 'images/Training/Testimonials/WetWetWet.jpg';
		document.getElementById('trainging_testimonails_quote').innerHTML = '<span class="training_headings">Gary Turner</span><br /><br />"Sol Gilbert is a very well respected member of the fight community and his ZT Fight Schools are some of the most complete and professional in the country. Sol takes his dedication and knowledge as a professional fighter and gives his all to his clients, whether their desired outcome is fitness, toning, weight loss or even preparation to enter the competitive fight world. Allow yourself to be trained by Sol - you will achieve your goals."<br /><br />Gary \'Smiler\' Turner Professional Fighter and 13x World Champion - <a href="http://www.teamgaryturner.com" target="_blank">www.teamgaryturner.com</a>';
	}
	if(person == 'john') {
		document.getElementById('p1').src = 'images/Training/Testimonials/GaryTurner.jpg';
		document.getElementById('p2').src = 'images/Training/Testimonials/JohnHathawayHover.jpg';
		document.getElementById('p3').src = 'images/Training/Testimonials/KatiePrice.jpg';
		document.getElementById('p4').src = 'images/Training/Testimonials/WetWetWet.jpg';
		document.getElementById('trainging_testimonails_quote').innerHTML = '<span class="training_headings">John Hathaway</span><br /><br />"I started training with Sol over 3 years ago, he has helped me to get to where I am today. I would recommend anyone to train with Sol as he has the ability for getting the most out of you"<br /><br />John Hathaway - UFC Fighter - <a href="http://www.johnhathaway.co.uk" target="_blank">www.johnhathaway.co.uk</a>';
	}
	if(person == 'katie') {
		document.getElementById('p1').src = 'images/Training/Testimonials/GaryTurner.jpg';
		document.getElementById('p2').src = 'images/Training/Testimonials/JohnHathaway.jpg';
		document.getElementById('p3').src = 'images/Training/Testimonials/KatiePriceHover.jpg';
		document.getElementById('p4').src = 'images/Training/Testimonials/WetWetWet.jpg';
		document.getElementById('trainging_testimonails_quote').innerHTML = '<span class="training_headings">Katie Price</span><br /><br />"I\'m now training at ZT Fight Skool doing boxing, martial arts and boot camp training - Boy it\'s hard work"<br /><br />Katie Price - <a href="http://www.katieprice.co.uk" target="_blank" >www.katieprice.co.uk</a>';
	}
	if(person == 'wetwetwet') {
		document.getElementById('p1').src = 'images/Training/Testimonials/GaryTurner.jpg';
		document.getElementById('p2').src = 'images/Training/Testimonials/JohnHathaway.jpg';
		document.getElementById('p3').src = 'images/Training/Testimonials/KatiePrice.jpg';
		document.getElementById('p4').src = 'images/Training/Testimonials/WetWetWetHover.jpg';
		document.getElementById('trainging_testimonails_quote').innerHTML = '<span class="training_headings">Marti Pellow</span><br /><br />"I got in contact with Sol to work on my fitness and stamina as the band was re-grouping and we were due to go on tour. Our sessions were hard but fun. I never thought I\'d be able to run the distance that Sol got me to but he\'s a hard task master and we managed to exceed all expectations."<br /><br />Marti Pellow - Wet Wet Wet - <a href="http://www.wetwetwet.co.uk" target="_blank">www.wetwetwet.co.uk</a>';
	}
}

function resetBox (div, message) {
	if (document.getElementById(div).value == "") {
		document.getElementById(div).value = message;
	}
}

function enterBox (div, message) {
	if (document.getElementById(div).value == message) {
		document.getElementById(div).value = "";
	}
}