/* 

Atlantic BT base scripts

*/




// This takes care of those ugly dotted borders that show up when you click on a link
var theahrefs = document.getElementsByTagName('a');
//fix dotted line thing when link is OnClicked
for(var x=0;x!=theahrefs.length;x++){
	theahrefs[x].onfocus = function stopLinkFocus(){this.hideFocus=true;};
}
//a:focus { -moz-outline-style: none; }   <-- this is found in the moz.css file to take care of firefox




// Scripts found at knover.com
function hide_display(id) {
	if (document.getElementById(id).style.display == "block") {
		//document.getElementById(id).style.display = "none";
		//setTimeout("document.getElementById("+id+").style.display = 'none'",1000);
		document.getElementById(id).style.display = 'none';
	} else {
		document.getElementById(id).style.display = "block";	
		
	}
}

function delay_hide(id) {
	setTimeout("hide_display("+id+")", 1800);
}

//put this on mouseover state
function show_P(id) {
	document.getElementById(id).style.display = "block";
}
//put this on mouseout state
function hide_P(id) {
	/*The timeout number is the 5000 at the end below.  It is in milliseconds*/
	setTimeout("document.getElementById("+id+").style.display = 'none'", 1800);	
}
// End knover scripts




// MM script
function showHideDiv() {
  var i,p,v,obj,args=showHideDiv.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}


// older scripts
function navmouseover(el) {
	el.style.backgroundColor = "#e0e4ea"
}

function navmouseout(el) {
	el.style.backgroundColor = ""
}

function showInfo(el) {
	el.style.display = "block"
}
// end older scripts




/* code by Chris Heilmann, evolt.org/trackback/60273 */
function hidem()
{
			for (var i=0;i<getElementsByClassName(document,'info_block').length;i++)
			{
				getElementsByClassName(document,'info_block')[i].style.display='none';
			}
}
/* end Chris' code */



/* code by Marius Kreis, www.nulldevice.org */
function gitteran(spalte, zeile, verz)
	{
	  //document.images[verz].src="bilder/pfeilvonoben.gif";
	  document.images["spalte" + spalte].src="bilder/pixelorange.gif";
	  document.images["zeile" + zeile].src="bilder/pixelorange.gif";
	}
	
function gitteraus(spalte, zeile, verz)
	{
	  //document.images[verz].src="bilder/pixeltransparent.gif";
	  document.images["spalte" + spalte].src="bilder/pixeltransparent.gif";
	  document.images["zeile" + zeile].src="bilder/pixeltransparent.gif";
	}
/* end nulldevice code */




/* Date Scripts */
function write_date()
{
	var curdate = new Date();
	dstring = curdate.toGMTString();
	document.write(dstring);
}


function write_date2()
{
var thetime=new Date();

var nday=thetime.getDay();
var nmonth=thetime.getMonth();
var ntoday=thetime.getDate();
var nyear=thetime.getYear();
var ntime=thetime.getTime();
var AorP=" ";

if (nday==0)
  nday="Sun";
if (nday==1)
  nday="Mon";
if (nday==2)
  nday="Tue";
if (nday==3)
  nday="Wed";
if (nday==4)
  nday="Thu";
if (nday==5)
  nday="Fri";
if (nday==6)
  nday="Sat";

if (nmonth==0)
  nmonth="Jan";
if (nmonth==1)
  nmonth="Feb";
if (nmonth==2)
  nmonth="Mar";
if (nmonth==3)
  nmonth="Apr";
if (nmonth==4)
  nmonth="May";
if (nday==5)
  nmonth="Jun";
if (nmonth==6)
  nmonth="Jul";
if (nmonth==7)
  nmonth="Aug";
if (nmonth==8)
  nmonth="Sept";
if (nmonth==9)
  nmonth="Oct";
if (nmonth==10)
  nmonth="Nov";
if (nmonth==11)
  nmonth="Dec";

if (nyear<=99)
  nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
 nyear+=1900;

document.write(""+nday+" "+nmonth+" "+ntoday+" "+nyear+" "+ntime+" EDT");

}
/* End Dates */




// Email.js version 5
var tld_ = new Array()
tld_[0] = "com";
tld_[1] = "org";
tld_[2] = "net";
tld_[3] = "ws";
tld_[4] = "info";
tld_[10] = "co.uk";
tld_[11] = "org.uk";
tld_[12] = "gov.uk";
tld_[13] = "ac.uk";
var topDom_ = 13;
var m_ = "mailto:";
var a_ = "@";
var d_ = ".";

function mail(name, dom, tl, params)
{
	var s = e(name,dom,tl);
	document.write('<a href="'+m_+s+params+'">'+s+'</a>');
}
function mail2(name, dom, tl, params, display)
{
	document.write('<a href="'+m_+e(name,dom,tl)+params+'">'+display+'</a>');
}
function e(name, dom, tl)
{
	var s = name+a_;
	if (tl!=-2)
	{
		s+= dom;
		if (tl>=0)
			s+= d_+tld_[tl];
	}
	else
		s+= swapper(dom);
	return s;
}
function swapper(d)
{
	var s = "";
	for (var i=0; i<d.length; i+=2)
		if (i+1==d.length)
			s+= d.charAt(i)
		else
			s+= d.charAt(i+1)+d.charAt(i);
	return s.replace(/\?/g,'.');
}





function showhidediv(el,img) {
	
	e = document.getElementById(el);
	i = document.getElementById(img);
	
	if (e.style.display == "none") {
		e.style.display = "block";
		i.src = "/images/i_minus.gif";
	} else {
		e.style.display = "none";
		i.src = "/images/i_plus.gif";
	}
}



function P7_hideSelect(a){ //v1.0 by PVII
  var g,h=(a==1)?"hidden":"visible";
  if(document.getElementsByTagName){
  g=document.getElementsByTagName("select");
  if(g){for(var i=0;i<g.length;i++){
  g[i].style.visibility=h;}}}
  }
  
  
function SubmitForm()
{
	document.forms[0].submit();
}

function DoPostBack(Arg)
{
	document.forms[0].Arg.value = Arg;
	document.forms[0].submit();
}



	/*
    Written by Jonathan Snook, http://www.snook.ca/jonathan
    Add-ons by Robert Nyman, http://www.robertnyman.com
	*/
	
	function getElementsByClassName(oElm, strTagName, strClassName){
		var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
		var arrReturnElements = new Array();
		strClassName = strClassName.replace(/\-/g, "\\-");
		var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
		var oElement;
		for(var i=0; i<arrElements.length; i++){
			oElement = arrElements[i];      
			if(oRegExp.test(oElement.className)){
				arrReturnElements.push(oElement);
			}   
		}
		return (arrReturnElements)
	}
	
	
	
// Print //

function printThis() {
	if (window.print) {
		window.print()
	}
	else
	{
		alert('To print his page press Ctrl-P on your keyboard \nor choose print from your browser or device after clicking OK');
	}
}
	
	
// By Matt Read (http://mattread.com/archives/2005/10/faking-two-column-text/) //	

// --- Event Handler Functions --- //
// from: http://www.scottandrew.com/weblog/articles/cbs-events
function addEvent(obj, evType, fn, useCapture) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, useCapture);
		return true;
	}
	else if (obj.attachEvent) {
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	}
	else
		alert("Handler could not be attached");
}

function removeEvent(obj, evType, fn, useCapture) {
	if (obj.removeEventListener) {
		obj.removeEventListener(evType, fn, useCapture);
		return true;
	}
	else if (obj.detachEvent) {
		var r = obj.detachEvent("on"+evType, fn);
		return r;
	}
	else
		alert("Handler could not be removed");
}

// Other functions //
function $(id) {
	return document.getElementById(id);
}

function $2(id) {
	return document.getElementsByClassName(document.all,'*',id);
}

function $tags(name) {
	return document.getElementsByTagName(name);
}

function $new(type, id) {
	var element = document.createElement(type);
	if (id) element.id = id;
	return element;
}

function $text(text) {
	return document.createTextNode(text);
}
	
	// --- two column function --- //
function twoCol() {
	// TODO: not split up tags
	
	// Check for the two-col element.
	if ($('two-col')) {
		// Grab the two-col element and create
		// the two new column elemets. As well
		// as a "clearer" element.
		var twoCol = $('two-col');
		var rightCol = $new('div');
			rightCol.setAttribute("style", "float:right;width:48%;");
		var leftCol = $new('div');
			leftCol.setAttribute("style", "float:left;width:48%;");
		var clearCol = $new('br');
			clearCol.setAttribute("style", "clear:both;");
		
		// Split the words into two columns
		var leftWords = new String();
		var rightWords = new String();
		var ogHTML = twoCol.innerHTML;
		var words = ogHTML.split(' ');
		for (var i=0; i<words.length; i++) {
			if ( i < (words.length/2) )
				leftWords += words[i] +' ';
			else
				rightWords += words[i] +' ';
		}
		
		leftCol.innerHTML = leftWords +"</p>";
		rightCol.innerHTML = "<p>"+ rightWords;
		
		twoCol.innerHTML = '';
		twoCol.appendChild(leftCol);
		twoCol.appendChild(rightCol);
		twoCol.appendChild(clearCol);
	}
	return;
}

addEvent(window, "load", twoCol);