// JavaScript Document
<!--
slogans = new Array();
slogans[0] = "Change CAPEX to OPEX";
slogans[1] = "For the agile business";
slogans[2] = "Minimize risk, quickly realize cost savings";
slogans[3] = "Low Cost of Ownership";
slogans[4] = "Proactive, not reactive";
slogans[5] = "React before your competitor does";
slogans[6] = "Is your core business IT? Ours is";
slogans[7] = "The next generation of Outsourcing";

slogan_index = slogans.length -1;

definitions = new Array();
definitions[0] = "A particular position, point or place";
definitions[1] = "The scene of an activity";
definitions[2] = "(Mathematics) A figure formed by all the points satisfying a particular equation of the relation between co-ordinatese";
definitions[3] = "(Archaeology) A discrete excavated unit or archaeological context";
definitions[4] = "(Genetics) The position on a chromosome of a gene or other chromosome marker";
definitions[5] = "(Psychology) A belief about whether the outcomes of our actions are contingent on what we do or on events outside our personal control";
definitions[6] = "(Phonetics) The hypothetical starting point of the formant transitions that characterise plosive consonants acoustically";
definitions[7] = "(Literature) Marks the first appearance of a phrase or the definitive passage that is authoritative for an idea";

definitions_index = definitions.length -1;

/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
var responseText;

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
	xmlHttp = false;
  }
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

function retrievePage(page) {
	xmlHttp.open("GET", page + "?random=" + Math.random(), true);
	xmlHttp.onreadystatechange = pageResponse;
	xmlHttp.send(null);
}

function pageResponse() {
	if (xmlHttp.readyState == 4) {
		var responseText = xmlHttp.responseText;
		document.getElementById('additionalcontent').innerHTML = responseText;

		document.getElementById('defaultcontent').style.display = 'none';
		//document.getElementById('additionalcontent').style.display = 'inline';

		//Then Fade our Default Content and Fade In new content
		//Effect.Fade('defaultcontent', {queue: {position:'front', scope: 'contentscope'} });
		Effect.Appear('additionalcontent', {queue: {position:'end', scope: 'contentscope'} });

	}
}

function retrieveImage(image) {
	document.getElementById('additionalcontent').innerHTML = '<img src=\"' + image + '\" border=\"0\"/>';

	document.getElementById('defaultcontent').style.display = 'none';
	//document.getElementById('additionalcontent').style.display = 'inline';

	//Then Fade our Default Content and Fade In new content
	//Effect.Fade('defaultcontent', {queue: {position:'front', scope: 'contentscope'} });
	Effect.Appear('additionalcontent', {queue: {position:'end', scope: 'contentscope'} });
}

function init() {
	loadArticles();
	InitializeTimer();
}
	
function InitializeTimer()
{
	FadeIn();
}

function FadeOut()
{
	if(slogan_index == slogans.length) slogan_index = 0;
	if(definitions_index == definitions.length) definitions_index = 0;

	Effect.Fade('slogan', {queue: {position:'front', scope: 'sloganscope'} });
	Effect.Fade('definition', {queue: {position:'front', scope: 'definitionscope'} });

	self.setTimeout("FadeIn()", 1000);
}
function FadeIn()
{
	document.getElementById("slogan").innerHTML = slogans[slogan_index];
	document.getElementById("definition").innerHTML = definitions[definitions_index];

	slogan_index = slogan_index + 1;
	definitions_index = definitions_index + 1;

	Effect.Appear('slogan', {queue: {position:'end', scope: 'sloganscope'} });
	Effect.Appear('definition', {queue: {position:'end', scope: 'definitionscope'} });

	self.setTimeout("FadeOut()", 7500);
}
function closeAdditionalContent()
{
	document.getElementById('defaultcontent').style.display = 'inline';
	document.getElementById('additionalcontent').style.display = 'none';

	//Effect.Fade('additionalcontent', {queue: {position:'front', scope: 'contentscope'} });
	//Effect.Appear('defaultcontent', {queue: {position:'end', scope: 'contentscope'} });


}
function submitContactForm() {
	var customer_name = document.getElementById("name").value;
	var customer_email = 	document.getElementById("email").value;
	var customer_message = 	document.getElementById("message").value;

	xmlHttp.open("POST", 'contact.php', true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.onreadystatechange = contactResponse;
	xmlHttp.send('name='+customer_name+'&email='+customer_email+'&message='+customer_message);

	return false;

}
function contactResponse() {
	if (xmlHttp.readyState == 4) {
		var responseText = xmlHttp.responseText;

		document.getElementById('emailForm').innerHTML = responseText;

	}

}

function highlightTarget(id) {
	var url = id.href;
	// Get everything after the '#' in the link--that's our id
	var elementId = url.substring(url.lastIndexOf('#') + 1);
	// Change the classname of the element of interest:
	//document.getElementById(elementId).className = 'highlighted';
	new Effect.Highlight(elementId, {startcolor:'#FFE900',duration:10.0});
}

function loadArticles() {
	xmlHttp.open("GET", "articles.php", true);
	xmlHttp.onreadystatechange = articleResponse;
	xmlHttp.send(null);
}
function articleResponse() {
	if (xmlHttp.readyState == 4) {
		var responseText = xmlHttp.responseText;
		document.getElementById('articles').innerHTML = responseText;
	}
}

//-->
