/* DBS Personal Script */
$(document).ready(function() {

 //if ($("#sidebar").length && $("#sidebar").parent().attr("class")!="ms-WPBody") loadLeftNav();

  
  /* BOF stock feed added by Germs on 10/11/2010 */
	if (document.getElementById('dbsshareticker') || document.getElementById('investor_dbsshareticker')) {
		updtIndex();
		setInterval("updtIndex()", 300000);
	}
	/* EOF stock feed */
    
    /* DBS Group Tabs */
	/*  if(document.getElementById('divTab1') != null) {
        $('#divTab1').css('display', 'block');
    }
    if(document.getElementById('divTab2') != null) {
        $('#divTab2').css('display', 'none');
    }
    if(document.getElementById('divTab3') != null) {
        $('#divTab3').css('display', 'none');
    }
    if(document.getElementById('divTab4') != null) {
        $('#divTab4').css('display', 'none');
    }*/
	
	   if(document.getElementById('divNav1') != null) {
        $('#divNav1').css('display', 'block');
    }
    if(document.getElementById('divNav2') != null) {
        $('#divNav2').css('display', 'none');
    }
    if(document.getElementById('divNav3') != null) {
        $('#divNav3').css('display', 'none');
    }
    if(document.getElementById('divNav4') != null) {
        $('#divNav4').css('display', 'none');
    }
	DBSGroupCreditRatingInit();
		$('#bodyareaframe_content tbody tr').children('td:first').siblings('td:last').addClass('last_sidebar');
	
	
    DBSGroupTabsInit();
   // openLeftNav();
	/* DBS Group Tabs */
	
	/* Career Graduate Candidate Pie Chart - Start */
	
	$('#map1')
	.click(function() { showhide('div1'); })
	.mouseover(function() { $('#pie').attr("src", "/common/img/dbsgroup/leadership_hover.jpg"); })
	.mouseout(function() { mouseOut(); });
	$('#map2')
	.click(function() { showhide('div2'); })
	.mouseover(function() { $('#pie').attr("src", "/common/img/dbsgroup/customer_focus.jpg"); })
	.mouseout(function() { mouseOut(); });
	$('#map3')
	.click(function() { showhide('div3'); })
	.mouseover(function() { $('#pie').attr("src", "/common/img/dbsgroup/decisiveness_results_focus.jpg"); })
	.mouseout(function() { mouseOut(); });
	$('#map4')
	.click(function() { showhide('div4'); })
	.mouseover(function() { $('#pie').attr("src", "/common/img/dbsgroup/innovation_and_change.jpg"); })
	.mouseout(function() { mouseOut(); });
	$('#map5')
	.click(function() { showhide('div5'); })
	.mouseover(function() { $('#pie').attr("src", "/common/img/dbsgroup/organizational_capability.jpg"); })
	.mouseout(function() { mouseOut(); });
	$('#map6')
	.click(function() { showhide('div6'); })
	.mouseover(function() { $('#pie').attr("src", "/common/img/dbsgroup/personal_effectiveness.jpg"); })
	.mouseout(function() { mouseOut(); });
	
	function mouseOut() {
		$("#pie").attr("src", "/common/img/dbsgroup/"+state);
	}
	
	/* Career Graduate Candidate Pie Chart - End */
	
});







var mapDiv = "global_office_image";
var markerImg = "/common/img/dbsgroup/map_marker.png";
var officeXml = "/globaloffices/globaloffice.xml"

var officeListElement = '<div class="global_office_item"><a class="branchname" href="#" onclick="showMap(\'branch\', \'elem0\'); return false;">elem1</a>elem2</div>';

var map;
var mapOptions;
var mapXml;
var infoWindow;

var markerArr;

//default value
var currentType = "country";
var currentId = "singapore";

/*
 * MAIN FUNCTION
 */
 
function showMap(type, id)
{
	if (type == "country")
	{
		currentType = type;
		currentId = id;
		
		window.location = "#"+id;
		
		$('#global_office_links ul li a').removeClass('selected');
		$('#country_'+id).addClass('selected');
		
		loadXml();
	}
	if (type == "branch")
	{
		onMarkerClick(id);
	}
}


/*
 * INIT MAP FUNCTIONS
 */
 
function loadScript() 
{
	var script = document.createElement("script");
	script.type = "text/javascript";
	script.src = "http://maps.google.com/maps/api/js?sensor=false&region=SG&callback=initialize";
	document.body.appendChild(script);
}

function initialize() {
	
	var zoom = parseInt($(mapXml).find('country[id=' + currentId + ']').attr('zoom'));
	var lat = $(mapXml).find('country[id=' + currentId + ']').attr('lat');
	var lng = $(mapXml).find('country[id=' + currentId + ']').attr('lng');
	
	var newMap = new google.maps.LatLng(lat, lng);
	
	mapOptions = {
		zoom: zoom, center: newMap, mapTypeId: google.maps.MapTypeId.ROADMAP,
		mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
		navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
		streetViewControl: false
	}
	
	$("#"+mapDiv).addClass("mapOn");
	map = new google.maps.Map(document.getElementById(mapDiv), mapOptions);							
	
	populateMarkers();
	
	//google.maps.event.addListener(map, 'zoom_changed', function(){setTimeout(onMapZoomChanged,100)} );
	
}


/*
 * MARKERS
 */
function populateMarkers(){
	markerArr 	= new Array();
	
	$('#global_office_list').html('');
	
	var country = $(mapXml).find('country[id=' + currentId + ']').attr('name');
	$('#global_office_list').append('<div class="global_office_country" >' + country + '</div>');
	
	// set marker image
  var image = new google.maps.MarkerImage(markerImg,
      new google.maps.Size(23, 23),
      new google.maps.Point(0,0),
      new google.maps.Point(11, 11)
	);
		
	$(mapXml).find('branch[countryId=' + currentId + ']').each(function(index){
		//populate marker
		var latlng = new google.maps.LatLng(parseFloat($(this).attr('lat')), parseFloat($(this).attr('lng')));
		var title = $(this).attr('name');
		var marker = new google.maps.Marker( {position: latlng, map:map, title:title, icon:image} );
		var id = $(this).attr('id');
		markerArr.push([id, marker]);
		
		// marker event listener
		google.maps.event.addListener( marker , "click", function(){ onMarkerClick(id);  } );
		
		//populate office list
		var branchName = $(this).find('branchname').text();
		var leftInfo = $(this).find('leftinfo').text();
		var rightInfo = $(this).find('rightinfo').text();
		
		var officeItem = officeListElement
		officeItem = officeItem.replace(/elem0/g, id);
		officeItem = officeItem.replace(/elem1/g, branchName);
		officeItem = officeItem.replace(/elem2/g, leftInfo + '<br>' + rightInfo);
		
		if (index%2 == 1)
		{
			officeItem = officeItem.replace(/global_office_item/g, "global_office_item right");
		}
		
		$('#global_office_list').append(officeItem);
	});
	
}

function onMarkerClick(id){
	makeInfoWindow(id);
}


/*
 * INFO WINDOWS
 */

function makeInfoWindow(id){
	// change the zoom level if the zoom level difference is too many
	if (map.getZoom() < parseInt($(mapXml).find('branch[id='+id+']').attr('zoom')) - 5)
	{
		map.setCenter(new google.maps.LatLng(parseFloat($(mapXml).find('branch[id='+id+']').attr('lat')), parseFloat($(mapXml).find('branch[id='+id+']').attr('lng'))))
		map.setZoom(parseInt($(mapXml).find('branch[id='+id+']').attr('zoom')));
	}
	
	//generate info window
	var infowindowOptions = { content: prepareInfoWindowContent(id) };
	var infowindow = new google.maps.InfoWindow(infowindowOptions);
	infowindow.set("isdomready", false);
	$.each(markerArr, function(index, value){
		if(value[0] == id)
		{
			infowindow.open( map, value[1]);
		}
	});
	setInfowindow(infowindow);
	
	// On Dom Ready
	google.maps.event.addListener(infowindow, 'domready', function () {
		if (infowindow.get("isdomready")) {
			// show the infowindow by setting css 
			//jQuery('.gmapPopup').css('visibility', 'visible');
		}
		else 
		{
			// trigger a domready event again.
			google.maps.event.trigger(infowindow, 'content_changed');
			infowindow.set("isdomready", true);
		}
	});
	
}

function setInfowindow(newInfowindow) {
  if (infoWindow != undefined) {
	infoWindow.close();
  }
  infoWindow = newInfowindow;
}
			
function prepareInfoWindowContent(id){
	var countryId = $(mapXml).find('branch[id=' + id + ']').attr('countryId');
	var country = $(mapXml).find('country[id=' + countryId + ']').attr('name');
	var branchName = $(mapXml).find('branch[id=' + id + ']').find('branchname').text();
	var leftInfo = $(mapXml).find('branch[id=' + id + ']').find('leftinfo').text();
	var rightInfo = $(mapXml).find('branch[id=' + id + ']').find('rightinfo').text();
	
	htmlString =
		'<div class="gmapPopup">' + 
		'<strong class="head" >' + country + '</strong>' +
		'<table><tr>' +
		'<td class="first">' + branchName + '<br>' + leftInfo + '</td>' +
		'<td>' + rightInfo + '</td>' +
		'</tr></table>' +
		'</div>';
	
	return htmlString;
}


/*
 * XML
 */
 
function loadXml()
{
	var date = new Date();
	if (mapXml == null)
	{
		$.ajax({
			type: "GET",
			url: officeXml + "?"+date.getTime(),
			//url: officeXml,
			//data: "",
			dataType :($.browser.msie) ? "text" : "xml",
			success: parseXml
		});
	}
	else
	{
		loadScript();
	}
}

function parseXml(xml)
{
	if ( $.browser.msie ) {
	mapXml = new ActiveXObject("Microsoft.XMLDOM");
	mapXml.async = false;
	mapXml.loadXML(xml);
	} else {
	mapXml = xml;
	}
	//mapXml = xml;
	loadScript();
}


/*
 * DEEP LINKING
 */
 
//$(window).load(function() {
$(document).ready(function() {
	var location = window.location.hash;
	if (location.length == 0) return false;
	
	var countryId = location.replace("#", "");
	
	showMap("country", countryId);
});


/* Left navigation */
function showSelectedLink(type, id)
{
	if (type == "leftnav")
	{
		currentType = type;
		currentId = id;
		
		window.location = "#"+id;
		
		$('#left_sidebar_links ul li a').removeClass('selected');
		$(id).addClass('selected');
	}
}
/*End Left navigation */


/* Go to page button*/

function gotoPagePersonal() {
    var el2 = document.getElementById('personal');
    selected = el2.options [el2.selectedIndex];
    if ((selected.value=='') || (selected.value=='Select one...')) {
        el2.style.backgroundColor = '#FFFFDD';
        alert('Please select a product to proceed.');
    } else {
        this.top.location.href = selected.value; // to fix iframe problem, permanently
    }
}

function gotoPageCapitalMarkets() {
    var el2 = document.getElementById('DDLcapital');
    selected = el2.options [el2.selectedIndex];
    if ((selected.value=='') || (selected.value=='Select one...')) {
        el2.style.backgroundColor = '#FFFFDD';
        alert('Please select a product to proceed.');
    } else {
        this.top.location.href = selected.value; // to fix iframe problem, permanently
    }
}

function gotoPageTreasures() {
    var el3 = document.getElementById('treasures');
    selected = el3.options [el3.selectedIndex];
    if ((selected.value=='') || (selected.value=='Select one...')) {
        el3.style.backgroundColor = '#FFFFDD';
        alert('Please select a product to proceed.');
    } else {
        this.top.location.href = selected.value; // to fix iframe problem, permanently
    }
}

function gotoPageInstitutional() {
    var el4 = document.getElementById('institutional');
    selected = el4.options [el4.selectedIndex];
    if ((selected.value=='') || (selected.value=='Select one...')) {
        el4.style.backgroundColor = '#FFFFDD';
        alert('Please select a product to proceed.');
    } else {
        this.top.location.href = selected.value; // to fix iframe problem, permanently
    }
}

function gotoPageTreasurey() {
    var el4 = document.getElementById('Treasurey');
    selected = el4.options [el4.selectedIndex];
    if ((selected.value=='') || (selected.value=='Select one...')) {
        el4.style.backgroundColor = '#FFFFDD';
        alert('Please select a product to proceed.');
    } else {
        this.top.location.href = selected.value; // to fix iframe problem, permanently
    }
}

function gotoPageDividend() {
    var el4 = document.getElementById('dividendHistSelection');
    selected = el4.options [el4.selectedIndex];
    if ((selected.value=='') || (selected.value=='Select Year')) {
        el4.style.backgroundColor = '#FFFFDD';
        alert('Please select year to proceed.');
    } else {
        this.top.location.href = selected.value; // to fix iframe problem, permanently
    }	
}

function gotoPage() {
    var el4 = document.getElementById('countrySelection');
    selected = el4.options [el4.selectedIndex];
    if ((selected.value=='') || (selected.value=='Select one...')) {
        el4.style.backgroundColor = '#FFFFDD';
        alert('Please select a product to proceed.');
    } else {
        this.top.location.href = selected.value; // to fix iframe problem, permanently
    }
}
/* End Go to page button */


/*  Career Graduate Candidate Pie Chart - Start */
var state = 'leadership_hover.jpg';
	function showhide(layer_ref) {
		
		switch(layer_ref) {
		  case 'div1':
		  state = "leadership_hover.jpg";
		  break;
		  case 'div2':
		  state = "customer_focus.jpg";
		  break;
		  case 'div3':
		  state = "decisiveness_results_focus.jpg";
		  break;
		  case 'div4':
		  state = "innovation_and_change.jpg";
		  break;
		  case 'div5':
		  state = "organizational_capability.jpg";
		  break;
		  case 'div6':
		  state = "personal_effectiveness.jpg";
		  break;
		  default:
		  state = "leadership_hover.jpg";
		  break;
		}
	  
	  $('#div1').css("display", "none");
	  $('#div2').css("display", "none");
	  $('#div3').css("display", "none");
	  $('#div4').css("display", "none");
	  $('#div5').css("display", "none");
	  $('#div6').css("display", "none");
	  
	  $('#'+layer_ref).css("display", "block");
	}
	/* Career Graduate Candidate Pie Chart - End */
	
function DBSGroupTabsInit()
{
    if(document.getElementById('content5') != null)
    {
        for(var i=0; i<document.getElementById('content5').childNodes.length; i++)
        {
            var className = '';
            if(document.getElementById('content5').childNodes[i].className != null)
            {
                className = document.getElementById('content5').childNodes[i].className;
            }
            var pos=className.indexOf("content_tab");
            if (pos>=0)
            {
                $(".tab").click(function() {
                    var currentTab = $(this);
                    var checkElement = null;
                    switch(currentTab.attr('id'))
                    {
                        case 'jsTab1': checkElement = $('#divTab1');break;
                        case 'jsTab2': checkElement = $('#divTab2');break;
                        case 'jsTab3': checkElement = $('#divTab3');break;
                        case 'jsTab4': checkElement = $('#divTab4');break;
                    }
                    if((currentTab.is('.tab')) && !(checkElement.css("display") == 'none'))
                    {
                        return false;
                    }
                    if((currentTab.is('.tab')) && (checkElement.css("display") == 'none') && $('.tab_content:visible').size() == 1)
                    {
                        $('.tab:visible').removeClass('tab_on');
                        $('.tab:visible').addClass('tab_off');
                        $('.link_selector').removeClass('tab_off');
                        currentTab.removeClass('tab_off');
                        currentTab.addClass('tab_on');
                        $('.tab_content').css('display', 'none');
                        checkElement.css('display', 'block');
                        return false;
                    }
                });
            }
        }
    }
}


function DBSGroupCreditRatingInit()

{

    if(document.getElementById('pnlCreditRating') != null)

    {

        for(var i=0; i<document.getElementById('pnlCreditRating').childNodes.length; i++)

        {

            var className = '';

            if(document.getElementById('pnlCreditRating').childNodes[i].className != null)

            {

                className = document.getElementById('pnlCreditRating').childNodes[i].className;

            }

            var pos=className.indexOf("content_creditRating");

            if (pos>=0)

            {

				/*==*/
				$('[id*="jsNav"]').click(function(e){
					var tagId = $(this).attr('id');
					var id = tagId.replace('jsNav', '');
					
					updateCreditRatingNav(id);
					return false;
				});
				
				$('#jsPrev').click(function(){
					$(this).parents('#pnlCreditRating').find('[id*=divNav]').each(function(){
						if ($(this).css('display') != 'none'){
							var tagId = $(this).attr('id');
							var id = tagId.replace('divNav', '');
							var newId = parseInt(id, 10);
							if (newId != 1) {
								newId -= 1;
							}
							updateCreditRatingNav(newId);
							return false;
						}
					});
					return false;
				});
				
				$('#jsNext').click(function(){
					$(this).parents('#pnlCreditRating').find('[id*=divNav]').each(function(){
						if ($(this).css('display') != 'none'){
							var tagId = $(this).attr('id');
							var id = tagId.replace('divNav', '');
							var newId = parseInt(id, 10);
							if (newId != 3) {
								newId += 1;
							}
							updateCreditRatingNav(newId);
							return false;
						}
					});
					return false;
				});
				/*==*/
				
            }

        }

    }

}

function updateCreditRatingNav(id)
{
	var contentToShow = "#divNav" + id;
	var navToShow = "#jsNav" + id;
					
	$('[id*=divNav]').hide();
	$('[id*=jsNav]').addClass('nav_off').removeClass('nav_on');
	$('#jsPrev').addClass('nav_off');
	$('#jsNext').addClass('nav_off');
	$(contentToShow).show();
	$(navToShow).addClass('nav_on');
	
	if (id == 1) {
		$('#jsPrev').removeClass('nav_off').addClass('nav_on');
	}
					
	if (id == 3) {
		$('#jsNext').removeClass('nav_off').addClass('nav_on');
	}
}

/* Left nav look up xml script */
function openLeftNav() {

    var urlstring = window.location.toString();
    var afterdomain = urlstring.split("dbs.com/");
    var folders = afterdomain[1].split("/");
    var match = false;
    var pathtoxml = "";
    var ref_url = "";
    var leftnav = "";
    var highlight = "";
	
    if (folders[0] == "about" && folders[1] == "management") pathtoxml = "/about/management/";
	
    if (folders[0] == "careers" && folders[1] == "graduates") pathtoxml = "/careers/graduates/";
	
    if (folders[0] == "careers" && folders[1] == "joindbs") pathtoxml = "/careers/joindbs/";
	
	if (folders[0] == "careers" && folders[1] == "undergraduates") pathtoxml = "/careers/undergraduates/";
	
	if (folders[0] == "community") pathtoxml = "/community/img/";
	
	
    if (pathtoxml != "") {
	
        $.get(pathtoxml+"leftnav.xml", null, function(lnlist) {
	
            $(lnlist).find("nav_entry").each( function() {
	
                ref_url = $(this).attr("url").toString();
                leftnav = $(this).attr("leftnav").toString();
                highlight = $(this).attr("highlight").toString();
				
                //compare url to xml table
                if (urlstring.indexOf(ref_url)!=-1) {
					
                    //bold selected links if applicable
                    if (highlight != "none") {
                        /*$("#"+highlight).css("font-weight","bold");
                        $("#"+highlight).css("color", "#660000");*/
						$("#"+highlight).addClass('selected');
                    }
				
                    //alert("hit! :" + leftnav);
                    if (leftnav != "none") {
                        $("#"+leftnav).trigger("click");
                        match = true;
                        return false;
                    }
                }
				
            });
			
            if (!match) {

                //close all
                $(".contentList").each(function () {
                   // $(this).hide();
                   // $(this).prev().removeClass('exp');
                   // $(this).prev().addClass('con');
                });
            }// end if (!match)
			
        });
	
    } //end if (pathtoxml != "")

}
/* EOF Left nav look up xml script */


/* BOF stock feed added by Germs on 10/11/2010 */
function updtIndex() {
	$.ajax({
		type: "GET",
		url: "http://www.dbs.com/_layouts/StockFeed/StockFeed.xml?" + new Date().getTime(),
		//url: "http://www.dbs.com/_layouts/StockFeed/StockFeed.xml",
		//url: "http://cms2.1bank.dbs.com/home2/img/StockFeed.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('pricefeed').each(function(){
				var dataDateTime = $(this).find('dataDateTime').text();
				var date = dataDateTime.substr(0,10);
				var time = dataDateTime.substr(11);
				var lastvalue = $(this).find('last').text();
				var change = $(this).find('change').text();
				var tickDirection = $(this).find('tickDirection').text();
				tickDirection = ((tickDirection == 'up') || (tickDirection == 'down')) ? tickDirection : 'unchanged';
				$('#dbsshareticker').empty();
				$('#dbsshareticker').append('<strong> SGD'+lastvalue+'  <span class="' + tickDirection + '">(<img src="/common/img/dbsgroup/share-'+tickDirection+'.gif"  align="baseline" id="tickDirection" /> '+change+')</span></strong> as at '+time+' +08:00 GMT on '+date);
				
				$('#investor_dbsshareticker').empty();
				$('#investor_dbsshareticker').append('<strong>DBS Share Price<br> SGD ' + lastvalue + ' <span class="' + tickDirection + '">(<img src="/common/img/dbsgroup/share-' + tickDirection + '.gif"  align="baseline" id="tickDirection" /> ' + change+ ')</span></strong>  <br><br>as at ' + time + ' +08:00 GMT on ' + date);
			});
		}
	});
}
/* EOF stock feed */

function loadUrl(val) {

  if (!val) return false;   

  var target = (val.substr(0,1)=='0') ? '_self' : '_blank';

  var url = val.substr(1);

  window.open(url, target);

}

/* BOF Financial Calendar */
$(window).load(function(){
	if ( $('#financialCalendarBody') ) {
		$.ajax({
			url: "/investor/financialcalendar/calendar.html",
			success: function(data) {
				var htmlData = '';
				$(data).find('tr.show').each(function() {
					var calendarItem = '<p><strong>@date@</strong><br>@title@</p>';
					var date = $(this).find('.date').html();
					var title = $(this).find('.title').html();
					calendarItem = calendarItem.replace(/@date@/, date);
					calendarItem = calendarItem.replace(/@title@/, title);
					htmlData += calendarItem;
				});
				
				$('#financialCalendarBody p').remove();
				$('#financialCalendarBody').prepend(htmlData);
			}
		});
	}
	
});
/* EOF Financial Calendar */

/* BOF Quarterly Performance */
$(window).load(function(){
	if ( $('#quarterlyPerformance') ) {
		$.ajax({
			url: "/investor/quarterlyresults/index_content.html",
			success: function(data) {
				var htmlData = '';
				$(data).find('div[id^="divTab"]').each(function() {
					
					var divTab = '<div id="@id@" class="tab_content" @style@>@content@</div>';
					var id = $(this).attr('id');
					var content = $(this).html();
					var style = '';
					if (id != 'divTab1') {
						style = 'style="display:none;"';
					}
					
					divTab = divTab.replace(/@id@/, id);
					divTab = divTab.replace(/@style@/, style);
					divTab = divTab.replace(/@content@/, content);
					htmlData += divTab;
				});
				
				$('#quarterlyPerformance').prepend(htmlData);
			}
		});
	}
	
});
/* EOF Quarterly Performance */


/* BOF Newsroom Feed */
$(document).ready(function(){
	var newsCounter = 0;
	$('.newsroom_landing_list tbody tr td').children('table').each(function(index){
		newsCounter++;
		if (newsCounter>3) {
			$(this).closest('tr').hide();
		}
	});
	
	if ( $('#sidebar_announcement_content') || $('#newsContent') ) {
		$.ajax({
			type: "GET",
			url: "/newsroom/NewsroomRSS/DBS_News_Singapore.rss",
			//url: "/home/img/DBS_News_Latest.xml",
			//url: "/newsroom/NewsroomRSS/DBS_News_Latest.rss",
			
			// rss structure is working on jQuery 1.5+
			//dataType: "xml",
			
			// jQuery 1.4.2
			dataType: "text",
						
			error: function(a, b, c) {
				//console.log(a,b,c);
			},
			success: function(data) {
				newsArray = getItems(data);				
				newsToShow = 5;
				
				if (newsArray.length < 5) {
					//console.log(newsArray.length);
					newsToShow = newsArray.length;
				}
				
				$('#rssDate').text(newsArray[0][2]);
				$('#rssContent').text(newsArray[0][0]);
				$('#rssLink').attr('href', newsArray[0][1]);
				
				var news = '';
				for (i=0; i<newsToShow; i++) {
					style = "";
					if (news.length != 0) {	
						style = 'style="display:none;"';
					}			
					var htmlNews = '<a href="@link@" @style@>(@date@) @title@</a>';
					htmlNews = htmlNews.replace('@date@', newsArray[i][2]);
					htmlNews = htmlNews.replace('@link@', newsArray[i][1]);
					htmlNews = htmlNews.replace('@style@', style);
					htmlNews = htmlNews.replace('@title@', truncate(newsArray[i][0], 130));
					news += htmlNews;
				}
				$('#newsContent a').remove();
				$('#newsContent').append(news);
				
			}
		});
	}
	
});

function truncate(text, length) {
	if (text.length > length) {
		text = text.substring(0, length);
		text = text.replace(/\w+$/, '');
		text += '...';
	}
	return text;
}

function getItems(data) {
	var dataArray = data.split('<item>');
	var item;
	var itemsArray = new Array();
	
	for (i=1; i< dataArray.length; i++) {
		item = ""+dataArray[i];
		item = item.split('</item>',1);
		itemsArray[i-1] = [getItemData(item[0], 'title'), getItemData(item[0], 'link'), getItemData(item[0], 'pubDate')];
	}
	return itemsArray;
}

function getItemData(data, type){
	newData1 = data.split('</'+type+'>',1);
	newData2 = newData1[0].split('<'+type+'>',2);
	return newData2[1];
}
/* EOF Newsroom Feed */


//Careers Carousel July 2011
/*!
 * Feature Carousel, Version 1.2.1
 * http://www.bkosolutions.com
 *
 * Copyright 2011 Brian Osborne
 * Licensed under GPL version 3
 * brian@bkosborne.com
 *
 * http://www.gnu.org/licenses/gpl.txt
 */
(function($) {

  $.fn.featureCarousel = function (options) {

    // override the default options with user defined options
    options = $.extend({}, $.fn.featureCarousel.defaults, options || {});

    return $(this).each(function () {

      /* These are univeral values that are used throughout the plugin. Do not modify them
       * unless you know what you're doing. Most of them feed off the options
       * so most customization can be achieved by modifying the options values */
      var pluginData = {
        currentCenterNum:     options.startingFeature,
        containerWidth:       0,
        containerHeight:      0,
        largeFeatureWidth:    0,
        largeFeatureHeight:   0,
        smallFeatureWidth:    0,
        smallFeatureHeight:   0,
        totalFeatureCount:    $(this).children("div").length,
        currentlyMoving:      false,
        featuresContainer:    $(this),
        featuresArray:        [],
        containerIDTag:       "#"+$(this).attr("id"),
        timeoutVar:           null,
        rotationsRemaining:   0,
        itemsToAnimate:       0,
        borderWidth:			    0
      };

      preload(function () {
      	setupFeatureDimensions();
        setupCarousel();
        setupFeaturePositions();
        setupTrackers();
        initiateMove(true,1);
      });
	  
      /**
       * Function to preload the images in the carousel if desired.
       * This is not recommended if there are a lot of images in the carousel because
       * it may take a while. Functionality does not depend on preloading the images
       */
      function preload(callback) {
        // user may not want to preload images
        if (options.preload == true) {
          var $imageElements = pluginData.featuresContainer.find("img");
          var loadedImages = 0;
          var totalImages = $imageElements.length;

          $imageElements.each(function () {
            // Attempt to load the images
            $(this).load(function () {
              // Add to number of images loaded and see if they are all done yet
              loadedImages++;
              if (loadedImages == totalImages) {
                // All done, perform callback
                callback();
              }
            });
            // The images may already be cached in the browser, in which case they
            // would have a 'true' complete value and the load callback would never be
            // fired. This will fire it manually.

            if (this.complete || $.browser.msie) {
              $(this).trigger('load');
            }
          });
        } else {
          // if user doesn't want preloader, then just go right to callback
          callback();
        }
      }

      // Gets the feature container based on the number
      function getContainer(featureNum) {
        return pluginData.featuresArray[featureNum-1];
      }

      // get a feature given it's set position (the position that doesn't change)
      function getBySetPos(position) {
        $.each(pluginData.featuresArray, function () {
          if ($(this).data().setPosition == position)
            return $(this);
        });
      }

      // get previous feature number
      function getPreviousNum(num) {
        if ((num - 1) == 0) {
          return pluginData.totalFeatureCount;
        } else {
          return num - 1;
        }
      }

      // get next feature number
      function getNextNum(num) {
        if ((num + 1) > pluginData.totalFeatureCount) {
          return 1;
        } else {
          return num + 1;
        }
      }

      /**
       * Because there are several options the user can set for the width and height
       * of the feature images, this function is used to determine which options were set
       * and to set the appropriate dimensions used for a small and large feature
       */
      function setupFeatureDimensions() {
        // Set the height and width of the entire carousel container
        pluginData.containerWidth = pluginData.featuresContainer.width();
        pluginData.containerHeight = pluginData.featuresContainer.height();

        // Grab the first image for reference
        var $firstFeatureImage = $(pluginData.containerIDTag).find(".carousel-image:first");

        // Large Feature Width
        if (options.largeFeatureWidth > 1)
          pluginData.largeFeatureWidth = options.largeFeatureWidth;
        else if (options.largeFeatureWidth > 0 && options.largeFeatureWidth < 1)
          pluginData.largeFeatureWidth = $firstFeatureImage.width() * options.largeFeatureWidth;
        else
          pluginData.largeFeatureWidth = $firstFeatureImage.outerWidth();
        // Large Feature Height
        if (options.largeFeatureHeight > 1)
          pluginData.largeFeatureHeight = options.largeFeatureHeight;
        else if (options.largeFeatureHeight > 0 && options.largeFeatureHeight < 1)
          pluginData.largeFeatureHeight = $firstFeatureImage.height() * options.largeFeatureHeight;
        else
          pluginData.largeFeatureHeight = $firstFeatureImage.outerHeight();
        // Small Feature Width
        if (options.smallFeatureWidth > 1)
          pluginData.smallFeatureWidth = options.smallFeatureWidth;
        else if (options.smallFeatureWidth > 0 && options.smallFeatureWidth < 1)
          pluginData.smallFeatureWidth = $firstFeatureImage.width() * options.smallFeatureWidth;
        else
          pluginData.smallFeatureWidth = $firstFeatureImage.outerWidth() / 2;
        // Small Feature Height
        if (options.smallFeatureHeight > 1)
          pluginData.smallFeatureHeight = options.smallFeatureHeight;
        else if (options.smallFeatureHeight > 0 && options.smallFeatureHeight < 1)
          pluginData.smallFeatureHeight = $firstFeatureImage.height() * options.smallFeatureHeight;
        else
          pluginData.smallFeatureHeight = $firstFeatureImage.outerHeight() / 2;
      }

      /**
       * Function to take care of setting up various aspects of the carousel,
       * most importantly the default positions for the features
       */
      function setupCarousel() {
        // Set the total feature count to the amount the user wanted to cutoff
        if (options.displayCutoff > 0 && options.displayCutoff < pluginData.totalFeatureCount) {
          pluginData.totalFeatureCount = options.displayCutoff;
        }

        // fill in the features array
        pluginData.featuresContainer.find(".carousel-feature").each(function (index) {
          if (index < pluginData.totalFeatureCount) {
            pluginData.featuresArray[index] = $(this);
          }
        });

        // Determine the total border width around the feature if there is one
        if (pluginData.featuresContainer.find(".carousel-feature").first().css("borderLeftWidth") != "medium") {
          pluginData.borderWidth = parseInt(pluginData.featuresContainer.find(".carousel-feature").first().css("borderLeftWidth"))*2;
        }

        // Place all the features in a center hidden position to start off
        pluginData.featuresContainer
          // Have to make the container relative positioning
          .find(".carousel-feature").each(function () {
            // Center all the features in the middle and hide them
            $(this).css({
              'left': (pluginData.containerWidth / 2) - (pluginData.smallFeatureWidth / 2) - (pluginData.borderWidth / 2),
              'width': pluginData.smallFeatureWidth,
              'height': pluginData.smallFeatureHeight,
              'top': options.smallFeatureOffset + options.topPadding,
              'opacity': 0
            });
          })
          // Set all the images to small feature size
          .find(".carousel-image").css({
            'width': pluginData.smallFeatureWidth
          });
          
        // set position to relative of captions if displaying below image
        if (options.captionBelow) {
          pluginData.featuresContainer.find('.carousel-caption').css('position','relative');
        }

        // figure out number of items that will rotate each time
        if (pluginData.totalFeatureCount < 4) {
          pluginData.itemsToAnimate = pluginData.totalFeatureCount;
        } else {
          pluginData.itemsToAnimate = 4;
        }

        // Hide story info and set the proper positioning
        pluginData.featuresContainer.find(".carousel-caption")
          .hide();
      }

      /**
       * Here all the position data is set for the features.
       * This is an important part of the carousel to keep track of where
       * each feature within the carousel is
       */
      function setupFeaturePositions() {
        // give all features a set number that won't change so they remember their
        // original order
        $.each(pluginData.featuresArray, function (i) {
          $(this).data('setPosition',i+1);
        });

        // Go back one - This is done because we call the move function right away, which
        // shifts everything to the right. So we set the current center back one, so that
        // it displays in the center when that happens
        var oneBeforeStarting = getPreviousNum(options.startingFeature);
        pluginData.currentCenterNum = oneBeforeStarting;

        // Center feature will be position 1
        var $centerFeature = getContainer(oneBeforeStarting);
        $centerFeature.data('position',1);

        // Everything before that center feature...
        var $prevFeatures = $centerFeature.prevAll();
        $prevFeatures.each(function (i) {
          $(this).data('position',(pluginData.totalFeatureCount - i));
        });

        // And everything after that center feature...
        var $nextFeatures = $centerFeature.nextAll();
        $nextFeatures.each(function (i) {
          if ($(this).data('setPosition') != undefined) {
            $(this).data('position',(i + 2));
          }
        });

        // if the counter style is for including number tags in description...
        if (options.counterStyle == 'caption') {
          $.each(pluginData.featuresArray, function () {
            var pos = getPreviousNum($(this).data('position'));
            var $numberTag = $("<span></span>");
            $numberTag.addClass("numberTag");
            $numberTag.html("("+ pos + " of " + pluginData.totalFeatureCount + ") ");
            $(this).find('.carousel-caption p').prepend($numberTag);
          });
        }
      }

      /**
       * This function will set up the two different types of trackers used
       */
      function setupTrackers()
      {
        if (options.trackerIndividual) {
          // construct the tracker list
          var $list = $("<ul></ul>");
          $list.addClass("tracker-individual-container");
          for (var i = 0; i < pluginData.totalFeatureCount; i++) {
            // item position one plus the index
            var counter = i+1;

            // Build the DOM for the tracker list
            var $trackerBlip = $("<div>"+counter+"</div>");
            $trackerBlip.addClass("tracker-individual-blip");
            $trackerBlip.css("cursor","pointer");
            $trackerBlip.attr("id","tracker-"+(i+1));
            var $listEntry = $("<li></li>");
            $listEntry.append($trackerBlip);
            $listEntry.css("float","left");
            $listEntry.css("list-style-type","none");
            $list.append($listEntry);
          }
          // add the blip list and then make sure it's visible
          $(pluginData.containerIDTag).append($list);
          $list.hide().show();
        }
        
        if (options.trackerSummation) {
          // Build the tracker div that will hold the tracking data
          var $tracker = $('<div></div>');
          $tracker.addClass('tracker-summation-container');
          // Collect info in spans
          var $current = $('<span></span>').addClass('tracker-summation-current').text(options.startingFeature);
          var $total = $('<span></span>').addClass('tracker-summation-total').text(pluginData.totalFeatureCount);
          var $middle = $('<span></span>').addClass('tracker-summation-middle').text(' of ');
          // Add it all together
          $tracker.append($current).append($middle).append($total);
          // Insert into DOM
          $(pluginData.containerIDTag).append($tracker);
        }
      }

      // Update the tracker information with the new centered feature
      function updateTracker(oldCenter, newCenter) {
        if (options.trackerIndividual) {
          // get selectors for the two trackers
          var $trackerContainer = pluginData.featuresContainer.find(".tracker-individual-container");
          var $oldCenter = $trackerContainer.find("#tracker-"+oldCenter);
          var $newCenter = $trackerContainer.find("#tracker-"+newCenter);

          // change classes
          $oldCenter.removeClass("tracker-individual-blip-selected");
          $newCenter.addClass("tracker-individual-blip-selected");
        }
        
        if (options.trackerSummation) {
          var $trackerContainer = pluginData.featuresContainer.find('.tracker-summation-container');
          $trackerContainer.find('.tracker-summation-current').text(newCenter);
        }
      }

      /**
       * This function will set the autoplay for the carousel to
       * automatically rotate it given the time in the options
       * pass in TRUE to just clear the timer
       */
      function setTimer(stop) {
        // clear the timeout var if it exists
        clearTimeout(pluginData.timeoutVar);

        // set interval for moving if autoplay is set
        if (!stop && options.autoPlay != 0) {
          var autoTime = (Math.abs(options.autoPlay) < options.carouselSpeed) ? options.carouselSpeed : Math.abs(options.autoPlay);
          pluginData.timeoutVar = setTimeout(function () {
            (options.autoPlay > 0) ? initiateMove(true,1) : initiateMove(false,1);
          }, autoTime);
        }
      }

	  
      // This is a helper function for the animateFeature function that
      // will update the positions of all the features based on the direction
      function rotatePositions(direction) {
        $.each(pluginData.featuresArray, function () {
          var newPos;
          if (direction == false) {
            newPos = getNextNum($(this).data().position);
          } else {
            newPos = getPreviousNum($(this).data().position);
          }
          $(this).data('position',newPos);
        });
      }

      /**
       * This function is used to animate the given feature to the given
       * location. Valid locations are "left", "right", "center", "hidden"
       */
      function animateFeature($feature, direction)
      {
        var new_width, new_height, new_top, new_left, new_zindex, new_padding, new_fade;

        // Determine the old and new positions of the feature
        var oldPosition = $feature.data('position');
        var newPosition;
        if (direction == true)
          newPosition = getPreviousNum(oldPosition);
        else
          newPosition = getNextNum(oldPosition);
          
        // callback for moving out of center pos
        if (oldPosition == 1) {
          options.leavingCenter($feature);
        }

        // Caculate new new css values depending on where the feature will be located
        if (newPosition == 1) {
          new_width = pluginData.largeFeatureWidth;
          new_height = pluginData.largeFeatureHeight;
          new_top = options.topPadding;
          new_zindex = $feature.css("z-index");
          new_left = (pluginData.containerWidth / 2) - (pluginData.largeFeatureWidth / 2) - (pluginData.borderWidth / 2);
          new_fade = 1.0;
        } else {
          new_width = pluginData.smallFeatureWidth;
          new_height = pluginData.smallFeatureHeight;
          new_top = options.smallFeatureOffset + options.topPadding;
          new_zindex = 1;
          new_fade = 0.4;
          // some info is different for the left, right, and hidden positions
          // left
          if (newPosition == pluginData.totalFeatureCount) {
            new_left = options.sidePadding;
          // right
          } else if (newPosition == 2) {
            new_left = pluginData.containerWidth - pluginData.smallFeatureWidth - options.sidePadding - pluginData.borderWidth;
          // hidden
          } else {
            new_left = (pluginData.containerWidth / 2) - (pluginData.smallFeatureWidth / 2) - (pluginData.borderWidth / 2);
            new_fade = 0;
          }
        }
        // This code block takes care of hiding the feature information if the feature is leaving the center
        if (oldPosition == 1) {
          // Slide up the story information
          $feature.find(".carousel-caption")
            .hide();
        }

        // Animate the feature div to its new location
        $feature
          .animate(
            {
              width: new_width,
              height: new_height,
              top: new_top,
              left: new_left,
              opacity: new_fade
            },
            options.carouselSpeed,
            options.animationEasing,
            function () {
              // Take feature info out of hiding if new position is center
              if (newPosition == 1) {
                // need to set the height to auto to accomodate caption if displayed below image
                if (options.captionBelow)
                  $feature.css('height','auto');
                // fade in the feature information
                $feature.find(".carousel-caption")
                  .fadeTo("fast",0.85);
                // callback for moved to center
                options.movedToCenter($feature);
              }
              // decrement the animation queue
              pluginData.rotationsRemaining = pluginData.rotationsRemaining - 1;
              // have to change the z-index after the animation is done
              $feature.css("z-index", new_zindex);
              // change trackers if using them
              if (options.trackerIndividual || options.trackerSummation) {
                // just update the tracker once; once the new center feature has arrived in center
                if (newPosition == 1) {
                  // figure out what item was just in the center, and what item is now in the center
                  var newCenterItemNum = pluginData.featuresContainer.find(".carousel-feature").index($feature) + 1;
                  var oldCenterItemNum;
                  if (direction == false)
                    oldCenterItemNum = getNextNum(newCenterItemNum);
                  else
                    oldCenterItemNum = getPreviousNum(newCenterItemNum);
                  // now update the trackers
                  updateTracker(oldCenterItemNum, newCenterItemNum);
                }
              }

              // did all the the animations finish yet?
              var divide = pluginData.rotationsRemaining / pluginData.itemsToAnimate;
              if (divide % 1 == 0) {
                // if so, set moving to false...
                pluginData.currentlyMoving = false;
                // change positions for all items...
                rotatePositions(direction);

                // and move carousel again if queue is not empty
                if (pluginData.rotationsRemaining > 0)
                  move(direction);
              }
              
              // reset timer and auto rotate again
              setTimer(false);
            }
          )
          // select the image within the feature
          .find('.carousel-image')
            // animate its size down
            .animate({
              width: new_width,
              height: new_height
            },
            options.carouselSpeed,
            options.animationEasing)
          .end();
      }

      /**
       * move the carousel to the left or to the right. The features that
       * will move into the four positions are calculated and then animated
       * rotate to the RIGHT when direction is TRUE and
       * rotate to the LEFT when direction is FALSE
       */
      function move(direction)
      {
        // Set the carousel to currently moving
        pluginData.currentlyMoving = true;

        // Obtain the new feature positions based on the direction that the carousel is moving
        var $newCenter, $newLeft, $newRight, $newHidden;
        if (direction == true) {
          // Shift features to the left
          $newCenter = getContainer(getNextNum(pluginData.currentCenterNum));
          $newLeft = getContainer(pluginData.currentCenterNum);
          $newRight = getContainer(getNextNum(getNextNum(pluginData.currentCenterNum)));
          $newHidden = getContainer(getPreviousNum(pluginData.currentCenterNum));
          pluginData.currentCenterNum = getNextNum(pluginData.currentCenterNum);
        } else {
          $newCenter = getContainer(getPreviousNum(pluginData.currentCenterNum));
          $newLeft = getContainer(getPreviousNum(getPreviousNum(pluginData.currentCenterNum)));
          $newRight = getContainer(pluginData.currentCenterNum);
          $newHidden = getContainer(getNextNum(pluginData.currentCenterNum));
          pluginData.currentCenterNum = getPreviousNum(pluginData.currentCenterNum);
        }

        // The z-index must be set before animations take place for certain movements
        // this makes the animations look nicer
        if (direction) {
          $newLeft.css("z-index", 3);
        } else {
          $newRight.css("z-index", 3);
        }
        $newCenter.css("z-index", 4);

        // Animate the features into their new positions
        animateFeature($newLeft, direction);
        animateFeature($newCenter, direction);
        animateFeature($newRight, direction);
        // Only want to animate the "hidden" feature if there are more than three
        if (pluginData.totalFeatureCount > 3) {
          animateFeature($newHidden, direction);
        }
      }

      // This is used to relegate carousel movement throughout the plugin
      // It will only initiate a move if the carousel isn't currently moving
      // It will set the animation queue to the number of rotations given
      function initiateMove(direction, rotations) {
		if (pluginData.currentlyMoving == false) {
          var queue = rotations * pluginData.itemsToAnimate;
          pluginData.rotationsRemaining = queue;		  
          move(direction);		  
        } 
      }

      /**
       * This will find the shortest distance to travel the carousel from
       * one position to another position. It will return the shortest distance
       * in number form, and will be positive to go to the right and negative for left
       */
      function findShortestDistance(from, to) {
        var goingToLeft = 1, goingToRight = 1, tracker;
        tracker = from;
        // see how long it takes to go to the left
        while ((tracker = getPreviousNum(tracker)) != to) {
          goingToLeft++;
        }

        tracker = from;
        // see how long it takes to to to the right
        while ((tracker = getNextNum(tracker)) != to) {
          goingToRight++;
        }

        // whichever is shorter
        return (goingToLeft < goingToRight) ? goingToLeft*-1 : goingToRight;
      }

      // Move to the left if left button clicked
      $(options.leftButtonTag).live('click',function () {
        initiateMove(false,1);
		//edited on 2011/07/05
		processImage(pluginData.currentCenterNum-1);		
      });

      // Move to right if right button clicked
      $(options.rightButtonTag).live('click',function () {
        initiateMove(true,1);
		processImage(pluginData.currentCenterNum-1);		
      });

      // These are the click and hover events for the features
      pluginData.featuresContainer.find(".carousel-feature")
        .click(function () {
          var position = $(this).data('position');
          if (position == 2) {
            initiateMove(true,1);
			processImage(pluginData.currentCenterNum-1);
          } else if (position == pluginData.totalFeatureCount) {
            initiateMove(false,1);
			processImage(pluginData.currentCenterNum-1);
          }
        })
        .mouseover(function () {
          if (pluginData.currentlyMoving == false) {
            var position = $(this).data('position');
            if (position == 2 || position == pluginData.totalFeatureCount) {
              $(this).css("opacity",0.8);
            }
          }
          // pause the rotation?
          if (options.pauseOnHover) setTimer(true);
          // stop the rotation?
          if (options.stopOnHover) options.autoPlay = 0;
        })
        .mouseout(function () {
          if (pluginData.currentlyMoving == false) {
            var position = $(this).data('position');
            if (position == 2 || position == pluginData.totalFeatureCount) {
              $(this).css("opacity",0.4);
            }
          }
          // resume the rotation
          if (options.pauseOnHover) {
            setTimer(false);
          }
        });

      // Add event listener to all clicks within the features container
      // This is done to disable any links that aren't within the center feature
      $("a", pluginData.containerIDTag).live("click", function (event) {
        // travel up to the container
        var $parents = $(this).parentsUntil(pluginData.containerIDTag);
        // now check each of the feature divs within it
        $parents.each(function () {
          var position = $(this).data('position');
          // if there are more than just feature divs within the container, they will
          // not have a position and it may come back as undefined. Throw these out
          if (position != undefined) {
            // if any of the links on a feature OTHER THAN the center feature were clicked,
            // initiate a carousel move but then throw the link action away
            if (position != 1) {
              if (position == pluginData.totalFeatureCount) {
                initiateMove(false,1);
              } else if (position == 2) {
                initiateMove(true,1);
              }
              event.preventDefault();
              return false;
            // if the position WAS the center (i.e. 1), fire callback
            } else {
              options.clickedCenter($(this));
            }
          }
        });
      });

      // Did someone click one of the individual trackers?
      $(".tracker-individual-blip").live("click",function () {
        // grab the position # that was clicked
        var goTo = $(this).attr("id").substring(8);
        // find out where that feature # actually is in the carousel right now
        var whereIsIt = pluginData.featuresContainer.find(".carousel-feature").eq(goTo-1).data('position');
        // which feature # is currently in the center
        var currentlyAt = pluginData.currentCenterNum;
        // if the tracker was clicked for the current center feature, do nothing
        if (goTo != currentlyAt) {
          // find the shortest distance to move the carousel
          var shortest = findShortestDistance(1, whereIsIt);
          // initiate a move in that direction with given number of rotations
          if (shortest < 0) {
            initiateMove(false,(shortest*-1));
          } else {
            initiateMove(true,shortest);
          }
        }
		
	

      });
   
		//Edited for left nav
		// Did someone click one of the individual trackers?
      $(".leftnav-individual-blip").live("click",function () {
		//console.log(carouselFeature);
        // grab the position # that was clicked
        var goTo = carouselFeature;
        // find out where that feature # actually is in the carousel right now
        var whereIsIt = pluginData.featuresContainer.find(".carousel-feature").eq(goTo).data('position');
        // which feature # is currently in the center
        var currentlyAt = pluginData.currentCenterNum;
        // if the tracker was clicked for the current center feature, do nothing
        if (goTo != currentlyAt-1) {
          // find the shortest distance to move the carousel
          var shortest = findShortestDistance(1, whereIsIt);
          // initiate a move in that direction with given number of rotations
          if (shortest < 0) {
            initiateMove(false,(shortest*-1));
          } else {
            initiateMove(true,shortest);
          }
        }
		});
	});
  };
  
  $.fn.featureCarousel.defaults = {
    // If zero, take original width and height of image
    // If between 0 and 1, multiply by original width and height (acts as a percentage)
    // If greater than one, use as a forced width/height for all of the images
    largeFeatureWidth :   0,
    largeFeatureHeight:		0,
    smallFeatureWidth:    .5,
    smallFeatureHeight:		.5,
    // how much to pad the top of the carousel
    topPadding:           20,
    // spacing between the sides of the container
    sidePadding:          50,
    // the additional offset to pad the side features from the top of the carousel
    smallFeatureOffset:		50,
    // indicates which feature to start the carousel at
    startingFeature:      1,
    // speed in milliseconds it takes to rotate the carousel
    carouselSpeed:        1000,
    // time in milliseconds to set interval to autorotate the carousel
    // set to zero to disable it, negative to go left
    autoPlay:             4000,
    // with autoplay enabled, set this option to true to have the carousel pause rotating
    // when a user hovers over any feature
    pauseOnHover:         true,
    // with autoplay enabled, set this option to completely stop the autorotate functionality
    // when a user hovers over any feature
    stopOnHover:          false,
    // numbered blips can appear and be used to track the currently centered feature, as well as 
    // allow the user to click a number to move to that feature. Set to false to not process these at all
    // and true to process and display them
    trackerIndividual:    true,
    // a summation of the features can also be used to display an "x Of y" style of tracking
    // this can be combined with the above option as well
    trackerSummation:     true,
    // true to preload all images in the carousel before displaying anything. If this is set to false,
    // you will probably need to set a fixed width/height to prevent strangeness
    preload:              true,
    // Will only display this many features in the carousel
    // set to zero to disable
    displayCutoff:        0,
    // an easing can be specified for the animation of the carousel
    animationEasing:      'swing',
    // selector for the left arrow of the carousel
    leftButtonTag:        '#carousel-left',
    // selector for the right arrow of the carousel
    rightButtonTag:       '#carousel-right',
    // display captions below the image instead of on top
    captionBelow:         false,
    // callback function for when a feature has animated to the center
    movedToCenter:        $.noop,
    // callback function for when feature left center
    leavingCenter:        $.noop,
    // callback function for when center feature was clicked
    clickedCenter:        $.noop
  };

})(jQuery);

	// Life in DBS July 2011
 carouselFeature=0;
      var data;
      
      $(document).ready(function() {
      	  $.ajax({
                 type: "GET",
                 url: "data.xml",
                 dataType: "xml",
				 success: function(xml) {
                    data = xml;   
                    $(xml).find('item').each(function(){					  
                        var name_text = $(this).find('name').text();
			var image_text = $(this).find('image').eq(0).text();						
			var feature_num = $(this).find('feature').text();						
			$('<li></li>').html("<a href='javascript:void(0);' onclick='processImage("+feature_num+");carouselFeature=("+feature_num+");' class='leftnav-individual-blip'>"+name_text+"</a>").appendTo('#People');						
			$('<div class="carousel-feature"></div>').html("<a href='javascript:void(0);' class='image-ajax'><div><img class='carousel-image' alt='Image Caption' src='/common/img/dbsgroup/careers/"+image_text+"' id='"+image_text+"' width='428' height='257'></div></a>").appendTo('#carousel');	
			
			// to apply dbs' pngfix for ie
			if (g_PNGImageIds==null)
				g_PNGImageIds=new Array();
			if (g_PNGImageSources==null)
				g_PNGImageSources=new Array();
			g_PNGImageIds.push(image_text);
			g_PNGImageSources.push('/common/img/dbsgroup/careers/'+image_text);
						
			});
					
                    $("#carousel").featureCarousel({
                        autoPlay: false,
                        smallFeatureWidth: .3,
                        smallFeatureHeight: .3,
                        smallFeatureOffset: 110,
                        sidePadding: 0,
                        trackerIndividual: false,
                        trackerSummation: false,
						topPadding:0,
						movedToCenter: function(e) {
							//sitecatalyst tracking
							//alert(location.pathname);
							var path = location.pathname;
							section = path.split("/");
							//alert(e.find('img').attr('id'));
							switch(section[2]) {
								case "lifeindbs":
									var imageId = e.find('img').attr('id');
									imageId = "lifeindbs-" + imageId.replace(/.png/gi, "");
									omnitureTrack(imageId);
									//alert(imageId);
									break;
								case "undergraduates":
									var imageId = e.find('img').attr('id');
									imageId = "internship/internspeak-" + imageId.replace(/.png/gi, "");
									omnitureTrack(imageId);
									//alert(imageId);
									break;
									case "graduates":
									var imageId = e.find('img').attr('id');
									imageId = "MAP/maspeak-" + imageId.replace(/.png/gi, "");
									omnitureTrack(imageId);
									//alert(imageId);
									break; 
							}
							
						}
                    });
					
                      processImage(0); 
				}
             });
          return data;
		
      });
      
      function processImage(centernum){
            $('.items').remove();
			
            $(data).find('item').eq(centernum).each(function(){
                var html_text = $(this).find('html').text();
		/*i=0;
		$(this).find('image').each(function(){
		  if (i != 0) {
			$('.carousel-feature').eq(centernum).find(".image-ajax").append("<div><img class='carousel-image' alt='Image Caption' src='common/img/careers/image1.png'></div>");
		  }
		  i++;
		});*/
		$('<div class="items"></div>').load(html_text).appendTo('#expand-qna');
		<!--$('.carousel-feature').find(".slideshow").cycle({ fx:'fade',timeout:0}).removeClass('slideshow'); -->
		<!--$('.carousel-feature').eq(centernum).find(".image-ajax").not(".slideshow").addClass("slideshow").cycle( { fx:'fade',speed:0}); -->
		$('#People').find('li a.selected').removeClass('selected');
		$('#People').find('li').eq(centernum).find('a').addClass('selected');
		
            });
     }
	  
	  

//Career Portfolio July 2011
var careerList= 1 - 1;
$(document).ready(function() {
	var path = location.href;
	listId = path.split("list=");
	if (listId[1]) {
		careerList = listId[1];
	}
	loadCareer(careerList);
	//Roll over effect						   
	$(".popup").hover(function(){
		//Rewarding Journey		
		$(this).css("z-index","1");
		if (!($(this).find(".rwd-popup").is(':visible'))){
			$(this).find(".rwd-popup").show();	
			$(this).css("cursor","pointer");	
			$(this).find(".rwd-popup").css("cursor","default");	
		}		
		//Who are we looking for
		if (!($(this).find(".lookingfor-popup").is(':visible'))){
			$(this).find(".lookingfor-popup").show();
			$(this).css("cursor","pointer");	
			$(this).find(".lookingfor-popup").css("cursor","default");	
		}
		
	},function(){
		//Rewarding Journey		
		$(this).css("z-index","");
		$(this).find(".rwd-popup").hide();
		$(this).find(".lookingfor-popup").hide();	
	});	
	
	//Career Portfolio	
	$("#career-portfolio-nav ul li").hover(function(){		
		$(this).addClass("hover");
		if ($(this).hasClass("long-bar")){
			$(this).not(".active").append("<span class='bar-start-2'></span><span class='bar-end-2'></span>");	
		} else {
			$(this).not(".active").not(".long-bar").append("<span class='bar-start'></span><span class='bar-end'></span>");												
		};
	},function(){		
		$(this).removeClass("hover");
		if ($(this).hasClass("long-bar")){
			$("#career-portfolio-nav ul li.long-bar").not(".active").children().remove(".bar-start, .bar-end, .bar-start-2, .bar-end-2");
		} else {
			$("#career-portfolio-nav ul li").not(".active").children().remove(".bar-start, .bar-end, .bar-start-2, .bar-end-2");
		};
	});
	
	if (careerList== 4 || careerList== 11){
		$("#career-portfolio-nav ul li").eq(careerList).addClass('active').append("<span class='bar-start-2'></span><span class='bar-end-2'></span>");
	} else {
		$("#career-portfolio-nav ul li").eq(careerList).addClass('active').append("<span class='bar-start'></span><span class='bar-end'></span>");
	}
	$("#career-portfolio-nav ul li").click(function(){
		//Adding Active Class
		$("#career-portfolio-nav ul li").removeClass('active').children().remove(".bar-start, .bar-end, .bar-start-2, .bar-end-2");
		$(this).addClass('active');
		$("#career-portfolio-nav ul li.active").not(".long-bar").append("<span class='bar-start'></span><span class='bar-end'></span>");
		$("#career-portfolio-nav ul li.active.long-bar").append("<span class='bar-start-2 '></span><span class='bar-end-2'></span>");
		
		//Switching content f
		//var careerNav=$(this).attr("id");		
		//careerList++;
		//alert($("#career-portfolio-nav ul li").index(this));
		careerList=$("#career-portfolio-nav ul li").index(this);
		//location.href='#list=' + careerList;
		omnitureTrack($(this).attr('TrackingId'));
		loadCareer(careerList);
	});	
	
	//MAP Funnel
	$(".map-group").hover(function(){
		//Adding Active Class
		//show learn more
		if (!($(this).hasClass('active'))){
			$(this).not('.active').addClass('hover').find(".link_selector").css("display","inline");;
			$(".map-group.active .map-blurb").css("background-position","0 100px").find(".link_selector").css("display","none");
		}
	},function(){
		//Removing Active Class
		//if (!($(this).hasClass('active'))){
			$(this).removeClass('hover');	
			$(this).find(".link_selector").hide();
			//$(".map-group .map-blurb").not('.active').css("background","")
			$(".map-group.active .map-blurb").css("background-position","0 0");
		//}
	});
	
	//$(".map-content").hide();
	//$(".map-content.active").show();
	$("#rs1").show();
	$("#rs2").hide();
	$("#rs3").hide();
	$("#rs4").hide();
	$("#rs5").hide();
	
	$(".map-group").click(function(){
		//Adding Active Class		
		$(".map-group.active .map-blurb").css("background-position","0 0");
		$(".map-group").removeClass('hover').removeClass('active').find(".link_selector").hide();
		$(this).addClass('active');
		
		//$(this).find(".link_selector").show();
		
		//Switching content f
		var mapContent=$(this).attr("id");	
		omnitureTrack($(this).attr('TrackingId'));
		
		$(".map-content").hide();
		switch(mapContent)
		{
		case "map-grp-1":
		  $("#cv-screen").show();
		  $("#rs1").show();
		  
		  break;
		case "map-grp-2":
		  $("#online-test").show();
		  $("#rs2").show();
		    
		  break;
		case "map-grp-3":
		  $("#cbi").show();
		  $("#rs3").show();
		  break;
		case "map-grp-4":
		  $("#assessment-center").show();
		  $("#rs4").show();
		    
		  break;
		case "map-grp-5":
		  $("#map-network").show();
		  $("#rs5").show();
		  
		  break;  	
		default:
			
		  
		}
	});
	
	//MAP Funnel
	$(".internship-tips-group").hover(function(){
		//Adding Active Class
		//show learn more
		if (!($(this).hasClass('active'))){
			$(this).not('.active').addClass('hover').find(".link_selector").css("display","inline");;
			$(".internship-tips-group.active .internship-tips-blurb").css("background-position","0 100px").find(".link_selector").css("display","none");
		}
	},function(){
		//Removing Active Class
		//if (!($(this).hasClass('active'))){
			$(this).removeClass('hover');	
			$(this).find(".link_selector").hide();
			//$(".map-group .map-blurb").not('.active').css("background","")
			$(".internship-tips-group.active .internship-tips-blurb").css("background-position","0 0");
		//}
	});
	
		  $("#rs1").show();
		  $("#rs2").hide();
		  $("#rs3").hide();
	$(".internship-tips-group").click(function(){
		//Adding Active Class		
		$(".internship-tips-group.active .internship-tips-blurb").css("background-position","0 0");
		$(".internship-tips-group").removeClass('hover').removeClass('active').find(".link_selector").hide();
		$(this).addClass('active');
		
		//$(this).find(".link_selector").show();
		
		//Switching content f
		var mapContent=$(this).attr("id");	
		omnitureTrack($(this).attr('TrackingId'));
		
		$(".internship-tips-content").hide();
		switch(mapContent)
		{
		case "internship-tips-grp-1":
		  $("#cv-screen").show();
		  $("#rs1").show();
		  
		  break;
		case "internship-tips-grp-2":
		  $("#online-test").show();
		  $("#rs2").show();
		 
		  break;
		case "internship-tips-grp-3":
		  $("#cbi").show();
		  $("#rs3").show();
		  
		  break;
		default:
			
		  
		}
	});

     
//Loading Career Portfolio Content function
/*	function loadCareer(loadList){
		var careerNav=$("#career-portfolio-nav ul li").eq(loadList).attr("id");				
		switch(careerNav)
		{
			case "capital-market":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p>DBS Capital Markets provides corporate finance services including advisory, equity and equity-linked fund-raising activities, mergers, acquisitions, direct investments and mezzanine debt financing.<ul><li>We have been consistently ranked &quot;Best Investment Bank&quot; and &quot;Best Equity House&quot; in Singapore</li><li>We are the market leader for REIT and BT issuance in Singapore and across Asia</li><li>We help shareholders create value by providing successful monetising solutions</li><li>We specialise in providing Equity Capital and Mezzanine Debt financing to mid-to-late stage growth companies that require funding for expansion and development plans</li><li>We play an instrumental role in helping companies from Singapore or around the region with their growth and operating strategies, corporate development/M&A needs, and related capital funding requirements</li></ul></p><p><strong>WHO WE LOOK FOR</strong></p><p>Capital Markets' looks for individuals who are mature, nimble thinkers, self starters with a passion for corporate finance and capital markets with the ability to build relationships.   You must also possess strong analytical skills, excellent written and verbal communication and presentation skills, plus an entrepreneurial spirit.</p><p>Quote from Choe Tse Wei, MD, Head of Strategic Advisory</p><p>&quot;The MA programme has been valuable because it provides Management Associates with a broad-based exposure to different functions in DBS, and enables them to forge informal networks which they can draw upon to resolve inter-unit issues in future.  Management Associates are intellectually versatile and confident, and these are key factors for a promising career in DBS.&quot;</p>");
				
			break;
			case "consumer-banking":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong><br><br>DBS Consumer Banking Group (CBG) provides a full spectrum of consumer products and services to meet our customers' needs at every life stage, including deposits, investments, insurance, mortgages, credit cards and personal loans Through our insights into consumer needs in Asia and our growing network of branches in the region, we strive to give our customers unparalleled convenience and a differentiated experience through innovative products and services.</p><p><strong>WHO WE LOOK for</strong><br><br>Consumer banking looks for motivated individuals who thrive on working in a team-oriented atmosphere. You must also possess excellent written and verbal communication skills with a strong passion for success.</p>");
				
			break;
			case "institutional-banking":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p><strong>WHO WE LOOK FOR</strong></p>");
			
			break;
			case "private-banking":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p>Our team of highly-skilled investment advisors provide a full suite of personalised services to meet our customers' total banking needs. Our deep understanding of business and wealth creation process enables us to tailor innovative Asian-centric solutions.</p><p><strong>WHO WE LOOK for</strong></p><p>DBS Private Bank looks for individuals who have strong analytical skills and have the strong communications and interpersonal skills needed to work closely with clients.</p>");
				
			break;
			case "treasury-liquidity":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p>We serve our customers' hedging and investment needs by offering the most comprehensive range of treasury products from foreign exchange, commodities, interest rate, credit, money markets and securities trading. With our Asian insights and strong structuring capabilities we have built in-house, we are able to provide innovative and responsive services and solutions to our customers.  We are a dominant leader in Singapore Dollar products and enjoy a leadership position in many of the Asian currency Financial Products.</p><p><strong>WHO WE LOOK for</strong></p><p>We look for people who share our core values Passion, Relationships, Integrity, Teamwork and confidence to Excel and embody them. Doing the right thing for our customers, employees, shareholders must be part of our DNA and it is what should come naturally.</p>");
			
			break;
			case "treasury-markets":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p><strong>WHO WE LOOK FOR</strong></p>");
				
			break;
			case "group-audit":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p>Group Audit examines and evaluates the adequacy, effectiveness and robustness of the Group's system of internal controls, risk management procedures, governance processes. As part of its credit review activities, Group Audit also provides an independent assessment of the Group's quantitative and judgmental credit management processes, portfolio strategies and portfolio quality.</p><p><strong>WHO WE LOOK FOR</strong></p><p>Group Audit looks for individuals who welcome responsibility and accountability, detailed oriented with the ability to communicate effectively with colleagues from a diversity of backgrounds with excellent written and verbal communication skills.</p>");
				
			break;
			case "group-finance":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p>We deliver world-class standards in reporting, financial planning and financial process. These include effectively managing the tax affairs of the Group, establishing a standard finance operating model, ensuring the accurate and timely capital reporting, driving all decision support processes, providing timely quality financial management analysis and ensuring the accuracy of the bank's financial records in compliance with local accounting standards and DBS accounting policies.</p><p><strong>WHO WE LOOK FOR</strong></p><p>Finance professionals come from a diverse set of backgrounds and experiences. Individuals who have strong problem-solving and analytical skills, a commercial focus and interest in financial markets with strong communication and interpersonal skills.</p>");
				
			break;
			case "group-hr":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p><strong>WHO WE LOOK FOR</strong></p>");
				
			break;
			case "group-legal":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p>Group Legal, Compliance & Secretariat (LCS), offers a comprehensive suite of solutions and works in partnership with various departments in DBS to provide legal and contract advisory, regulatory advisory and compliance and corporate governance to manage risk exposures within the organisation.</p><p><strong>WHO WE LOOK FOR</strong></p><p>Group Legal, Compliance & Secretariat (LCS) look for individuals who have an interest in legal issues and finance who are inquisitive and are critical thinkers.</p>");
				
			break;
			case "group-planning":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p>Group Planning encompasses strategic planning, organisational excellence and knowledge management.  The team works in close partnership with internal key stakeholders to ensure that capabilities and resources are in place to implement business and organizational strategies to achieve the Group's desired objectives.</p><p><strong>WHO WE LOOK FOR</strong></p><p>Group Planning looks for individuals who are intellectually curious, creative and analytical. You must also possess excellent written and verbal communication skills.</p>");
	
			break;
			case "group-strategic":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><P>Group Strategic Marketing & Communications (GSMC) enhances the Group's corporate reputation, differentiating the organisation through a strategic and integrated focus on branding, corporate communications, marketing and research.</p><p><strong>WHO WE LOOK FOR</strong></p><P>Group Strategic Marketing & Communications look for individuals with an analytical mind who possess excellent written and verbal communication skills, have high standard of integrity, versatile interests and the ability and will to adapt.</p>");
				
			break;
			case "group-tech":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><P>Group Technology and  Operations (T&O) enables and empowers DBS with a standardised infrastructure that is efficient and scalable, focussing strategically on productivity, quality & control, technology and our people. We maintain the high quality and efficiency of our services by managing the bank's processes across various delivery channels.</p><p><strong>WHO WE LOOK FOR</strong></p><p>Group Technology & Operations looks for individuals with a passion to make a difference, a desire to use technology to solve critical business problems, with outstanding technical and analytical skills who are team players and have excellent written and verbal communication skills.</p>");

			break;
			case "risk-management":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p>Risk Management Group (RMG) is the central resource for quantifying and managing the portfolio of risks taken by the Group as a whole. We develop and implement effective risk and economic capital adequacy assessment frameworks policies and methodologies. We also identify opportunities to optimise risk-based return on capital and provide our senior management and Board with assessments of the bank's aggregate risk profile.</p><p><strong>WHO WE LOOK FOR</strong></p><p>Risk Management Group looks for individuals who are intellectually curious, analytical with strong communications and interpersonal skills.</p>");
				
			break;
			case "dbs-vickers":
				$("#career-portfolio").html("<p><strong>WHAT WE DO</strong></p><p>DBS Vickers Securities is the wholly-owned securities and derivatives arm of the DBS Group. We have full stock broking licenses in Singapore, Hong Kong, Thailand and Indonesia, as well as sales offices in London and New York, and a representative office in Shanghai. DBS Vickers Securities offers a broad range of services, which include share placement and trading, derivatives trading, provision of corporate and economic research, nominee and securities custodial services. We are also an active player in the distribution of primary and secondary issues in the Singapore and regional capital markets</p><p><strong>WHO WE LOOK FOR</strong></p><P>DBS Vickers Securities looks for individuals who are intellectually curious, creative and analytical, interested in conducting in-depth evaluations of company performance and enjoy working in a challenging environment.</p>");
				
			break;
			default:
		  
		}
}
});
*/

function loadCareer(loadList){
		var careerNav=$("#career-portfolio-nav ul li").eq(loadList).attr("id");				
		switch(careerNav)
		{
			case "capital-market":
				$("#career-portfolio").html("<p>DBS Capital Markets' services cover fund-raising activities in the equity and debt markets as well as the provision of mergers & acquisitions (M&A), financial advisory services and direct investments. DBS has played an instrumental role in helping companies tap equity through initial public offerings (IPOs) on the Singapore Exchange.  An award-winning team, we topped the league table for the highest amount raised for initial public offerings in Singapore from 1999 to 2008, achieving a market share of 17.4% (source: Bloomberg).</p>");
				
			break;
			case "consumer-banking":
				$("#career-portfolio").html("<p>Asia's middle class is growing and as the leading bank in Asia, DBS Consumer Banking Group (CBG) is in a unique position to help our customers realise their dreams and ambitions. As a market leader in the consumer banking business, DBS has a full spectrum of products and services, including deposits, investments, insurance, mortgages, credit cards and personal loans, to help our customers realize their dreams and aspirations at every life stage. As the largest bank in Singapore, we are proud that almost every Singaporean banks with our DBS and POSB franchises.</p>");
				
			break;
			case "institutional-banking":
				$("#career-portfolio").html("<p>DBS Institutional Banking Group (IBG) provides a broad range of financial solutions to large corporate and institutional clients, as well as small and medium sized enterprises. With our strong product capabilities and client-focused approach, the Group has established leadership positions in syndicated finance, equipment financing and factoring. With a presence in 15 markets, we are committed to delivering a comprehensive suite of financing solutions to help meet our customers' business aspirations across Asia.</p><p>IBG encompasses Corporate and Investment Banking, Enterprise Banking and Global Transaction Services.</p>");
			
			break;
			case "private-banking":
				$("#career-portfolio").html("<p>DBS Private Banking offers our customers a one-stop full-service touch-point for their total banking requirements. We provide the highest level of personalized banking through our team of investment advisors. Our focus lies in identifying opportunities in the various asset classes and the best ways to profit from it, employing the best strategies and product vehicles.</p>");
				
			break;
			case "treasury-liquidity":
				$("#career-portfolio").html("<p>DBS Treasury Liquidity Management & Treasury Investments manages the Group's structural interest rate, foreign exchange and liquidity risks and investment of the Group's excess liquidity and shareholders' funds. We invest in a broad range of financial market instruments such as fixed income, equities, derivatives, alternative investments and structured products. In addition, we are responsible for the daily management of the Bank's overall asset & liability position as well as short to medium term funding requirements.</p>");
			
			break;
			case "treasury-markets":
				$("#career-portfolio").html("<p>DBS Treasury & Markets (T&M) is a leading financial market house in Asia, offering the most comprehensive range of treasury products from foreign exchange, commodities, interest rates, money market and securities trading, to serve corporations' hedging and investment needs with a regional emphasis. As a leader in the SGD market and other regional products, we pride ourselves on an excellent, customer-driven research capability and cutting edge risk management technology and systems. No two days are the same in this exciting, fast-paced environment.</p>");
				
			break;
			case "group-audit":
				$("#career-portfolio").html("<p>Group Audit assists the Board and Executive Management in meeting the strategic and operational objectives of the DBS Group. Through independent appraisals, Group Audit assesses the adequacy and effectiveness of risk management and control processes in operation. Led by a team of much sought-after professionals in the field, the group is committed to excellence and strives to become the best audit function in the financial services industry in Asia-Pacific, as well as the stakeholder's trusted adviser in all matters relating to internal controls.</p>");
				
			break;
			case "group-finance":
				$("#career-portfolio").html("<p>Group Finance provides insights and analyses on the banking business and product and customer profitability to enable the bank to make sound business decisions. In addition, we provide capital management, business planning, forecasting, tax and accounting advisory services to our businesses.</p>");
				
			break;
			case "group-hr":
				$("#career-portfolio").html("<p>At DBS, we believe that banking is about people, our people. Group Human Resources (HR) has the important role of attracting, retaining and nurturing talent to ensure that we continue to be a competitive Asia banking specialist. To this end, HR's vision is to differentiate DBS as an employer of choice through strategic partnerships with our business and outstanding people practices. With a well-established team of HR partners supporting and delivering people-based effective HR solutions and services across businesses, we are committed to empowering and engaging our staff so as to build a high performance organisation.</p>");
				
			break;
			case "group-legal":
				$("#career-portfolio").html("<p>The banking business is founded on trust and integrity. To continue to succeed, we must zealously guard and enhance our reputation and capital. Group Legal, Compliance & Secretariat ensures that our interests are protected, and that we continue to maintain our good standing with regulators, customers, business partners and stakeholders.</p>");
				
			break;
			case "group-planning":
				$("#career-portfolio").html("<p>Group Planning performs the function of developing corporate strategy and aligning business strategies to achieve financial targets and strategic objectives. The unit reviews banking trends, market opportunities and structural issues to formulate corporate strategy and priorities. Working closely with other group functions, we enable execution of the Bank's plans through the various units.</p>");	
			break;
			case "group-strategic":
				$("#career-portfolio").html("<p>The business of banking is a highly commoditised one and customers today have many choices. Group Strategic Marketing & Communications (GSMC) seeks to build, protect and enhance DBS corporate reputation and differentiate DBS through a strategic and integrated focus on corporate communications, marketing and research. We are at the forefront of building the DBS brand in the region, inspiring and working closely with all units in the DBS Group.</p>");
				
			break;
			case "group-tech":
				$("#career-portfolio").html("<p>Group Technology and Operations (T&O) enables and empowers our Bank with an efficient, nimble, scalable standard infrastructure through a strategic focus on Productivity, Quality & Control, Operating Models, Technology and People. We manage the majority of the Bank's operational processes and inspire to delight our business partners through our multiple banking delivery channels. </p>");

			break;
			case "risk-management":
				$("#career-portfolio").html("<p>Risk Management Group works closely with our business partners to manage the bank's risk exposure to maximize returns against an acceptable risk profile. We partner with origination teams to provide financing, investments and hedging opportunities to our customers. To successfully manage our risk and run a successful business, we invest significantly in our people and the needed infrastructure to stay ahead of the curve.</p>");
				
			break;
			case "dbs-vickers":
				$("#career-portfolio").html("<p>DBS Vickers Securities is one of the largest securities and derivatives brokerages in Singapore and one of the leading institutional and retail brokerages in Asia. Backed by the financial strength of the DBS Group, our extensive client base and regional presence, we offer a broad range of services which include equities, derivatives, share placement, provision of corporate and economic research, nominee and securities custodial services.</p>");
				
			break;
			default:
		  
		}
}
});


function omnitureTrack(pageName)
{
	var s=s_gi(s_account);
	s.linkTrackVars='eVar13,events';
	s.linkTrackEvents='event1';
	s.eVar13=pageName;
	s.events='event1','prodView';
	s.products=pageName;
	s.tl(this,'o');
}

