/*
* common.js - Common functions
*/
function SetCookie(name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function getCookie(name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
return getCookieVal(j);
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function getTrackingUrl() {
return (document.location.pathname + document.location.search + document.location.hash);
}
function trimInput(input) {
if (input != null) {
return input.replace(/^\s*/, "").replace(/\s*$/, "");
}
return "";
}
function trimCustomerEmail(email) {
if (email != null) {
return email.replace(/^\s*/, "").replace(/\s*$/, "");
}
return "";
}
function trimText(text) {
if (text != null) {
return text.replace(/^\s*/, "").replace(/\s*$/, "");
}
return "";
}
function toggleCheckBox(checkBoxElement) {
if (checkBoxElement.checked == false)
checkBoxElement.checked = true;
else
checkBoxElement.checked = false;
}
function ValidateWelcome() {
if ((document.welcome.useeouserstatus != null && document.welcome.useeouserstatus.value == "true")) {
if (document.welcome.eouserstatus.value == "") {
document.welcome.eouserstatus.focus();
alert("Please select the way you plan to use our website.");
return false;
}
}
if ((document.welcome.usefn != null && document.welcome.usefn.value == "true") &&
! (document.welcome.optionalfn != null && document.welcome.optionalfn.value == "true")) {
if (document.welcome.custfname.value == "") {
document.welcome.custfname.focus();
alert("Please provide a first name.");
return false;
}
} else if ((document.welcome.usename != null && document.welcome.usename.value == "true") &&
! (document.welcome.optionalname != null && document.welcome.optionalname.value == "true")) {
if (document.welcome.custfname.value == "") {
document.welcome.custfname.focus();
alert("Please provide a first name.");
return false;
} else if (document.welcome.custlname.value == "") {
document.welcome.custlname.focus();
alert("Please provide a last name.");
return false;
}
}
if (! (document.welcome.optionalemail != null && document.welcome.optionalemail.value == "true") ||
(document.welcome.custemail.value.length >= 1 && document.welcome.custemail.value != "optional")) {
document.welcome.custemail.value = trimCustomerEmail(document.welcome.custemail.value);
if (document.welcome.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.welcome.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.welcome.custemail.value.indexOf("www.") == 0) {
document.welcome.custemail.focus();
alert("Please provide a valid email address by removing the 'www.' in front.");
return false;
}
}
if (document.welcome.custzip != null && document.welcome.custzip.value.search(/^\d{5}(-?\d{4})?$/) == -1) {
document.welcome.custzip.focus();
alert("Please provide a valid zip code.");
return false;
}
if ((document.welcome.usephone != null && document.welcome.usephone.value == "true") &&
(! (document.welcome.optionalphone != null && document.welcome.optionalphone.value == "true") ||
document.welcome.custphone.value.length > 0)) {
var phone = document.welcome.custphone.value;
if (phone.indexOf("-") > 0 || phone.indexOf(" ") > 0 || phone.indexOf("(") > 0 || phone.indexOf(")") > 0) {
phone = phone.replace(/-/g, "").replace(/ /g, "").replace(/\(/g, "").replace(/\)/g, "");
}
if (phone == "") {
document.welcome.custphone.focus();
alert("Please provide a telephone number.");
return false;
} else if (phone.search(/^\d{10}$/) == -1) {
document.welcome.custphone.focus();
alert("Please enter a full 10-digit telephone number, including the area code.");
return false;
} else {
document.welcome.custphone.value = phone.substring(0,3) + "-" + phone.substring(3,6) + "-" + phone.substring(6,10);
if (phone.length >= 3 && checkValidPhoneAreaCode(phone.substring(0,3)) == false) {
document.welcome.custphone.focus();
return false;
} else if (phone.length >= 6 && checkValidPhoneMiddleNumber(phone.substring(3,6)) == false) {
document.welcome.custphone.focus();
return false;
}
}
}
if ((document.welcome.useaddress != null && document.welcome.useaddress.value == "true") &&
! (document.eoform.optionaladdress != null && document.eoform.optionaladdress.value == "true")) {
if (document.welcome.custaddress.value == "") {
document.welcome.custaddress.focus();
alert("Please provide a street address.");
return false;
}
}
return true;
}
function ValidateEOForm() {
if ((document.eoform.useeouserstatus != null && document.eoform.useeouserstatus.value == "true")) {
if (document.eoform.eouserstatus.value == "") {
document.eoform.eouserstatus.focus();
alert("Please select the way you plan to use our website.");
return false;
}
}
if ((document.eoform.usefn != null && document.eoform.usefn.value == "true") &&
! (document.eoform.optionalfn != null && document.eoform.optionalfn.value == "true")) {
if (document.eoform.custfname.value == "") {
document.eoform.custfname.focus();
alert("Please provide a first name.");
return false;
}
} else if ((document.eoform.usename != null && document.eoform.usename.value == "true") &&
! (document.eoform.optionalname != null && document.eoform.optionalname.value == "true")) {
if (document.eoform.custfname.value == "") {
document.eoform.custfname.focus();
alert("Please provide a first name.");
return false;
} else if (document.eoform.custlname.value == "") {
document.eoform.custlname.focus();
alert("Please provide a last name.");
return false;
}
}
if (! (document.eoform.optionalemail != null && document.eoform.optionalemail.value == "true") ||
(document.eoform.custemail.value.length >= 1 && document.eoform.custemail.value != "optional")) {
document.eoform.custemail.value = trimCustomerEmail(document.eoform.custemail.value);
if (document.eoform.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.eoform.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.eoform.custemail.value.indexOf("www.") == 0) {
document.eoform.custemail.focus();
alert("Please provide a valid email address by removing the 'www.' in front.");
return false;
}
}
if (document.eoform.custzip != null && document.eoform.custzip.value.search(/^\d{5}(-?\d{4})?$/) == -1) {
document.eoform.custzip.focus();
alert("Please provide a valid zip code.");
return false;
}
if ((document.eoform.usephone != null && document.eoform.usephone.value == "true") &&
(! (document.eoform.optionalphone != null && document.eoform.optionalphone.value == "true") ||
document.eoform.custphone.value.length > 0)) {
var phone = document.eoform.custphone.value;
if (phone.indexOf("-") > 0 || phone.indexOf(" ") > 0 || phone.indexOf("(") > 0 || phone.indexOf(")") > 0) {
phone = phone.replace(/-/g, "").replace(/ /g, "").replace(/\(/g, "").replace(/\)/g, "");
}
if (phone == "") {
document.eoform.custphone.focus();
alert("Please enter a telephone number.");
return false;
} else if (phone.search(/^\d{10}$/) == -1) {
document.eoform.custphone.focus();
alert("Please enter a full 10-digit telephone number, including the area code.");
return false;
} else {
document.eoform.custphone.value = phone.substring(0,3) + "-" + phone.substring(3,6) + "-" + phone.substring(6,10);
if (phone.length >= 3 && checkValidPhoneAreaCode(phone.substring(0,3)) == false) {
document.eoform.custphone.focus();
return false;
} else if (phone.length >= 6 && checkValidPhoneMiddleNumber(phone.substring(3,6)) == false) {
document.eoform.custphone.focus();
return false;
}
}
}
if ((document.eoform.useaddress != null && document.eoform.useaddress.value == "true") &&
! (document.eoform.optionaladdress != null && document.eoform.optionaladdress.value == "true")) {
if (document.eoform.custaddress.value == "") {
document.eoform.custaddress.focus();
alert("Please provide a street address.");
return false;
}
}
return true;
}
function ValidateEOPForm() {
if (document.welcome.custzip != null && document.welcome.custzip.value.search(/^\d{5}(-?\d{4})?$/) == -1) {
document.welcome.custzip.focus();
alert("Please provide a valid zip code.");
return false;
}
if (! (document.welcome.optionalemail != null && document.welcome.optionalemail.value == "true") ||
(document.welcome.custemail.value.length >= 1 && document.welcome.custemail.value != "optional")) {
document.welcome.custemail.value = trimCustomerEmail(document.welcome.custemail.value);
if (document.welcome.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.welcome.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.welcome.custemail.value.indexOf("www.") == 0) {
document.welcome.custemail.focus();
alert("Please provide a valid email address by removing the 'www.' in front.");
return false;
}
}
if ((document.welcome.usefn != null && document.welcome.usefn.value == "true") &&
! (document.welcome.optionalfn != null && document.welcome.optionalfn.value == "true")) {
if (document.welcome.custfname.value == "") {
document.welcome.custfname.focus();
alert("Please provide a first name.");
return false;
}
}
if ((document.welcome.usephone != null && document.welcome.usephone.value == "true") &&
! (document.welcome.optionalphone != null && document.welcome.optionalphone.value == "true")) {
var phone = document.welcome.custphone.value;
if (phone.indexOf("-") > 0 || phone.indexOf(" ") > 0 || phone.indexOf("(") > 0 || phone.indexOf(")") > 0) {
phone = phone.replace(/-/g, "").replace(/ /g, "").replace(/\(/g, "").replace(/\)/g, "");
}
if (phone == "") {
document.welcome.custphone.focus();
alert("Please enter a telephone number.");
return false;
} else if (phone.search(/^\d{10}$/) == -1) {
document.welcome.custphone.focus();
alert("Please enter a full 10-digit telephone number, including the area code.");
return false;
} else {
document.welcome.custphone.value = phone.substring(0,3) + "-" + phone.substring(3,6) + "-" + phone.substring(6,10);
if (phone.length >= 3 && checkValidPhoneAreaCode(phone.substring(0,3)) == false) {
document.welcome.custphone.focus();
return false;
} else if (phone.length >= 6 && checkValidPhoneMiddleNumber(phone.substring(3,6)) == false) {
document.welcome.custphone.focus();
return false;
}
}
}
return true;
}
function ValidateLoginForm() {
document.login.custemail.value = trimInput(document.login.custemail.value);
if (document.login.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.login.custemail.focus();
alert("Please provide a valid email address.");
return false;
}
else if (document.login.custpassword.value == "") {
document.login.custpassword.focus();
alert("Password is required.");
return false;
}
return true;
}
function ValidateForgotPasswordForm() {
document.forgot.custemail.value = trimInput(document.forgot.custemail.value);
if (document.forgot.custemail.value == "") {
document.forgot.custemail.focus();
alert("Please enter email address.");
return false;
} else if (document.forgot.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.forgot.custemail.focus();
alert("Please provide a valid email address.");
return false;
}
return true;
}
function ShowHideDiv(id, pId, mId) {
var div = document.getElementById(id);
div.style.display = (div.style.display == 'none' ? 'block' : 'none');
if (pId && mId) {
var pdiv = document.getElementById(pId);
var mdiv = document.getElementById(mId);
pdiv.style.display = (mdiv.style.display == 'none' ? 'none' : 'block');
mdiv.style.display = (pdiv.style.display == 'none' ? 'block' : 'none');
}
}
function ShowHideDiv(id) {
var div = document.getElementById(id);
div.style.display = (div.style.display == 'none' ? 'block' : 'none');
}
function openTermsPopUp() {
helpwin = window.open('/terms-of-use.do', 'help','scrollbars=yes,toolbar=no,width=750,height=480');
helpwin.focus();
}
function openUFTermsPopUp() {
helpwin = window.open('/terms-of-use.html', 'help','scrollbars=yes,toolbar=no,width=750,height=480');
helpwin.focus();
}
function countredirect() {
if (currentsecond != 1) {
currentsecond -= 1;
}
else {
var changetext = document.getElementById("changetext");
if (counter == 1) {
counter = 2;
changetext.innerHTML = newtext2;
}
else if (counter == 2) {
counter = 3;
changetext.innerHTML = newtext3;
}
else if (counter == 3) {
counter = 1;
changetext.innerHTML = newtext1;
}
currentsecond = countdownfrom + 1;
}
setTimeout("countredirect()", 1000);
}
var xmlDoc = getXmlHttpObject();
function getXmlHttpObject() {
var _xmlHttp;
try {
_xmlHttp=new XMLHttpRequest();
}
catch (e) {
try {
_xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return _xmlHttp;
}
function NewWindow(url, width, height) {
strOption = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + width + ",height=" + height;
newWin = window.open(url, '_new', strOption);
newWin.focus();
}
function NewWindowTarget(url, target, width, height) {
strOption = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + width + ",height=" + height;
newWin = window.open(url, target, strOption);
newWin.focus();
}
function hidelayer(lay) {
var ie4 = (document.all) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
if (ie4) {
try {
document.all[lay].style.visibility = "hidden";
document.all[lay].style.display = "none";
} catch (e) {
}
}
if (ns6) {
try {
document.getElementById([lay]).style.visibility = "hidden";
document.getElementById([lay]).style.display = "none";
} catch (e) {
}
}
}
function showlayer(lay) {
var ie4 = (document.all) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
if (ie4) {
try {
document.all[lay].style.visibility = "visible";
document.all[lay].style.display = "block";
} catch (e) {
}
}
if (ns6) {
try {
document.getElementById([lay]).style.visibility = "visible";
document.getElementById([lay]).style.display = "block";
} catch (e) {
}
}
}
function hideMultipleLayers(lay) {
var ie4 = (document.all) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
var layers = lay.split(",");
if (ie4) {
for (i=0; i<layers.length; i++) {
try {
document.all[lay].style.visibility = "hidden";
document.all[lay].style.display = "none";
} catch (e) {
}
}
}
if (ns6) {
for (i=0; i<layers.length; i++) {
try {
document.getElementById([lay]).style.visibility = "hidden";
document.getElementById([lay]).style.display = "none";
} catch (e) {
}
}
}
}
function showMultipleLayers(lay) {
var ie4 = (document.all) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
var layers = lay.split(",");
if (ie4) {
for (i=0; i<layers.length; i++) {
try {
document.all[lay].style.visibility = "visible";
document.all[lay].style.display = "block";
} catch (e) {
}
}
}
if (ns6) {
for (i=0; i<layers.length; i++) {
try {
document.getElementById([lay]).style.visibility = "visible";
document.getElementById([lay]).style.display = "block";
} catch (e) {
}
}
}
}
function redirectToPage(url) {
document.location = url;
}
function promptRedirectToPage(url, msg) {
if (msg.length > 0) {
var ok = confirm(msg);
}
if (ok) {
document.location = url;
}
}
function resizeIframe(element,addHeight) {
var height = null;
try {
height = element.contentWindow.document.body.offsetHeight;
} catch (err) { }
if (height != null) {
if(typeof addHeight != 'undefined') {
height += addHeight;
}
height += "px";
element.style.height = height;
}
}
function processKISSmetrics(eventname,eventvalue) {
}
function safeThisSrc(elem,imagesrc) {
if(elem != null && imagesrc != null) {
if( elem.src.indexOf(imagesrc) < 0) {
elem.src=imagesrc;
}
}
}
function validateSearchQuery() {
if (document.search.queryText.value.length == 0 || document.search.queryText.value == "Enter ZIP or City, State") {
alert("Please enter a search query.");
document.search.queryText.focus();
return false;
}
}
function popupSearch() {
window.open("","popupWindow","scrollbars,resizable,width=1000,height=800");
window.setTimeout("document.search.submit();", 500);
}
function resetStateCounty() {
document.getElementById("state").selectedIndex = 0;
document.getElementById("county").selectedIndex = 0;
}
function gaTrackPageView(pageName) {
try {
_gaq.push(["_trackPageview", pageName]);
} catch (x) {
}
}
/*
* sales.js - Functions for Sales Pages
*/
/** Start - Generic functions **/
function openurl(url) {
if (window.opener != null) {
window.opener.location=url;
window.opener.focus();
window.close();
}
else {
window.location=url;
}
}
function parenturl(url) {
if (window.top != null) {
window.top.location=url;
window.top.focus();
}
else {
window.location=url;
}
}
function openerparenturl(url) {
if (window.opener.top != null) {
window.opener.top.location=url;
window.opener.top.focus();
window.close();
}
else {
window.location=url;
}
}
function opennewurl(url) {
if (window.opener != null) {
newWin = window.open(url);
newWin.focus();
window.close();
}
else {
newWin = window.open(url);
newWin.focus();
}
}
function openCenterWin(url, name, theWidth, theHeight, scrollbars){
var theTop = (screen.height/2)-(theHeight/2);
var theLeft = (screen.width/2)-(theWidth/2);
var features = 'scrollbars='+scrollbars+',toolbar=no,height='+theHeight+',width='+theWidth+',top='+theTop+',left='+theLeft;
theWin = window.open(url, name, features);
if (theWin.opener == null) theWin.opener = self;
theWin.focus();
}
function gotoPage(url) {
window.opener.location = url;
window.opener.focus();
window.close();
}
function getQueryStringVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split('=');
if (pair[0] == variable) {
return pair[1];
}
}
}
function hideDiv() {
document.getElementById('wthvideo').style.visibility = 'hidden';
}
/** End - Generic functions **/
/**  Start - Validate functions **/
function ValidateUnsubscribeForm() {
document.unsubscribe.email.value = trimInput(document.unsubscribe.email.value);
if (document.unsubscribe.email.value == "") {
document.unsubscribe.email.focus();
alert("Please enter email address.");
return false;
} else if (document.unsubscribe.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.unsubscribe.email.focus();
alert("Please enter a valid email address.");
return false;
}
return true;
}
function ValidateContactUsForm() {
document.contactUsForm.email.value = trimInput(document.contactUsForm.email.value);
if (document.contactUsForm.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.contactUsForm.email.focus();
alert("Please provide a valid email address.");
return false;
}
else if (document.contactUsForm.message.value == "") {
document.contactUsForm.message.focus();
alert("Message is required.");
return false;
}
return true;
}
function ValidateSmartSearch() {
if (document.smartsearch.searchstring.value == "" || document.smartsearch.searchstring.value == "City & State, or Zip") {
document.smartsearch.searchstring.focus();
alert("Please enter a valid search string.");
return false;
}
return true;
}
function ValidateWelcomeOpenerRedirect(url) {
if (ValidateWelcome() == true) {
var query = "";
if (url.indexOf("?") > 0) {
query += "&";
} else {
query += "?";
}
query += "post=true&";
if (document.welcome.promotion != null && document.welcome.promotion.checked == true) {
query+="promotion=true";
}
window.opener.eval("properClickThrough = true;");
window.opener.location.href=url+query+"&custemail="+document.welcome.custemail.value+"&custzip="+document.welcome.custzip.value;
window.opener.focus();
window.close();
}
return false;
}
function ValidateWelcomeParentRedirect(url) {
if (ValidateWelcome() == true) {
var query = "";
if (url.indexOf("?") > 0) {
query += "&";
} else {
query += "?";
}
query += "post=true&";
if (document.welcome.promotion != null && document.welcome.promotion.checked == true) {
query+="promotion=true";
}
window.top.eval("properClickThrough = true;");
window.top.location.href=url+query+"&custemail="+document.welcome.custemail.value+"&custzip="+document.welcome.custzip.value;
}
return false;
}
function ValidateWelcomeOpenerParentRedirect(url) {
if (ValidateWelcome() == true) {
var query = "";
if (url.indexOf("?") > 0) {
query += "&";
} else {
query += "?";
}
query += "post=true&";
if (document.welcome.promotion != null && document.welcome.promotion.checked == true) {
query+="promotion=true";
}
window.opener.top.eval("properClickThrough = true;");
window.opener.top.location.href=url+query+"&custemail="+document.welcome.custemail.value+"&custzip="+document.welcome.custzip.value;
window.opener.top.focus();
window.close();
}
return false;
}
function ValidateMainSearchEmail() {
document.mainsearch.custemail.value = trimCustomerEmail(document.mainsearch.custemail.value);
if (document.mainsearch.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.mainsearch.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.mainsearch.custemail.value.indexOf("www.") == 0) {
document.mainsearch.custemail.focus();
alert("Please provide a valid email address by removing the 'www.' in front.");
return false;
}
}
function validateCountySearch() {
if (document.search.state.selectedIndex == 0) {
alert("Please select a state and county");
return false;
} else if (document.search.county.selectedIndex == 0) {
alert("Please select a county");
return false;
}
}
function checkValidPhoneAreaCode(areaCode) {
var flag = false;
areaCode.scan('[2-9](?!(?=00|11|22|33|44|55|66|77|88))[0-8]\\d',function() {
flag = true;
});
if (flag!=true) {
alert("Please enter a valid area code.");
}
return flag;
}
function checkValidPhoneMiddleNumber(telephoneNumber) {
var flag = true;
telephoneNumber.scan('555|[01]\\d\\d',function() {
flag = false;
});
if (flag!=true) {
alert("Please enter a valid telephone number.");
}
return flag;
}
/**  End - Validate functions **/
/** Start - Homepage functions **/
function changeText() {
var changetext = document.getElementById("changetext");
var total = 1;
try {
total = numOfText;
}
catch (x) { }
var duration = 5000;
try {
duration = numOfSeconds * 1000;
}
catch (x) { }
if (total <= current) {
current = 0;
}
if (total > current) {
if (current == 0) {
changetext.innerHTML = text1;
}
else if (current == 1) {
changetext.innerHTML = text2;
}
else if (current == 2) {
changetext.innerHTML = text3;
}
else if (current == 3) {
changetext.innerHTML = text4;
}
else if (current == 4) {
changetext.innerHTML = text5;
}
else if (current == 5) {
changetext.innerHTML = text6;
}
else if (current == 6) {
changetext.innerHTML = text7;
}
else if (current == 7) {
changetext.innerHTML = text8;
}
else if (current == 8) {
changetext.innerHTML = text9;
}
else if (current == 9) {
changetext.innerHTML = text10;
}
current += 1;
}
if (total > 1) {
setTimeout("changeText()", duration);
}
}
function changeTestimonial() {
var changetext = document.getElementById("testimonialtext");
var total = 1;
try {
total = numOfTestimonial;
}
catch (x) { }
var durationTestimonial = 5000;
try {
durationTestimonial = numOfSecondsTestimonial * 1000;
}
catch (x) { }
if (total <= currentTestimonial) {
currentTestimonial = 0;
}
if (total > currentTestimonial) {
if (currentTestimonial == 0) {
changetext.innerHTML = testimonial1;
}
else if (currentTestimonial == 1) {
changetext.innerHTML = testimonial2;
}
else if (currentTestimonial == 2) {
changetext.innerHTML = testimonial3;
}
else if (currentTestimonial == 3) {
changetext.innerHTML = testimonial4;
}
else if (currentTestimonial == 4) {
changetext.innerHTML = testimonial5;
}
else if (currentTestimonial == 5) {
changetext.innerHTML = testimonial6;
}
else if (currentTestimonial == 6) {
changetext.innerHTML = testimonial7;
}
else if (currentTestimonial == 7) {
changetext.innerHTML = testimonial8;
}
else if (currentTestimonial == 8) {
changetext.innerHTML = testimonial9;
}
else if (currentTestimonial == 9) {
changetext.innerHTML = testimonial10;
}
currentTestimonial += 1;
}
if (total > 1) {
setTimeout("changeTestimonial()", durationTestimonial);
}
}
/** End - Homepage functions **/
/** Start - Popup page functions **/
function closePopup() {
window.close();
}
function openRepExamplesPopUp() {
helpwin = window.open('/sales/rep/get-listed-screenshots.jsp', 'content','scrollbars=yes,toolbar=no,width=560,height=530')
helpwin.focus();
}
function openHFRepExamplesPopUp() {
helpwin = window.open('/sales/rep/get-listed-screenshots-hf.jsp', 'content','scrollbars=no,toolbar=no,width=560,height=530')
helpwin.focus();
}
function openFFContactUsPopUp() {
openCenterWin("/contact-form.do", "_blank", 648, 600, "yes");
}
function openFlashTutorial() {
openCenterWin("http://" + location.host + "/member/tutorial.jsp","flashTutorial",680,480);
}
function openTutorial(url) {
openCenterWin(url, 'htmlTutorial', 780, 480, 'yes');
if (window.opener != null) {
window.close();
}
}
function openPrivacyPopUp() {
helpwin = window.open('/privacy-policy.do', 'help','scrollbars=yes,toolbar=no,width=750,height=480');
helpwin.focus();
}
function openContactUsPopUp() {
helpwin = window.open('/contact-form.do', 'help','scrollbars=yes,toolbar=no,width=794,height=548')
helpwin.focus();
}
/** End - Popup page functions **/
/** Start - SRP page functions **/
function openPropertyDetails(url) {
var sound = document.getElementById("sound")
if (sound) {
sound.src = "/img/click.wav";
}
newWin = window.open(url,'_blank','scrollbars=yes,toolbar=no,resizable=yes,width=768,height=540');
newWin.focus();
}
function showListingMessage(url) {
var status = confirm("You must LOG IN to view property details. Click \"OK\" to create a username and password.");
if (status) {
document.location.href = url;
}
}
function showSortByMessage(url) {
var status = confirm("This feature is available for REGISTERED MEMBERS only. Click \"OK\" to complete registration.");
if (status) {
document.location.href = url;
}
}
function showIconMessage(url) {
var status = confirm("This feature is available for REGISTERED MEMBERS only. Click \"OK\" to complete registration.");
if (status) {
document.location.href = url;
}
}
function editSavedTeaserItem(propertyid,checkboxID) {
var checkedValue;
if($(checkboxID).checked == true) {
checkedValue = "false";
} else {
checkedValue = "true";
}
editSavedTeaser(propertyid,checkedValue);
}
function editSavedTeaserItemAndToggleHide(propertyid,id) {
if(typeof editSavedTeaserItemAndToggleHide.checked =='undefined') editSavedTeaserItemAndToggleHide.checked="false";
if(editSavedTeaserItemAndToggleHide.checked == "true") {
$(id).show();
editSavedTeaserItemAndToggleHide.checked = "false";
} else {
$(id).hide();
editSavedTeaserItemAndToggleHide.checked = "true";
}
editSavedTeaser(propertyid,editSavedTeaserItemAndToggleHide.checked);
}
function editSavedTeaser(propertyid,flag) {
new Ajax.Request('/sales/nottobesaved.do?nottobesaved='+flag+'&propertyid='+propertyid);
}
/** End - SRP page functions **/
/** Start - Interstitial/Confirmation page functions **/
function getUpSellRegistration(productId,regProductId, transactionId, prodCampaignId, uType, formId, formName) {
var strURL = '/reg-upsell-serv.do';
xmlHttp = getXmlHttpObject();
strURL += '?utype=' + uType + '&formId=' + formId + '&formName=' + formName;
xmlHttp.onreadystatechange= setProcessUpSellRegistration;
xmlHttp.open("GET",strURL,true);
xmlHttp.send(null);
}
function setProcessUpSellRegistration() {
if (xmlHttp.readyState == 4) {
var _response = xmlHttp.responseXML;
var xroot = _response.getElementsByTagName('upsell-form').item(0);
var upsellResponse = "0";
var formId = "0";
var formName = "0";
var initialPageLoad = "i";
var successResponse = "s";
var failedResponse  = "f";
var preDisplay = "";
var postDisplay = "";
var imagePrefix = "i";
var preImageDisplay = "";
var postImageDisplay = "";
try {
upsellResponse = xroot.getElementsByTagName('feedback')[0].childNodes[0].nodeValue;
}
catch(e) { }
try {
formId = xroot.getElementsByTagName('formId')[0].childNodes[0].nodeValue;
}
catch(e) { }
try {
formName = xroot.getElementsByTagName('formName')[0].childNodes[0].nodeValue;
}
catch(e) { }
preDisplay = formName + initialPageLoad;
preImageDisplay = formName + imagePrefix + initialPageLoad;
hidelayer(preDisplay);
hidelayer(preImageDisplay);
if (upsellResponse == '1') {
postDisplay = formName + successResponse;
postImageDisplay = formName + imagePrefix + successResponse;
}
else {
postDisplay = formName + failedResponse;
postImageDisplay = formName + imagePrefix + failedResponse;
}
showlayer(postDisplay);
showlayer(postImageDisplay);
selectNextMethod(formId);
}
}
function displayProcessUpSellRegistration() {
hidelayer("submitButton");
hidelayer("feedback-pre");
showlayer("feedback-post");
setTimeout('processInterstitialConfirmation()', 3000);
}
function processInterstitialUpGrade(productId, regProductId, transactionId, campaignId, prodCampaignId, uType, formId, formName) {
hidelayer("submitButton");
showlayer("feedback-pre");
getUpSellRegistration(productId, regProductId, transactionId, prodCampaignId, uType, formId, formName);
}
function processUpsell(productId, regProductId, transactionId, campaignId, prodCampaignId, uType, formId, formName) {
processInterstitialUpGrade(productId, regProductId, transactionId, campaignId, prodCampaignId, uType, formId, formName);
}
function processInterstitialConfirmation() {
document.getElementById("interstitial").submit();
}
function displayProductDescription(productId)  {
document.all.description.innerHTML = description[productId];
}
/** End - Interstitial/Confirmation page functions **/
/** Start - Lightbox functions **/
function ShowEBookDiv() {
document.getElementById("bglayer").style.display = "inline";
document.getElementById("bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("eBookDiv").style.left = Math.round((document.body.clientWidth/2)-(600/2)) + "px";
document.getElementById("eBookDiv").style.top = "70px";
scroll(0,0);
}
function hideEBookDiv() {
document.getElementById("bglayer").style.display = "none";
}
function showCCVerificationDiv() {
unhideCCVerificationDiv();
gaTrackPageView("upsell-lightbox-ccverify");
}
function unhideCCVerificationDiv() {
document.upsellOfferFormAccept.lightboxDisplay.value = "ccVerification";
document.getElementById("bglayer").style.display = "inline";
document.getElementById("bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("ccVerificationDiv").style.left = Math.round((document.body.clientWidth/2)-(document.getElementById("ccVerificationDiv").offsetWidth/2)) + "px";
document.getElementById("ccVerificationDiv").style.top = (getScrollTop() + 70) + "px";
}
function hideCCVerificationDiv() {
document.getElementById("bglayer").style.display = "none";
gaTrackPageView(getTrackingUrl());
}
function showOrderVerificationDiv() {
document.upsellOfferFormAccept.lightboxDisplay.value = "orderVerification";
document.getElementById("bglayer").style.display = "inline";
document.getElementById("bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("orderVerificationDiv").style.left = Math.round((document.body.clientWidth/2)-(document.getElementById("orderVerificationDiv").offsetWidth/2)) + "px";
document.getElementById("orderVerificationDiv").style.top = (getScrollTop() + 100) + "px";
gaTrackPageView("upsell-lightbox-orderverify");
}
function hideOrderVerificationDiv() {
document.getElementById("bglayer").style.display = "none";
gaTrackPageView(getTrackingUrl());
}
function showAddUserDiv() {
unhideAddUserDiv();
gaTrackPageView("upsell-lightbox-addUser");
}
function unhideAddUserDiv() {
document.upsellOfferFormAccept.lightboxDisplay.value = "addUser";
document.getElementById("bglayer").style.display = "inline";
document.getElementById("bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("addUserDiv").style.left = Math.round((document.body.clientWidth/2)-(document.getElementById("addUserDiv").offsetWidth/2)) + "px";
document.getElementById("addUserDiv").style.top = (getScrollTop() + 100) + "px";
}
function hideAddUserDiv() {
document.getElementById("bglayer").style.display = "none";
gaTrackPageView(getTrackingUrl());
}
function showOrderConfirmationDiv() {
document.upsellOfferFormAccept.lightboxDisplay.value = "orderConfirmation";
document.getElementById("confirmation-bglayer").style.display = "inline";
document.getElementById("confirmation-bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("orderConfirmationDiv").style.left = Math.round((document.body.clientWidth/2)-(document.getElementById("orderConfirmationDiv").offsetWidth/2)) + "px";
document.getElementById("orderConfirmationDiv").style.top = (getScrollTop() + 100) + "px";
gaTrackPageView("upsell-lightbox-orderconfirm");
}
function hideOrderConfirmationDiv() {
document.getElementById("bglayer").style.display = "none";
gaTrackPageView(getTrackingUrl());
}
function showMessageDiv(propertyid) {
document.messagediv.propertyid.value = propertyid;
document.getElementById("message-bglayer").style.display = "inline";
document.getElementById("message-bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("messageDiv").style.left = Math.round((document.body.clientWidth/2)-(document.getElementById("messageDiv").offsetWidth/2)) + "px";
document.getElementById("messageDiv").style.top = (getScrollTop() + 100) + "px";
gaTrackPageView("srp-lightbox-message");
}
function closeMessageDiv() {
document.getElementById("message-bglayer").style.display = "none";
gaTrackPageView(getTrackingUrl());
}
function showPropertyDetailsDiv(url) {
document.getElementById("propertydetails-bglayer").style.display = "inline";
document.getElementById("propertydetails-bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("propertyDetailsDiv").style.left = Math.round((document.body.clientWidth/2)-(document.getElementById("propertyDetailsDiv").offsetWidth/2)) + "px";
document.getElementById("propertyDetailsDiv").style.top = (getScrollTop() + 15) + "px";
document.getElementById("propertyDetailsFrame").src = "";
var ifrm = document.getElementById("propertyDetailsFrame");
ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
ifrm.document.open();
ifrm.document.write("<html><body><div align='center' style='margin-top:200px;'><img src='/img/loading.gif' alt=''/></div></body></html>");
ifrm.document.close();
document.getElementById("propertyDetailsFrame").src = url;
gaTrackPageView("srp-lightbox-details");
}
function closePropertyDetailsDiv() {
document.getElementById("propertydetails-bglayer").style.display = "none";
document.getElementById("propertyDetailsFrame").src = "";
gaTrackPageView(getTrackingUrl());
}
function showEOFormDiv(propertyid) {
document.eoform.propertyid.value = propertyid;
unhideEOFormDiv();
gaTrackPageView("srp-lightbox-eoform");
}
function unhideEOFormDiv() {
document.getElementById("eoform-bglayer").style.display = "inline";
document.getElementById("eoform-bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("eoFormDiv").style.left = Math.round((document.body.clientWidth/2)-(document.getElementById("eoFormDiv").offsetWidth/2)) + "px";
document.getElementById("eoFormDiv").style.top = (getScrollTop() + 100) + "px";
}
function closeEOFormDiv() {
document.getElementById("eoform-bglayer").style.display = "none";
gaTrackPageView(getTrackingUrl());
}
function showREPLeadFormDiv() {
unhideREPLeadFormDiv();
if (document.replead.displaytype.value == "step1") {
gaTrackPageView("srp#eoform-shown");
} else if (document.replead.displaytype.value == "step2") {
gaTrackPageView("srp-rep-lightbox#lead-form-shown");
}
}
function unhideREPLeadFormDiv() {
document.getElementById("replead-bglayer").style.display = "inline";
document.getElementById("replead-bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("repLeadDiv").style.left = Math.round((document.body.clientWidth/2)-(document.getElementById("repLeadDiv").offsetWidth/2)) + "px";
document.getElementById("repLeadDiv").style.top = (getScrollTop() + 85) + "px";
}
function closeREPLeadFormDiv() {
document.getElementById("replead-bglayer").style.display = "none";
gaTrackPageView(getTrackingUrl());
}
function showReportSampleDiv() {
window.location.hash = "reportSampleDiv";
try {
_gaq.push(['_trackPageview', getTrackingUrl()]);
} catch (x) {
}
document.getElementById("reportsample-bglayer").style.display = "inline";
document.getElementById("reportsample-bglayer").style.height = document.body.clientHeight + "px";
document.getElementById("reportSampleDiv").style.left = Math.round((document.body.clientWidth/2)-(722/2)) + "px";
document.getElementById("reportSampleDiv").style.top = (getScrollTop() + 15) + "px";
if (document.welcome.linkAction.value == "5") {
document.getElementById("frameTd").style.height = "400px";
document.getElementById("reportSampleDiv").style.height = "400px";
document.getElementById("reportSampleFrame").style.height = "390px";
}
var ifrm = document.getElementById("reportSampleFrame");
ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
ifrm.document.open();
ifrm.document.write("<html><body><div align='center' style='margin-top:160px;'><img src='/img/loading.gif' alt=''/></div></body></html>");
ifrm.document.close();
document.getElementById("reportSampleFrame").src = "http://www.smartzip.com/html/sample.html";
}
function closeReportSampleDiv() {
document.getElementById("reportsample-bglayer").style.display = "none";
document.getElementById("reportSampleFrame").src = "";
}
function closeDiv() {
document.getElementById("bglayer").style.display = "none";
}
function getScrollTop() {
var scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
scrOfY = window.pageYOffset;
} else if( document.body && document.body.scrollTop) {
scrOfY = document.body.scrollTop;
} else if( document.documentElement && document.documentElement.scrollTop) {
scrOfY = document.documentElement.scrollTop;
}
return scrOfY;
}
/** End - Lightbox functions **/
/** Start - FAQs page functions **/
function expand(strId, qn, ans, status) {
var question = document.getElementById("faq" + strId);
var answer = document.getElementById("ans" + strId);
if (status == "true") {
question.innerHTML = "<a class='hyperlinktext' href=\"javascript: expand('" + strId + "', '" + qn + "', '" + ans + "', 'false')\"><u>" + qn + "</u></a>";
answer.innerHTML = ans + "<br/><br/>";
}
else if (status == "false") {
question.innerHTML = "<a class='hyperlinktext' href=\"javascript: expand('" + strId + "', '" + qn + "', '" + ans + "', 'true')\"><u>" + qn + "</u></a>";
answer.innerHTML = "";
}
}
/** End - FAQs page functions **/
/** Start - Account page functions **/
function modifyButton1(domElement) {
domElement.style.cursor = "wait";
domElement.onmouseover = "this.style.cursor='wait'";
domElement["onclick"] = "";
document.button1Form.submit();
}
function modifyButton2(domElement) {
domElement.style.cursor = "wait";
domElement.onmouseover = "this.style.cursor='wait'";
domElement["onclick"] = "";
document.button2Form.submit();
}
function modifyExtendButton(domElement) {
domElement.style.cursor = "wait";
domElement.onmouseover = "this.style.cursor='wait'";
domElement["onclick"] = "";
document.membershipExtendForm.submit();
}
/** End - Account page functions **/
function checkCCDetailsPopupForm() {
if (document.upsellOfferFormAccept.ccnumber.value.indexOf("-") > 0) {
document.upsellOfferFormAccept.ccnumber.value = document.offer.ccnumber.value.replace(/-/g, "");
}
if (isNaN(document.upsellOfferFormAccept.ccnumber.value) || document.upsellOfferFormAccept.ccnumber.value.length != 4) {
document.upsellOfferFormAccept.ccnumber.focus();
alert("Please enter last 4 digits of Credit Card #");
return false;
}
return true;
}
function createTestimonialsPagination() {
document.body.onhashchange = function() {
if (document.testimonials.status.value == "0") {
loadTestimonialPage(0);
}
document.testimonials.status.value = "0";
}
var numOfPages = document.testimonials.numOfPages.value;
for (i=1; i <= numOfPages; i++) {
x = document.getElementById("testimonials-page-" + i);
x.style.visibility = "hidden";
x.style.display = "none";
}
showlayer("testimonials-page-1");
loadTestimonialPage(0);
}
function goToTestimonialPage(page) {
loadTestimonialPage(page);
document.testimonials.status.value = "1";
}
function loadTestimonialPage(page) {
var pageid = "page";
var updatehash = true;
if (page == 0) {
try {
if (window.location.hash.substring(1,5) == pageid) {
page = parseInt(window.location.hash.substring(5));
}
} catch (err) { }
}
if (page == 0) {
updatehash = false;
page = 1;
}
var numOfPages = document.testimonials.numOfPages.value;
for (i=1; i <= numOfPages; i++) {
x = document.getElementById("testimonials-page-" + i);
x.style.visibility = "hidden";
x.style.display = "none";
}
showlayer("testimonials-page-" + page);
updateTestimonialsPagination(page);
if (updatehash) {
window.location.hash = pageid + page;
}
var leftbg = document.getElementById("leftbg");
if (leftbg != null) {
leftbg.style.backgroundImage = "url('/images/realtystore/sales/testimonials/lhs_bg_pg" + page + ".jpg')";
}
}
function updateTestimonialsPagination(currentPage) {
var pagingMaxSize = 10;
var numOfPages = document.testimonials.numOfPages.value;
var paginationHtml = "";
if (currentPage > 1) {
paginationHtml += "<a style='font-size:10px; font-family:verdana;' href='javascript:goToTestimonialPage(" + (currentPage - 1) + ")'>&lt;&lt; prev&hellip;</a>&#160;<span class='paging-separator'>&#160;</span>";
}
var start = 1;
if (numOfPages > pagingMaxSize) {
if (currentPage > (pagingMaxSize/2)) {
start = currentPage - (pagingMaxSize/2);
}
if (numOfPages - start < pagingMaxSize) {
start = numOfPages - (pagingMaxSize - 1);
}
}
var count = 0;
for (i=start; i <= numOfPages && count < pagingMaxSize; i++) {
count += 1;
paginationHtml += "<a href='javascript:goToTestimonialPage(" + i + ")' class='paging";
if (currentPage == i) {
paginationHtml += " highlighted";
}
paginationHtml += "'>" + i + "</a>";
paginationHtml += "<span class='paging-separator'>&#160;</span>";
}
if (currentPage < numOfPages) {
paginationHtml += "<span class='paging-separator'>&#160;</span><a style='font-size:10px; font-family:verdana;' href='javascript:goToTestimonialPage(" + (currentPage + 1) + ")'>&hellip;next &gt;&gt;</a>";
}
document.getElementById("pagination-area").innerHTML = paginationHtml;
}
function offerAccept() {
if (document.upsellOfferFormAccept.lightboxDisplay.value == "ccVerification") {
if (checkCCDetailsPopupForm() == false) {
return false;
}
document.getElementById("submitCCVerification").disabled = true;
var html = "";
html += "<div id='processing-text-small'>Processing order. Please wait...</div>";
html += "<div align='center'><img src='/branding/images/loading_small.gif'/></div>";
document.getElementById("buttonContentCCVerificationDiv").innerHTML = html;
gaTrackPageView("upsell-lightbox-ccverify-submitted");
} else if (document.upsellOfferFormAccept.lightboxDisplay.value == "orderVerification") {
document.getElementById("submitOrderVerification").disabled = true;
var html = "";
html += "<div id='processing-text-small'>Processing order. Please wait...</div>";
html += "<div align='center'><img src='/branding/images/loading_small.gif'/></div>";
document.getElementById("buttonContentOrderVerificationDiv").innerHTML = html;
gaTrackPageView("upsell-lightbox-orderverify-submitted");
} else if (document.upsellOfferFormAccept.lightboxDisplay.value == "addUser") {
if (checkAddUserForm() == false) {
return false;
}
document.getElementById("submitAddUser").disabled = true;
var html = "";
html += "<div id='processing-text-small'>Processing order. Please wait...</div>";
html += "<div align='center'><img src='/branding/images/loading_small.gif'/></div>";
document.getElementById("buttonContentAddUserDiv").innerHTML = html;
gaTrackPageView("upsell-lightbox-adduser-submitted");
} else {
document.getElementById("submitOffer").disabled = true;
var html = "";
html += "<div id='processing-text-large'>Processing order. Please wait...</div>";
html += "<div align='center'><img src='/branding/images/loading_med.gif'/></div>";
document.getElementById("buttonContent").style.visibility = "hidden";
document.getElementById("buttonContent").style.display = "none";
document.getElementById("processingContent").innerHTML = html;
document.getElementById("processingContent").style.visibility = "visible";
document.getElementById("processingContent").style.display = "block";
}
return true;
}
function checkAddUserForm() {
document.upsellOfferFormAccept.custemail.value = trimCustomerEmail(document.upsellOfferFormAccept.custemail.value);
if (document.upsellOfferFormAccept.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.upsellOfferFormAccept.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.upsellOfferFormAccept.custphone.value == "") {
document.upsellOfferFormAccept.custphone.focus();
alert("Please provide a telephone number.");
return false;
}
if (document.upsellOfferFormAccept.custphone.value.length > 0) {
var phone = document.upsellOfferFormAccept.custphone.value;
if (phone.indexOf("-") > 0 || phone.indexOf(" ") > 0 || phone.indexOf("(") > 0 || phone.indexOf(")") > 0) {
phone = phone.replace(/-/g, "").replace(/ /g, "").replace(/\(/g, "").replace(/\)/g, "");
}
if (phone == "") {
document.upsellOfferFormAccept.custphone.focus();
alert("Please provide a telephone number.");
return false;
} else if (phone.search(/^\d{10}$/) == -1) {
document.upsellOfferFormAccept.custphone.focus();
alert("Please enter a full 10-digit telephone number, including the area code.");
return false;
} else {
document.upsellOfferFormAccept.custphone.value = phone.substring(0,3) + "-" + phone.substring(3,6) + "-" + phone.substring(6,10);
if (phone.length >= 3 && checkValidPhoneAreaCode(phone.substring(0,3)) == false) {
document.upsellOfferFormAccept.custphone.focus();
return false;
} else if (phone.length >= 6 && checkValidPhoneMiddleNumber(phone.substring(3,6)) == false) {
document.upsellOfferFormAccept.custphone.focus();
return false;
}
}
}
if (document.upsellOfferFormAccept.tccheck.checked == false) {
alert("You need to agree the terms and conditions to continue....");
return false;
}
return true;
}
function upsellDecline() {
document.getElementById("submitDecline").disabled = true;
return true;
}
function upsellConfirm() {
document.getElementById("submitConfirm1").disabled = true;
document.getElementById("submitConfirm2").disabled = true;
var html = "";
html += "<div id='processing-text-small'>Please wait...</div>";
html += "<div align='center'><img src='/branding/images/loading_small.gif'/></div>";
document.getElementById("buttonContentOrderConfirmationDiv").innerHTML = html;
gaTrackPageView("upsell-lightbox-orderconfirm-submitted");
return true;
}
function checkREPLeadFormSubmit() {
if (validateREPLeadForm()) {
if (document.replead.submitted.value == "false") {
document.replead.submitted.value = "true";
if (document.replead.displaytype.value == "step1"
&& document.replead.contactbyrep != null
&& document.replead.contactbyrep.checked) {
gaTrackPageView("srp-eoform#rep-checkbox-selected");
document.replead.checkemail.value = document.replead.custemail.value;
document.replead.checkzip.value = document.replead.custzip.value;
submitREPEO(true);
return false;
} else if (document.replead.displaytype.value == "step2"
|| document.replead.displaytype.value == "step1and2") {
if (document.replead.checkemail.value != document.replead.custemail.value ||
document.replead.checkzip.value != document.replead.custzip.value) {
submitREPEO(false);
}
if (document.replead.processed.value != "true") {
if (document.replead.displaytype.value == "step2") {
gaTrackPageView("srp-rep-lightbox#lead-form-submitted");
} else if (document.replead.displaytype.value == "step1and2") {
gaTrackPageView("srp-rep-lightbox#eo-and-lead-form-submitted");
}
submitREPLead();
closeREPLeadFormDiv();
return false;
}
} else {
submitREPEO(false);
closeREPLeadFormDiv();
return false;
}
} else {
alert("Please wait while we process your request.");
return false;
}
} else {
document.replead.submitted.value = "false";
return false;
}
}
function submitREPEO(checkValidZip) {
var getURL = "eorpost.ajax";
if (checkValidZip) {
getURL = '/eorpost-checkzip.ajax';
}
xmlHttp = getXmlHttpObject();
var params = "custemail=" + document.replead.custemail.value + "&";
params += "custzip=" + document.replead.custzip.value;
xmlHttp.open("POST", getURL, true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
if (checkValidZip) {
xmlHttp.onreadystatechange = checkREPEOValidZipStatus;
}
xmlHttp.send(params);
}
function checkREPEOValidZipStatus() {
if (xmlHttp.readyState == 4) {
var response = xmlHttp.responseText;
if (response == "true") {
gaTrackPageView("srp-rep-lightbox#lead-form-shown");
document.replead.submitted.value = "false";
document.replead.displaytype.value = "step1and2";
document.getElementById("repLeadStep2").style.visibility = "visible";
document.getElementById("repLeadStep2").style.display = "block";
document.getElementById("repLeadDiv").style.height = "470px";
} else {
closeREPLeadFormDiv();
}
}
}
function submitREPLead() {
var getURL = '/Membersite/lead.ajax?type=agent';
xmlHttp = getXmlHttpObject();
var params = "leadType=agent&";
params += "idBrand=" + document.replead.brandid.value + "&";
params += "adid=" + document.replead.adid.value + "&";
params += "captureLocation=" + document.replead.capturelocation.value + "&";
params += "formType=" + document.replead.formtype.value + "&";
params += "firstName=" + document.replead.custfname.value + "&";
params += "lastName=" + document.replead.custlname.value + "&";
params += "phone=" + document.replead.custphone.value + "&";
if (document.replead.lookingto.value != "") {
params += "agentLeadType=" + document.replead.lookingto.value + "&";
}
if (document.replead.propertytype.value != "") {
params += "propertyRecordType=" + document.replead.propertytype.value + "&";
}
if (document.replead.timeframe.value != "") {
params += "timeFrame=" + document.replead.timeframe.value + "&";
}
if (document.replead.timetocontact.value != "") {
params += "bestContactTime=" + document.replead.timetocontact.value + "&";
}
var email = document.replead.checkemail.value;
var zip = document.replead.checkzip.value;
if (document.replead.displaytype.value == "step1and2") {
email = document.replead.custemail.value;
zip = document.replead.custzip.value;
}
params += "email=" + email + "&";
params += "zip=" + zip + "&";
if (document.replead.lookingto.value == "buy"
|| document.replead.lookingto.value == "buy_sell") {
params += "zipcodes=" + zip + "&";
}
if (document.replead.lookingto.value == "sell"
|| document.replead.lookingto.value == "buy_sell") {
params += "sellZIP=" + zip + "&";
}
var minprice = "";
var maxprice = "";
if (document.replead.pricerange.value == "___50k") {
maxprice = "50000";
} else if (document.replead.pricerange.value == "50k___150k") {
minprice = "50000";
maxprice = "150000";
} else if (document.replead.pricerange.value == "150k___250k") {
minprice = "150000";
maxprice = "250000";
} else if (document.replead.pricerange.value == "250k___500k") {
minprice = "250000";
maxprice = "500000";
} else if (document.replead.pricerange.value == "500k___1m") {
minprice = "500000";
maxprice = "1000000";
} else if (document.replead.pricerange.value == "1m___") {
minprice = "1000000";
}
if (minprice != "") {
params += "minPrice=" + minprice + "&";
}
if (maxprice != "") {
params += "maxPrice=" + maxprice + "&";
}
if (document.replead.displaytype.value == "step2") {
xmlHttp.open("POST", getURL, true);
} else {
xmlHttp.open("POST", getURL, false);
}
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.onreadystatechange = checkREPLeadStatus;
xmlHttp.send(params);
}
function checkREPLeadStatus() {
if (xmlHttp.readyState == 4) {
var response = xmlHttp.responseText;
if (response == "success") {
} else if (response == "failed") {
gaq.push(['_trackEvent', 'REPLeadForm', 'response', 'failed']);
}
}
}
function validateREPLeadForm() {
if (document.replead.displaytype.value == "step1") {
return validateREPLeadFormStep1();
} else if (document.replead.displaytype.value == "step2") {
return validateREPLeadFormStep2();
} else if (document.replead.displaytype.value == "step1and2") {
return (validateREPLeadFormStep1() && validateREPLeadFormStep2());
}
}
function validateREPLeadFormStep1() {
document.replead.custemail.value = trimCustomerEmail(document.replead.custemail.value);
if (document.replead.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.replead.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.replead.custzip.value.search(/^\d{5}(-?\d{4})?$/) == -1) {
document.replead.custzip.focus();
alert("Please provide a valid zip code.");
return false;
}
return true;
}
function validateREPLeadFormStep2() {
document.replead.custfname.value = trimText(document.replead.custfname.value);
document.replead.custlname.value = trimText(document.replead.custlname.value);
if (document.replead.custfname.value == "") {
document.replead.custfname.focus();
alert("Please provide first name.");
return false;
} else if (document.replead.custlname.value == "") {
document.replead.custlname.focus();
alert("Please provide last name.");
return false;
} else if (document.replead.custphone.value == "") {
document.replead.custphone.focus();
alert("Please provide a telephone number.");
return false;
}
if (document.replead.custphone.value.length > 0) {
var phone = document.replead.custphone.value;
if (phone.indexOf("-") > 0 || phone.indexOf(" ") > 0 || phone.indexOf("(") > 0 || phone.indexOf(")") > 0) {
phone = phone.replace(/-/g, "").replace(/ /g, "").replace(/\(/g, "").replace(/\)/g, "");
}
if (phone == "") {
document.replead.custphone.focus();
alert("Please provide a telephone number.");
return false;
} else if (phone.search(/^\d{10}$/) == -1) {
document.replead.custphone.focus();
alert("Please enter a full 10-digit telephone number, including the area code.");
return false;
} else {
document.replead.custphone.value = phone.substring(0,3) + "-" + phone.substring(3,6) + "-" + phone.substring(6,10);
if (phone.length >= 3 && checkValidPhoneAreaCode(phone.substring(0,3)) == false) {
document.replead.custphone.focus();
return false;
} else if (phone.length >= 6 && checkValidPhoneMiddleNumber(phone.substring(3,6)) == false) {
document.replead.custphone.focus();
return false;
}
}
}
if (document.replead.lookingto.value == "") {
document.replead.lookingto.focus();
alert("Please select the way you plan to use our site.");
return false;
}  else if (document.replead.pricerange.value == "") {
document.replead.pricerange.focus();
alert("Please select Price Range.");
return false;
}
return true;
}
function checkREPLeadFormDisplay() {
if (document.replead.displaytype.value == "step1and2"
&& ! document.replead.contactbyrep.checked) {
document.replead.submitted.value = "false";
document.replead.displaytype.value = "step1";
document.getElementById("repLeadStep2").style.visibility = "hidden";
document.getElementById("repLeadStep2").style.display = "none";
}
if (document.replead.displaytype.value == "step1") {
document.getElementById("repLeadDiv").style.height = "310px";
} else if (document.replead.displaytype.value == "step2") {
document.getElementById("repLeadDiv").style.height = "410px";
} else if (document.replead.displaytype.value == "step1and2") {
document.getElementById("repLeadDiv").style.height = "485px";
}
}
/*
* secure.js - Functions for Secure Pages
*/
function ValidateCustomerFields() {
document.register.custfname.value = trimText(document.register.custfname.value);
document.register.custlname.value = trimText(document.register.custlname.value);
document.register.custemail.value = trimCustomerEmail(document.register.custemail.value);
if (document.register.custfname.value == "") {
document.register.custfname.focus();
alert("Please provide first name.");
return false;
}
else if (document.register.custlname.value == "") {
document.register.custlname.focus();
alert("Please provide last name.");
return false;
}
else if (document.register.phone1.value.search(/^\d{3}$/) == -1 ||
document.register.phone2.value.search(/^\d{3}$/) == -1 ||
document.register.phone3.value.search(/^\d{4}$/) == -1) {
document.register.phone1.focus();
alert("Please provide a valid phone number.");
return false;
}
else if (document.register.custaddress.value == "") {
document.register.custaddress.focus();
alert("Please provide a street address.");
return false;
}
else if (document.register.custzip.value.search(/^\d{5}(-?\d{4})?$/) == -1) {
document.register.custzip.focus();
alert("Please provide a valid zip code.");
return false;
}
else if (document.register.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.register.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.register.custemail.value.indexOf("www.") == 0) {
document.register.custemail.focus();
alert("Please provide a valid email address by removing the 'www.' in front.");
return false;
}
return true;
}
function ValidateCCFields() {
try {
var x = document.register.othercctype.options[document.register.othercctype.selectedIndex].text;
if (document.register.cctype.options[document.register.cctype.selectedIndex].text == "Other Options") {
if (x == "Use Check") {
if (document.register.checkaccountname.value == "") {
document.register.checkaccountname.focus();
alert("Please provide a valid name on the account");
return false;
}
else if (document.register.checkroutingnumber.value.length < 9) {
document.register.checkroutingnumber.focus();
alert("Bank Routing Number must be 9-digits.");
return false;
}
else if (document.register.checkaccountnumber.value.length < 10) {
document.register.checkaccountnumber.focus();
alert("Account Number must be 10-digits.");
return false;
}
return true;
}
else {
document.register.othercctype.focus();
alert("Please select a Credit Card option.");
return false;
}
}
} catch (e) { }
CheckCCNumber();
if (document.register.cctype.selectedIndex == 0) {
document.register.cctype.focus();
alert("Please select a credit card type.");
return false;
}
else if (isNaN(document.register.ccnumber.value) || document.register.ccnumber.value.length < 13) {
document.register.ccnumber.focus();
alert("Please provide a valid Credit Card #");
return false;
}
else if (document.register.ccmonth.value == "zero") {
alert("You have entered an invalid credit card expiration month.");
document.register.ccmonth.focus();
return false;
}
else if (document.register.ccyear.value == "zero") {
alert("You have entered an invalid credit card expiration year.");
document.register.ccyear.focus()
return false;
}
else if (isNaN(document.register.cccvv2.value) || document.register.cccvv2.value.length < document.register.cccvv2.maxLength) {
var card = document.register.cctype.options[document.register.cctype.selectedIndex].text;
if (document.register.cctype.options[document.register.cctype.selectedIndex].value == 0) {
card = document.register.othercctype.options[document.register.othercctype.selectedIndex].text;
}
document.register.cccvv2.focus();
alert("Your " + card + " card verification number should contain " + document.register.cccvv2.maxLength + " digits. Please re-enter the full card verification number.");
return false;
}
if (!validateCreditCardType()) {
return false;
}
return true;
}
function validateCreditCardType() {
var validCreditCardType = false;
var creditCardValidationCounter = 0;
var CREDIT_CARD_TYPE = new Array();
CREDIT_CARD_TYPE[0] = "visa" // Visa
CREDIT_CARD_TYPE[1] = "mastercard" // Mastercard
CREDIT_CARD_TYPE[2] = "americanexpress" // American Express
CREDIT_CARD_TYPE[3] = "discover" // Discover
var AMEX_PREFIX = new Array();
AMEX_PREFIX[0] = "34";
AMEX_PREFIX[1] = "37";
var DISCOVER_PREFIX = new Array();
DISCOVER_PREFIX[0] = "65";
DISCOVER_PREFIX[1] = "6011";
var MASTERCARD_PREFIX = new Array();
MASTERCARD_PREFIX[0] = "51";
MASTERCARD_PREFIX[1] = "52";
MASTERCARD_PREFIX[2] = "53";
MASTERCARD_PREFIX[3] = "54";
MASTERCARD_PREFIX[4] = "55";
var VISA_PREFIX = new Array();
VISA_PREFIX[0] = "4";
var creditCardNumber = document.register.ccnumber.value;
var creditCardType   = document.register.cctype.options[document.register.cctype.selectedIndex].value;
if (creditCardType == CREDIT_CARD_TYPE[0]) {
if (creditCardNumber.substring(0,1) == VISA_PREFIX[0]) {
validCreditCardType = true;
}
if (!validCreditCardType) {
alert('Please confirm your Visa card number corresponds to the Visa card type');
}
}
if (creditCardType == CREDIT_CARD_TYPE[1]) {
for (i = 0; i < MASTERCARD_PREFIX.length; i++) {
if (creditCardNumber.substring(0,2) == MASTERCARD_PREFIX[i]) {
validCreditCardType = true;
break;
}
}
if (!validCreditCardType) {
alert('Please confirm your Mastercard number corresponds to the Mastercard card type');
}
}
if (creditCardType == CREDIT_CARD_TYPE[2]) {
for (i = 0; i < AMEX_PREFIX.length; i++) {
if (creditCardNumber.substring(0,2) == AMEX_PREFIX[i]) {
validCreditCardType = true;
break;
}
}
if (!validCreditCardType) {
alert('Please confirm your American Express card number corresponds to the American Express card type');
}
}
if (creditCardType == CREDIT_CARD_TYPE[3]) {
if (creditCardNumber.substring(0,2) == DISCOVER_PREFIX[0]) {
validCreditCardType = true;
}
if (creditCardNumber.substring(0,4) == DISCOVER_PREFIX[1]) {
validCreditCardType = true;
}
if (!validCreditCardType) {
alert('Please confirm your Discover card number corresponds to the Discover card type');
}
}
return validCreditCardType;
}
function ValidateTermsAndConditions() {
if(document.register.tccheck.checked == false) {
alert("You need to agree the terms and conditions to continue....");
return false;
}
return true;
}
function CheckCCNumber() {
if (document.register.ccnumber.value.indexOf("-") > 0) {
document.register.ccnumber.value = document.register.ccnumber.value.replace(/-/g, "");
}
}
function checkShortSubmitCount(noIncrementCount) {
return processCheckSubmit("short", noIncrementCount);
}
function checkSubmitAndCustInfo(noIncrementCount) {
return processCheckSubmit("custinfo", noIncrementCount);
}
function checkSubmitAndCCInfo(noIncrementCount) {
return processCheckSubmit("ccinfo", noIncrementCount);
}
function checkSubmitAndCCInfoOnly(noIncrementCount) {
return processCheckSubmit("cconly", noIncrementCount);
}
function checkStateSelectedAndCCInfo(noIncrementCount) {
if (document.register.selectedOfferId != null && document.register.selectedOfferId.value == "") {
alert("Please select a state.");
document.register.selectedOfferId.focus();
return false;
} else {
return processCheckSubmit("ccinfo", noIncrementCount);
}
}
function processCheckSubmit(type, noIncrementCount) {
document.register.hasjavascript.value = "true";
var doIncrementCount = (noIncrementCount != true);
if (doIncrementCount) {
submitcount++;
}
if (1 == submitcount) {
var proceed = true;
if (type == "short") {
proceed = ValidateShort;
}
else if (type == "ccinfo") {
proceed = (ValidateCCFields() && ValidateCustomerFields() && ValidateTermsAndConditions());
}
else if (type == "custinfo") {
proceed = (ValidateCustomerFields() && ValidateCCFields() && ValidateTermsAndConditions());
}
else if (type == "cconly") {
proceed = (ValidateCCFields() && ValidateTermsAndConditions());
}
else {
proceed = (ValidateCustomerFields() && ValidateCCFields() && ValidateTermsAndConditions());
}
if (proceed) {
setCCVBVAmount();
modifySubmitButton();
oldOnBeforeUnload = window.onbeforeunload;
window.onbeforeunload = null;
return true;
}
else {
submitcount = 0;
return false;
}
}
else {
alert("Only one click on SUBMIT is needed. We are verifying your account information. Thank you for your patience.");
return false;
}
return true;
}
function checkfirst() {
if (document.register.phone1.value.length >= 3) {
document.register.phone2.focus();
}
}
function checksecond() {
if (document.register.phone2.value.length >= 3) {
document.register.phone3.focus();
}
}
function getSelectedOfferId() {
if (document.register.selectedOfferId.length == undefined) {
return document.register.selectedOfferId.value;
} else if (document.getElementById("selectedOfferId") != null) {
var e = document.getElementById("selectedOfferId");
return e.options[e.selectedIndex].value;
} else {
for (i=0; i<document.register.selectedOfferId.length; i++) {
if (document.register.selectedOfferId[i].checked) {
return document.register.selectedOfferId[i].value;
}
}
}
}
function getCategoryRegistrationAttributes() {
var strURL = '/registration-service.html';
var selectedOfferId = getSelectedOfferId();
var catId = document.register.catid.value;
var ccType = document.register.cctype.options[document.register.cctype.selectedIndex].value;
xmlHttp = getXmlHttpObject();
var getURL = strURL + '?catid=' + catId + '&selectedOfferId=' + selectedOfferId + '&cctype=' + ccType;
xmlHttp.onreadystatechange = setCategoryRegistrationAttributes;
xmlHttp.open("GET",getURL,true);
xmlHttp.send(null);
}
function setCategoryRegistrationAttributes() {
if (xmlHttp.readyState == 4) {
var _response = xmlHttp.responseXML;
var xroot = _response.getElementsByTagName('formContent').item(0);
var displayDivs = new Array("headlineTopDiv", "headlineBottomDiv", "introDiv", "formTitleDiv",
"step1HeadingDiv", "step1TopDiv", "step1BottomDiv", "step2HeadingDiv",
"step2TopDiv", "step2BottomDiv", "step3HeadingDiv", "step3TopDiv", "step3BottomDiv",
"termsTopDiv", "termsBottomDiv", "rhsIntroTopDiv", "rhsIntroBottomDiv",
"rhs1TopDiv", "rhs1BottomDiv", "rhs2TopDiv", "rhs2BottomDiv", "disclaimerDiv",
"promo1TopDiv", "promo1BottomDiv");
for (var i=0; i < displayDivs.length; i++) {
var display = displayDivs[i];
if (document.getElementById(display) != null) {
try { document.getElementById(display).innerHTML = xroot.getElementsByTagName(display)[0].childNodes[0].nodeValue;
} catch (e) { document.getElementById(display).innerHTML = ''; }
}
}
displayRegistrationAttributes();
}
}
function displayRegistrationAttributes() {
var displayDivs = new Array("headlineTopDiv", "headlineBottomDiv", "introDiv", "step1HeadingDiv",
"step1TopDiv", "step1BottomDiv", "step2HeadingDiv", "step2TopDiv",
"step2BottomDiv", "step3HeadingDiv", "step3TopDiv", "step3BottomDiv",
"termsTopDiv", "termsBottomDiv", "rhsIntroTopDiv", "rhsIntroBottomDiv",
"disclaimerDiv", "promo1TopDiv", "promo1BottomDiv");
for (var i=0; i < displayDivs.length; i++) {
var display = displayDivs[i];
if (document.getElementById(display) != null && document.getElementById(display).innerHTML != "") {
showlayer(display);
} else {
hidelayer(display);
}
}
if ((document.getElementById("rhs1TopDiv") != null && document.getElementById("rhs1TopDiv").innerHTML != "")
|| (document.getElementById("rhs1BottomDiv") != null && document.getElementById("rhs1BottomDiv").innerHTML != "")) {
showlayer("rhs1Div");
} else {
hidelayer("rhs1Div");
}
if ((document.getElementById("rhs2TopDiv") != null && document.getElementById("rhs2TopDiv").innerHTML != "")
|| (document.getElementById("rhs2BottomDiv") != null && document.getElementById("rhs2BottomDiv").innerHTML != "")) {
showlayer("rhs2Div");
} else {
hidelayer("rhs2Div");
}
}
function retrieveAndUpdatePageContent() {
confirmCVV2Length();
getCategoryRegistrationAttributes();
}
function checkSelectedOfferAndCardType() {
if (! document.register.selectedOfferId.length == undefined ||
document.register.cctype.selectedIndex > 0) {
retrieveAndUpdatePageContent();
} else {
displayRegistrationAttributes();
}
}
function setCCVBVAmount() {
if (document.register.cc_amount0 != undefined) {
if (document.register.spid.length == undefined) {
document.register.cc_amount.value = document.register.cc_amount0.value;
}
else {
for (i=0; i<document.register.spid.length; i++) {
if (document.register.spid[i].checked) {
document.register.cc_amount.value = document.register.elements["cc_amount" + i].value;
}
}
}
}
}
function confirmCVV2Length() {
var cvv2Length = document.register.cccvv2.maxLength;
if ((cvv2Length == undefined || cvv2Length == -1) && (document.register.cctype.options[document.register.cctype.selectedIndex].text != 'American Express')) {
document.register.cccvv2.maxLength = 3;
}
else if ((cvv2Length == undefined || cvv2Length == -1) && (document.register.cctype.options[document.register.cctype.selectedIndex].text == 'American Express')) {
document.register.cccvv2.maxLength = 4;
}
else if ((cvv2Length == 3) && (document.register.cctype.options[document.register.cctype.selectedIndex].text == 'American Express')) {
document.register.cccvv2.maxLength = 4;
}
else if ((cvv2Length == 4) && (document.register.cctype.options[document.register.cctype.selectedIndex].text != 'American Express')) {
document.register.cccvv2.maxLength = 3;
document.register.cccvv2.value = '';
}
else {
}
}
function openCvv2PopUp(url) {
var x = document.register.cctype.options[document.register.cctype.selectedIndex].value;
if (x == 0) {
try {
x = document.register.othercctype.options[document.register.othercctype.selectedIndex].value;
}
catch (e) { }
}
helpwin = window.open(url + x, 'help','toolbar=no,scrollbars=yes,width=700,height=480');
helpwin.focus();
}
function showFaqAnswer(id) {
document.getElementById("tempFaqContentDisplay").innerHTML = document.getElementById("faqContentDisplay").innerHTML;
document.getElementById("faqContentDisplay").innerHTML = document.getElementById(id).innerHTML;
}
function hideFaqAnswer() {
document.getElementById("faqContentDisplay").innerHTML = document.getElementById("tempFaqContentDisplay").innerHTML;
}
function loadTestimonial(toload, total, autostart) {
for (i=1; i <= total; i+=1) {
document.getElementById("testimonial-" + i).style.visibility = "hidden";
document.getElementById("testimonial-" + i).style.display = "none";
}
document.getElementById("testimonial-" + toload).style.visibility = "visible";
document.getElementById("testimonial-" + toload).style.display = "block";
AudioPlayer.embed("testimonial-audio-" + toload, {
soundFile: audioFiles[toload-1],
autostart: (autostart ? "yes" : "no")
});
}
function check2StepRegPageShort() {
if (document.register.formtype.value == "step1") {
validateAndSubmitRegPageEOFormShort();
} else if (document.register.formtype.value == "step2") {
if (validateRegPageEOFormShort()) {
return checkSubmitAndCustInfo();
}
}
return false;
}
function validateAndSubmitRegPageEOFormShort() {
if (validateRegPageEOFormShort()) {
var params = "custzip=" + document.register.custzip.value + "&";
params += "custemail=" + document.register.custemail.value + "&";
params += "promotion=" + document.register.promotion.checked;
loadRegPageStep2();
postRegPageEO(params);
}
}
function validateRegPageEOFormShort() {
document.register.custemail.value = trimCustomerEmail(document.register.custemail.value);
if (document.register.custzip.value.search(/^\d{5}(-?\d{4})?$/) == -1) {
document.register.custzip.focus();
alert("Please provide a valid zip code.");
return false;
} else if (document.register.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.register.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else {
return true;
}
}
function check2StepRegPageLong() {
if (document.register.formtype.value == "step1") {
validateAndSubmitRegPageEOFormLong();
} else if (document.register.formtype.value == "step2") {
if (validateRegPageEOFormLong()) {
return checkSubmitAndCustInfo();
}
}
return false;
}
function validateAndSubmitRegPageEOFormLong() {
if (validateRegPageEOFormLong()) {
var params = "custfname=" + document.register.custfname.value + "&";
params += "custlname=" + document.register.custlname.value + "&";
params += "custaddress=" + document.register.custaddress.value + "&";
params += "custzip=" + document.register.custzip.value + "&";
params += "custemail=" + document.register.custemail.value + "&";
params += "custphone=" + document.register.phone1.value + document.register.phone2.value + document.register.phone3.value + "&";
params += "promotion=" + document.register.promotion.checked;
loadRegPageStep2();
postRegPageEO(params);
}
}
function validateRegPageEOFormLong() {
document.register.custfname.value = trimText(document.register.custfname.value);
document.register.custlname.value = trimText(document.register.custlname.value);
document.register.custemail.value = trimCustomerEmail(document.register.custemail.value);
if (document.register.custfname.value == "") {
document.register.custfname.focus();
alert("Please provide first name.");
return false;
} else if (document.register.custlname.value == "") {
document.register.custlname.focus();
alert("Please provide last name.");
return false;
} else if (document.register.custaddress.value == "") {
document.register.custaddress.focus();
alert("Please provide a street address.");
return false;
} else if (document.register.custzip.value.search(/^\d{5}(-?\d{4})?$/) == -1) {
document.register.custzip.focus();
alert("Please provide a valid zip code.");
return false;
} else if (document.register.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.register.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.register.custemail.value.indexOf("www.") == 0) {
document.register.custemail.focus();
alert("Please provide a valid email address by removing the 'www.' in front.");
return false;
} else if (document.register.phone1.value.search(/^\d{3}$/) == -1 ||
document.register.phone2.value.search(/^\d{3}$/) == -1 ||
document.register.phone3.value.search(/^\d{4}$/) == -1) {
document.register.phone1.focus();
alert("Please provide a valid phone number.");
return false;
} else {
return true;
}
}
function postRegPageEO(params) {
var getURL = '/eopost.ajax';
xmlHttp = getXmlHttpObject();
xmlHttp.open("POST", getURL, false);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(params);
}
function loadRegPageStep2() {
document.register.formtype.value = "step2";
document.getElementById("step1Button").innerHTML = "<div class='step-separator'><img src='/resources/site/images/separator.png' width='490' height='7'/></div>";
document.getElementById("step2").style.visibility = "visible";
document.getElementById("step2").style.display = "block";
document.getElementById("step2-rhs-content").style.visibility = "visible";
document.getElementById("step2-rhs-content").style.display = "block";
document.getElementById("rhs-content").style.backgroundImage = "url('/resources/site/images/divider_long.png')";
document.getElementById("rhs-content").style.minHeight = "498px";
}
function NewWindow(url, width, height) {
strOption = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + width + ",height=" + height;
newWin = window.open(url, '_new', strOption);
newWin.focus();
}
function openPage(url, width, height) {
if (!width) {
width = 768;
}
if (!height) {
height = 540;
}
var sound = document.getElementById("sound");
if (sound) {
sound.src = "/images/click.wav";
}
newWin = window.open(url, '_blank', 'scrollbars=yes,toolbar=no,resizable=yes,width='+width+',height='+height+',top='+((screen.availHeight - height) / 2)+',left='+((screen.availWidth - width) / 2));
newWin.focus();
}
function openPopupWindow(url) {
strOption = "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no";
newWin = window.open(url, '_new', strOption);
newWin.focus();
window.close();
}
function printPage() {
if (window.print) {
window.print();
}
else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";
}
}
function changeCounty() {
page = document.forms[0].page.value;
if (page == 'index'){
document.cookie= "searchstate=" + document.forms[0].state.value +"; expires=Friday, 31-Dec-2010 05:00:00 GMT";
}
county = document.forms[0].county.value;
for(ii=0;ii<document.forms[0].county.length;ii++){
if(document.forms[0].county[ii].checked ){
county = document.forms[0].county[ii].value;
break;
}
}
url = page + ".do?county=" + county;
url+= '&state='+ document.forms[0].state.value;
window.opener.location.href=url;
window.close();
}
function searchbySelected(x) {
for (i = 0; i < document.sortform.searchby.length; i++) {
if (document.sortform.searchby[i].value == x) {
document.sortform.searchby[i].checked = true;
}
}
}
function changeZip() {
if(document.forms[0].location.value == "neighbor") {
window.opener.document.neighborhood.zipcode.value=document.forms[0].zipcode.value;;
for(ii=0;ii<document.forms[0].zipcode.length;ii++) {
if(document.forms[0].zipcode[ii].checked) {
window.opener.document.neighborhood.zipcode.value=document.forms[0].zipcode[ii].value;;
break;
}
}
}
else {
document.cookie= "searchstate=" + document.forms[0].state.value +"; expires=Friday, 31-Dec-2010 05:00:00 GMT";
window.opener.document.forms[0].zipcode.value=document.forms[0].zipcode.value;;
if (window.opener.document.forms[0].city != null ) {
window.opener.document.forms[0].city.value=document.forms[0].city.value;
}
if (window.opener.document.forms[0].state != null) {
window.opener.document.forms[0].state.value=document.forms[0].state.value;
}
for(ii=0;ii<document.forms[0].zipcode.length;ii++) {
if(document.forms[0].zipcode[ii].checked ) {
window.opener.document.forms[0].zipcode.value=document.forms[0].zipcode[ii].value;;
break;
}
}
}
window.close();
}
function changeSearchState(selectedState, page) {
if( selectedState.value == "") {
alert("Please select a state");
return false;
}
else {
document.cookie= "searchstate=" + selectedState.value +"; expires=Friday, 31-Dec-2010 05:00:00 GMT";
}
location.href=page;
}
function clearSearchState(page) {
document.cookie= "searchstate=XX; expires=Friday, 31-Dec-2010 05:00:00 GMT";
location.href=page;
}
function saveSearch(url, address, zipcode) {
if (typeof(address) == "undefined") {
address = '';
}
if (typeof(zipcode) == "undefined") {
zipcode = '';
}
tab = document.getElementById("tab");
url += (address != '' ? '&address=' + address : '') +
(zipcode != '' ? '&zipcode=' + zipcode : '') +
(tab != null ? '&tab=' + tab.value : '') + '&';
hrefStr = window.location.href;
queryStr = hrefStr.substr(hrefStr.indexOf("?") + 1);
url += queryStr;
NewWindow(url, 350, 200);
}
var recordsPerPage = 10;
currentCol = 0
previousCol = -1
var month = new Array();
month["January"] = 1;
month["Feburary"] = 2;
month["March"] = 3;
month["April"] = 4;
month["May"] = 5;
month["June"] = 6;
month["July"] = 7;
month["Auguest"] = 8;
month["September"] = 9;
month["October"] = 10;
month["Novemeber"] = 11;
month["December"] = 12;
function CompareAlpha(a, b) {
if (a[currentCol] < b[currentCol]) { return -1; }
if (a[currentCol] > b[currentCol]) { return 1; }
return 0;
}
function CompareAlphaIgnore(a, b) {
strA = a[currentCol].toLowerCase();
strB = b[currentCol].toLowerCase();
if (strA < strB) { return -1; }
else {
if (strA > strB) { return 1; }
else { return 0; }
}
}
function CompareDate(a, b) {
datA = new Date(a[currentCol]);
datB = new Date(b[currentCol]);
if (datA < datB) { return -1; }
else {
if (datA > datB) { return 1; }
else { return 0; }
}
}
function CompareDateOur(a, b) {
strA = a[currentCol].split(", ");
strAA = strA[0].split(" ");
strB = b[currentCol].split(", ");
strBB = strB[0].split(" ");
datA = new Date(strA[1], month[strAA[0]], strAA[1]);
datB = new Date(strB[1], month[strBB[0]], strBB[1]);
if (datA < datB) { return -1; }
else {
if (datA > datB) { return 1; }
else { return 0; }
}
}
function CompareNumeric(a, b) {
numA = a[currentCol]
numB = b[currentCol]
if (isNaN(numA)) { return 0;}
else {
if (isNaN(numB)) { return 0; }
else { return numA - numB; }
}
}
function SortRecords(myArray, myCol, myType) {
var myRows = myArray.length;
var myCols = myArray[0].length;
currentCol = myCol
switch (myType) {
case "a":
myArray.sort(CompareAlpha);
if (myCol == 7) { myArray.reverse(); }
break;
case "ai":
myArray.sort(CompareAlphaIgnore);
break;
case "d":
myArray.sort(CompareDate);
break;
case "do":
myArray.sort(CompareDateOur);
break;
case "n":
myArray.sort(CompareNumeric);
break;
default:
myArray.sort()
}
return 0;
}
function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if (isNaN(num)) {
num = "0";
}
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
num = Math.floor(num/100).toString();
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) {
num = num.substring(0,num.length-(4*i+3)) + ',' + num.substring(num.length-(4*i+3));
}
return (((sign)?'':'-') + '$' + num);
}
function Morgcal()
{
form = document.loan
LoanAmount= form.LoanAmount.value
DownPayment= "0"
AnnualInterestRate = form.InterestRate.value/100
Years= form.NumberOfYears.value
MonthRate=AnnualInterestRate/12
NumPayments=Years*12
Prin=LoanAmount-DownPayment
MonthPayment=Math.floor((Prin*MonthRate)/(1-Math.pow((1+MonthRate),(-1*NumPayments)))*100)/100
form.NumberOfPayments.value=NumPayments
form.MonthlyPayment.value=MonthPayment
}
function sortSearchResult(sortby) {
tabParam = $('tab').value;
sortbyParam = (sortby != null ? sortby.options[sortby.selectedIndex].value : '');
url = replaceUrlParam(window.location.href, "tab", tabParam);
finalUrl = replaceUrlParam(url , "sortby", sortbyParam);
$('sortform').action = finalUrl;
ajaxAnywhere.submitAJAX();
}
function sortSearch(searchUrl) {
var sortby = document.getElementById("sortby");
url = searchUrl + (sortby ? sortby.options[sortby.selectedIndex].value : '');
var queryStr = window.location.search;
if (queryStr) {
queryStr = queryStr.substr(1); // Drop the leading "?"
var params = queryStr.split("&");
for (var i = 0; i < params.length; i++) {
var param = params[i].split("=");
if (param[0] != "sortby") {
url +=  "&" + param[0] + "=" + param[1];
}
}
}
location.href = url;
}
function advancedSearch(searchUrl) {
url = searchUrl;
var sGet = window.location.search;
if (sGet) {
sGet = sGet.substr(1); // Drop the leading "?"
var sNVPairs = sGet.split("&");
for (var i = 0; i < sNVPairs.length; i++) {
var sNV = sNVPairs[i].split("=");
if (sNV[0] != "stype") {
url +=  "&" + sNV[0] + "=" + sNV[1];
}
}
}
location.href = url;
}
function newsearch(url) {
document.location.href = url;
}
function validateState(state) {
if (!state || state == null || state.value == "") {
alert("Please select a state");
return false;
}
return true;
}
function validateRealtorState() {
var realtorState = document.getElementById("realtorState");
return validateState(realtorState);
}
function validateNeighborhoodZip() {
var zipcode = document.forms["neighborhood"].zipcode;
if (!zipcode || zipcode == null || zipcode.value == "") {
alert("Please enter a valid ZIP code");
document.forms["neighborhood"].zipcode.focus();
return false;
}
return true;
}
function validateAuctionState() {
var auctionState = document.getElementById("auctionState");
return validateState(auctionState);
}
function validateForeclosureLawState() {
var foreclosureLawState = document.getElementById("foreclosureLawState");
return validateState(foreclosureLawState);
}
function validateHousingPredictorState() {
var housingPredictorState = document.getElementById("housingPredictorState");
return validateState(housingPredictorState);
}
function validateBank() {
var bankName = document.getElementById("bankName");
if (!bankName || bankName == null || bankName.value == "") {
alert("Please select a Bank");
return false;
}
return true;
}
function validateLTLoan() {
if (document.ltloan.loantype.value == "") {
alert("Please select a loan type");
return false;
}
if (document.ltloan.zipcode.value.length != 5 && window.location['pathname'] == '/finance-news.do') {
alert("Please enter a valid ZIP code");
return false;
}
return true;
}
function validateSureHits() {
if (document.sureHits.loantype.value == "") {
alert("Please select a loan type");
return false;
}
return true;
}
function displayLTLoanOptions() {
document.write("<option value=\"\">Select a Loan</option>");
document.write("<option value=\"1\">Purchase</option>");
document.write("<option value=\"2\">Refinance</option>");
document.write("<option value=\"3\">Home Equity</option>");
}
function displayLTLoanOptionsHF() {
document.write("<option value=\"\">Select a Loan</option>");
document.write("<option value=\"1\">Purchase</option>");
document.write("<option value=\"2\">Refinance</option>");
document.write("<option value=\"3\">Home Equity</option>");
}
function displayLTLoanOptionsUF() {
document.write("<option value=\"\">Select a Loan</option>");
document.write("<option value=\"1\">Purchase</option>");
document.write("<option value=\"2\">Refinance</option>");
document.write("<option value=\"3\">Home Equity</option>");
}
function searchRealtor(url, city) {
window.location.href = url + getRealtorLocation(city);
}
function initProgress() {
Element.show('progressMsg');
}
function resetProgress() {
Effect.Fade('progressMsg');
}
function deactivateTab(elem) {
if ($(elem) != null) {
$(elem).className = 'tab not_active';
}
}
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fun /*, thisp*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this)
fun.call(thisp, this[i], i, this);
}
};
}
function showAllListings(fast) {
['foreclosuresTab', 'taxSalesTab', 'tab-rent-to-own'].forEach(deactivateTab);
$('allListingsTab').className = 'tab active';
if (!fast) {
$('sortform').action = prepareTabUrl("all");
ajaxAnywhere.submitAJAX();
}
}
function showForeclosures(fast) {
['allListingsTab', 'taxSalesTab', 'tab-rent-to-own'].forEach(deactivateTab);
$('foreclosuresTab').className = 'tab active';
if (!fast) {
$('sortform').action = prepareTabUrl("fore");
ajaxAnywhere.submitAJAX();
}
}
function showTaxSales(fast) {
['allListingsTab', 'foreclosuresTab', 'tab-rent-to-own'].forEach(deactivateTab);
$('taxSalesTab').className = 'tab active';
if (!fast) {
$('sortform').action = prepareTabUrl("tax");
ajaxAnywhere.submitAJAX();
}
}
function showRentToOwn(fast) {
['allListingsTab', 'foreclosuresTab', 'taxSalesTab'].forEach(deactivateTab);
$('tab-rent-to-own').className = 'tab active';
if (! fast) {
$('sortform').action = prepareTabUrl("rto");
ajaxAnywhere.submitAJAX();
}
}
function prepareTabUrl(tab) {
$('tab').value = tab;
url = replaceUrlParam(window.location.href, "tab", tab);
finalUrl = replaceUrlParam(url , "sortby", "");
return finalUrl;
}
function replaceUrlParam(url, replaceParam, replaceValue) {
hrefStr = url.substring(0, url.indexOf("?") + 1);
queryStr = url.substr(url.indexOf("?") + 1);
if (queryStr) {
var params = queryStr.split("&");
for (var i = 0; i < params.length; i++) {
var param = params[i].split("=");
if (param[0] != replaceParam) {
hrefStr += (i > 0 ? "&" : "") + param[0] + "=" + param[1];
}
}
hrefStr += (params.length > 0 ? "&" : "") + replaceParam + "=" + replaceValue;
}
return hrefStr;
}
/*
Do not remove or change this notice.
overlibmws.js core module - Copyright Foteos Macrides 2002-2005. All rights reserved.
Initial: August 18, 2002 - Last Revised: June 8, 2005
This module is subject to the same terms of usage as for Erik Bosrup's overLIB,
though only a minority of the code and API now correspond with Erik's version.
See the overlibmws Change History and Command Reference via:
http://www.macridesweb.com/oltest/
Published under an open source license: http://www.macridesweb.com/oltest/license.html
Give credit on sites that use overlibmws and submit changes so others can use them as well.
You can get Erik's version via: http://www.bosrup.com/web/overlib/
*/
var OLloaded=0,pmCnt=1,pMtr=new Array(),OLcmdLine=new Array(),OLrunTime=new Array(),OLv,OLudf,
OLpct=new Array("83%","67%","83%","100%","117%","150%","200%","267%"),OLrefXY,
OLbubblePI=0,OLcrossframePI=0,OLdebugPI=0,OLdraggablePI=0,OLexclusivePI=0,OLfilterPI=0,
OLfunctionPI=0,OLhidePI=0,OLiframePI=0,OLovertwoPI=0,OLscrollPI=0,OLshadowPI=0,OLprintPI=0;
if(typeof OLgateOK=='undefined')var OLgateOK=1;
var OLp1or2c='inarray,caparray,caption,closetext,right,left,center,autostatuscap,padx,pady,'
+'below,above,vcenter,donothing',OLp1or2co='nofollow,background,offsetx,offsety,fgcolor,'
+'bgcolor,cgcolor,textcolor,capcolor,width,wrap,wrapmax,height,border,base,status,autostatus,'
+'snapx,snapy,fixx,fixy,relx,rely,midx,midy,ref,refc,refp,refx,refy,fgbackground,bgbackground,'
+'cgbackground,fullhtml,capicon,textfont,captionfont,textsize,captionsize,timeout,delay,hauto,'
+'vauto,nojustx,nojusty,fgclass,bgclass,cgclass,capbelow,textpadding,textfontclass,'
+'captionpadding,captionfontclass,sticky,noclose,mouseoff,offdelay,closecolor,closefont,'
+'closesize,closeclick,closetitle,closefontclass,decode',OLp1or2o='text,cap,close,hpos,vpos,'
+'padxl,padxr,padyt,padyb',OLp1co='label',OLp1or2=OLp1or2co+','+OLp1or2o,OLp1=OLp1co+','+'frame';
OLregCmds(OLp1or2c+','+OLp1or2co+','+OLp1co);
function OLud(v){return eval('typeof ol_'+v+'=="undefined"')?1:0;}
if(OLud('fgcolor'))var ol_fgcolor="#ccccff";
if(OLud('bgcolor'))var ol_bgcolor="#333399";
if(OLud('cgcolor'))var ol_cgcolor="#333399";
if(OLud('textcolor'))var ol_textcolor="#000000";
if(OLud('capcolor'))var ol_capcolor="#ffffff";
if(OLud('closecolor'))var ol_closecolor="#eeeeff";
if(OLud('textfont'))var ol_textfont="Verdana,Arial,Helvetica";
if(OLud('captionfont'))var ol_captionfont="Verdana,Arial,Helvetica";
if(OLud('closefont'))var ol_closefont="Verdana,Arial,Helvetica";
if(OLud('textsize'))var ol_textsize=3;
if(OLud('captionsize'))var ol_captionsize=1;
if(OLud('closesize'))var ol_closesize=1;
if(OLud('fgclass'))var ol_fgclass="";
if(OLud('bgclass'))var ol_bgclass="";
if(OLud('cgclass'))var ol_cgclass="";
if(OLud('textpadding'))var ol_textpadding=2;
if(OLud('textfontclass'))var ol_textfontclass="";
if(OLud('captionpadding'))var ol_captionpadding=2;
if(OLud('captionfontclass'))var ol_captionfontclass="";
if(OLud('closefontclass'))var ol_closefontclass="";
if(OLud('close'))var ol_close="Close";
if(OLud('closeclick'))var ol_closeclick=0;
if(OLud('closetitle'))var ol_closetitle="Click to Close";
if(OLud('text'))var ol_text="Default Text";
if(OLud('cap'))var ol_cap="";
if(OLud('capbelow'))var ol_capbelow=0;
if(OLud('background'))var ol_background="";
if(OLud('width'))var ol_width=200;
if(OLud('wrap'))var ol_wrap=0;
if(OLud('wrapmax'))var ol_wrapmax=0;
if(OLud('height'))var ol_height= -1;
if(OLud('border'))var ol_border=1;
if(OLud('base'))var ol_base=0;
if(OLud('offsetx'))var ol_offsetx=10;
if(OLud('offsety'))var ol_offsety=10;
if(OLud('sticky'))var ol_sticky=0;
if(OLud('nofollow'))var ol_nofollow=0;
if(OLud('noclose'))var ol_noclose=0;
if(OLud('mouseoff'))var ol_mouseoff=0;
if(OLud('offdelay'))var ol_offdelay=300;
if(OLud('hpos'))var ol_hpos=RIGHT;
if(OLud('vpos'))var ol_vpos=BELOW;
if(OLud('status'))var ol_status="";
if(OLud('autostatus'))var ol_autostatus=0;
if(OLud('snapx'))var ol_snapx=0;
if(OLud('snapy'))var ol_snapy=0;
if(OLud('fixx'))var ol_fixx= -1;
if(OLud('fixy'))var ol_fixy= -1;
if(OLud('relx'))var ol_relx=null;
if(OLud('rely'))var ol_rely=null;
if(OLud('midx'))var ol_midx=null;
if(OLud('midy'))var ol_midy=null;
if(OLud('ref'))var ol_ref="";
if(OLud('refc'))var ol_refc='UL';
if(OLud('refp'))var ol_refp='UL';
if(OLud('refx'))var ol_refx=0;
if(OLud('refy'))var ol_refy=0;
if(OLud('fgbackground'))var ol_fgbackground="";
if(OLud('bgbackground'))var ol_bgbackground="";
if(OLud('cgbackground'))var ol_cgbackground="";
if(OLud('padxl'))var ol_padxl=1;
if(OLud('padxr'))var ol_padxr=1;
if(OLud('padyt'))var ol_padyt=1;
if(OLud('padyb'))var ol_padyb=1;
if(OLud('fullhtml'))var ol_fullhtml=0;
if(OLud('capicon'))var ol_capicon="";
if(OLud('frame'))var ol_frame=self;
if(OLud('timeout'))var ol_timeout=0;
if(OLud('delay'))var ol_delay=0;
if(OLud('hauto'))var ol_hauto=0;
if(OLud('vauto'))var ol_vauto=0;
if(OLud('nojustx'))var ol_nojustx=0;
if(OLud('nojusty'))var ol_nojusty=0;
if(OLud('label'))var ol_label="";
if(OLud('decode'))var ol_decode=0;
if(OLud('texts'))var ol_texts=new Array("Text 0","Text 1");
if(OLud('caps'))var ol_caps=new Array("Caption 0","Caption 1");
var o3_text="",o3_cap="",o3_sticky=0,o3_nofollow=0,o3_background="",o3_noclose=0,o3_mouseoff=0,
o3_offdelay=300,o3_hpos=RIGHT,o3_offsetx=10,o3_offsety=10,o3_fgcolor="",o3_bgcolor="",
o3_cgcolor="",o3_textcolor="",o3_capcolor="",o3_closecolor="",o3_width=200,o3_wrap=0,
o3_wrapmax=0,o3_height= -1,o3_border=1,o3_base=0,o3_status="",o3_autostatus=0,o3_snapx=0,
o3_snapy=0,o3_fixx= -1,o3_fixy= -1,o3_relx=null,o3_rely=null,o3_midx=null,o3_midy=null,o3_ref="",
o3_refc='UL',o3_refp='UL',o3_refx=0,o3_refy=0,o3_fgbackground="",o3_bgbackground="",
o3_cgbackground="",o3_padxl=0,o3_padxr=0,o3_padyt=0,o3_padyb=0,o3_fullhtml=0,o3_vpos=BELOW,
o3_capicon="",o3_textfont="Verdana,Arial,Helvetica",o3_captionfont="",o3_closefont="",
o3_textsize=1,o3_captionsize=1,o3_closesize=1,o3_frame=self,o3_timeout=0,o3_delay=0,o3_hauto=0,
o3_vauto=0,o3_nojustx=0,o3_nojusty=0,o3_close="",o3_closeclick=0,o3_closetitle="",o3_fgclass="",
o3_bgclass="",o3_cgclass="",o3_textpadding=2,o3_textfontclass="",o3_captionpadding=2,
o3_captionfontclass="",o3_closefontclass="",o3_capbelow=0,o3_label="",o3_decode=0,
CSSOFF=DONOTHING,CSSCLASS=DONOTHING,OLdelayid=0,OLtimerid=0,OLshowid=0,OLndt=0,over=null,
OLfnRef="",OLhover=0,OLx=0,OLy=0,OLshowingsticky=0,OLallowmove=0,OLcC=null,
OLua=navigator.userAgent.toLowerCase(),
OLns4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4),
OLns6=(document.getElementById)?1:0,
OLie4=(document.all)?1:0,
OLgek=(OLv=OLua.match(/gecko\/(\d{8})/i))?parseInt(OLv[1]):0,
OLmac=(OLua.indexOf('mac')>=0)?1:0,
OLsaf=(OLua.indexOf('safari')>=0)?1:0,
OLkon=(OLua.indexOf('konqueror')>=0)?1:0,
OLkht=(OLsaf||OLkon)?1:0,
OLopr=(OLua.indexOf('opera')>=0)?1:0,
OLop7=(OLopr&&document.createTextNode)?1:0;
if(OLopr){OLns4=OLns6=0;if(!OLop7)OLie4=0;}
var OLieM=((OLie4&&OLmac)&&!(OLkht||OLopr))?1:0,
OLie5=0,OLie55=0;if(OLie4&&!OLop7){
if((OLv=OLua.match(/msie (\d\.\d+)\.*/i))&&(OLv=parseFloat(OLv[1]))>=5.0){
OLie5=1;OLns6=0;if(OLv>=5.5)OLie55=1;}if(OLns6)OLie4=0;}
if(OLns4)window.onresize=function(){location.reload();}
var OLchkMh=1,OLdw;
if(OLns4||OLie4||OLns6)OLmh();
else{overlib=nd=cClick=OLpageDefaults=no_overlib;}
/*
PUBLIC FUNCTIONS
*/
function overlib(){
if(!(OLloaded&&OLgateOK))return;
if((OLexclusivePI)&&OLisExclusive(arguments))return true;
if(OLchkMh)OLmh();
if(OLndt&&!OLtimerid)OLndt=0;if(over)cClick();
OLload(OLp1or2);OLload(OLp1);
OLfnRef="";OLhover=0;
OLsetRunTimeVar();
OLparseTokens('o3_',arguments);
if(!(over=OLmkLyr()))return false;
if(o3_decode)OLdecode();
if(OLprintPI)OLchkPrint();
if(OLbubblePI)OLchkForBubbleEffect();
if(OLdebugPI)OLsetDebugCanShow();
if(OLshadowPI)OLinitShadow();
if(OLiframePI)OLinitIfs();
if(OLfilterPI)OLinitFilterLyr();
if(OLexclusivePI&&o3_exclusive&&o3_exclusivestatus!="")o3_status=o3_exclusivestatus;
else if(o3_autostatus==2&&o3_cap!="")o3_status=o3_cap;
else if(o3_autostatus==1&&o3_text!="")o3_status=o3_text;
if(!o3_delay){return OLmain();
}else{OLdelayid=setTimeout("OLmain()",o3_delay);
if(o3_status!=""){self.status=o3_status;return true;}
else if(!(OLop7&&event&&event.type=='mouseover'))return false;}
}
function nd(time){
if(OLloaded&&OLgateOK){if(!((OLexclusivePI)&&OLisExclusive())){
if(time&&over&&!o3_delay){if(OLtimerid>0)clearTimeout(OLtimerid);
OLtimerid=(OLhover&&o3_frame==self&&!OLcursorOff())?0:
setTimeout("cClick()",(o3_timeout=OLndt=time));}else{
if(!OLshowingsticky){OLallowmove=0;if(over)OLhideObject(over);}}}}
return false;
}
function cClick(){
if(OLloaded&&OLgateOK){OLhover=0;if(over){
if(OLovertwoPI&&over==over2)cClick2();OLhideObject(over);OLshowingsticky=0;}}
return false;
}
function OLpageDefaults(){
OLparseTokens('ol_',arguments);
}
function no_overlib(){return false;}
/*
OVERLIB MAIN FUNCTION SET
*/
function OLmain(){
o3_delay=0;
if(o3_frame==self){if(o3_noclose)OLoptMOUSEOFF(0);else if(o3_mouseoff)OLoptMOUSEOFF(1);}
if(o3_sticky)OLshowingsticky=1;OLdoLyr();OLallowmove=0;if(o3_timeout>0){
if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=setTimeout("cClick()",o3_timeout);}
if(o3_ref){OLrefXY=OLgetRefXY(o3_ref);if(OLrefXY[0]==null){o3_ref="";o3_midx=0;o3_midy=0;}}
OLdisp(o3_status);if(OLdraggablePI)OLcheckDrag();
if(o3_status!="")return true;else if(!(OLop7&&event&&event.type=='mouseover'))return false;
}
function OLload(c){var i,m=c.split(',');for(i=0;i<m.length;i++)eval('o3_'+m[i]+'=ol_'+m[i]);}
function OLdoLGF(){
return (o3_background!=''||o3_fullhtml)?OLcontentBackground(o3_text,o3_background,o3_fullhtml):
(o3_cap=="")?OLcontentSimple(o3_text):
(o3_sticky)?OLcontentCaption(o3_text,o3_cap,o3_close):OLcontentCaption(o3_text,o3_cap,'');
}
function OLmkLyr(id,f,z){
id=(id||'overDiv');f=(f||o3_frame);z=(z||1000);var fd=f.document,d=OLgetRefById(id,fd);
if(!d){if(OLns4)d=fd.layers[id]=new Layer(1024,f);else if(OLie4&&!document.getElementById){
fd.body.insertAdjacentHTML('BeforeEnd','<div id="'+id+'"></div>');d=fd.all[id];
}else{d=fd.createElement('div');if(d){d.id=id;fd.body.appendChild(d);}}if(!d)return null;
if(OLns4)d.zIndex=z;else{var o=d.style;o.position='absolute';o.visibility='hidden';o.zIndex=z;}}
return d;
}
function OLdoLyr(){
if(o3_background==''&&!o3_fullhtml){
if(o3_fgbackground!='')o3_fgbackground=' background="'+o3_fgbackground+'"';
if(o3_bgbackground!='')o3_bgbackground=' background="'+o3_bgbackground+'"';
if(o3_cgbackground!='')o3_cgbackground=' background="'+o3_cgbackground+'"';
if(o3_fgcolor!='')o3_fgcolor=' bgcolor="'+o3_fgcolor+'"';
if(o3_bgcolor!='')o3_bgcolor=' bgcolor="'+o3_bgcolor+'"';
if(o3_cgcolor!='')o3_cgcolor=' bgcolor="'+o3_cgcolor+'"';
if(o3_height>0)o3_height=' height="'+o3_height+'"';else o3_height='';}
if(!OLns4)OLrepositionTo(over,(OLns6?20:0),0);var lyrHtml=OLdoLGF();
if(o3_sticky&&OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;}
if(o3_wrap&&!o3_fullhtml){OLlayerWrite(lyrHtml);
o3_width=(OLns4?over.clip.width:over.offsetWidth);
if(OLns4&&o3_wrapmax<1)o3_wrapmax=o3_frame.innerWidth-40;
o3_wrap=0;if(o3_wrapmax>0&&o3_width>o3_wrapmax)o3_width=o3_wrapmax;lyrHtml=OLdoLGF();}
OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth);
if(OLbubblePI)OLgenerateBubble(lyrHtml);
}
/*
LAYER GENERATION FUNCTIONS
*/
function OLcontentSimple(txt){
var t=OLbgLGF()+OLfgLGF(txt)+OLbaseLGF();
OLsetBackground('');return t;
}
function OLcontentCaption(txt,title,close){
var closing=(OLprintPI?OLprintCapLGF():''),closeevent='onmouseover',caption,t,
cC='javascript:return '+OLfnRef+(OLovertwoPI&&over==over2?'cClick2();':'cClick();');
if(o3_closeclick)closeevent=(o3_closetitle?'title="'+o3_closetitle+'" ':'')+'onclick';
if(o3_capicon!='')o3_capicon='<img src="'+o3_capicon+'" /> ';
if(close){closing+='<td align="right"><a href="'+cC+'" '
+closeevent+'="'+cC+'"'+(o3_closefontclass?' class="'+o3_closefontclass
+'">':'>'+OLlgfUtil(0,'','span',o3_closecolor,o3_closefont,o3_closesize))+close
+(o3_closefontclass?'':OLlgfUtil(1,'','span'))+'</a></td>';}
caption='<table'+OLwd(0)+' border="0" cellpadding="'+o3_captionpadding+'" cellspacing="0"'
+(o3_cgclass?' class="'+o3_cgclass+'"':o3_cgcolor+o3_cgbackground)+'><tr><td'+OLwd(0)
+(o3_cgclass?' class="'+o3_cgclass+'">':'>')+(o3_captionfontclass?'<div class="'
+o3_captionfontclass+'">':'<strong>'
+OLlgfUtil(0,'','div',o3_capcolor,o3_captionfont,o3_captionsize))+o3_capicon+title
+OLlgfUtil(1,'','div')+(o3_captionfontclass?'':'</strong>')+'</td>'+closing+'</tr></table>';
t=OLbgLGF()+(o3_capbelow?OLfgLGF(txt)+caption:caption+OLfgLGF(txt))+OLbaseLGF();
OLsetBackground('');return t;
}
function OLcontentBackground(txt, image, hasfullhtml){
var t;if(hasfullhtml){t=txt;}else{t='<table'+OLwd(1)
+' border="0" cellpadding="0" cellspacing="0" '+'height="'+o3_height
+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'
+o3_padxl+'"></td><td valign="top"'+OLwd(2)+'>'
+OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+txt+
OLlgfUtil(1,'','div')+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'
+o3_padyb+'"></td></tr></table>';}
OLsetBackground(image);return t;
}
function OLbgLGF(){
return '<table'+OLwd(1)+o3_height+' border="0" cellpadding="'+o3_border+'" cellspacing="0"'
+(o3_bgclass?' class="'+o3_bgclass+'"':o3_bgcolor+o3_bgbackground)+'><tr><td>';
}
function OLfgLGF(t){
return '<table'+OLwd(0)+o3_height+' border="0" cellpadding="'+o3_textpadding
+'" cellspacing="0"'+(o3_fgclass?' class="'+o3_fgclass+'"':o3_fgcolor+o3_fgbackground)
+'><tr><td valign="top"'+(o3_fgclass?' class="'+o3_fgclass+'"':'')+'>'
+OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+t
+(OLprintPI?OLprintFgLGF():'')+OLlgfUtil(1,'','div')+'</td></tr></table>';
}
function OLlgfUtil(end,tfc,ele,col,fac,siz){
if(end)return ('</'+(OLns4?'font':ele)+'>');else return (tfc?'<div class="'+tfc+'">':
('<'+(OLns4?'font color="'+col+'" face="'+OLquoteMultiNameFonts(fac)+'" size="'+siz:ele
+' style="color:'+col+';font-family:'+OLquoteMultiNameFonts(fac)+';font-size:'+siz+';'
+(ele=='span'?'text-decoration:underline;':''))+'">'));
}
function OLquoteMultiNameFonts(f){
var i,v,pM=f.split(',');
for(i=0;i<pM.length;i++){v=pM[i];v=v.replace(/^\s+/,'').replace(/\s+$/,'');
if(/\s/.test(v) && !/['"]/.test(v)){v="\'"+v+"\'";pM[i]=v;}}
return pM.join();
}
function OLbaseLGF(){
return ((o3_base>0&&!o3_wrap)?('<table width="100%" border="0" cellpadding="0" cellspacing="0"'
+(o3_bgclass?' class="'+o3_bgclass+'"':'')+'><tr><td height="'+o3_base
+'"></td></tr></table>'):'')+'</td></tr></table>';
}
function OLwd(a){
return(o3_wrap?'':' width="'+(!a?'100%':(a==1?o3_width:(o3_width-o3_padxl-o3_padxr)))+'"');
}
function OLsetBackground(i){
if(i==''){if(OLns4)over.background.src=null;
else{if(OLns6)over.style.width='';over.style.backgroundImage='none';}
}else{if(OLns4)over.background.src=i;
else{if(OLns6)over.style.width=o3_width+'px';over.style.backgroundImage='url('+i+')';}}
}
/*
HANDLING FUNCTIONS
*/
function OLdisp(s){
if(!OLallowmove){if(OLshadowPI)OLdispShadow();if(OLiframePI)OLdispIfs();OLplaceLayer();
if(OLndt)OLshowObject(over);else OLshowid=setTimeout("OLshowObject(over)",1);
OLallowmove=(o3_sticky||o3_nofollow)?0:1;}OLndt=0;if(s!="")self.status=s;
}
function OLplaceLayer(){
var snp,X,Y,pgLeft,pgTop,pWd=o3_width,pHt,iWd=100,iHt=100,SB=0,LM=0,CX=0,TM=0,BM=0,CY=0,
o=OLfd(),nsb=(OLgek>=20010505&&!o3_frame.scrollbars.visible)?1:0;
if(!OLkht&&o&&o.clientWidth)iWd=o.clientWidth;
else if(o3_frame.innerWidth){SB=Math.ceil(1.4*(o3_frame.outerWidth-o3_frame.innerWidth));
if(SB>20)SB=20;iWd=o3_frame.innerWidth;}
pgLeft=(OLie4)?o.scrollLeft:o3_frame.pageXOffset;
if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow)SB=CX=5;else
if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){SB+=((o3_shadowx>0)?o3_shadowx:0);
LM=((o3_shadowx<0)?Math.abs(o3_shadowx):0);CX=Math.abs(o3_shadowx);}
if(o3_ref!=""||o3_fixx> -1||o3_relx!=null||o3_midx!=null){
if(o3_ref!=""){X=OLrefXY[0];if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow){
if(o3_refp=='UR'||o3_refp=='LR')X-=5;}
else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){
if(o3_shadowx<0&&(o3_refp=='UL'||o3_refp=='LL'))X-=o3_shadowx;else
if(o3_shadowx>0&&(o3_refp=='UR'||o3_refp=='LR'))X-=o3_shadowx;}
}else{if(o3_midx!=null){
X=parseInt(pgLeft+((iWd-pWd-SB-LM)/2)+o3_midx);
}else{if(o3_relx!=null){
if(o3_relx>=0)X=pgLeft+o3_relx+LM;else X=pgLeft+o3_relx+iWd-pWd-SB;
}else{X=o3_fixx+LM;}}}
}else{
if(o3_hauto){
if(o3_hpos==LEFT&&OLx-pgLeft<iWd/2&&OLx-pWd-o3_offsetx<pgLeft+LM)o3_hpos=RIGHT;else
if(o3_hpos==RIGHT&&OLx-pgLeft>iWd/2&&OLx+pWd+o3_offsetx>pgLeft+iWd-SB)o3_hpos=LEFT;}
X=(o3_hpos==CENTER)?parseInt(OLx-((pWd+CX)/2)+o3_offsetx):
(o3_hpos==LEFT)?OLx-o3_offsetx-pWd:OLx+o3_offsetx;
if(o3_snapx>1){
snp=X % o3_snapx;
if(o3_hpos==LEFT){X=X-(o3_snapx+snp);}else{X=X+(o3_snapx-snp);}}}
if(!o3_nojustx&&X+pWd>pgLeft+iWd-SB)
X=iWd+pgLeft-pWd-SB;if(!o3_nojustx&&X-LM<pgLeft)X=pgLeft+LM;
pgTop=OLie4?o.scrollTop:o3_frame.pageYOffset;
if(!OLkht&&!nsb&&o&&o.clientHeight)iHt=o.clientHeight;
else if(o3_frame.innerHeight)iHt=o3_frame.innerHeight;
if(OLbubblePI&&o3_bubble)pHt=OLbubbleHt;else pHt=OLns4?over.clip.height:over.offsetHeight;
if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){TM=(o3_shadowy<0)?Math.abs(o3_shadowy):0;
if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow)BM=CY=5;else
BM=(o3_shadowy>0)?o3_shadowy:0;CY=Math.abs(o3_shadowy);}
if(o3_ref!=""||o3_fixy> -1||o3_rely!=null||o3_midy!=null){
if(o3_ref!=""){Y=OLrefXY[1];if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow){
if(o3_refp=='LL'||o3_refp=='LR')Y-=5;}else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){
if(o3_shadowy<0&&(o3_refp=='UL'||o3_refp=='UR'))Y-=o3_shadowy;else
if(o3_shadowy>0&&(o3_refp=='LL'||o3_refp=='LR'))Y-=o3_shadowy;}
}else{if(o3_midy!=null){
Y=parseInt(pgTop+((iHt-pHt-CY)/2)+o3_midy);
}else{if(o3_rely!=null){
if(o3_rely>=0)Y=pgTop+o3_rely+TM;else Y=pgTop+o3_rely+iHt-pHt-BM;}else{
Y=o3_fixy+TM;}}}
}else{
if(o3_vauto){
if(o3_vpos==ABOVE&&OLy-pgTop<iHt/2&&OLy-pHt-o3_offsety<pgTop)o3_vpos=BELOW;else
if(o3_vpos==BELOW&&OLy-pgTop>iHt/2&&OLy+pHt+o3_offsety+((OLns4||OLkht)?17:0)>pgTop+iHt-BM)
o3_vpos=ABOVE;}Y=(o3_vpos==VCENTER)?parseInt(OLy-((pHt+CY)/2)+o3_offsety):
(o3_vpos==ABOVE)?OLy-(pHt+o3_offsety+BM):OLy+o3_offsety+TM;
if(o3_snapy>1){
snp=Y % o3_snapy;
if(pHt>0&&o3_vpos==ABOVE){Y=Y-(o3_snapy+snp);}else{Y=Y+(o3_snapy-snp);}}}
if(!o3_nojusty&&Y+pHt+BM>pgTop+iHt)Y=pgTop+iHt-pHt-BM;if(!o3_nojusty&&Y-TM<pgTop)Y=pgTop+TM;
OLrepositionTo(over,X,Y);
if(OLshadowPI)OLrepositionShadow(X,Y);if(OLiframePI)OLrepositionIfs(X,Y);
if(OLns6&&o3_frame.innerHeight){iHt=o3_frame.innerHeight;OLrepositionTo(over,X,Y);}
if(OLscrollPI)OLchkScroll(X-pgLeft,Y-pgTop);
}
function OLfd(f){
var fd=((f)?f:o3_frame).document,fdc=fd.compatMode,fdd=fd.documentElement;
return (!OLop7&&fdc&&fdc!='BackCompat'&&fdd&&fdd.clientWidth)?fd.documentElement:fd.body;
}
function OLgetRefXY(r){
var o=OLgetRef(r),ob=o,rXY=[o3_refx,o3_refy],of;
if(!o)return [null,null];
if(OLns4){if(typeof o.length!='undefined'&&o.length>1){
ob=o[0];rXY[0]+=o[0].x+o[1].pageX;rXY[1]+=o[0].y+o[1].pageY;
}else{if((o.toString().indexOf('Image')!= -1)||(o.toString().indexOf('Anchor')!= -1)){
rXY[0]+=o.x;rXY[1]+=o.y;}else{rXY[0]+=o.pageX;rXY[1]+=o.pageY;}}
}else{rXY[0]+=OLpageLoc(o,'Left');rXY[1]+=OLpageLoc(o,'Top');}
of=OLgetRefOffsets(ob);rXY[0]+=of[0];rXY[1]+=of[1];
return rXY;
}
function OLgetRef(l){var r=OLgetRefById(l);return (r)?r:OLgetRefByName(l);}
function OLgetRefById(l,d){
var r="",j;l=(l||'overDiv');d=(d||o3_frame.document);
if(OLie4&&d.all){return d.all[l];}else if(d.getElementById){return d.getElementById(l);
}else if(d.layers&&d.layers.length>0){if(d.layers[l])return d.layers[l];
for(j=0;j<d.layers.length;j++){r=OLgetRefById(l,d.layers[j].document);if(r)return r;}}
return null;
}
function OLgetRefByName(l,d){
var r=null,j;d=(d||o3_frame.document);
if(typeof d.images[l]!='undefined'&&d.images[l]){return d.images[l];
}else if(typeof d.anchors[l]!='undefined'&&d.anchors[l]){return d.anchors[l];
}else if(d.layers&&d.layers.length>0){
for(j=0;j<d.layers.length;j++){r=OLgetRefByName(l,d.layers[j].document);
if(r&&r.length>0)return r;else if(r)return [r,d.layers[j]];}}
return null;
}
function OLgetRefOffsets(o){
var c=o3_refc.toUpperCase(),p=o3_refp.toUpperCase(),W=0,H=0,pW=0,pH=0,of=[0,0];
pW=(OLbubblePI&&o3_bubble)?o3_width:OLns4?over.clip.width:over.offsetWidth;
pH=(OLbubblePI&&o3_bubble)?OLbubbleHt:OLns4?over.clip.height:over.offsetHeight;
if((!OLop7)&&o.toString().indexOf('Image')!= -1){W=o.width;H=o.height;
}else if((!OLop7)&&o.toString().indexOf('Anchor')!= -1){c=o3_refc='UL';}else{
W=(OLns4)?o.clip.width:o.offsetWidth;H=(OLns4)?o.clip.height:o.offsetHeight;}
if((OLns4||(OLns6&&OLgek))&&o.border){W+=2*parseInt(o.border);H+=2*parseInt(o.border);}
if(c=='UL'){of=(p=='UR')?[-pW,0]:(p=='LL')?[0,-pH]:(p=='LR')?[-pW,-pH]:[0,0];
}else if(c=='UR'){of=(p=='UR')?[W-pW,0]:(p=='LL')?[W,-pH]:(p=='LR')?[W-pW,-pH]:[W,0];
}else if(c=='LL'){of=(p=='UR')?[-pW,H]:(p=='LL')?[0,H-pH]:(p=='LR')?[-pW,H-pH]:[0,H];
}else if(c=='LR'){of=(p=='UR')?[W-pW,H]:(p=='LL')?[W,H-pH]:(p=='LR')?[W-pW,H-pH]:
[W,H];}
return of;
}
function OLpageLoc(o,t){
var l=0;while(o.offsetParent&&o.offsetParent.tagName.toLowerCase()!='html'){
l+=o['offset'+t];o=o.offsetParent;}l+=o['offset'+t];
return l;
}
function OLmouseMove(e){
var e=(e||event);
OLcC=(OLovertwoPI&&over2&&over==over2?cClick2:cClick);
OLx=(e.pageX||e.clientX+OLfd().scrollLeft);OLy=(e.pageY||e.clientY+OLfd().scrollTop);
if((OLallowmove&&over)&&(o3_frame==self||over==OLgetRefById())){
OLplaceLayer();if(OLhidePI)OLhideUtil(0,1,1,0,0,0);}
if(OLhover&&over&&o3_frame==self&&OLcursorOff())if(o3_offdelay<1)OLcC();else
{if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=setTimeout("OLcC()",o3_offdelay);}
}
function OLmh(){
var fN,f,j,k,s,mh=OLmouseMove,w=(OLns4&&window.onmousemove),re=/function[ ]*(\w*)\(/;
OLdw=document;if(document.onmousemove||w){if(w)OLdw=window;f=OLdw.onmousemove.toString();
fN=f.match(re);if(!fN||fN[1]=='anonymous'||fN[1]=='OLmouseMove'){OLchkMh=0;return;}
if(fN[1])s=fN[1]+'(e)';else{j=f.indexOf('{');k=f.lastIndexOf('}')+1;s=f.substring(j,k);}
s+=';OLmouseMove(e);';mh=new Function('e',s);}
OLdw.onmousemove=mh;if(OLns4)OLdw.captureEvents(Event.MOUSEMOVE);
}
/*
PARSING
*/
function OLparseTokens(pf,ar){
var i,v,md= -1,par=(pf!='ol_'),p=OLpar,q=OLparQuo,t=OLtoggle;OLudf=(par&&!ar.length?1:0);
for(i=0;i< ar.length;i++){if(md<0){if(typeof ar[i]=='number'){OLudf=(par?1:0);i--;}
else{switch(pf){case 'ol_':ol_text=ar[i];break;default:o3_text=ar[i];}}md=0;
}else{
if(ar[i]==INARRAY){OLudf=0;eval(pf+'text=ol_texts['+ar[++i]+']');continue;}
if(ar[i]==CAPARRAY){eval(pf+'cap=ol_caps['+ar[++i]+']');continue;}
if(ar[i]==CAPTION){q(ar[++i],pf+'cap');continue;}
if(Math.abs(ar[i])==STICKY){t(ar[i],pf+'sticky');continue;}
if(Math.abs(ar[i])==NOFOLLOW){t(ar[i],pf+'nofollow');continue;}
if(ar[i]==BACKGROUND){q(ar[++i],pf+'background');continue;}
if(Math.abs(ar[i])==NOCLOSE){t(ar[i],pf+'noclose');continue;}
if(Math.abs(ar[i])==MOUSEOFF){t(ar[i],pf+'mouseoff');continue;}
if(ar[i]==OFFDELAY){p(ar[++i],pf+'offdelay');continue;}
if(ar[i]==RIGHT||ar[i]==LEFT||ar[i]==CENTER){p(ar[i],pf+'hpos');continue;}
if(ar[i]==OFFSETX){p(ar[++i],pf+'offsetx');continue;}
if(ar[i]==OFFSETY){p(ar[++i],pf+'offsety');continue;}
if(ar[i]==FGCOLOR){q(ar[++i],pf+'fgcolor');continue;}
if(ar[i]==BGCOLOR){q(ar[++i],pf+'bgcolor');continue;}
if(ar[i]==CGCOLOR){q(ar[++i],pf+'cgcolor');continue;}
if(ar[i]==TEXTCOLOR){q(ar[++i],pf+'textcolor');continue;}
if(ar[i]==CAPCOLOR){q(ar[++i],pf+'capcolor');continue;}
if(ar[i]==CLOSECOLOR){q(ar[++i],pf+'closecolor');continue;}
if(ar[i]==WIDTH){p(ar[++i],pf+'width');continue;}
if(Math.abs(ar[i])==WRAP){t(ar[i],pf+'wrap');continue;}
if(ar[i]==WRAPMAX){p(ar[++i],pf+'wrapmax');continue;}
if(ar[i]==HEIGHT){p(ar[++i],pf+'height');continue;}
if(ar[i]==BORDER){p(ar[++i],pf+'border');continue;}
if(ar[i]==BASE){p(ar[++i],pf+'base');continue;}
if(ar[i]==STATUS){q(ar[++i],pf+'status');continue;}
if(Math.abs(ar[i])==AUTOSTATUS){v=pf+'autostatus';
eval(v+'=('+ar[i]+'<0)?('+v+'==2?2:0):('+v+'==1?0:1)');continue;}
if(Math.abs(ar[i])==AUTOSTATUSCAP){v=pf+'autostatus';
eval(v+'=('+ar[i]+'<0)?('+v+'==1?1:0):('+v+'==2?0:2)');continue;}
if(ar[i]==CLOSETEXT){q(ar[++i],pf+'close');continue;}
if(ar[i]==SNAPX){p(ar[++i],pf+'snapx');continue;}
if(ar[i]==SNAPY){p(ar[++i],pf+'snapy');continue;}
if(ar[i]==FIXX){p(ar[++i],pf+'fixx');continue;}
if(ar[i]==FIXY){p(ar[++i],pf+'fixy');continue;}
if(ar[i]==RELX){p(ar[++i],pf+'relx');continue;}
if(ar[i]==RELY){p(ar[++i],pf+'rely');continue;}
if(ar[i]==MIDX){p(ar[++i],pf+'midx');continue;}
if(ar[i]==MIDY){p(ar[++i],pf+'midy');continue;}
if(ar[i]==REF){q(ar[++i],pf+'ref');continue;}
if(ar[i]==REFC){q(ar[++i],pf+'refc');continue;}
if(ar[i]==REFP){q(ar[++i],pf+'refp');continue;}
if(ar[i]==REFX){p(ar[++i],pf+'refx');continue;}
if(ar[i]==REFY){p(ar[++i],pf+'refy');continue;}
if(ar[i]==FGBACKGROUND){q(ar[++i],pf+'fgbackground');continue;}
if(ar[i]==BGBACKGROUND){q(ar[++i],pf+'bgbackground');continue;}
if(ar[i]==CGBACKGROUND){q(ar[++i],pf+'cgbackground');continue;}
if(ar[i]==PADX){p(ar[++i],pf+'padxl');p(ar[++i],pf+'padxr');continue;}
if(ar[i]==PADY){p(ar[++i],pf+'padyt');p(ar[++i],pf+'padyb');continue;}
if(Math.abs(ar[i])==FULLHTML){t(ar[i],pf+'fullhtml');continue;}
if(ar[i]==BELOW||ar[i]==ABOVE||ar[i]==VCENTER){p(ar[i],pf+'vpos');continue;}
if(ar[i]==CAPICON){q(ar[++i],pf+'capicon');continue;}
if(ar[i]==TEXTFONT){q(ar[++i],pf+'textfont');continue;}
if(ar[i]==CAPTIONFONT){q(ar[++i],pf+'captionfont');continue;}
if(ar[i]==CLOSEFONT){q(ar[++i],pf+'closefont');continue;}
if(ar[i]==TEXTSIZE){q(ar[++i],pf+'textsize');continue;}
if(ar[i]==CAPTIONSIZE){q(ar[++i],pf+'captionsize');continue;}
if(ar[i]==CLOSESIZE){q(ar[++i],pf+'closesize');continue;}
if(ar[i]==TIMEOUT){p(ar[++i],pf+'timeout');continue;}
if(ar[i]==DELAY){p(ar[++i],pf+'delay');continue;}
if(Math.abs(ar[i])==HAUTO){t(ar[i],pf+'hauto');continue;}
if(Math.abs(ar[i])==VAUTO){t(ar[i],pf+'vauto');continue;}
if(Math.abs(ar[i])==NOJUSTX){t(ar[i],pf+'nojustx');continue;}
if(Math.abs(ar[i])==NOJUSTY){t(ar[i],pf+'nojusty');continue;}
if(Math.abs(ar[i])==CLOSECLICK){t(ar[i],pf+'closeclick');continue;}
if(ar[i]==CLOSETITLE){q(ar[++i],pf+'closetitle');continue;}
if(ar[i]==FGCLASS){q(ar[++i],pf+'fgclass');continue;}
if(ar[i]==BGCLASS){q(ar[++i],pf+'bgclass');continue;}
if(ar[i]==CGCLASS){q(ar[++i],pf+'cgclass');continue;}
if(ar[i]==TEXTPADDING){p(ar[++i],pf+'textpadding');continue;}
if(ar[i]==TEXTFONTCLASS){q(ar[++i],pf+'textfontclass');continue;}
if(ar[i]==CAPTIONPADDING){p(ar[++i],pf+'captionpadding');continue;}
if(ar[i]==CAPTIONFONTCLASS){q(ar[++i],pf+'captionfontclass');continue;}
if(ar[i]==CLOSEFONTCLASS){q(ar[++i],pf+'closefontclass');continue;}
if(Math.abs(ar[i])==CAPBELOW){t(ar[i],pf+'capbelow');continue;}
if(ar[i]==LABEL){q(ar[++i],pf+'label');continue;}
if(Math.abs(ar[i])==DECODE){t(ar[i],pf+'decode');continue;}
if(ar[i]==DONOTHING){continue;}
i=OLparseCmdLine(pf,i,ar);}}
if((OLfunctionPI)&&OLudf&&o3_function)o3_text=o3_function();
if(pf=='o3_')OLfontSize();
}
function OLpar(a,v){eval(v+'='+a);}
function OLparQuo(a,v){eval(v+"='"+OLescSglQt(a)+"'");}
function OLescSglQt(s){return s.toString().replace(/'/g,"\\'");}
function OLtoggle(a,v){eval(v+'=('+v+'==0&&'+a+'>=0)?1:0');}
function OLhasDims(s){return /[%\-a-z]+$/.test(s);}
function OLfontSize(){
var i;if(OLhasDims(o3_textsize)){if(OLns4)o3_textsize="2";}else
if(!OLns4){i=parseInt(o3_textsize);o3_textsize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
if(OLhasDims(o3_captionsize)){if(OLns4)o3_captionsize="2";}else
if(!OLns4){i=parseInt(o3_captionsize);o3_captionsize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
if(OLhasDims(o3_closesize)){if(OLns4)o3_closesize="2";}else
if(!OLns4){i=parseInt(o3_closesize);o3_closesize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
if(OLprintPI)OLprintDims();
}
function OLdecode(){
var re=/%[0-9A-Fa-f]{2,}/,t=o3_text,c=o3_cap,u=unescape,d=!OLns4&&(!OLgek||OLgek>=20020826)
&&typeof decodeURIComponent?decodeURIComponent:u;if(typeof(window.TypeError)=='function'){
if(re.test(t)){eval(new Array('try{','o3_text=d(t);','}catch(e){','o3_text=u(t);',
'}').join('\n'))};if(c&&re.test(c)){eval(new Array('try{','o3_cap=d(c);','}catch(e){',
'o3_cap=u(c);','}').join('\n'))}}else{if(re.test(t))o3_text=u(t);if(c&&re.test(c))o3_cap=u(c);}
}
/*
LAYER FUNCTIONS
*/
function OLlayerWrite(t){
t+="\n";
if(OLns4){over.document.write(t);over.document.close();
}else if(typeof over.innerHTML!='undefined'){if(OLieM)over.innerHTML='';over.innerHTML=t;
}else{range=o3_frame.document.createRange();range.setStartAfter(over);
domfrag=range.createContextualFragment(t);
while(over.hasChildNodes()){over.removeChild(over.lastChild);}
over.appendChild(domfrag);}
if(OLprintPI)over.print=o3_print?t:null;
}
function OLshowObject(o){
OLshowid=0;o=(OLns4)?o:o.style;
if(((OLfilterPI)&&!OLchkFilter(o))||!OLfilterPI)o.visibility="visible";
if(OLshadowPI)OLshowShadow();if(OLiframePI)OLshowIfs();if(OLhidePI)OLhideUtil(1,1,0);
}
function OLhideObject(o){
if(OLshowid>0){clearTimeout(OLshowid);OLshowid=0;}
if(OLtimerid>0)clearTimeout(OLtimerid);if(OLdelayid>0)clearTimeout(OLdelayid);
OLtimerid=0;OLdelayid=0;self.status="";o3_label=ol_label;
if(o3_frame!=self)o=OLgetRefById();
if(o){if(o.onmouseover)o.onmouseover=null;
if(OLscrollPI&&o==over)OLclearScroll();
if(OLdraggablePI)OLclearDrag();
if(OLfilterPI)OLcleanupFilter(o);if(OLshadowPI)OLhideShadow();
var os=(OLns4)?o:o.style;os.visibility="hidden";
if(OLhidePI&&o==over)OLhideUtil(0,0,1);if(OLiframePI)OLhideIfs(o);}
}
function OLrepositionTo(o,xL,yL){
o=(OLns4)?o:o.style;
o.left=(OLns4?xL:xL+'px');
o.top=(OLns4?yL:yL+'px');
}
function OLoptMOUSEOFF(c){
if(!c)o3_close="";
over.onmouseover=function(){OLhover=1;if(OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;}}
}
function OLcursorOff(){
var o=(OLns4?over:over.style),pHt=OLns4?over.clip.height:over.offsetHeight,
left=parseInt(o.left),top=parseInt(o.top),
right=left+o3_width,bottom=top+((OLbubblePI&&o3_bubble)?OLbubbleHt:pHt);
if(OLx<left||OLx>right||OLy<top||OLy>bottom)return true;
return false;
}
/*
REGISTRATION
*/
function OLsetRunTimeVar(){
if(OLrunTime.length)for(var k=0;k<OLrunTime.length;k++)OLrunTime[k]();
}
function OLparseCmdLine(pf,i,ar){
if(OLcmdLine.length){for(var k=0;k<OLcmdLine.length;k++){
var j=OLcmdLine[k](pf,i,ar);if(j>-1){i=j;break;}}}
return i;
}
function OLregCmds(c){
if(typeof c!='string')return;
var pM=c.split(',');pMtr=pMtr.concat(pM);
for(var i=0;i<pM.length;i++)eval(pM[i].toUpperCase()+'='+pmCnt++);
}
function OLregRunTimeFunc(f){
if(typeof f=='object')OLrunTime=OLrunTime.concat(f);
else OLrunTime[OLrunTime.length++]=f;
}
function OLregCmdLineFunc(f){
if(typeof f=='object')OLcmdLine=OLcmdLine.concat(f);
else OLcmdLine[OLcmdLine.length++]=f;
}
OLloaded=1;
/*  Prototype JavaScript framework, version 1.5.0
*  (c) 2005-2007 Sam Stephenson
*
*  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',
BrowserFeatures: {
XPath: !!document.evaluate
},
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.extend(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;
}
},
keys: function(object) {
var keys = [];
for (var property in object)
keys.push(property);
return keys;
},
values: function(object) {
var values = [];
for (var property in object)
values.push(object[property]);
return values;
},
clone: function(object) {
return Object.extend({}, object);
}
});
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, args = $A(arguments), object = args.shift();
return function(event) {
return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments)));
}
}
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, length = arguments.length; i < 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() {
this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
},
stop: function() {
if (!this.timer) return;
clearInterval(this.timer);
this.timer = null;
},
onTimerEvent: function() {
if (!this.currentlyExecuting) {
try {
this.currentlyExecuting = true;
this.callback(this);
} finally {
this.currentlyExecuting = false;
}
}
}
}
String.interpret = function(value){
return value == null ? '' : String(value);
}
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 += String.interpret(replacement(match));
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.length > 1 ?
$A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) :
div.childNodes[0].nodeValue) : '';
},
toQueryParams: function(separator) {
var match = this.strip().match(/([^?#]*)(#.*)?$/);
if (!match) return {};
return match[1].split(separator || '&').inject({}, function(hash, pair) {
if ((pair = pair.split('='))[0]) {
var name = decodeURIComponent(pair[0]);
var value = pair[1] ? decodeURIComponent(pair[1]) : undefined;
if (hash[name] !== undefined) {
if (hash[name].constructor != Array)
hash[name] = [hash[name]];
if (value) hash[name].push(value);
}
else hash[name] = value;
}
return hash;
});
},
toArray: function() {
return this.split('');
},
succ: function() {
return this.slice(0, this.length - 1) +
String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
},
camelize: function() {
var parts = this.split('-'), len = parts.length;
if (len == 1) return parts[0];
var camelized = this.charAt(0) == '-'
? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
: parts[0];
for (var i = 1; i < len; i++)
camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
return camelized;
},
capitalize: function(){
return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
},
underscore: function() {
return this;
},
dasherize: function() {
return this.gsub(/_/,'-');
},
inspect: function(useDoubleQuotes) {
var escapedString = this.replace(/\\/g, '\\\\');
if (useDoubleQuotes)
return '"' + escapedString.replace(/"/g, '\\"') + '"';
else
return "'" + escapedString.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 + String.interpret(object[match[3]]);
});
}
}
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;
}
return this;
},
eachSlice: function(number, iterator) {
var index = -number, slices = [], array = this.toArray();
while ((index += number) < array.length)
slices.push(array.slice(index, index+number));
return slices.map(iterator);
},
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 = false;
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 || Prototype.K)(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;
},
inGroupsOf: function(number, fillWith) {
fillWith = fillWith === undefined ? null : fillWith;
return this.eachSlice(number, function(slice) {
while(slice.length < number) slice.push(fillWith);
return slice;
});
},
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.map(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.map(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.map();
},
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));
});
},
size: function() {
return this.toArray().length;
},
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, length = iterable.length; i < 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, length = this.length; i < 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 != 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, length = this.length; i < length; i++)
if (this[i] == object) return i;
return -1;
},
reverse: function(inline) {
return (inline !== false ? this : this.toArray())._reverse();
},
reduce: function() {
return this.length > 1 ? this : this[0];
},
uniq: function() {
return this.inject([], function(array, value) {
return array.include(value) ? array : array.concat([value]);
});
},
clone: function() {
return [].concat(this);
},
size: function() {
return this.length;
},
inspect: function() {
return '[' + this.map(Object.inspect).join(', ') + ']';
}
});
Array.prototype.toArray = Array.prototype.clone;
function $w(string){
string = string.strip();
return string ? string.split(/\s+/) : [];
}
if(window.opera){
Array.prototype.concat = function(){
var array = [];
for(var i = 0, length = this.length; i < length; i++) array.push(this[i]);
for(var i = 0, length = arguments.length; i < length; i++) {
if(arguments[i].constructor == Array) {
for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
array.push(arguments[i][j]);
} else {
array.push(arguments[i]);
}
}
return array;
}
}
var Hash = function(obj) {
Object.extend(this, obj || {});
};
Object.extend(Hash, {
toQueryString: function(obj) {
var parts = [];
this.prototype._each.call(obj, function(pair) {
if (!pair.key) return;
if (pair.value && pair.value.constructor == Array) {
var values = pair.value.compact();
if (values.length < 2) pair.value = values.reduce();
else {
key = encodeURIComponent(pair.key);
values.each(function(value) {
value = value != undefined ? encodeURIComponent(value) : '';
parts.push(key + '=' + encodeURIComponent(value));
});
return;
}
}
if (pair.value == undefined) pair[1] = '';
parts.push(pair.map(encodeURIComponent).join('='));
});
return parts.join('&');
}
});
Object.extend(Hash.prototype, Enumerable);
Object.extend(Hash.prototype, {
_each: function(iterator) {
for (var key in this) {
var value = this[key];
if (value && value == Hash.prototype[key]) 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(this, function(mergedHash, pair) {
mergedHash[pair.key] = pair.value;
return mergedHash;
});
},
remove: function() {
var result;
for(var i = 0, length = arguments.length; i < length; i++) {
var value = this[arguments[i]];
if (value !== undefined){
if (result === undefined) result = value;
else {
if (result.constructor != Array) result = [result];
result.push(value)
}
}
delete this[arguments[i]];
}
return result;
},
toQueryString: function() {
return Hash.toQueryString(this);
},
inspect: function() {
return '#<Hash:{' + this.map(function(pair) {
return pair.map(Object.inspect).join(': ');
}).join(', ') + '}>';
}
});
function $H(object) {
if (object && object.constructor == Hash) return object;
return new Hash(object);
};
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;
while (this.include(value)) {
iterator(value);
value = value.succ();
}
},
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(responder) {
if (!this.include(responder))
this.responders.push(responder);
},
unregister: function(responder) {
this.responders = this.responders.without(responder);
},
dispatch: function(callback, request, transport, json) {
this.each(function(responder) {
if (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',
encoding:     'UTF-8',
parameters:   ''
}
Object.extend(this.options, options || {});
this.options.method = this.options.method.toLowerCase();
if (typeof this.options.parameters == 'string')
this.options.parameters = this.options.parameters.toQueryParams();
}
}
Ajax.Request = Class.create();
Ajax.Request.Events =
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
_complete: false,
initialize: function(url, options) {
this.transport = Ajax.getTransport();
this.setOptions(options);
this.request(url);
},
request: function(url) {
this.url = url;
this.method = this.options.method;
var params = this.options.parameters;
if (!['get', 'post'].include(this.method)) {
params['_method'] = this.method;
this.method = 'post';
}
params = Hash.toQueryString(params);
if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_='
if (this.method == 'get' && params)
this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params;
try {
Ajax.Responders.dispatch('onCreate', this, this.transport);
this.transport.open(this.method.toUpperCase(), this.url,
this.options.asynchronous);
if (this.options.asynchronous)
setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);
this.transport.onreadystatechange = this.onStateChange.bind(this);
this.setRequestHeaders();
var body = this.method == 'post' ? (this.options.postBody || params) : null;
this.transport.send(body);
/* Force Firefox to handle ready state 4 for synchronous requests */
if (!this.options.asynchronous && this.transport.overrideMimeType)
this.onStateChange();
}
catch (e) {
this.dispatchException(e);
}
},
onStateChange: function() {
var readyState = this.transport.readyState;
if (readyState > 1 && !((readyState == 4) && this._complete))
this.respondToReadyState(this.transport.readyState);
},
setRequestHeaders: function() {
var headers = {
'X-Requested-With': 'XMLHttpRequest',
'X-Prototype-Version': Prototype.Version,
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
};
if (this.method == 'post') {
headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');
/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
* Content-length header. See Mozilla Bugzilla #246651.
*/
if (this.transport.overrideMimeType &&
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
headers['Connection'] = 'close';
}
if (typeof this.options.requestHeaders == 'object') {
var extras = this.options.requestHeaders;
if (typeof extras.push == 'function')
for (var i = 0, length = extras.length; i < length; i += 2)
headers[extras[i]] = extras[i+1];
else
$H(extras).each(function(pair) { headers[pair.key] = pair.value });
}
for (var name in headers)
this.transport.setRequestHeader(name, headers[name]);
},
success: function() {
return !this.transport.status
|| (this.transport.status >= 200 && this.transport.status < 300);
},
respondToReadyState: function(readyState) {
var state = Ajax.Request.Events[readyState];
var transport = this.transport, json = this.evalJSON();
if (state == 'Complete') {
try {
this._complete = true;
(this.options['on' + this.transport.status]
|| this.options['on' + (this.success() ? 'Success' : 'Failure')]
|| Prototype.emptyFunction)(transport, json);
} catch (e) {
this.dispatchException(e);
}
if ((this.getHeader('Content-type') || 'text/javascript').strip().
match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
this.evalResponse();
}
try {
(this.options['on' + state] || Prototype.emptyFunction)(transport, json);
Ajax.Responders.dispatch('on' + state, this, transport, json);
} catch (e) {
this.dispatchException(e);
}
if (state == 'Complete') {
this.transport.onreadystatechange = Prototype.emptyFunction;
}
},
getHeader: function(name) {
try {
return this.transport.getResponseHeader(name);
} catch (e) { return null }
},
evalJSON: function() {
try {
var json = this.getHeader('X-JSON');
return json ? eval('(' + json + ')') : null;
} catch (e) { return null }
},
evalResponse: function() {
try {
return eval(this.transport.responseText);
} catch (e) {
this.dispatchException(e);
}
},
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.container = {
success: (container.success || 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, param) {
this.updateContent();
onComplete(transport, param);
}).bind(this);
this.request(url);
},
updateContent: function() {
var receiver = this.container[this.success() ? 'success' : 'failure'];
var response = this.transport.responseText;
if (!this.options.evalScripts) response = response.stripScripts();
if (receiver = $(receiver)) {
if (this.options.insertion)
new this.options.insertion(receiver, response);
else
receiver.update(response);
}
if (this.success()) {
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.options.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 $(element) {
if (arguments.length > 1) {
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
elements.push($(arguments[i]));
return elements;
}
if (typeof element == 'string')
element = document.getElementById(element);
return Element.extend(element);
}
if (Prototype.BrowserFeatures.XPath) {
document._getElementsByXPath = function(expression, parentElement) {
var results = [];
var query = document.evaluate(expression, $(parentElement) || document,
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0, length = query.snapshotLength; i < length; i++)
results.push(query.snapshotItem(i));
return results;
};
}
document.getElementsByClassName = function(className, parentElement) {
if (Prototype.BrowserFeatures.XPath) {
var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
return document._getElementsByXPath(q, parentElement);
} else {
var children = ($(parentElement) || document.body).getElementsByTagName('*');
var elements = [], child;
for (var i = 0, length = children.length; i < length; i++) {
child = children[i];
if (Element.hasClassName(child, className))
elements.push(Element.extend(child));
}
return elements;
}
};
/*--------------------------------------------------------------------------*/
if (!window.Element)
var Element = new Object();
Element.extend = function(element) {
if (!element || _nativeExtensions || element.nodeType == 3) return element;
if (!element._extended && element.tagName && element != window) {
var methods = Object.clone(Element.Methods), cache = Element.extend.cache;
if (element.tagName == 'FORM')
Object.extend(methods, Form.Methods);
if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName))
Object.extend(methods, Form.Element.Methods);
Object.extend(methods, Element.Methods.Simulated);
for (var property in methods) {
var value = methods[property];
if (typeof value == 'function' && !(property in element))
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(element) {
element = $(element);
Element[Element.visible(element) ? 'hide' : 'show'](element);
return element;
},
hide: function(element) {
$(element).style.display = 'none';
return element;
},
show: function(element) {
$(element).style.display = '';
return element;
},
remove: function(element) {
element = $(element);
element.parentNode.removeChild(element);
return element;
},
update: function(element, html) {
html = typeof html == 'undefined' ? '' : html.toString();
$(element).innerHTML = html.stripScripts();
setTimeout(function() {html.evalScripts()}, 10);
return element;
},
replace: function(element, html) {
element = $(element);
html = typeof html == 'undefined' ? '' : html.toString();
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);
return element;
},
inspect: function(element) {
element = $(element);
var result = '<' + element.tagName.toLowerCase();
$H({'id': 'id', 'className': 'class'}).each(function(pair) {
var property = pair.first(), attribute = pair.last();
var value = (element[property] || '').toString();
if (value) result += ' ' + attribute + '=' + value.inspect(true);
});
return result + '>';
},
recursivelyCollect: function(element, property) {
element = $(element);
var elements = [];
while (element = element[property])
if (element.nodeType == 1)
elements.push(Element.extend(element));
return elements;
},
ancestors: function(element) {
return $(element).recursivelyCollect('parentNode');
},
descendants: function(element) {
return $A($(element).getElementsByTagName('*'));
},
immediateDescendants: function(element) {
if (!(element = $(element).firstChild)) return [];
while (element && element.nodeType != 1) element = element.nextSibling;
if (element) return [element].concat($(element).nextSiblings());
return [];
},
previousSiblings: function(element) {
return $(element).recursivelyCollect('previousSibling');
},
nextSiblings: function(element) {
return $(element).recursivelyCollect('nextSibling');
},
siblings: function(element) {
element = $(element);
return element.previousSiblings().reverse().concat(element.nextSiblings());
},
match: function(element, selector) {
if (typeof selector == 'string')
selector = new Selector(selector);
return selector.match($(element));
},
up: function(element, expression, index) {
return Selector.findElement($(element).ancestors(), expression, index);
},
down: function(element, expression, index) {
return Selector.findElement($(element).descendants(), expression, index);
},
previous: function(element, expression, index) {
return Selector.findElement($(element).previousSiblings(), expression, index);
},
next: function(element, expression, index) {
return Selector.findElement($(element).nextSiblings(), expression, index);
},
getElementsBySelector: function() {
var args = $A(arguments), element = $(args.shift());
return Selector.findChildElements(element, args);
},
getElementsByClassName: function(element, className) {
return document.getElementsByClassName(className, element);
},
readAttribute: function(element, name) {
element = $(element);
if (document.all && !window.opera) {
var t = Element._attributeTranslations;
if (t.values[name]) return t.values[name](element, name);
if (t.names[name])  name = t.names[name];
var attribute = element.attributes[name];
if(attribute) return attribute.nodeValue;
}
return element.getAttribute(name);
},
getHeight: function(element) {
return $(element).getDimensions().height;
},
getWidth: function(element) {
return $(element).getDimensions().width;
},
classNames: function(element) {
return new Element.ClassNames(element);
},
hasClassName: function(element, className) {
if (!(element = $(element))) return;
var elementClassName = element.className;
if (elementClassName.length == 0) return false;
if (elementClassName == className ||
elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
return true;
return false;
},
addClassName: function(element, className) {
if (!(element = $(element))) return;
Element.classNames(element).add(className);
return element;
},
removeClassName: function(element, className) {
if (!(element = $(element))) return;
Element.classNames(element).remove(className);
return element;
},
toggleClassName: function(element, className) {
if (!(element = $(element))) return;
Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
return element;
},
observe: function() {
Event.observe.apply(Event, arguments);
return $A(arguments).first();
},
stopObserving: function() {
Event.stopObserving.apply(Event, arguments);
return $A(arguments).first();
},
cleanWhitespace: function(element) {
element = $(element);
var node = element.firstChild;
while (node) {
var nextNode = node.nextSibling;
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
element.removeChild(node);
node = nextNode;
}
return element;
},
empty: function(element) {
return $(element).innerHTML.match(/^\s*$/);
},
descendantOf: function(element, ancestor) {
element = $(element), ancestor = $(ancestor);
while (element = element.parentNode)
if (element == ancestor) return true;
return false;
},
scrollTo: function(element) {
element = $(element);
var pos = Position.cumulativeOffset(element);
window.scrollTo(pos[0], pos[1]);
return element;
},
getStyle: function(element, style) {
element = $(element);
if (['float','cssFloat'].include(style))
style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat');
style = style.camelize();
var value = element.style[style];
if (!value) {
if (document.defaultView && document.defaultView.getComputedStyle) {
var css = document.defaultView.getComputedStyle(element, null);
value = css ? css[style] : null;
} else if (element.currentStyle) {
value = element.currentStyle[style];
}
}
if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none'))
value = element['offset'+style.capitalize()] + 'px';
if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
if (Element.getStyle(element, 'position') == 'static') value = 'auto';
if(style == 'opacity') {
if(value) return parseFloat(value);
if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
if(value[1]) return parseFloat(value[1]) / 100;
return 1.0;
}
return value == 'auto' ? null : value;
},
setStyle: function(element, style) {
element = $(element);
for (var name in style) {
var value = style[name];
if(name == 'opacity') {
if (value == 1) {
value = (/Gecko/.test(navigator.userAgent) &&
!/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0;
if(/MSIE/.test(navigator.userAgent) && !window.opera)
element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
} else if(value == '') {
if(/MSIE/.test(navigator.userAgent) && !window.opera)
element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'');
} else {
if(value < 0.00001) value = 0;
if(/MSIE/.test(navigator.userAgent) && !window.opera)
element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') +
'alpha(opacity='+value*100+')';
}
} else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat';
element.style[name.camelize()] = value;
}
return element;
},
getDimensions: function(element) {
element = $(element);
var display = $(element).getStyle('display');
if (display != 'none' && display != null) // Safari bug
return {width: element.offsetWidth, height: element.offsetHeight};
var els = element.style;
var originalVisibility = els.visibility;
var originalPosition = els.position;
var originalDisplay = els.display;
els.visibility = 'hidden';
els.position = 'absolute';
els.display = 'block';
var originalWidth = element.clientWidth;
var originalHeight = element.clientHeight;
els.display = originalDisplay;
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';
if (window.opera) {
element.style.top = 0;
element.style.left = 0;
}
}
return element;
},
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 = '';
}
return element;
},
makeClipping: function(element) {
element = $(element);
if (element._overflow) return element;
element._overflow = element.style.overflow || 'auto';
if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
element.style.overflow = 'hidden';
return element;
},
undoClipping: function(element) {
element = $(element);
if (!element._overflow) return element;
element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
element._overflow = null;
return element;
}
};
Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf});
Element._attributeTranslations = {};
Element._attributeTranslations.names = {
colspan:   "colSpan",
rowspan:   "rowSpan",
valign:    "vAlign",
datetime:  "dateTime",
accesskey: "accessKey",
tabindex:  "tabIndex",
enctype:   "encType",
maxlength: "maxLength",
readonly:  "readOnly",
longdesc:  "longDesc"
};
Element._attributeTranslations.values = {
_getAttr: function(element, attribute) {
return element.getAttribute(attribute, 2);
},
_flag: function(element, attribute) {
return $(element).hasAttribute(attribute) ? attribute : null;
},
style: function(element) {
return element.style.cssText.toLowerCase();
},
title: function(element) {
var node = element.getAttributeNode('title');
return node.specified ? node.nodeValue : null;
}
};
Object.extend(Element._attributeTranslations.values, {
href: Element._attributeTranslations.values._getAttr,
src:  Element._attributeTranslations.values._getAttr,
disabled: Element._attributeTranslations.values._flag,
checked:  Element._attributeTranslations.values._flag,
readonly: Element._attributeTranslations.values._flag,
multiple: Element._attributeTranslations.values._flag
});
Element.Methods.Simulated = {
hasAttribute: function(element, attribute) {
var t = Element._attributeTranslations;
attribute = t.names[attribute] || attribute;
return $(element).getAttributeNode(attribute).specified;
}
};
if (document.all && !window.opera){
Element.Methods.update = function(element, html) {
element = $(element);
html = typeof html == 'undefined' ? '' : html.toString();
var tagName = element.tagName.toUpperCase();
if (['THEAD','TBODY','TR','TD'].include(tagName)) {
var div = document.createElement('div');
switch (tagName) {
case 'THEAD':
case 'TBODY':
div.innerHTML = '<table><tbody>' +  html.stripScripts() + '</tbody></table>';
depth = 2;
break;
case 'TR':
div.innerHTML = '<table><tbody><tr>' +  html.stripScripts() + '</tr></tbody></table>';
depth = 3;
break;
case 'TD':
div.innerHTML = '<table><tbody><tr><td>' +  html.stripScripts() + '</td></tr></tbody></table>';
depth = 4;
}
$A(element.childNodes).each(function(node){
element.removeChild(node)
});
depth.times(function(){ div = div.firstChild });
$A(div.childNodes).each(
function(node){ element.appendChild(node) });
} else {
element.innerHTML = html.stripScripts();
}
setTimeout(function() {html.evalScripts()}, 10);
return element;
}
};
Object.extend(Element, Element.Methods);
var _nativeExtensions = false;
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) {
var className = 'HTML' + tag + 'Element';
if(window[className]) return;
var klass = window[className] = {};
klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__;
});
Element.addMethods = function(methods) {
Object.extend(Element.Methods, methods || {});
function copy(methods, destination, onlyIfAbsent) {
onlyIfAbsent = onlyIfAbsent || false;
var cache = Element.extend.cache;
for (var property in methods) {
var value = methods[property];
if (!onlyIfAbsent || !(property in destination))
destination[property] = cache.findOrStore(value);
}
}
if (typeof HTMLElement != 'undefined') {
copy(Element.Methods, HTMLElement.prototype);
copy(Element.Methods.Simulated, HTMLElement.prototype, true);
copy(Form.Methods, HTMLFormElement.prototype);
[HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) {
copy(Form.Element.Methods, klass.prototype);
});
_nativeExtensions = true;
}
}
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.toUpperCase();
if (['TBODY', 'TR'].include(tagName)) {
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($A(this).concat(classNameToAdd).join(' '));
},
remove: function(classNameToRemove) {
if (!this.include(classNameToRemove)) return;
this.set($A(this).without(classNameToRemove).join(' '));
},
toString: function() {
return $A(this).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.readAttribute("id") == ' + clause.inspect());
if (clause = params.tagName)
conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
if ((clause = params.classNames).length > 0)
for (var i = 0, length = clause.length; i < length; i++)
conditions.push('element.hasClassName(' + clause[i].inspect() + ')');
if (clause = params.attributes) {
clause.each(function(attribute) {
var value = 'element.readAttribute(' + 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('element.hasAttribute(' + attribute.name.inspect() + ')'); break;
default:        throw 'Unknown operator ' + attribute.operator + ' in selector';
}
});
}
return conditions.join(' && ');
},
compileMatcher: function() {
this.match = new Function('element', 'if (!element.tagName) return false; \
element = $(element); \
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, length = scope.length; i < length; i++)
if (this.match(element = scope[i]))
results.push(Element.extend(element));
return results;
},
toString: function() {
return this.expression;
}
}
Object.extend(Selector, {
matchElements: function(elements, expression) {
var selector = new Selector(expression);
return elements.select(selector.match.bind(selector)).map(Element.extend);
},
findElement: function(elements, expression, index) {
if (typeof expression == 'number') index = expression, expression = false;
return Selector.matchElements(elements, expression || '*')[index || 0];
},
findChildElements: function(element, expressions) {
return expressions.map(function(expression) {
return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) {
var selector = new Selector(expr);
return results.inject([], function(elements, result) {
return elements.concat(selector.findElements(result || element));
});
});
}).flatten();
}
});
function $$() {
return Selector.findChildElements(document, $A(arguments));
}
var Form = {
reset: function(form) {
$(form).reset();
return form;
},
serializeElements: function(elements, getHash) {
var data = elements.inject({}, function(result, element) {
if (!element.disabled && element.name) {
var key = element.name, value = $(element).getValue();
if (value != undefined) {
if (result[key]) {
if (result[key].constructor != Array) result[key] = [result[key]];
result[key].push(value);
}
else result[key] = value;
}
}
return result;
});
return getHash ? data : Hash.toQueryString(data);
}
};
Form.Methods = {
serialize: function(form, getHash) {
return Form.serializeElements(Form.getElements(form), getHash);
},
getElements: function(form) {
return $A($(form).getElementsByTagName('*')).inject([],
function(elements, child) {
if (Form.Element.Serializers[child.tagName.toLowerCase()])
elements.push(Element.extend(child));
return elements;
}
);
},
getInputs: function(form, typeName, name) {
form = $(form);
var inputs = form.getElementsByTagName('input');
if (!typeName && !name) return $A(inputs).map(Element.extend);
for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
var input = inputs[i];
if ((typeName && input.type != typeName) || (name && input.name != name))
continue;
matchingInputs.push(Element.extend(input));
}
return matchingInputs;
},
disable: function(form) {
form = $(form);
form.getElements().each(function(element) {
element.blur();
element.disabled = 'true';
});
return form;
},
enable: function(form) {
form = $(form);
form.getElements().each(function(element) {
element.disabled = '';
});
return form;
},
findFirstElement: function(form) {
return $(form).getElements().find(function(element) {
return element.type != 'hidden' && !element.disabled &&
['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
});
},
focusFirstElement: function(form) {
form = $(form);
form.findFirstElement().activate();
return form;
}
}
Object.extend(Form, Form.Methods);
/*--------------------------------------------------------------------------*/
Form.Element = {
focus: function(element) {
$(element).focus();
return element;
},
select: function(element) {
$(element).select();
return element;
}
}
Form.Element.Methods = {
serialize: function(element) {
element = $(element);
if (!element.disabled && element.name) {
var value = element.getValue();
if (value != undefined) {
var pair = {};
pair[element.name] = value;
return Hash.toQueryString(pair);
}
}
return '';
},
getValue: function(element) {
element = $(element);
var method = element.tagName.toLowerCase();
return Form.Element.Serializers[method](element);
},
clear: function(element) {
$(element).value = '';
return element;
},
present: function(element) {
return $(element).value != '';
},
activate: function(element) {
element = $(element);
element.focus();
if (element.select && ( element.tagName.toLowerCase() != 'input' ||
!['button', 'reset', 'submit'].include(element.type) ) )
element.select();
return element;
},
disable: function(element) {
element = $(element);
element.disabled = true;
return element;
},
enable: function(element) {
element = $(element);
element.blur();
element.disabled = false;
return element;
}
}
Object.extend(Form.Element, Form.Element.Methods);
var Field = Form.Element;
var $F = Form.Element.getValue;
/*--------------------------------------------------------------------------*/
Form.Element.Serializers = {
input: function(element) {
switch (element.type.toLowerCase()) {
case 'checkbox':
case 'radio':
return Form.Element.Serializers.inputSelector(element);
default:
return Form.Element.Serializers.textarea(element);
}
},
inputSelector: function(element) {
return element.checked ? element.value : null;
},
textarea: function(element) {
return element.value;
},
select: function(element) {
return this[element.type == 'select-one' ?
'selectOne' : 'selectMany'](element);
},
selectOne: function(element) {
var index = element.selectedIndex;
return index >= 0 ? this.optionValue(element.options[index]) : null;
},
selectMany: function(element) {
var values, length = element.length;
if (!length) return null;
for (var i = 0, values = []; i < length; i++) {
var opt = element.options[i];
if (opt.selected) values.push(this.optionValue(opt));
}
return values;
},
optionValue: function(opt) {
return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
}
}
/*--------------------------------------------------------------------------*/
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();
var changed = ('string' == typeof this.lastValue && 'string' == typeof value
? this.lastValue != value : String(this.lastValue) != String(value));
if (changed) {
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() {
Form.getElements(this.element).each(this.registerCallback.bind(this));
},
registerCallback: function(element) {
if (element.type) {
switch (element.type.toLowerCase()) {
case 'checkbox':
case 'radio':
Event.observe(element, 'click', this.onElementEvent.bind(this));
break;
default:
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,
KEY_HOME:     36,
KEY_END:      35,
KEY_PAGEUP:   33,
KEY_PAGEDOWN: 34,
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;
}
},
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 != null) {
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, length = Event.observers.length; i < length; i++) {
Event.stopObserving.apply(this, Event.observers[i]);
Event.observers[i][0] = null;
}
Event.observers = false;
},
observe: function(element, name, observer, useCapture) {
element = $(element);
useCapture = useCapture || false;
if (name == 'keypress' &&
(navigator.appVersion.match(/Konqueror|Safari|KHTML/)
|| element.attachEvent))
name = 'keydown';
Event._observeAndCache(element, name, observer, useCapture);
},
stopObserving: function(element, name, observer, useCapture) {
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) {
try {
element.detachEvent('on' + name, observer);
} catch (e) {}
}
}
});
/* prevent memory leaks in IE */
if (navigator.appVersion.match(/\bMSIE\b/))
Event.observe(window, 'unload', Event.unloadCache, false);
var Position = {
includeScrollOffsets: false,
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) {
if(element.tagName=='BODY') break;
var 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;
},
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);
},
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;
},
page: function(forElement) {
var valueT = 0, valueL = 0;
var element = forElement;
do {
valueT += element.offsetTop  || 0;
valueL += element.offsetLeft || 0;
if (element.offsetParent==document.body)
if (Element.getStyle(element,'position')=='absolute') break;
} while (element = element.offsetParent);
element = forElement;
do {
if (!window.opera || element.tagName=='BODY') {
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] || {})
source = $(source);
var p = Position.page(source);
target = $(target);
var delta = [0, 0];
var parent = null;
if (Element.getStyle(target,'position') == 'absolute') {
parent = Position.offsetParent(target);
delta = Position.page(parent);
}
if (parent == document.body) {
delta[0] -= document.body.offsetLeft;
delta[1] -= document.body.offsetTop;
}
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;
}
}
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];
}
}
Element.addMethods();function modifySubmitButton() {
}
function createSearchResultsPagination(updateImages) {
document.body.onhashchange = function() {
if (document.results.status.value == "0") {
loadPage(0, updateImages);
}
document.results.status.value = "0";
}
if (document.results != null) {
var numOfPages = document.results.numOfPages.value;
for (i=1; i <= numOfPages; i++) {
x = document.getElementById("listings-page-" + i);
x.style.visibility = "hidden";
x.style.display = "none";
}
showlayer("listings-page-1");
loadPage(0, updateImages);
if (document.results.numOfPages.value > 1 && document.getElementById("jump-to") != null) {
addJumpToOptions();
}
if (document.getElementById("jump-to-area") != null) {
document.getElementById("jump-to-area").style.visibility = "visible";
}
}
}
function addJumpToOptions() {
var numOfPages = document.results.numOfPages.value;
for (i=2; i <= numOfPages; i++) {
var y = document.createElement("option");
y.value = "" + i;
y.text = "" + i;
try {
document.getElementById("jump-to").add(y, null);
} catch (ex) {
document.getElementById("jump-to").add(y);
}
}
document.getElementById("jump-to").selectedIndex = 0;
}
function goToPage(page, updateImages) {
loadPage(page, updateImages);
scroll(0,0);
document.results.status.value = "1";
}
function loadPage(page, updateImages) {
var pageid = "page";
var updatehash = true;
if (page == 0) {
try {
if (window.location.hash.substring(1,5) == pageid) {
page = parseInt(window.location.hash.substring(5));
}
} catch (err) { }
}
if (page == 0) {
updatehash = false;
page = 1;
}
var numOfPages = document.results.numOfPages.value;
for (i=1; i <= numOfPages; i++) {
x = document.getElementById("listings-page-" + i);
x.style.visibility = "hidden";
x.style.display = "none";
}
showlayer("listings-page-" + page);
if (document.results.numOfPages.value > 1) {
if (document.results.isMobile != null && document.results.isMobile.value == "1") {
updateMobilePagination(page, updateImages);
} else {
updatePagination(page, updateImages);
}
if (document.getElementById("jump-to") != null) {
updateJumpTo(page);
}
}
if (document.results.loadPropertyDetails != null && document.results.loadPropertyDetails.value == "true") {
loadPropertyDetailsDivPage(page);
}
if (updateImages) {
updatePropertyImages(page);
}
if (updatehash) {
window.location.hash = pageid + page;
}
updateListingStyle(page);
if (document.results.loadPropertyDetails != null && document.results.loadPropertyDetails.value == "true") {
highlightListing(page, (page - 1) * document.results.listingsPerPage.value, "sr-row-highlighted", "");
}
}
function checkGoToPage(updateImages) {
var x = document.getElementById("jump-to");
var page = parseInt(x.options[x.selectedIndex].value);
goToPage(page, updateImages);
}
function updatePropertyImages(page) {
for (i=0; i < propertyImages.length; i++) {
var listingsPerPage = parseInt(document.results.listingsPerPage.value);
if (propertyImages[i].page < page) {
i = (i + listingsPerPage - 1);
} else if (propertyImages[i].page > page) {
break;
} else if (propertyImages[i].page == page && propertyImages[i].imageUrl != "") {
document.getElementById("property-photo-" + propertyImages[i].recordId).src = propertyImages[i].imageUrl;
propertyImages[i].imageUrl = "";
}
}
}
function updatePagination(currentPage, updateImages) {
var pagingMaxSize = 10;
var numOfPages = document.results.numOfPages.value;
var paginationHtml = "";
if (currentPage > 1) {
paginationHtml += "<a href='javascript:goToPage(" + (currentPage - 1) + ", " + updateImages + ")', " + updateImages + ">prev</a>&#160;<a class='no-underline' href='javascript:goToPage(" + (currentPage - 1) + ", " + updateImages + ")'><img src='/resources/site/images/previous.gif' width='17' height='14' alt='prev'/></a><span class='paging-separator'>&#160;</span>";
}
var start = 1;
if (numOfPages > pagingMaxSize) {
if (currentPage > (pagingMaxSize/2)) {
start = currentPage - (pagingMaxSize/2);
}
if (numOfPages - start < pagingMaxSize) {
start = numOfPages - (pagingMaxSize - 1);
}
}
var count = 0;
for (i=start; i <= numOfPages && count < pagingMaxSize; i++) {
count += 1;
paginationHtml += "<a href='javascript:goToPage(" + i + ", " + updateImages + ")' class='paging";
if (currentPage == i) { paginationHtml += " highlighted"; }
paginationHtml += "'>" + i + "</a>";
paginationHtml += "<span class='paging-separator'>&#160;</span>";
}
if (currentPage < numOfPages) {
paginationHtml += "<span class='paging-separator'>&#160;</span><a class='no-underline' href='javascript:goToPage(" + (currentPage + 1) + ", " + updateImages + ")'><img src='/resources/site/images/next.gif' width='17' height='14' alt='next'/></a>&#160;<a href='javascript:goToPage(" + (currentPage + 1) + ", " + updateImages + ")'>next</a>";
}
document.getElementById("pagination-area").innerHTML = paginationHtml;
}
function updateMobilePagination(currentPage, updateImages) {
var numOfPages = document.results.numOfPages.value;
var paginationHtml = "";
if (currentPage > 1) {
paginationHtml += "<a class='arrow-pagination-left' href='javascript:goToPage(" + (currentPage - 1) + ", " + updateImages + ")'></a>";
} else {
paginationHtml += "<span class='arrow-pagination-blank'></span>";
}
paginationHtml += "<span class='current-page'>Page " + currentPage + " of " + numOfPages + "</span>";
if (currentPage < numOfPages) {
paginationHtml += "<a class='arrow-pagination-right' href='javascript:goToPage(" + (currentPage + 1) + ", " + updateImages + ")'></a>";
} else {
paginationHtml += "<span class='arrow-pagination-blank'></span>";
}
document.getElementById("pagination-area").innerHTML = paginationHtml;
}
function updateJumpTo(page) {
var x = document.getElementById("jump-to");
for (i=0; i < x.length; i++) {
if (x[i].value == page) {
x.selectedIndex = i;
}
}
}
function updateListingStyle(page) {
var currentStyle = document.results.currentStyle.value;
var x = document.getElementById("listings-page-" + page);
var y = x.getElementsByTagName("tr");
for (j=0; j < y.length; j++) {
if (j % 2 == 1) {
if (currentStyle == "0") {
y[j].className = "sr-row-odd";
} else {
y[j].className = "sr-row-even";
}
} else {
if (currentStyle == "0") {
y[j].className = "sr-row-even";
} else {
y[j].className = "sr-row-odd";
}
}
}
if (currentStyle == "0") {
document.results.currentStyle.value = "1";
} else {
document.results.currentStyle.value = "0";
}
}
function updatePropertyDetailsDiv(imageUrl, imageCount, amount, propType, location, bedroom, bathroom, area) {
document.getElementById("propertyImageDisplay").src = "/branding/images/loading-text.jpg";
document.getElementById("propertyImageDisplay").src = imageUrl;
var propertySummaryText = "";
if (amount != '') { propertySummaryText += "Amount:&#160;&#160;<span class='amount'>" + amount + "</span>"; }
if (propType != '') { propertySummaryText += "<br/>Type:&#160;&#160;" + propType; }
if (location != '') { propertySummaryText += "<br/>Location:&#160;&#160;" + location; }
document.getElementById("propertySummary").innerHTML = propertySummaryText;
var propertyInformationText = "";
if (bedroom != '') { propertyInformationText += "Bedrooms:&#160;&#160;" + bedroom + " &#160;&#160;&#160;"; }
if (bathroom != '') { propertyInformationText += "Bathrooms:&#160;&#160;" + bathroom; }
if (area != '') { propertyInformationText += "<br/>Living Area:&#160;&#160;" + area; }
document.getElementById("propertyInformation").innerHTML =  propertyInformationText;
}
function highlightListing(page, id, classname, beforeclassname) {
document.getElementById("row-" + id).className = classname;
document.getElementById("col-left-" + id).className = "sr-col-left-highlighted";
document.getElementById("col-right-" + id).className = "sr-col-right-highlighted";
document.results.selectedRow.value = id;
for (i=0; i < document.results.listingsPerPage.value; i++) {
var rowNumber = ((page - 1) * document.results.listingsPerPage.value) + i;
if (rowNumber != id) {
document.getElementById("row-" + rowNumber).className = "sr-row-odd";
document.getElementById("col-left-" + rowNumber).className = "sr-col-left-normal";
document.getElementById("col-right-" + rowNumber).className = "sr-col-right-normal";
}
}
if (id > 0) {
document.getElementById("row-" + (id - 1)).className = beforeclassname;
}
}
function highlightHoverListing(page, id, classname, beforeclassname, hoverbeforeclassname) {
var highlightedRow = document.results.selectedRow.value;
if (id != highlightedRow) {
document.getElementById("row-" + id).className = classname;
}
for (i=0; i < document.results.listingsPerPage.value; i++) {
var rowNumber = ((page - 1) * document.results.listingsPerPage.value) + i;
if (rowNumber != id && (rowNumber != highlightedRow)) {
document.getElementById("row-" + rowNumber).className = "sr-row-odd";
}
}
if (id == (highlightedRow - 1)) {
document.getElementById("row-" + id).className = hoverbeforeclassname;
} else {
document.getElementById("row-" + (highlightedRow - 1)).className = beforeclassname;
}
}
function movePropertyDetailsDiv() {
var scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
scrOfY = window.pageYOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
scrOfY = document.body.scrollTop;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
scrOfY = document.documentElement.scrollTop;
}
if (scrOfY < 250) {
document.getElementById("propertyDetails").className = "property-details";
} else {
document.getElementById("propertyDetails").className = "property-details property-details-fixed";
}
setTimeout("movePropertyDetailsDiv()", 500);
}
function ValidateUFWelcome() {
if (document.welcome.custzip != null && document.welcome.custzip.value.search(/^\d{5}(-?\d{4})?$/) == -1) {
document.welcome.custzip.focus();
alert("Please provide a valid zip code.");
return false;
}
if (document.welcome.usename != null && document.welcome.usename.value != null) {
if (document.welcome.custfname.value == "") {
document.welcome.custfname.focus();
alert("Please provide a first name.");
return false;
} else if (document.welcome.custlname.value == "") {
document.welcome.custlname.focus();
alert("Please provide a last name.");
return false;
}
} else if (document.welcome.usefn != null && document.welcome.usefn.value != null) {
if (document.welcome.custfname.value == "") {
document.welcome.custfname.focus();
alert("Please provide a first name.");
return false;
}
}
if (! (document.welcome.optionalemail != null && document.welcome.optionalemail.value == "true") ||
(document.welcome.custemail.value.length >= 1 && document.welcome.custemail.value != "optional")) {
document.welcome.custemail.value = trimCustomerEmail(document.welcome.custemail.value);
if (document.welcome.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.welcome.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.welcome.custemail.value.indexOf("www.") == 0) {
document.welcome.custemail.focus();
alert("Please provide a valid email address by removing the 'www.' in front.");
return false;
}
}
if ((document.welcome.usephone != null && document.welcome.usephone.value == "true") &&
(! (document.welcome.optionalphone != null && document.welcome.optionalphone.value == "true") ||
(document.welcome.custphone != null && document.welcome.custphone.value.length >= 1)) ) {
var phone = document.welcome.custphone.value;
if (phone.indexOf("-") > 0 || phone.indexOf(" ") > 0 || phone.indexOf("(") > 0 || phone.indexOf(")") > 0) {
phone = phone.replace(/-/g, "").replace(/ /g, "").replace(/\(/g, "").replace(/\)/g, "");
}
if (phone == "") {
document.welcome.custphone.focus();
alert("Please provide a telephone number.");
return false;
} else if (phone.search(/^\d{10}$/) == -1) {
document.welcome.custphone.focus();
alert("Please enter a full 10-digit telephone number, including the area code.");
return false;
} else {
document.welcome.custphone.value = phone.substring(0,3) + "-" + phone.substring(3,6) + "-" + phone.substring(6,10);
if (phone.length >= 3 && checkValidPhoneAreaCode(phone.substring(0,3)) == false) {
document.welcome.custphone.focus();
return false;
} else if (phone.length >= 6 && checkValidPhoneMiddleNumber(phone.substring(3,6)) == false) {
document.welcome.custphone.focus();
return false;
}
}
}
if (document.welcome.custaddress.value == "") {
document.welcome.custaddress.focus();
alert("Please provide a street address.");
return false;
}
return true;
}
function openPropertyDetails(url) {
var sound = document.getElementById("sound")
if (sound) {
sound.src = "/images/click.wav";
}
var w = 800;
var h = 580;
if (window.screen) {
w = window.screen.availWidth * 95 / 100;
h = window.screen.availHeight * 90 / 100;
}
newWin = window.open(url,'_blank','scrollbars=yes,toolbar=no,resizable=yes,width='+w+',height='+h).focus();
}
function processInterstitialConfirmation() {
document.getElementById("interstitial-form").submit();
}
function ValidateCustomerFields() {
document.register.custfname.value = trimText(document.register.custfname.value);
document.register.custlname.value = trimText(document.register.custlname.value);
document.register.custemail.value = trimCustomerEmail(document.register.custemail.value);
if (document.register.custfname.value == "") {
document.register.custfname.focus();
alert("Please provide first name.");
return false;
}
else if (document.register.custlname.value == "") {
document.register.custlname.focus();
alert("Please provide last name.");
return false;
}
else if (document.register.phone1.value.search(/^\d{3}$/) == -1 ||
document.register.phone2.value.search(/^\d{3}$/) == -1 ||
document.register.phone3.value.search(/^\d{4}$/) == -1) {
document.register.phone1.focus();
alert("Please provide a valid phone number.");
return false;
}
else if (document.register.custemail.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
document.register.custemail.focus();
alert("Please provide a valid email address.");
return false;
} else if (document.register.custemail.value.indexOf("www.") == 0) {
document.register.custemail.focus();
alert("Please provide a valid email address by removing the 'www.' in front.");
return false;
}
else if (document.register.custaddress.value == "") {
document.register.custaddress.focus();
alert("Please provide a street address.");
return false;
}
else if (document.register.custzip.value.search(/^\d{5}(-?\d{4})?$/) == -1) {
document.register.custzip.focus();
alert("Please provide a valid zip code.");
return false;
}
return true;
}
function setCounties(url,selectid,state,addNull) {
$.getJSON(
url,
{
state: state
},
function(json) {
$('#'+selectid).text('');
if(addNull==true) {
$('#'+selectid).
append($("<option></option>").
attr("value",'null').
text('County'));
}
$.each(json, function(key, value)
{
$('#'+selectid).
append($("<option></option>").
attr("value",value).
text(value));
});
});
}
AC_FL_RunContent = 0;
DetectFlashVer = 0;
var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 0;
function addFlashMap(filename, titleText) {
if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if (hasRightVersion) {
if (document.getElementById("alternateMapContent") != null) {
document.getElementById("alternateMapContent").className = "";
document.getElementById("alternateMapContent").removeAttribute("href");
}
var wmodevalue = "transparent";
var bgcolorvalue = "#FFFFFF";
if (! (filename == "main_usb" || filename == "main_usbhf" || filename == "main_green"
|| filename == "main_usgb" || filename == "main_uslb" || filename == "main_violet")) {
}
AC_FL_RunContent(
'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab',
'width','428',
'height','293',
'id','map',
'align','middle',
'src','map',
'quality','high',
'scale','showall',
'wmode',wmodevalue,
'bgcolor',bgcolorvalue,
'name','map',
'allowscriptaccess', 'sameDomain',
'allowfullscreen', 'false',
'pluginspage','http://www.macromedia.com/go/getflashplayer',
'movie','/flash_maps/' + filename,
'FlashVars','absolutePath=http://www.foreclosurefortunes.net/flash_maps/&amp;' +
'xmlFolderPath=/flash_maps/statesdata/&amp;' +
'siteUrl=http://www.foreclosurefortunes.net/search.html?&amp;' +
'mapTitleText=' + titleText);
}
}
}
