function bookmarkUs()
{
	if (document.all) {
		window.external.AddFavorite('http://www.gblfs.com','GBL Financial Services');
	} else {
		alert('To bookmark our site, close this message, then select "Bookmarks | Add to Bookmarks" from the menu, or press <Ctrl-D>');
	}
}

/****************************************** Image Manipulation */
function newImage(theImgLoc)
{
	if (document.images)
	{
		var theNewImg = new Image();
		theNewImg.src = theImgLoc;
		return theNewImg;
	}
}

function swapImg(theImg, theSrc, theDiv)
{
	if(theDiv)
	{
		(document.all || document.getElementById)?eval("document.images."+theImg+".src = "+theSrc+".src"):eval("document."+theDiv+".document.images."+theImg+".src = "+theSrc+".src");
	}
	else
	{
		eval("document.images."+theImg+".src = "+theSrc+".src");
	}
}

/****************************************** Additional Image Manipulation */
function transImg(thisImg,img,dur,trans,div)
{
	var div = (div)?div:false;
	var navApp = navigator.appVersion;
	if(navApp.substring(navApp.indexOf("MSIE")+5,navApp.indexOf("MSIE")+8) >= 5.5 && trans)
	{
		var theImg = document.getElementById(thisImg);
		if(theImg.filters && trans < 24 && trans > 0)
		{
			theImg.filters.revealTrans.Transition=((trans)?trans:23);
			theImg.filters.revealTrans.Duration=dur;
			theImg.filters.revealTrans.stop();
			theImg.filters.revealTrans.apply();
			swapImg(thisImg,img,div);
			theImg.filters.revealTrans.play();
		}
		else if(theImg.filters && trans == 24)
		{
			theImg.filters.blendTrans.Duration=dur;
			theImg.filters.blendTrans.stop();
			theImg.filters.blendTrans.apply();
			swapImg(thisImg,img,div);
			theImg.filters.blendTrans.play();
		}
		else
		{
			swapImg(thisImg,img,div);
		}
	}
	else
	{
		swapImg(thisImg,img,div);
	}
}

/*************** Mortgage Calculator **************************/
function calculate(){
var calcs = 12;
var loan = 0;
var rate = 0;
var intloan = "0";
var intrate = "0";
var term = "0";
var intterm = "0";
var monthlyterm;
var rate100 = "0";
var monthlyrepayments = "0";
loan = document.mortgageform.loanvalue.value;
rate = document.mortgageform.interest.value;
if (!parseInt(loan) > 0){
alert("Please enter a value for the loan, no spaces or commas"); document.mortgageform.loanvalue.focus();
return false;
}
if (!parseFloat(rate) > 0){
alert("Please enter an interest rate here"); document.mortgageform.interest.focus();
return false;
}
intloan = parseInt(loan); intrate = parseFloat(rate);
if (!intloan > 0){
alert("Please enter a number here");
document.mortgageform.loanvalue.focus();
return false;
}
if (!intrate > 0){
alert("Please enter a number here"); document.mortgageform.interest.focus();
return false;
}
term = document.mortgageform.mortgage.selectedIndex
term = (term + 5) // aligns selected index with value
intterm = parseInt(term);
rate100 = (intrate / 100)
monthlyrepayments = ((intloan * term * rate100) / (12 * term))
monthlyrepayments = (monthlyrepayments * 100);
monthlyrepayments = Math.round(monthlyrepayments); monthlyrepayments = (monthlyrepayments / 100);
monthlyrepayments = padZero(monthlyrepayments); document.mortgageform.IOGanswer.value = monthlyrepayments;
var topline = (intloan * intrate * 12);
var mid = Math.pow((1+(intrate/1200)), (-term * 12));
mid = (100 * 12 * (1 - mid));
var answer = ((topline / mid) / 12);
answer = (answer * 100);
answer = Math.round(answer);
answer = (answer / 100);
answer = padZero(answer); document.mortgageform.CRGanswer.value = answer;
return false; 
}
// ***************************



//Start of new function for borrowing money 

function range1(){
//rem isNan document.calculationform.range1res.value = ""
var income1 = 0;
var income2 = "";
var newincome1 = 0 //income1 after parseint
var newincome2 = 0 //income2 after parseint
var bonus1 = "";
var bonus2 = "";
var newbonus1 = 0 //bonus1 after parseint
var newbonus2 = 0 //bonus2 after parseint
var inc9 = 0
var rgeres1 = 0 //range results
var rgeres2 = 0 //second lot of results
var intres1 = 0
var intres2 = 0
income1 = document.calculationform.income1.value;
income2 = document.calculationform.income2.value;
bonus1 = document.calculationform.commission1.value;
bonus2 = document.calculationform.commission2.value;
if (bonus1.length == 0){
bonus1 = "0"
}
if (bonus2.length == 0){
bonus2 = "0" }
if (income2.length == 0){
income2 = "0"
}
newincome1 = parseInt(income1);
newincome2 = parseInt(income2);
newbonus1 = parseInt(bonus1);
newbonus2 = parseInt(bonus2);
if (!newincome1 > 0){
alert("Please enter a number here"); document.calculationform.income1.focus();
return false;
}
if (income2.length > 1 && !newincome2 > 0) {
alert("Please enter a number here"); document.calculationform.income2.focus();
return false;
}else{ // (income1 == greatest; income2 == smallest)--->BugID=189
if(income2.length > 1 && newincome2 > 0 && newincome2 > newincome1){
newincome1 = parseInt(income2);
newincome2 = parseInt(income1);
}
}
if (bonus1.length > 1 && !newbonus1 > 0) { alert("Please enter a number here"); document.calculationform.commission1.focus();
return false;
}
if (bonus2.length > 1 && !newbonus2 > 0) {
alert("Please enter a number here"); document.calculationform.commission2.focus();
return false;
}
if (newbonus1 >= 1){
newbonus1 = (newbonus1 * 0.5)
}else{
newbonus1 == 0
}
if (newbonus2 >= 1){
newbonus2 = (newbonus2 * 0.5)
}else{
newbonus2 == 0
}
newincome1 = (newincome1 + newbonus1)
rgeres1 = newincome1 //this is used for the second calculation
newincome2 = (newincome2 + newbonus2)
rgeres2 = newincome2 //again used for the second set of results
var res1 = (newincome1 + newincome2);
var res2
res1 = (res1 * 2.5);
res2 = (newincome1 * 3.25);
intres1 = ((rgeres1 * 4) + rgeres2)
intres2 = (rgeres1 + (rgeres2 * 2.75))
if (res1 == res2){ document.calculationform.range1res.value = res1
}else if(res1 > res2){ document.calculationform.range1res.value = res1
}else{
document.calculationform.range1res.value = res2
}
if (intres1 == intres2){ document.calculationform.range2res.value = intres1
}else if(intres1 > intres2){ document.calculationform.range2res.value = intres1
}else{ document.calculationform.range2res.value = intres2
}
return false;
}
function padZero(n){
var a;
n = n.toString();
if(n.indexOf(".")!=-1){
a=n.split(".");
n=(a[1].length==1)?n+"0":n;
}
return n;
}
