﻿var AC_FL_RunContent = 0;
var min=11;
var max=25;

function trim_str(str) {
	str = str.replace(/^\s+/, '');
	for (var i = str.length - 1; i >= 0; i--) {
		if (/\S/.test(str.charAt(i))) {
			str = str.substring(0, i + 1);
			break;
		}
	}
	return str;
}
function ClearUsername() {
	if(document.getElementById("txt_Username").value == ""){
		document.getElementById("txt_Username").style.backgroundImage="none";
	}
}
function UsernameLoseFocus() {
	if(trim_str(document.getElementById("txt_Username").value) == "") {
		document.getElementById("txt_Username").style.backgroundImage="url('imgs/userbox.jpg')"; 
	}
}
function ClearPassword() {
	if(document.getElementById("txt_Password").value == ""){
		document.getElementById("txt_Password").style.backgroundImage="none";	
	}
}
function PasswordLoseFocus() {
	if(trim_str(document.getElementById("txt_Password").value) == "") {
		document.getElementById("txt_Password").style.backgroundImage="url('imgs/pwdbox.jpg')"; 
	}
}
function doLogin() {
	document.getElementById("loginButton").style.display = "none";
	document.getElementById("loginWait").style.display = "block";
			if(trim_str(document.getElementById("txt_Username").value) == "" || trim_str(document.getElementById("txt_Password").value) == ""){
				document.getElementById("loginButton").style.display = "block";
				document.getElementById("loginWait").style.display = "none";
				alert("You must enter a username and password and select a state to login to.");		
			} else {
				var username = $Security.Encrypt_Text(document.getElementById("txt_Username").value);
				var password = $Security.Encrypt_Text(document.getElementById("txt_Password").value);
						if(document.getElementById('state').options[document.getElementById('state').selectedIndex].value == "FL"){	
							location.href = "https://www.hugroupfl.com/Home?u=" + username + "&p=" + password;
						}else if(document.getElementById('state').options[document.getElementById('state').selectedIndex].value == "KY"){
							location.href = "https://www.hugroupky.com/Home?u=" + username + "&p=" + password;
						}else if(document.getElementById('state').options[document.getElementById('state').selectedIndex].value == "OH"){
							location.href = "https://www.hugroupoh.com/Home?u=" + username + "&p=" + password;
						}
			}

}
 
(function() {
if (typeof(Security) == "undefined") {
var Security = function() {
if (window == this || !this.init) {
return new Security();
} else {
return this.init();
}
};
}
 
var nEncKey, cText, nCharSize, cSourceText;
 
Security.prototype = {
init : function() {
},
 
Encrypt_Text : function(cText, utf8) {
 
 
if (utf8) {
var eText = this.utf8_encode(cText);
} else {
var eText = cText;
}
 
var nCounter = 0;
// Get a random Number between 1 and 100. This will be the multiplier
// for the Ascii value of the characters.
this.nEncKey = this.intval((100 * this.Rnd()) + 1);
 
// Loop until we get a random value betwee 5 and 7. This will be
// the lenght (with leading zeros) of the value of the Characters.
this.nCharSize = 0;
var nUpperBound = 10;
var nLowerBound = 5;
this.nCharSize = this.intval((nUpperBound - nLowerBound + 1) * this.Rnd() + nLowerBound);
// Encrypt the Size of the characters and convert it to String.
// This size has to be standard so we always get the right character.
var cCharSize = this.fEncryptedKeySize(this.nCharSize);
// Convert the KeyNumber to String with leading zeros.
var cEncKey = this.NumToString(this.nEncKey, this.nCharSize);
// Get the text to encrypt and it's size.
var cEncryptedText = '';
var nTextLenght = this.strlen(eText);
 
// Loop thru the text one character at the time.
for (nCounter = 1; nCounter <= nTextLenght; nCounter++) {
// Get the Next Character.
var cChar = this.Mid(eText, nCounter, 1);
// Get Ascii Value of the character multplied by the Key Number.
var nChar = this.ord(cChar) * this.nEncKey;
// Get the String version of the Ascii Code with leading zeros.
// using the Random generated Key Lenght.
var cChar2 = this.NumToString(nChar, this.nCharSize);
// Add the Newly generated character to the encrypted text variable.
cEncryptedText += cChar2;
}
 
// Separate the text in two to insert the enc
// key in the middle of the string.
var nLeft = this.intval(this.strlen(cEncryptedText) / 2);
var cLeft = this.strleft(cEncryptedText, nLeft);
var nRight = this.strlen(cEncryptedText) - nLeft;
var cRight = this.strright(cEncryptedText, nRight);
// Add a Dummy string at the end to fool people.
var cDummy = this.CreateDummy();
// Add all the strings together to get the final result.
this.cSourceText = cEncryptedText;
this.InsertInTheMiddle(this.cSourceText, cEncKey);
this.InsertInTheMiddle(this.cSourceText, cCharSize);
cEncryptedText = this.cSourceText;
cEncryptedText = this.CreateDummy() + cEncryptedText + this.CreateDummy();
 
return cEncryptedText;
 
},
 
Decrypt_Text : function(cText, utf8) {
 
var cTempText = cText;
var cDecryptedText = '';
var len = this.strlen(cTempText);
var nChar2 = 0;
var nChar = 0;
 
this.cText = '';
 
// Replace alpha characters for zeros.
for (var nCounter = 1; nCounter <= len; nCounter++) {
cChar = this.Mid(cTempText, nCounter, 1);
if (this.is_numeric(cChar) == true) {
this.cText += cChar;
} else {
this.cText += '0';
}
 
}
 
// Get the size of the key.
this.cText = this.strleft(this.cText, this.strlen(this.cText) - 4);
this.cText = this.strright(this.cText, this.strlen(this.cText) - 4);
this.nCharSize = 0;
this.Extract_Char_Size(this.cText, this.nCharSize);
this.Extract_Enc_Key(this.cText, this.nCharSize, this.nEncKey);
 
// Decrypt the Size of the encrypted characters.
nTextLenght = this.strlen(this.cText);
// Loop thru text in increments of the Key Size.
var nCounter = 1;
 
do { // Get a Character the size of the key.
cChar = this.Mid(this.cText, nCounter, this.nCharSize);
// Get the value of the character.
nChar = this.Val(cChar);
// Divide the value by the Key to get the real value of the
// character.
if (this.nEncKey > 0) {
nChar2 = parseInt(nChar / this.nEncKey);
}
 
// Convert the value to the character.
cChar2 = this.chr(nChar2);
cDecryptedText += cChar2;
nCounter += parseInt(this.nCharSize);
} while (nCounter <= nTextLenght);
 
// Clear any unwanted spaces and show the decrypted text.
cDecryptedText = this.trim(cDecryptedText);
 
if (utf8) {
return this.utf8_decode(cDecryptedText);
} else {
return cDecryptedText;
}
 
},
 
Extract_Char_Size : function(cText, nCharSize) {
 
// Get the half left side of the text.
var nLeft = this.intval(this.strlen(cText) / 2);
var cLeft = this.strleft(cText, nLeft);
// Get the half right side of the text.
var nRight = this.strlen(cText) - nLeft;
var cRight = this.strright(cText, nRight);
 
// Get the key from the text.
var nKeyEnc = this.Val(this.strright(cLeft, 2));
var nKeySize = this.Val(this.strleft(cRight, 2));
 
if (nKeyEnc >= 5) {
this.nCharSize = parseInt(nKeySize) + parseInt(nKeyEnc);   
} else {
this.nCharSize = parseInt(nKeySize) - parseInt(nKeyEnc); 
}
 
this.cText = this.strleft(cLeft, this.strlen(cLeft) - 2) +
this.strright(cRight, this.strlen(cRight) - 2);
 
},
 
Extract_Enc_Key : function(cText, nCharSize, nEncKey) {
 
var cEncKey = '';
 
// Get the real size of the text (without the previously
// stored character size).
var nLenght = this.strlen(cText) - nCharSize;
// Get the half left and half right sides of the text.
var nLeft = this.intval(nLenght / 2);
var cLeft = this.strleft(cText, nLeft);
var nRight = nLenght - nLeft;
var cRight = this.strright(cText, nRight);
// Get the key from the text.
cEncKey = this.Mid(cText, nLeft + 1, nCharSize);
// Get the numeric value of the key.
this.nEncKey = this.Val(this.trim(cEncKey));
// Get the real text to decrypt (left side + right side).
this.cText = cLeft + '' + cRight;
},
 
fEncryptedKeySize : function(nKeySize) {
 
var nLowerBound = 0;
var nKeyEnc = this.intval((nKeySize - nLowerBound + 1) * this.Rnd() + nLowerBound);
 
if (nKeyEnc >= 5) {
nKeySize = parseInt(nKeySize) - parseInt(nKeyEnc); 
} else {
nKeySize = parseInt(nKeySize) + parseInt(nKeyEnc); 
}
 
return this.NumToString(nKeyEnc, 2) + this.NumToString(nKeySize, 2);
 
},
 
NumToString : function(nNumber, nZeros) {
 
// Check that the zeros to fill are not smaller than the actual size.
var cNumber = this.trim(nNumber);
var nLenght = this.strlen(cNumber);
 
if (nZeros < nLenght) {
nZeros = 0;
}
 
var nUpperBound = 122;
var nLowerBound = 65;
var nCounter = 0;
 
for (nCounter = 1; nCounter <= (nZeros - nLenght); nCounter++) { // Add a zero in front of the string until we reach the desired size.
var lCreated = false;
 
do {
nNumber = this.intval((nUpperBound - nLowerBound + 1) * this.Rnd() + nLowerBound);
if ((nNumber > 90) && (nNumber < 97)) {
lCreated = false; 
} else {
lCreated = true; 
}
 
} while (lCreated == false);
 
cChar = this.chr(nNumber);
cNumber = cChar + cNumber;
}
 
// Return the resulting string.
return cNumber;
 
},
 
InsertInTheMiddle : function(cSourceText, cTextToInsert) {
 
// Get the half left and half right sides of the text.
var nLeft = this.intval(this.strlen(cSourceText) / 2);
var cLeft = this.strleft(cSourceText, nLeft);
var nRight = this.strlen(cSourceText) - nLeft;
var cRight = this.strright(cSourceText, nRight);
// Insert cTextToString in the middle of cSourceText.
this.cSourceText = cLeft + cTextToInsert + cRight;
 
},
 
CreateDummy : function() {
 
var nUpperBound = 122;
var nLowerBound = 48;
var nCounter = 0;
var cDummy = '';
 
for (nCounter = 1; nCounter <= 4; nCounter++) {
var lCreated = false;
 
do {
nDummy = this.intval((nUpperBound - nLowerBound + 1) * this.Rnd() + nLowerBound)
if (((nDummy > 57) && (nDummy < 65)) || ((nDummy > 90) && (nDummy < 97))) {
lCreated = false; 
} else {
lCreated = true; 
}
 
} while (lCreated == false);
 
cDummy += this.chr(nDummy);
 
}
 
return cDummy;
 
},
 
is_numeric : function(mixed_var) {
// More info at: http://phpjs.org
// This is version: 2.47 php.js is copyright 2009 Kevin van Zonneveld.
 
if (mixed_var === '') {
return false;
}
 
return !isNaN(mixed_var * 1);
 
},
 
strlen : function(string) {
 
var str = string + '';
 
return str.length;
 
},
 
strright : function(tmp, nRight) {
 
var len = this.strlen(tmp);
 
if (nRight == 0){
str = ''; 
} else if (nRight < len) {
str = this.Mid(tmp, len - nRight + 1, len); 
}
 
return str;
 
},
 
strleft : function(tmp, nLeft) {
 
var len = this.strlen(tmp);
 
if (nLeft == 0){
str = ''; 
} else if (nLeft < len) {
str = this.Mid(tmp, 1, nLeft); 
}
 
return str;
 
},
 
Mid : function(tmp, start, length) {
 
str = this.substr(tmp, start - 1, length);
return str;
 
},
 
substr : function(f_string, f_start, f_length) {
 
var str = f_string + '';
 
return str.substr(f_start, f_length);
 
},
 
trim : function(f_string) {
 
var str = f_string + '';
 
while (str.charAt(0) == (" ")) {
str = str.substring(1);
}
 
while (str.charAt(str.length-1) == " ") {
str = str.substring(0,str.length-1);
}
 
return str;
 
},
 
Rnd : function() {
 
do {
var tmp = Math.abs( Math.tan( Math.random() ) );
} while ((tmp > 1) || (tmp < 0));
 
tmp = this.Mid(tmp, 1, 8);
 
return tmp;
 
},
 
Val : function(tmp) {
 
var length = this.strlen(tmp);
var tmp2 = 0;
 
for (i = 1; i <= length; i++) {
var tmp1 = this.substr(tmp, i - 1, 1);
if (this.is_numeric(tmp1) == true) {
tmp2 += tmp1;
}
 
}
 
return this.intval(tmp2);
 
},
 
intval : function(mixed_var, base) {
// More info at: http://phpjs.org
// This is version: 2.47 php.js is copyright 2009 Kevin van Zonneveld.
 
var tmp;
var type = typeof(mixed_var);
if (type == 'boolean') {
if (mixed_var == true) {
return 1;
} else {
return 0;
}
 
} else if (type == 'string') {
tmp = parseInt(mixed_var * 1);
if (isNaN(tmp) || !isFinite(tmp)) {
return 0;
} else {
return tmp.toString(base || 10);
}
 
} else if (type == 'number' && isFinite(mixed_var)) {
return Math.floor(mixed_var);
} else {
return 0;
}
 
},
 
chr : function(ascii) {
 
return String.fromCharCode(ascii);
 
},
 
ord : function(string) {
 
string += '';
return string.charCodeAt(0);
 
},
 
utf8_encode : function(string) {
// More info at: http://phpjs.org
// This is version: 2.47 php.js is copyright 2009 Kevin van Zonneveld.
 
string = (string + '').replace(/\r\n/g, "\n").replace(/\r/g, "\n");
var utftext = "";
var start, end;
var stringl = 0;
start = end = 0;
stringl = string.length;
 
for (var n = 0; n < stringl; n++) {
var c1 = string.charCodeAt(n);
var enc = null;
 
if (c1 < 128) {
end++;
} else if ((c1 > 127) && (c1 < 2048)) {
enc = String.fromCharCode((c1 >> 6) | 192)
+ String.fromCharCode((c1 & 63) | 128);
} else {
enc = String.fromCharCode((c1 >> 12) | 224)
+ String.fromCharCode(((c1 >> 6) & 63) | 128)
+ String.fromCharCode((c1 & 63) | 128);
}
 
if (enc != null) {
if (end > start) {
utftext += string.substring(start, end);
}
 
utftext += enc;
start = end = n + 1;
}
 
}
 
if (end > start) {
utftext += string.substring(start, string.length);
}
 
return utftext;
 
},
 
utf8_decode : function(str_data) {
// More info at: http://phpjs.org
// This is version: 2.47 php.js is copyright 2009 Kevin van Zonneveld.
 
var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0;
str_data += '';
 
while (i < str_data.length) {
c1 = str_data.charCodeAt(i);
if (c1 < 128) {
tmp_arr[ac++] = String.fromCharCode(c1);
i++;
} else if ((c1 > 191) && (c1 < 224)) {
c2 = str_data.charCodeAt(i + 1);
tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6)
| (c2 & 63));
i += 2;
} else {
c2 = str_data.charCodeAt(i + 1);
c3 = str_data.charCodeAt(i + 2);
tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12)
| ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
 
}
 
return tmp_arr.join('');
 
}
 
};
 
window.$Security = Security();
 
})();
function increaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px";
  	} 
}
function decreaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}

function sendMailTo(name, company, domain) {
      locationstring = 'm' + 'a' + 'i' + 'lto:' + name + '@' + company + '.' + domain;
      window.location.replace(locationstring);
   }

