<!--//--><![CDATA[//><!--
function formfocus(obj){
    if (document.getElementById(obj).name=='CIRestriction'){
    document.getElementById(obj).value='';
   }
   else if(document.getElementById(obj).name=='b'){
    document.getElementById(obj).value='';
   }
   else if(document.getElementById(obj).name=='e'){
    document.getElementById(obj).value='';
   }
}

function formunfocus(obj){
    if(document.getElementById(obj).name=='CIRestriction' && document.getElementById(obj).value==''){
   document.getElementById(obj).value='Search';
   }
   else if(document.getElementById(obj).name=='b' && document.getElementById(obj).value==''){
   document.getElementById(obj).value='Departure point';
   } 
   else if(document.getElementById(obj).name=='e' && document.getElementById(obj).value==''){
   document.getElementById(obj).value='Destination';
   } 
}

function CheckForTags()
{
var theForm;
var Valid;
var i;

	Valid = true;
	theForm = document.feedbackform;
	/*  block any attempt to send HTML through the form */

	for (i=0;i < theForm.elements.length;i++)
	{
	 if (theForm.elements[i].value.indexOf("<") != -1)
	 {
	  Valid = false;
	 }
	 if (theForm.elements[i].value.indexOf(">") != -1)
	 {
	   Valid = false;
	 }	
	}
	
	if (Valid)
	{
	 ValidateForm();
	}
	else
	{
	 alert("You cannot use the characters '<' or '>' \n Please remove these and re-submit.");
	}
	
	return false;
}

function ValidateForm()
{
var ErrMessage;
var theForm;
var Valid;

	Valid = true;
	theForm = document.feedbackform;
	ErrMessage = "The details you have supplied are insufficient. \n";
	ErrMessage = ErrMessage + "You must provide valid information for \n";
	
	/* First Name */
	if (theForm.firstname.value.length < 1)
	{
		Valid = false;
		ErrMessage = ErrMessage + "First Name(s) \n";
	}
	
	/* Surname */
	if (theForm.surname.value.length < 1)
	{
		Valid = false;
		ErrMessage = ErrMessage + "Surname \n"; 
	}
	
	/* Email */
	if (theForm.email.value.length < 1)
	{
		Valid = false;
		ErrMessage = ErrMessage + "Email Address \n"; 
	}
	
	/* Title */
	if (Valid)
	{
	 Valid = false;
	 for(n=0;n<theForm.title.length;n++)
	 {
	  if(theForm.title[n].checked)
	  {
	   Valid = true;
	  }
	 }
	 if(!Valid)
	 {
	  ErrMessage = "You must specify your title. (Mr/Ms etc.) \n";
	 }
	}
	
	if (Valid)
	{
	theForm.submit();
	}
	else
	{
	 alert(ErrMessage);
	}
}

var timerID = null
var timerRunning = false

function stopClock(){
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function startClock(){
    stopClock()
    showTime()
}

function showTime(){
    if(document.getElementById("homepage_news_content"))
{
    var month_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec");
    var now = new Date()
    var month = now.getMonth()
    var day = now.getDate()
    var year = now.getFullYear()
    var hours = now.getHours()
    var minutes = now.getMinutes()
    var seconds = now.getSeconds()
    var timeValue = "" + ((hours > 12) ? hours - 12 : hours)
    timeValue  += ((minutes < 10) ? ":0" : ":") + minutes
    timeValue  += ((seconds < 10) ? ":0" : ":") + seconds
    timeValue  += (hours >= 12) ? " PM" : " AM"
    document.getElementById("running_clock").firstChild.nodeValue = timeValue 
    timerID = setTimeout("showTime()",1000)
    timerRunning = true
}
}

function showDate()
{
if(document.getElementById("site_date"))
{
var myDays= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
var month_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec");
    var now = new Date()
    var month = month_names[now.getMonth()]
    var day = now.getDate()
    var full_day = myDays[now.getDay()]
    var year = now.getFullYear()
var shortYear = year.toString()
shortYear = shortYear.substring(2)
    return (full_day + " " + day + " " + month + " " + shortYear)
}
}


function showNews(type){
if(document.getElementById("homepage_news_content"))
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
document.getElementById("homepage_news_content").innerHTML = '<h3>Latest News</h3><div id="homepage_news_section"><p>Get all the latest travel news from Translink at: <a href="http:\/\/www.translink.co.uk/latesttravelnews.asp" title="Get all the latest travel news from Translink">www.translink.co.uk/latesttravelnews.asp<\/a> &raquo;</p></div>'
} 
else
{
var url;
url="dcincludes/getTransportNews.asp";
url=url+"?q="+type+"&c=travel";
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}
}
function GetXmlHttpObject(){
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e){
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

function stateChanged(){
if (xmlHttp.readyState==4){
document.getElementById("homepage_news_content").innerHTML=xmlHttp.responseText;
}
}
//--><!]]>
<!--
function PopupCenter(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 
//-->