function Sitesearch(){
	
var SearchField = document.SearchForm.Search.value

if (SearchField.indexOf("Search") == -1){
	return true
	}
	else
	{
	return false
	}


}

//Functions to toggle field contents on and off
function clearfield(fieldname,numeric,classchange) {

var field = document.getElementById(fieldname)
if (numeric != 'false'){
    if (isNaN(field.value) == true){
    field.value = ''
  }
}
else
{
    if (field.value == 'Search thinkbanking')
    {
    field.value = ''
    if (classchange == 1){
        field.className = 'utilities-field'
    }
    }
}
}

function populate(original,fieldname,numeric,classchange) {
 
var field = document.getElementById(fieldname)

if (numeric != 'false'){
    if (field.value == '' || isNaN(field.value) == true){
    field.value = original
    if (classchange == 1) {
    field.className = 'utilities-field grey'
    }
  }
}
else
{
    if (field.value == ''){
    field.value = original
    if (classchange == 1) {
    field.className = 'utilities-field grey'
    }
}
}  
  
}

//banner

var manual = 0
var moveme
var globalcounter = 1
var width = 700
var currentvalue = 0
var polarity
var freeze = false
var noOfItems = 3
var playloop
var playing = 0
var firstitem = 0

function play(){
playing = 1
playloop = setInterval("next(1)", 6000)
}

function kill(){
clearInterval(playloop)
}


function resetall(e){
if (freeze == false){
if (e != 1 )
{document.getElementById('slide1').style.zIndex = 0
document.getElementById('slide1').style.left = width + 'px'
}
else
{document.getElementById('slide1').style.zIndex = 8}

if (e != 2)
{document.getElementById('slide2').style.zIndex = 0
document.getElementById('slide2').style.left =  width + 'px'}
else
{document.getElementById('slide2').style.zIndex = 8}


if (e != 3)
{document.getElementById('slide3').style.zIndex = 0
document.getElementById('slide3').style.left =  width + 'px'}
else
{document.getElementById('slide3').style.zIndex = 8}
}
}

function polarstart(p) {

if (freeze == false) {
if (p == "n"){
	polarity = "-"
	currentvalue = width
}
else
{
	currentvalue = width - (width*2)
	polarity = "+"
	document.getElementById('slide' + globalcounter).style.left = "-695px"
	document.getElementById('slide' + globalcounter).style.zIndex = 9 
}

moveme = setInterval("move('"+polarity+"')",35)
}
}



function move(p) {

if (p == "-"){
	leftValue = width
}
else
{
leftValue = width - (width*2)
}
		
		moveAmount = 50
		freeze = true
		
		if (p == "-")
		{
		if (currentvalue > 0){
			leftValue = leftValue - moveAmount
			currentvalue = currentvalue - moveAmount
			document.getElementById('slide' + globalcounter).style.left = currentvalue + "px"
			if (globalcounter > 1){
				document.getElementById('slide' + (globalcounter-1)).style.left = (currentvalue-width) + "px"
			}
			if (globalcounter == 1){
				document.getElementById('slide' + (noOfItems)).style.left = (currentvalue-width) + "px"
			}
			
			document.getElementById('slide' + globalcounter).style.zIndex = 9 
			}
			
		if (currentvalue == 0){
			clearInterval(moveme)
			freeze = false
		}
			
		}
		else
		{
		if (currentvalue < 0){
			leftValue = leftValue + moveAmount
			currentvalue = currentvalue + moveAmount
			document.getElementById('slide' + globalcounter).style.left = currentvalue + "px"
			if (globalcounter < noOfItems){
				document.getElementById('slide' + (globalcounter+1)).style.left = (currentvalue+width) + "px"
			}
			if (globalcounter == noOfItems){
				document.getElementById('slide1').style.left = (currentvalue+width) + "px"
			}
			}
			
		if (currentvalue == 0){
			clearInterval(moveme)
			freeze = false
		}

		}
		
	}

function next(loop){
if (manual == 1){
kill()
}
if (freeze==false){
if (loop == 1)
	{
	if (globalcounter >= noOfItems){
	        clearInterval(moveme)
			resetall(globalcounter)
			globalcounter = 1
			polarstart('n')
	}
	else
	{
		resetall(globalcounter)
		polarstart('n')
		globalcounter = globalcounter + 1
	}
}
else
{

	if (globalcounter < noOfItems){
		resetall(globalcounter)
		polarstart('n')
		globalcounter = globalcounter + 1
	}
	
	else{
		resetall(globalcounter)
		globalcounter = 1
		polarstart('n')
	}
}
}
}

function last(){
if (manual == 1){
kill()
}
if (freeze==false){
if (globalcounter > 1 ){
resetall(globalcounter)
globalcounter = globalcounter - 1
polarstart('p')
}
else
{
globalcounter = noOfItems
polarstart('p')
}
}
}



// Show hide
function showdiv(name,name2){
var obj = (document.getElementById)? document.getElementById(name) : eval("document.all[name]");
var ua = navigator.userAgent;

if(name2 && ua.indexOf('MSIE 6.0') != -1){
	var obj2 = (document.getElementById)? document.getElementById(name2) : eval("document.all[name2]");
	if (obj2.style.display=="none"){
		obj2.style.display="";
	}else{
		obj2.style.display="none";
	}
}

if (obj.style.display=="none"){
obj.style.display="";
}else{
obj.style.display="none";
}
}

function hidediv(name){
var obj = (document.getElementById)? document.getElementById(name) : eval("document.all[name]");
obj.style.display="none";
}




// Pop up windows
function openpopup(popurl){
var winpops=window.open(popurl,"","width=419,height=440,scrollbars,resizable")
}

function openbanking(popurl){
var winpops=window.open(popurl,"","width=1007,height=658,scrollbars,resizable")
}

function openfairbanking(popurl){
var winpops=window.open(popurl,"","width=600,height=581,scrollbars,resizable")
}

function openid(popurl){
var winpops=window.open(popurl,"","width=720,height=600,scrollbars,resizable")
}




//Routing to fade in layers
var fadeTime = ""
var mozfade = 0
var IEfade = 0
var previous = ""
function flipper(ID,targetID) {
	
   	clearInterval(fadeTime)
   
	document.getElementById(targetID).style.backgroundImage = "url(images/" + targetID + ".jpg)";
	
   
   if (previous!=targetID){
	document.getElementById("image-welcome").style.zIndex = 1;
	document.getElementById("image-mortgage").style.zIndex = 1;
	document.getElementById("image-loan").style.zIndex = 1;
	document.getElementById("image-debt").style.zIndex = 1;
	document.getElementById("image-repossession").style.zIndex = 1;
   }
	
	document.getElementById("one").className = "";
	document.getElementById("two").className = "";
	document.getElementById("three").className = "";
	document.getElementById("four").className = "";
	document.getElementById("five").className = "";
	
	if (previous==""){
		previous = "image-welcome"
		document.getElementById(targetID).style.zIndex = 9;
	}
	
	mozfade = 0
	IEfade = 0
	if (previous==targetID){
		document.getElementById(targetID).style.zIndex = 9;

	}
	
	else
	
	{
		fadeTime = setInterval("FadeIn('" + targetID + "')",10)
		document.getElementById(targetID).style.opacity = 0;
		document.getElementById(targetID).style.filter="alpha(opacity=0)";
		document.getElementById(previous).style.zIndex = 2;
		document.getElementById(targetID).style.zIndex = 9;
		
	}
	document.getElementById(ID).className = "active"
	previous = targetID
}




//Fading function
function FadeIn(targetID) {

		document.getElementById(targetID).style.opacity = mozfade 
		document.getElementById(targetID).style.filter = "alpha(opacity=" + IEfade + ")" 
		mozfade = mozfade + 0.1
		IEfade = IEfade + 10
		
		if (mozfade > 1 || IEfade > 100){
			clearInterval(fadeTime)
		}

	}


function testcustomer(iscustomer){
    if (iscustomer=="Yes")
        {document.getElementById("cusref").style.display="block"}
    else
        {document.getElementById("cusref").style.display="none"}

}
