function ContactUsFormSubmit()
{
	var o = document.ContactUs;
	if((o.sn.value != "") && (o.se.value != "") && (o.state.selectedIndex > 0) && (o.zip.value != ""))
	{
		o.submit();
	}else
	{
		document.getElementById("errorMsg").style.visibility="";
	}
}
function StoreLocaterFormSubmit()
{
	var o = document.StoreLocator;
	//if((o.Zipcode.value != "") && (o.State.value != ""))
	if ((o.State.value != "") || ((o.Zipcode.value != "") && (o.Distance.value !="")))
	{
		o.submit();
	}else
	{
		document.getElementById("errorMsg").style.visibility="";
		document.getElementById("errorMsg").style.display="";
	}
}

/* GOOGLE MAP */
function createLine(nStartLatitude, nStartLongitude, nStopLatitude, nStopLongitude, cColor, nWidth){
   var polyline = new GPolyline([
       new GLatLng(nStartLatitude, nStartLongitude),
       new GLatLng(nStopLatitude, nStopLongitude)
       ], cColor, nWidth);
   return polyline;
}
function createMarker(nLatitude, nLongitude, windowText){
   var point = new GLatLng(nLatitude, nLongitude);
   var marker = new GMarker(point);
   GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml(windowText);
   });
   return marker;
}
function addPoint(oMap, nLatitude, nLongitude, windowText){
   var oMarker = createMarker(nLatitude, nLongitude, windowText);
   oMap.addOverlay(oMarker);
}
function addMarker(oMap, oMarker){
	oMap.addOverlay(oMarker);
}
function clearMap(oMap){
	oMap.clearOverlays();
}
function setMap(oMap, oData, cType){
	oMap.clearOverlays();
	if (oData.ItemCount > 0){
		var bounds = new GLatLngBounds();
		for (i=0; i < oData.ItemCount; i++){
			addPoint(oMap, oData.Item[i].Latitude, oData.Item[i].Longitude, oData.Item[i].Text);
			var point = new GLatLng(oData.Item[i].Latitude, oData.Item[i].Longitude);
			bounds.extend(point);
		}
		var centerLat = (bounds.getNorthEast().lat() + bounds.getSouthWest().lat()) / 2;
		var centerLng = (bounds.getNorthEast().lng() + bounds.getSouthWest().lng()) / 2;
		oMap.setCenter(new GLatLng(centerLat, centerLng), oMap.getBoundsZoomLevel(bounds));
		oMap.zoomOut();
	}
}

/* Ajax Function */
function CreateRequestObject() {
	if (navigator.appName == "Microsoft Internet Explorer"){
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return new XMLHttpRequest();
}
