
  var IS_NS4   = (document.layers) ? true : false;
  var IS_IE    = (document.all) ? true : false;
  var IS_NS6   = (!document.all && document.getElementById) ? true : false;

function CheckOptions()
{
  var AllAnswered = true;
  //Update the status.
  document.forms[0].JavaScriptStatus.value = "1";
  
    //Check Question 1.
  if ((document.forms[0]["SiteBuilding"][0].checked == false) && (document.forms[0]["SiteBuilding"][1].checked == false) && (document.forms[0]["SiteBuilding"][2].checked == false))
    AllAnswered = false;

  //Check Question 2.
  if ((document.forms[0]["SpamPro"][0].checked == false) && (document.forms[0]["SpamPro"][1].checked == false))
    AllAnswered = false;

  //Check Question 3.
  if ((document.forms[0]["EngDir"][0].checked == false) && (document.forms[0]["EngDir"][1].checked == false))
    AllAnswered = false;

  //Check Question 4.
  if ((document.forms[0]["AddOns"][0].checked == false) && (document.forms[0]["AddOns"][1].checked == false))
    AllAnswered = false;

	//Check Question 5.
  if ((document.forms[0]["Sale"][0].checked == false) && (document.forms[0]["Sale"][1].checked == false))
    AllAnswered = false;
	
  //Check Question 6.
  if ((document.forms[0]["Myweb"][0].checked == false) && (document.forms[0]["Myweb"][1].checked == false))
    AllAnswered = false;

  //If all answered then display the correct product.
  if (AllAnswered == true)
  {
  
    //Customer selects Yes for 2-6, --- Recommend Plan C
    if ((document.forms[0]["SpamPro"][0].checked == true)&&(document.forms[0]["EngDir"][0].checked == true)&&(document.forms[0]["AddOns"][0].checked == true)&&(document.forms[0]["Sale"][0].checked == true)&&(document.forms[0]["Myweb"][0].checked == true))
    {
      fcnDisplayLayer(fcnGetLayer("PlanC"));
      fcnRemoveLayer(fcnGetLayer("PlanB"));
      fcnRemoveLayer(fcnGetLayer("PlanA"));
    }
	//Customer selects No for 2-6 --- Recommend Plan A
    else if ((document.forms[0]["SpamPro"][1].checked == true)&&(document.forms[0]["EngDir"][1].checked == true)&&(document.forms[0]["AddOns"][1].checked == true)&&(document.forms[0]["Sale"][1].checked == true)&&(document.forms[0]["Myweb"][1].checked == true))
    {
      	fcnDisplayLayer(fcnGetLayer("PlanA"));
        fcnRemoveLayer(fcnGetLayer("PlanB"));
        fcnRemoveLayer(fcnGetLayer("PlanC"));		
    }
	//Customer selects Yes for #2 and No for 3-6 --- Recommend Plan A
	else if ((document.forms[0]["SpamPro"][0].checked == true)&&(document.forms[0]["EngDir"][1].checked == true)&&(document.forms[0]["AddOns"][1].checked == true)&&(document.forms[0]["Sale"][1].checked == true)&&(document.forms[0]["Myweb"][1].checked == true))
	{
		fcnDisplayLayer(fcnGetLayer("PlanA"));
        fcnRemoveLayer(fcnGetLayer("PlanB"));
        fcnRemoveLayer(fcnGetLayer("PlanC"));
	}
	//Customer selects Yes for #3 and No for 2, 4-6 --- Recommend Plan B
	else if ((document.forms[0]["SpamPro"][1].checked == true)&&(document.forms[0]["EngDir"][0].checked == true)&&(document.forms[0]["AddOns"][1].checked == true)&&(document.forms[0]["Sale"][1].checked == true)&&(document.forms[0]["Myweb"][1].checked == true))
	{
		fcnDisplayLayer(fcnGetLayer("PlanB"));
        fcnRemoveLayer(fcnGetLayer("PlanA"));
        fcnRemoveLayer(fcnGetLayer("PlanC"));
	}
	// Customer selects Yes for #4 and No for 3, 5-6 --- Recommend Plan B
	else if ((document.forms[0]["EngDir"][1].checked == true)&&(document.forms[0]["AddOns"][0].checked == true)&&(document.forms[0]["Sale"][1].checked == true)&&(document.forms[0]["Myweb"][1].checked == true))
	{
		fcnDisplayLayer(fcnGetLayer("PlanB"));
        fcnRemoveLayer(fcnGetLayer("PlanA"));
        fcnRemoveLayer(fcnGetLayer("PlanC"));
	}
	//Customer selects Yes for #5 --- Recommend Plan C
	else if (document.forms[0]["Sale"][0].checked == true)
	{
		fcnDisplayLayer(fcnGetLayer("PlanC"));
        fcnRemoveLayer(fcnGetLayer("PlanA"));
        fcnRemoveLayer(fcnGetLayer("PlanB"));
	}
	//Customer selects Yes for #6 --- Recommend Plan C
	else if (document.forms[0]["Myweb"][0].checked == true)
	{
		fcnDisplayLayer(fcnGetLayer("PlanC"));
        fcnRemoveLayer(fcnGetLayer("PlanA"));
        fcnRemoveLayer(fcnGetLayer("PlanB"));
	}
		
  }
}
function fcnGetLayer(a_strLayerName)
{
  if (IS_NS4)
    return fcnFindLayer(a_strLayerName, document);

  if (IS_NS6)
    return document.getElementById(a_strLayerName);

  if (IS_IE)
    return eval('document.all.' + a_strLayerName);

  return null;
}

//Function finds the layer from the document object model.
function fcnFindLayer(a_strLayerName, a_objDocument)
{
  var intCount;
  var objLayer;

  for (intCount = 0; intCount < a_objDocument.layers.length; intCount++)
  {
    objLayer = a_objDocument.layers[intCount];
    if (objLayer.name == a_strLayerName)
      return objLayer;
    if (objLayer.document.layers.length > 0)
    {
      objLayer = fcnFindLayer(a_strLayerName, objLayer.document);
      if (objLayer != null)
        return objLayer;
    }
  }
  return null;
}

//--------------------------------------------------------------------------------------------
// Layer visibility.
//--------------------------------------------------------------------------------------------
//This function hides the layer.
function fcnHideLayer(a_objLayer)
{
  if (IS_NS4)
    a_objLayer.visibility = "hide";

  if (IS_IE || IS_NS6)
    a_objLayer.style.visibility = "hidden";
}

//This function displays the layer.
function fcnShowLayer(a_objLayer)
{
  if (IS_NS4)
    a_objLayer.visibility = "show";

  if (IS_IE || IS_NS6)
    a_objLayer.style.visibility = "visible";
}

//This function shows the layer visiblity then sets the display to show the layer.
function fcnDisplayLayer(a_objLayer)
{
  fcnShowLayer(a_objLayer);

  if (IS_NS4)
    a_objLayer.display = "";

  if (IS_IE || IS_NS6)
    a_objLayer.style.display = "";
}

//This function hides the layer visiblity then sets the display to none.
function fcnRemoveLayer(a_objLayer)
{
  fcnHideLayer(a_objLayer);

  if (IS_NS4)
    a_objLayer.display = "none";

  if (IS_IE || IS_NS6)
    a_objLayer.style.display = "none";
}

//--------------------------------------------------------------------------------------------
// Layer positioning.
//--------------------------------------------------------------------------------------------
//Function moves a layer to the passed coordinates.
function fcnMoveLayerTo(a_objlayer, a_intXAxis, a_intYAxis)
{
  if (IS_NS4)
    a_objlayer.moveTo(a_intXAxis, a_intYAxis);

  if (IS_IE || IS_NS6)
  {
    a_objlayer.style.left = a_intXAxis;
    a_objlayer.style.top = a_intYAxis;
  }
}

//Function moves layer and then displays the layer.
function fcnMoveToShow(a_strLayerName, a_intXAxis, a_intYAxis)
{
  fcnMoveLayerTo(fcnGetLayer(a_strLayerName), a_intXAxis, a_intYAxis);
  fcnShowLayer(fcnGetLayer(a_strLayerName));
}

//Function moves layer and then hides the layer.
function fcnMoveToHide(a_strLayerName, a_intXAxis, a_intYAxis)
{
  fcnMoveLayerTo(fcnGetLayer(a_strLayerName), a_intXAxis, a_intYAxis);
  fcnHideLayer(fcnGetLayer(a_strLayerName));
}

//Function moves the passed layer to new coordinates.
function fcnMoveLayerBy(a_objLayer, a_intXPixels, a_intYPixels)
{
  var intXSpot;
  var intYSpot;

  if (IS_NS4)
    a_objLayer.moveBy(a_intXPixels, a_intYPixels);

  if (IS_NS6)
  {
    intXSpot = parseInt(a_objLayer.style.left);
    intYSpot = parseInt(a_objLayer.style.top);

    intXSpot += a_intXPixels;
    intYSpot += a_intYPixels;

    a_objLayer.style.left = intXSpot;
    a_objLayer.style.top  = intYSpot;
  }

  if (IS_IE)
  {
    a_objLayer.style.pixelLeft += a_intXPixels;
    a_objLayer.style.pixelTop  += a_intYPixels;
  }
}

//Function gets the left side coordinate of the passed layer.
function fcnGetLeft(a_objLayer)
{
  if (IS_NS4)
    return(a_objLayer.left);

  if (IS_NS6)
    return(parseInt(a_objLayer.style.left));

  if (IS_IE)
    return(a_objLayer.style.pixelLeft);

  return(-1);
}

//Function gets the top side coordinate of the passed layer.
function fcnGetTop(a_objLayer)
{
  if (IS_NS4)
    return(a_objLayer.top);

  if (IS_NS6)
    return(parseInt(a_objLayer.style.top));

  if (IS_IE)
    return(a_objLayer.style.pixelTop);

  return(-1);
}

//--------------------------------------------------------------------------------------------
// Gathering Image coordinates.
//--------------------------------------------------------------------------------------------
//Obtain X coordinate of imageName.
function fcnFindX(a_strImageName)
{
  var objImage;
  var intCount;
  var intTotal;

  objImage = document.images[a_strImageName]
  if (IS_NS4)
  {
    //Test for image in document object.
    if (document.images[a_strImageName])
    {
      return eval(objImage).x
    }
    //Fix for Netscape 4 div bug - find image in document.layers object instead (will NOT work for nested divs).
    else
    {
      for (intCount = 0; intCount < document.layers.length; intCount++)
      {
        if (document.layers[intCount].document.images[a_strImageName])
        {
          intTotal = document.layers[intCount].left + document.layers[intCount].document.images[a_strImageName].x;
          return intTotal;
        }
      }
    }
  }
  else
  {
    return fcnGetXPosition(objImage);
  }
}

//Get X Coordinate by a different mean.
function fcnGetXPosition(a_objImage)
{
  var intXPosition;
  var objTemp;

  intXPosition = eval(a_objImage).offsetLeft;
  objTemp = eval(a_objImage).offsetParent;

  while (objTemp != null)
  {
    intXPosition += objTemp.offsetLeft;
    objTemp = objTemp.offsetParent;
  }
  return intXPosition;
}

//Obtain Y coordinate of imageName.
function fcnFindY(a_strImageName)
{
  var objImage;
  var intCount;
  var intTotal;

  objImage = document.images[a_strImageName];
  if (IS_NS4)
  {
     //Test for image in document object.
    if (document.images[a_strImageName])
    {
      return eval(objImage).y;
    }
    //Fix for Netscape 4 div bug - find image in document.layers object instead (will NOT work for nested divs).
    else
    {
      for (intCount = 0; intCount < document.layers.length; intCount++)
      {
        if (document.layers[intCount].document.images[a_strImageName])
        {
          intTotal = document.layers[intCount].top + document.layers[intCount].document.images[a_strImageName].y;
          return intTotal;
        }
      }
    }
  }
  else
  {
    return fcnGetWindowWidth(objImage);
  }
}

//Get Y Coordinate by a different mean.
function fcnGetWindowWidth(a_objImage)
{
  var intYPosition;
  var objTemp;

  intYPosition = eval(a_objImage).offsetTop;
  objTemp = eval(a_objImage).offsetParent;
  while (objTemp != null)
  {
    intYPosition += objTemp.offsetTop;
    objTemp = objTemp.offsetParent;
  }
  return intYPosition;
}

