// Logo Image Hover
if (document.images)
{
    pic1on= new Image(189,44);
    pic1on.src="/image/OperatingAuthorityButtonOn.png";  

    pic1off= new Image(189,44);
    pic1off.src="/image/OperatingAuthorityButtonOff.png";
    
    pic2on= new Image(86,44);
    pic2on.src="/image/USDOTButtonOn.png";  

    pic2off= new Image(86,44);
    pic2off.src="/image/USDOTButtonOff.png";
    
    pic3on= new Image(204,44);
    pic3on.src="/image/BOC-3ButtonOn.png";  

    pic3off= new Image(204,44);
    pic3off.src="/image/BOC-3ButtonOff.png";
    
    pic4on= new Image(64,44);
    pic4on.src="/image/UCRButtonOn.png";  

    pic4off= new Image(64,44);
    pic4off.src="/image/UCRButtonOff.png";
    
    pic5on= new Image(96,44);
    pic5on.src="/image/IFTAButtonOn.png";  

    pic5off= new Image(96,44);
    pic5off.src="/image/IFTAButtonOff.png";
    
    
    pic6on= new Image(86,34);
    pic6on.src="/image/NCSTSIconOff.jpg";
    
    pic7on= new Image(86,34);
    pic7on.src="/image/UCRIconOff.jpg";
    
    pic8on= new Image(86,34);
    pic8on.src="/image/NATSAIconOff.jpg";

    pic9on = new Image(86,34);
    pic9on.src="/image/TIAIconOff.png";

    pic10on = new Image(86,34);
    pic10on.src="/image/SCTAIconOff.png";
}

function lightup(imgName)
{
    if (document.images)
    {
        imgOn=eval(imgName + "on.src");
        document[imgName].src= imgOn;
    }
}

function turnoff(imgName)
{
    if (document.images)
    {
        imgOff=eval(imgName + "off.src");
        document[imgName].src= imgOff;
    }
}

function lightupMemberAff(imgName,imgDest)
{
    if (document.images)
    {
        imgOn=eval(imgDest + "on.src");
        document[imgName].src= imgOn;
    }
}

function turnoffMemberAff(imgName)
{
    if (document.images)
    {
        document[imgName].src= "/image/MemberAffHolder.png";
    }
}


// Form Input Clear - All
function RemoveSideContactName()
{
    if (document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtName").value == "Name")
    {
	document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtName").value = "";
    }
}
function AddSideContactName()
{
    if (document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtName").value != "")
    {
        
    }
    else
    {
        document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtName").value = "Name";
    }
}

function RemoveSideContactMCDOT()
{
    if (document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtMCDOT").value == "MC/DOT #")
    {
    	document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtMCDOT").value = "";
    }
}
function AddSideContactMCDOT()
{
    if (document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtMCDOT").value != "")
    {
        
    }
    else
    {
        document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtMCDOT").value = "MC/DOT #";
    }
}

function RemoveSideContactPhone()
{
    if (document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtPhone").value == "Phone")
    {
	document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtPhone").value = "";
    }
}
function AddSideContactPhone()
{
    if (document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtPhone").value != "")
    {
        
    }
    else
    {
        document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtPhone").value = "Phone";
    }
}

function RemoveSideContactEmail()
{
    if (document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtEmail").value == "Email")
    {
    	document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtEmail").value = "";
    }
}
function AddSideContactEmail()
{
    if (document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtEmail").value != "")
    {
        
    }
    else
    {
        document.getElementById("ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ChildTemplate_LG_SideContact_6_txtEmail").value = "Email";
    }
}


// Leaving Site Alert
function Leaving(address)
{
    var r = confirm("You are now leaving Logistec/TTS' web site and are going to a web site that is not operated by our company. Logistec/TTS is not responsible for the content or availability of linked sites. Please be advised that Logistec/TTS does not represent either the third party or you, the visitor, if you enter into a transaction. Further, the privacy and security policies of the linked site may differ from those practiced by Logistec/TTS.");

    if (r == true)
    {
	window.open(address);
    }
    else
    {
	alert("You have chosen not to leave Logistec/TTS' web site.");
    }
}


// Search Script
window.onload = function ()
{
    searchsetup();
}

function searchsetup ()
{
    document.getElementById("search1").style.visibility = "visible";
    document.getElementById("search1").style.height = "21px";

    document.getElementById("search2").style.visibility = "hidden";
    document.getElementById("search2").style.height = "0px";
}

function ToggleVisibility(divid)
{
    if (divid == 'search1')
    {
	document.getElementById("search1").style.visibility = "visible";
	document.getElementById("search1").style.height = "21px";
        document.getElementById("search2").style.visibility = "hidden";
	document.getElementById("search2").style.height = "0px";
    }
    else
    {
	document.getElementById("search2").style.visibility = "visible";
	document.getElementById("search2").style.height = "21px";
        document.getElementById("search1").style.visibility = "hidden";
	document.getElementById("search1").style.height = "0px";
    }
}


// Newsletter Sign Up Script
function trim(str){str = str.replace(/^\s*$/, '');return str;}
function $Npro(field){var element =  document.getElementById(field);return element;return false;}
function emailvalidation(field, errorMessage) {
	var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.mobi)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
	apos=field.value.indexOf("@");dotpos=field.value.lastIndexOf(".");lastpos=field.value.length-1;	var badEmail = (apos<1 || dotpos-apos<2 || lastpos-dotpos<2);
	if (goodEmail && !badEmail) {return true;}
	else {/*alert(errorMessage);*/$Npro("Error").innerHTML=errorMessage;$Npro("Error").style.display="inline";field.focus();field.select();return false;}
}
function emptyvalidation(entered, errorMessage) {
	$Npro("Error").innerHTML="";
	with (entered) {
	if (trim(value)==null || trim(value)=="") {/*alert(errorMessage);*/$Npro("Error").innerHTML=errorMessage;$Npro("Error").style.display="inline";return false;}
	else {return true;}} //with
}	//emptyvalidation

function formvalidation(thisform) {
with (thisform) {
if (emailvalidation(email,"Please enter your valid email address")==false) {email.focus(); return false;};

if (emptyvalidation(name,"Please enter your name")==false) {name.focus(); return false;};

if (emptyvalidation(lastname,"Please enter your last name")==false) {lastname.focus(); return false;};
 }
}


// FMCSA Search Script
(function ($) {
	$(function () {
		
		$('#fmcsa').submit(function(e) {
      var el = $('input[name=n_docketno]', this);
      var num = parseInt(el.val());
      if( (Math.floor(num) != num) || (Math.floor(num) < 0) ) {
        el.focus();
        e.preventDefault();
        return false;
      }
      return true;
    });

	

	});
})(window.jQuery);

