/*
 * Common Constants and Functions
 * "included" after prototype.js
 */


var formHasBeenEdited = false;

function goTo(url) {
  if (!formHasBeenEdited || confirm("You have unsaved changes. Do you wish to leave them?"))
    window.location = url;
}

function formElementChanged() {
  formHasBeenEdited = true;
}

// Used in coordination with Date Picker
function showEnglishDate(argObj) {
  // Grab the span & get a more English-ised version of the selected date
  var spn = document.getElementById(argObj.id + "-span");
  var formattedDate = datePickerController.printFormattedDate(argObj.date, "F-sp-j-cc-sp-Y", false) + ' ';
   
  // Remove the current contents of the span
  while(spn.firstChild) spn.removeChild(spn.firstChild);
  
  // Add a new text node containing our formatted date
  spn.appendChild(document.createTextNode(formattedDate));
};

function baseUrl() {
  return 'http://autodesk.wordtext.com.ph/';
}
