﻿function SetRadioValue(radioObj, newValue)
// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
{
 if(typeof(radioObj) === "undefined")
 {
  return;
 }
 var radioLength = radioObj.length;
 if(typeof radioLength === "undefined") {
  radioObj.checked = (radioObj.value == newValue.toString());
  return;
 }
 for(var i = 0; i < radioLength; i++) {
  radioObj[i].checked = false;
  if(radioObj[i].value == newValue.toString()) {
   radioObj[i].checked = true;
  }
 }
}
function getRadioValue(radioObj) {
// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
 if(radioObj === "undefined")
 {
  return "";
 }
 var radioLength = radioObj.length;
 if(radioLength === "undefined")
 {
  if(radioObj.checked)
  {
   return radioObj.value;
  }
  else
  {
   return "";
  }
 }
 for(var i = 0; i < radioLength; i++) 
 {
  if(radioObj[i].checked) 
  {
   return radioObj[i].value;
  }
 }
 return "";
}
function SetCheckboxValue(checkObj, newValue)
{
 if(checkObj === "undefined")
 {
  return;
 }
 if (newValue == "0")
 {
  checkObj.checked = false;
 }
 else
 {
  checkObj.checked = true;
 }
}
function SetSelectValue(selectObj, newValue)
// set the select with the given value as being selected
// do nothing if there is no select object
// if the given value does not exist, return the index to 0
{
 if(selectObj === "undefined")
 {
  return;
 }
 selectObj.selectedIndex = 0;
 for(var i=0; i<selectObj.options.length; i++)
 {
  if (selectObj.options[i].value == newValue)
  {
   selectObj.selectedIndex = i;
   break;
  }
 }
}
function CreateFlashObject(objectWidth, objectHeight, flashURL, flashLoop)
{
   document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://active.macromedia.com/flash/cabs/swflash.cab#version=3,0,0,11" WIDTH="' + objectWidth + '" HEIGHT="' + objectHeight +'" NAME="sw" ID="sw">');
   document.write('<PARAM NAME="Movie" VALUE="' + flashURL + '"/>');
   document.write('<PARAM NAME="quality" VALUE="high"/>');
   document.write('<PARAM NAME="Loop" VALUE="true"/>');
   document.write('<PARAM NAME="play" VALUE="true"/>');
   document.write('<EMBED SRC="' + flashURL + '" WIDTH="' + objectWidth + '" HEIGHT="' + objectHeight + '" LOOP="' + flashLoop + '" QUALITY="high"/>');
   document.write('</OBJECT>');
}

function checkClear(input,defaultPhrase) {
  if ( input.value == defaultPhrase) input.value = "";
}

function popUp(url,width,height,scrollbar)
{
 xposition = (screen.width) ? (screen.width-width)/2 : 0;
 yposition = (screen.height) ? (screen.height-height)/2 : 0;
 window.open(url,null,"menubar=0,toolbar=0,scrollbars=" + scrollbar + ",location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height +",left=" + xposition + ",top=" + yposition)
}

function fullScreen(theURL) {
window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');
}

function sendmessage(topersonaddress,topersonName,subject)
{
 url = "http://www.caridianbct.com/feedback/sendmessage.asp?"
 url = url + "toperson=" + topersonaddress
 url = url + "&topersonName=" + topersonName
 url = url + "&subject=" + subject
 window.open(url,null,"menubar=0,status=0,height=500,width=500,top=100,left=100")
}

function sendmessageOptia(topersonaddress,topersonName,subject)
{
 url = "http://www.caridianbct.com/SpectraOptia/sendmessage.asp?"
 url = url + "toperson=" + topersonaddress
 url = url + "&topersonName=" + topersonName
 url = url + "&subject=" + subject
 window.open(url,null,"menubar=0,status=0,height=725,width=500,top=100,left=100")
}

function sendmessagePress(topersonaddress,topersonName,subject)
{
 url = "http://www.caridianbct.com/press/press.asp?"
 url = url + "toperson=" + topersonaddress
 url = url + "&topersonName=" + topersonName
 url = url + "&subject=" + subject
 window.open(url,null,"menubar=0,status=0,height=725,width=500,top=100,left=100")
}