///////////////////////////////////////////////////////////////////

function Highlight(TargetName, Color){
    var target = document.getElementById(TargetName);
        target.bgColor=Color;
}
        
///////////////////////////////////////////////////////////////////

function HighlightOnEmpty(ElementName, TargetName){
    var x = document.getElementById(ElementName);
    var target = document.getElementById(TargetName);
    if (x.value === null || x.value ==  ''){
        target.style.color='red';
    }
    else{
        target.style.color='black';
    }
}

///////////////////////////////////////////////////////////////////

function HighlightOnBadZip(ElementName, TargetName){
    var x = document.getElementById(ElementName);
    var target = document.getElementById(TargetName);
	var ZipRegExp  = /(^\d{5}$)|(^\d{5}-\d{4}$)/; // 5 or 5-4

	if (!ZipRegExp.test(x.value)){
        target.style.color='red';
    }
    else{
        target.style.color='black';
    }
}

///////////////////////////////////////////////////////////////////

function HighlightOnDLLMissingValue(ElementName, TargetName){
    var x = document.getElementById(ElementName);
    var target = document.getElementById(TargetName);
    
    myindex  = x.selectedIndex;
    SelValue = x.options[myindex].value;
    
	if (SelValue === null || SelValue ==  '' || SelValue ==  'ZZ'){
        target.style.color='red';
    }
    else{
        target.style.color='black';
    }
}

///////////////////////////////////////////////////////////////////

function MatchDropDown(watch, target){
	/* GET THE WATCH VALUE */ 
	var x = document.getElementById(watch);
	var xindex  = x.selectedIndex;
	var xValue = x.options[xindex].value; 
	 
	/* MATCH THE WATCH VALUE */ 
	var y = document.getElementById(target); 
	for ( var i = 0; i < y.options.length; i++){
	if(y.options[i].value == xValue) 
		y.selectedIndex = i 
	} 
}

///////////////////////////////////////////////////////////////////

function ShowFocus(Element){
		
}

function IsNumeric(sText) { 
	//3/25/2010 JDK - Replicates IsNumeric() in VB.NET. Hard to believe there isnt a native function in JS but so sez google, this is the easiest way.
	//http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric
	return ((sText - 0) == sText && sText.length > 0);
}

function IsIe() {
	//3/25/2010 JDK - Returns true if the browser is IE
	return (document.uniqueID && window.createPopup);
}

function Unescape(Str) { //'Cause the unescape() native function SUCKS!!! (yea, and I don't care that I'm using it right now!)
	return decodeURIComponent(Str.replace(/\+/g,' ' ));
}

//  Google Maps API

function GoogleMapsAPI_GeoCodeAddress(lblAddressId) {

/*  taking this out until further notice - we will go way over the 2500 hits a day in CPP alone

    //var latlng = new google.maps.LatLng(40.708, -74.008);

	// get the address from the UI
	var lblAddress = $('#'+lblAddressId);
	if(lblAddress.length==0) alert('lbl not found');
	
    // make the request
    var geocoder = new google.maps.Geocoder();
	// create a request object
    var geocoderRequest = {
		address: lblAddress.val()
    }
    geocoder.geocode(geocoderRequest,function(results,status){
		// handle the response
			// OK - result returned
			// ZERO_RESULTS - request is good, but no results - address probably not valid
			// OVER_QUERY_LIMIT - only allowed to make 2,500 requests a day - we went over
			// REQUEST_DENIED - most common reason is the sensor parameter is missing
			// INVALID_REQUEST - something is wrong with the request
		if (status == google.maps.GeocoderStatus.OK){
		
			var myOptions = {
				zoom: 8,
				center: results[0].geometry.location,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			}
			var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
			
			// create a marker
			var marker = new google.maps.Marker({
				position: results[0].geometry.location
			});
			marker.setMap(map);
		}		
    });
*/
  }
//  Google Maps API

