// JavaScript Document
var  imgPath = "images/Leftnav/"

var DirtyFlagWarningMessage =  "Data has been changed on this page.\n" +
			"If you proceed you will lose your changes.\n\n" +
			"Press Cancel to abort this operation and then save your changes.";

function ResetFormValues()
{
	if (DirtyFlag > 0 )
		if (!confirm(DirtyFlagWarningMessage))
			{
			//alert("do not reset");
			return false;
			}
	 //alert("reseting page");
	DirtyFlag = 0;
	ResetErrorFlags();
	return true;
}

function CheckDirty() {
	var allCookies = document.cookie;
	//alert("All cookies = " + allCookies);
	var pos = allCookies.indexOf("DirtyFlag=");
	var start = pos + 10;
	var end = allCookies.indexOf(";",start);
	if (end == -1)
		end = allCookies.length;
		//alert("start =" + start + " end = " + end)
	var  value = allCookies.substring(start,end);
	//alert("DirtyFlag = " + value);
	
	if (value > 0 )
	{
		if(confirm(DirtyFlagWarningMessage) == 0)
		{
			//CanceledAction_Flag = 1;
			return false;	
		}
		else
		{
//			document.cookie = "DirtyFlag=" + 0;
			return true;
		}
	}
}

function ExistsInStr(strValue) {
//	var objRegExp = strFind/i;
	var objRegExp = new RegExp("TewksburyLimoBlankPage.asp", "i");
	alert("objRegExp = " + objRegExp + ", strValue = " + strValue)
  	//check for valid email
  	return objRegExp.test(strValue);
}
//------------------------------------ macromedia code goes below this line ----------------------------------------------

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var temp = imgPath + MM_swapImage.arguments[2]
MM_swapImage.arguments[2] = temp
//alert("arg 2 " + MM_swapImage.arguments[2])
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2)eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;

	// Someone pushed a button and the dirty flag was set and they cancled the action.
	// So we do not want to show the button change.	
	if (CanceledAction_Flag == 1) 
  	{
		CanceledAction_Flag = 0;
		return false;
	}
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

function fPreloadImages() {
//		imgHomeOff = new Image
//		imgHomeOn = new Image
//		imgHomeOff.src = "images/leftnav/btn_home.gif"
//		imgHomeOn.src = "images/leftnav/btn_home_on.gif"
		
		imgmenu1 = new Image
		imgmenu1a_over = new Image
		imgmenu1.src = "img/menu1.gif"
		imgmenu1a_over.src = "img/menu1a_over.gif"
		
		imgPromsOff = new Image
		imgPromsOn = new Image
		imgPromsOn.src = "images/leftnav/btn_proms.gif"
		imgPromsOff.src = "images/leftnav/btn_proms_on.gif"

		imgWeddingsOff = new Image
		imgWeddingsOn = new Image
		imgWeddingsOff.src = "images/leftnav/btn_weddings.gif"
		imgWeddingsOn.src = "images/leftnav/btn_weddings_on.gif"
		
		imgDiningOff = new Image
		imgDiningOn = new Image
		imgDiningOff.src = "images/leftnav/btn_dining.gif"
		imgDiningOn.src = "images/leftnav/btn_dining_on.gif"

		imgSportsOff = new Image
		imgSportsOn = new Image
		imgSportsOff.src = "images/leftnav/btn_sports.gif"
		imgSportsOn.src = "images/leftnav/btn_sports_on.gif"
		
		imgAirportOff = new Image
		imgAirportOn = new Image
		imgAirportOff.src = "images/leftnav/btn_airport.gif"
		imgAirportOn.src = "images/leftnav/btn_airport_on.gif"

		imgVIPOff = new Image
		imgVIPOn = new Image
		imgVIPOff.src = "images/leftnav/btn_vip.gif"
		imgVIPOn.src = "images/leftnav/btn_vip_on.gif"

		imgPoliciesOff = new Image
		imgPoliciesOn = new Image
		imgPoliciesOff.src = "images/leftnav/btn_policies.gif"
		imgPoliciesOn.src = "images/leftnav/btn_policies_on.gif"

		imgReservOff = new Image
		imgReservOn = new Image
		imgReservOff.src = "images/leftnav/btn_reserv.gif"
		imgReservOn.src = "images/leftnav/btn_reserv_on.gif"

		imgContactUsOff = new Image
		imgContactUsOn = new Image
		imgContactUsOff.src = "images/leftnav/btn_contactus.gif"
		imgContactUsOn.src = "images/leftnav/btn_contactus_on.gif"
		}
	
function fImageSwapOn(imgTarget, imgSource) {
	if (eval(imgSource).complete) {
			document.images[imgTarget].src = eval(imgSource).src;
		}
	}

function fImageSwapOff(imgTarget, imgSource) {
	if (eval(imgSource).complete) {
			imgTarget.src = eval(imgSource).src;
		}
	}

function fImageOn(imgTarget) {
	Alert('imagesOn');
	if (document.images) {
			imgOn = eval(imgTarget + ".src");
			imgTarget.src = imgOn;
		}
	}

function fImageOff(imgTarget) {
	Alert('imagesOff');
	if (document.images) {
			imgOff = eval(imgTarget + ".src");
			document[imgTarget].src = imgOff;
		}
	}

function changeImage(filename) {
	document.getElementById('mainimage').src=filename;
	}

function SetStartFocus() {
	var list = document.body.getElementsByTagName("input");
	list[0].focus()	
	list[0].select()
}

function SetFocus(list_nbr)
{
	var list = document.body.getElementsByTagName("input");
	list[list_nbr].focus()	
	list[list_nbr].select()
}

function SetFocusSelect(list_nbr)
{
	var list = document.body.getElementsByTagName("select");
	list[list_nbr].focus()	
}

/******************************************************************************
AUTHOR: Dennis J. Leslie
DATE: 	October 25, 2005
*******************************************************************************/
function validatesecurity(strValue) {
/************************************************
DESCRIPTION: Validates that a string does not contain security patterns.
 
PARAMETERS:
	strValue - String to be tested for validity
 
RETURNS:
   True if valid, otherwise false.
 
REMARKS: Makes sure that user is not inserting invalid words into fields that can
	cause system executions of unwanted code that overrides the system security
*************************************************/
	var objRegExp = /(insert)|(INSERT)|(update)|(UPDATE)|(execute)|(EXECUTE)|(exec)|(EXEC)|(alter)|(ALTER)|(run)|(RUN)/;
	
	// check to verify field entries to not pose security issues
	return objRegExp.test(strValue);
}

/******************************************************************************
AUTHOR: Karen Gayda
 
DATE: 03/24/2000
*******************************************************************************/
 
function validateEmail( strValue) {
/************************************************
DESCRIPTION: Validates that a string contains a
  valid email pattern.
 
 PARAMETERS:
   strValue - String to be tested for validity
 
RETURNS:
   True if valid, otherwise false.
 
REMARKS: Accounts for email with country appended
  does not validate that email contains valid URL
  type (.com, .gov, etc.) or valid country suffix.
*************************************************/
var objRegExp  =
 /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;

  //check for valid email
  return objRegExp.test(strValue);
}
 
function validateUSPhone( strValue ) {
/************************************************
DESCRIPTION: Validates that a string contains valid
  US phone pattern.
  Ex. (999) 999-9999 or (999)999-9999
 
PARAMETERS:
   strValue - String to be tested for validity
 
RETURNS:
   True if valid, otherwise false.
*************************************************/
  var objRegExp  = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
 
  //check for valid us phone with or without space between
  //area code
  return objRegExp.test(strValue);
}
 
function  validateNumeric( strValue ) {
/******************************************************************************
DESCRIPTION: Validates that a string contains only valid numbers.
 
PARAMETERS:
   strValue - String to be tested for validity
 
RETURNS:
   True if valid, otherwise false.
******************************************************************************/
  var objRegExp  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
 
  //check for numeric characters
  return objRegExp.test(strValue);
}
 
function validateInteger( strValue ) {
/************************************************
DESCRIPTION: Validates that a string contains only
    valid integer number.
 
PARAMETERS:
   strValue - String to be tested for validity
 
RETURNS:
   True if valid, otherwise false.
******************************************************************************/
  var objRegExp  = /(^-?\d\d*$)/;
 
  //check for integer characters
  return objRegExp.test(strValue);
}
 
function validateUSZip( strValue ) {
/************************************************
DESCRIPTION: Validates that a string a United
  States zip code in 5 digit format or zip+4
  format. 99999 or 99999-9999
 
PARAMETERS:
   strValue - String to be tested for validity
 
RETURNS:
   True if valid, otherwise false.
 
*************************************************/
var objRegExp  = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
 
  //check for valid US Zipcode
  return objRegExp.test(strValue);
}

function validateUSZip1( strValue ) {
/************************************************
DESCRIPTION: Validates that a string is a United
  States zip code in 5 digit format 
  format. 99999
 
PARAMETERS:
   strValue - String to be tested for validity
 
RETURNS:
   True if valid, otherwise false.
 
*************************************************/
var objRegExp  = /(^\d{5}$)/;
 
  //check for valid US Zipcode
  return objRegExp.test(strValue);
}

function validateUSZip2( strValue ) {
/************************************************
DESCRIPTION: Validates that a string is a United
  States zip code extension in 4 digit format. 9999
 
PARAMETERS:
   strValue - String to be tested for validity
 
RETURNS:
   True if valid, otherwise false.
 
*************************************************/
var objRegExp  = /(^\d{4}$)/;
 
  //check for valid US Zipcode
  return objRegExp.test(strValue);
}
 
function validateUSDate( strValue ) {
/************************************************
DESCRIPTION: Validates that a string contains only
    valid dates with 2 digit month, 2 digit day,
    4 digit year. Date separator can be ., -, or /.
    Uses combination of regular expressions and
    string parsing to validate date.
    Ex. mm/dd/yyyy or mm-dd-yyyy or mm.dd.yyyy
 
PARAMETERS:
   strValue - String to be tested for validity
 
RETURNS:
   True if valid, otherwise false.
 
REMARKS:
   Avoids some of the limitations of the Date.parse()
   method such as the date separator character.
*************************************************/
  var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
 
  //check to see if in correct format
  if(!objRegExp.test(strValue))
    return false; //doesn't match pattern, bad date
  else{
    var strSeparator = strValue.substring(2,3) //find date separator
    var arrayDate = strValue.split(strSeparator); //split date into month, day, year
    //create a lookup for months not equal to Feb.
    var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31,
                        '08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31}
    var intDay = parseInt(arrayDate[1]);
 
    //check if month value and day value agree
    if(arrayLookup[arrayDate[0]] != null) {
      if(intDay <= arrayLookup[arrayDate[0]] && intDay != 0)
        return true; //found in lookup table, good date
    }
 
    //check for February
    var intYear = parseInt(arrayDate[2]);
    var intMonth = parseInt(arrayDate[0]);
    if( ((intYear % 4 == 0 && intDay <= 29) || (intYear % 4 != 0 && intDay <=28)) && intDay !=0)
      return true; //Feb. had valid number of days
  }
  return false; //any other values, bad date
}

function rightTrim( strValue ) {
/************************************************
DESCRIPTION: Trims trailing whitespace chars.
 
PARAMETERS:
   strValue - String to be trimmed.
 
RETURNS:
   Source string with right whitespaces removed.
*************************************************/
var objRegExp = /^([\w\W]*)(\b\s*)$/;
 
      if(objRegExp.test(strValue)) {
       //remove trailing a whitespace characters
       strValue = strValue.replace(objRegExp, '$1');
    }
  return strValue;
}
 
function leftTrim( strValue ) {
/************************************************
DESCRIPTION: Trims leading whitespace chars.
 
PARAMETERS:
   strValue - String to be trimmed
 
RETURNS:
   Source string with left whitespaces removed.
*************************************************/
var objRegExp = /^(\s*)(\b[\w\W]*)$/;
 
      if(objRegExp.test(strValue)) {
       //remove leading a whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}
 
function trimAll( strValue ) {
/************************************************
DESCRIPTION: Removes leading and trailing spaces.
 
PARAMETERS: Source string from which spaces will
  be removed;
 
RETURNS: Source string with whitespaces removed.
*************************************************/
 var objRegExp = /^(\s*)$/;
 
    //check for all spaces
    if(objRegExp.test(strValue)) {
       strValue = strValue.replace(objRegExp, '');
       if( strValue.length == 0)
          return strValue;
    }
 
   //check for leading & trailing spaces
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) {
       //remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}
 
function formatPhone( strValue ) {
/************************************************
DESCRIPTION: Format input field to US Phone Number
 
PARAMETERS:
  strValue - source string containing commas.
 
RETURNS: String modified with comma grouping if
  source was all numeric, otherwise source is
  returned.
 
*************************************************/
  var newStr;
 
  s = strValue.value
  newStr = '(' + s.substring(0,3) + ') ' + s.substring(3,6) + '-' + s.substring(6,10);
  //alert(newStr);
  strValue.value = newStr;
}
 
function stringFilterPhone (input)
{
	s = input.value;
	filteredValues = ",'&%$#@!~`()[]{}<>;:-+=^£ ";     // Characters stripped out  Do not remove decimal points.
	var i;
	var c;
	var returnString = "";
	for (i = 0; i < s.length; i++)
		{  // Search through string and append to unfiltered values to returnString.
		c = s.charAt(i);
		if (filteredValues.indexOf(c) == -1)
			returnString += c;
		}
	input.value = returnString;
}

function stringFilter (input)
{
	s = input.value;
	filteredValues = ",'&%$#@!~`()[]{}<>;:-+=^£";     // Characters stripped out  Do not remove decimal points.
	var i;
	var c;
	var returnString = "";
	for (i = 0; i < s.length; i++)
		{  // Search through string and append to unfiltered values to returnString.
		c = s.charAt(i);
		if (filteredValues.indexOf(c) == -1)
			returnString += c;
		}
	input.value = returnString;
}

function stringFilterSpecial (input)
{
	s = input.value;
//	filteredValues = "'&~`^{}<>";     // Characters stripped out  Do not remove decimal points.
//  modified March 5, 2006 (Dennis Leslie) - "&" sign was excluded from list of stripped objects
	filteredValues = "'~`^{}<>";     // Characters stripped out  Do not remove decimal points.
	var i;
	var c;
	var returnString = "";
	for (i = 0; i < s.length; i++)
		{  // Search through string and append to unfiltered values to returnString.
		c = s.charAt(i);
		if (filteredValues.indexOf(c) == -1)
			returnString += c;
		}
	input.value = returnString;
}
 
function removeCurrency( strValue ) {
/************************************************
DESCRIPTION: Removes currency formatting from
  source string.
 
PARAMETERS:
  strValue - Source string from which currency formatting
     will be removed;
 
RETURNS: Source string with commas removed.
*************************************************/
  var objRegExp = /\(/;
  var strMinus = '';
 
  //check if negative
  if(objRegExp.test(strValue)){
    strMinus = '-';
  }
 
  objRegExp = /\)|\(|[,]/g;
  strValue = strValue.replace(objRegExp,'');
  if(strValue.indexOf('$') >= 0){
    strValue = strValue.substring(1, strValue.length);
  }
  return strMinus + strValue;
}
 
function addCurrency( strValue ) {
/************************************************
DESCRIPTION: Formats a number as currency.
 
PARAMETERS:
  strValue - Source string to be formatted
 
REMARKS: Assumes number passed is a valid
  numeric value in the rounded to 2 decimal
  places.  If not, returns original value.
*************************************************/
  var objRegExp = /-?[0-9]+\.[0-9]{2}$/;
 
    if( objRegExp.test(strValue)) {
      objRegExp.compile('^-');
      strValue = addCommas(strValue);
      if (objRegExp.test(strValue)){
        strValue = '(' + strValue.replace(objRegExp,'') + ')';
      }
      return '$' + strValue;
    }
    else
      return strValue;
}
 
function removeCommas( strValue ) {
/************************************************
DESCRIPTION: Removes commas from source string.
 
PARAMETERS:
  strValue - Source string from which commas will
    be removed;
 
RETURNS: Source string with commas removed.
*************************************************/
  var objRegExp = /,/g; //search for commas globally
 
  //replace all matches with empty strings
  return strValue.replace(objRegExp,'');
}
 
function addCommas( strValue ) {
/************************************************
DESCRIPTION: Inserts commas into numeric string.
 
PARAMETERS:
  strValue - source string containing commas.
 
RETURNS: String modified with comma grouping if
  source was all numeric, otherwise source is
  returned.
 
REMARKS: Used with integers or numbers with
  2 or less decimal places.
*************************************************/
  var objRegExp  = new RegExp('(-?[0-9]+)([0-9]{3})');
 
    //check for match to search criteria
    while(objRegExp.test(strValue)) {
       //replace original string with first group match,
       //a comma, then second group match
       strValue = strValue.replace(objRegExp, '$1,$2');
    }
  return strValue;
}
 
function removeCharacters( strValue, strMatchPattern ) {
/************************************************
DESCRIPTION: Removes characters from a source string
  based upon matches of the supplied pattern.
 
PARAMETERS:
  strValue - source string containing number.
 
RETURNS: String modified with characters
  matching search pattern removed
 
USAGE:  strNoSpaces = removeCharacters( ' sfdf  dfd', '\s*')
*************************************************/
 var objRegExp =  new RegExp( strMatchPattern, 'gi' );
 
 //replace passed pattern matches with blanks
  return strValue.replace(objRegExp,'');
}

mainImages = new Array("images/mainpage/patriots4.jpg","images/mainpage/bridal10.jpg","images/mainpage/gambling2.jpg","images/mainpage/bruins1.jpg","images/mainpage/bridal2.jpg");
thisMain = 0;
imgCt = mainImages.length;

function rotate() {
	if (document.images) {
		thisMain++
		if (thisMain == imgCt) {
			thisMain = 0
		}
		document.mainBanner.src=mainImages[thisMain]
		setTimeout("rotate()", 7 * 1000)
	}	
}

function openWindowwebsites(strValue) {
	popupWin = window.open("www.quilion.com", "websites", "width=325, height=200");
}

function doPopUp(strValue) {
	switch(strValue) {
		case 1: doPopUpWindow = window.open("van_disclosure_popup.asp", "popup", "scrollbars=no, toolbar=no, width=400, height=300");
			break;
		case 2: doPopUpWindow = window.open("prom_package_popup.asp", "popup", "scrollbars=no, toolbar=no, width=680, height=450");
			break;
		case 3: doPopUpWindow = window.open("wedding_package_popup.asp", "popup", "scrollbars=no, toolbar=no, width=680, height=450");
			break;
		case 4: doPopUpWindow = window.open("privacy_popup.asp", "popup", "scrollbars=yes, toolbar=no, width=600, height=600");
			break;
		case 5: doPopUpWindow = window.open("terms_popup.asp", "popup", "scrollbars=yes, toolbar=no, width=600, height=600");
			break;
		case 6: doPopUpWindow = window.open("security_popup.asp", "popup", "scrollbars=yes, toolbar=no, width=600, height=600");
			break;
		case 7: doPopUpWindow = window.open("other_package_popup.asp", "popup", "scrollbars=no, toolbar=no, width=680, height=510");
			break;
		case 8: doPopUpWindow = window.open("buying_car_popup.asp", "popup", "scrollbars=yes, toolbar=no, width=680, height=700");
			break;
		case 9: doPopUpWindow = window.open("tewksautorepair_employmentpopup.asp", "popup", "scrollbars=yes, toolbar=no, width=780, height=595");
			break;
		default: doPopUpWindow = window.open("program_error_popup.asp", "popup", "scrollbars=no, toolbar=no, width=400, height=300");
			break;
	}
}

function doPopUpAuto(car_id, car_sold, actv_flg) {
	var pass_str = "?car_id="+car_id + "&car_sold=" + car_sold + "&actv_flg=" + actv_flg;
	doPopUpWindow = window.open("auto_data_popup.asp"+pass_str, "popup", "scrollbars=no, toolbar=no, width=800, height=600");
}

function doPopUpService(service_id, customer_id, vehicle_id) {
	var pass_str = "?service_id="+service_id + "&customer_id="+customer_id + "&vehicle_id="+vehicle_id;
	alert("service_id =" + service_id + ", custoner_id = " + customer_id + ", vehicle_id = "+ vehicle_id);
	doPopUpWindow = window.open("ViewServicePopUp.asp"+pass_str, "popup", "scrollbars=no, toolbar=no, width=660, height=280");
}

function doPopUpWarrantyInfo(service_id, vendor_inv) {
	var pass_str = "?service_id="+service_id + "&vendor_inv= " + vendor_inv;
//	alert("service_id =" + service_id + ", vendor_inv = " + vendor_inv);
	doPopUpWindow = window.open("ViewWarrantyPopUp.asp"+pass_str, "popup", "scrollbars=no, toolbar=no, width=520, height=340");
}

function doPopUpWarrantyEntry(service_id, service_date, warranty_id) {
	var pass_str = "?service_id="+service_id + "&service_date= " + service_date + "&warranty_id= " + warranty_id;
//	alert("pass_str =" +pass_str);
doPopUpWindow = window.open("EnterWarrantyInfoPopUp.asp"+pass_str, "popup", "scrollbars=no, toolbar=no, width=480, height=390");
}

//--------------------------------------------------------------------------------------------------------------------------------------
//
// Use these functions in NewVehicle and Reservations to populate listboxes
//
//--------------------------------------------------------------------------------------------------------------------------------------
function setDynaList(arrDL){
	//alert("setDynaList")
   var oList1 = document.forms[arrDL[2]].elements[arrDL[1]];
   var oList2 = document.forms[arrDL[4]].elements[arrDL[3]];
   var arrList = arrDL[5];
 
   clearDynaList(oList2);
 
   if (oList1.selectedIndex == -1){
      oList1.selectedIndex = 0;
   }
   populateDynaList(oList2, oList1[oList1.selectedIndex].value, arrList);
   return true;
}
 
function clearDynaList(oList){
   for (var i = oList.options.length; i >= 0; i--){
      oList.options[i] = null;
   }
   oList.selectedIndex = -1;
}
 
function populateDynaList(oList, nIndex, aArray){
   for (var i = 0; i < aArray.length; i= i + 3){
      if (aArray[i] == nIndex){
         oList.options[oList.options.length] = new Option(aArray[i + 1], aArray[i + 2]);
      }
   }
   if (oList.options.length == 0){
      oList.options[oList.options.length] = new Option("No Data Available", 0);
   }
   oList.selectedIndex = 0;
}

function Detect(value, value2) {
	if (CheckDirty())
	{
		document.cookie = "DirtyFlag=" + 0;
		if (value = 0)
			ViewAll = value2;
		else
			cust_type = value2;
	}
}


