/************************************************************
*(C) 2004. All Rights Reserved. www.universaldancedestiny.com
*
*Author: 		WEBECCENTRIC INC www.webeccentric.com
*Date:			7/13/2004
*File:			global.js
*Summary:		The main javascript file
*-------------------------------------------------
*Modifications:	
*Initial		Date		Description
*-------		----		-----------
*
*
***************************************************************/

/*
Global variables used through out this file.
*/
var GLOBAL_app_folder = "";


/* 
Swap images by placing off/on flags according to what reference is passed 0/1 
*/
function rollOver(imageName, ref){
  var imageName, ref;
	var image_obj;
	
	image_obj = eval("document." + imageName);
	
	switch (ref){
	  case 1: image_obj.src = eval(imageName + "_on"+ ".src"); break;
	  case 0: image_obj.src = eval(imageName + "" + ".src"); break;
	  default: // do nothing here . . . . 
	}
}

/*
Write status text to browser status bar on bottom
*/
function setStatusBarText(strText){
  var strText;
  
  window.defaultStatus = "Welcome to Universal Dance Destiny";  
  window.status = strText;
  
}

/*
Open pop up window
*/
function popWindow(urlText){
  var urlText;
  window.open(urlText,'APPL','width=500,top=50,left=50,resizable,scrollbars');
}

function popGalleryWindow(urlText){
  var urlText;
  gw = window.open(urlText,'gw','height=650,width=900,top=30,left=30,resizable,scrollbars');
  gw.focus();
}



/*
Open up the photo window that displays some descriptions
*/
function popPhotoWindow(strURL){
	var strURL;
	window.open('photo_descriptions.php' + strURL,'PHOTO','width=500,top=50,left=50,resizable,scrollbars');
}


/*
Replace the current URI of any web page with a new one using the
following function
*/
function RedirectUser(refURL){
  var refURL;
  
  location.replace(refURL);
}


/*
Verify if the email address value passed is valid.
We are not using an SMTP validation. We cann't control totally
what people actually write down as email addresses
*/
function isEmail(refEmail){
  var refEmail;
  
  if(refEmail.indexOf("@") == -1 || refEmail.indexOf(".") == -1){
     return false;
    }
  return true;
}


/*
Validate form input on the contact us form
*/
function validateForm(refForm){
  var refForm;
  var objForm;
  
  objForm = eval("document." + refForm);
  
  if(objForm.contact_lname && objForm.contact_lname.value == ""){
    alert("Please enter your Last Name!");
	objForm.contact_lname.focus();
    return false
  }
  
  if(objForm.contact_fname && objForm.contact_fname.value == ""){
    alert("Please enter your First Name!");
	objForm.contact_fname.focus();
    return false
  }
  
  if(objForm.address1 && objForm.address1.value == ""){
    alert("Please enter your Street Address!");
	objForm.address1.focus();
    return false
  }
  
  if(objForm.city && objForm.city.value == ""){
    alert("Please enter your City Name!");
	objForm.city.focus();
    return false
  }
  
  if(objForm.state && objForm.state.value == "NA"){
    alert("Please select your State Name!");
	objForm.state.focus();
    return false
  }
   
  if(objForm.zip_code && objForm.zip_code.value == ""){
    alert("Please Enter your Zip Code!");
	objForm.zip_code.focus();
    return false
  }
  
  if(objForm.country && objForm.country.value == "NA"){
    alert("Please select your Country Name!");
	objForm.country.focus();
    return false
  }
  
  if(objForm.phone && objForm.phone.value == ""){
    alert("Please enter your Phone Number!");
	objForm.phone.focus();
    return false
  }
  
  if((objForm.email && objForm.email.value == "") || !isEmail(objForm.email.value)){
    alert("Please enter your Email Account!");
	objForm.email.focus();
    return false
  }
  
   if(objForm.note && objForm.note.value == ""){
    alert("Please type in your request or comment!");
	objForm.note.focus();
    return false
  }
  return true;
  
}

