// JavaScript Document
var date = new Date();
var logoPath = "assets/images/lqLogoBlue.jpg";
var flagPath = "assets/images/serviceStarIcon.jpg";
var deployedData;

function buildSite(){
	LoadXML("data/menuList.xml");
	buildBanner();
	buildMenu();
	buildFooter();
}
function buildBanner(){
	var Banner=document.getElementById("bannerShell")
	Banner.innerHTML = "<div id='bannerLogo'><img src="+logoPath+" alt='linquest logo' width='120' height='60' /></div><div class='bannerLink'><a href='https://secure.linquest.com' target='_blank'>Employee Portal</a></div><div class='bannerLink' style='padding-top:4px; width:202px'><img src="+flagPath+" alt='service star' width='20' height='12' style='float:left; padding-top:1px; padding-left:11px'/> <a href='lq-deployed.html'>LinQuest Deployed Reservists</a></div><div class='bannerLink' style='padding-top:4px; width:202px'><a href='http://commercial.linquest.com/'>Commercial Solutions Website</a></div>";
}

function buildMenu(){
	var menuXML=xmlDoc.getElementsByTagName("mainMenu")[0].childNodes[0].nodeValue;
	var Menu=document.getElementById("menuShell");
	Menu.innerHTML = "<div id='menu'>"+menuXML+"</div>";
}

function buildFooter(){
	var Footer=document.getElementById("footerShell");
	Footer.innerHTML = "<div id='footer'><p id='footerInfo'> Copyright &#169 2004 - "+date.getFullYear()+" LinQuest Corporation. All Rights Reserved.</p><p><a href='lq-terms.html'>Terms and Conditions</a> | <a href ='mailto:bryan.ross@linquest.com'>Webmaster</a> | <a href ='lq-sitemap.html'>Site Map</a> | <a href='http://www.facebook.com/pages/LinQuest-Corporation/218810651463864'>Find us on Facebook</a></p></div>"
}

function buildSiteMap(){
	buildBanner();
	buildFooter();
	buildSubMenu("mainMenu","mainList");
    buildSubMenu("swMenu","swList");
    buildSubMenu("locMenu","locList");
}

function buildSubMenu(XML,DIV){
	var menuXML=xmlDoc.getElementsByTagName(XML)[0].childNodes[0].nodeValue;
	var menu=document.getElementById(DIV)
	menu.innerHTML = menuXML;
}

function loadDeployed(){
	LoadXML("data/deployed.xml");
	deployedData=xmlDoc.getElementsByTagName("employee");
	buildDeployed();
}

function buildDeployed(){
	var dList=document.getElementById("deployed");
	var tempHTML = '';
	for (var i=0;i<deployedData.length;i++){
		var name=deployedData[i].getAttribute("name");
		var photo=deployedData[i].getAttribute("photo");
		var title=deployedData[i].getAttribute("title");
		var mTitle=deployedData[i].getElementsByTagName("h2")[0].childNodes[0].nodeValue;
		var content=deployedData[i].getElementsByTagName("p")[0].childNodes[0].nodeValue;
		tempHTML+='<div id="employee">';
		tempHTML+='<img src="assets/images/americanFlag.jpg" width="72" height="120" style="float:left;"/>';
		tempHTML+='<img src="assets/images/serviceStar.jpg" width="72" height="120" style="float:right" />';
		tempHTML+='<div style="display:inline; float:left; width:156px; height:30px; margin-top:10px;">';
		tempHTML+='<img src="assets/images/deployed/'+photo+'" width="83" height="100" />';
		tempHTML+='</div>';
		tempHTML+='</div>';
	};
	dList.innerHTML += tempHTML;
}
