URL = window.location.href;

var pagename_array = URL.split("/");
var barefile_array = pagename_array[3].split(".");
var result = barefile_array[0];

if	(result == "index" || result == "" || !result)	{
	result = "welcome";
}else if (result == "tux-measure")	{
	result = "tuxedos";
	}
else if	(result == "_vti_bin" || result == "list")	{
	result = "contact";
}
else if	(result == "location-zoom")	{
	result = "location";
}
var baseURL = "http://www.ronaldallan.com/";
var loaded = 0;

function PreLoad() {

if (document.images != null) {

clickme1 = new Image();
clickme1.src = baseURL + "images/menu/mens-fashion.gif";
clickme1o = new Image();
clickme1o.src = baseURL + "images/menu/mens-fashion-over.gif";
clickme2 = new Image();
clickme2.src = baseURL + "images/menu/womens-fashion.gif";
clickme2o = new Image();
clickme2o.src = baseURL + "images/menu/womens-fashion-over.gif";
clickme3 = new Image();
clickme3.src = baseURL + "images/menu/tuxedos.gif";
clickme3o = new Image();
clickme3o.src = baseURL + "images/menu/tuxedos-over.gif";
clickme4 = new Image();
clickme4.src = baseURL + "images/menu/specials.gif";
clickme4o = new Image();
clickme4o.src = baseURL + "images/menu/specials-over.gif";
clickme5 = new Image();
clickme5.src = baseURL + "images/menu/about.gif";
clickme5o = new Image();
clickme5o.src = baseURL + "images/menu/about-over.gif";
clickme6 = new Image();
clickme6.src = baseURL + "images/menu/contact.gif";
clickme6o = new Image();
clickme6o.src = baseURL + "images/menu/contact-over.gif";
clickme7 = new Image();
clickme7.src = baseURL + "images/menu/home.gif";
clickme7o = new Image();
clickme7o.src = baseURL + "images/menu/home-over.gif";

}
	loaded = 1;
}

function hiLite(imgDocID,imgObjName) {
if (document.images !=null) {
  if (loaded)
   document.images[imgDocID].src = eval(imgObjName + ".src")
  }
}

function popup(winName,URL,width,height,scroll) {

 var popup = window.open(URL,winName,"height=" + height + ",width=" + width + ",left=28,top=25,status=0,scrollbars=" + scroll + ",toolbar=0,directories=0,menubar=0,location=0");
 NewWindow = popup;
 NewWindow.focus();

}

function jump(url) {

 var popup = window.open(url,"popup","HEIGHT=380,WIDTH=710,screenX=20,screenY=5,status=0,scrollbars=0,toolbar=0,directories=0,menubar=0,location=0");
 NewWindow = popup;
 NewWindow.focus();

}

function FormVal(form) {

if (form.FName.value == "") {
	alert("Please enter your first name.")
	document.Form.FName.focus()
	return false;
}
if (form.FName.value.length > 25) {
	alert("Your first name is to long, please fix it.")
	document.Form.FName.focus()
	return false;
}
if (form.LName.value == "") {
	alert("Please enter your last name.")
	document.Form.LName.focus()
	return false;
}
if (form.LName.value.length > 25) {
	alert("Your last name is to long, please fix it.")
	document.Form.LName.focus()
	return false;
}
if (form.Address.value == "") {
	alert("Please enter your address.")
	document.Form.Address.focus()
	return false;
}
if (form.City.value == "") {
	alert("Please enter city.")
	document.Form.City.focus()
	return false;
}
if (form.Prov_State.value == "") {
	alert("Please enter your province or state.")
	document.Form.Prov_State.focus()
	return false;
}
if (form.Country.value == "") {
	alert("Please enter your country.")
	document.Form.Country.focus()
	return false;
}
if (form.Postal_Zip.value == "") {
	alert("Please enter your postal/zip code.")
	document.Form.Postal_Zip.focus()
	return false;
}
if (form.AreaCode.value == "") {
	alert("Please enter your area code.")
	document.Form.AreaCode.focus()
	return false;
}
if (form.AreaCode.value.length > 3) {
	alert("Your area code is to long, please fix it.")
	document.Form.AreaCode.focus()
	return false;
}
if (form.Phone.value == "") {
	alert("Please enter your phone number.")
	document.Form.Phone.focus()
	return false;
}
if (form.Phone.value.length > 10) {
	alert("Your phone number is to long, please fix it.")
	document.Form.Phone.focus()
	return false;
}
if (form.Email.value == "") {
	alert("Please enter your Email address.")
	document.Form.Email.focus()
	return false;
}
if (form.Email.value.length > 50) {
	alert("Your Email address is to long, please fix it.")
	document.Form.Email.focus()
	return false;
}
}

function DoIt(Comments){
 document.Form.sComments.value = escape(document.Form.Comments.value);
}


function US_Validate(theForm) {
if (theForm.jac_prodoptions0.selectedIndex < 0) {
 alert("Please select one of the Shipping options.");
 theForm.jac_prodoptions0.focus();
 return (false);
}
if (theForm.jac_prodoptions0.selectedIndex == 0) {
 alert("The first Shipping option is not a valid selection.  Please choose one of the other options.");
 theForm.jac_prodoptions0.focus();
 return (false);
}
 return (true);
}


function Check() {

  if (document.Form1.Name.value == "") {
    alert("Please enter your name.");
    document.Form1.Name.focus();
    return (false);
  }

  if (document.Form1.Email.value == "") {
    alert("Please enter your email address.");
    document.Form1.Email.focus();
    return (false);
  }

  if (document.Form1.State.value == "") {
    alert("Please enter your province or state.");
    document.Form1.State.focus();
    return (false);
  }

  if (document.Form1.Country.value == "") {
    alert("Please enter your country.");
    document.Form1.Country.focus();
    return (false);
  }
  return (true);
}


function CheckSubscribe(theForm) {

  if (theForm.Name.value == "") {
    alert("Please enter a value for the Name field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Email.value == "") {
    alert("Please enter a value for the Email field.");
    theForm.Email.focus();
    return (false);
  }
  
  var x = theForm.Email.value;
  var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  if (!filter.test(x)){
    alert("Your email address is invalid please fix it.");
    theForm.Email.focus();
    return (false);
  }

  return (true);
}


function CheckContest(theForm) {

  if (theForm.Name.value == "") {
    alert("Please enter a value for the Name field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Email.value == "") {
    alert("Please enter a value for the Email field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.State.selectedIndex < 0) {
    alert("Please select one of the Province/State options.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.State.selectedIndex == 0) {
    alert("The first Province/State option is not a valid selection.  Please choose one of the other options.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex < 0) {
    alert("Please select one of the Country options.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex == 0) {
    alert("The first Country option is not a valid selection.  Please choose one of the other options.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex >= 3) {
	theForm.State.selectedIndex = 68
  }

  if (theForm.FindUs.selectedIndex == 0) {
    alert("Please tell us where you heard about us.");
    theForm.FindUs.focus();
    return (false);
  }


  return (true);
}


function CheckUpdate(theForm) {

  if (theForm.Name.value == "") {
    alert("Please enter a value for the Name field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.OldEmail.value == "") {
    alert("Please enter a value for the Previous Email field.");
    theForm.OldEmail.focus();
    return (false);
  }

  if (theForm.Email.value == "") {
    alert("Please enter a value for the Email field.");
    theForm.Email.focus();
    return (false);
  }


  if (theForm.State.selectedIndex < 0) {
    alert("Please select one of the Province/State options.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.State.selectedIndex == 0) {
    alert("The first Province/State option is not a valid selection.  Please choose one of the other options.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex < 0) {
    alert("Please select one of the Country options.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex == 0) {
    alert("The first Country option is not a valid selection.  Please choose one of the other options.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex >= 3) {
	theForm.State.selectedIndex = 68
  }

  return (true);
}