// JavaScript Document

// Description:  Function that reloads the browser window in Netscape if window is resixed ('The Netscape Bug Fix')
// Author: Macromedia
//===========================================================
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


// Description:  Function that finds objects in the DOM
// Author: Macromedia
//===========================================================
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
} 

<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Description:  Function that show and hides layers
// Author: Macromedia
//===========================================================
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


// Description: Function that changes the class of active links
// Make sure you declare the variable in the page eg - var section = 'events'
// Author: Danielle Sheridan/Kevin Smith 29.04.2003
//===========================================================
function highlightSection() {
	var count = document.getElementsByTagName("A").length;
	for (i = 0 ; i < count ; i++) {
	if (document.getElementsByTagName("A")[i].id == section) {
	(document.getElementsByTagName("A")[i].style.color = brandcolour);
	(document.getElementsByTagName("A")[i].style.fontWeight = 'bold');
	(document.getElementsByTagName("A")[i].style.borderWidth = '1px');	
	(document.getElementsByTagName("A")[i].style.borderColor = '#ffffff');	
	(document.getElementsByTagName("A")[i].style.backgroundImage = 'none');}
	}
}


// Description:  Function that applies the brand colour to objects
// Author: Danielle Sheridan/Kevin Smith 02.05.2003
// Amended: For Mozilla compatibility - Danielle Sheridan 20.07.2005
//===========================================================
function applyBrandColour() {
	var elementsList = new Array('hr','h1','h2','ul');
	var elementCount = elementsList.length;
	for (e = 0 ; e < elementCount ; e++) {
	var count = document.getElementsByTagName(elementsList[e]).length;
	for (i = 0 ; i < count ; i++) {
	(document.getElementsByTagName(elementsList[e])[i].style.color = brandcolour);
	}
}
}


// Description: Function for changing the colour of TR tages when used as links
// Author: Danielle Sheridan
//===========================================================
function changeColour(id,colour) { 
	id.bgColor = colour;
}


// Description: Function for opening popup windows
// Author: Macromedia
//===========================================================
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}


// Description: Function for controlling JavaScript links
// Author: Macromedia
//===========================================================
function MM_goToURL() { 
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

// Description: Function for detecting plugins
// Author: Macromedia
//===========================================================
function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}

with (navigator) if (appName.indexOf('Microsoft')!=-1 && appVersion.indexOf('Mac')==-1) document.write(''+
'<scr'+'ipt language="VBScript">\nOn error resume next\n'+
'MM_dir = IsObject(CreateObject("SWCtl.SWCtl.1"))\n'+
'MM_flash = NOT IsNull(CreateObject("ShockwaveFlash.ShockwaveFlash"))\n</scr'+'ipt>');


// Description: Validates form entries
// Author: Macromedia
//===========================================================
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+'\n'; }
  } if (errors) alert('The following fields are mandatory:\n\n'+errors);
  document.MM_returnValue = (errors == '');
}


// Description: Handles graphical highlighting of field states
//Author: Danielle Sheridan - 30/09/03
//===========================================================
function FocusField(objID) {
	if(document.getElementById(objID).value==document.getElementById(objID).defaultValue) {
		document.getElementById(objID).value='';
		document.getElementById(objID).className='active'; }
}

function BlurField(objID,mandatory) {
   if(document.getElementById(objID).value==document.getElementById(objID).defaultValue) {
 		document.getElementById(objID).className='incomplete'; }

//	if(document.getElementById(objID).value==document.getElementById(objID).defaultValue  && mandatory == 'y') {
//		document.getElementById(objID).className='exclamation'; }
		
 	if(document.getElementById(objID).value==''  && mandatory == 'y') {
 		document.getElementById(objID).value=document.getElementById(objID).defaultValue;
 		document.getElementById(objID).className='mand'; }

 	if(document.getElementById(objID).value=='') {
 		document.getElementById(objID).value=document.getElementById(objID).defaultValue;
 		document.getElementById(objID).className='incomplete'; }
		
  	if(document.getElementById(objID).value != null && document.getElementById(objID).value != document.getElementById(objID).defaultValue) {
  		document.getElementById(objID).className='complete'; }				
}

// Description: Warns before deleting a record in admin pages
//Author: Danielle Sheridan - 02/10/03
//===========================================================
 function deleteWarning() 
 {
  event.returnValue="Are you sure you wish to make these changes?";
 }
 
// function for changing the class of an object
//Author: Danielle Sheridan - 15/07/05
//===========================================================
function changeClass(objID,newClass) { 
	blankClass = ''
		if (newClass == '') { 
			objID.className = blankClass;
		}
			else {
		objID.className = newClass;
		}
}
 
 
 // Description: Randomises homepage images -  ***** No longer in use *****
//Author: Danielle Sheridan - 06/07/05
//===========================================================
 
var homepageAd = new Array()
homepageAd[0] = 'assets/graphics/homepageAds/loansAd.jpg'
homepageAd[1] = 'assets/graphics/homepageAds/MontageAd.jpg'
homepageAd[2] = 'assets/graphics/homepageAds/homepageAd01.gif'

var homepageAdLink = new Array()
homepageAdLink[0] = 'pages.aspx?sid=6&id=41'
homepageAdLink[1] = 'pages.aspx?sid=7&id=49'
homepageAdLink[2] = '#'

var homepageAdAlt = new Array()
homepageAdAlt[0] = 'Learn more about NetFinance Loans'
homepageAdAlt[1] = 'Discover NetFinance Montage' 
homepageAdAlt[2] = 'Testimonials campaign'

var p = homepageAd.length;
var preLoad = new Array()
for (i = 0; i < p; i++){
	 preLoad[i] = new Image()
	 preLoad[i].src = homepageAd[i]
}

var whichAd = Math.round(Math.random()*(p-1));

function showImage(){
document.write('<a href="'+homepageAdLink[whichAd]+'"><img src="'+homepageAd[whichAd]+'" alt="'+homepageAdAlt[whichAd]+'" width="755" height="204" id="mainimage" border="0"></a>');		}


// Description: Handles main menu system
//Author: Macromedia
//===========================================================
 
var menuYmin = 70;
var menuYmax = 140;

//menu constructor
	function menu(allitems,thisitem,startstate){ 
	callname= "gl"+thisitem;
	divname="subglobal"+thisitem;
	this.numberofmenuitems = numberofmenuitems;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.display = startstate;
}

//menu methods
function ehandler(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
    var shutdiv =eval( "menuitem"+i+".thediv");
    shutdiv.style.display="none";
  }
  theobj.thediv.style.display="block";
}
				
function closesubnav(event){
  if ((event.clientY < menuYmin)||(event.clientY > menuYmax)){
    for (var i=1; i<= numberofmenuitems; i++){
      var shutdiv =eval('menuitem'+i+'.thediv');
      shutdiv.style.display='none';
    }
  }
}

//Description: Grabs the page URL and sets value to a hidden field for Send to a Friend messages
//Author: Danielle Sheridan - 15/09/05
//===========================================================

function setDocumentURL(url) {
		document.getElementById(url).value=document.URL;
}

// END OF IE INTERNAL SCRIPTS


// Description: Required for Hemscott Investor Pages
//Author: Hemscott
//===========================================================
function pageSpecificOnload(){
 var hereforpagespecific;
}

function validateInput() {
	if (document.IR_ALERT.email.value == '') {
		alert('Please enter your email adddress.');
		document.IR_ALERT.email.focus();
		return false;}
	
	if (document.IR_ALERT.firstname.value == '') {
		alert('Please enter your first name.');
		document.IR_ALERT.firstname.focus();
		return false;}
	
	if (document.IR_ALERT.surname.value == '') {
		alert('Please enter your surname.');
		document.IR_ALERT.surname.focus();
		return false;}
	
	return true;
}

if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,7) ) { 
includeHemscott = "<iframe id=\"emailalerts\" style=\"padding: 10px; position: relative; margin: -10px 0 0 0; width:100%\" height=\"790\" scrolling=\"no\" src=\"http://www.hemscott.com/scripts/IRAlert.dll/register?coy_id=03114\" frameborder=\"0\"></iframe>";
}

else if (navigator.appName == "Netscape") { 
includeHemscott = "<layer style=\"position:relative; visibility:visible;\" id=\"emailalerts\" width=\"100%\" height=\"820\" src=\"http://www.hemscott.com/scripts/IRAlert.dll/register?coy_id=03114\"></layer>";
}

else if (document.all) { 
includeHemscott = "<iframe id=\"emailalerts\" style=\"position: relative; margin: -10px 0 0 0; height:820px; width:100%\" scrolling=\"no\" src=\"http://www.hemscott.com/scripts/IRAlert.dll/register?coy_id=03114\" frameborder=\"0\"></iframe>";
}


// End Hemscott specific scripts
//===========================================================