var param_style = 'generic/shape2_image1';
var param_type = [3];
if (self.location != top.location) top.location = self.location;
var param_came_from = '';

    function affp_producer(mine,url)
    {
		var affp = '';
		re = /[&?]affp=([^&]+)/i;
		matches = re.exec(url);
		if (matches) affp = matches[1];

		var ssaid = '';
		re = /[&?]SSAID=([^&]+)/i;
		matches = re.exec(url);
		if (matches) ssaid = matches[1];
		if (ssaid && affp=='') affp = 'sas';

	    if(affp == 'sas') return 'lDWT7s';
if(affp == 'cxc') return 'Ushi4p';
if(affp == 'autosas') return 'EvF18R';


	    if(affp != '') return affp;

    	return mine;
    }
var captcha_salt = "1c399782567827b0e6e1bedc372d494c";
var base_url = "https://www.leadpile.com/";
//http://www.quirksmode.org/js/detect.html
var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; },
searchString: function (data) {for (var i=0;i<data.length;i++)	{var dataString = data[i].string;var dataProp = data[i].prop;this.versionSearchString = data[i].versionSearch || data[i].identity;if (dataString) {if (dataString.indexOf(data[i].subString) != -1)return data[i].identity;}else if (dataProp)return data[i].identity;}},
searchVersion: function (dataString) {var index = dataString.indexOf(this.versionSearchString);if (index == -1) return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},
dataBrowser: [
{string: navigator.userAgent,subString: "OmniWeb",versionSearch: "OmniWeb/",identity: "OmniWeb"},
{string: navigator.vendor,subString: "Apple",identity: "Safari"},
{prop: window.opera,identity: "Opera"},
{string: navigator.vendor,subString: "iCab",identity: "iCab"},
{string: navigator.vendor,subString: "KDE",identity: "Konqueror"},
{string: navigator.userAgent,subString: "Firefox",identity: "Firefox"},
{string: navigator.vendor,subString: "Camino",identity: "Camino"},
{string: navigator.userAgent,subString: "Netscape",identity: "Netscape"},
{string: navigator.userAgent,subString: "MSIE",identity: "Explorer",versionSearch: "MSIE"},
{string: navigator.userAgent,subString: "Gecko",identity: "Mozilla",versionSearch: "rv"},
{string: navigator.userAgent,subString: "Mozilla",identity: "Netscape",versionSearch: "Mozilla"}
],
dataOS : [
{string: navigator.platform,subString: "Win",identity: "Windows"},
{string: navigator.platform,subString: "Mac",identity: "Mac"},
{string: navigator.platform,subString: "Linux",identity: "Linux"}
]
};
BrowserDetect.init();(function (){var m = {'\b': '\\b','\t': '\\t','\n': '\\n','\f': '\\f','\r': '\\r','"' : '\\"','\\': '\\\\'},s = {array: function (x) {var a = ['['], b, f, i, l = x.length, v;for (i = 0; i < l; i += 1) {v = x[i];f = s[typeof v];if (f) {v = f(v);if (typeof v == 'string') {if (b) {a[a.length] = ',';}a[a.length] = v;b = true;}}}a[a.length] = ']';return a.join('');},'boolean': function (x) {return String(x);},'null': function (x) {return "null";},number: function (x) {return isFinite(x) ? String(x) : 'null';},object: function (x) {if (x) {if (x instanceof Array) {return s.array(x);}var a = ['{'], b, f, i, v;for (i in x) {v = x[i];f = s[typeof v];if (f) {v = f(v);if (typeof v == 'string') {if (b) {a[a.length] = ',';}a.push(s.string(i), ':', v);b = true;}}}a[a.length] = '}';return a.join('');}return 'null';},string: function (x) {if (/["\\\x00-\x1f]/.test(x)) {x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {var c = m[b];if (c) {return c;}c = b.charCodeAt();return '\\u00' +Math.floor(c / 16).toString(16) +(c % 16).toString(16);});}return '"' + x + '"';}};
Object.prototype.toJSONString = function () {return s.object(this);};
Array.prototype.toJSONString = function () {return s.array(this);};})();
String.prototype.parseJSON = function () {try {return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(this.replace(/"(\\.|[^"\\])*"/g, ''))) &&eval('(' + this + ')');} catch (e) {return false;}};
/*  Prototype JavaScript framework, version 1.5.0_rc0
*  (c) 2005 Sam Stephenson <sam@conio.net>
*
*  Prototype is freely distributable under the terms of an MIT-style license.
*  For details, see the Prototype web site: http://prototype.conio.net/
*
/*--------------------------------------------------------------------------*/
var Prototype = {
Version: '1.5.0_rc0',
ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
emptyFunction: function() {},
K: function(x) {return x}
}
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
var Abstract = new Object();
Object.extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
}
Object.inspect = function(object) {
try {
if (object == undefined) return 'undefined';
if (object == null) return 'null';
return object.inspect ? object.inspect() : object.toString();
} catch (e) {
if (e instanceof RangeError) return '...';
throw e;
}
}
Function.prototype.bind = function() {
var __method = this, args = $A(arguments), object = args.shift();
return function() {
return __method.apply(object, args.concat($A(arguments)));
}
}
Function.prototype.bindAsEventListener = function(object) {
var __method = this;
return function(event) {
return __method.call(object, event || window.event);
}
}
Object.extend(Number.prototype, {
toColorPart: function() {
var digits = this.toString(16);
if (this < 16) return '0' + digits;
return digits;
},
succ: function() {
return this + 1;
},
times: function(iterator) {
$R(0, this, true).each(iterator);
return this;
}
});
var Try = {
these: function() {
var returnValue;
for (var i = 0; i < arguments.length; i++) {
var lambda = arguments[i];
try {
returnValue = lambda();
break;
} catch (e) {}
}
return returnValue;
}
}
/*--------------------------------------------------------------------------*/
var PeriodicalExecuter = Class.create();
PeriodicalExecuter.prototype = {
initialize: function(callback, frequency) {
this.callback = callback;
this.frequency = frequency;
this.currentlyExecuting = false;
this.registerCallback();
},
registerCallback: function() {
setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
},
onTimerEvent: function() {
if (!this.currentlyExecuting) {
try {
this.currentlyExecuting = true;
this.callback();
} finally {
this.currentlyExecuting = false;
}
}
}
}
Object.extend(String.prototype, {
gsub: function(pattern, replacement) {
var result = '', source = this, match;
replacement = arguments.callee.prepareReplacement(replacement);
while (source.length > 0) {
if (match = source.match(pattern)) {
result += source.slice(0, match.index);
result += (replacement(match) || '').toString();
source  = source.slice(match.index + match[0].length);
} else {
result += source, source = '';
}
}
return result;
},
sub: function(pattern, replacement, count) {
replacement = this.gsub.prepareReplacement(replacement);
count = count === undefined ? 1 : count;
return this.gsub(pattern, function(match) {
if (--count < 0) return match[0];
return replacement(match);
});
},
scan: function(pattern, iterator) {
this.gsub(pattern, iterator);
return this;
},
truncate: function(length, truncation) {
length = length || 30;
truncation = truncation === undefined ? '...' : truncation;
return this.length > length ?
this.slice(0, length - truncation.length) + truncation : this;
},
strip: function() {
return this.replace(/^\s+/, '').replace(/\s+$/, '');
},
stripTags: function() {
return this.replace(/<\/?[^>]+>/gi, '');
},
stripScripts: function() {
return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
},
extractScripts: function() {
var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
return (this.match(matchAll) || []).map(function(scriptTag) {
return (scriptTag.match(matchOne) || ['', ''])[1];
});
},
evalScripts: function() {
return this.extractScripts().map(function(script) { return eval(script) });
},
escapeHTML: function() {
var div = document.createElement('div');
var text = document.createTextNode(this);
div.appendChild(text);
return div.innerHTML;
},
unescapeHTML: function() {
var div = document.createElement('div');
div.innerHTML = this.stripTags();
return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
},
toQueryParams: function() {
var pairs = this.match(/^\??(.*)$/)[1].split('&');
return pairs.inject({}, function(params, pairString) {
var pair = pairString.split('=');
params[pair[0]] = pair[1];
return params;
});
},
toArray: function() {
return this.split('');
},
camelize: function() {
var oStringList = this.split('-');
if (oStringList.length == 1) return oStringList[0];
var camelizedString = this.indexOf('-') == 0
? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
: oStringList[0];
for (var i = 1, len = oStringList.length; i < len; i++) {
var s = oStringList[i];
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
}
return camelizedString;
},
inspect: function() {
return "'" + this.replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + "'";
}
});
String.prototype.gsub.prepareReplacement = function(replacement) {
if (typeof replacement == 'function') return replacement;
var template = new Template(replacement);
return function(match) { return template.evaluate(match) };
}
String.prototype.parseQuery = String.prototype.toQueryParams;
var Template = Class.create();
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
Template.prototype = {
initialize: function(template, pattern) {
this.template = template.toString();
this.pattern  = pattern || Template.Pattern;
},
evaluate: function(object) {
return this.template.gsub(this.pattern, function(match) {
var before = match[1];
if (before == '\\') return match[2];
return before + (object[match[3]] || '').toString();
});
}
}
var $break    = new Object();
var $continue = new Object();
var Enumerable = {
each: function(iterator) {
var index = 0;
try {
this._each(function(value) {
try {
iterator(value, index++);
} catch (e) {
if (e != $continue) throw e;
}
});
} catch (e) {
if (e != $break) throw e;
}
},
all: function(iterator) {
var result = true;
this.each(function(value, index) {
result = result && !!(iterator || Prototype.K)(value, index);
if (!result) throw $break;
});
return result;
},
any: function(iterator) {
var result = true;
this.each(function(value, index) {
if (result = !!(iterator || Prototype.K)(value, index))
throw $break;
});
return result;
},
collect: function(iterator) {
var results = [];
this.each(function(value, index) {
results.push(iterator(value, index));
});
return results;
},
detect: function (iterator) {
var result;
this.each(function(value, index) {
if (iterator(value, index)) {
result = value;
throw $break;
}
});
return result;
},
findAll: function(iterator) {
var results = [];
this.each(function(value, index) {
if (iterator(value, index))
results.push(value);
});
return results;
},
grep: function(pattern, iterator) {
var results = [];
this.each(function(value, index) {
var stringValue = value.toString();
if (stringValue.match(pattern))
results.push((iterator || Prototype.K)(value, index));
})
return results;
},
include: function(object) {
var found = false;
this.each(function(value) {
if (value == object) {
found = true;
throw $break;
}
});
return found;
},
inject: function(memo, iterator) {
this.each(function(value, index) {
memo = iterator(memo, value, index);
});
return memo;
},
invoke: function(method) {
var args = $A(arguments).slice(1);
return this.collect(function(value) {
return value[method].apply(value, args);
});
},
max: function(iterator) {
var result;
this.each(function(value, index) {
value = (iterator || Prototype.K)(value, index);
if (result == undefined || value >= result)
result = value;
});
return result;
},
min: function(iterator) {
var result;
this.each(function(value, index) {
value = (iterator || Prototype.K)(value, index);
if (result == undefined || value < result)
result = value;
});
return result;
},
partition: function(iterator) {
var trues = [], falses = [];
this.each(function(value, index) {
((iterator || Prototype.K)(value, index) ?
trues : falses).push(value);
});
return [trues, falses];
},
pluck: function(property) {
var results = [];
this.each(function(value, index) {
results.push(value[property]);
});
return results;
},
reject: function(iterator) {
var results = [];
this.each(function(value, index) {
if (!iterator(value, index))
results.push(value);
});
return results;
},
sortBy: function(iterator) {
return this.collect(function(value, index) {
return {value: value, criteria: iterator(value, index)};
}).sort(function(left, right) {
var a = left.criteria, b = right.criteria;
return a < b ? -1 : a > b ? 1 : 0;
}).pluck('value');
},
toArray: function() {
return this.collect(Prototype.K);
},
zip: function() {
var iterator = Prototype.K, args = $A(arguments);
if (typeof args.last() == 'function')
iterator = args.pop();
var collections = [this].concat(args).map($A);
return this.map(function(value, index) {
return iterator(collections.pluck(index));
});
},
inspect: function() {
return '#<Enumerable:' + this.toArray().inspect() + '>';
}
}
Object.extend(Enumerable, {
map:     Enumerable.collect,
find:    Enumerable.detect,
select:  Enumerable.findAll,
member:  Enumerable.include,
entries: Enumerable.toArray
});
var $A = Array.from = function(iterable) {
if (!iterable) return [];
if (iterable.toArray) {
return iterable.toArray();
} else {
var results = [];
for (var i = 0; i < iterable.length; i++)
results.push(iterable[i]);
return results;
}
}
Object.extend(Array.prototype, Enumerable);
if (!Array.prototype._reverse)
Array.prototype._reverse = Array.prototype.reverse;
Object.extend(Array.prototype, {
_each: function(iterator) {
for (var i = 0; i < this.length; i++)
iterator(this[i]);
},
clear: function() {
this.length = 0;
return this;
},
first: function() {
return this[0];
},
last: function() {
return this[this.length - 1];
},
compact: function() {
return this.select(function(value) {
return value != undefined || value != null;
});
},
flatten: function() {
return this.inject([], function(array, value) {
return array.concat(value && value.constructor == Array ?
value.flatten() : [value]);
});
},
without: function() {
var values = $A(arguments);
return this.select(function(value) {
return !values.include(value);
});
},
indexOf: function(object) {
for (var i = 0; i < this.length; i++)
if (this[i] == object) return i;
return -1;
},
reverse: function(inline) {
return (inline !== false ? this : this.toArray())._reverse();
},
inspect: function() {
return '[' + this.map(Object.inspect).join(', ') + ']';
}
});
var Hash = {
_each: function(iterator) {
for (var key in this) {
var value = this[key];
if (typeof value == 'function') continue;
var pair = [key, value];
pair.key = key;
pair.value = value;
iterator(pair);
}
},
keys: function() {
return this.pluck('key');
},
values: function() {
return this.pluck('value');
},
merge: function(hash) {
return $H(hash).inject($H(this), function(mergedHash, pair) {
mergedHash[pair.key] = pair.value;
return mergedHash;
});
},
toQueryString: function() {
return this.map(function(pair) {
return pair.map(encodeURIComponent).join('=');
}).join('&');
},
inspect: function() {
return '#<Hash:{' + this.map(function(pair) {
return pair.map(Object.inspect).join(': ');
}).join(', ') + '}>';
}
}
function $H(object) {
var hash = Object.extend({}, object || {});
Object.extend(hash, Enumerable);
Object.extend(hash, Hash);
return hash;
}
ObjectRange = Class.create();
Object.extend(ObjectRange.prototype, Enumerable);
Object.extend(ObjectRange.prototype, {
initialize: function(start, end, exclusive) {
this.start = start;
this.end = end;
this.exclusive = exclusive;
},
_each: function(iterator) {
var value = this.start;
do {
iterator(value);
value = value.succ();
} while (this.include(value));
},
include: function(value) {
if (value < this.start)
return false;
if (this.exclusive)
return value < this.end;
return value <= this.end;
}
});
var $R = function(start, end, exclusive) {
return new ObjectRange(start, end, exclusive);
}
var Ajax = {
getTransport: function() {
return Try.these(
function() {return new XMLHttpRequest()},
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
function() {return new ActiveXObject('Microsoft.XMLHTTP')}
) || false;
},
activeRequestCount: 0
}
Ajax.Responders = {
responders: [],
_each: function(iterator) {
this.responders._each(iterator);
},
register: function(responderToAdd) {
if (!this.include(responderToAdd))
this.responders.push(responderToAdd);
},
unregister: function(responderToRemove) {
this.responders = this.responders.without(responderToRemove);
},
dispatch: function(callback, request, transport, json) {
this.each(function(responder) {
if (responder[callback] && typeof responder[callback] == 'function') {
try {
responder[callback].apply(responder, [request, transport, json]);
} catch (e) {}
}
});
}
};
Object.extend(Ajax.Responders, Enumerable);
Ajax.Responders.register({
onCreate: function() {
Ajax.activeRequestCount++;
},
onComplete: function() {
Ajax.activeRequestCount--;
}
});
Ajax.Base = function() {};
Ajax.Base.prototype = {
setOptions: function(options) {
this.options = {
method:       'post',
asynchronous: true,
contentType:  'application/x-www-form-urlencoded',
parameters:   ''
}
Object.extend(this.options, options || {});
},
responseIsSuccess: function() {
return this.transport.status == undefined
|| this.transport.status == 0
|| (this.transport.status >= 200 && this.transport.status < 300);
},
responseIsFailure: function() {
return !this.responseIsSuccess();
}
}
Ajax.Request = Class.create();
Ajax.Request.Events =
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
initialize: function(url, options) {
this.transport = Ajax.getTransport();
this.setOptions(options);
this.request(url);
},
request: function(url) {
var parameters = this.options.parameters || '';
if (parameters.length > 0) parameters += '&_=';
try {
this.url = url;
if (this.options.method == 'get' && parameters.length > 0)
this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
Ajax.Responders.dispatch('onCreate', this, this.transport);
this.transport.open(this.options.method, this.url,
this.options.asynchronous);
if (this.options.asynchronous) {
this.transport.onreadystatechange = this.onStateChange.bind(this);
setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
}
this.setRequestHeaders();
var body = this.options.postBody ? this.options.postBody : parameters;
this.transport.send(this.options.method == 'post' ? body : null);
} catch (e) {
this.dispatchException(e);
}
},
setRequestHeaders: function() {
var requestHeaders =
['X-Requested-With', 'XMLHttpRequest',
'X-Prototype-Version', Prototype.Version,
'Accept', 'text/javascript, text/html, application/xml, text/xml, */*'];
if (this.options.method == 'post') {
requestHeaders.push('Content-type', this.options.contentType);
/* Force "Connection: close" for Mozilla browsers to work around
* a bug where XMLHttpReqeuest sends an incorrect Content-length
* header. See Mozilla Bugzilla #246651.
*/
if (this.transport.overrideMimeType)
requestHeaders.push('Connection', 'close');
}
if (this.options.requestHeaders)
requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
for (var i = 0; i < requestHeaders.length; i += 2)
this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
},
onStateChange: function() {
var readyState = this.transport.readyState;
if (readyState != 1)
this.respondToReadyState(this.transport.readyState);
},
header: function(name) {
try {
return this.transport.getResponseHeader(name);
} catch (e) {}
},
evalJSON: function() {
try {
return eval('(' + this.header('X-JSON') + ')');
} catch (e) {}
},
evalResponse: function() {
try {
return eval(this.transport.responseText);
} catch (e) {
this.dispatchException(e);
}
},
respondToReadyState: function(readyState) {
var event = Ajax.Request.Events[readyState];
var transport = this.transport, json = this.evalJSON();
if (event == 'Complete') {
try {
(this.options['on' + this.transport.status]
|| this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
|| Prototype.emptyFunction)(transport, json);
} catch (e) {
this.dispatchException(e);
}
if ((this.header('Content-type') || '').match(/^text\/javascript/i))
this.evalResponse();
}
try {
(this.options['on' + event] || Prototype.emptyFunction)(transport, json);
Ajax.Responders.dispatch('on' + event, this, transport, json);
} catch (e) {
this.dispatchException(e);
}
/* Avoid memory leak in MSIE: clean up the oncomplete event handler */
if (event == 'Complete')
this.transport.onreadystatechange = Prototype.emptyFunction;
},
dispatchException: function(exception) {
(this.options.onException || Prototype.emptyFunction)(this, exception);
Ajax.Responders.dispatch('onException', this, exception);
}
});
Ajax.Updater = Class.create();
Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
initialize: function(container, url, options) {
this.containers = {
success: container.success ? $(container.success) : $(container),
failure: container.failure ? $(container.failure) :
(container.success ? null : $(container))
}
this.transport = Ajax.getTransport();
this.setOptions(options);
var onComplete = this.options.onComplete || Prototype.emptyFunction;
this.options.onComplete = (function(transport, object) {
this.updateContent();
onComplete(transport, object);
}).bind(this);
this.request(url);
},
updateContent: function() {
var receiver = this.responseIsSuccess() ?
this.containers.success : this.containers.failure;
var response = this.transport.responseText;
if (!this.options.evalScripts)
response = response.stripScripts();
if (receiver) {
if (this.options.insertion) {
new this.options.insertion(receiver, response);
} else {
Element.update(receiver, response);
}
}
if (this.responseIsSuccess()) {
if (this.onComplete)
setTimeout(this.onComplete.bind(this), 10);
}
}
});
Ajax.PeriodicalUpdater = Class.create();
Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
initialize: function(container, url, options) {
this.setOptions(options);
this.onComplete = this.options.onComplete;
this.frequency = (this.options.frequency || 2);
this.decay = (this.options.decay || 1);
this.updater = {};
this.container = container;
this.url = url;
this.start();
},
start: function() {
this.options.onComplete = this.updateComplete.bind(this);
this.onTimerEvent();
},
stop: function() {
this.updater.onComplete = undefined;
clearTimeout(this.timer);
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
},
updateComplete: function(request) {
if (this.options.decay) {
this.decay = (request.responseText == this.lastText ?
this.decay * this.options.decay : 1);
this.lastText = request.responseText;
}
this.timer = setTimeout(this.onTimerEvent.bind(this),
this.decay * this.frequency * 1000);
},
onTimerEvent: function() {
this.updater = new Ajax.Updater(this.container, this.url, this.options);
}
});
function $() {
var results = [], element;
for (var i = 0; i < arguments.length; i++) {
element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
results.push(Element.extend(element));
}
return results.length < 2 ? results[0] : results;
}
document.getElementsByClassName = function(className, parentElement) {
var children = ($(parentElement) || document.body).getElementsByTagName('*');
return $A(children).inject([], function(elements, child) {
if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
elements.push(Element.extend(child));
return elements;
});
}
/*--------------------------------------------------------------------------*/
if (!window.Element)
var Element = new Object();
Element.extend = function(element) {
if (!element) return;
if (_nativeExtensions) return element;
if (!element._extended && element.tagName && element != window) {
var methods = Element.Methods, cache = Element.extend.cache;
for (property in methods) {
var value = methods[property];
if (typeof value == 'function')
element[property] = cache.findOrStore(value);
}
}
element._extended = true;
return element;
}
Element.extend.cache = {
findOrStore: function(value) {
return this[value] = this[value] || function() {
return value.apply(null, [this].concat($A(arguments)));
}
}
}
Element.Methods = {
visible: function(element) {
return $(element).style.display != 'none';
},
toggle: function() {
for (var i = 0; i < arguments.length; i++) {
var element = $(arguments[i]);
Element[Element.visible(element) ? 'hide' : 'show'](element);
}
},
hide: function() {
for (var i = 0; i < arguments.length; i++) {
var element = $(arguments[i]);
element.style.display = 'none';
}
},
show: function() {
for (var i = 0; i < arguments.length; i++) {
var element = $(arguments[i]);
element.style.display = '';
}
},
remove: function(element) {
element = $(element);
element.parentNode.removeChild(element);
},
update: function(element, html) {
$(element).innerHTML = html.stripScripts();
setTimeout(function() {html.evalScripts()}, 10);
},
replace: function(element, html) {
element = $(element);
if (element.outerHTML) {
element.outerHTML = html.stripScripts();
} else {
var range = element.ownerDocument.createRange();
range.selectNodeContents(element);
element.parentNode.replaceChild(
range.createContextualFragment(html.stripScripts()), element);
}
setTimeout(function() {html.evalScripts()}, 10);
},
getHeight: function(element) {
element = $(element);
return element.offsetHeight;
},
classNames: function(element) {
return new Element.ClassNames(element);
},
hasClassName: function(element, className) {
if (!(element = $(element))) return;
return Element.classNames(element).include(className);
},
addClassName: function(element, className) {
if (!(element = $(element))) return;
return Element.classNames(element).add(className);
},
removeClassName: function(element, className) {
if (!(element = $(element))) return;
return Element.classNames(element).remove(className);
},
// removes whitespace-only text node children
cleanWhitespace: function(element) {
element = $(element);
for (var i = 0; i < element.childNodes.length; i++) {
var node = element.childNodes[i];
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
Element.remove(node);
}
},
empty: function(element) {
return $(element).innerHTML.match(/^\s*$/);
},
childOf: function(element, ancestor) {
element = $(element), ancestor = $(ancestor);
while (element = element.parentNode)
if (element == ancestor) return true;
return false;
},
scrollTo: function(element) {
element = $(element);
var x = element.x ? element.x : element.offsetLeft,
y = element.y ? element.y : element.offsetTop;
window.scrollTo(x, y);
},
getStyle: function(element, style) {
element = $(element);
var value = element.style[style.camelize()];
if (!value) {
if (document.defaultView && document.defaultView.getComputedStyle) {
var css = document.defaultView.getComputedStyle(element, null);
value = css ? css.getPropertyValue(style) : null;
} else if (element.currentStyle) {
value = element.currentStyle[style.camelize()];
}
}
if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
if (Element.getStyle(element, 'position') == 'static') value = 'auto';
return value == 'auto' ? null : value;
},
setStyle: function(element, style) {
element = $(element);
for (var name in style)
element.style[name.camelize()] = style[name];
},
getDimensions: function(element) {
element = $(element);
if (Element.getStyle(element, 'display') != 'none')
return {width: element.offsetWidth, height: element.offsetHeight};
// All *Width and *Height properties give 0 on elements with display none,
// so enable the element temporarily
var els = element.style;
var originalVisibility = els.visibility;
var originalPosition = els.position;
els.visibility = 'hidden';
els.position = 'absolute';
els.display = '';
var originalWidth = element.clientWidth;
var originalHeight = element.clientHeight;
els.display = 'none';
els.position = originalPosition;
els.visibility = originalVisibility;
return {width: originalWidth, height: originalHeight};
},
makePositioned: function(element) {
element = $(element);
var pos = Element.getStyle(element, 'position');
if (pos == 'static' || !pos) {
element._madePositioned = true;
element.style.position = 'relative';
// Opera returns the offset relative to the positioning context, when an
// element is position relative but top and left have not been defined
if (window.opera) {
element.style.top = 0;
element.style.left = 0;
}
}
},
undoPositioned: function(element) {
element = $(element);
if (element._madePositioned) {
element._madePositioned = undefined;
element.style.position =
element.style.top =
element.style.left =
element.style.bottom =
element.style.right = '';
}
},
makeClipping: function(element) {
element = $(element);
if (element._overflow) return;
element._overflow = element.style.overflow;
if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
element.style.overflow = 'hidden';
},
undoClipping: function(element) {
element = $(element);
if (element._overflow) return;
element.style.overflow = element._overflow;
element._overflow = undefined;
}
}
Object.extend(Element, Element.Methods);
var _nativeExtensions = false;
if(!HTMLElement && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
var HTMLElement = {}
HTMLElement.prototype = document.createElement('div').__proto__;
}
Element.addMethods = function(methods) {
Object.extend(Element.Methods, methods || {});
if(typeof HTMLElement != 'undefined') {
var methods = Element.Methods, cache = Element.extend.cache;
for (property in methods) {
var value = methods[property];
if (typeof value == 'function')
HTMLElement.prototype[property] = cache.findOrStore(value);
}
_nativeExtensions = true;
}
}
Element.addMethods();
var Toggle = new Object();
Toggle.display = Element.toggle;
/*--------------------------------------------------------------------------*/
Abstract.Insertion = function(adjacency) {
this.adjacency = adjacency;
}
Abstract.Insertion.prototype = {
initialize: function(element, content) {
this.element = $(element);
this.content = content.stripScripts();
if (this.adjacency && this.element.insertAdjacentHTML) {
try {
this.element.insertAdjacentHTML(this.adjacency, this.content);
} catch (e) {
var tagName = this.element.tagName.toLowerCase();
if (tagName == 'tbody' || tagName == 'tr') {
this.insertContent(this.contentFromAnonymousTable());
} else {
throw e;
}
}
} else {
this.range = this.element.ownerDocument.createRange();
if (this.initializeRange) this.initializeRange();
this.insertContent([this.range.createContextualFragment(this.content)]);
}
setTimeout(function() {content.evalScripts()}, 10);
},
contentFromAnonymousTable: function() {
var div = document.createElement('div');
div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
return $A(div.childNodes[0].childNodes[0].childNodes);
}
}
var Insertion = new Object();
Insertion.Before = Class.create();
Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
initializeRange: function() {
this.range.setStartBefore(this.element);
},
insertContent: function(fragments) {
fragments.each((function(fragment) {
this.element.parentNode.insertBefore(fragment, this.element);
}).bind(this));
}
});
Insertion.Top = Class.create();
Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
initializeRange: function() {
this.range.selectNodeContents(this.element);
this.range.collapse(true);
},
insertContent: function(fragments) {
fragments.reverse(false).each((function(fragment) {
this.element.insertBefore(fragment, this.element.firstChild);
}).bind(this));
}
});
Insertion.Bottom = Class.create();
Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
initializeRange: function() {
this.range.selectNodeContents(this.element);
this.range.collapse(this.element);
},
insertContent: function(fragments) {
fragments.each((function(fragment) {
this.element.appendChild(fragment);
}).bind(this));
}
});
Insertion.After = Class.create();
Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
initializeRange: function() {
this.range.setStartAfter(this.element);
},
insertContent: function(fragments) {
fragments.each((function(fragment) {
this.element.parentNode.insertBefore(fragment,
this.element.nextSibling);
}).bind(this));
}
});
/*--------------------------------------------------------------------------*/
Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
initialize: function(element) {
this.element = $(element);
},
_each: function(iterator) {
this.element.className.split(/\s+/).select(function(name) {
return name.length > 0;
})._each(iterator);
},
set: function(className) {
this.element.className = className;
},
add: function(classNameToAdd) {
if (this.include(classNameToAdd)) return;
this.set(this.toArray().concat(classNameToAdd).join(' '));
},
remove: function(classNameToRemove) {
if (!this.include(classNameToRemove)) return;
this.set(this.select(function(className) {
return className != classNameToRemove;
}).join(' '));
},
toString: function() {
return this.toArray().join(' ');
}
}
Object.extend(Element.ClassNames.prototype, Enumerable);
var Selector = Class.create();
Selector.prototype = {
initialize: function(expression) {
this.params = {classNames: []};
this.expression = expression.toString().strip();
this.parseExpression();
this.compileMatcher();
},
parseExpression: function() {
function abort(message) { throw 'Parse error in selector: ' + message; }
if (this.expression == '')  abort('empty expression');
var params = this.params, expr = this.expression, match, modifier, clause, rest;
while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
params.attributes = params.attributes || [];
params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
expr = match[1];
}
if (expr == '*') return this.params.wildcard = true;
while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
modifier = match[1], clause = match[2], rest = match[3];
switch (modifier) {
case '#':       params.id = clause; break;
case '.':       params.classNames.push(clause); break;
case '':
case undefined: params.tagName = clause.toUpperCase(); break;
default:        abort(expr.inspect());
}
expr = rest;
}
if (expr.length > 0) abort(expr.inspect());
},
buildMatchExpression: function() {
var params = this.params, conditions = [], clause;
if (params.wildcard)
conditions.push('true');
if (clause = params.id)
conditions.push('element.id == ' + clause.inspect());
if (clause = params.tagName)
conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
if ((clause = params.classNames).length > 0)
for (var i = 0; i < clause.length; i++)
conditions.push('Element.hasClassName(element, ' + clause[i].inspect() + ')');
if (clause = params.attributes) {
clause.each(function(attribute) {
var value = 'element.getAttribute(' + attribute.name.inspect() + ')';
var splitValueBy = function(delimiter) {
return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
}
switch (attribute.operator) {
case '=':       conditions.push(value + ' == ' + attribute.value.inspect()); break;
case '~=':      conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
case '|=':      conditions.push(
splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
); break;
case '!=':      conditions.push(value + ' != ' + attribute.value.inspect()); break;
case '':
case undefined: conditions.push(value + ' != null'); break;
default:        throw 'Unknown operator ' + attribute.operator + ' in selector';
}
});
}
return conditions.join(' && ');
},
compileMatcher: function() {
this.match = new Function('element', 'if (!element.tagName) return false; \
return ' + this.buildMatchExpression());
},
findElements: function(scope) {
var element;
if (element = $(this.params.id))
if (this.match(element))
if (!scope || Element.childOf(element, scope))
return [element];
scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
var results = [];
for (var i = 0; i < scope.length; i++)
if (this.match(element = scope[i]))
results.push(Element.extend(element));
return results;
},
toString: function() {
return this.expression;
}
}
function $$() {
return $A(arguments).map(function(expression) {
return expression.strip().split(/\s+/).inject([null], function(results, expr) {
var selector = new Selector(expr);
return results.map(selector.findElements.bind(selector)).flatten();
});
}).flatten();
}
var Field = {
clear: function() {
for (var i = 0; i < arguments.length; i++)
$(arguments[i]).value = '';
},
focus: function(element) {
$(element).focus();
},
present: function() {
for (var i = 0; i < arguments.length; i++)
if ($(arguments[i]).value == '') return false;
return true;
},
select: function(element) {
$(element).select();
},
activate: function(element) {
element = $(element);
element.focus();
if (element.select)
element.select();
}
}
/*--------------------------------------------------------------------------*/
var Form = {
serialize: function(form) {
var elements = Form.getElements($(form));
var queryComponents = new Array();
for (var i = 0; i < elements.length; i++) {
var queryComponent = Form.Element.serialize(elements[i]);
if (queryComponent)
queryComponents.push(queryComponent);
}
return queryComponents.join('&');
},
getElements: function(form) {
form = $(form);
var elements = new Array();
for (var tagName in Form.Element.Serializers) {
var tagElements = form.getElementsByTagName(tagName);
for (var j = 0; j < tagElements.length; j++)
elements.push(tagElements[j]);
}
return elements;
},
getInputs: function(form, typeName, name) {
form = $(form);
var inputs = form.getElementsByTagName('input');
if (!typeName && !name)
return inputs;
var matchingInputs = new Array();
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
if ((typeName && input.type != typeName) ||
(name && input.name != name))
continue;
matchingInputs.push(input);
}
return matchingInputs;
},
disable: function(form) {
var elements = Form.getElements(form);
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
element.blur();
element.disabled = 'true';
}
},
enable: function(form) {
var elements = Form.getElements(form);
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
element.disabled = '';
}
},
findFirstElement: function(form) {
return Form.getElements(form).find(function(element) {
return element.type != 'hidden' && !element.disabled &&
['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
});
},
focusFirstElement: function(form) {
Field.activate(Form.findFirstElement(form));
},
reset: function(form) {
$(form).reset();
}
}
Form.Element = {
serialize: function(element) {
element = $(element);
var method = element.tagName.toLowerCase();
var parameter = Form.Element.Serializers[method](element);
if (parameter) {
var key = encodeURIComponent(parameter[0]);
if (key.length == 0) return;
if (parameter[1].constructor != Array)
parameter[1] = [parameter[1]];
return parameter[1].map(function(value) {
return key + '=' + encodeURIComponent(value);
}).join('&');
}
},
getValue: function(element) {
element = $(element);
var method = element.tagName.toLowerCase();
var parameter = Form.Element.Serializers[method](element);
if (parameter)
return parameter[1];
}
}
Form.Element.Serializers = {
input: function(element) {
switch (element.type.toLowerCase()) {
case 'submit':
case 'hidden':
case 'password':
case 'text':
return Form.Element.Serializers.textarea(element);
case 'checkbox':
case 'radio':
return Form.Element.Serializers.inputSelector(element);
}
return false;
},
inputSelector: function(element) {
if (element.checked)
return [element.name, element.value];
},
textarea: function(element) {
return [element.name, element.value];
},
select: function(element) {
return Form.Element.Serializers[element.type == 'select-one' ?
'selectOne' : 'selectMany'](element);
},
selectOne: function(element) {
var value = '', opt, index = element.selectedIndex;
if (index >= 0) {
opt = element.options[index];
value = opt.value || opt.text;
}
return [element.name, value];
},
selectMany: function(element) {
var value = [];
for (var i = 0; i < element.length; i++) {
var opt = element.options[i];
if (opt.selected)
value.push(opt.value || opt.text);
}
return [element.name, value];
}
}
/*--------------------------------------------------------------------------*/
var $F = Form.Element.getValue;
/*--------------------------------------------------------------------------*/
Abstract.TimedObserver = function() {}
Abstract.TimedObserver.prototype = {
initialize: function(element, frequency, callback) {
this.frequency = frequency;
this.element   = $(element);
this.callback  = callback;
this.lastValue = this.getValue();
this.registerCallback();
},
registerCallback: function() {
setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
},
onTimerEvent: function() {
var value = this.getValue();
if (this.lastValue != value) {
this.callback(this.element, value);
this.lastValue = value;
}
}
}
Form.Element.Observer = Class.create();
Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
getValue: function() {
return Form.Element.getValue(this.element);
}
});
Form.Observer = Class.create();
Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
getValue: function() {
return Form.serialize(this.element);
}
});
/*--------------------------------------------------------------------------*/
Abstract.EventObserver = function() {}
Abstract.EventObserver.prototype = {
initialize: function(element, callback) {
this.element  = $(element);
this.callback = callback;
this.lastValue = this.getValue();
if (this.element.tagName.toLowerCase() == 'form')
this.registerFormCallbacks();
else
this.registerCallback(this.element);
},
onElementEvent: function() {
var value = this.getValue();
if (this.lastValue != value) {
this.callback(this.element, value);
this.lastValue = value;
}
},
registerFormCallbacks: function() {
var elements = Form.getElements(this.element);
for (var i = 0; i < elements.length; i++)
this.registerCallback(elements[i]);
},
registerCallback: function(element) {
if (element.type) {
switch (element.type.toLowerCase()) {
case 'checkbox':
case 'radio':
Event.observe(element, 'click', this.onElementEvent.bind(this));
break;
case 'password':
case 'text':
case 'textarea':
case 'select-one':
case 'select-multiple':
Event.observe(element, 'change', this.onElementEvent.bind(this));
break;
}
}
}
}
Form.Element.EventObserver = Class.create();
Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
getValue: function() {
return Form.Element.getValue(this.element);
}
});
Form.EventObserver = Class.create();
Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
getValue: function() {
return Form.serialize(this.element);
}
});
if (!window.Event) {
var Event = new Object();
}
Object.extend(Event, {
KEY_BACKSPACE: 8,
KEY_TAB:       9,
KEY_RETURN:   13,
KEY_ESC:      27,
KEY_LEFT:     37,
KEY_UP:       38,
KEY_RIGHT:    39,
KEY_DOWN:     40,
KEY_DELETE:   46,
element: function(event) {
return event.target || event.srcElement;
},
isLeftClick: function(event) {
return (((event.which) && (event.which == 1)) ||
((event.button) && (event.button == 1)));
},
pointerX: function(event) {
return event.pageX || (event.clientX +
(document.documentElement.scrollLeft || document.body.scrollLeft));
},
pointerY: function(event) {
return event.pageY || (event.clientY +
(document.documentElement.scrollTop || document.body.scrollTop));
},
stop: function(event) {
if (event.preventDefault) {
event.preventDefault();
event.stopPropagation();
} else {
event.returnValue = false;
event.cancelBubble = true;
}
},
// find the first node with the given tagName, starting from the
// node the event was triggered on; traverses the DOM upwards
findElement: function(event, tagName) {
var element = Event.element(event);
while (element.parentNode && (!element.tagName ||
(element.tagName.toUpperCase() != tagName.toUpperCase())))
element = element.parentNode;
return element;
},
observers: false,
_observeAndCache: function(element, name, observer, useCapture) {
if (!this.observers) this.observers = [];
if (element.addEventListener) {
this.observers.push([element, name, observer, useCapture]);
element.addEventListener(name, observer, useCapture);
} else if (element.attachEvent) {
this.observers.push([element, name, observer, useCapture]);
element.attachEvent('on' + name, observer);
}
},
unloadCache: function() {
if (!Event.observers) return;
for (var i = 0; i < Event.observers.length; i++) {
Event.stopObserving.apply(this, Event.observers[i]);
Event.observers[i][0] = null;
}
Event.observers = false;
},
observe: function(element, name, observer, useCapture) {
var element = $(element);
useCapture = useCapture || false;
if (name == 'keypress' &&
(navigator.appVersion.match(/Konqueror|Safari|KHTML/)
|| element.attachEvent))
name = 'keydown';
this._observeAndCache(element, name, observer, useCapture);
},
stopObserving: function(element, name, observer, useCapture) {
var element = $(element);
useCapture = useCapture || false;
if (name == 'keypress' &&
(navigator.appVersion.match(/Konqueror|Safari|KHTML/)
|| element.detachEvent))
name = 'keydown';
if (element.removeEventListener) {
element.removeEventListener(name, observer, useCapture);
} else if (element.detachEvent) {
element.detachEvent('on' + name, observer);
}
}
});
/* prevent memory leaks in IE */
if (navigator.appVersion.match(/\bMSIE\b/))
Event.observe(window, 'unload', Event.unloadCache, false);
var Position = {
// set to true if needed, warning: firefox performance problems
// NOT neeeded for page scrolling, only if draggable contained in
// scrollable elements
includeScrollOffsets: false,
// must be called before calling withinIncludingScrolloffset, every time the
// page is scrolled
prepare: function() {
this.deltaX =  window.pageXOffset
|| document.documentElement.scrollLeft
|| document.body.scrollLeft
|| 0;
this.deltaY =  window.pageYOffset
|| document.documentElement.scrollTop
|| document.body.scrollTop
|| 0;
},
realOffset: function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.scrollTop  || 0;
valueL += element.scrollLeft || 0;
element = element.parentNode;
} while (element);
return [valueL, valueT];
},
cumulativeOffset: function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop  || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
} while (element);
return [valueL, valueT];
},
positionedOffset: function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop  || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
if (element) {
p = Element.getStyle(element, 'position');
if (p == 'relative' || p == 'absolute') break;
}
} while (element);
return [valueL, valueT];
},
offsetParent: function(element) {
if (element.offsetParent) return element.offsetParent;
if (element == document.body) return element;
while ((element = element.parentNode) && element != document.body)
if (Element.getStyle(element, 'position') != 'static')
return element;
return document.body;
},
// caches x/y coordinate pair to use with overlap
within: function(element, x, y) {
if (this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element, x, y);
this.xcomp = x;
this.ycomp = y;
this.offset = this.cumulativeOffset(element);
return (y >= this.offset[1] &&
y <  this.offset[1] + element.offsetHeight &&
x >= this.offset[0] &&
x <  this.offset[0] + element.offsetWidth);
},
withinIncludingScrolloffsets: function(element, x, y) {
var offsetcache = this.realOffset(element);
this.xcomp = x + offsetcache[0] - this.deltaX;
this.ycomp = y + offsetcache[1] - this.deltaY;
this.offset = this.cumulativeOffset(element);
return (this.ycomp >= this.offset[1] &&
this.ycomp <  this.offset[1] + element.offsetHeight &&
this.xcomp >= this.offset[0] &&
this.xcomp <  this.offset[0] + element.offsetWidth);
},
// within must be called directly before
overlap: function(mode, element) {
if (!mode) return 0;
if (mode == 'vertical')
return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
element.offsetHeight;
if (mode == 'horizontal')
return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
element.offsetWidth;
},
clone: function(source, target) {
source = $(source);
target = $(target);
target.style.position = 'absolute';
var offsets = this.cumulativeOffset(source);
target.style.top    = offsets[1] + 'px';
target.style.left   = offsets[0] + 'px';
target.style.width  = source.offsetWidth + 'px';
target.style.height = source.offsetHeight + 'px';
},
page: function(forElement) {
var valueT = 0, valueL = 0;
var element = forElement;
do {
valueT += element.offsetTop  || 0;
valueL += element.offsetLeft || 0;
// Safari fix
if (element.offsetParent==document.body)
if (Element.getStyle(element,'position')=='absolute') break;
} while (element = element.offsetParent);
element = forElement;
do {
valueT -= element.scrollTop  || 0;
valueL -= element.scrollLeft || 0;
} while (element = element.parentNode);
return [valueL, valueT];
},
clone: function(source, target) {
var options = Object.extend({
setLeft:    true,
setTop:     true,
setWidth:   true,
setHeight:  true,
offsetTop:  0,
offsetLeft: 0
}, arguments[2] || {})
// find page position of source
source = $(source);
var p = Position.page(source);
// find coordinate system to use
target = $(target);
var delta = [0, 0];
var parent = null;
// delta [0,0] will do fine with position: fixed elements,
// position:absolute needs offsetParent deltas
if (Element.getStyle(target,'position') == 'absolute') {
parent = Position.offsetParent(target);
delta = Position.page(parent);
}
// correct by body offsets (fixes Safari)
if (parent == document.body) {
delta[0] -= document.body.offsetLeft;
delta[1] -= document.body.offsetTop;
}
// set position
if(options.setLeft)   target.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
if(options.setTop)    target.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
if(options.setWidth)  target.style.width = source.offsetWidth + 'px';
if(options.setHeight) target.style.height = source.offsetHeight + 'px';
},
absolutize: function(element) {
element = $(element);
if (element.style.position == 'absolute') return;
Position.prepare();
var offsets = Position.positionedOffset(element);
var top     = offsets[1];
var left    = offsets[0];
var width   = element.clientWidth;
var height  = element.clientHeight;
element._originalLeft   = left - parseFloat(element.style.left  || 0);
element._originalTop    = top  - parseFloat(element.style.top || 0);
element._originalWidth  = element.style.width;
element._originalHeight = element.style.height;
element.style.position = 'absolute';
element.style.top    = top + 'px';;
element.style.left   = left + 'px';;
element.style.width  = width + 'px';;
element.style.height = height + 'px';;
},
relativize: function(element) {
element = $(element);
if (element.style.position == 'relative') return;
Position.prepare();
element.style.position = 'relative';
var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
element.style.top    = top + 'px';
element.style.left   = left + 'px';
element.style.height = element._originalHeight;
element.style.width  = element._originalWidth;
}
}
// Safari returns margins on body which is incorrect if the child is absolutely
// positioned.  For performance reasons, redefine Position.cumulativeOffset for
// KHTML/WebKit only.
if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
Position.cumulativeOffset = function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop  || 0;
valueL += element.offsetLeft || 0;
if (element.offsetParent == document.body)
if (Element.getStyle(element, 'position') == 'absolute') break;
element = element.offsetParent;
} while (element);
return [valueL, valueT];
}
}
Object.extend(Event, {
_domReady : function() {
if (arguments.callee.done) return;
arguments.callee.done = true;
if (this._timer)  clearInterval(this._timer);
this._readyCallbacks.each(function(f) { f() });
this._readyCallbacks = null;
},
onDOMReady : function(f) {
if (!this._readyCallbacks) {
var domReady = this._domReady.bind(this);
if (document.addEventListener)
document.addEventListener("DOMContentLoaded", domReady, false);
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
document.getElementById("__ie_onload").onreadystatechange = function() {
if (this.readyState == "complete") domReady(); 
};
/*@end @*/
if (/WebKit/i.test(navigator.userAgent)) { 
this._timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) domReady(); 
}, 10);
}
Event.observe(window, 'load', domReady);
Event._readyCallbacks =  [];
}
Event._readyCallbacks.push(f);
}
});
// Below is a faster version of $$(), compressed for size.
var SelectorLiteAddon=Class.create();SelectorLiteAddon.prototype={initialize:function(stack){this.r=[];this.s=[];this.i=0;for(var i=stack.length-1;i>=0;i--){var s=["*","",[]];var t=stack[i];var cursor=t.length-1;do{var d=t.lastIndexOf("#");var p=t.lastIndexOf(".");cursor=Math.max(d,p);if(cursor==-1){s[0]=t.toUpperCase();}else if(d==-1||p==cursor){s[2].push(t.substring(p+1));}else if(!s[1]){s[1]=t.substring(d+1);}
t=t.substring(0,cursor);}while(cursor>0);this.s[i]=s;}
},get:function(root){this.explore(root||document,this.i==(this.s.length-1));return this.r;},explore:function(elt,leaf){var s=this.s[this.i];var r=[];if(s[1]){e=$(s[1]);if(e&&(s[0]=="*"||e.tagName==s[0])&&e.childOf(elt)){r=[e];}
}else{r=$A(elt.getElementsByTagName(s[0]));}
if(s[2].length==1){r=r.findAll(function(o){if(o.className.indexOf(" ")==-1){return o.className==s[2][0];}else{return o.className.split(/\s+/).include(s[2][0]);}
});}else if(s[2].length>0){r=r.findAll(function(o){if(o.className.indexOf(" ")==-1){return false;}else{var q=o.className.split(/\s+/);return s[2].all(function(c){return q.include(c);});}
});}
if(leaf){this.r=this.r.concat(r);}else{++this.i;r.each(function(o){this.explore(o,this.i==(this.s.length-1));}.bind(this));}
}
}
var $$old=$$;var $$=function(a,b){if(b||a.indexOf("[")>=0)return $$old.apply(this,arguments);return new SelectorLiteAddon(a.split(/\s+/)).get();}
EducationSelect = Class.create();
EducationSelect.prototype = {
is_element: function(p_obj,p_item) { for(var i=0;i<p_obj.length;i++) if(p_obj[i] == p_item) return true; return false; },
initialize: function(p_index)
{
this.this_index = p_index;
this.selected_type = null;
this.selected_area = null;
this.selected_degree = null;
this.areas_of_study = { 
business:{name:"Business",degrees:['business_admin','human_resources','visual_communication','leadership','accounting','management','marketing','operations','operations_management','org_psych','projects','international']},
justice:{name:"Justice",degrees:['criminal_justice']},
healthcare:{name:"Healthcare",degrees:['healthcare_admin','healthcare_management']},
education:{name:"Education",degrees:['curriculum','instruction','assessment','leadership']},
technology:{name:"Technology",degrees:['computer_systems','information_technology','network_admin','programming']}
};
this.degree_type={a:"Associate",b:"Bachelor's",m:"Master's"};
this.degrees = { 
healthcare_admin: {type: ['a'], name: "Healthcare Administraion"},
healthcare_management: {type: ['b','m'], name: "Healthcare Management"},
business_admin: {type: ['a'], name: "Business Administration"},
human_resources: {type: ['a','b','m'], name: "Human Resources"},
visual_communication: {type: ['a','b'], name: "Visual Communication"},
accounting: {type: ['b','m'], name: "Accounting and Finance"},
management: {type: ['b','m'], name: "Management"},
marketing: {type: ['b','m'], name: "Marketing"},
operations: {type: ['b'], name: "Operations"},
operations_management: {type: ['m'], name: "Operations Management"},
org_psych: {type: ['b','m'], name: "Organizational Psychology"},
projects: {type: ['b','m'], name: "Project Management"},
international: {type: ['b','m'], name: "International Business"},
computer_systems: {type: ['b'], name: "Computer Systems"},
information_technology: {type: ['b','m'], name: "Information Technology"},
network_admin: {type: ['b'], name: "Network Administration"},
programming: {type: ['b'], name: "Programming"},
criminal_justice: {type: ['b'], name: "Criminal Justice"},
curriculum: {type: ['m'], name: "Curriculum and Instruction"},
instruction: {type: ['m'], name: "Instructional Technology"},
assessment: {type: ['m'], name: "Educational Assessment and Evaluation"},
leadership: {type: ['m'], name: "Leadership in Educational Organizations"}
};
this.schools = {
asu: "Arizona State University",
nau: "Northern Arizona Univerity",
uoa: "University of Arizona",
mit: "Massachusettes Institute of Technology",
cu: "Colorado University",
mcc: "Mesa Community College",
gcc: "Gilbert Community College"
};
this.school_programs = {
asu:['a_business_admin','a_healthcare_admin','a_human_resources','a_visual_communication','b_accounting'],
nau:['b_healthcare_management','b_human_resources','b_management','b_marketing','b_operations'],
uoa:['b_org_psych','b_projects','b_international','b_visual_communications','b_computer_systems'],
mit:['b_information_technology','b_network_admin','b_programming','b_criminal_justice','m_curriculum'],
cu:['m_instruction','m_assessment','m_leadership','m_information','m_accounting'],
mcc:['m_healthcare','m_human_resources','m_management','m_marketing','m_operations'],
gcc:['m_org_psych','m_projects','m_international']
};
},
find_degree_area: function(){var frm_study = document.getElementById(this.this_index + '_degree_area_d');frm_study.options.length = 0;frm_study.options[0] =  new Option("Choose One","");var j = 1;$H(this.areas_of_study).each( function (pair) {frm_study.options[j++] = new Option(pair.value['name'], pair.key);}.bind(this));},
find_degree_type: function(){var frm_type = document.getElementById(this.this_index + '_degree_type_d');frm_type.options.length = 0;frm_type.options[0] =  new Option("Choose One","");var j = 1;$H(this.degree_type).each( function (pair) {frm_type.options[j++] = new Option(pair.value, pair.key);}.bind(this));},
find_degree_program: function(p_area,p_type){if(p_area != null) this.selected_area = p_area;if(p_type != null) this.selected_type = p_type;var frm_degree = document.getElementById(this.this_index + '_degree_section_d');frm_degree.options.length=0;frm_degree.options[0] =  new Option("Choose One","");if(typeof(this.areas_of_study[this.selected_area]) == 'undefined')return;var area_degrees = this.areas_of_study[this.selected_area]['degrees'];var k = 1;for(var j=0;j<area_degrees.length;j++){if(typeof(this.degrees[area_degrees[j]]) !='undefined'){if(this.is_element(this.degrees[area_degrees[j]]['type'],this.selected_type)){frm_degree.options[k] =  new Option(this.degrees[area_degrees[j]]['name'],area_degrees[j]);k++;}}}},
find_degree_school: function(p_degree){if(p_degree != null) this.selected_degree = p_degree;var frm_school = document.getElementById(this.this_index + '_degree_school_d');frm_school.options.length=0;frm_school.options[0] =  new Option("Choose One","");var this_degree = this.selected_type + "_" + this.selected_degree;var j=1;$H(this.school_programs).each( function (pair) {if(this.is_element(pair.value,this_degree)){frm_school.options[j++] = new Option(this.schools[pair.key], pair.key);}}.bind(this));}
};
/**/
function getCookie(name){cname = name + "=";dc = document.cookie;if (dc.length > 0) {begin = dc.indexOf(cname);if (begin != -1) {begin += cname.length;end = dc.indexOf(";", begin);if (end == -1) end = dc.length;return unescape(dc.substring(begin, end));}}return null;}
function setCookie(name, value, expires, path, domain, secure) {document.cookie = name + "=" + escape(value) +((expires == null) ? "" : "; expires=" + expires.toGMTString()) +((path == null) ? "" : "; path=" + path) +((domain == null) ? "" : "; domain=" + domain) +((secure == null) ? "" : "; secure");}
function delCookie(name,path,domain) {if (getCookie(name)) {document.cookie = name + "=" +((path == null) ? "" : "; path=" + path) +((domain == null) ? "" : "; domain=" + domain) +"; expires=Thu, 01-Jan-70 00:00:01 GMT";}}
/**/
function missingField(form, fields) {form = $(form);missing = null;fields.each(function (elem) {$elem = $(elem);if (!$elem || !$elem.value) {missing = elem;throw $break;}});return missing;}
function filter(field, regex) {if (! field.value) return true;re = new RegExp(regex);if (re.test(field.value)) return true;alert("Invalid entry!");field.value = "";field.focus();field.select();return false;}
function noPress(keyCodes) {if(typeof(keyCodes) == "number") return true; keyList = keyCodes.split(",");for (i = 0; i < keyList.length; i++) {if (window.event.keyCode == keyList[i]) return false;}return true;}
function checkABA(field) {var value = $F(field);if (value == '') return true;if (value.length != 9) {field.value = '';return false;}n = 0;for (i = 0; i < value.length; i += 3) {n += parseInt(value.substr(i + 0, 1)) * 3;n += parseInt(value.substr(i + 1, 1)) * 7;n += parseInt(value.substr(i + 2, 1)) * 1;}if (n == 0 || n % 10) {field.value = '';return false;}return true;}
function checkZipCode(zip, state) {if ($w('ab bc mb nb nl nt ns nu on pe qc sk yt').include(state)) {if (zip.match(/^[0-9a-z]{6}$/i)) return true;alert('The postal code you entered is not valid. Please don\'t enter any spaces or dashes.');return false;}if (zip.match(/^[0-9]{5}$/i)) return true;alert('The zip code you entered is not valid. Please enter only the 5-digit zip code.');return false;}
function checkIncome(income, payday) {limit = 99999;if (payday == 'primary') { limit = 9999; }if (income > limit) {alert('Please enter your monthly income, not your annual income');return false;}return true;}
function checkEmployed(unused,employed) {if (employed) { return true; }alert('You must be employed for at least 1 month.');return false;}
function numJoin(field) {target = field.name.substr(1);value = '';for (i = 0; i < field.form.elements.length; i++) {elem = field.form.elements[i];if (elem.name == 'x' + target) value = '' + value + '' + elem.value;if (elem.name == 'm' + target) value =	1 * value +  1 * elem.value;if (elem.name == 'y' + target) value =	1 * value + 12 * elem.value;}elem = field.form.elements[target];if (elem) { elem.value = value; }}
function numSplit(field) {start = 0;elems = Form.getElements(field.form);for (i = 0; i < elems.length; i++) {elem = elems[i];if (elem.name == 'x' + field.name) {elem.value = field.value.substr(start, elem.size);start = start*1 + elem.size*1;} else if (elem.name == 'm' + field.name) {elem.value = field.value % 12;} else if (elem.name == 'y' + field.name) {elem.value = Math.floor(field.value / 12);}}}
function checkLTV() {property_value	= $('property_value_d');mortgage_balance = $('mortgage_balance_d');additional_cash 	= $('additional_cash_d');pv = parseInt($F(property_value));mb = parseInt($F(mortgage_balance));ac = parseInt($F(additional_cash));if (pv == 0) {alert('You must specify the estimated value of your property.');property_value.value = '';} else if (ac && !mb) {alert('You must specify the balance of your mortgage.');additional_cash.value = '';} else if (mb && !ac) {req = Math.floor(pv * .85 - mb);additional_cash.value = req > 0 ? req : 0;} else {ltv = (mb + ac) / pv;if (ltv > 1) {alert('You cannot request more money than the value of your home. Please lower the additional cash you would like to receive.');additional_cash.value = '';} else if (ltv > .85) {property_value.value = Math.floor(pv * 1.1);}}}
/**/
document.write("<div id=\"calendar\" style=\"z-index: 100000; position: absolute; display: none; width: 200px; background-color: white;\"></div>");
document.write("<style> td.cal { border-top: 1px solid black; border-left: 1px solid black; font-size: xx-small; } table.cal { border-right: 1px solid black; border-bottom: 1px solid black; } </style>\n");
var dateField = new Object();
var dateField2 = null;
var date_pp = null;
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var days = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
var year = month = day = 0;
function zeroPad(num, pad){tgt = "" + num;while(tgt.length < pad){tgt = "0" + tgt;}return tgt;}
function findPosX(obj) {var curleft = 0;if (obj.offsetParent) {while (obj.offsetParent) {curleft += obj.offsetLeft; obj = obj.offsetParent;}} else if (obj.x)curleft += obj.x;return curleft;}
function findPosY(obj) {curtop = 0;if (obj.offsetParent) {while (obj.offsetParent) {curtop += obj.offsetTop;obj = obj.offsetParent;}} else if (obj.y)curtop += obj.y;return curtop;}
function calOpen(field, fmt,field_2,pp) 
{
dateField = field;
dateField2 = null;
if(field_2 != null){dateField2 = $(field.id.replace(field.name,field_2));date_pp = field.id.replace(field.name,pp);date_pp = $(date_pp.replace("_d","_h"));}
if(typeof(dateField2) == "undefined" || typeof(date_pp) == "undefined") dateField2 = null;
theCal = document.getElementById('calendar');
theCal.style.top = findPosY(dateField);
theCal.style.left = findPosX(dateField) + 100;
theCal.style.display = 'block';
year = month = day = 0;
calInit(fmt);
}
function calHoliday(value)
{
var date 	= value.split("/");
if(date == value)
date 	= value.split("-");
var month 	= parseInt(date[0], 10);
var day 	= parseInt(date[1], 10);
var year 	= parseInt(date[2], 10);
switch(month)
{
case 1: if(day == 1 || day == 16) return true;	break;
case 2:	if(day == 20) return true;	break;
case 3:
case 4:
case 5:
case 6:	break;
case 7:	if(day == 4) return true;	break;
case 8:
case 9:
case 10: break;
case 11: if(day == 11 || day == 23) return true; break;
case 12: if(day == 25) return true; break;
}
return false;
}
function calInit(fmt) {
if (!year && !month && !day) {
if (dateField.value) {
value 	= dateField.value;
date 	= value.split("/");
if(date == value)
date 	= value.split("-");
month 	= parseInt(date[0], 10) - 1;
day 	= parseInt(date[1], 10);
year 	= parseInt(date[2], 10);
}
if (isNaN(day) || isNaN(month) || isNaN(year) || day == 0) {
dt 	= new Date();
day 	= dt.getDate();
month	= dt.getMonth();
year 	= dt.getFullYear();
}
} else {
if (month > 11) {
month = 0;
year++;
} else if (month < 0) {
month = 11;
year--;
}
}
this_dt 	= new Date();
this_day 	= this_dt.getDate();
this_month	= this_dt.getMonth();
this_year 	= this_dt.getFullYear();
str = "";
str += "<table class=cal cellspacing=0 width=100%>";
str += "<tr><td class=cal align=center width=50%>";
str += " <a name='' onMouseOver=\"this.style.cursor='pointer'\" onMouseOut=\"this.style.cursor='default'\" onClick=\"javascript:month--; calInit('" + fmt + "');\">&laquo;</a> ";
str += months[month];
str += " <a name='' onMouseOver=\"this.style.cursor='pointer'\" onMouseOut=\"this.style.cursor='default'\" onClick=\"javascript:month++; calInit('" + fmt + "');\">&raquo;</a> ";
str += "</td><td class=cal align=center width=50%>\n";
str += " <a name='' onMouseOver=\"this.style.cursor='pointer'\" onMouseOut=\"this.style.cursor='default'\" onClick=\"javascript:year--; calInit('" + fmt + "');\">&laquo;</a> ";
str += year;
str += " <a name='' onMouseOver=\"this.style.cursor='pointer'\" onMouseOut=\"this.style.cursor='default'\" onClick=\"javascript:year++; calInit('" + fmt + "');\">&raquo;</a> ";
str += "</td></tr>";
str += "</table>";
str += "<table class=cal cellspacing=0 width=100% style=\"border-top: 0px;\">";
str += "<tr>";
for (var i = 0; i < 7; i++) {
str += "<td class=cal align=center width=14%>" + days[i] + "</th>";
}
str += "</tr>";
firstDay = new Date(year, month, 1).getDay();
lastDay = new Date(year, month + 1, 0).getDate();
weekDay = 0;
str += "<tr>";
for (i = 0; i < firstDay; i++) {
str += "<td class=cal style=\"background-color: LightSlateGray;\">&nbsp;</td>";
weekDay++;
}
for (i = 1; i <= lastDay; i++) {
if (weekDay == 7) {
str += "</tr><tr>";
weekDay = 0;
}
if (i == day && month == this_month && year == this_year) {
str += "<td class=cal style=\"background-color: silver;\">";
} else {
str += "<td class=cal>";
}
val = fmt.replace(/yyyy/i, zeroPad(year, 4));
val = val.replace(/mm/i, zeroPad(month + 1, 2));
val = val.replace(/dd/i, zeroPad(i, 2));
if(weekDay != 0 && weekDay != 6 && !calHoliday(val) && (i + month * 100 + year * 10000 >= this_day + 1 + this_month * 100 + this_year * 10000))
str += "<a name='' onMouseOver=\"this.style.cursor='pointer'\" onMouseOut=\"this.style.cursor='default'\" onClick=\"javascript:calReturn('" + val + "');\"><font color='#0000FF'><u>" + i + "</font></u></a>";
else
str += "" + i + "";
str += "</td>";
weekDay++;
}
for (i = weekDay; i < 7; i++) {
str += "<td class=cal style=\"background-color: LightSlateGray;\">&nbsp;</td>";
}
str += "</tr></table>";
val = fmt.replace(/yyyy/i, '0000').replace(/mm/i, '00').replace(/dd/i, '00');
str += "<table class=cal cellspacing=0 width=100%>";
str += "<tr><td class=cal align=center width=50%>";
str += " <a name='' onMouseOver=\"this.style.cursor='pointer'\" onMouseOut=\"this.style.cursor='default'\" onClick=\"javascript:calReturn('');\">Close</a> ";
str += "</td></tr>";
str += "</table>";
document.getElementById('calendar').innerHTML = str;
}
function calReturn(val) {if (val) { dateField.value = val; if(dateField2) calcPayDate2(dateField2,dateField.value,date_pp.value); }document.getElementById('calendar').style.display = 'none';}
var do_autotab_onload = false;
var autotab = {uid: null, i: 0, elems: [],next_element: function() { return this.elems[this.i]; }};
function autoTab(event) {elem = Event.element(event);if (!elem || elem.size < 1) { return; }if (!filter(elem, '^([0-9]*|dd|mm|yyyy)$')) { return false; }
if (autotab.uid != elem.id) {autotab.uid   = elem.id;autotab.i     = autotab.elems.indexOf(elem) + 1;while ((autotab.elems[autotab.i].type == 'hidden') || (autotab.elems[autotab.i].type == 'button')) { autotab.i++; }}
if (![9,16].include(event.keyCode) && elem.value.length >= elem.size) {Field.activate(autotab.next_element());elem.value = elem.value.substr(0, elem.size);}numJoin(elem);}
function $w(string) {string = string.strip();return $A(string ? string.split(/\s+/) : []);};
/**/
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
var hexcase = 0; 
var b64pad  = "";
var chrsz   = 8;
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
function md5_vm_test() { return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; }
function core_md5(x, len) { x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len;var a =  1732584193;var b = -271733879;var c = -1732584194;var d =  271733878;for(var i = 0; i < x.length; i += 16){var olda = a;var oldb = b;var oldc = c;var oldd = d;a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);c = md5_ff(c, d, a, b, x[i+10], 17, -42063);b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);a = safe_add(a, olda);b = safe_add(b, oldb);c = safe_add(c, oldc);d = safe_add(d, oldd);}return Array(a, b, c, d);}
function md5_cmn(q, a, b, x, s, t){return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);}
function md5_ff(a, b, c, d, x, s, t){return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);}
function md5_gg(a, b, c, d, x, s, t){return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);}
function md5_hh(a, b, c, d, x, s, t){return md5_cmn(b ^ c ^ d, a, b, x, s, t);}
function md5_ii(a, b, c, d, x, s, t){return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);}
function core_hmac_md5(key, data){var bkey = str2binl(key);if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);var ipad = Array(16), opad = Array(16);for(var i = 0; i < 16; i++){ipad[i] = bkey[i] ^ 0x36363636;opad[i] = bkey[i] ^ 0x5C5C5C5C;}var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);return core_md5(opad.concat(hash), 512 + 128);}
function safe_add(x, y){var lsw = (x & 0xFFFF) + (y & 0xFFFF);var msw = (x >> 16) + (y >> 16) + (lsw >> 16);return (msw << 16) | (lsw & 0xFFFF);}
function bit_rol(num, cnt){return (num << cnt) | (num >>> (32 - cnt));}
function str2binl(str){var bin = Array();var mask = (1 << chrsz) - 1;for(var i = 0; i < str.length * chrsz; i += chrsz)bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);return bin;}
function binl2str(bin){var str = "";var mask = (1 << chrsz) - 1;for(var i = 0; i < bin.length * 32; i += chrsz)str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);return str;}
function binl2hex(binarray){var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";var str = "";for(var i = 0; i < binarray.length * 4; i++){str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);}return str;}
function binl2b64(binarray){var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str = "";for(var i = 0; i < binarray.length * 4; i += 3){var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)| (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )|  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);for(var j = 0; j < 4; j++){if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);}}return str;}
/**/
var generated_types = { 2: 'Auto Financing',
9: 'Car Insurance',
10: 'Credit Card',
5: 'Credit Repair',
3: 'Debt Consolidation',
8: 'Health Insurance',
14: 'Home Based Business',
7: 'Home Insurance',
4: 'Home Purchase',
11: 'Homeowner',
15: 'Life Insurance',
13: 'Online Degree',
1: 'Payday',
6: 'Personal Injury',
12: 'Student Loans Consolidation'
};
var posturl = 'https://www.leadpile.com/cgi-bin/manage_leads/shared/postlead.pl';
var fields_per_type = { 2: 'state_selection,working_in_us,monthly_income,first_name,last_name,address,city,postal_code,email,home_phone,housing,best_time_to_call,months_at_residence,income_type,occupation,employer,supervisor_name,supervisor_phone,work_phone,months_employed,birth_date,social_security_number,credit_check,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
9: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
10: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
5: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
3: 'state_selection,unsecured_debt,first_name,last_name,address,city,postal_code,email,home_phone,housing,creditors,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
8: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
11: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,credit,property_type,property_value,mortgage_balance,additional_cash,second_mortgage,interest_rate,monthly_obligations,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
14: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
7: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
4: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,auto_financing_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
15: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
13: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,level_of_education,degree_program,active_military,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
1: 'state_selection,working_in_us,monthly_income,has_bank_account,pay_period,next_pay_date,second_pay_date,first_name,last_name,address,city,postal_code,email,home_phone,housing,requested_loan_amount,best_time_to_call,months_at_residence,income_type,occupation,employer,supervisor_name,supervisor_phone,work_phone,months_employed,bank_name,account_number,routing_number,bank_phone,direct_deposit,driving_license_state,driving_license_number,mother_maiden_name,birth_date,social_security_number,reference_1_first_name,reference_1_last_name,reference_1_relationship,reference_1_phone,reference_2_first_name,reference_2_last_name,reference_2_relationship,reference_2_phone,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
6: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,case_description,auto_financing_bonus,home_purchase_bonus,mortgage_lead_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
12: 'state_selection,first_name,last_name,address,city,postal_code,email,home_phone,housing,birth_date,social_security_number,student_loan_type,student_loan_count,student_loan_default,student_loan_already_consolidated,student_loan_debt,graduated,auto_financing_bonus,title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus,sms_agree,sms_phone,captcha',
0:''
};
var masks_per_type = { 2: ',,,X,X,X,X,X,X,X,X,,,,X,X,X,X,X,X,X,X,,X,X,X,O,X,X,X,X,X,X',
9: ',X,X,X,X,X,X,X,X,,X,X,X,O,X,X,X,X,X,X',
10: ',X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X',
5: ',X,X,X,X,X,X,X,X,,X,X,X,X,X,X,X,X,X',
3: ',,X,X,X,X,X,X,X,X,,,X,X,X,X,X,X,X,X,X,X',
8: ',X,X,X,X,X,X,X,X,,X,X,X,X,X,X,X,X,X,X',
11: ',X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X',
14: ',X,X,X,X,X,X,X,X,X,X,X,X,X,O,X,X,X,X,X,X,X,X,O,X,X,X,X,X,X,X,X,O,X,X,X,X,X',
7: ',X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X',
4: ',X,X,X,X,X,X,X,,X,X,X,X,X,X,X,X',
15: ',X,X,X,X,X,X,X,X,,X,X,X,X,O,X,X,X,X,X',
13: ',X,X,X,X,X,X,X,X,X,X,,,X,X,X,X,X,X,X,X,X,X',
1: ',,,,,X,X,X,X,X,X,X,X,X,X,,,,,X,X,X,X,X,X,X,X,X,X,,X,X,X,X,X,X,X,X,X,X,X,X,X,,X,X,X,X,X,X,X,X,X,X',
6: ',X,X,X,X,X,X,X,X,,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X',
12: ',X,X,X,X,X,X,X,X,X,X,X,X,X,X,,,,X,X,X,X,X,X,X,X',
0:''
};
var fields_per_mask = {sms_agree: 'sms_agree,sms_phone',
title_bonus: 'title_bonus,car_insurance_bonus,life_insurance_bonus,student_loan_consolidation_bonus,home_based_business_bonus,credit_repair_bonus',
reference_1_first_name: 'reference_1_first_name,reference_1_last_name,reference_1_relationship,reference_1_phone',
best_time_to_call: 'best_time_to_call',
case_description: 'case_description',
student_loan_type: 'student_loan_type,student_loan_count,student_loan_default,student_loan_already_consolidated',
next_pay_date: 'next_pay_date,second_pay_date',
income_type: 'income_type',
pay_period: 'pay_period',
direct_deposit: 'direct_deposit',
creditors: 'creditors',
student_loan_debt: 'student_loan_debt',
requested_loan_amount: 'requested_loan_amount',
home_purchase_bonus: 'home_purchase_bonus,mortgage_lead_bonus',
monthly_income: 'monthly_income',
occupation: 'occupation,employer,supervisor_name,supervisor_phone,work_phone,months_employed',
active_military: 'active_military',
working_in_us: 'working_in_us',
degree_area: 'degree_area',
state_selection: 'state_selection',
auto_financing_bonus: 'auto_financing_bonus',
months_at_residence: 'months_at_residence',
degree_type: 'degree_type',
bank_name: 'bank_name,account_number,routing_number,bank_phone',
degree_school: 'degree_school',
reference_3_first_name: 'reference_3_first_name,reference_3_last_name,reference_3_relationship,reference_3_phone',
level_of_education: 'level_of_education,degree_program',
has_bank_account: 'has_bank_account',
unsecured_debt: 'unsecured_debt',
reference_2_first_name: 'reference_2_first_name,reference_2_last_name,reference_2_relationship,reference_2_phone',
credit: 'credit,property_type,property_value,mortgage_balance,additional_cash,second_mortgage,interest_rate,monthly_obligations',
graduated: 'graduated',
birth_date: 'birth_date,social_security_number',
degree_section: 'degree_section',
credit_check: 'credit_check',
driving_license_state: 'driving_license_state,driving_license_number,mother_maiden_name',
first_name: 'first_name,last_name,address,city,postal_code,email,home_phone,housing',
0: ''};
function formFieldObj(){
this.state_selection = '<div id="state_selection_p"><label for="state_selection_d">Select your residence state</label><br><select id="state_selection_d" name="state_selection" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">State/Province</option><option class="head" value="null">----------</option><option value="al">Alabama</option><option value="ak">Alaska</option><option value="az">Arizona</option><option value="ar">Arkansas</option><option value="ca">California</option><option value="co">Colorado</option><option value="ct">Connecticut</option><option value="de">Delaware</option><option value="dc">District of Columbia</option><option value="fl">Florida</option><option value="ga">Georgia</option><option value="hi">Hawaii</option><option value="id">Idaho</option><option value="il">Illinois</option><option value="in">Indiana</option><option value="ia">Iowa</option><option value="ks">Kansas</option><option value="ky">Kentucky</option><option value="la">Louisianna</option><option value="me">Maine</option><option value="md">Maryland</option><option value="ma">Massachusetts</option><option value="mi">Michigan</option><option value="mn">Minnesota</option><option value="ms">Mississippi</option><option value="mo">Missouri</option><option value="mt">Montana</option><option value="ne">Nebraska</option><option value="nv">Nevada</option><option value="nh">New Hampshire</option><option value="nj">New Jersey</option><option value="nm">New Mexico</option><option value="ny">New York</option><option value="nc">North Carolina</option><option value="nd">North Dakota</option><option value="oh">Ohio</option><option value="ok">Oklahoma</option><option value="or">Oregon</option><option value="pa">Pennsylvania</option><option value="ri">Rhode Island</option><option value="sc">South Carolina</option><option value="sd">South Dakota</option><option value="tn">Tennessee</option><option value="tx">Texas</option><option value="ut">Utah</option><option value="vt">Vermont</option><option value="va">Virginia</option><option value="wa">Washington</option><option value="wv">West Virginia</option><option value="wi">Wisconsin</option><option value="wy">Wyoming</option><option value="ab">Alberta</option><option value="bc">British Columbia</option><option value="mb">Manitoba</option><option value="nb">New Brunswick</option><option value="nl">Newfoundland</option><option value="nt">Northwest Territories</option><option value="ns">Nova Scotia</option><option value="nu">Nunavut</option><option value="on">Ontario</option><option value="pe">Prince Edward Island</option><option value="qc">Quebec</option><option value="sk">Saskatchewan</option><option value="yt">Yukon Territory</option></select><br></div>';
this.working_in_us = '<div id="working_in_us_p"><label for="working_in_us_d">Are you living and working in the US?</label><br><select id="working_in_us_d" name="working_in_us" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="yes">Yes</option><option value="no">No</option></select></div>';
this.monthly_income = '<div id="monthly_income_p"><label for="monthly_income_d">Your <b><u>monthly</u></b> income</label><br><input type="text" class="text" id="monthly_income_d" name="monthly_income" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.has_bank_account = '<div id="has_bank_account_p"><label for="has_bank_account_d">Do you have a bank account?</label><br><select id="has_bank_account_d" name="has_bank_account" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="checking" title="I have a checking account">I have a checking account</option><option value="savings" title="I only have a savings account">I only have a savings account</option><option value="no" title="I do not have a bank account">I do not have a bank account</option></select></div>';
this.pay_period = '<div id="pay_period_p"><label for="pay_period_d">What is your pay cycle</label><br><select id="pay_period_d" name="pay_period" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="weekly">Weekly</option><option value="bi-weekly">Every other week</option><option value="twice_monthly">Twice a month</option><option value="monthly">Monthly</option></select></div>';
this.next_pay_date = '<div id="next_pay_date_p"><label for="next_pay_date_d">When are your next 2 pay dates</label><br><input type="text" class="text" id="next_pay_date_d" name="next_pay_date" readonly="readonly" onClick="calOpen(this, \'mm-dd-yyyy\',\'second_pay_date\',\'pay_period\');" /></div>';
this.next_pay_date += '<div id="second_pay_date_p"><label for="second_pay_date_d"></label><br><input type="text" class="text" id="second_pay_date_d" name="second_pay_date" readonly="readonly" onClick="calOpen(this, \'mm-dd-yyyy\');" /></div>';
this.unsecured_debt = '<div id="unsecured_debt_p"><label for="unsecured_debt_d">Approximate your total unsecured debt (credit card, medical bills, utility bills, unsecured loans, etc.)</label><br><select id="unsecured_debt_d" name="unsecured_debt" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="20000">Over $20,000</option><option value="15000">$15,000 - $20,000</option><option value="10000">$10,000 - $15,000</option><option value="5000">$5,000 - $10,000</option><option value="1000">$1,000 - $5,000</option><option value="0">Up to $1,000</option></select></div>';
this.first_name = '<div id="first_name_p"><label for="first_name_d">First Name</label><br><input type="text" class="text" id="first_name_d" name="first_name" /></div>';
this.first_name += '<div id="last_name_p"><label for="last_name_d">Last Name</label><br><input type="text" class="text" id="last_name_d" name="last_name" /></div>';
this.first_name += '<div id="address_p"><label for="address_d">Address</label><br><input type="text" class="text" id="address_d" name="address" /></div>';
this.first_name += '<div id="city_p"><label for="city_d">City</label><br><input type="text" class="text" id="city_d" name="city" /></div>';
this.first_name += '<div id="postal_code_p"><label for="postal_code_d">Zip</label><br><input type="text" class="text" id="postal_code_d" name="postal_code" /></div>';
this.first_name += '<div id="email_p"><label for="email_d">Email</label><br><input type="text" class="text" id="email_d" name="email" onBlur="return filter(this, \'^[a-zA-Z0-9_.-]+@[a-zA-Z0-9_.-]+\\\\.[a-zA-Z]+$\');" /></div>';
this.first_name += '<div id="home_phone_p"><label for="home_phone_d">Home phone</label><br><input type="hidden" id="home_phone_d" name="home_phone" /><input type="text" class="textPart autotab" id="home_phone_part1" name="xhome_phone" size="3" /> - <input type="text" class="textPart autotab" id="home_phone_part2" name="xhome_phone" size="3" /> - <input type="text" class="textPart autotab" id="home_phone_part3" name="xhome_phone" size="4" /></div>';
this.first_name += '<div id="housing_p"><label for="housing_d">Do you own or rent a home</label><br><select id="housing_d" name="housing" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="own">Own</option><option value="rent">Rent</option></select></div>';
this.requested_loan_amount = '<div id="requested_loan_amount_p"><label for="requested_loan_amount_d">Up to what loan amount would you like to receive?</label><br><select id="requested_loan_amount_d" name="requested_loan_amount" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="200">Up to $200</option><option value="300">Up to $300</option><option value="400">Up to $400</option><option value="500">Up to $500</option><option value="600">Up to $600</option><option value="700">Up to $700</option><option value="800">Up to $800</option><option value="900">Up to $900</option><option value="1000">Up to $1000</option></select></div>';
this.best_time_to_call = '<div id="best_time_to_call_p"><label for="best_time_to_call_d">What is the best time to be reached</label><br><select id="best_time_to_call_d" name="best_time_to_call" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="anytime">Anytime</option><option value="morning">Morning</option><option value="afternoon">Afternoon</option><option value="evening">Evening</option></select></div>';
this.months_at_residence = '<div id="months_at_residence_p"><label for="months_at_residence_d">How long have you lived at your current residence?</label><br><input type="hidden" id="months_at_residence_d" name="months_at_residence" /><select id="months_at_residence_part1" name="ymonths_at_residence" onChange="numJoin(this);"><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select> Years <select id="months_at_residence_part2" name="mmonths_at_residence" onChange="numJoin(this);"><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option></select> Months </div>';
this.income_type = '<div id="income_type_p"><label for="income_type_d">What is your main source of income?</label><br><select id="income_type_d" name="income_type" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="employment">Employment</option><option value="benefits" title="Benefits (social security, etc.)">Benefits (social security, etc.)</option><option value="other">Other</option></select></div>';
this.occupation = '<div id="occupation_p"><label for="occupation_d">Your occupation</label><br><input type="text" class="text" id="occupation_d" name="occupation" /></div>';
this.occupation += '<div id="employer_p"><label for="employer_d">Employer</label><br><input type="text" class="text" id="employer_d" name="employer" /></div>';
this.occupation += '<div id="supervisor_name_p"><label for="supervisor_name_d">Supervisor name</label><br><input type="text" class="text" id="supervisor_name_d" name="supervisor_name" /></div>';
this.occupation += '<div id="supervisor_phone_p"><label for="supervisor_phone_d">Supervisor phone</label><br><input type="hidden" id="supervisor_phone_d" name="supervisor_phone" /><input type="text" class="textPart autotab" id="supervisor_phone_part1" name="xsupervisor_phone" size="3" /> - <input type="text" class="textPart autotab" id="supervisor_phone_part2" name="xsupervisor_phone" size="3" /> - <input type="text" class="textPart autotab" id="supervisor_phone_part3" name="xsupervisor_phone" size="4" /></div>';
this.occupation += '<div id="work_phone_p"><label for="work_phone_d">Your work phone</label><br><input type="hidden" id="work_phone_d" name="work_phone" /><input type="text" class="textPart autotab" id="work_phone_part1" name="xwork_phone" size="3" /> - <input type="text" class="textPart autotab" id="work_phone_part2" name="xwork_phone" size="3" /> - <input type="text" class="textPart autotab" id="work_phone_part3" name="xwork_phone" size="4" /></div>';
this.occupation += '<div id="months_employed_p"><label for="months_employed_d">How long have you been employed with your current employer?</label><br><input type="hidden" id="months_employed_d" name="months_employed" /><select id="months_employed_part1" name="ymonths_employed" onChange="numJoin(this);"><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select> Years <select id="months_employed_part2" name="mmonths_employed" onChange="numJoin(this);"><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option></select> Months </div>';
this.bank_name = '<div id="bank_name_p"><label for="bank_name_d">Bank name</label><br><input type="text" class="text" id="bank_name_d" name="bank_name" /></div>';
this.bank_name += '<div id="account_number_p"><label for="account_number_d">Account number</label><br><input type="text" class="text" id="account_number_d" name="account_number" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.bank_name += '<div id="routing_number_p"><label for="routing_number_d">Routing number</label><br><input type="text" class="text" id="routing_number_d" name="routing_number" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.bank_name += '<div id="bank_phone_p"><label for="bank_phone_d">Bank phone</label><br><input type="hidden" id="bank_phone_d" name="bank_phone" /><input type="text" class="textPart autotab" id="bank_phone_part1" name="xbank_phone" size="3" /> - <input type="text" class="textPart autotab" id="bank_phone_part2" name="xbank_phone" size="3" /> - <input type="text" class="textPart autotab" id="bank_phone_part3" name="xbank_phone" size="4" /></div>';
this.direct_deposit = '<div id="direct_deposit_p"><label for="direct_deposit_d">Do you have direct deposit</label><br><select id="direct_deposit_d" name="direct_deposit" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="yes">Yes</option><option value="no">No</option><option value="no">I don\'t know</option></select></div>';
this.driving_license_state = '<div id="driving_license_state_p"><label for="driving_license_state_d">Your driving license state</label><br><select id="driving_license_state_d" name="driving_license_state" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">State/Province</option><option class="head" value="null">----------</option><option value="al">Alabama</option><option value="ak">Alaska</option><option value="az">Arizona</option><option value="ar">Arkansas</option><option value="ca">California</option><option value="co">Colorado</option><option value="ct">Connecticut</option><option value="de">Delaware</option><option value="dc">District of Columbia</option><option value="fl">Florida</option><option value="ga">Georgia</option><option value="hi">Hawaii</option><option value="id">Idaho</option><option value="il">Illinois</option><option value="in">Indiana</option><option value="ia">Iowa</option><option value="ks">Kansas</option><option value="ky">Kentucky</option><option value="la">Louisianna</option><option value="me">Maine</option><option value="md">Maryland</option><option value="ma">Massachusetts</option><option value="mi">Michigan</option><option value="mn">Minnesota</option><option value="ms">Mississippi</option><option value="mo">Missouri</option><option value="mt">Montana</option><option value="ne">Nebraska</option><option value="nv">Nevada</option><option value="nh">New Hampshire</option><option value="nj">New Jersey</option><option value="nm">New Mexico</option><option value="ny">New York</option><option value="nc">North Carolina</option><option value="nd">North Dakota</option><option value="oh">Ohio</option><option value="ok">Oklahoma</option><option value="or">Oregon</option><option value="pa">Pennsylvania</option><option value="ri">Rhode Island</option><option value="sc">South Carolina</option><option value="sd">South Dakota</option><option value="tn">Tennessee</option><option value="tx">Texas</option><option value="ut">Utah</option><option value="vt">Vermont</option><option value="va">Virginia</option><option value="wa">Washington</option><option value="wv">West Virginia</option><option value="wi">Wisconsin</option><option value="wy">Wyoming</option><option value="ab">Alberta</option><option value="bc">British Columbia</option><option value="mb">Manitoba</option><option value="nb">New Brunswick</option><option value="nl">Newfoundland</option><option value="nt">Northwest Territories</option><option value="ns">Nova Scotia</option><option value="nu">Nunavut</option><option value="on">Ontario</option><option value="pe">Prince Edward Island</option><option value="qc">Quebec</option><option value="sk">Saskatchewan</option><option value="yt">Yukon Territory</option></select><br></div>';
this.driving_license_state += '<div id="driving_license_number_p"><label for="driving_license_number_d">Driving license #</label><br><input type="text" class="text" id="driving_license_number_d" name="driving_license_number" /></div>';
this.driving_license_state += '<div id="mother_maiden_name_p"><label for="mother_maiden_name_d">Mother\'s maiden name</label><br><input type="text" class="text" id="mother_maiden_name_d" name="mother_maiden_name" /></div>';
this.birth_date = '<div id="birth_date_p"><label for="birth_date_d">Your birthdate (mm/dd/yyyy)</label><br><input type="hidden" id="birth_date_d" name="birth_date" /><input type="text" class="textPart autotab" id="birth_date_part1" name="xbirth_date" size="2" value="" onBlur="return filter(this, \'^(0[1-9]|1[0-2]|mm)$\');" /> / <input type="text" class="textPart autotab" id="birth_date_part2" name="xbirth_date" size="2" value="" onBlur="return filter(this, \'^(0[1-9]|[12][0-9]|3[01]|dd)$\');" /> / <input type="text" class="textPart autotab" id="birth_date_part3" name="xbirth_date" size="4" value="" onBlur="return filter(this, \'^([0-9]{4}|yyyy)$\');" /></div>';
this.birth_date += '<div id="social_security_number_p"><label for="social_security_number_d">Social security #</label><br><input type="hidden" id="social_security_number_d" name="social_security_number" /><input type="text" class="textPart autotab" id="social_security_number_part1" name="xsocial_security_number" size="3" /> - <input type="text" class="textPart autotab" id="social_security_number_part2" name="xsocial_security_number" size="2" /> - <input type="text" class="textPart autotab" id="social_security_number_part3" name="xsocial_security_number" size="4" /></div>';
this.student_loan_type = '<div id="student_loan_type_p"><label for="student_loan_type_d">What type of loans do you currently have?</label><br><select id="student_loan_type_d" name="student_loan_type" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="federal">Federal</option><option value="private">Private</option></select></div>';
this.student_loan_type += '<div id="student_loan_count_p"><label for="student_loan_count_d">How many loans do you currently have?</label><br><input type="text" class="text" id="student_loan_count_d" name="student_loan_count" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.student_loan_type += '<div id="student_loan_default_p"><label for="student_loan_default_d">Are you in default on any student loans?</label><br><select id="student_loan_default_d" name="student_loan_default" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="yes">Yes</option><option value="no">No</option></select></div>';
this.student_loan_type += '<div id="student_loan_already_consolidated_p"><label for="student_loan_already_consolidated_d">Do you have any student loans already consolidated?</label><br><select id="student_loan_already_consolidated_d" name="student_loan_already_consolidated" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="yes">Yes</option><option value="no">No</option></select></div>';
this.reference_1_first_name = '<div id="reference_1_first_name_p"><label for="reference_1_first_name_d">Please give a personal reference<br>Full name</label><br><input type="text" class="text" id="reference_1_first_name_d" name="reference_1_first_name" /></div>';
this.reference_1_first_name += '<div id="reference_1_last_name_p"><label for="reference_1_last_name_d"></label><br><input type="text" class="text" id="reference_1_last_name_d" name="reference_1_last_name" /></div>';
this.reference_1_first_name += '<div id="reference_1_relationship_p"><label for="reference_1_relationship_d">Relationship</label><br><select id="reference_1_relationship_d" name="reference_1_relationship" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="parent">Parent</option><option value="sibling">Sibling</option><option value="fiend">Friend</option><option value="co-worker">Co-worker</option><option value="employer">Employer</option><option value="relative">Relative</option></select></div>';
this.reference_1_first_name += '<div id="reference_1_phone_p"><label for="reference_1_phone_d">Phone:</label><br><input type="hidden" id="reference_1_phone_d" name="reference_1_phone" /><input type="text" class="textPart autotab" id="reference_1_phone_part1" name="xreference_1_phone" size="3" /> - <input type="text" class="textPart autotab" id="reference_1_phone_part2" name="xreference_1_phone" size="3" /> - <input type="text" class="textPart autotab" id="reference_1_phone_part3" name="xreference_1_phone" size="4" /></div>';
this.reference_2_first_name = '<div id="reference_2_first_name_p"><label for="reference_2_first_name_d">Please give a <em>SECOND</em> personal reference<br>Full name</label><br><input type="text" class="text" id="reference_2_first_name_d" name="reference_2_first_name" /></div>';
this.reference_2_first_name += '<div id="reference_2_last_name_p"><label for="reference_2_last_name_d"></label><br><input type="text" class="text" id="reference_2_last_name_d" name="reference_2_last_name" /></div>';
this.reference_2_first_name += '<div id="reference_2_relationship_p"><label for="reference_2_relationship_d">Relationship</label><br><select id="reference_2_relationship_d" name="reference_2_relationship" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="parent">Parent</option><option value="sibling">Sibling</option><option value="fiend">Friend</option><option value="co-worker">Co-worker</option><option value="employer">Employer</option><option value="relative">Relative</option></select></div>';
this.reference_2_first_name += '<div id="reference_2_phone_p"><label for="reference_2_phone_d">Phone:</label><br><input type="hidden" id="reference_2_phone_d" name="reference_2_phone" /><input type="text" class="textPart autotab" id="reference_2_phone_part1" name="xreference_2_phone" size="3" /> - <input type="text" class="textPart autotab" id="reference_2_phone_part2" name="xreference_2_phone" size="3" /> - <input type="text" class="textPart autotab" id="reference_2_phone_part3" name="xreference_2_phone" size="4" /></div>';
this.reference_3_first_name = '<div id="reference_3_first_name_p"><label for="reference_3_first_name_d">Please give a last personal reference<br>Full name</label><br><input type="text" class="text" id="reference_3_first_name_d" name="reference_3_first_name" /></div>';
this.reference_3_first_name += '<div id="reference_3_last_name_p"><label for="reference_3_last_name_d"></label><br><input type="text" class="text" id="reference_3_last_name_d" name="reference_3_last_name" /></div>';
this.reference_3_first_name += '<div id="reference_3_relationship_p"><label for="reference_3_relationship_d">Relationship</label><br><select id="reference_3_relationship_d" name="reference_3_relationship" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="parent">Parent</option><option value="sibling">Sibling</option><option value="fiend">Friend</option><option value="co-worker">Co-worker</option><option value="employer">Employer</option><option value="relative">Relative</option></select></div>';
this.reference_3_first_name += '<div id="reference_3_phone_p"><label for="reference_3_phone_d">Phone:</label><br><input type="hidden" id="reference_3_phone_d" name="reference_3_phone" /><input type="text" class="textPart autotab" id="reference_3_phone_part1" name="xreference_3_phone" size="3" /> - <input type="text" class="textPart autotab" id="reference_3_phone_part2" name="xreference_3_phone" size="3" /> - <input type="text" class="textPart autotab" id="reference_3_phone_part3" name="xreference_3_phone" size="4" /></div>';
this.credit = '<div id="credit_p"><label for="credit_d">Your credit</label><br><select id="credit_d" name="credit" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="excellent">Excellent</option><option value="good">Good</option><option value="fair">Fair</option><option value="poor">Poor</option></select></div>';
this.credit += '<div id="property_type_p"><label for="property_type_d">Your home type</label><br><select id="property_type_d" name="property_type" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="single_family_home">Single Family Home</option><option value="condominium">Condominium</option><option value="multi_family_home">Multi Family Home</option></select></div>';
this.credit += '<div id="property_value_p"><label for="property_value_d">Approximate your home value</label><br><input type="text" class="text" id="property_value_d" name="property_value" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.credit += '<div id="mortgage_balance_p"><label for="mortgage_balance_d">Approximate your mortgage balance</label><br><input type="text" class="text" id="mortgage_balance_d" name="mortgage_balance" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.credit += '<div id="additional_cash_p"><label for="additional_cash_d">Additional cash wanted</label><br><input type="text" class="text" id="additional_cash_d" name="additional_cash" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.credit += '<div id="second_mortgage_p"><label for="second_mortgage_d">Second Mortgage</label><br><input type="text" class="text" id="second_mortgage_d" name="second_mortgage" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.credit += '<div id="interest_rate_p"><label for="interest_rate_d">Your current interest rate</label><br><input type="text" class="text" id="interest_rate_d" name="interest_rate" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.credit += '<div id="monthly_obligations_p"><label for="monthly_obligations_d">Your monthly obligations excluding housing (credit cards, child support, etc.)</label><br><input type="text" class="text" id="monthly_obligations_d" name="monthly_obligations" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.creditors = '<div id="creditors_p"><label for="creditors_d">List your creditors</label><br><textarea cols=20 rows=10 id="creditors_d" name="creditors"></textarea></div>';
this.case_description = '<div id="case_description_p"><label for="case_description_d">Please breifly describe your case</label><br><textarea cols=20 rows=10 id="case_description_d" name="case_description"></textarea></div>';
this.level_of_education = '<div id="level_of_education_p"><label for="level_of_education_d">Education Level</label><br><select id="level_of_education_d" name="level_of_education" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="high_school">High School</option><option value="ged">GED</option><option value="some_college">Some College</option><option value="associate">Associate\'s Degree</option><option value="bachelor">Bachelor\'s Degree</option><option value="master">Master\'s Degree</option><option value="doctorate">Doctorate</option></select></div>';
this.level_of_education += '<div id="degree_program_p"><label for="degree_program_d">Program of Interest</label><br><select id="degree_program_d" name="degree_program" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="devry" title="I am interested in a DeVry Degree">I am interested in a DeVry Degree</option><option class="head" value="null">----------</option><option class="head" value="null">I am interested in one</option><option class="head" value="null">of the following AIU programs</option><option class="head" value="null">----------</option><option class="head" value="null">Associate\'s Degrees</option><option class="head" value="null">----------</option><option value="a_business_admin">Business Administration</option><option value="a_healthcare_admin">Healthcare Administraion</option><option value="a_human_resources">Human Resources</option><option value="a_visual_communication">Visual Communication</option><option class="head" value="null">----------</option><option class="head" value="null">Bachelor\'s Degrees</option><option value="nul">----------</option><option value="b_accounting">Accounting and Finance</option><option value="b_healthcare_management">Healthcare Management</option><option value="b_human_resources">Human Resources</option><option value="b_management">Management</option><option value="b_marketing">Marketing</option><option value="b_operations">Operations</option><option value="b_org_psych" title="Organizational Psychology">Organizational Psychology</option><option value="b_projects">Project Management</option><option value="b_international">International Business</option><option value="b_visual_communications">Visual Communication</option><option value="b_computer_systems">Computer Systems</option><option value="b_information_technology">Information Technology</option><option value="b_network_admin">Network Administration</option><option value="b_programming">Programming</option><option value="b_criminal_justice">Criminal Justice</option><option class="head" value="null">------------</option><option class="head" value="null">Master\'s Degrees</option><option class="head" value="null">----------</option><option value="m_curriculum" title="Curriculum and Instruction">Curriculum and Instruction</option><option value="m_instruction">Instructional Technology</option><option value="m_assessment" title="Educational Assessment and Evaluation">Educational Assessment and Evaluation</option><option value="m_leadership" title="Leadership in Educational Organizations">Leadership in Educational Organizations</option><option value="m_information">Information Technology</option><option value="m_accounting">Accounting and Finance</option><option value="m_healthcare">Healthcare Managment</option><option value="m_human_resources">Human Resources</option><option value="m_management">Management</option><option value="m_marketing">Marketing</option><option value="m_operations">Operations Management</option><option value="m_org_psych" title="Organizational Psychology">Organizational Psychology</option><option value="m_projects">Project Management</option><option value="m_international">International Business</option></select></div>';
this.active_military = '<div id="active_military_p"><label for="active_military_d">Are you currently actively enrolled in the military?</label><br><select id="active_military_d" name="active_military" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="yes">Yes</option><option value="no">No</option></select></div>';
this.credit_check = '<div id="credit_check_p"><label for="credit_check_d">For a fast and accurate auto loan quote please check my credit (bad credit or no credit OK)</label><br><select id="credit_check_d" name="credit_check" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="yes">YES</option><option value="no" title="No, I do not want the auto loan quote">No, I do not want the auto loan quote</option></select></div>';
this.degree_area = '<div id="degree_area_p"><label for="degree_area_d">Program of Interest</label><br><select id="degree_area_d" name="degree_area" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option></select></div>';
this.degree_type = '<div id="degree_type_p"><label for="degree_type_d">Degree Type</label><br><select id="degree_type_d" name="degree_type" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option></select></div>';
this.degree_section = '<div id="degree_section_p"><label for="degree_section_d">Degree Program</label><br><select id="degree_section_d" name="degree_section" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option></select></div>';
this.degree_school = '<div id="degree_school_p"><label for="degree_school_d">School</label><br><select id="degree_school_d" name="degree_school" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option></select></div>';
this.student_loan_debt = '<div id="student_loan_debt_p"><label for="student_loan_debt_d">Student Loan Debt</label><br><input type="text" class="text" id="student_loan_debt_d" name="student_loan_debt" onBlur="return filter(this, \'^[0-9.]+$\')" /></div>';
this.graduated = '<div id="graduated_p"><label for="graduated_d">Have you graduated or will you graduate in the next 6 months?</label><br><select id="graduated_d" name="graduated" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="yes">Yes</option><option value="no">No</option></select></div>';
this.auto_financing_bonus = '<div id="auto_financing_bonus_p"><label for="auto_financing_bonus_d">Congratulations</label><br><select id="auto_financing_bonus_d" name="auto_financing_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option class="head" value="null">You are also pre-approved</option><option class="head" value="null">to receive a free, no obligation</option><option class="head" value="null">auto loan quote for a new or used car</option><option class="head" value="null">(bad or no credit OK with credit check)</option><option class="head" value="null">----------------</option><option value="yes">YES, get me approved</option><option value="no">No, I don\'t want it</option></select></div>';
this.home_purchase_bonus = '<div id="home_purchase_bonus_p"><label for="home_purchase_bonus_d">Why Rent when you can OWN your home?</label><br><select id="home_purchase_bonus_d" name="home_purchase_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option class="head" value="null">Learn how you can own a home</option><option class="head" value="null">for the same money you pay on rent.</option><option class="head" value="null">(bad credit OK)</option><option class="head" value="null">----------------</option><option value="yes" title="YES, I would rather own than rent">YES, I would rather own than rent</option><option class="head" value="null">----------------</option><option value="no" title="no, I don\'t want to own my home">no, I don\'t want to own my home</option></select></div>';
this.home_purchase_bonus += '<div id="mortgage_lead_bonus_p"><label for="mortgage_lead_bonus_d">As a homeowner you may also qualify for MORE CASH:</label><br><select id="mortgage_lead_bonus_d" name="mortgage_lead_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="yes" title="Yes, show me how to get more cash">Yes, show me how to get more cash</option><option value="no" title="No, I don\'t want more cash">No, I don\'t want more cash</option></select></div>';
this.title_bonus = '<div id="title_bonus_p"><label for="title_bonus_d">Based on your information we can help you save money!<br><b>Yes! I would like to save up to 70% on the following:</b></label><br><input type="hidden" id="title_bonus_d" name="title_bonus" /></div>';
this.title_bonus += '<div id="car_insurance_bonus_p"><label for="car_insurance_bonus_d">My Car Insurance</label><br><div align="center"><table class="form_container"><tr><td><input type="radio" value="yes" id="yes_car_insurance_bonus_d" name="car_insurance_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><b>YES</b></input></td><td><input type="radio" value="no" id="no_car_insurance_bonus_d" name="car_insurance_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}">no thanks</input></td></tr></table></div></div>';
this.title_bonus += '<div id="life_insurance_bonus_p"><label for="life_insurance_bonus_d">Life Insurance Quote</label><br><div align="center"><table class="form_container"><tr><td><input type="radio" value="yes" id="yes_life_insurance_bonus_d" name="life_insurance_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><b>YES</b></input></td><td><input type="radio" value="no" id="no_life_insurance_bonus_d" name="life_insurance_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}">no thanks</input></td></tr></table></div></div>';
this.title_bonus += '<div id="student_loan_consolidation_bonus_p"><label for="student_loan_consolidation_bonus_d">My Student Loan Debt of over $10,000 (must be out of school)</label><br><div align="center"><table class="form_container"><tr><td><input type="radio" value="yes" id="yes_student_loan_consolidation_bonus_d" name="student_loan_consolidation_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><b>YES</b></input></td><td><input type="radio" value="no" id="no_student_loan_consolidation_bonus_d" name="student_loan_consolidation_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}">no thanks</input></td></tr></table></div></div>';
this.title_bonus += '<div id="home_based_business_bonus_p"><label for="home_based_business_bonus_d">Home Business Opportunity</label><br><div align="center"><table class="form_container"><tr><td><input type="radio" value="yes" id="yes_home_based_business_bonus_d" name="home_based_business_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><b>YES</b></input></td><td><input type="radio" value="no" id="no_home_based_business_bonus_d" name="home_based_business_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}">no thanks</input></td></tr></table></div></div>';
this.title_bonus += '<div id="credit_repair_bonus_p"><label for="credit_repair_bonus_d">Credit Repair Quote</label><br><div align="center"><table class="form_container"><tr><td><input type="radio" value="yes" id="yes_credit_repair_bonus_d" name="credit_repair_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><b>YES</b></input></td><td><input type="radio" value="no" id="no_credit_repair_bonus_d" name="credit_repair_bonus" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}">no thanks</input></td></tr></table></div></div>';
this.sms_agree = '<div id="sms_agree_p"><label for="sms_agree_d">Keep me updated on my request and Special Promotions using SMS (text messaging)</label><br><select id="sms_agree_d" name="sms_agree" onKeyDown="if (event.keyCode ==8) {backStep(); return false;}"><option class="head" value="null">Choose One...</option><option class="head" value="null">-----------</option><option value="yes">Yes</option><option value="no">No</option><option value="no" title="I do not have a cell phone">I do not have a cell phone</option></select></div>';
this.sms_agree += '<div id="sms_phone_p"><label for="sms_phone_d">Cell Phone</label><br><input type="hidden" id="sms_phone_d" name="sms_phone" /><input type="text" class="textPart autotab" id="sms_phone_part1" name="xsms_phone" size="3" /> - <input type="text" class="textPart autotab" id="sms_phone_part2" name="xsms_phone" size="3" /> - <input type="text" class="textPart autotab" id="sms_phone_part3" name="xsms_phone" size="4" /></div>';
this.captcha = '<div id="captcha_p"><label for="captcha_d">Please Enter the Security Code</label><br><img src="https://www.leadpile.com/cgi-bin/manage_leads/shared/captcha.pl?h=30&w=145&s=' + captcha_salt + '"><br>Security code (above):<br><input id="captcha" name="captcha"></div>';
};
var FormChanges = Class.create();
FormChanges.prototype = {
initialize: function(form) {
this.form   = form;
this.fields = $H({});
eval("function bind_checkLTV() { property_value = $(" + form.form_index + " + '_property_value_d'); mortgage_balance = $(" + form.form_index + "  + '_mortgage_balance_d'); additional_cash = $(" + form.form_index + "  + '_additional_cash_d'); pv = parseInt($F(property_value)); mb = parseInt($F(mortgage_balance)); ac = parseInt($F(additional_cash)); 	if (pv == 0) {	alert('You must specify the estimated value of your property.'); property_value.value = ''; } else if (ac && !mb) { alert('You must specify the balance of your mortgage.'); additional_cash.value = ''; } else if (mb && !ac) { req = Math.floor(pv * .85 - mb); additional_cash.value = req > 0 ? req : 0; } else { ltv = (mb + ac) / pv; if (ltv > 1) { alert('You cannot request more money than the value of your home. Please lower the additional cash you would like to receive.'); additional_cash.value = ''; } else if (ltv > .85) { property_value.value = Math.floor(pv * 1.1); } } }");
eval("function bind_checkEmploy() { if($("+form.form_index + " + '_months_employed_d').value == 0) alert('You must be employed at least 1 month.');}");
['pay_period','requested_loan_amount','best_time_to_call','direct_deposit','active_military','degree_area','degree_type','degree_school','has_bank_account'].each(function(name) { this.fields[name] = this.proceed; }.bind(this));
['property_value','mortgage_balance','additional_cash','second_mortgage'].each(function(name) { this.fields[name] = bind_checkLTV; }.bind(this));
['mmonths_employed','ymonths_employed'].each(function(name) { this.fields[name] = bind_checkEmploy; }.bind(this));
this.fields['housing'] = function(elem, form) 
{
if(inv_generated_types["Debt Consolidation"] != this.form.form_type)
this.add_bonus_fields("Debt Consolidation",elem,"CONGRATULATIONS!\nYou also qualify for a Free - No Obligation\nDEBT RELIEF Solution.\n\nClick OK to receive it with your main request\nor Cancel to waive it.");
return form.nextStep();
}.bind(this);
this.fields['working_in_us'] = function(elem,form)
{
if(form.form_type != 1)return form.nextStep();
if(	elem.value != 'no')return form.nextStep();
alert("Only applications from those working in the US will be accepted.");
}.bind(this);
this.fields['monthly_income'] = function(elem,form)
{
if(!filter(elem, '^[0-9.]+$')) {elem.value=""; return;}
if(form.form_type != 1) return form.nextStep();
else if(elem.value >= 1000) return form.nextStep();
alert("You must be making at least $1000 per month to qualify.");
}.bind(this);
this.fields['state_selection'] = function(elem,form)
{
if(form.form_type != 1)return form.nextStep();
if(	elem.value != 'ga' && elem.value != 'ma') return form.nextStep();
alert("Application can not be accepted from selected state.");
}.bind(this);
this.fields['unsecured_debt'] = function(elem,form)
{
return form.nextStep();
}.bind(this);
this.fields['income_type'] = function(elem, form) 
{	
fields = ['occupation','employment','supervisor_name','supervisor_phone','work_phone','months_employed'];
if ($F(elem) == 'employment') form.addAfter(form.form_index,fields, form.form_index + '_income_type_h');
else form.eraseFields(form.form_index,fields);
return form.nextStep();
}.bind(this);
this.fields['credit_check'] = function(elem, form) 
{
if(elem.value != '')
{
if (($F(elem) == 'yes')) 
$(form.form_index + '_credit_check_h').value = 'yes';
else 
{
$(form.form_index + '_credit_check_h').value = 'no';
var bonus = $(form.form_index + '_auto_financing_bonus_h');
if (bonus) bonus.value = '';
}
return form.nextStep();
}
}.bind(this);
this.fields['sms_agree'] = function(elem, form) 
{
if(elem.value != '')
{
if (($F(elem) != 'yes')) 
{
$(form.form_index + '_sms_phone_part1').value = '000';
$(form.form_index + '_sms_phone_part2').value = '000';
$(form.form_index + '_sms_phone_part3').value = '0000';
}
}
}.bind(this);
this.fields['routing_number'] = function(elem, form) 
{
if(!checkABA(elem)) 
{
alert('The routing number you entered is not valid.');
Field.activate(elem);
}
}.bind(this);
this.fields['mortgage_lead_bonus'] = function(elem,form)
{
if(elem.value != '')
{
this.add_bonus_fields("Homeowner",elem);
return form.nextStep();
}
}.bind(this);
this.fields['credit_repair_bonus'] = function(elem,form)
{
if(elem.value != '')
this.add_bonus_fields("Credit Repair",elem);
}.bind(this);
this.fields['car_insurance_bonus'] = function(elem,form)
{
if(elem.value != '')
this.add_bonus_fields("Car Insurance",elem);
}.bind(this);
this.fields['life_insurance_bonus'] = function(elem,form)
{
if(elem.value != '')
this.add_bonus_fields("Life Insurance",elem);
}.bind(this);
this.fields['student_loan_consolidation_bonus'] = function(elem,form)
{
if(elem.value != '')
this.add_bonus_fields("Student Loans Consolidation",elem);
}.bind(this);
this.fields['home_based_business_bonus'] = function(elem,form)
{
if(elem.value != '')
this.add_bonus_fields("Home Based Business",elem);
}.bind(this);
this.fields['home_purchase_bonus'] = function(elem, form) 
{
if(elem.value != '')
{
this.add_bonus_fields("Home Purchase",elem,"Thank you. You will ALSO receive a Free - No Obligation Quote on a New Home Purchase.\n\nClick OK to confirm your selection.");
return form.nextStep();
}
}.bind(this);
this.fields['auto_financing_bonus'] = function(elem, form) 
{
if(elem.value != '')
{
this.add_bonus_fields("Auto Financing",elem,"Thank you. You will ALSO receive a Free - No Obligation auto financing quote.\n\nClick OK to confirm your selection.");
return form.nextStep();
}
}.bind(this);
},
add_bonus_fields: function(key,elem,confirm_msg)
{
var x = 0;
var bonus_type = inv_generated_types[key];
var newfields = new Array();
var secondary = this.form.form_index + '_' + bonus_type + '_h';
var fields = fields_per_type[bonus_type].split(",");
var orig_fields = fields_per_type[this.form.form_type].split(",");
if ($F(elem) == 'yes' || $F(elem) == 'own' || $F(elem) >= 1000 || $F(elem) == 'rent')
{
if(confirm_msg != "" && typeof(confirm_msg) != "undefined")
if(!confirm(confirm_msg))
return;
for(j=0;j<fields.length;j++)
{
if(typeof($(this.form.form_index + '_' + fields[j] + '_h')) == "undefined")
if(fields[j].match("_bonus") == null)
{
newfields[x] = fields[j];
x++;
}
}
if($(secondary).value != 'yes')
$(secondary).value = 'secondary';
this.form.addAfter(this.form.form_index,newfields, this.form.form_index + '_'+elem.name+'_h');
}
else 
{
for(j=0;j<fields.length;j++)
{
var found = 0;
for(k=0;k<orig_fields.length;k++)
if(orig_fields[k] == fields[j])
{
found = 1;
k = orig_fields.length;
}
if(found == 0)
{
newfields[x] = fields[j];
x++;
}
}
if($(secondary).value != 'yes')
$(secondary).value = '';
this.form.eraseFields(this.form.form_index,newfields);
}
},
proceed: function(elem, form) { form.nextStep(); },  
setup: function() { this.form.visible_form_elements.each(function(elem) { if (elem.name && this.fields[elem.name] && !elem.id.match(/_part/)) Event.observe(elem, 'change', this.call_onchange.bindAsEventListener(this)); }.bind(this)); },
call_onchange: function(event) { elem = Event.element(event);if (method = this.fields[elem.name]) if(method(elem, this.form) === false) Event.stop(event); }
};
var formField = new formFieldObj();
var active_lead_forms = 0;
var	page_count = 1;
var max_page_count = 1;
var inv_generated_types = {};
function image_with_trans(src)
{
if (navigator.appVersion.match(/\bMSIE 6\b/))
return '<img style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\', sizingMethod=\'scale\')" src="' + base_url + 'leadpile/images01/spacer.gif" />';
return '<img src="' + src + '" />';
}
var LeadForm = Class.create();
LeadForm.prototype = {
initialize: function(hash)
{
if(typeof(param_style) == "undefined") param_style = null;
if(typeof(param_site) == "undefined") param_site = null;
if(typeof(param_producer) == "undefined") param_producer = null;
if(typeof(param_ajax_submit) == "undefined") param_ajax_submit = null;
if(typeof(param_div) == "undefined") param_div = null;
if(typeof(param_type) == "undefined") param_type = null;
if(typeof(param_links) == "undefined") param_links = null;
if(typeof(param_autosave) == "undefined") param_autosave = null;
if(typeof(param_confpage) == "undefined") param_confpage = null;
if(typeof(hash) == "undefined")
var hash = {};
hash.style = hash.style || param_style;
hash.site = hash.site || param_site;
hash.producer = hash.producer || param_producer;
hash.ajax_submit = hash.ajax_submit || param_ajax_submit;
hash.div =  hash.div || param_div;
hash.types = hash.types || param_type;
hash.links =  hash.links || param_links;
hash.autosave =  hash.autosave || param_autosave;
hash.confpage =  hash.confpage || param_confpage;
active_lead_forms += 1;
this.form_index  = active_lead_forms;
this.consumer_id = hash.consumer_id || null;
this.consumer_key = hash.consumer_key || null;
this.education = null;
this.form_type		= 0;
this.types			= $H(generated_types);
this.fields			= $H(fields_per_type);
this.field_masks	= $H(masks_per_type);
this.posturl		= posturl;
this.style			= hash.style || null;
this.site			= hash.site || '';
this.instance_name	= hash.instance_name || '';
this.links			= hash.links || '';
this.producer		= hash.producer || '';
this.ajax_submit	= hash.ajax_submit || false;
this.came_from		= param_came_from || '';
this.div			= hash.div || '';
this.auto_save 		= hash.auto_save || 1;
this.confpage 		= hash.confpage || "";
this.show_terms		= '<p class="foottext"><a href="http://www.ezwebsys.com/shared/form/disclaimer.html" target="_blank">Terms of Use</a> | ' +
   '<a href="http://www.ezwebsys.com/shared/form/contact/contact.html?site=' + this.site + '" target=new>Contact Us</a>' +
   '<br><a href="http://www.leadpile.com/i-savenow.html?source=form" target="_blank">I-SaveNow Form powered by LeadPile</a></p>';
if(this.instance_name != '')
this.instance_name = this.instance_name + "_" + this.form_index;
valid_types = $A(hash.types || []);
if (valid_types.length > 0)
{
this.types.keys().each(function(key)
{
if (valid_types.include(key)) { throw $continue; }
delete this.types[key];
}.bind(this));
}
this.onchanges = new FormChanges(this);
Event.onDOMReady(function()
{
this.education = new EducationSelect(this.form_index);
if((this.div != '' && $(this.div).innerHTML == '') || !this.recentlySubmitted())
{
this.createFormHTML();
if (this.recentlySubmitted())
{
this.visible_form_elem.update('We have received your information within the past 10 minutes; there is no need to resubmit.');
}
else if (!this.populateFromServer())
{
this.producer = affp_producer(this.producer,this.came_from);
this.createhiddenForm();
}
}
}.bindAsEventListener(this));
},
populateFromServer: function() {
email = null;
string = (document.baseURI || document.URL).split('?');
// Check GET variables to see if email exists
if (string[1]) {
string[1].split('&').each(
function(pair) {
parts = pair.split('=');
if (parts[0] == 'email') {
email = parts[1];
}
}
);
}
// don't do anything if niether email or consumer_id are passed in the url
if (!email && !this.consumer_id) { return false; }
if (email != null) {
Element.update(this.visible_form_elem,
'Retrieve my previous submission:<br />' +
'Email: <input type="text" id="' + this.form_index + '_email_d" value="' + email + '" /><br />' +
'Phone Number: <input type="text" id="' + this.form_index + '_phone_d" /><br />' +
'<input type="button" id="' + this.form_index + '_find_button" value="Find my submission" />');
Event.observe(this.form_index + '_find_button', 'click', function(event) {
var uri = location.href;
uri = uri.split("//");
var proto = uri[0];
uri = uri[1];
uri = uri.split("/");
uri = uri[0];
new Ajax.Request(
'lead_bridge.php',
{
parameters: "email=" + $F(this.form_index + '_email_d') + "&phone=" + $F(this.form_index + '_phone_d'),
onComplete: function(t, json) {
this.json = $H(json || {});
this.createhiddenForm();
}.bind(this)
}
);
}.bindAsEventListener(this));
} else if (this.consumer_id != null) {
var request_url = "lead_bridge.php";
if (base_url.match(/alan/)) {
request_url = 'http://alan.test.leadpile.com/cgi-bin/manage_leads/shared/jsonconsumerlead.pl';
}
new Ajax.Request(
request_url,
{
parameters: "consumer_id=" + this.consumer_id + "&consumer_key=" + this.consumer_key,
onComplete: function(t, json) {
this.json = $H(json || {});
this.createhiddenForm();
}.bind(this)
}
);
}
return true;
},
createFormHTML: function() {
this.visible_form = 'lead_form_' + this.form_index;
form = '<form id="' + this.visible_form + '" class="lead_form"></form>';
if (this.style && !this.style.match(/[^a-zA-Z0-9_\-\/]+/))
{
css = base_url + 'leadpile/styles/' + this.style + '/style.css';
if (document.createStyleSheet)
document.createStyleSheet(css);
else
new Insertion.After(document.getElementsByTagName("head")[0],'<style type="text/css">@import url(\'' + css + '\');</style>');
var header = image_with_trans(base_url + "leadpile/styles/" + this.style + "/top.png");
var footer = image_with_trans(base_url + "leadpile/styles/" + this.style + "/footer.png");
if (navigator.appVersion.match(/\bMSIE 6\b/))
middle = '  <tr><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + base_url + 'leadpile/styles/' + this.style + '/middle.l.png\', sizingMethod=\'scale\')"><img src="'+base_url+'leadpile/images01/spacer.gif" width="20" height="1" /></td><td class="form_container" style="background-image:url(' + base_url + 'leadpile/styles/' + this.style + '/middle.m.png);text-align:center;width:263px;"><div style="padding:0 0 0 0;">' + form + '</div></td><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + base_url + 'leadpile/styles/' + this.style + '/middle.r.png\', sizingMethod=\'scale\')"><img src="'+base_url+'leadpile/images01/spacer.gif" width="20" height="1" /></td></tr>';
else
middle = '  <tr><td style="background:url(' + base_url + 'leadpile/styles/' + this.style + '/middle.l.png) top left repeat-y;"><img src="'+base_url+'leadpile/images01/spacer.gif" width="20" height="1" /></td><td class="form_container" style="background:url(' + base_url + 'leadpile/styles/' + this.style + '/middle.m.png) top left repeat-y;width:263px;"><div style="text-align: center;padding: 0 0 0 0;">' + form + '</div></td><td style="background:url(' + base_url + 'leadpile/styles/' + this.style + '/middle.r.png)"><img src="'+base_url+'leadpile/images01/spacer.gif" width="20" height="1" /></td></tr>';
form = '<table class="form_table" border=0 cellspacing="0" cellpadding="0" style="width:303px;">' +
'  <tr><td colspan=3 class="form_table_header">' + header + '</td></tr>' +
middle +
'  <tr><td colspan=3 class="form_table_footer">' + footer + '</td></tr>' +
'</table>';
}
script_tags = $$('script').map(function(e) {return e.innerHTML.match(/new LeadForm/) ? e : undefined}).compact();
if(this.div == '')
new Insertion.After(script_tags[(this.form_index - 1)], form);
else
$(this.div).innerHTML = form;
this.visible_form_elem = $(this.visible_form);
},
createhiddenForm: function(producer) {
this.hidden_form = 'hidden_form_' + this.form_index;
Event.observe(this.visible_form_elem, 'submit', Event.stop);
typeOptions = '';
hiddenForm  = '<form id="' + this.hidden_form + '" name="' + this.hidden_form + '" method="post" action="' + this.posturl + '">' + "\n";
$H(generated_types).each(function(pair)
{
inv_generated_types[pair.value] = pair.key;
hiddenForm  += '  <input type="hidden" id="' + this.form_index + '_' + pair.key + '_h" name="' + pair.key + '" />' + "\n";
}.bind(this));
this.types.each(function(pair)
{
typeOptions += '  <option id="' + this.form_index + '_request_option_value_' + pair.key + '" value="' + pair.key + '">' + pair.value + '</option>';
}.bind(this));
hiddenForm += '  <input type="hidden" class="ignore" id="' + this.form_index + '_site_h" name="site" />' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_links_h" name="links" value="' + this.links + '"/>' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_came_from_h" name="came_from" value="' + this.came_from + '"/>' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_comfpage_h" name="comfpage" value="' + this.confpage + '"/>' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_source_h" name="source" />' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_campaign_h" name="campaign" />' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_captcha_salt_h" name="captcha_salt" />' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_captcha_ignore_h" name="captcha_ignore" />' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_ad_h" name="ad" />' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_referrer_h" name="referrer" />' + "\n" +
'  <input type="hidden" class="ignore" id="' + this.form_index + '_producer_h" name="producer" value="' + this.producer + '" />' + "\n" +
"</form>\n";
new Insertion.After(this.visible_form, hiddenForm);
this.hidden_form_elem  = $(this.hidden_form);
trackLead(this.site,this.form_index);
if (this.types.keys().length == 1)
this.createVisibleForm(this.types.keys().last(), true);
else
{
Element.update(this.visible_form_elem,
'Select a service type:<br />' +
'<select id="' + this.form_index + '_request_d">' +
'  <option class="head">Choose one...</option>' +
'  <option class="head">----------</option>' +
typeOptions +
'</select>' + this.show_terms);
Event.observe(this.form_index + '_request_d', 'change', function(event)
{
elem = Event.element(event);
if (elem.selectedIndex > 1)
{
this.show_terms = false;
this.createVisibleForm($F(elem), true);
}
}.bindAsEventListener(this));
}
},
createVisibleForm: function(type, focus) {
if (!type) { return; }
this.form_type = type;
this.form_page = this.fields[type].split(",");
this.form_mask = this.field_masks[type].split(",");
this._addFields(this.form_index,this.fields[type], this.form_index + '_' + type + '_h', 'before', false);
this.hidden_form_elements = Form.getElements(this.hidden_form_elem);
this.form_type = type;
$(this.form_index + '_' + type + '_h').value = 'yes';
this.showFirstField(focus);
this.show_terms = false;
},
total_fields: function() {
count = 0;
this.hidden_form_elements.each(function(elem) {if (formField[elem.name]) { count++; };}.bind(this));
return count;
},
completed_fields: function() {
completed = 0;
this.hidden_form_elements.each(function(elem) {
if (formField[elem.name] && $F(this.form_index + '_' + elem.name + '_h')) { completed++; }}.bind(this));
return completed;
},
showFirstField: function(focus) {
elem = this.hidden_form_elements.find(function(felem) { return formField[felem.name];});
if(typeof(elem)!="undefined") this.showField(elem, focus && elem.type != 'hidden');
},
saveTohiddenForm: function() {
this.visible_form_elements.each(function(elem)
{
if (elem.id.match(/_part1$/))
this.numJoin(elem);
if (hidden = $(this.form_index + '_' + elem.name + '_h'))
if(elem.type != "radio")
hidden.value = $F(elem);
else
hidden.value = this.radio_value(elem);
}.bind(this));
},
radio_value: function(elem)
{
var all_elems = document.getElementsByName(elem.name);
for(var j=0;j<all_elems.length;j++)
if(all_elems[j].id.split("_")[0] == this.form_index)
if(all_elems[j].checked)
return all_elems[j].value;
return "";
},
numJoin: function(field) {
target = field.name.substr(1);
value = '';
this.visible_form_elements.each(function(elem)
{
if (elem.type != 'text' && elem.type != 'select-one') { throw $continue; }
if (elem.name == 'x' + target) { value = '' + value + '' + $F(elem); }
else if (elem.name == 'm' + target) { value = 1 * value +  1 * $F(elem); }
else if (elem.name == 'y' + target) { value = 1 * value + 12 * $F(elem); }
});
if (elem = $(this.form_index + '_' + target + '_h')) { elem.value = value; }
},
buildProgressBar: function(hash) {
hash = hash || {};
width  = hash.width || 100;
height = hash.height || 15;
border = hash.border || 'black';
percent = (this.completed_fields() + 1) / this.total_fields();
percent = Math.floor(percent * 100);
if (percent >= 100) { percent = 95; }
return "<center><table cellpadding=0 cellspacing=0 style='border: solid 1px #000000;'><tr><td bgcolor='#000000'><img src='" + base_url + "/leadpile/images01/spacer.gif' width='" + (Math.floor(percent*width/100)) + "px' height='" + height + "px' border=0/></td><td bgcolor='#FFFFFF'><img src='" + base_url + "/leadpile/images01/spacer.gif' width='" + (Math.floor((100-percent)*width/100)) + "px' height='" + height + "px' border=0/></td></tr></table></center>";
},
showField: function(elem, focus) {
if($(this.form_index + '_state_selection_h').value != '' && max_page_count > 2)
{
if(BrowserDetect.browser == 'Explorer' && this.auto_save == 1)
{
window.onunload = function()
{
if($(this.form_index + '_email_h').value != "" && max_page_count > 2)
{
window.onbeforeunload = null;
$(this.form_index + '_captcha_ignore_h').value="ignore";
this.hidden_form_elem.submit();
window.onunload = null;
}
}.bind(this);
}
window.onbeforeunload = function (e)
{
var message = 'Your application is incomplete.  Please click cancel to complete the form.';
return message;
}.bind(this);
}
elem = $(elem);
if(typeof(elem) == 'undefined') return;
fieldsLeft = this.buildProgressBar({ width: 200, height: 3 });
temp_form = formField[elem.name].replace(/(type=\"text\")/gi, "$1 autocomplete=\"OFF\"");
temp_form = temp_form.replace(/id=\"/gi, "id=\"" + this.form_index + "_");
lock_image = '<a href="' + base_url + 'ezwebsys.com/shared/form/secureSite.html" target="_blank"><img src="' + base_url + 'leadpile/images01/lock.gif" width=12 height=15 border=0 alt="SSL Secured Form - Click for Details"></a>';
lock_track = '<a href="' + base_url + 'ezwebsys.com/shared/form/secureSite.html" target="_blank"><img src="' + base_url + 'cgi-bin/manage_leads/shared/actiontrak.pl?uid=' + $F(this.form_index + '_captcha_salt_h') + "&pid=" + $F(this.form_index + '_producer_h')+ "&form=" + generated_types[this.form_type] + "&page=" + elem.name + "&site=" + $(this.form_index + '_site_h').value + "&ad=" + $(this.form_index + '_ad_h').value + "&source=" + $(this.form_index + '_source_h').value + "&campaign=" + $(this.form_index + '_campaign_h').value + "&url=" + fix_url($(this.form_index + '_came_from_h').value) + "&count=" + max_page_count + '" width=12 height=15 border=0 alt="SSL Secured Form - Click for Details"></a>';
form_items = '<p class="progress" style="white-space: nowrap;">Progress: ' + fieldsLeft + '</p>' +
temp_form +
'<p>' + lock_image + '&nbsp;' +
'<input type="button" class="button" id="' + this.form_index + '_back_button" value="&larr; Back">&nbsp;' +
'<input type="submit" class="button" id="' + this.form_index + '_next_button" value="Next &rarr;">&nbsp;' +
lock_track + '</p>';
if (this.show_terms) form_items += this.show_terms;
Element.update(this.visible_form_elem, form_items);
Event.observe(this.form_index + '_back_button', 'click', function() { this.backStep(true); }.bindAsEventListener(this));
Event.observe(this.form_index + '_next_button', 'click', function() { this.nextStep(true); }.bindAsEventListener(this));
this.visible_form_elements = Form.getElements(this.visible_form_elem);
this.visible_form_elements.each(function(felem)
{
hidden = this.form_index + '_' + felem.name + '_h';
if (typeof($(hidden)) != 'undefined' && $F(hidden))
{
if(felem.type != 'radio')
{
felem.value = $F(hidden);
if (felem.type == 'hidden') { numSplit(felem); }
}
else
if(felem.id == this.form_index + "_" + $(hidden).value + "_" + felem.name + "_d")
felem.checked=true;
}
}.bind(this));
if(typeof(this.onchanges) != "undefined")
this.onchanges.setup();
this.setupAutotabHandlers();
if (focus && (felem = this.first_form_field()) && (felem.type != 'hidden')) {Field.focus(felem);}
if(elem.name == 'degree_area') this.education.find_degree_area();
if(elem.name == 'degree_type') this.education.find_degree_type();
if(elem.name == 'degree_section') this.education.find_degree_program($(this.form_index + '_degree_area_h').value,$(this.form_index + '_degree_type_h').value);
if(elem.name == 'degree_school') this.education.find_degree_school($(this.form_index + '_degree_program_h').value);
for(var j=0;j<this.form_page.length;j++)
{
if(this.form_page[j] == elem.name)
{
if(typeof(fields_per_mask[elem.name]) != "undefined")
{
var field_group = fields_per_mask[elem.name].split(",");
for(var k=0;k<field_group.length;k++)
{
if(typeof(this.form_mask[j+k]) != "undefined")
if(this.form_mask[j+k] == "O")
$(this.form_index + "_" + field_group[k] + "_p").style.display="none";
}
}
j=this.form_page.length+1;
}
}
if(typeof($(this.form_index+"_housing_h")) != "undefined")
{
if(typeof($(this.form_index + "_home_purchase_bonus_p")) != "undefined")
if($(this.form_index+"_housing_h").value == "own")
$(this.form_index + "_home_purchase_bonus_p").style.display="none";
if(typeof($(this.form_index + "_mortgage_lead_bonus_p")) != "undefined")
if($(this.form_index+"_housing_h").value == "rent")
$(this.form_index + "_mortgage_lead_bonus_p").style.display="none";
}
},
setupAutotabHandlers: function () {
autotab.elems = this.visible_form_elements;
$$('.autotab').each(function(elem) { Event.observe(elem, 'keyup', autoTab); });
},
recentlySubmitted: function()
{
if ((document.baseURI || document.URL).match(/test_mode/)) 	return false;
return getCookie('submitted_form') ? true : false;
},
nextStep: function(focus) {
page_count = page_count + 1;
if(page_count > max_page_count) max_page_count = page_count;
is_valid = true;
this.visible_form_elements.each(function(elem)
{
if (elem.type == 'button' || elem.type == 'submit') { throw $continue; }
if ((elem.name == 'second_pay_date' && !checkPayDate2(elem, $F(this.form_index + '_next_pay_date_d'), $F(this.form_index + '_pay_period_h'))) ||
(elem.name == 'postal_code'     && !checkZipCode($F(elem), $F(this.form_index + '_state_selection_h'))) ||
(elem.name == 'months_employed' && !checkEmployed($F(elem), $F(this.form_index + '_months_employed_d'))) ||
(elem.name == 'monthly_income'  && !checkIncome($F(elem), $F(this.form_index + '_monthly_income_d'))) ||
(elem.name == 'degree_program'  && !checkDegree($F(elem))))
if($(this.form_index + "_" + elem.name + "_p").style.display != "none")
{
is_valid = false;
throw $break;
}
if (elem.type == 'text' && elem.id.match(/_part\d+$/) && $F(elem).length != elem.size)
{
var elemname = elem.name;
if(elem.id.match(/_part\d+$/)) elemname = elem.name.substring(1);
if($(this.form_index + "_" + elemname + "_p").style.display != "none")
{
alert('There are not enough digits!');
Field.focus(elem);
is_valid = false;
throw $break;
}
}
if (
(elem.type.match('select') && Element.hasClassName(elem.options[elem.selectedIndex], 'head')) ||
(elem.type == 'text' && ($F(elem) == '' || $F(elem) == 'mmddyyyy')) ||
(elem.type == 'radio' && this.radio_value(elem) == "")
)
if($(this.form_index + "_" + elem.name + "_p").style.display != "none")
{
alert('Please fill out all fields');
if (elem.type != "hidden") { Field.focus(elem); }
is_valid = false;
throw $break;
}
}.bind(this));

if (!is_valid) { return false; }
$(this.form_index + '_back_button').disabled = true;
$(this.form_index + '_next_button').disabled = true;
this.saveTohiddenForm();
if (this.showNextField(focus))
{
$(this.form_index + '_back_button').disabled = false;
$(this.form_index + '_next_button').disabled = false;
   return true;
}
window.onbeforeunload = null;
window.onunload = null;
Element.update(this.visible_form_elem, "<center>Your request is being processed. This may take several minutes. <b>Please wait for a confirmation page.</b></center><br><br>Thank you for your patience.");
expDate = new Date();
expDate.setTime(expDate.getTime() + 1000 * 60 * 10);
setCookie('submitted_form', '1', expDate, '/');
var once = true;
setTimeout(function()
{
if (once && !(document.baseURI || document.URL).match(/test_mode/))
{
if (this.ajax_submit)
new Ajax.Request(this.hidden_form_elem.action, {parameters: Form.serialize(this.hidden_form_elem),onLoading: function() {},onComplete: function(transport) {}});
else
this.hidden_form_elem.submit();
once = false;
}
}.bind(this), 100);
return true;
},
nextFormElement: function(current)
{
found = false;
return this.hidden_form_elements.find(function(elem) {if (found && formField[elem.name]) { return true; }if (elem.name == current.name) { found = true; }return false;}.bind(this));
},
showNextField: function(focus) {
next_field = this.nextFormElement(this.first_form_field());
if (typeof(next_field)!="undefined") { this.showField(next_field, focus); return true; }
return false;
},
previousFormElement: function(current) {
last_item = null;
for (i = 0; i < this.hidden_form_elements.length; i++)
{
elem = $(this.hidden_form_elements[i].id);
if (last_item && (elem.name == current.name))
return last_item;
if (formField[elem.name]) { last_item = elem; }
}
},
showPrevField: function(focus) {
prev_field = this.previousFormElement(this.first_form_field());
if (prev_field)
{
this.showField(prev_field, focus);
return true;
}
return false;
},
backStep: function() {
page_count = page_count - 1;
this.saveTohiddenForm();
this.showPrevField(true);
},
addBefore: function(i, f, t) { this._addFields(i, f, t, 'before'); },
addAfter: function(i, f, t)  { this._addFields(i, f, t, 'after');  },
addTop: function(i, f, t)    { this._addFields(i, f, t, 'top');    },
addBottom: function(i, f, t) { this._addFields(i, f, t, 'bottom'); },
_addFields: function(form_index, fields, adjacent, before_or_after, cache) {
cache = cache || true;
if (typeof(fields) == 'string') { fields = fields.split(','); }
new_fields = '';
(fields || []).each(function(field)
{
if (!$(form_index + '_' + field + '_h'))
{
value = (this.json && this.json[field]) ? this.json[field] : '';
new_fields += "<input type=\"hidden\" id=\"" + form_index + "_" + field + "_h\" name=\"" + field + "\" value=\"" + value + "\">\n";
}
}.bind(this));
before_or_after = before_or_after.toLowerCase();
before_or_after = before_or_after.charAt(0).toUpperCase() + before_or_after.substring(1);
new Insertion[before_or_after](adjacent, new_fields);
if (cache)
this.hidden_form_elements = Form.getElements(this.hidden_form_elem);
},
eraseFields: function(form_index, fields) {
if (typeof(fields) == 'string') fields = fields.split(',');
fields.each(function(elem)
{
if (typeof(elem) == 'string') elem = $(form_index + '_' + elem + '_h');
if (elem) Element.remove(elem.id);
});
this.hidden_form_elements = Form.getElements(this.hidden_form_elem);
},
first_form_field: function() { return this.visible_form_elements.find(function(elem) {return formField[elem.name];}.bind(this)); }
};
function trackLead(site,form_index) {
expDays = 30;
expDate = new Date();
expDate.setTime(expDate.getTime() + (24 * 60 * 60 * 1000 * expDays));
source = "";
re = /[&?]source=([^&]+)/i;
matches = re.exec(window.location);
if (matches) source = matches[1];
campaign = "";
re = /[&?]campaign=([^&]+)/i;
matches = re.exec(window.location);
if (matches) campaign = matches[1];
ad = "";
re = /[&?]ad=([^&]+)/i;
matches = re.exec(window.location);
if (matches) ad = matches[1];
affp = "";
re = /[&?]affp=([^&]+)/i;
matches = re.exec(window.location);
if (matches) affp = matches[1];
rpt = "";
re = /[&?]rpt=([^&]+)/i;
matches = re.exec(window.location);
if (matches) rpt = matches[1];
ref_url = window.location + "";
referrer = document.referrer;
if(rpt == "")
{
if(affp != "" || source != "" || ad != "" || campaign != "")
{
setCookie('LeadpileFormUrl',window.location,expDate,'/');
}
else
{
url = getCookie('LeadpileFormUrl');
source = "";
re = /[&?]source=([^&]+)/i;
matches = re.exec(url);
if (matches) source = matches[1];
campaign = "";
re = /[&?]campaign=([^&]+)/i;
matches = re.exec(url);
if (matches) campaign = matches[1];
ad = "";
re = /[&?]ad=([^&]+)/i;
matches = re.exec(url);
if (matches) ad = matches[1];
affp = "";
re = /[&?]affp=([^&]+)/i;
matches = re.exec(url);
if (matches) affp = matches[1];
if(affp != "" || source != "" || ad != "" || campaign != "")
{
ref_url = url;
}
}
oldSource = getCookie('LeadpileFormSource');
if (oldSource && ((source == oldSource) || source == ''))
{
source		= oldSource;
referrer	= getCookie('LeadpileFormReferrer');
campaign	= getCookie('LeadpileFormCampaign');
ad			= getCookie('LeadpileFormAd');
}
else
{
setCookie('LeadpileFormSource',source,expDate, '/');
setCookie('LeadpileFormReferrer',referrer,expDate, '/');
setCookie('LeadpileFormCampaign',campaign,expDate, '/');
setCookie('LeadpileFormAd',ad,expDate,'/');
}
}
else
{
if(affp != "")
{
site = "Repeat Business";
campaign="";
source="";
ad="";
ref_url = "";
$(form_index + '_producer_h').value = affp;
}
}
$(form_index + '_came_from_h').value = ref_url;
$(form_index + '_site_h').value = site;
$(form_index + '_source_h').value = source;
$(form_index + '_campaign_h').value = campaign;
$(form_index + '_captcha_salt_h').value = captcha_salt;
$(form_index + '_ad_h').value = ad;
$(form_index + '_referrer_h').value = referrer;
}
function calcPayDate2(elem,pd1,pp)
{
var now = new Date();
var pd1a = pd1.split('-');
var pd1d = new Date();
pd1d.setFullYear(pd1a[2], pd1a[0] - 1, pd1a[1]);
if (pd1d.valueOf() < now.valueOf() + 864e2)
{
alert('The first pay date you chose is in the past.');
elem.value = '';
return false;
}
var new_date = pd1d.valueOf();
switch (pp)
{
case 'weekly': new_date += 7 * 60 * 60 * 24*1000; break;
case 'bi-weekly': new_date += 14 * 60 * 60 * 24*1000; break;
case 'monthly': new_date += 30 * 60 * 60 * 24*1000; break;
case 'twice_monthly': new_date += 14 * 60 * 60 * 24*1000; break;
}
new_date = new Date(parseInt(new_date));
var day = new_date.getDate();
if(day<10) day = "0" + day;
var month = new_date.getMonth() + 1;
if(month<10) month = "0" + month;
var year = new_date.getFullYear();
while(calHoliday(month + "-" + day + "-" + year) || new_date.getDay()%6==0)
{
new_date = new_date.valueOf();
new_date -= 60 * 60 * 24*1000;
new_date = new Date(parseInt(new_date));
day = new_date.getDate();
if(day<10) day = "0" + day;
month = new_date.getMonth() + 1;
if(month<10) month = "0" + month;
year = new_date.getFullYear();
}
elem.value = month + "-" + day + "-" + year;
return true;
}
function checkPayDate2(elem, pd1, pp)
{
pd2 = $F(elem);
now = new Date();
pd1a = pd1.split('-');
pd1d = new Date();
pd1d.setFullYear(pd1a[2], pd1a[0] - 1, pd1a[1]);
pd2a = pd2.split('-');
pd2d = new Date();
pd2d.setFullYear(pd2a[2], pd2a[0] - 1, pd2a[1]);
if (pd1d.valueOf() < now.valueOf() + 864e2)
{
alert('The first pay date you chose is in the past.');
elem.value = '';
return false;
}
if (pd2d.valueOf() < pd1d.valueOf() + 864e2)
{
alert('The second pay date you chose is sooner than the first.');
elem.value = '';
return false;
}
dd = Math.floor((pd2d.valueOf() - pd1d.valueOf()) / 864e5);
valid = 1;
switch (pp)
{
case 'weekly':if (dd != 7) valid = 0;break;
case 'bi-weekly':if (dd != 14) valid = 0;break;
case 'monthly':if (dd < 28 || dd > 31) valid = 0;break;
case 'twice_monthly':if (dd < 14 || dd > 16) valid = 0;break;
}
if (valid == 0 && !confirm('The second pay date you chose doesn\'t match your pay period, are you sure it\'s correct?'))
{
elem.value = '';
return false;
}
return true;
}
function fix_url(v)
{
v = v.replace(/\?/g,"}");
v = v.replace(/=/g,"{");
v = v.replace(/&/g,"|");
return escape(v);
}
function checkDegree(value)
{
if (value == 'null')
{
alert('Please select a valid degree program.');
return false;
}
return true;
}