﻿// GMAC Residential Funding Site Version 2 - JavaScript File
// Last updated: 2008-06-03 by Jeff Mongeon

/* Create random images at startup for French and English */
function getRandomNumber(startInt, endInt) 
{ 
    return startInt + Math.floor(Math.random()*(1+endInt-startInt));
}
var rdmNum = getRandomNumber(1,2);
if (document.getElementById('mainImgEn')) document.getElementById('mainImgEn').src = 'Images/en/home_lhs_photo' + rdmNum + '.jpg';
if (document.getElementById('mainImgFr')) document.getElementById('mainImgFr').src = 'images/fr/home_lhs_photo' + rdmNum + '.jpg';
if (document.getElementById('ctl00_menuImgB')) document.getElementById('ctl00_menuImgB').src = 'images/shared/menu_photo_b' + rdmNum + '.jpg';

/* Toggle showing a hidden object */
function toggleDiv(objID) {
    if (document.getElementById(objID)) {
        if (document.getElementById(objID).className == 'hidden_items') document.getElementById(objID).className = 'expanded_list';
        else document.getElementById(objID).className = 'hidden_items';
    }
}

/* function for switching the languages */
function changeLang(langID) {
    var concatType = '?';
    var loc = window.location + '';
    if (loc.indexOf('LangType=')) loc = loc.substring(0, loc.indexOf('LangType=')-1)  
    if (loc.indexOf('?') > -1) concatType = '&';
    window.location = loc + concatType + 'LangType=' + langID;
}

/* highlight the careers link if on the page */
var loc = window.location + '';
if (loc.indexOf('careers.aspx') > -1) document.getElementById('hlCareers').className = 'link_selected';

