/* ***********************************************************************************

This file contains the functions specific to the locmap results/print templates
Should always be included after the common file as well as the insert script tag.

**************************************************************************************** */


//function used to output the hidden fields of a location into a form.
//parameter is the location to output the hidden properties for
function mqOutputLocHidden(loc) {
   if(mq_ParamExists(loc.recordId) && loc.recordId.length)
      document.write("<input type=\"hidden\" name=\"recordId\" value=\"" + loc.recordId + "\">");
   
   if(mq_ParamExists(loc.name) && loc.name.length)
      document.write("<input type=\"hidden\" name=\"name\" value=\"" + loc.name + "\">");
   
   if(mq_ParamExists(loc.address) && loc.address.length)
      document.write("<input type=\"hidden\" name=\"address\" value=\"" + loc.address + "\">");

   if(mq_ParamExists(loc.city) && loc.city.length)
      document.write("<input type=\"hidden\" name=\"city\" value=\"" + loc.city + "\">");
   
   if(mq_ParamExists(loc.stateProvince) && loc.stateProvince.length)
      document.write("<input type=\"hidden\" name=\"stateProvince\" value=\"" + loc.stateProvince + "\">");

   if(mq_ParamExists(loc.postalCode) && loc.postalCode.length)
      document.write("<input type=\"hidden\" name=\"postalCode\" value=\"" + loc.postalCode + "\">");

   if(mq_ParamExists(loc.country) && loc.country.length)
      document.write("<input type=\"hidden\" name=\"country\" value=\"" + loc.country + "\" ID=\"PrintHidden12\">");

   if(mq_ParamExists(loc.iconId) && loc.iconId.length)
      document.write("<input type=\"hidden\" name=\"iconId\" value=\"" + loc.iconId + "\">");

   if(mq_ParamExists(loc.latitude) && loc.latitude.length > 0)
      document.write("<input type=\"hidden\" name=\"latitude\" value=\"" + loc.latitude + "\">");

   if(mq_ParamExists(loc.longitude) && loc.longitude.length > 0)
      document.write("<input type=\"hidden\" name=\"longitude\" value=\"" + loc.longitude + "\">");
}//end //function used to output the hidden fields of a location into a form.

//function used to generate hidden values necessary for form submittal to the print results page
//used by map-results.htm
//parameter - parameters object of advantage response
//map - map object to use to display the map for the print page
//loc - the location object containing the address info to display on the print page
function mq_output_print_hidden(parameters, map, loc) {
   if(!mq_ParamExists(parameters) || !mq_ParamExists(map) || !mq_ParamExists(loc))
      return;

   document.write("<input type=\"hidden\" name=\"imageQuality\" value=\"print\" ID=\"PrintHidden1\">");
   document.write("<input type=\"hidden\" name=\"pheight\" value=\"672\" ID=\"PrintHidden2\">");
   document.write("<input type=\"hidden\" name=\"pwidth\" value=\"672\" ID=\"PrintHidden3\">");
   document.write("<input type=\"hidden\" name=\"template\" value=\"map-print\" ID=\"PrintHidden13\">");
   document.write("<input type=\"hidden\" name=\"dupSession\" value=\"1\" ID=\"PrintHidden13\">");
    document.write("<input type=\"hidden\" name=\"revertState\"  id=\"revertState\"  value=\"0\"/>");
   
    if(document.getElementById("orgZoomLevel").value !="")
      {
         var zoomvalue= document.getElementById("orgZoomLevel").value;
         document.write("<input type=\"hidden\" name=\"orgZoomLevel\"  id=\"orgZoomLevel\"  value=\"" + zoomvalue +"\"  >");
   }  
   
   if(mq_ParamExists(parameters.transaction) && parameters.transaction.length)
      document.write("<input type=\"hidden\" name=\"transaction\" value=\"" + av.parameters.transaction +"\" ID=\"PrintHidden4\">");
   

   if(mq_ParamExists(map.mapSessionId) && map.mapSessionId.length)
      document.write("<input type=\"hidden\" name=\"mapSessionId\" value=\"" + map.mapSessionId + "\" ID=\"mapSessionId\">");
   
   mqOutputLocHidden(loc);
}// end function mq_output_print_hidden(av) {


//function used to generate hidden values necessary for returning from the print results page
//used by map-print.htm
//parameter - parameters object of advantage response
//map - map object to use to display the map for the print page
//loc - the location object containing the address info to display on the print page
function mq_output_back_hidden(parameters, map, loc) {
   document.write("<input type=\"hidden\" name=\"pheight\" value=\"324\" ID=\"BackHidden2\">");
   document.write("<input type=\"hidden\" name=\"pwidth\" value=\"504\" ID=\"BackHidden3\">");

   if(mq_ParamExists(parameters.transaction) && parameters.transaction.length)
      document.write("<input type=\"hidden\" name=\"transaction\" value=\"" + av.parameters.transaction +"\" ID=\"BackHidden4\">");
   
   if(mq_ParamExists(parameters.revertState) && parameters.revertState.length)
      document.write("<input type=\"hidden\" name=\"revertState\" value=\"" + av.parameters.revertState +"\" ID=\"revertState\">");
   
   if(mq_ParamExists(parameters.clickSet) && parameters.clickSet.length)
      document.write("<input type=\"hidden\" name=\"clickSet\" value=\"" + av.parameters.clickSet +"\" ID=\"clickSet\">");
   if(mq_ParamExists(parameters.mapBrowse) && parameters.mapBrowse.length)
      document.write("<input type=\"hidden\" name=\"mapBrowse\" value=\"" + av.parameters.mapBrowse +"\" ID=\"mapBrowse\">");
   
   if(mq_ParamExists(parameters.mapSessionId) && parameters.mapSessionId.length)
      document.write("<input type=\"hidden\" name=\"mapSessionId\" value=\"" + parameters.mapSessionId + "\" ID=\"mapSessionId\">");
   document.write("<input type=\"hidden\" name=\"orgZoomLevel\" value=\"" + parameters.orgZoomLevel + "\" ID=\"orgZoomLevel\">");
   
   mqOutputLocHidden(loc);
}//end function mq_output_back_hidden(parameters, map, loc) {
