function ext_link () {
	alert('You are now leaving Virginia Beach City Public Schools\' Web site -- www.vbschools.com. \r\rThe school division has identified this Web site as having educational value. Virginia Beach City Public Schools does not control or guarantee the content of this site, nor does the school division endorse the organization, its views, products, or services.');
}

function checkLinks() {
	var acc; // array of acceptable urls
	var url; // url of anchor
	var bolChange; // boolean change var
	
	acc = new Array(
		
		"localhost",
		"mailto:",
		"216.54.14.90",
		"vbcps.com",
		"vbschools.com",
		"vbcps.net",
		"vbcps.k12.va.us",
		"amcda122816",
		"10.91.24.30",
		"64.5.130.50",
		"mms://streaming.whro.net:80/vbcps",
		"192.168.1.103",
		"vbef.org",
		"vbatc.com",
		"http://wmstreaming.whro.org/vbschools",
		"http://mediastream.whro.org/vbcps",
		"http://wmstreaming.whro.org/vbgov",
		"https://www.vbschools-census.org/login.asp",
		"http://www.vdoe.whro.org/",
		"http://dev.searchsoft.net/ats/app_login?COMPANY_ID=00012691",
		"https://vbschools.hrvlc.org/",
		"https://ats3.searchsoft.net/ats/trans_login?COMPANY_ID=00012691",
		"https://ats3.searchsoft.net/ats/app_login?COMPANY_ID=00012691",
		"https://vbschools.schoolnet.com/Authentication.aspx?mode=login",
		"https://vbparents.net/Login.aspx?ReturnUrl=%2fRegister.aspx",
		"http://sites.americomm.net/vbcps/",
		"javascript:");
	
	for(var i=0; i < document.links.length; i++) {
		url = document.links[i].href;
		bolChange = true;
		for(var u=0; u < acc.length; u++) {
			if(document.links[i].href.indexOf(acc[u]) > -1) {
				bolChange = false;
				break;
			}
		}
		if(bolChange) {
			document.links[i].onclick = ext_link;
		}
	}
}

function alternateCols(tableId) {
	var t = document.getElementById(tableId);
	for (var r = 0; r < t.rows.length; r++) {
		for (var c = 0; c < t.rows[r].cells.length; c++) {
			if(c % 2 == 1) {
				t.rows[r].cells[c].bgColor = "#FFFF99";
			}
		}
	}
}

function alternateColors(tableId) {
	var t = document.getElementById(tableId);
	t.cellSpacing = 0;
	for (var i = 0; i < t.rows.length; i++) {
		if (i % 2 == 1) {
			t.rows[i].bgColor = "#FFFF99";
		}
		for (var c = 0; c < t.rows[i].cells.length; c++) {
			t.rows[i].cells[c].style.paddingLeft = "5px";
		}
	}
}

function autoAlternate() {
	if(document.getElementsByTagName && document.getElementById) {
		var tables = document.getElementsByTagName("table");
		for(var i = 0; i < tables.length; i++) {
			if(tables[i].id) {
				alternateColors(tables[i].id);
			}
		}
	}
}


/**
 * balanceTables and applyBalance added 09092006.
 * Searches for tables wtih classname `balance' and
 * automatically turns the table into a balanced,
 * two column table.
 */
function balanceTables()
{
	var tables = document.getElementsByTagName('TABLE');
	for(var i = 0; i < tables.length; i++)
	{
		if(tables[i].className == 'balance')
		{
			applyBalance(tables[i]);
		}
	}
}

function applyBalance(t)
{
	var arrTr = t.getElementsByTagName('TR');
	var intBottomRow = arrTr.length - 1;
	var intBottomCol = Math.round((arrTr.length - 1) / 2);
	for(var r = intBottomRow; r > intBottomCol; r--)
	{
		var arrTd = arrTr[r].getElementsByTagName('TD');
		var lastChild = null;
		for(var d = arrTd.length - 1; d >= 0; d--)
		{
			var child = arrTr[r].removeChild(arrTd[d]);
			arrTr[r-intBottomCol-1].insertBefore(child, lastChild);
			lastChild = child;
		}
	}
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function bodyLoad() {
	checkLinks();
	autoAlternate();
}

function changePage(sel) {
	if(sel.value) {
		window.location.href = sel.value;
	}
}

// Thanks to http://homepage.ntlworld.com/bobosola/index.htm for providing the PNG transparency solution
function correctPNG() { // correctly handle PNG transparency in Win IE 5.5 or higher.
	for(var i=0; i<document.images.length; i++) {
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
			var imgID = (img.id) ? "id='" + img.id + "' " : ""
			var imgClass = (img.className) ? "class='" + img.className + "' " : ""
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			var imgStyle = "display:inline-block;" + img.style.cssText 
			var imgMouseOver = (img.onmouseover) ? "onMouseOver=\""+img.onmouseover+"\" " : "";
			var imgMouseOut = (img.onmouseout) ? "onMouseOut=\""+img.onmouseout+"\" " : "";
			var imgMouseDown = (img.onmousedown) ? "onMouseDown=\""+img.onmousedown+"\" " : "";
			if (img.align == "left") imgStyle = "float:left;" + imgStyle
			if (img.align == "right") imgStyle = "float:right;" + imgStyle
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
			var strNewHTML = "<span " + imgID + imgClass + imgTitle
			+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
			img.outerHTML = strNewHTML
			i = i-1
		}
	}
}
if(navigator.userAgent.indexOf("MSIE") > -1) {
	window.attachEvent("onload", correctPNG);
}
// end correctPNG() fun

//For alternating table rows Give the table a class name of skip :)


