function startTripMaker(){
	
	var width = 245;
	var height = 240;
	var left = parseInt((screen.availWidth/2) - (width/2));
	var top = parseInt((screen.availHeight/2) - (height/2));
    
    var browser = navigator.appName; 
    if(browser == "Microsoft Internet Explorer"){
	    document.body.style.filter = "alpha(opacity=20)";
    }else{
             document.getElementById('everyThing').style.opacity = ".2";
             if (document.getElementById('bottomFooter')){
                document.getElementById('bottomFooter').style.opacity = ".2";
             }
         }

    document.getElementById('startTripPanel').style.visibility = "visible";
    document.getElementById('startTripPanel').style.zIndex = "1";
    dd.elements.startTripPanel.moveTo(left-40,top - 160)

    if (document.getElementById('hiddenUid').value == ""){
        document.getElementById('startTripHeader').innerHTML = "Please Log In or Register!";
        document.getElementById('registerOrLogNotice').style.display = "block";
        document.getElementById('startTripLogged').style.display = "none";
    }
    else{
       //document.getElementById('contentArea').style.backgroundImage = "url(./images/planeBack.png)";
       //document.getElementById('contentArea').style.backgroundRepeat = "no-repeat";
        document.getElementById('startTripHeader').innerHTML = "Build Your Trip!";
        document.getElementById('registerOrLogNotice').style.display = "none";
        document.getElementById('startTripLogged').style.display = "block";
        document.getElementById('newTripName').focus();
    }

}

function redirectIt(){
    hideStarters();
    var f = window.location.href;
    //alert(f.length);
   
    if (f.indexOf("index.aspx") > -1 || f.indexOf(".aspx") == -1) {
        setFocus();
    }
    else{
        window.location = "index.aspx";
    
    }
}

function hideStarters(){
    hideMe('startTripPanel');
    document.getElementById('registerOrLogNotice').style.display = "none";
    document.getElementById('startTripLogged').style.display = "none";
    
}

function startMaking(){

    if (document.getElementById('newTripName').value != "" && document.getElementById('homeSetFlag').value != "N"){

        return true;
    }
    else if (document.getElementById('newTripName').value == ""){
        alert('Enter a name for your trip!');
        document.getElementById('newTripName').focus();
	    if (window.event){
	        event.returnValue=false; 
        }
         else{
		    return false;
	    }


    }
    else if (document.getElementById('homeSetFlag').value == "N"){
        alert('Please set your home location!');
	    if (window.event){
	    event.returnValue=false; 
        }
         else{
		    return false;
	        }

    }

}

function checkHome(){
  if (document.getElementById('homeText').value != ""){
        geocoder = new GClientGeocoder();    
        findLocation();

        return false;
    }
    else{
        alert('Enter your home!');
	    if (window.event){
	    event.returnValue=false; 
        }
         else{
		    return false;
	    }


    }


}
function setTheHome(response) {
 //map.clearOverlays();
 if (!response || response.Status.code != 200) {

      alert("Sorry, the location you entered could not be found.  Please try again!");
      document.getElementById('homeText').focus();


  } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
			    place.Point.coordinates[0]);

        //add coords to hidden fields to be sent to server
        document.getElementById("homeXCoord").value = place.Point.coordinates[1];
        document.getElementById("homeYCoord").value = place.Point.coordinates[0];

       document.getElementById("hiddenHome").value = place.address;
       document.getElementById("homeSetFlag").value = "Y";
       alert('Your home has been set!');

    }




}

function findLocation() { 
    var address = document.getElementById('homeText').value;
    geocoder.getLocations(address, setTheHome);
    return false;
}
