//FRAMES BUSTING SCRIPT.
if(top != self) top.location = document.location;

var quotes = new Array();
quotes[0] = "<b>\"</b>It was nice to speak to friendly people - I spoke to several different people and they always took the time to be polite and helpful. Thank you.<b>\"</b><br>Mrs Pickwell from Lincolnshire";
quotes[1] = "<b>\"</b>I am a Mortgage Advisor and this is the best in house conveyancing I have come across.<b>\"</b><br> Mr Hill from Wrexham";
quotes[2] = "<b>\"</b>The process of changing mortgages was made very simple and with the minimum amount of fuss. An extremely efficient service. Thank you.<b>\"</b><br> Mrs Richards from Shewsbury";
quotes[3] = "<b>\"</b>Thanks for arranging my remortgage so quickly you should be called 'Rapid enact' Cheers!<b>\"</b><br> Mr Dobson from Burnley";
quotes[4] = "<b>\"</b>I was very pleased with the speed and efficiency with which the remortgage was handled<b>\"</b><br> Mr and Mrs Duncan from Twickenham";
quotes[5] = "<b>\"</b>Excellent service, very helpful and knowledgeable staff, a professional service. Thank you.<b>\"</b><br> Ms Stevens from Tunbridge Wells";
quotes[6] = "<b>\"</b>Good feedback, quick completion and very pleasant staff. Thank you.<b>\"</b><br> Mr Leverton from Spalding.";
quotes[7] = "<b>\"</b>I could not be more satisfied with your extremely helpful, friendly and efficient staff. Thank you all very much for helping to take the pressure away from purchasing my property. Highly recommendable.<b>\"</b><br> Mrs Sant from Liverpool"

var bgcolor = "#FFFFFF";
var fcolor = "#000000";
var fadesteps = 20;
var fadeshow = 3000;
var fadesleep = 30;
var loop = true;


var colors = new Array(fadesteps);
getFadeColors(bgcolor,fcolor,colors);
var color = 0;
var text = Math.floor(Math.random()*8)
var fadestep = 1;

//*******************************************************************************************
function fade() {
	var styleobj = (isMinIE4||isMinIE5||isMinNS6)?getLayer("quotediv").style : getLayer("quotediv");
	
	if(color==0)
	{
		fadestep = 1;
		color += fadestep;
		if(text==quotes.length-1) text = 0;
		getLayer("quotediv").innerHTML = quotes[text+=1];
		setTimeout("fade()",fadesleep);
	}
	else if(color==fadesteps)
	{
		color += fadestep;
		fadestep = -1;
		styleobj.color = colors[color];
		setTimeout("fade()",fadeshow);
	}
	else
	{
		color += fadestep;
		styleobj.color = colors[color];
		setTimeout("fade()",fadesleep);
	}
}

//*******************************************************************************************
function getFadeColors(ColorA, ColorB, Colors) {
	len = Colors.length;

	// strip '#' signs if present
	if (ColorA.charAt(0)=='#') ColorA = ColorA.substring(1);
	if (ColorB.charAt(0)=='#') ColorB = ColorB.substring(1);

	// substract rgb compents from hex string
	var r = HexToInt(ColorA.substring(0,2));
	var g = HexToInt(ColorA.substring(2,4));
	var b = HexToInt(ColorA.substring(4,6));
	var r2 = HexToInt(ColorB.substring(0,2));
	var g2 = HexToInt(ColorB.substring(2,4));
	var b2 = HexToInt(ColorB.substring(4,6));

	// calculate size of fadestep for each color component
	var rfadestep = Math.round((r2 - r) / len);
	var gfadestep = Math.round((g2 - g) / len);
	var bfadestep = Math.round((b2 - b) / len);

	// fill Colors array with fader colors
	for (i = 0; i < len-1; i++) {
		Colors[i] = "#" + IntToHex(r) + IntToHex(g) + IntToHex(b);
	r += rfadestep;
	g += gfadestep;
	b += bfadestep;
	}
	Colors[len-1] = ColorB; // make sure we finish exactly at ColorB
}

//*******************************************************************************************
function IntToHex(n) {
	var result = n.toString(16);
	if (result.length==1) result = "0"+result;
	return result;
}

//*******************************************************************************************
function HexToInt(hex) {
	return parseInt(hex, 16);
}


function MM_preloadImages() {
    if (document.images) {
        var imgFiles = MM_preloadImages.arguments;
        if (document.preloadArray == null) {
            document.preloadArray = new Array();
        }
        var i = document.preloadArray.length;
        with (document) {
            for (var j = 0; j < imgFiles.length; j++) {
                if (imgFiles[j].charAt(0) != "#") {
                    document.preloadArray[i] = new Image();
                    document.preloadArray[i++].src = imgFiles[j];
                }
            }
        }
    }
}

function MM_swapImage() {
    var i, j = 0, objStr, obj, swapArray = new Array(), oldArray = document.MM_swapImgData;
    for (i = 0; i < (MM_swapImage.arguments.length - 2); i += 3) {
        objStr = MM_swapImage.arguments[(navigator.appName == "Netscape") ? i : i + 1];
        if ((objStr.indexOf("document.layers[") == 0 && document.layers == null) || (objStr.indexOf("document.all[") == 0 && document.all == null)) {
            objStr = "document" + objStr.substring(objStr.lastIndexOf("."), objStr.length);
        }
        obj = eval(objStr);
        if (obj != null) {
            swapArray[j++] = obj;
            swapArray[j++] = (oldArray == null || oldArray[j - 1] != obj) ? obj.src : oldArray[j];
            obj.src = MM_swapImage.arguments[i + 2];
        }
    }
    document.MM_swapImgData = swapArray;
}

function MM_swapImgRestore() {
    if (document.MM_swapImgData != null) {
        for (var i = 0; i < (document.MM_swapImgData.length - 1); i += 2) {
            document.MM_swapImgData[i].src = document.MM_swapImgData[i + 1];
        }
    }
}

function popDisclaimer(url) {
	var newWin = window.open(url,'terms','directories=no,height=400,width=400,menubar=no,resizable=no,scrollbars=yes,status=NO,toolbar=no,alwaysRaised=yes') ;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		button_remortgage_over = newImage("images/button_remortgage-over.gif");
		button_buysell_button_remortgage_over = newImage("images/button_buysell-button_remor.gif");
		button_buy_button_remortgage_over = newImage("images/button_buy-button_remortgag.gif");
		button_sell_button_remortgage_over = newImage("images/button_sell-button_remortga.gif");
		preloadFlag = true;
	}
}

// Resize image larger than maximum dimensions
function resizeImage(image, maxWidth, maxHeight) {

  // Clone image to get dimensions
  var cloneImg = new Image();
  cloneImg.src = image.src;
  var height = cloneImg.height;
  var width = cloneImg.width;
  
  // Check image is larger than maximum
  if (width > maxWidth || height > maxHeight) {
  
    // Calculate resize factor
    var resizeFactor;
    if ((width - maxWidth) / maxWidth > (height - maxHeight) / maxHeight)
      resizeFactor = maxWidth / width;
    else
      resizeFactor = maxHeight / height;     
  
    // Resize image
    image.width = width * resizeFactor;
    image.height = height * resizeFactor;
  }
}