﻿
function CloseIE6Box() {
    document.getElementById('IE6NoMoreBox').style.display = 'none';
}



function WinWidth() {
    var myWidth = 0;
    if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth - 10;
}

function WinHeight() {
  var myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight - 10;
}

function GetPageHeight() {
    if(window.innerHeight && window.scrollMaxY) {
    // Firefox 
        pageHeight = window.innerHeight + window.scrollMaxY;
    } else if( document.body.scrollHeight > document.body.offsetHeight ) {
     // all but Explorer Mac
        pageHeight = document.body.scrollHeight;
    } else {
        // works in Explorer 6 Strict, Mozilla (not FF) and Safari
        pageHeight = document.body.offsetHeight + document.body.offsetTop; 
    }
    return pageHeight;
}

function ViewPolicy() {
    window.open("/StaticHTML/RefundPolicy.html","Window1", "scrollbars=yes,menubar=no,width=430,height=450,toolbar=no,screenX=200,screenY=200,top=200,left=200'");
}

function ViewTCs() {
    window.open("/StaticHTML/TermsAndConditions.html","Window1", "scrollbars=yes,menubar=no,width=430,height=450,toolbar=no,screenX=200,screenY=200,top=200,left=200'");
}


function ChangeTransparencyState(state) {
    var TransparencyHolder = document.getElementById("TransparencyHolder");

    if (state==1) {
        TransparencyHolder.style.height=GetPageHeight() + 'px';
        TransparencyHolder.style.display="block";
    } else {
        TransparencyHolder.style.height='0px';
        TransparencyHolder.style.display="none"; 
    }
}

function PrintStage() {
   window.print()
}

function SwitchCursor(ispointer) {
    if (ispointer==1) {
        document.body.style.cursor="pointer";
    } else {
        document.body.style.cursor="default";
    }
}

function OpenMap_Tracker(RegNo) {
    window.open('../Walk/GIS/DistanceTracker.aspx?m=2&regno=' + RegNo,'Mapping_Utility','width=965,height=595,toolbar=0,resizable=0');
}

function OpenMap_Route(Stage) {
    window.open('../../../Walk/GIS/DistanceTracker.aspx?m=1&es=' + Stage,'Mapping_Utility','width=965,height=595,toolbar=0,resizable=0');
}



function findPos(obj, dimen) {
	var curleft = curtop = 0;
    if (obj.offsetParent) {
        do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
        } while (obj = obj.offsetParent);
        
        if (dimen=="left") {
            return curleft;
        } else {
            return curtop;
        }
    }
}

function IsNumeric(sText) {
    var ValidChars = "0123456789";
    var IsNumber=true;
    var Char;

    for (i = 0; i < sText.length && IsNumber == true; i++) { 
        Char = sText.charAt(i); 
        if (ValidChars.indexOf(Char) == -1) {
            IsNumber = false;
        }
    }            
    return IsNumber;
}

function StripChildElements(node) {
    if (node.hasChildNodes()) {
        while (node.childNodes.length >= 1)  {
            node.removeChild(node.firstChild);       
        } 
    }
}