// new window js eg. displaying the office, displaying the origin/destination place lists etc
function SpawnWindow_focus(baseurl, x, y, scrollbars) {
   var url = baseurl + "&x=" + x + "&y=" + y;
   var ht = y;
   var wd = x;
   var options = "status=no,toolbar=no,menubar=no,scrollbars=" + scrollbars +",resizable=yes,width=" + wd + ",height=" + ht;
   imgWindow=window.open(url,"",options);
   imgWindow.focus();
}

// new window for pop up images
function DisplayImage(baseurl, x, y) {
   var url = baseurl + "&x=" + x + "&y=" + y;
   var ht = y-5;
   var wd = x-5;
   var options = "toolbar=no,menubar=no,scrollbars=no,resizable=yes,width=" + wd + ",height=" + ht;
   imgWindow=window.open(url,"",options);
   imgWindow.focus();
}


// js to populate the origin and destination fields from the pop-up page of places
function PopulatePlace(placeID, placeName, placeType){
    if (placeType=='origin') {
        opener.document.forms.servicesForm.elements.origin.value = placeID;
        opener.document.forms.servicesForm.elements.origin_name.value = placeName;
    }
    if (placeType=='destination') {
        opener.document.forms.servicesForm.elements.destination.value = placeID;
        opener.document.forms.servicesForm.elements.destination_name.value = placeName;
    }
    window.close();
    opener.focus();
}
// js to populate the origin field from the drop-down select box when user types in the origin input box
function PopulateOrigin(originID, originName){
    document.forms.servicesForm.elements.origin.value = originID;
    document.forms.servicesForm.elements.origin_name.value = originName;
}
// js to populate the destination field from the drop-down select box when user types in the destination input box
function PopulateDestination(destinationID, destinationName){
    document.forms.servicesForm.elements.destination.value = destinationID;
    document.forms.servicesForm.elements.destination_name.value = destinationName;
}
// js to populate the company field from the drop-down select box when user types in the company name input box
function PopulateCompany(companyID, companyName){
    document.forms.servicesForm.elements.company.value = companyID;
    document.forms.servicesForm.elements.company_name.value = companyName;
}

// js to toggle an element display on and off;
function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}




