﻿
<!--

function MM_openBrWindow(theURL,winName,features) { 
	window.open(theURL,winName,features);
	}
	
function CloseWindow() {
	window.close(); 
}

function SelectRadioButton(radioButtonName, value)
{
    // If a radio button with the given name and value exists,
    // then make it selected.  Otherwise, make the first radio
    // button with the given name selected.

    var selectedRadioButton = null;
        
    var radioButtons = document.getElementsByName(radioButtonName);

    if (radioButtons.length > 0)
    {
        selectedRadioButton = radioButtons[0];
        
        if (value != null && value != '')
        {
            for (i = 0; i < radioButtons.length; i++)
            {
                if (radioButtons[i].value == value)
                {
                    selectedRadioButton = radioButtons[i];
                    break;
                }
            }
        }
    }
    
    if (selectedRadioButton != null)
    {
        selectedRadioButton.checked = true;
    }
    
    return selectedRadioButton;
}

function findControlID(ControlID)
{
    var ret=ControlID; 
    var inputControls = document.getElementsByTagName('input'); 
    if (inputControls) 
    {
	    for (var i=0; i< inputControls.length ; i++) 
	    { 
		    if (inputControls[i].id.lastIndexOf(ControlID) == inputControls[i].id.length - ControlID.length && inputControls[i].id.length != ControlID.length && inputControls[i].id.lastIndexOf(ControlID)  > 0 ) 
		    { 
			    ret =inputControls[i].id; 
			    break;
            } 
        } 
    };
    var tableControls = document.getElementsByTagName('table'); 
    if (tableControls) 
    {
	    for (var i=0; i< tableControls.length ; i++) 
	    { 
		    if (tableControls[i].id.lastIndexOf(ControlID) == tableControls[i].id.length - ControlID.length && tableControls[i].id.length != ControlID.length && tableControls[i].id.lastIndexOf(ControlID)  > 0 ) 
		    { 
			    ret =tableControls[i].id; 
			    break;
            } 
        } 
    };
    spanControls = document.getElementsByTagName('span'); 
    if (spanControls) 
    {
	    for (var i=0; i< spanControls.length ; i++) 
	    { 
		    if (spanControls[i].id.lastIndexOf(ControlID) == spanControls[i].id.length - ControlID.length && spanControls[i].id.length != ControlID.length && spanControls[i].id.lastIndexOf(ControlID)  > 0 ) 
		    { 
			    ret =spanControls[i].id; 
			    break;
            } 
        } 
    };
    selectControls = document.getElementsByTagName('select'); 
    if (selectControls) 
    {
	    for (var i=0; i< selectControls.length ; i++) 
	    { 
		    if (selectControls[i].id.lastIndexOf(ControlID) == selectControls[i].id.length - ControlID.length && selectControls[i].id.length != ControlID.length && selectControls[i].id.lastIndexOf(ControlID)  > 0 ) 
		    { 
			    ret =selectControls[i].id; 
			    break;
            } 
        } 
    };
    textareaControls = document.getElementsByTagName('textarea'); 
    if (textareaControls) 
    {
	    for (var i=0; i< textareaControls.length ; i++) 
	    { 
		    if (textareaControls[i].id.lastIndexOf(ControlID) == textareaControls[i].id.length - ControlID.length && textareaControls[i].id.length != ControlID.length && textareaControls[i].id.lastIndexOf(ControlID)  > 0 ) 
		    { 
			    ret =textareaControls[i].id; 
			    break;
            } 
        } 
    };
    divControls = document.getElementsByTagName('div'); 
    if (divControls) 
    {
	    for (var i=0; i< divControls.length ; i++) 
	    { 
		    if (divControls[i].id.lastIndexOf(ControlID) == divControls[i].id.length - ControlID.length && divControls[i].id.length != ControlID.length && divControls[i].id.lastIndexOf(ControlID)  > 0 ) 
		    { 
			    ret =divControls[i].id; 
			    break;
            } 
        } 
    };
    return ret; 
}

function SetAddress(addressList,house,street,locality,city,county)
	{ 
			var AddressValue = addressList.value.split(':');
			if (document.getElementById(findControlID(house)) != null)
            {
                document.getElementById(findControlID(house)).value=AddressValue[0];
            }
			if (document.getElementById(findControlID(street)) != null)
            {
                document.getElementById(findControlID(street)).value=AddressValue[1];
            }
            if (document.getElementById(findControlID(locality)) != null)
            {
                document.getElementById(findControlID(locality)).value=AddressValue[2];
            }
            if (document.getElementById(findControlID(city)) != null)
            {
                document.getElementById(findControlID(city)).value=AddressValue[3];
            }
            if (document.getElementById(findControlID(county)) != null)
            {
                document.getElementById(findControlID(county)).value=AddressValue[4];
            }
	}

function FormatNumberAsMoney(N) 
{ 
	if (parseFloat(N) == 0) 
		return "0.00" 
	else 
	{ 
		N = (Math.floor((parseFloat(N) + 0.005) * 100) / 100).toString() 
		var index = N.indexOf(".") 
		var pence = N.substring(index + 1, N.length) 
		if (index == -1) N += ".00" 
		else if (pence.length < 2) N += "0" 
		return N 
	} 
}

function getPremium() 
{
	var decPremium=0;
	if (document.getElementById(findControlID('lblPremium'))!=null)
	{
		decPremium=parseFloat(document.getElementById(findControlID('lblPremium')).innerText);
	}
	var aControls = document.getElementsByTagName("input"); 
    if (aControls) 
    {
	    for (var i=0; i< aControls.length ; i++) 
	    { 
		    if (aControls[i].id.indexOf('addon__') > 0) 
		    { 
		        if (document.getElementById(findControlID(aControls[i].id))!=null)
	            {
		            if (document.getElementById(findControlID(aControls[i].id)).checked) 
		            {
		                var addonid = aControls[i].id.substring(aControls[i].id.lastIndexOf('addon__')+7,aControls[i].id.length)
		                var bControls = document.getElementsByTagName("span"); 
		                if (bControls) 
                        {
		                    for (var j=0; j< bControls.length ; j++) 
                            { 
	                            if (bControls[j].id.indexOf('addonpremium__'+ addonid) > 0) 
	                            { 
		                            if (document.getElementById(bControls[j].id)!=null)
		                            {
                            		      decPremium = decPremium + parseFloat(document.getElementById(bControls[j].id).innerText);    
		                            }
	                            } 
                            }
		                }
		            }
	            }
            } 
        } 
    } 
	if (document.getElementById(findControlID('lblTotal'))!=null)
	{
		document.getElementById(findControlID('lblTotal')).innerText=FormatNumberAsMoney(decPremium);
	}
}

function MM_openAddonWindow(addon,winName,features) 
{

	var lstrPolicy='documents/' + addon; 
	window.open(lstrPolicy,winName,features);
}

//-->


// script function to make help text appear and disappear


var DivId = new Array(); // load all help ids into an array for function ToggleDivDisplay(event, ID)

DivId [0] = "help1";
DivId [1] = "help2";
DivId [2] = "help3";
DivId [3] = "help4";
DivId [4] = "help5";
DivId [5] = "help6";
DivId [6] = "help7";
DivId [7] = "help8";
DivId [8] = "help9";
DivId [9] = "help10";
DivId [10] = "help11";
DivId [11] = "help12";
DivId [12] = "help13";
DivId [13] = "help14";
DivId [14] = "help15";
DivId [15] = "help16";
DivId [16] = "help17";
DivId [17] = "help18";
DivId [18] = "help19";
DivId [19] = "help20";
DivId [20] = "help21";
DivId [21] = "help22";
DivId [22] = "help23";
DivId [23] = "help24";
DivId [24] = "help25";


function ToggleDivDisplay(event, ID){ 

    var useIframe = false;
    var iframeControl = null;
    if (navigator.appVersion.indexOf("MSIE 6.0") > -1) {
        useIframe = true;
        iframeControl = document.getElementById(ID + "_iframe");
    }

	// get all divs
    var divControls = document.getElementsByTagName('div');
        
    // go round all divs
    var i = 0;
	for(i = 0; i < divControls.length; i++){ 
	
	     // skip current div id 
        if(divControls[i].getAttribute("id") != ID){ 
    		
	        // get class	
	        var helpClass = divControls[i].getAttribute("class");
    		
		    // if class=helpdiv then hide
		    if (helpClass == "HelpDiv") {
    									
			    try{ 
				    eval("document.getElementById('" + divControls[i].id + "').style.display='none'"); 
    			
			    }catch(err){
				    //alert("Error Description: " + err.description + "\n\n"); // test ***
			    } 			
		    } 
        }	
	}    
	
	var divControl = document.getElementById(ID);
	if(divControl.style.display!='block'){ 
		
		divControl.style.display='block';  // display
		
		if (useIframe) {		
		    if (iframeControl == null) {
		      pos = findPos(divControl);
              iframeControl = document.createElement("iframe");
              iframeControl.setAttribute("id", ID + "_iframe");
              iframeControl.style.position = "absolute";
              iframeControl.style.left = pos[0];
              iframeControl.style.top = pos[1];
              iframeControl.style.width = divControl.offsetWidth;
              iframeControl.style.height = divControl.offsetHeight;
              iframeControl.style.zIndex = divControl.style.zIndex;
              divControl.style.zIndex = divControl.style.zIndex + 1; //Move the div above the iframe
              document.body.appendChild(iframeControl);  
              alert(iframeControl.style.position);            
		    }
		    iframeControl.style.display='block';
		}
	
	}else{
		
		divControl.style.display='none';  // hide
		if (iframeControl != null) {
		    iframeControl.style.display='none';
		}
	}	
	
} // function ToggleDivDisplay

function findPos(obj) {
	var curleft = curtop = 0;
    if (obj.offsetParent) {
        do {
		    curleft += obj.offsetLeft;
		    curtop += obj.offsetTop;
        } while (obj = obj.offsetParent);
    }
    return [curleft,curtop];
}


function displayCCDetails() 
{
    if (document.getElementById(findControlID('radCreditCard'))!=null)
    {
	    if (document.getElementById(findControlID('radCreditCard')).checked==true) 
	    {
		    document.getElementById(findControlID('divCreditCard')).style.display='';
	    }else{
	        document.getElementById(findControlID('divCreditCard')).style.display='none';
	    }
	}
}

function sumControls(numericControls, totalControl) 
{

    var decTotal=0
    
        for(i = 0; i < numericControls.length; i++){
        
           if (document.getElementById(findControlID(numericControls[i].split("!")[0])).value !='')
			    {
			    
			        var symbol=numericControls[i].split("!")[1]
                  
			        if (symbol=='Addition')
			            {
                            decTotal = decTotal + parseFloat(document.getElementById(findControlID(numericControls[i].split("!")[0])).value);
                        }
                    else if (symbol=='Subtraction')
                        {
                            decTotal = decTotal - parseFloat(document.getElementById(findControlID(numericControls[i].split("!")[0])).value);
                        }
                    else
                        {
                            decTotal = decTotal + parseFloat(document.getElementById(findControlID(numericControls[i].split("!")[0])).value);
                        }
			    }
			    
		    else
		    
			    {
			        decTotal = decTotal + 0
			    }
		    
        }
        
        if (document.getElementById(findControlID(totalControl))!=null)
        {
	        document.getElementById(findControlID(totalControl)).value = decTotal;
	    }
	    
}

function findControlWithID(ControlID){
  var ret=ControlID; 
  var inputControls = document.getElementsByTagName('input'); 
  if (inputControls) 
  {
      for (var i=0; i< inputControls.length ; i++) 
      { 
          if (inputControls[i].id.lastIndexOf(ControlID) == inputControls[i].id.length - ControlID.length && inputControls[i].id.length != ControlID.length && inputControls[i].id.lastIndexOf(ControlID)  > 0 ) 
          { 
              ret =inputControls[i].id; 
              break; 
          } 
      } 
  };
  var tableControls = document.getElementsByTagName('table'); 
  if (tableControls) 
  {
      for (var i=0; i< tableControls.length ; i++) 
      { 
          if (tableControls[i].id.lastIndexOf(ControlID) == tableControls[i].id.length - ControlID.length && tableControls[i].id.length != ControlID.length && tableControls[i].id.lastIndexOf(ControlID)  > 0 ) 
          { 
              ret =tableControls[i].id; 
              break; 
          } 
      } 
  };    
  var spanControls = document.getElementsByTagName('span'); 
  if (spanControls) 
  {
      for (var i=0; i< spanControls.length ; i++) 
      { 
          if (spanControls[i].id.lastIndexOf(ControlID) == spanControls[i].id.length - ControlID.length && spanControls[i].id.length != ControlID.length && spanControls[i].id.lastIndexOf(ControlID)  > 0 ) 
          { 
              ret =spanControls[i].id; 
              break; 
          } 
      } 
  };
  /* BH 25/02/2010 - This version of the function wasn't being used until the latest release (with optimisations), instead it was using the version in RelatedControls.js which doesn't have a div
                     With the div included it's diverting away from the controlID passed in for ID's starting p and picking up the hlp div instead
  var divControls = document.getElementsByTagName('div'); 
  if (divControls) 
  {
      for (var i=0; i< divControls.length ; i++) 
      { 
          if (divControls[i].id.lastIndexOf(ControlID) == divControls[i].id.length - ControlID.length && divControls[i].id.length != ControlID.length && divControls[i].id.lastIndexOf(ControlID)  > 0 ) 
          { 
              ret =divControls[i].id; 
              break; 
          } 
      } 
  }; 
  */    
  var selectControls = document.getElementsByTagName('select'); 
  if (selectControls) 
  {
      for (var i=0; i< selectControls.length ; i++) 
      { 
          if (selectControls[i].id.lastIndexOf(ControlID) == selectControls[i].id.length - ControlID.length && selectControls[i].id.length != ControlID.length && selectControls[i].id.lastIndexOf(ControlID)  > 0 ) 
          { 
              ret =selectControls[i].id; 
              break; 
          } 
      } 
  };
  var textareaControls = document.getElementsByTagName('textarea'); 
  if (textareaControls) 
  {
      for (var i=0; i< textareaControls.length ; i++) 
      { 
          if (textareaControls[i].id.lastIndexOf(ControlID) == textareaControls[i].id.length - ControlID.length && textareaControls[i].id.length != ControlID.length && textareaControls[i].id.lastIndexOf(ControlID)  > 0 ) 
          { 
              ret =textareaControls[i].id; 
              break; 
          } 
      } 
  };
  var h2Controls = document.getElementsByTagName('h2'); 
  if (h2Controls) 
  {
      for (var i=0; i< h2Controls.length ; i++) 
      { 
          if (h2Controls[i].id.lastIndexOf(ControlID) == h2Controls[i].id.length - ControlID.length && h2Controls[i].id.length != ControlID.length && h2Controls[i].id.lastIndexOf(ControlID)  > 0 ) 
          { 
              ret =h2Controls[i].id; 
              break; 
          } 
      } 
  };
  var liControls = document.getElementsByTagName('li'); 
  if (liControls) 
  {
      for (var i=0; i< liControls.length ; i++) 
      { 
          if (liControls[i].id.lastIndexOf(ControlID) == liControls[i].id.length - ControlID.length && liControls[i].id.length != ControlID.length && liControls[i].id.lastIndexOf(ControlID)  > 0 ) 
          { 
              ret =liControls[i].id; 
              break; 
          } 
      } 
  };  
  return ret; 
}

function clearControlType(ControlID){
  var inputControls = document.getElementsByTagName('input'); 
  if (inputControls) 
  {
      for (var i=0; i< inputControls.length ; i++) 
      { 
          if ((inputControls[i].id.lastIndexOf(ControlID) == inputControls[i].id.length - ControlID.length && inputControls[i].id.length != ControlID.length && inputControls[i].id.lastIndexOf(ControlID) > 0) || inputControls[i].id == ControlID ) 
          { 
              switch(inputControls[i].type)
              {
              case 'text':
              inputControls[i].value='';
              break;
              case 'checkbox':
              inputControls[i].checked=false;
              break;
              case 'radio':
              inputControls[i].checked=false;
              break;
              }
              break; 
          } 
      } 
  };
  var tableControls = document.getElementsByTagName('table'); 
  if (tableControls) 
  {
      for (var i=0; i< tableControls.length ; i++) 
      { 
          if ((tableControls[i].id.lastIndexOf(ControlID) == tableControls[i].id.length - ControlID.length && tableControls[i].id.length != ControlID.length && tableControls[i].id.lastIndexOf(ControlID) > 0) || tableControls[i].id == ControlID ) 
          { 
              var radioControls = tableControls[i].getElementsByTagName('input'); 
              if (radioControls) 
              {
                  for (var j=0; j< radioControls.length ; j++) 
                  { 
                  switch(radioControls[j].type)
                      {
                      case 'radio':
                          radioControls[j].checked=false;
                      }
                  } 
              }
          } 
      } 
  };
  var textareaControls = document.getElementsByTagName('textarea'); 
  if (textareaControls) 
  {
      for (var i=0; i< textareaControls.length ; i++) 
      { 
          if ((textareaControls[i].id.lastIndexOf(ControlID) == textareaControls[i].id.length - ControlID.length && textareaControls[i].id.length != ControlID.length && textareaControls[i].id.lastIndexOf(ControlID) > 0) || textareaControls[i].id == ControlID ) 
          { 
              textareaControls[i].value=''; 
          } 
      } 
  };
  var selectControls = document.getElementsByTagName('select'); 
  if (selectControls) 
  {
      for (var i=0; i< selectControls.length ; i++) 
      { 
          if ((selectControls[i].id.lastIndexOf(ControlID) == selectControls[i].id.length - ControlID.length && selectControls[i].id.length != ControlID.length && selectControls[i].id.lastIndexOf(ControlID) > 0) || selectControls[i].id == ControlID ) 
          { 
              if (selectControls[i].id.substring(selectControls[i].id.length-7)=='_cboDay' || selectControls[i].id.substring(selectControls[i].id.length-9)=='_cboMonth' || selectControls[i].id.substring(selectControls[i].id.length-8)=='_cboYear')
              {
                  selectControls[i].value=''; 
              }else{
                  selectControls[i].value='0'; 
              } 
          } 
      } 
  };
}

function getTableName(field) {
	//Pass in a control name, eg. USER_XXX_LOB__FIELD, finds double _ and returns USER_XXX_LOB
	var i = field.indexOf('__');
	if (i != -1) 
	{
		return field.substring(0, i);
	}
}

function SetVehicle(vehicleControl,abicode,make,model,type,series,doors,cc,gearbox,fuel,gvw,capacity)
	{ 
        for (var i=0; i< vehicleControl.form.length ; i++) 
        {
            if (vehicleControl.form[i].parentNode!=null)
            {
                switch(vehicleControl.form[i].parentNode.id)
                {
                    case 'storedabicode':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            document.getElementById(findControlID(vehicleControl.form[i].id)).value=abicode;
                        }
                        break;
                    case 'abicode':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            document.getElementById(findControlID(vehicleControl.form[i].id)).value=abicode;
                        }
                        break;
                    case 'make':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            if (document.getElementById(findControlID(vehicleControl.form[i].id)).nodeName == 'SELECT')
                            {
                                for (j=0;j<document.getElementById(findControlID(vehicleControl.form[i].id)).length;j++)
                                {
                                    if (make == document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).text)
                                    {
                                        document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).selected = true;
                                        break;
                                    }
                                }
                            }else{
                                document.getElementById(findControlID(vehicleControl.form[i].id)).value=make;
                            }
                        }
                        break;
                    case 'model':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            if (document.getElementById(findControlID(vehicleControl.form[i].id)).nodeName == 'SELECT')
                            {
                                for (j=0;j<document.getElementById(findControlID(vehicleControl.form[i].id)).length;j++)
                                {
                                    if (model == document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).text)
                                    {
                                        document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).selected = true;
                                        break;
                                    }
                                }
                            }else{
                                document.getElementById(findControlID(vehicleControl.form[i].id)).value=model;
                            }
                        }
                        break;
                    case 'type':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            document.getElementById(findControlID(vehicleControl.form[i].id)).value=type;
                        }
                        break;
                    case 'series':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            document.getElementById(findControlID(vehicleControl.form[i].id)).value=series;
                        }
                        break;
                    case 'doors':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            if (document.getElementById(findControlID(vehicleControl.form[i].id)).nodeName == 'SELECT')
                            {
                                for (j=0;j<document.getElementById(findControlID(vehicleControl.form[i].id)).length;j++)
                                {
                                    if (doors == document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).text)
                                    {
                                        document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).selected = true;
                                        break;
                                    }
                                }
                            }else{
                                document.getElementById(findControlID(vehicleControl.form[i].id)).value=doors;
                            }
                        }
                        break;
                    case 'cc':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            document.getElementById(findControlID(vehicleControl.form[i].id)).value=cc;
                        }
                        break;
                    case 'gearbox':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            if (document.getElementById(findControlID(vehicleControl.form[i].id)).nodeName == 'SELECT')
                            {
                                for (j=0;j<document.getElementById(findControlID(vehicleControl.form[i].id)).length;j++)
                                {
                                    if (gearbox == document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).text)
                                    {
                                        document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).selected = true;
                                        break;
                                    }
                                }
                            }else{
                                document.getElementById(findControlID(vehicleControl.form[i].id)).value=gearbox;
                            }
                        }
                        break;
                    case 'fuel':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            if (document.getElementById(findControlID(vehicleControl.form[i].id)).nodeName == 'SELECT')
                            {
                                for (j=0;j<document.getElementById(findControlID(vehicleControl.form[i].id)).length;j++)
                                {
                                    if (fuel == document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).text)
                                    {
                                        document.getElementById(findControlID(vehicleControl.form[i].id)).options(j).selected = true;
                                        break;
                                    }
                                }
                            }else{
                                document.getElementById(findControlID(vehicleControl.form[i].id)).value=fuel;
                            }
                        }
                        break;
                    case 'gvw':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            document.getElementById(findControlID(vehicleControl.form[i].id)).value=gvw;
                        }
                        break;
                    case 'capacity':
                        if (document.getElementById(findControlID(vehicleControl.form[i].id)) != null)
                        {
                            document.getElementById(findControlID(vehicleControl.form[i].id)).value=capacity;
                        }
                        break;
                    default:
                        break;
                }         
            }
        }
	}
	
function vehicleReselect(abicode)
	{ 
        var inputControls = document.getElementsByTagName('input'); 
        if (inputControls) 
        {
            for (var i=0; i< inputControls.length ; i++) 
            { 
                switch(inputControls[i].type)
                {
                    case 'radio':
                    if (inputControls[i].value == abicode)
                    {
                        inputControls[i].checked=true;
                    }
                    break;
                }
            } 
        }
    }
        

//Create one method to handle 'please wait' pop up message on clicking 'continue' and 'back' 
    function navResponse()
    {
        try 
        {
            //Text 
            var navDiv = document.getElementById('navMessageDiv');
            navDiv.innerHTML = "Please wait a moment....";                
           
            //Spinning image
            //Add loading/saving spinning image
            var newImage = document.createElement('img');
            newImage.setAttribute('id', 'spinningImage');
            newImage.setAttribute('src', '/quote/images/loader.gif');
            newImage.style.width = '28px';
            newImage.style.height = '28px';            
            navDiv.appendChild(newImage);
                 
        }
        
        catch(err)
        {
            //unable to write nav Response message to navMessageDiv
        }
             
    
    }    
	
	//Deactive the 'buy now' button once it has been pressed once 
	function deactivatePaymentButton() 
	{       
        var buyNowButton = document.getElementById("ctl00_CoreScreens_cmdBuyNow");
        if(buyNowButton != null)
        {                         
            //buyNowButton.disabled='true';         
            var buyNowDiv = document.getElementById('buyNowDiv');      
            var newdiv = document.createElement('div');
            var divIdName = 'submittedDiv';
            newdiv.setAttribute('id',divIdName);
            newdiv.innerHTML = 'Order submitted, please wait a few moments......';
            buyNowDiv.appendChild(newdiv);                  
        }  
        return true;  
    
    }
    
     //Deactive the 'save' button once it has been pressed once 
	function deactivateSaveQuoteButton() 
	{       
        var saveNowButton = document.getElementById("ctl00_CoreScreens_cmdSave");
        if(saveNowButton != null)
        {                         
            //buyNowButton.disabled='true';         
            var saveNowDiv = document.getElementById('navMessageDiv');      
            var newdiv = document.createElement('div');
            var divIdName = 'submittedDiv';
            newdiv.setAttribute('id',divIdName);
            newdiv.innerHTML = 'Quote saving, please wait a moment......';
            saveNowDiv.appendChild(newdiv);                  
        }  
        return true;  
    
    }


    function ChatWindow() {

    window.open("http://chat.constructaquote.com:8000/main.asp?sid=3&sTag=CONSTRUCTAQUOTE", "Chat", "status=1,width=650,height=550,resizable=0");

}

	
