//******************************************************************************
function redirector(surl,timeout){
	var timeout=timeout*1;
//	alert(timeout);
	settimeout(window.location.href = surl,timeout);
}
//******************************************************************************
function newwin(loc,w,h) {
	var window1;
	w = w * 1 + 20;
	h = h * 1 + 30;

	swindow = "width="+w+",height="+h+",location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0";
	window1=window.open (loc,"new_window",swindow);
}

//*****************************silverpop scripts*********************************
/* Validates a form called "form", for use with the opt-in and preferences forms. */
function f_validateForm(a_sFormName)
{
   if (typeof(a_sFormName) == "undefined")
   {
      a_sFormName = "form";
   }
   var l_okay = true;

   for (var j=0; j < document.forms[a_sFormName].elements.length; j++)
   {
      var l_element = document.forms[a_sFormName].elements[j];
      f_useHiddenFieldIfCheckbox(l_element);

      var sFieldNameRequired = l_element.name + "_REQUIRED";
      var elRequired = document.forms[a_sFormName].elements[sFieldNameRequired];

      if (elRequired)
      {
         if (elRequired.value == "T" && l_element.value == "")
         {
            alert("You must fill in all the required fields.");
            return;
         }
      }
      //text areas can only be 255 in size
      if(l_element.type == "textarea")
      {
         if (l_element.value.length > 255)
         {
            alert("Please limit your entries to only 255 characters");
            return;
         }
      }
      var sFieldNameDataType = l_element.name + "_DATATYPE";
      var elDataType = document.forms[a_sFormName].elements[sFieldNameDataType];

      if (elDataType)
      {
         if (l_element.value != "")
         {
            if (elDataType.value == "time")
            {
               l_okay = f_isValidTime(l_element.value);
            }
            if (elDataType.value == "date")
            {
               l_okay = f_isValidDate(l_element.value);
            }
            if (elDataType.value == "numeric")
            {
               l_okay = f_isNumeric(l_element.value);
            }
            if (elDataType.value == "email")
            {
               l_okay = f_isValidEmail(l_element.value);
            }
            if (!l_okay)
            {
               l_element.focus();
               return;
            }
         }
      }
   }
   document.forms[a_sFormName].submit();
//   notify(document.form.sid.value,document.form.sfrom.value);
}

/* checkboxes that have SYSTEM_ before their name should have an accompanying hidden
 field, that does not have the SYSTEM_.  This field should be "Yes" if the checkbox
 is checked, and "No" if it is not */
function f_useHiddenFieldIfCheckbox(a_element)
{
   if (a_element.type == "checkbox" && a_element.name.substring(0, 7) == "SYSTEM_")
   {
      var hiddenElement = eval("document.form.elements['" + a_element.name.substring(7) +"']");

      if (a_element.checked)
      {
         hiddenElement.value = "Yes";
      }
      else
      {
         hiddenElement.value = "No";
      }
   }
}

/* The following are common validation routines used by any screens that need to
 * validate user input.
 */
/* Checks if an email address is valid, modified from http://javascript.internet.com/forms/check-email.html
*/
function f_isValidEmail(a_sEmail)
{
   if (a_sEmail != null && a_sEmail != "")
   {
      /* The following pattern is used to check if the entered e-mail address
         fits the user@domain format.  It also is used to separate the username
         from the domain. */
      var emailPat=/^(.+)@(.+)$/;
      /* The following string represents the pattern for matching all special
         characters.  We don't want to allow special characters in the address.
         These characters include ( ) < > @ , ; : \ " . [ ]    */
      var specialCharsUser="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
      var specialCharsDomain="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]\\'";

      /* The following string represents the range of characters allowed in a
         username or domainname.  It really states which chars aren't allowed. */
      var validCharsUser="\[^\\s" + specialCharsUser + "\]";
      var validCharsDomain="\[^\\s" + specialCharsDomain + "\]";
      /* The following pattern applies if the "user" is a quoted string (in
         which case, there are no rules about which characters are allowed
         and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
         is a legal e-mail address. */
      var quotedUser="(\"[^\"]*\")";
      /* The following pattern applies for domains that are IP addresses,
         rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
         e-mail address. NOTE: The square brackets are required. */
      var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
      /* The following string represents an atom (basically a series of
         non-special characters.) */
      var atomUser=validCharsUser + '+';
      var atomDomain=validCharsDomain + '+';
      /* The following string represents one word in the typical username.
         For example, in john.doe@somewhere.com, john and doe are words.
         Basically, a word is either an atom or quoted string. */
      var wordUser="(" + atomUser + "|" + quotedUser + ")";
      // The following pattern describes the structure of the user
      var userPat=new RegExp("^" + wordUser + "(\\." + wordUser + ")*$");
      /* The following pattern describes the structure of a normal symbolic
         domain, as opposed to ipDomainPat, shown above. */
      var domainPat=new RegExp("^" + atomDomain + "(\\." + atomDomain +")*$");


      /* Finally, let's start trying to figure out if the supplied address is
         valid. */

      /* Begin with the coarse pattern to simply break up user@domain into
         different pieces that are easy to analyze. */
      var matchArray=a_sEmail.match(emailPat);
      if (matchArray==null)
      {
        /* Too many/few @'s or something; basically, this address doesn't
           even fit the general mould of a valid e-mail address. */
      	alert("The format of the email address you entered is not valid for email addresses.");
      	return false;
      }
      var user=matchArray[1];
      var domain=matchArray[2];

      // See if "user" is valid
      if (user.match(userPat)==null)
      {
          // user is not valid
          alert("Email username doesn't seem to be valid.");
          return false;
      }

      /* if the e-mail address is at an IP address (as opposed to a symbolic
         host name) make sure the IP address is valid. */
      var IPArray=domain.match(ipDomainPat);
      if (IPArray!=null)
      {
          // this is an IP address
      	  for (var i=1;i<=4;i++)
           {
      	    if (IPArray[i]>255)
             {
      	        alert("Email IP address is invalid!");
      		     return false;
      	    }
          }
          return true;
      }

      // Domain is symbolic name
      var domainArray=domain.match(domainPat);
      if (domainArray==null)
      {
      	alert("Email domain name doesn't seem to be valid.");
         return false;
      }

      /* domain name seems valid, but now make sure that it ends in a
         three-letter word (like com, edu, gov) or a two-letter word,
         representing country (uk, nl), and that there's a hostname preceding
         the domain or country. */

      /* Now we need to break up the domain to get a count of how many atoms
         it consists of. */
      var atomPat=new RegExp(atomDomain,"g");
      var domArr=domain.match(atomPat);
      var len=domArr.length;
      if (domArr[domArr.length-1].length<2 ||
          domArr[domArr.length-1].length>4)
      {
         // the address must end in a two letter or three letter word.
         alert("Email address must end in a three or four letter domain or a two letter country.");
         return false;
      }

      // Make sure there's a host name preceding the domain.
      if (len<2)
      {
         var errStr="Email address is missing a hostname.";
         alert(errStr);
         return false;
      }
   }

   // If we've gotten this far, everything's valid!
   return true;
}

/**
 * Checks if a time value is valid
 *
 */
function f_isValidTime(a_sTime)
{
   // Checks if time is in HH:MM:SS AM/PM format.
   // The seconds and AM/PM are optional.

//   var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;
   var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?$/;

   var matchArray = a_sTime.match(timePat);
   if (matchArray == null)
   {
      alert("Time is not in a valid format.");
      return(false);
   }
   hour = matchArray[1];
   minute = matchArray[2];
   second = matchArray[4];

   if (second=="")
   {
      second = null;
   }

   if (hour < 0  || hour > 23)
   {
      alert("Hour must be between 1 and 12. (or 0 and 23 for military time)");
      return(false);
   }
   if (minute<0 || minute > 59)
   {
      alert ("Minute must be between 0 and 59.");
      return(false);
   }
   if (second != null && (second < 0 || second > 59))
   {
      alert ("Second must be between 0 and 59.");
      return(false);
   }
   return(true);
}

/**
 * Validates the characters in the text string.  This routine checks for
 * characters that are not allowed.  The intention is to prevent someone from
 * entering scripting code into a text field on a form.
 * Ideally, we would check that the string contained only the allowed
 * characters, but this gets difficult when you consider other character sets.
 *
 * We disallow the following characters: <, >, ", ', %, ;, (, ), &, +
 *
 */
function f_isValidText(a_sText)
{
   invalidChars = "|/<>%;&+\"\'\\";
   for(i = 0; i < a_sText.length; i++)
   {
      if(invalidChars.indexOf(a_sText.charAt(i)) != -1)
      {
         alert("The the following characters are not allowed in text strings: | \\ / < > \" % ; & + \'");
         return(false);
      }
   }

   return(true);
}

function mod(div,base) {
	return Math.round(div - (Math.floor(div/base)*base));
}


/**
 * Checks if a value is a number
 *
 */
function f_isNumeric(a_sNumber)
{
   myString = "0123456789";

   for(i = 0; i < a_sNumber.length; i++)
   {
      if(myString.indexOf(a_sNumber.charAt(i)) == -1)
      {
         alert("The number you entered is invalid");
         return(false);
      }
   }
   return(true);
}
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s)
{
   var i;
   for (i = 0; i < s.length; i++){
      // Check that current character is number.
      var c = s.charAt(i);
      if (((c < "0") || (c > "9")))
      {
         return false;
      }
   }
   // All characters are numbers.
   return true;
}

function stripCharsInBag(s, bag)
{
   var i;
   var returnString = "";
   // Search through string's characters one by one.
   // If character is not in bag, append to returnString.
   for (i = 0; i < s.length; i++)
   {
      var c = s.charAt(i);
      if (bag.indexOf(c) == -1)
      {
         returnString += c;
      }
   }
   return returnString;
}

function daysInFebruary (year)
{
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n)
{
	for (var i = 1; i <= n; i++)
	{
		this[i] = 31;

		if (i==4 || i==6 || i==9 || i==11)
		{
		   this[i] = 30;
		}
		if (i==2)
		{
		   this[i] = 29;
		}
   }
   return this
}


function f_isValidDate(dtStr)
{
   if (dtStr.length != 10)
   {
		alert("The date format should be : mm/dd/yyyy");
		return(false);
   }
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strMonth=dtStr.substring(0,pos1);
	var strDay=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);
	strYr=strYear;

	if (strDay.charAt(0)=="0" && strDay.length>1)
	{
	   strDay = strDay.substring(1);
	}
	if (strMonth.charAt(0)=="0" && strMonth.length>1)
	{
	   strMonth = strMonth.substring(1);
	}
	for (var i = 1; i <= 3; i++)
	{
		if (strYr.charAt(0)=="0" && strYr.length>1)
		{
		   strYr = strYr.substring(1);
		}
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1)
	{
		alert("The date format should be : mm/dd/yyyy");
		return(false);
	}
	if (strMonth.length<1 || month<1 || month>12)
	{
		alert("Please enter a valid month");
		return(false);
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month])
	{
		alert("Please enter a valid day");
		return(false);
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear)
	{
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);
		return(false);
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false)
	{
		alert("Please enter a valid date");
		return(false);
	}
   return(true);
}

function f_isValidLength(a_name, a_maxLength) {
    var data = a_name;
    
    if (data.length > a_maxLength) {
        alert("Maximum field length has been exceeded.");
        return false;
    }
    
    return true;
}

//*****************************end silverpop scripts*********************************

function notify(sid,sfrom)
{
//	alert(sid);
//	alert(sfrom);
	document.open();
 	document.write ("<img src=http://sidener.com/php/notify.php?id="+sid+"&from="+sfrom+" border=0 width=1 height=1>");
	document.close();
//	window.close();
	window.location.href = "thanksAll.htm";
//	var window1;
/*
	swindow="width=100,height=10,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0";

    mywindow=open ("","new_window",swindow);
    mywindow.document.open();
    mywindow.document.write("<html>\n<head>\n<title></title>\n</head>\n<body>\n");
    mywindow.document.write("<img src=http://sidener.com/php/notify.php?id="+sid+"&from="+sfrom+" border=0 width=1 height=1>\n");
    mywindow.document.write("</body>\n</html>");
    mywindow.document.close();
    mywindow.close();
*/
}

/* 

function sendform()
{
 alert("Nowhere to send this yet!");
 return false;
}

function newwin(loc) {
	var window1;

	swindow = "width=700,height=400,location=1,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=1";

	window1=window.open (loc,"new_window",swindow);
}
old version of validate()
function validate() 
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	var bEmail;
	var bMail;
	var fname;
	var lname;
	var company;
	var address1;
	var address2;
	var city;
	var state;
	var zip;
	var phone;
	var email;

	bEmail = document.reqinfo.ContactBy[0];
	bMail = document.reqinfo.ContactBy[1];
	fname = document.reqinfo.FirstName;
	lname = document.reqinfo.LastName;
	company = document.reqinfo.Company;
	address1 = document.reqinfo.Address1;
	address2 = document.reqinfo.Address2;
	city = document.reqinfo.City;
	state = document.reqinfo.State;
	zip = document.reqinfo.Zip;
	phone = document.reqinfo.Phone;
	email = document.reqinfo.Email;
	
	if (bEmail.checked==true)
	 {
		if (fname.value.length <= 0)
		{
		 msg = "Please enter your first name";
		 alert (msg);
		 fname.focus(); 
		 return false;
		}
		if (lname.value.length <= 0)
		{
		 msg = "Please enter your last name";
		 alert (msg);
		 lname.focus(); 
		 return false;
		}
		if (company.value.length <= 0)
		{
		 msg = "Please enter your company name";
		 alert (msg);
		 company.focus(); 
		 return false;
		}
		if (zip.value.length > 0)
		{
			if (isNaN(zip.value) || zip.value.length < 5)
			{
			 msg = "Zip code in not valid";
			 alert (msg);
			 zip.focus(); 
			 return false;
			 }
		}
		if (document.layers||document.getElementById||document.all)
		 {
		  if (!filter.test(email.value))
		  {
			alert("Please supply a valid email address!")
			email.focus()
			return false
		   }
		   //document.reqinfo.Email.value = "mailto:"+email.value;
		 }
	   return true;
	 }
	if (bMail.checked==true)
	 {
		if (fname.value.length <= 0)
		{
		 msg = "Please enter your first name";
		 alert (msg);
		 fname.focus(); 
		 return false;
		}
		if (lname.value.length <= 0)
		{
		 msg = "Please enter your last name";
		 alert (msg);
		 lname.focus(); 
		 return false;
		}
		if (company.value.length <= 0)
		{
		 msg = "Please enter your company name";
		 alert (msg);
		 company.focus(); 
		 return false;
		}
		if (address1.value.length <= 0)
		{
		 msg = "Please enter your street address";
		 alert (msg);
		 address1.focus(); 
		 return false;
		}
		if (city.value.length <= 0)
		{
		 msg = "Please enter your city";
		 alert (msg);
		 city.focus(); 
		 return false;
		}
		if (state.value == 'NULL')
		{
		 msg = "Please select your state";
		 alert (msg);
		 state.focus(); 
		 return false;
		}
		if (isNaN(zip.value) || zip.value.length < 5)
		{
		 msg = "Please enter your zip code";
		 alert (msg);
		 zip.focus(); 
		 return false;
		}
	   return true;
	 }
}
function validate() 
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	var fname;
	var lname;
	var company;
	var address;
	var address2;
	var city;
	var state;
	var zip;
	var phone;
	var email;

	fname = document.reqinfo.FirstName;
	lname = document.reqinfo.LastName;
	company = document.reqinfo.Company;
	address = document.reqinfo.Address;
	apt_suite = document.reqinfo.Apt_Suite;
	city = document.reqinfo.City;
	state = document.reqinfo.State;
	zip = document.reqinfo.Zip;
	phone = document.reqinfo.Phone;
	email = document.reqinfo.Email;
	
		if (document.layers||document.getElementById||document.all)
		 {
		  if (!filter.test(email.value))
		  {
			alert("Please supply a valid email address!")
			email.focus()
			return false
		   }
		if (fname.value.length <= 0)
		{
		 msg = "Please enter your first name";
		 alert (msg);
		 fname.focus(); 
		 return false;
		}
		if (lname.value.length <= 0)
		{
		 msg = "Please enter your last name";
		 alert (msg);
		 lname.focus(); 
		 return false;
		}
		if (company.value.length <= 0)
		{
		 msg = "Please enter your company name";
		 alert (msg);
		 company.focus(); 
		 return false;
		}
		if (address.value.length <= 0)
		{
		 msg = "Please enter your street address";
		 alert (msg);
		 address.focus(); 
		 return false;
		}
		if (city.value.length <= 0)
		{
		 msg = "Please enter your city";
		 alert (msg);
		 city.focus(); 
		 return false;
		}
		if (state.value == 'NULL')
		{
		 msg = "Please select your state";
		 alert (msg);
		 state.focus(); 
		 return false;
		}
		if (isNaN(zip.value) || zip.value.length < 5)
		{
		 msg = "Please enter your zip code";
		 alert (msg);
		 zip.focus(); 
		 return false;
		}
	   return true;
	 }
}
function newwintrack(loc,trackid)
  {
	var window1;

	swindow="width=700,height=400,location=1,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=1,toolbar=0";

    mywindow=open ("","new_window",swindow);
    mywindow.document.open();
    mywindow.document.write("<html>\n<head>\n<title>"+trackid+"</title>\n</head>\n<body>\n");
    mywindow.document.write("<img src=http://www.epriority.com/B/1/22139/"+trackid+" border=0 width=1 height=1>\n");
    mywindow.document.write("</body>\n</html>");
    mywindow.document.close();

	window1=window.open (loc,"new_window",swindow);
}
function launch(pic,w,h,name)
  {
	  quot = String.fromCharCode(34);
	  w = w * 1 + 20;
	  w = "width=" + w + ",";

	  h = h * 1 + 100;
	  h = "height=" + h;
	  pic = "" + "images/" + pic +".jpg";
	  swindow = w + h + ",location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0";

	  myclose = "<script language=Javascript>";
	  myclose = myclose + "function ChangeImg(imgNum,imgSrc)";
	  myclose = myclose+"{document.images[imgNum].src = imgSrc;}</script>"

	  mywindow=open ("","new_window",swindow);
	  mywindow.document.open();
	  mywindow.document.write(myclose);
	  mywindow.document.write("<html><head><title>"+name+"</title></HEAD>");
	  mywindow.document.write("<body  marginheight=0 marginwidth=0 topmargin=0 leftmargin=0");
	  mywindow.document.write(" rightmargin=0 bottommargin=0 BGCOLOR=white");
	  mywindow.document.write(" text=black>");
	  mywindow.document.write("<center><br><img src=" +pic+ " border=0 alt=" + name+">");
	  mywindow.document.write("<br><br>" + name);

	  mywindow.document.write("<br><br><a href="+quot+"javascript:self.close();"+quot);
	  mywindow.document.write(" onMouseOver="+quot+"ChangeImg(1,'images/flagjoff.gif');"+quot);
  	  mywindow.document.write(" onMouseOut="+quot+"ChangeImg(1,'images/flagjon.gif');"+quot);
  	  mywindow.document.write("><img src="+quot+"images/flagjon.gif"+quot+" border=0>Close</a>");

  	  mywindow.document.write("</center>");
	  mywindow.document.write("</body></html>");
	  mywindow.document.close();
}

function chktop(ylu, mlu, dlu)    {
//alert('in');
     statstring = "Welcome to DST Systems, Inc. Online.  ";
 
     if (dlu != null && mlu != null && dlu != null) {
        statstring += " This page last updated on " + ylu + "/" + mlu + "/" + dlu +".";
    }   
     
   window.defaultStatus = statstring;
 }


function winOpn(imgname) {
   imgWindow=window.open("","displayWindow","menubar=0,status=0,resizable=1,scrollbars=1,width=680,height=540");
   imgWindow.document.write
      ("<HEAD><TITLE>Illustration Window</TITLE></HEAD>");
   imgWindow.document.write
      ("<BODY><IMG SRC="+imgname+"><FORM><CENTER><INPUT TYPE='submit' VALUE='Close' onClick='window.close();'><CENTER></BODY>");

   imgWindow.document.close();

        }


		function formEIROpn()  {

formWindow=window.open('https://careers.dstsystems.com/hr/onlineap.nsf/res/?Open',"displayWindow","menubar=1,status=1,resizable=1,scrollbars=1,width=680,height=540,toolbar=0,location=1");

		}		
		

function formFULLOpn()	{

formWindow=window.open('https://careers.dstsystems.com/hr/aoldst.nsf/app?OpenForm',"displayWindow","menubar=1,status=1,resizable=1,scrollbars=1,width=680,height=540,toolbar=0,location=1")
		
	}	


function howdy()   {

form2Window=window.open('https://careers.dstsystems.com/hr/aoldst.nsf/app?OpenForm&apptype=profile',"displayWindow","menubar=1,status=1,resizable=1,scrollbars=1,width=680,height=540,toolbar=0,location=1");

}
		
function apply(jbcd)   {

form2Window=window.open("https://careers.dstsystems.com/hr/aoldst.nsf/app?OpenForm&apptype=profile&jobcode="+jbcd,"displayWindow", "menubar=1,status=1,resizable=1,scrollbars=1,width=680,height=540,toolbar=0,location=1");

}


function dateUpdate()  {

var months = new Array(13);
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";

var dateObj = new Date(document.lastModified)
var lmonth = months[dateObj.getMonth() + 1]
var fyear = dateObj.getYear()
var date = dateObj.getDate()

alert (lmonth + " " + date + ", " + fyear);
return (lmonth + " " + date + ", " + fyear);

}		
*/
