//code for every page/////////////////////////////////////
//////////////////////////////////////////////////////////

var result = false;
var ml = 730;
function sniffIE(path){
var browser = navigator.appName;
var re = /Internet Explorer/gi;
result = re.test(browser);
//alert (result);
//alert (browser);
if (result == true){
  document.getElementById("cssLink").href = "hannekeIE.css";
  if(path){document.getElementById("cssLink").href = path+"hannekeIE.css";}//the 'path' parameter is there for pages that require a different path to the css file than simply 'hannekeIE.css'.
  ml = 315;
  }
}


//SETTING MY RANDOM-IMAGE for the BACKGROUND//
        image_sources = new Array();

        //Here's where you set up your list of images:
        //When adding one, be sure to give it the next
        //number in square brackets []
        //The first image must be [0].

        image_sources[0] = "images/background-1";
        image_sources[1] = "images/background-2";
        image_sources[2] = "images/background-3";
               
       function setBackground() {
            rindex = Math.floor(Math.random() * image_sources.length);
			newImage = image_sources[rindex]+".jpg";
			document.body.setAttribute("background",newImage);
        }
//END//

//SETTING MY RANDOM-IMAGE for the FEATURE PHOTO//
        image_sources2 = new Array();

        image_sources2[0] = "images/hannekePhoto-1";
        image_sources2[1] = "images/hannekePhoto-2";
        image_sources2[2] = "images/hannekePhoto-3";
		
		var currentPhoto = "images/hannekePhoto-1" //used later to keep the photos shuffling.
               
       function setPhoto() {
            rindex = Math.floor(Math.random() * image_sources2.length);
			newImage = image_sources2[rindex]+".jpg";
			if (newImage == currentPhoto){setPhoto();} //if newImage is same as currentPhoto, it tries again.
			document.getElementById("photoImageDiv").innerHTML = "<img id='featurePhoto' src='"+newImage+"' alt='photo' onclick='setPhoto()'/>";
			currentPhoto = newImage;
        }
		
		
//END//

function swapImage(ID,srcName){
document.getElementById(ID).src = "images/"+srcName;
}

function slideSocial(){
  if(result==true){
	if (ml<366){
	document.getElementById("socialDiv").style.marginLeft = ml+"px";
	ml=ml*1.01;
	if(ml>366){ml=366;document.getElementById("socialDiv").style.marginLeft = ml+"px";}
	t=setTimeout("slideSocial()",10);
	}
  }else{
  if (ml<781){
  document.getElementById("socialDiv").style.marginLeft = ml+"px";
  ml=ml*1.01;
  if(ml>781){ml=781;document.getElementById("socialDiv").style.marginLeft = ml+"px";}
  t=setTimeout("slideSocial()",30);
  }
  }
}

//For Mail Order Page
function returnQueryString(){
var query = location.search;
return query;
}

function setOrderAmount(){
var query = returnQueryString();
switch (query){
	case "?FRU":
		document.getElementById("FRUselect").value = 1;
		break;
	case "?CRS":
		document.getElementById("CRSselect").value = 1;
		break;
	case "?SIL":
		document.getElementById("SILselect").value = 1;
		break;
	case "?SMS":
		document.getElementById("SMSselect").value = 1;
		break;
	case "?MHR":
		document.getElementById("MHRselect").value = 1;
		break;
	case "?MJO":
		document.getElementById("MJOselect").value = 1;
		break;
	case "?HAL":
		document.getElementById("HALselect").value = 1;
		break;
}
}

var printed = false;

function confirmPrint(){
	if (printed == false){
		var confirmed = confirm("Just double-checking: have you printed your order form? \nClick 'okay' to close the order form window, or click 'cancel' to keep it open.");
		if (confirmed == true){window.close();}
	}else{
	window.close();
	}
}

/*
The following "printit()" function is written by Eric (Webcrawl@usa.net).
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

function printit(){  
if (window.print) {
    window.print();  
	printed = true;//(my addition)
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    
	WebBrowser1.outerHTML = "";  
	printed = true;//(my addition)
}
}

//
//
//
//THE FOLLOWING CODE all came from Hanneke's old site, and is used for the mail order form. I did not write it. And currently, it is not being called upon. I do not understand it.
//
//
//
function FrontPage_Form1_Validator(theForm)
{
 
  if (theForm.First.value == "")
  {
    alert("Please enter a value for the \"First\" field.");
    theForm.First.focus();
    return (false);
  }
 
  if (theForm.First.value.length < 20)
  {
    alert("Please enter at least 20 characters in the \"First\" field.");
    theForm.First.focus();
    return (false);
  }
 
  if (theForm.First.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"First\" field.");
    theForm.First.focus();
    return (false);
  }
 
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ";
  var checkStr = theForm.First.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter characters in the \"First\" field.");
    theForm.First.focus();
    return (false);
  }
 
  if (theForm.Last.value == "")
  {
    alert("Please enter a value for the \"Last\" field.");
    theForm.Last.focus();
    return (false);
  }
 
  if (theForm.Last.value.length < 20)
  {
    alert("Please enter at least 20 characters in the \"Last\" field.");
    theForm.Last.focus();
    return (false);
  }
 
  if (theForm.Last.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"Last\" field.");
    theForm.Last.focus();
    return (false);
  }
 
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ";
  var checkStr = theForm.Last.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter characters in the \"Last\" field.");
    theForm.Last.focus();
    return (false);
  }
 
  if (theForm.Address.value == "")
  {
    alert("Please enter a value for the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }
 
  if (theForm.Address.value.length < 20)
  {
    alert("Please enter at least 20 characters in the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }
 
  if (theForm.Address.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }
 
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789- \t\r\n\f";
  var checkStr = theForm.Address.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter, digit and whitespace characters in the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }
 
  if (theForm.APT.value == "")
  {
    alert("Please enter a value for the \"APT\" field.");
    theForm.APT.focus();
    return (false);
  }
 
  if (theForm.APT.value.length < 6)
  {
    alert("Please enter at least 6 characters in the \"APT\" field.");
    theForm.APT.focus();
    return (false);
  }
 
  if (theForm.APT.value.length > 6)
  {
    alert("Please enter at most 6 characters in the \"APT\" field.");
    theForm.APT.focus();
    return (false);
  }
 
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-";
  var checkStr = theForm.APT.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and digit characters in the \"APT\" field.");
    theForm.APT.focus();
    return (false);
  }
 
  if (theForm.Mailing.value == "")
  {
    alert("Please enter a value for the \"Mailing\" field.");
    theForm.Mailing.focus();
    return (false);
  }
 
  if (theForm.Mailing.value.length < 20)
  {
    alert("Please enter at least 20 characters in the \"Mailing\" field.");
    theForm.Mailing.focus();
    return (false);
  }
 
  if (theForm.Mailing.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"Mailing\" field.");
    theForm.Mailing.focus();
    return (false);
  }
 
  if (theForm.City.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.City.focus();
    return (false);
  }
 
  if (theForm.City.value.length < 20)
  {
    alert("Please enter at least 20 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }
 
  if (theForm.City.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }
 
  if (theForm.Zip1.value == "")
  {
    alert("Please enter a value for the \"Zip1\" field.");
    theForm.Zip1.focus();
    return (false);
  }
 
  if (theForm.Zip1.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Zip1\" field.");
    theForm.Zip1.focus();
    return (false);
  }
 
  if (theForm.Zip1.value.length > 5)
  {
    alert("Please enter at most 5 characters in the \"Zip1\" field.");
    theForm.Zip1.focus();
    return (false);
  }
 
  var checkOK = "0123456789-";
  var checkStr = theForm.Zip1.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit characters in the \"Zip1\" field.");
    theForm.Zip1.focus();
    return (false);
  }
 
  if (theForm.Zip2.value == "")
  {
    alert("Please enter a value for the \"Zip2\" field.");
    theForm.Zip2.focus();
    return (false);
  }
 
  if (theForm.Zip2.value.length < 4)
  {
    alert("Please enter at least 4 characters in the \"Zip2\" field.");
    theForm.Zip2.focus();
    return (false);
  }
 
  if (theForm.Zip2.value.length > 4)
  {
    alert("Please enter at most 4 characters in the \"Zip2\" field.");
    theForm.Zip2.focus();
    return (false);
  }
 
  if (theForm.AreaCode.value == "")
  {
    alert("Please enter a value for the \"AreaCode\" field.");
    theForm.AreaCode.focus();
    return (false);
  }
 
  if (theForm.AreaCode.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"AreaCode\" field.");
    theForm.AreaCode.focus();
    return (false);
  }
 
  if (theForm.AreaCode.value.length > 3)
  {
    alert("Please enter at most 3 characters in the \"AreaCode\" field.");
    theForm.AreaCode.focus();
    return (false);
  }
 
  if (theForm.Prefix.value == "")
  {
    alert("Please enter a value for the \"Prefix\" field.");
    theForm.Prefix.focus();
    return (false);
  }
 
  if (theForm.Prefix.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Prefix\" field.");
    theForm.Prefix.focus();
    return (false);
  }
 
  if (theForm.Prefix.value.length > 3)
  {
    alert("Please enter at most 3 characters in the \"Prefix\" field.");
    theForm.Prefix.focus();
    return (false);
  }
 
  if (theForm.Phone.value == "")
  {
    alert("Please enter a value for the \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }
 
  if (theForm.Phone.value.length < 4)
  {
    alert("Please enter at least 4 characters in the \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }
 
  if (theForm.Phone.value.length > 4)
  {
    alert("Please enter at most 4 characters in the \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }
 
  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"E-mail\" field.");
    theForm.email.focus();
    return (false);
  }
 
  if (theForm.email.value.length < 28)
  {
    alert("Please enter at least 28 characters in the \"E-mail\" field.");
    theForm.email.focus();
    return (false);
  }
 
  if (theForm.email.value.length > 28)
  {
    alert("Please enter at most 28 characters in the \"E-mail\" field.");
    theForm.email.focus();
    return (false);
  }
 
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-";
  var checkStr = theForm.email.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and digit characters in the \"E-mail\" field.");
    theForm.email.focus();
    return (false);
  }
  return (true);
}
