//disabled messages
function showDisabledMessage(strID){
	var intX, intY;
	intX = getTopPos(strID);
	intY = getLeftPos(strID);
	disabledMessage.style.display = "block";
	disabledMessage.style.pixelTop = intX - disabledMessage.clientHeight;
	disabledMessage.style.pixelLeft = intY;
}

function hideDisabledMessage(){
	disabledMessage.style.display = "none";
}

// request querystring
function requestQueryString(strName) {
	var strUrl = top.location.toString();
	var splitUrl = strUrl.split("?");
	var queryString = splitUrl[1].split("&");
	for (i=0; i < queryString.length; i++) {
		tempArray = queryString[i].split("=");
		if (tempArray[0] == strName) {
			return tempArray[1]
		}
	}
}

//field messages
var messageX = 0;
var messageY = 0;
var messageText = "";

function showMessage(strItem,strID) {
	if (strItem == "buildingMessage") {
		messageText = "When applicable, the building number is a useful tool for sorting results.";
	}
	if (strItem == "unitMessage") {
		messageText = "The unit number is a helpful tool for sorting and transferring to property management software.";
	}
	if (strItem == "rentMessage") {
		messageText = "Enter the required monthly rental amount for the unit the applicant desires."
	}
	if (strItem == "depositMessage") {
		messageText = "Enter the total deposit amount required if the applicant were to sign a lease today."
	}
	if (strItem == "leaseTermMessage") {
		messageText = "Enter the lease term in months."
	}
	if (strItem == "sourceMessage") {
		messageText = "We track guest card information to assist each property in tracking traffic resources."
	}
	if (strItem == "applicant_type") {
		messageText = "There is a significant difference between applicant types. Please contact your CreditRetriever representative for a complete description.";
	}
	if (strItem == "first_name") {
		messageText = "Enter the applicant's first name using normal capitalization.";
	}
	if (strItem == "middle_name") {
		messageText = "Enter the applicant's middle name using normal capitalization."
	}
	if (strItem == "last_name") {
		messageText = "Enter the applicant's last name using normal capitalization."
	}
	if (strItem == "street_address") {
		messageText = "Enter the applicant's street address, including apartment number if any."
	}
	if (strItem == "city") {
		messageText = "Enter the applicant's city of residence."
	}
	if (strItem == "state") {
		messageText = "Enter the applicant's state of residence by choosing it from the dropdown menu."
	}
	if (strItem == "zip_code") {
		messageText = "Enter the applicant's five-digit zip code."
	}
	if (strItem == "social_security_number") {
		messageText = "Enter the applicant's Social Security Number or a government issued nine-digit number."
	}
	if (strItem == "employment_income") {
		messageText = "Enter the applicant's income in whole dollars per year, using no commas, periods or currency signs (i.e. - 36250 would be $36,250.00/year)";
	}
	if (strItem == "other_income") {
		messageText = "Enter the applicant's other income (child support, alimony, etc.) in whole dollars per year, using no commas, periods or currency signs (i.e. - 3250 would be $3,250.00/year)"
	}
	if (strItem == "assets") {	
		messageText = "Enter the amount of liquid assets only (in whole dollars). CreditRetriever has the ability to convert assets to income."
	}
	if (strItem == "employment_status") {
		messageText = "Enter the employment status of the applicant.  This demographic information is populated on the reports."
	}
	if (strItem == "first_nameC") {
		messageText = "Enter the first name, middle name, and last name of the applicant you wish to perform the criminal check on.";
	}
	if (strItem == "middle_nameC") {
		messageText = "Enter the first name, middle name, and last name of the applicant you wish to perform the criminal check on.";
	}
	if (strItem == "last_nameC") {
		messageText = "Enter the first name, middle name, and last name of the applicant you wish to perform the criminal check on."
	}
	if (strItem == "dob") {
		messageText = "Enter the date of birth(in mm/dd/yyyy format) of the applicant you wish to perform the criminal check on."
	}
	if (strItem == "ssn") {
		messageText = "Enter the Social Security Number of the applicant you wish to perform the criminal check on."
	}
	if (strItem == "states") {
		messageText = "For the purposes of this demonstration, please choose only two states.  In the live application, you can choose up to six states."
	}
	if (strItem == "first_nameE") {
		messageText = "Enter the first name, middle name, and last name of the applicant you wish to perform the eviction check on.";
	}
	if (strItem == "middle_nameE") {
		messageText = "Enter the first name, middle name, and last name of the applicant you wish to perform the eviction check on.";
	}
	if (strItem == "last_nameE") {
		messageText = "Enter the first name, middle name, and last name of the applicant you wish to perform the eviction check on."
	}
	if (strItem == "dobE") {
		messageText = "Enter the date of birth(in mm/dd/yyyy format) of the applicant you wish to perform the eviction check on."
	}
	if (strItem == "ssnE") {
		messageText = "Enter the Social Security Number of the applicant you wish to perform the eviction check on."
	}
	if (strItem == "statesE") {
		messageText = "For the purposes of this demonstration, please choose only two states.  In the live application, you can choose up to six states."
	}
	messageBox.style.display = "block";
	messageContent.innerHTML = messageText;
	messageBox.style.pixelLeft = getLeftPos(strID) - 25;
	messageBox.style.pixelTop = getTopPos(strID) - messageBox.clientHeight;
}

function overMessage(strID) {
	var e = document.getElementById(strID)
	e.style.color = "#CCCCCC";
}

function hideMessage(strID) {
	var e = document.getElementById(strID)
	e.style.color = "#000000";
	messageBox.style.display = "none";
}

function hideDropDown(strID){
	var e = document.getElementById(strID);
	e.style.display = "none";
}
function showDropDown(strID){
	var e = document.getElementById(strID);
	e.style.display = "block";
}

//finish later function
function showFinishLaterMessage(strID){
	var intX, intY;
	intX = getTopPos(strID);
	intY = getLeftPos(strID);
	messageBox.style.display = "block";
	messageBox.style.pixelTop = intX - messageBox.clientHeight;
	messageBox.style.pixelLeft = intY;
	messageContent.innerHTML = "The finish later button will save the application for you to complete later";
}

function hideFinishLaterMessage(){
	messageBox.style.display = "none";
}


//General XY functions
function getTopPos(strID) {
	var parentExists = true;	
	var objID = document.getElementById(strID)
	var intOffset = objID.offsetTop;
	curE =objID;
	do {
		if (curE.offsetParent) {
			curE = curE.offsetParent;
			intOffset = intOffset + curE.offsetTop;
		}
		else {
			parentExists = false;
		}
	}
	while(parentExists); 
	return intOffset;
	
}

function getLeftPos(strID) {
	var parentExists = true;
	var objID = document.getElementById(strID)
	var intOffset = objID.offsetLeft;
	curE =objID;
	do {
		if (curE.offsetParent) {
			curE = curE.offsetParent;
			intOffset = intOffset + curE.offsetLeft;
		}
		else {
			parentExists = false;
		}
	}
	while(parentExists); 
	return intOffset;
	
}




//MACROMEDIA FUNCTIONS
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//Macromedia rollover code
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//location href to management report based on demoType
function gotoManagementReport(strReport) {
	if (strReport == "portfolio") location.href="demo_portfolio_report.html";
	if (strReport == "region") location.href="demo_region_report.html";
	if (strReport == "property") {
		if (top.demoType == "L") {
			location.href="demo_property_report_crlite.html";
		}
		else {
			location.href="demo_property_report.html";
		}
	}			
}
