function pausecomp(millis) 
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < millis);
} 

window.onload = function() {

//alert("vid");
//pausecomp(1000);
vid();


if (pageidjs == '0') 
{
// do nothing

}
 else {

 




 
//var stageVidEl = document.getElementById("player");
//if (stageVidEl != null)
//{
//reqVideo2('<%=pagetags%>');
//alert("play video");
//loadMovie('/FLV/DC_JM_flv.flv','/FLV/CA_captions.xml','','');
//}
 
		reqPages(pageidjs, pagetags);
			if (pageidjs == '138') {
			reqEmpCourses(pagetags); // this one is so we can navigat BF courses without Leaving the Emplyers section!
			} else {
			reqCourses(pagetags);
			}
		reqPress(pagetags, pageid);
		reqEvnts(pageid, pagetags);
		reqLinks(pagetags);
		reqEvents(pagetags);
		reqPeople(pagetags);
newsevents('news');	
showForm('enquiry');
		
		//} else
		//do nothing
		//}
//		}


}


}



function vid() {
// ok the problem here is that the object sometimes isnt loading in time... so its returning null...



			var stageEl = document.getElementById("player2");
//			alert(stageEl);
			if (stageEl != null)
				{
//				
					var filename = stageEl.value;
					var prev = stageEl.prev;
					var caps = stageEl.caps;
					var H = stageEl.H;
					var W = stageEl.W;
				
							function loadMovie(fil,cap,lrg,aud) {
								var so = new SWFObject('flvplayer.swf','mpl',W,H,'7');
								so.addParam("allowfullscreen","true");
								so.addParam("seamlesstabbing","true");
								so.addVariable("file",fil);
								if(cap != '') { so.addVariable("captions",cap); }
								if(lrg != '') { so.addVariable("largecontrols","true"); }
								if(aud != '') { so.addVariable("audio",aud); }
								so.addVariable("image", "/FLV/" + prev);
								so.write('player2');
							}

					loadMovie('/FLV/' + filename,'/FLV/' + caps,'',''); window.document.mpl.focus();
				}
			else
				{
//	alert("no video stage");
				}
		}




function createDocument() {
var aVersions = [ "MSXML2.DOMDocument.5.0",
"MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0",
"MSXML2.DOMDocument","Microsoft.XmlDom"
];
for (var i = 0; i < aVersions.length; i++) {
try {
var oXmlDom = new ActiveXObject(aVersions[i]);
return oXmlDom;
} catch (oError) {
//Do nothing
}	
}
throw new Error("MSXML is not installed.");
}



function TIMESTAMP() {
// Create a timestamp...
var nowDate 	= new Date();
var nowHour 	= nowDate.getHours();
var nowMinute 	= nowDate.getMinutes();
var nowSecond 	= nowDate.getSeconds();
var TIMESTAMP 	= (nowHour + nowMinute + nowSecond);
return TIMESTAMP;

this.noDate 	= null;
this.nowHour 	= null;
this.nowMinute 	= null;
this.nowSecond 	= null;
}



function reqCourses(pagetags) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/related_Courses09v2.asp?pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispCourses(oXmlHttp.responseText);		
} else {
dispCourses("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispCourses(sText) {
var dispCourses = document.getElementById("courses");
dispCourses.innerHTML = (sText);
}

function reqEmpCourses(pagetags) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/related_Courses_Emp.asp?pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispCourses(oXmlHttp.responseText);		
} else {
dispEmpCourses("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispEmpCourses(sText) {
var dispEmpCourses = document.getElementById("empCourses");
dispEmpCourses.innerHTML = (sText);
}


function reqPages(pageid, pagetags) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/related_pages2010.asp?pageid=" + pageid + "&pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispPages(oXmlHttp.responseText);		
} else {
dispPages("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispPages(sText) {
var dispPages = document.getElementById("Pages");
dispPages.innerHTML = (sText);
}



function reqPress(pagetags, pageid) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
//if (pageid == "138") {
//oXmlHttp.open("get", "applications/related_press09.asp?pagetags=" + pagetags + "&pageid=" + pageid + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 
//} else {
//oXmlHttp.open("get", "applications/related_press.asp?pagetags=" + pagetags + "&pageid=" + pageid + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 
//}
//oXmlHttp.open("get", "applications/related_press09.asp?pagetags=" + pagetags + "&pageid=" + pageid + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 
oXmlHttp.open("get", "applications/relatedDBPress.asp?pgtgs=" + pagetags + "&pageid=" + pageid + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 
oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispPress(oXmlHttp.responseText);		
} else {
dispPress("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispPress(sText) {
var dispPress = document.getElementById("relatedPress");
dispPress.innerHTML = (sText);
}



function reqEvents(pagetags) {
var strTIMESTAMP = TIMESTAMP()
//alert(pagetags);
var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/Eventmanager/ASP/related_Events.asp?pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispEvents(oXmlHttp.responseText);		
} else {
dispEvents("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispEvents(sText) {
//var dispEvents = document.getElementById("eventsMngr");
//dispEvents.innerHTML = (sText);
}



function reqPeople(pagetags) {
var strTIMESTAMP = TIMESTAMP()
//alert("people");
var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/related_People.asp?pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispPeople(oXmlHttp.responseText);		
} else {
dispPeople("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispPeople(sText) {
var dispPeople = document.getElementById("relatedPeople");
dispPeople.innerHTML = (sText);
}



function reqLinks(pagetags) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/related_Links.asp?pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispLinks(oXmlHttp.responseText);		
} else {
dispLinks("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispLinks(sText) {
var dispLinks = document.getElementById("relatedLinks");
dispLinks.innerHTML = (sText);
}


function reqChildPages(pageid) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/childPages.asp?pageid=" + pageid + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispChildPages(oXmlHttp.responseText);		
} else {
dispChildPages("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispChildPages(sText) {
var dispChildPages = document.getElementById("stage");
dispChildPages.innerHTML = (sText);
}


function reqVideo(pagetags) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/relatedVideo.asp?pageid=" + pageid + "&pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispVideo(oXmlHttp.responseText);		
} else {
dispVideo("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispVideo(sText) {
var dispVideo = document.getElementById("stageVideo");
dispVideo.innerHTML = (sText);
}



function reqEvnts(pageid, pagetags) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/related_Events.asp?pageid=" + pageid + "&pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispEvnts(oXmlHttp.responseText);		
} else {
dispEvnts("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispEvnts(sText) {
var dispEvnts = document.getElementById("relEvnts");
dispEvnts.innerHTML = (sText);
}






function reqEvnts2(pagetags) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/related_Events2.asp?pageid=" + pageid + "&pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispEvnts2(oXmlHttp.responseText);		
} else {
dispEvnts2("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispEvnts2(sText) {
var dispEvnts2 = document.getElementById("stageEvents");
dispEvnts2.innerHTML = (sText);
}







function reqVideo2(pagetags) {
var strTIMESTAMP = TIMESTAMP()

var oXmlHttp = zXmlHttp.createRequest();							// Create an instance of the object
oXmlHttp.open("get", "applications/relatedVideo2.asp?pageid=" + pageid + "&pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 
//oXmlHttp.open("get", "/FLV/flvplayer.html?pageid=" + pageid + "&pgtgs=" + pagetags + "&TSTAMP=" + strTIMESTAMP, true);	// Go get the stuff! 

oXmlHttp.onreadystatechange = function () {
if (oXmlHttp.readyState == 4) {
if (oXmlHttp.status == 200) {
dispVideo2(oXmlHttp.responseText);		
} else {
dispVideo2("<font color=#ff0000>An error has occured on this part of the page: (" + oXmlHttp.statusText + ")</font>"); //statusText is not always accurate
}
}            
};
oXmlHttp.send(null);
}


function dispVideo2(sText) {
var dispVideo2 = document.getElementById("videoStage");
dispVideo2.innerHTML = (sText);
}