function preLoadHomepageImages (form) {
     //preload the homepage images
     matrix_img1= new Image(128,83);matrix_img1.src = "/dccdocs/graphics/globe.jpg"
     matrix_img2 = new Image(128,83);matrix_img2.src = "/dccdocs/graphics/banquet hall.jpg"
     matrix_img3 = new Image(128,83);matrix_img3.src = "/dccdocs/graphics/wineglasses.jpg"
     matrix_img4 = new Image(128,83);matrix_img4.src = "/dccdocs/graphics/dancing2.jpg"
     matrix_img5 = new Image(128,83);matrix_img5.src = "/dccdocs/graphics/diary_writing.jpg"
     matrix_img6 = new Image(128,83);matrix_img6.src = "/dccdocs/graphics/keyboard.jpg"
     matrix_img7 = new Image(128,83);matrix_img7.src = "/dccdocs/graphics/fireworks.jpg"
     matrix_img8 = new Image(128,83);matrix_img8.src = "/dccdocs/graphics/buffet.jpg"
     matrix_img9 = new Image(128,83);matrix_img9.src = "/dccdocs/graphics/dinnertable1.jpg"	 		  

}    
/*************************end of preLoadHomepageImages()*************************/		  

function preLoadNavbar (form) {
  	//preload the navigation bar images
    img_link1_off = new Image(); img_link1_off.src = "/dccdocs/graphics/home1.gif";        
	img_link1_on = new Image(); img_link1_on.src = "/dccdocs/graphics/home2.gif";
    img_link2_off = new Image(); img_link2_off.src = "/dccdocs/graphics/bhalllist1.gif"; 
    img_link2_on = new Image(); img_link2_on.src = "/dccdocs/graphics/bhalllist2.gif";
    img_link3_off = new Image(); img_link3_off.src = "/dccdocs/graphics/ologin1.gif"; 
    img_link3_on = new Image(); img_link3_on.src = "/dccdocs/graphics/ologin2.gif";
    img_link4_off = new Image(); img_link4_off.src = "/dccdocs/graphics/disclaimer1.gif"; 
    img_link4_on = new Image(); img_link4_on.src = "/dccdocs/graphics/disclaimer2.gif";
    img_link5_off = new Image(); img_link5_off.src = "/dccdocs/graphics/aboutus1.gif"; 
    img_link5_on = new Image(); img_link5_on.src = "/dccdocs/graphics/aboutus2.gif";
    img_link6_off = new Image(); img_link6_off.src = "/dccdocs/graphics/contact1.gif"; 
    img_link6_on = new Image(); img_link6_on.src = "/dccdocs/graphics/contact2.gif";
    img_link7_off = new Image(); img_link7_off.src = "/dccdocs/graphics/help1.gif"; 
    img_link7_on = new Image(); img_link7_on.src = "/dccdocs/graphics/help2.gif";	
	  
    //preload site logo
	img_bcc_logo = new Image();img_bcc_logo.src = "/dccdocs/graphics/dcc_navy.jpg";
	
	//preload welcome banner for login.html
	img_welcome_banr = new Image();img_welcome_banr.src = "/dccdocs/graphics/welcome.gif";
	
	//check browser
	//browserWarn(form)
}
/************************* end of preLoadNavbar()*************************/	

function preLoadNavbarSSL (form, ssl_url) {
  	//preload the navigation bar images
    img_link1_off = new Image(); img_link1_off.src = "+ssl_url+/dccdocs/graphics/home1.gif";        
	img_link1_on = new Image(); img_link1_on.src = "/dccdocs/graphics/home2.gif";
    img_link2_off = new Image(); img_link2_off.src = "/dccdocs/graphics/bhalllist1.gif"; 
    img_link2_on = new Image(); img_link2_on.src = "/dccdocs/graphics/bhalllist2.gif";
    img_link3_off = new Image(); img_link3_off.src = "/dccdocs/graphics/ologin1.gif"; 
    img_link3_on = new Image(); img_link3_on.src = "/dccdocs/graphics/ologin2.gif";
    img_link4_off = new Image(); img_link4_off.src = "/dccdocs/graphics/disclaimer1.gif"; 
    img_link4_on = new Image(); img_link4_on.src = "/dccdocs/graphics/disclaimer2.gif";
    img_link5_off = new Image(); img_link5_off.src = "/dccdocs/graphics/aboutus1.gif"; 
    img_link5_on = new Image(); img_link5_on.src = "/dccdocs/graphics/aboutus2.gif";
    img_link6_off = new Image(); img_link6_off.src = "/dccdocs/graphics/contact1.gif"; 
    img_link6_on = new Image(); img_link6_on.src = "/dccdocs/graphics/contact2.gif";
    img_link7_off = new Image(); img_link7_off.src = "/dccdocs/graphics/help1.gif"; 
    img_link7_on = new Image(); img_link7_on.src = "/dccdocs/graphics/help2.gif";	
	  
    //preload site logo
	img_bcc_logo = new Image();img_bcc_logo.src = "/dccdocs/graphics/dcc_navy.jpg";
	
	//preload welcome banner for login.html
	img_welcome_banr = new Image();img_welcome_banr.src = "/dccdocs/graphics/welcome.gif";
	
	//check browser
	//browserWarn(form)
}
/************************* end of preLoadNavbar()*************************/	
	  

//function mousein(num) { document.images[eval("\"link" + num + "\"")].src = eval("img_link" + num + "_on.src"); }


//function mouseout(num) { document.images[eval("\"link" + num + "\"")].src = eval("img_link" + num + "_off.src"); }

function fToggleColor(myElement) {
  
  var toggleColor = "#ffffcc"
  if (myElement.id == "leftMenuItem") {
	if (myElement.color == toggleColor) {
      myElement.color = "#EEEECC";
    } else {
      myElement.color = toggleColor
    }
  }
}

function noRightClick()
{
  if (event.button==2)
  {
    alert("Right click has been disabled")
  }
}

function count_text(form,txt_fld,counter_fld,limit){
    /*How to call:
    <textarea cols=70 name=email_body rows=10 wrap=PHYSICAL           
    onKeyPress="count_text(this.form,this,'700')" 
    onKeyUp="count_text(this.form,this,frm.counter2,'254')"></textarea>*/
    var max_text = limit;
	elem=txt_fld.value
    if (elem.length == 0){
      data = "";
    } else {
      data = elem;
    }
    data_length= data.length;
    counter_fld.value = data_length;
  if (data_length > max_text ) { 
    elem=data.substring(0,max_text);
	counter_fld.value=max_text;
    txt_fld.blur();
    alert ("Maximum message length reached. Your message has been truncated at "+max_text+" characters.");

  }  
}
/************************* end of count_text()*************************/


function setMapParams(form) {
  //uses mapsonus.com
    addrstreetline = document.forms[0].AD2.value;
	addrcityline = document.forms[0].citystatezip.value;
	//addrcityline = document.forms[0].city.value + " " + document.forms[0].zip.value
  	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/2) - (350 + 10); //half the screen width minus 
                                             //half the new window width (plus 5 pixel borders).
    iMyHeight = (window.screen.height/2) - (200 + 50); //half the screen height minus 
                                      //half the new window height (plus title and status bars).
    var win2 =      window.open("http://mapsonus.com/bin/maps-map/usr=~new/formName=mapsetaddr?AddrStreetLine="+addrstreetline+"&AddrCityLine="+addrcityline,"Window2","status,location,toolbar,height=400,width=700,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes"); 
}
/*************************setMapParams()*************************/


function sendMail(bnqtId,app_url) {
    var iMyWidth;
    var iMyHeight;
    //gets top and left positions based on user's resolution so hint window is centered.
    iMyWidth = (window.screen.width/2) - (350 + 10); //half the screen width minus 
                                     //half the new window width (plus 5 pixel borders).
    iMyHeight = (window.screen.height/2) - (200 + 50); //half the screen height minus 
                                   //half the new window height (plus title and status bars).
    var win2 = window.open(app_url+"/app/usermail.php?banquet_id="+bnqtId, "Window2","status,toolbar,height=575,width=800,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");

}
/************************* end of sendMail()*************************/


function activateMapPopup(form, action) {
    //uses google local
    if (action == "AREAMAP") {
	  AD2_street = document.forms[0].AD2.value
	  AD2 = document.forms[0].AD2.value
	  AD3 = document.forms[0].city.value
	  AD4 = document.forms[0].AD4.value  + " " + document.forms[0].zip.value
	  CMD = document.forms[0].CMD.value
	  var iMyWidth;
	  var iMyHeight;
	  //gets top and left positions based on user's resolution so hint window is centered.
	  /*
	  iMyWidth = (window.screen.width/2) - (350 + 10); //half the screen width minus 
                                    //half the new window width (plus 5 pixel borders).
      iMyHeight = (window.screen.height/2) - (200 + 50); //half the screen height minus 
                                   //half the new window height (plus title and status bar
	  */
      //gets top and left positions based on user's resolution so hint window is centered.
	  iMyWidth = (window.screen.width/2) - (350 + 10); //half the screen width minus 
                                     //half the new window width (plus 5 pixel borders).
      iMyHeight = (window.screen.height/2) - (200 + 50); //half the screen height minus 
                                     //half the new window height (plus title and status bars).

	  //iMyWidth = (window.screen.width)-(400 + 10);
	  //iMyHeight = (window.screen.height)-(250 + 50);
  	  var win2 = window.open("http://www.google.com/maps?oi=map&q="+AD2+","+AD3+","+AD4, "Window2","status,toolbar,height=575,width=800,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
    } else if (action == 'DIRECTIONS'){
	  
	  d_AD2 = document.forms[0].AD2.value
	  d_AD3 = document.forms[0].city.value
	  d_AD4 = document.forms[0].AD4.value  + " " + document.forms[0].zip.value
	  d_CMD = document.forms[0].CMD.value
	 // req_action = "getdir"
	  s_addr = "5675 Maxwelton Rd, Langley, Washington, 98260"
	  d_addr = "'" + d_AD2 + "," + d_AD3 + "," + d_AD4
	  var iMyWidth;
	  var iMyHeight;
	  //gets top and left positions based on user's resolution so hint window is centered.
	  /*
	  iMyWidth = (window.screen.width/2) - (122 + 10); //half the screen width minus half             
                                             //the new window width (plus 5 pixel borders).
      iMyHeight = (window.screen.height/2) - (27 + 50); //half the screen height minus 
                                   //half the new window height (plus title and status bars).
      */								   
	  iMyWidth = (window.screen.width)-(400 + 10);
	  iMyHeight = (window.screen.height)-(250 + 50);
	  var win2 = window.open("http://maps.google.com/maps?saddr="+s_addr+"&daddr="+d_addr, "Window2","status,toolbar,height=600,width=1000,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
	}
      win2.focus();
}
/*************************end of activateMapPopup()*************************/
	
	
function goToWebsite(url) {
    //the website url has to be http://www.x0x0x0.com
	//website url such as www.xoxoxo.com will be rejected
  	//url  = form.website_url.value;
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/2) - (350 + 10); //half the screen width minus 
                                    //half the new window width (plus 5 pixel borders).
    iMyHeight = (window.screen.height/2) - (200 + 50); //half the screen height minus 
                                   //half the new window height (plus title and status bars).
	var win2 = window.open(url,"Window2","status,toolbar,height=575,width=800,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");

}
/************************* end of goToWebsite()*************************/
	
function chngPic(form){
    bnqt_id = form.banquet_id.value
	user_seq_num = form.user_seq.value
	var iMyWidth;
    var iMyHeight;
    //gets top and left positions based on user's resolution so hint window is centered.
    iMyWidth = (window.screen.width/2) - (238 + 10); //half the screen width minus half             
                                            //the new window width (plus 5 pixel borders).
   	iMyHeight = (window.screen.height/2) - (350 + 50); //half the screen height minus 
                                   //half the new window height (plus title and status bars).
//	    var win2 = window.open("../../cgi-bin/picload.php?user_seq="+user_seq_num, "Window2","status,height=400,width=700,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=no");
    var win2 = window.open("../../cgi-bin/picload.php?banquet_id="+bnqt_id, "Window2","status,height=500,width=650,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=no");
    win2.focus();
}
/************************* end of chngPic()*************************/

function validatePassword(form) {
  if (newPwdInfo.new_pwd.value == newPwdInfo.retype_new_pwd.value) {
    if (newPwdInfo.new_pwd.value == newPwdInfo.user_pwd.value) {
	  alert ("The existing password and the new password cannot be same.")
	  return false
	} else {
	  form.submit()
	}
  } else {
	alert ("The new passwords do not match, Please re-enter.")
	return false
  }
}
/************************* end of validatePassword()*************************/

function validateFile(form) {
    if (document.forms[0].banquet_image.value == "") {
	  alert ("Select a valid picture file to upload (.png, .jpg, .gif)");
	  return false
	} else {
      if (checkFileType(this.form)) {
//        if (validateFilename(this.form)) {
	      form.submit();
//	    } else {
//          alert ("Filename cannot have a space")
//	    }
	  } else {
	    alert ("Only image files of type .png, .jpg and .gif can be uploaded")
	  }
	}
}
/************************* end of validateFile()*************************/

function validateFilename(form) {
  //if filename contains empty space then reject
  t = document.forms[0].banquet_image.value
  if (t.indexOf(" ", 0) >= 0){
    return false
  } else {
	return true
  }
} 
/************************** end of validateFilename() ******************/
  
function checkFileType(form) {
    t = document.forms[0].banquet_image.value
    if ((t.indexOf("gif", 0) >= 0) || (t.indexOf("GIF", 0) >= 0)){
	  return true
	} else if ((t.indexOf("jpg", 0) >= 0) || (t.indexOf("JPG", 0) >= 0)){
	  return true
	} else if ((t.indexOf("png", 0) >= 0) || (t.indexOf("PNG", 0) >= 0)){
	  return true
	} else {
	  return false
	}
}
/************************* end of checkFileType()*************************/	  

function noImage(form) {
    user_seq_number = document.forms[0].user_seq.value
	cntry_id = document.forms[0].country_id.value
    location.href = "http://www.banquetcentral.com/cgi-bin/newfacl.php?user_seq=" + user_seq_number + "&country_id=" + cntry_id
}
/************************* end of noImage()*************************/
function openImgViewWindow(form) {
     var iMyWidth;
     var iMyHeight;
     //gets top and left positions based on user's resolution so hint window is centered.
     iMyWidth = (window.screen.width/2) - (350 + 10); //half the screen width minus   
                                                      //half the new window width (plus 5 
                                                      //pixel borders).
     iMyHeight = (window.screen.height/2) - (200 + 50); //half the screen height minus 
                                  //half the new window height (plus title and status bars).
     var win2 = window.open("http://www.banquetcentral.com/cgi-bin/imgview.php?filenm=" + document.uploadFrm.filenm.value, "Window2","status,height=400,width=700,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
		
     win2.focus();
}
/************************* end of openResultWindow()*************************/
  
function browserWarn(form) {
/* if (navigator.appName == "Microsoft Internet Explorer") {
   browserVersion = parseInt(navigator.appVersion);
   alert ("Browser="+navigator.appName+", version="+browserVersion)
}  else { 
*/

   if (navigator.appName == "Netscape") {
   //document.write('<META HTTP-EQUIV="REFRESH" CONTENT="1;URL=/dccdocs/html/brwsrwarn.html">');
   browserType = navigator.appName
   browserVersion = parseInt(navigator.appVersion);   
   //gets top and left positions based on user's resolution so hint window is centered.
   iMyWidth = (window.screen.width/2) - (350 + 10); //half the screen width minus   
                                                    //half the new window width (plus 5 
                                                    //pixel borders).
   iMyHeight = (window.screen.height/2) - (200 + 50); //half the screen height minus 
                                  //half the new window height (plus title and status bars).
   var win2 = window.open("http://www.banquetcentral.com/cgi-bin/brwsrwarn.php?browser_type="+browserType+"&browser_version="+browserVersion, "Window2","location=1,status,height=400,width=700,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
   win2.focus();
   }

}	  
/************************* end of browserWarn()*************************/

function openExamplePopup(form,action) {
  if (action == "DINING") {
    list_content = "Example: Kosher, Vegetarian, None.."
  } else if (action == "MENU") {
    list_content = "Example: American, American-Soutwestern, Chinese, Continental, French, Greek, Indian, Italian, Mexican, Middle Eastern.."
  } else if (action == "WEBSITE") {
    list_content = "Example: http://www.mywebsite.com/index.html\n(make sure you enter the entire URL, including the http:// portion)"
  } else if (action == "FACILITYTYPE") {
    list_content = "Example: Banquet Facility, Restaurant, Community Hall, Church, Club House, Country Club.."
  }
  alert(list_content)
  return
}
/*******end of openExamplePopup() for tips in newfacl.php and admindetl.php*********/

function deleteCheck(form, bnqt_id) {
  //Prompt the user and confirm
  if(confirm('Are you sure, you want to delete?')) {
    //perform delete
    location.href = "http://www.banquetcentral.com/cgi-bin/delete_list.php?banquet_id=" + bnqt_id
  }

}

/************************* end of deleteCheck()*************************/

function goToLinkWebsite(form,url) {
    //the website url has to be http://www.x0x0x0.com
	//website url such as www.xoxoxo.com will be rejected
  	//url  = document.forms[0].website_url.value;
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/2) - (350 + 10); //half the screen width minus 
                                    //half the new window width (plus 5 pixel borders).
    iMyHeight = (window.screen.height/2) - (200 + 50); //half the screen height minus 
                                   //half the new window height (plus title and status bars).
	var win2 = window.open("http://www.banquetcentral.com/cgi-bin/link_svc.php?"+ url,"Window2","status,toolbar,height=575,width=800,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");

//	var win2 = window.open(url,"Window2","status,toolbar,height=575,width=800,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");

}
/************************* end of goToLinkWebsite()*************************/
function goToPassedWebsite(form,url) {
    //the website url has to be http://www.x0x0x0.com
	//website url such as www.xoxoxo.com will be rejected
  	//url  = document.forms[0].website_url.value;
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/2) - (350 + 10); //half the screen width minus 
                                    //half the new window width (plus 5 pixel borders).
    iMyHeight = (window.screen.height/2) - (200 + 50); //half the screen height minus 
                                   //half the new window height (plus title and status bars).
	var win2 = window.open(url,"Window2","status,toolbar,height=575,width=800,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");

}
/************************* end of goToWebsite()**************************/

function verifyStreetAddress(form) {
	AD2 = document.forms[0].street_line1.value;
    AD3 = document.forms[0].city.value;
    AD4 = getSelectedText(document.forms[0].state_id)  + " " + document.forms[0].zip.value;
	addr = AD2 + "," + AD3 + "," + AD4;
	url = "http://maps.google.com/maps?oi=map&q="+addr
	goToPassedWebsite(form,url)
	
}
/************************* end of verifyStreetAddress()**************************/

function hide_display(id) {
var e = document.getElementById(id);
e.style.display = 'none';
}

function toggle_display(id,lat,lng) {
var e = document.getElementById(id);
if(e.style.display == 'none') {
    e.style.display = 'block';
     var myOptions = {
        zoom: 8,      //zoom is set here
        center: new google.maps.LatLng(lat,lng),
        mapTypeId: google.maps.MapTypeId.ROADMAP    //radmap,aerial,etc
      }
     map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
     setMarkers(map, beaches);
}
else {
    e.style.display = 'none';
}

}
/************************* end of toggle_display()**************************/

