// JavaScript Document

 var IsNumber=true;
 var IsText = true;

function IsNumeric(sText)
{
   var ValidChars = "0123456789. ";
   var Char;
   
  

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}




function IsCharacter(sText)
{
   var ValidChars = "!£$%^&*()_+=-[]{};:@'#~<,.?\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY`¬¬|";
   var Char;
   
  

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsText = false;
         }
      }
   return IsText;
}







function findmap()
{
	document.map.submit();
	}


function submitcontactForm(formdestination)
		{
		
			
			
			validate(document.contactForm.name.value != '', 'Please enter your name in the form', document.contactForm.name);
			
if(document.contactForm.name.value.length > 0)
{
IsCharacter(document.contactForm.name.value);
}
if (IsText == false)
{
	alert('Please enter non numeric characters in the name field')
	IsText = true;
	return false;
	
	
}			
			
			
			
			
			validate(document.contactForm.company.value != '', 'Please enter your company name in the form', document.contactForm.company);
			
			
if(document.contactForm.company.value.length > 0)
{
IsCharacter(document.contactForm.company.value);
}
if (IsText == false)
{
	alert('Please enter non numeric characters in the company field')
	IsText = true;
	return false;
	
	
}




if(document.contactForm.position.value.length > 0)
{
IsCharacter(document.contactForm.position.value);
}
if (IsText == false)
{
	alert('Please enter non numeric characters in the position field')
	IsText = true;
	return false;
	
	
}
			
			
			validate(document.contactForm.telephone.value != '', 'Please enter your telephone number in the form', document.contactForm.telephone);
			

/*Check Number*/

if(document.contactForm.telephone.value.length > 0)
{
IsNumeric(document.contactForm.telephone.value);
}
if (IsNumber == false)
{
	alert('Please enter your telephone number in numeric format only')
	IsNumber = true;
	return false;
	
	
}







validate(document.contactForm.email.value != '', 'Please enter your email address in the form', document.contactForm.email);
			
			
			
if (document.contactForm.email.value != '') validate(isEmail(document.contactForm.email.value), 'The email address you have entered doesn\'t appear to be valid.  Please check it and re-enter.', document.contactForm.email);
			validate(document.contactForm.message.value.length != 0 , 'Please enter a message', document.contactForm.message);
			
if (allOK())
{
if (document.contactForm.computerOpt1.value == 0 && document.contactForm.mobileOpt2.value == 0 && document.contactForm.dataRecoveryOpt3.value == 0 ) 
{
alert('Please indicate your area of enquiry. Please select all that apply');

return false;
}





				
				
				document.contactForm.action = formdestination;
				document.contactForm.submit();
				return true;
			}
			else return false;
		}
		
		
		


function formTicker(hiddenfieldval, elementtriggerdfrom)
{
	if (document.getElementById(hiddenfieldval).value == 0)
	{	
	document.getElementById(elementtriggerdfrom).src="/images/buttons/check_box_checked.gif";
	document.getElementById(hiddenfieldval).value = 1;
	}
	else
	{
	document.getElementById(elementtriggerdfrom).src="/images/buttons/check_box_unchecked.gif";
	document.getElementById(hiddenfieldval).value = 0;
	}
		
	
}


function newsItemwithAnimation(amountofnews, triggertype)
{
	if (amountofnews != 0)
	{
		var increment=0;
		var createstring;
		for (increment=0;increment<=amountofnews;increment++)
		{
		createstring = 'newsitem' +	increment
		setInterval("ExecuteAnimation('"+ createstring + "')", increment * 500);	
		createstring = ''
	
		if (triggertype !='news')
		{
		setTimeout("artcleItemwithAnimation('')", amountofnews*500)
		}
		
		}
			
	}
		
}



function ExecuteAnimation(items)
{
	
  $("#" + items).fadeOut("slow");
}


var articlecounts

function calcnoofArticles(noofarticlesfound)
{
	
	articlecounts = noofarticlesfound;
	
	}


function artcleItemwithAnimation(triggertype)
{
	if (articlecounts != 0)
	{
		var increment=0;
		var createstring;
		for (increment=0;increment<=articlecounts;increment++)
		{
		createstring = 'articlesitem' +	increment
		setInterval("ExecuteAnimation('"+ createstring + "')", increment * 500);	
		createstring = ''
		}
	}
}


function findwidthnavfirstime()
{
	
document.getElementById('expandablediv1').style.width='254px';
document.getElementById('expandablediv2').style.width='254px';
document.getElementById('expandablediv3').style.width='254px';
	
	}











$(document).ready(function(){ 
						   
$("#expandablediv1").hover(function(){
									

//$("#expandablediv1").animate({ width: "500"}, 500 );
$("#orange1").fadeOut("slow");
$("#image1").fadeIn("slow");
document.getElementById('titleholder1').style.color='#000';

},function(){
//$("#expandablediv1").animate({ width: "254"}, 500 ); 
$("#orange1").fadeIn("slow");
$("#image1").fadeOut("slow");
document.getElementById('titleholder1').style.color='#FFF';

});
});




$(document).ready(function(){
						   
						   
$("#expandablediv2").hover(function(){
									
																		
//$("#expandablediv2").animate({ width: "500"}, 500 ); 
$("#orange2").fadeOut("slow");
$("#image2").fadeIn("slow");
document.getElementById('titleholder2').style.color='#000';

},function(){
//$("#expandablediv2").animate({ width: "254"}, 500 ); 
$("#orange2").fadeIn("slow");
$("#image2").fadeOut("slow");
document.getElementById('titleholder2').style.color='#FFF';
});
});


$(document).ready(function(){ 
$("#expandablediv3").hover(function(){
									
									
//$("#expandablediv3").animate({ width: "500"}, 500 ); 
$("#orange3").fadeOut("slow");
$("#image3").fadeIn("slow");
document.getElementById('titleholder3').style.color='#000';

},function(){
//$("#expandablediv3").animate({ width: "254"}, 500 ); 
$("#orange3").fadeIn("slow");
$("#image3").fadeOut("slow");
document.getElementById('titleholder3').style.color='#FFF';
});
});




$(document).ready(function(){ 
$("#homeslink").hover(function(){
$("#homeslink").fadeTo("slow", 0.65);
},function(){
	$("#homeslink").fadeTo("slow", 1.0);

});
});


$(document).ready(function(){ 
$("#aboutlink").hover(function(){
$("#aboutlink").fadeTo("slow", 0.65);
},function(){
	$("#aboutlink").fadeTo("slow", 1.0);

});
});



$(document).ready(function(){ 
$("#compuLink").hover(function(){
$("#compuLink").fadeTo("slow", 0.65);
},function(){
	$("#compuLink").fadeTo("slow", 1.0);

});
});

$(document).ready(function(){ 
$("#mobilLink").hover(function(){
$("#mobilLink").fadeTo("slow", 0.65);
},function(){
	$("#mobilLink").fadeTo("slow", 1.0);

});
});


$(document).ready(function(){ 
$("#datarLink").hover(function(){
$("#datarLink").fadeTo("slow", 0.65);
},function(){
	$("#datarLink").fadeTo("slow", 1.0);

});
});

$(document).ready(function(){ 
$("#articLink").hover(function(){
$("#articLink").fadeTo("slow", 0.65);
},function(){
	$("#articLink").fadeTo("slow", 1.0);

});
});

$(document).ready(function(){ 
$("#contaLink").hover(function(){
$("#contaLink").fadeTo("slow", 0.65);
},function(){
	$("#contaLink").fadeTo("slow", 1.0);

});
});


$(document).ready(function(){ 
$("#linkslistLink").hover(function(){
$("#linkslistLink").fadeTo("slow", 0.65);
},function(){
	$("#linkslistLink").fadeTo("slow", 1.0);

});
});