function emailPage(anchor)
{
	var body = escape("I saw this page on the blueyonder web site, and thought you would be interested.\n\n" + document.title + " - " + location.href + "\n\n");
	anchor.href = "mailto:?subject=" + document.title + "&body=" + body;
}

function setHomepage(page){
	page.style.behavior = "url(#default#homepage)";
	page.setHomePage("http://www.blueyonder.co.uk");
}

function goToLink(link){
	var header = link.getElementsByTagName('h3')[0];
	var anchor = header.getElementsByTagName('a')[0];
	_hbLink(anchor.innerHTML);
	if(anchor.target){
		window.open(anchor.href,anchor.target,'');
	}else{
		location.href = anchor.href;
	}
}

function openLink(anchor){
	if(this._hbLink){
		_hbLink(anchor.innerHTML);
	}
	if(anchor.target){
		var pop = window.open(anchor.href,anchor.target);
		if(!pop || pop.closed){
			location.href = anchor.href;
		}
	}else{
		location.href = anchor.href;
	}
}

function changeStyle(link,style){
	if(style){
		if(!link.classNameOut){
			link.classNameOut = link.className;
		}
		link.className = link.className + ' ' + style;
	}else{
		if(link.classNameOut){
			link.className = link.classNameOut;
		}
	}
}

if(document.getElementById && document.getElementsByTagName){
	var home = document.getElementById('home');
	if(home){
		if(document.getElementsByTagName){
			var divs = document.getElementsByTagName('div');
			for(var i=0;i<divs.length;i++){
				if((divs[i].className == 'link')||(divs[i].className.substring(0,5) == 'link ')){
					var header = divs[i].getElementsByTagName('h3');
					if(header&&header.length){
						var anchor = header[0].getElementsByTagName('a');
						if(anchor&&anchor.length){
							divs[i].onclick = function(){
								goToLink(this);
							}
							divs[i].onmouseover = function(){
								changeStyle(this,'linkover');
							}
							divs[i].onmouseout = function(){
								changeStyle(this,null);
							}
						}
					}
				}
			}
		}
	}

	var modules = document.getElementById('modules');
	if(modules){
		var divs = modules.getElementsByTagName('div');
		if(divs)for(var i=0;i<divs.length;i++){
			if((divs[i].className == 'content')||(divs[i].className.substring(0,8) == 'content ')){
				var header = divs[i].getElementsByTagName('h2');
				if(header && header.length){
					var anchor = header[0].getElementsByTagName('a');
					if(anchor && anchor.length && anchor[0].className == 'rollover'){
						divs[i].longdesc = anchor[0];
						divs[i].onclick = function(){
							openLink(this.longdesc);
						}
						// Prevent multiple popups by disabling anchor when target is present
						if(anchor[0].target){
							anchor[0].onclick = function(){
								return(false);
							}
						}
						divs[i].onmouseover = function(){
							changeStyle(this,'rollover');
						}
						divs[i].onmouseout = function(){
							changeStyle(this,null);
						}
					}
				}
			}
		}
	}

	var enablers = document.getElementById('enablers');
	if(enablers){
		var divs = enablers.getElementsByTagName('div');
		if(divs)for(var i=0;i<divs.length;i++){
			if(divs[i].className == 'enabler'){
				var anchor = divs[i].getElementsByTagName('a');
				if(anchor && anchor.length && anchor[0].className == 'chevron'){
					var image = divs[i].getElementsByTagName('img');
					if(image && image.length){
						image[0].longdesc = anchor[0];
						image[0].onclick = function(){
							openLink(this.longdesc);
						}
						image[0].onmouseover = function(){
							changeStyle(this,'rollover');
						}
						image[0].onmouseout = function(){
							changeStyle(this,null);
						}
					}
				}
			}
		}
	}
}


// Author: Sharath Peravali
// This is to validate Alliance and Leicester Loan Form
// This is in Channel>Money on the enabler section
// Placed here as this .js file is loaded with all pages
// and didnt want to place it in a separate file as it will
// cause extra connection to server to load.
// To be be removed AS SOON AS Alliance and Leicester
// form is removed, which is meant to last only a month.(august, 2006)

function validate_anl_loan_amount()
{
    amount = document.loan_form.amount.value;
       valid = true;
    if ( isNaN(amount) || amount < 1000 || amount > 20000 )
    {
        valid = false;

        if ( isNaN(amount) )
        {
                  alert("Please enter numeric characters only");
        }

        else
        {
                alert("Please enter loan amount between 1,000 and 20,000");
        }

              document.loan_form.amount.focus();
    }
       return valid;
}
