 // JavaScript Document
function clientSideInclude(id, url) {
  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
	try {
	  req = new XMLHttpRequest();
	} catch (e) {
	  req = false;
	}
  } else if (window.ActiveXObject) {
	// For Internet Explorer on Windows
	try {
	  req = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  try {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (e) {
		req = false;
	  }
	}
  }
 var element = document.getElementById(id);
 if (!element) {
  alert("Bad id " + id +
   "passed to clientSideInclude." +
   "You need a div or span element " +
   "with this id in your page.");
  return;
 }
  if (req) {
	// Synchronous request, wait till we have it all
	req.open('GET', url, false);
	req.send(null);
	fadeIn(id,30);
	element.innerHTML = req.responseText;
  } else {
	element.innerHTML =
   "Sorry, your browser does not support " +
	  "XMLHTTPRequest objects. This page requires " +
	  "Internet Explorer 5 or better for Windows, " +
	  "or Firefox for any system, or Safari. Other " +
	  "compatible browsers may also exist.";
  }
}


function contentTransition(id) {
	
	if (document.getElementById('scrollBool').innerHTML == "Auto") {
		changeContent('content');
		document.getElementById('scrollBool').innerHTML = "Stop";
		k = sites.length * delaySeconds;
		scrollTimerId = setInterval("changeContent('"+id+"')" , k);
	} else {
		document.getElementById('scrollBool').innerHTML = "Auto";
		clearInterval ( scrollTimerId );
		
		for(thisId in changeTimerId) {
			clearTimeout ( changeTimerId[thisId] );
			
		arrNum = 0;
		}
	}
}



function changeContent(id) {
	
	
	var j = 0;
	for (i=0;i<sites.length;i++) {
		
		
		
			if (arrNum == 0) {
				changeTimerId[arrNum] = setTimeout("clientSideInclude('"+id+"','" + sites[i] + "')" , 5);
				arrNum++;
				
			} else {
				changeTimerId[arrNum] = setTimeout("clientSideInclude('"+id+"','" + sites[i] + "')" , j);
				arrNum++;
			}
			j += delaySeconds;
			
		
			
				
		
			
				
	}
		
		 arrNum = 0;
	
}


var fadeTimerId = 0;

function fadeIn(id,fade)
{
	
    if(fade != 100)
    {
    fade += 5;
    document.getElementById(id).style.MozOpacity = fade/100; 
    document.getElementById(id).style.KhtmlOpacity = fade/100; 
    document.getElementById(id).style.filter = "alpha(opacity:" + fade + ")";
    }
    fadeTimerId = setTimeout("fadeIn('"+id+"',"+fade+")", 25);
}

function closeAlertWindow() {
	setTimeout("$('#signoutId').fadeOut('fast')");
}


