var xmlhttp;

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("displayHere").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
  
function openDiv(thisId) {
	if(document.getElementById(thisId).style.display==""){
SlideClosed(thisId);
	}
	else{
document.getElementById(thisId).style.display="none";
SlideOpen(thisId);
}
}


function selectColour(obj){
xmlHttp=GetXmlHttpObject();
var url="/resource/working/setColour.asp";
url=url+"?col="+obj;
document.location.href=url;
}

function setSize(obj){
xmlHttp=GetXmlHttpObject();
var url="/resource/working/setSize.asp";
url=url+"?sz="+obj;
document.location.href=url;
}

function setFont(obj){
//xmlHttp=GetXmlHttpObject();
//var url="/resource/working/setFont.asp";
//url=url+"?ft="+obj;
//document.location.href=url;
alert("The set font function has been disabled for the MCL website");
}

function refresh(){
document.location.href="/template.asp"
}

function getWidth(){
var x,y;
if (self.innerHeight) // all except Explorer
{
	x = self.innerWidth;
	y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
{
	x = document.documentElement.clientWidth;
	y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
	x = document.body.clientWidth;
	y = document.body.clientHeight;
}
return x;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function sendContactForm(){

var thisLot;
thisLot =  "inam=" + encodeURIComponent(document.forms[0].inam.value);
thisLot = thisLot + "&iadd=" + encodeURIComponent(document.forms[0].iadd.value);
thisLot = thisLot + "&itow=" + encodeURIComponent(document.forms[0].itow.value);
thisLot = thisLot + "&icou=" + encodeURIComponent(document.forms[0].icou.value);
thisLot = thisLot + "&ipos=" + encodeURIComponent(document.forms[0].ipos.value);
thisLot = thisLot + "&itel=" + encodeURIComponent(document.forms[0].itel.value);
thisLot = thisLot + "&iema=" + encodeURIComponent(document.forms[0].iema.value);
thisLot = thisLot + "&imes=" + encodeURIComponent(document.forms[0].imes.value);
//alert(thisLot);

var result = "&nbsp<b>Required</b>&nbsp";
document.getElementById('snam').innerHTML = "";
document.getElementById('stow').innerHTML = "";
document.getElementById('stel').innerHTML = "";
document.getElementById('sema').innerHTML = "";
document.getElementById('smes').innerHTML = "";

if(document.forms[0].inam.value==""){
document.getElementById('snam').innerHTML = result;
return;
}
if(document.forms[0].itow.value==""){
document.getElementById('stow').innerHTML = result;
return;
}
if(document.forms[0].itel.value==""){
document.getElementById('stel').innerHTML = result;
return;
}
if(document.forms[0].iema.value==""){
document.getElementById('sema').innerHTML = result;
return;
}
if(document.forms[0].imes.value==""){
document.getElementById('smes').innerHTML = result;
return;
}

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/sendMessage.asp";
xmlHttp.onreadystatechange = messageResponse;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}


function messageResponse() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            document.getElementById('thanksHere').innerHTML = xmlHttp.responseText;         
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }

function goNow(){
var sX = findPosX(document.getElementById('stickHere'));
var sY = findPosY(document.getElementById('stickHere')); 
var obj = document.getElementById('shadowHere');
obj.style.position="absolute";
//obj.style.zindex=1;
sX+=282;
obj.style.left=sX + "px";
obj.style.top=sY + "px";

}

function fireText(obj){
var thisText;
if(obj==1){
thisText="<b>Secure Web Portal</b><br>This provides complete visibility of the movement of people and goods by displaying the real-time business information through straightforward user interfaces which can be interacted with by operators and managers to control the workflow.<br><br><b>Click for Features Overview</b>";
}
if(obj==2){
thisText="<b>On the Road</b><br>The Houndit mobile framework provides the delivery driver with everything that is needed to make deliveries, collect/return items and manage exceptions. Customise-able instructions are clear, simple and available in any language on the touch-screen which operates through finger-tip control on a choice of devices.<br><br><b>Click for Features Overview</b>";
}
if(obj==3){
thisText="<b>In the Depot</b><br>The depot system is fully integrated with the on the road process. The depot operators are provided with everything they need to manage the tracking and movement of items as they move through the depot; from receipting to dispatch, and including loading, storing and finding your critical items. This gives full visibility and control of the in depot operations.<br><br><b>Click for Features Overview</b>";
}
if(obj==4){
thisText="<b>Interface Hub</b><br>This is designed to flexibly fulfill the requirements of a multi-partner system. It has the capability of supporting multichannel interfaces receiving pre-advice and returning tracking data. In addition to the standard XML and delimited file imports we have existing interfaces with FedEx, Parcelforce, Royal Mail, UKMail (Business Post), DHL and HDNL.";
}
if(obj==5){
thisText="<b>Tracking System Core</b><br>The core system is purpose built to manage high volumes of tracking data which it securely feeds from your own and your partners' (or customers') systems and translates into essential business information. It is configured to your unique business requirements, which means that the comprehensive management reporting is accurate and relevant, giving you complete control of your delivery operations.<br><br><b>Click for Features Overview</b>";
}
document.getElementById("displayDescHere").innerHTML=thisText;
}

function closeText(){
//document.getElementById("displayDescHere").innerHTML="";
}


function showList(obj){
//document.getElementById('divThis').style.display='';
//document.getElementById('apDiv1').style.display='';
//document.body.scroll="no";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/resource/working/popBox.asp";
url=url+"?id="+obj+"&$=" +new Date().getTime();;
xmlHttp.onreadystatechange=displayPop;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function getTechnical(obj){
//document.getElementById('divThis').style.display='';
//document.getElementById('apDiv1').style.display='';
//document.body.scroll="no";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/resource/working/popBox2.asp";
url=url+"?id="+obj+"&$=" +new Date().getTime();;
xmlHttp.onreadystatechange=displayPop;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function displayPop() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("displayDescHere").innerHTML=xmlHttp.responseText;
//resetAll();
}
else {
document.getElementById("displayDescHere").innerHTML="<center><img src=/resource/graphics/loader.gif></center>";
}
}

function closePop(){
document.getElementById('divThis').style.display='none';
document.getElementById('apDiv1').style.display='none';
document.body.scroll="yes";
}