//POPUP WINDOWS
function contestpop() {
popwin = this.open("contest.html", "menu", "width=500,height=400, toolbar=no,menubar=no,location=no,resize=no,noresize,scrollbars=yes");
popwin.focus();}
//href=javascript:menupop("menu.html")

function menupop(imagename) {
popwin = this.open(imagename, "menu", "width=500,height=400, toolbar=no,menubar=no,location=no,resize=no,noresize,scrollbars=yes");
popwin.focus();}
//href=javascript:menupop("menu.html")

function mappop(imagename) {
popwin = this.open(imagename, "map", "width=400,height=400, toolbar=no,menubar=no,location=no,resize=no,noresize");
popwin.focus();}
//href=javascript:mappop("map.html")

function gallerypop(imagename) {
popwin = this.open(imagename, "gallery", "width=500,height=375, toolbar=no,menubar=no,location=no,scrollbars=no,resize=no,noresize");
popwin.focus();}
// href=javascript:gallerypop("gallery/1.html")

//-------------------------------------------------------------------------------------

//RANDOM IMAGES


var ListPIC = new Array("PIC_madison_1.jpg", "PIC_madison_2.jpg", "PIC_madison_3.jpg", "PIC_madison_4.jpg", "PIC_madison_5.jpg", "PIC_madison_6.jpg", "PIC_madison_7.jpg", "PIC_madison_8.jpg")
function RandomPIC(){
	if(document.images){
		randomNum = Math.floor((Math.random()*10))%8
			document.PIC.src = "images/"+ ListPIC[randomNum]
	}
}

//usage: onLoad="RandomPIC()"

//-------------------------------------------------------------------------------------

//IMAGE PRELOADER & ROLLOVER FUNCTIONS

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 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];}}

//-------------------------------------------------------------------------------------

//DEFINE FLASH VARIABLE
/*Flash setup
create variable or dynamic textbox in the root timeline called VAR
*/
 function flashVar(text) {
 window.document.FLASHNAME.SetVariable("VAR", text);
 }
//
/*USAGE
BODY  add-> onLoad="flashVar('VALUE')"

OBJECT  add->  ID="FLASHNAME"
EMBED  add->  NAME="FLASHNAME" swLiveconnect=true
*/

//-------------------------------------------------------------------------------------

//SCREEN REZ CHECKER


//Screen resolution detecter script: By JavaScript Kit (www.javascriptkit.com) More free scripts here! Note: Credit must stay intact for use.

var correctwidth=800;
var correctheight=600;
if (screen.width<correctwidth||screen.height<correctheight){
alert("This webpage is bested viewed with screen resolution "+correctwidth+"*"+correctheight+" or above. Your current resolution is "+screen.width+"*"+screen.height+". If possible, please change the resolution!");
}

//-------------------------------------------------------------------------------------


//WINDOW SIZING CENTERING
//-------------------------------------------------------------------------------------
/*****
* [resizewin.js] v2.1
* 2001-08-05
* Author: Anarchos
* E-mail: anarchos3@hotmail.com
* URL: http://anarchos.xs.mw/
***/

function resizeWin(maxX,maxY,speed,delay,win){
	this.obj = "resizeWin" + (resizeWin.count++);
	eval(this.obj + "=this");
	if (!win)     this.win = self;    else this.win = eval(win);
	if (!maxX)    this.maxX = 400;    else this.maxX = maxX;
	if (!maxY)    this.maxY = 300;    else this.maxY = maxY;
	if (!speed)   this.speed = 1/5;   else this.speed = 1/speed;
	if (!delay)   this.delay = 0;    else this.delay = delay;
	this.doResize = (document.all || document.getElementById);
	this.stayCentered = false;
	
	this.initWin = 	function(){
		if (this.doResize){
			this.resizeMe();
			}
		else {
			this.win.resizeTo(this.maxX + 10, this.maxY - 20);
			}
		}

	this.resizeMe = function(){
		this.win.focus();
		this.updateMe();
		}
	
	this.resizeTo = function(x,y){
		this.maxX = x;
		this.maxY = y;
		this.resizeMe();
		}
		
	this.stayCentered = function(){
		this.stayCentered = true;
		}

	this.updateMe = function(){
		this.resizing = true;
		var x = Math.ceil((this.maxX - this.getX()) * this.speed);
		var y = Math.ceil((this.maxY - this.getY()) * this.speed);
		if (x == 0 && this.getX() != this.maxX) {
			if (this.getX() > this.maxX) x = -1;
			else  x = 1;
			}
		if (y == 0 && this.getY() != this.maxY){
			if (this.getY() > this.maxY) y = -1;
			else y = 1;
			}
		if (x == 0 && y == 0) {
			this.resizing = false;
    		}
		else {
			this.win.top.resizeBy(parseInt(x),parseInt(y));
			if (this.stayCentered == true) this.win.moveTo((screen.width - this.getX()) / 2,(screen.height - this.getY()) / 2);
			setTimeout(this.obj + '.updateMe()',this.delay)
			}
		}
		
	this.write =  function(text){
		if (document.all && this.win.document.all["coords"]) this.win.document.all["coords"].innerHTML = text;
		else if (document.getElementById && this.win.document.getElementById("coords")) this.win.document.getElementById("coords").innerHTML = text;
		}
		
	this.getX =  function(){
		if (document.all) return (this.win.top.document.body.clientWidth + 10)
		else if (document.getElementById)
			return this.win.top.outerWidth;
		else return this.win.top.outerWidth - 12;
	}
	
	this.getY = function(){
		if (document.all) return (this.win.top.document.body.clientHeight + 29)
		else if (document.getElementById)
			return this.win.top.outerHeight;
		else return this.win.top.outerHeight - 31; 
	}
	
	this.onResize =  function(){
		if (this.doResize){
			if (!this.resizing) this.resizeMe();
			}
		}

	return this;
}
resizeWin.count = 0;

booyah = new resizeWin(310,329);
booyah.stayCentered();

//usage:<BODY bgcolor="#000000" onload="booyah.initWin()" onresize="booyah.onResize()">
//-------------------------------------------------------------------------------------


//DYNAMIC FORM  FILLER
//-------------------------------------------------------------------------------------
function Text_Input(elm, onoff)
{
	if (typeof(onoff) == "undefined" )
	{
		onoff = "blur";
	}

	if (!elm.base)
	{
		elm.base = elm.value;
	}

	if (elm.value == elm.base && onoff != "blur")
	{
		elm.value = "";
	}
	else if (elm.value == "" && onoff == "blur")
	{
		elm.value = elm.base;
	}
}
//usage:<input type="text" value="TEXT" onBlur="Text_Input(this, 'blur')" onFocus="Text_Input(this, 'focus')">
//-------------------------------------------------------------------------------------




//-------------------------------------------------------------------------------------

//FORM VALIDATORS

//RESERVATIONS FORM

function Reservations_Validator(theForm){

if (theForm.salutation.value == "x"){
alert("Please select a Salutation.");
theForm.salutation.focus();
return (false);}

if (theForm.reserveFirstName.value == "First"){
alert("Please enter your First Name.");
theForm.reserveFirstName.focus();
return (false);}

if (theForm.reserveFirstName.value == ""){
alert("Please enter your First Name.");
theForm.reserveFirstName.focus();
return (false);}

if (theForm.reserveLastName.value == "Last"){
alert("Please enter your Last Name.");
theForm.reserveLastName.focus();
return (false);}

if (theForm.reserveLastName.value == ""){
alert("Please enter your Last Name.");
theForm.reserveLastName.focus();
return (false);}

if (theForm.reserveTelephonenumber.value == ""){
alert("Please enter your Phone Number.");
theForm.reserveTelephonenumber.focus();
return (false);}

if (theForm.reserveTelephonenumber.value.length < 10){
alert("Please include your area code in the \"Phone Number\" field.");
theForm.reserveTelephonenumber.focus();
return (false);}

if (theForm.reservationDay.value == "x"){
alert("Please specify what Day of the Week your reservation is for.");
theForm.reservationDay.focus();
return (false);}

if (theForm.reservationMonth.value == "x"){
alert("Please specify what Month your reservation is for.");
theForm.reservationMonth.focus();
return (false);}

if (theForm.reservationDate.value == "Date"){
alert("Please enter the date of your reservation.");
theForm.reservationDate.focus();
return (false);}

if (theForm.reservationTime.value == ""){
alert("Please enter the Time of Reservation.");
theForm.reservationTime.focus();
return (false);}

if (theForm.numberOfPeople.value == ""){
alert("Please enter the Number of People in your party.");
theForm.numberOfPeople.focus();
return (false);}
return (true);}

//---------------------------------------

//TELL A FRIEND FORM
function TellAFriend_Form_Validator(theForm)
{
  if (theForm.user_name.value == "")
  {
    alert("Please enter a value for the \"name\" field.");
    theForm.user_name.focus();
    return (false);
  }
  if (theForm.user_name.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"Your Name\" field.");
    theForm.user_name.focus();
    return (false);
  }
  if (theForm.user_email.value == "")
  {
    alert("Please enter a value for the \"Your E-mail\" field.");
    theForm.user_email.focus();
    return (false);
  }
  if (theForm.user_email.value.length < 6)
  {
    alert("Please enter at least 6 characters in the \"Your E-mail\" field.");
    theForm.user_email.focus();
    return (false);
  }
  return (true);
}

//---------------------------------------

//REQUEST INFO FORM
function RequestForm_Validator(theForm){

if (theForm.user_name.value == ""){
alert("Please enter a value for the \"Name\" field.");
theForm.user_name.focus();
return (false);}

if (theForm.user_telephone.value == ""){
alert("Please enter a value for the \"Telephone\" field.");
theForm.user_telephone.focus();
return (false);}

if (theForm.user_telephone.value.length < 10){
alert("Please include your area code in the \"Telephone\" field.");
theForm.user_telephone.focus();
return (false);}

/*	if (theForm.user_email.value == ""){
		alert("Please enter your email address");
		theForm.user_email.focus();
		return (false);
	}

		if (theForm.user_email.value.length < 6){
		alert("Please enter a valid email address");
		theForm.user_email.focus();
		return (false);
	}*/

if (theForm.event_date.value == ""){
alert("Please enter a value for the \"Date of Event\" field.");
theForm.event_date.focus();
return (false);}

if (theForm.event_date.value.length < 6){
alert("Please enter a valid date in the \"Date of Event\" field.");
theForm.event_date.focus();
return (false);}

if (theForm.event_time.value == ""){
alert("Please enter a value for the \"Time of event\" field.");
theForm.event_time.focus();
return (false);}

if (theForm.event_people.value == ""){
alert("Please enter a value for the \"Number of People\" field.");
theForm.event_people.focus();
return (false);}

return (true);}

//-------------------------------------------------------------------------------------