


// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use

var ie=document.all
var dom=document.getElementById
var ns4=document.layers

var bouncelimit=32 //(must be divisible by 8)
var direction="left"

function initbox(){
if (!dom&&!ie&&!ns4)
return
cen=(ie)? document.body.clientWidth/2-155 : (dom)?window.innerWidth/2-155  : window.innerWidth/2-155
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? document.body.scrollTop : window.pageYOffset
crossobj.top=scroll_top-250
crossobj.width=310
crossobj.left=cen

crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}

function dropin(){
scroll_top=(ie)? document.body.scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<50+scroll_top)
crossobj.top=parseInt(crossobj.top)+40
else{
clearInterval(dropstart)
//bouncestart=setInterval("bouncein()",50)
}
}

function staton(st) {
	window.status='Contact Us';
	return true;
	}
function statoff() {
	window.status='';
}


function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}





function updateWin(url) {
	updateWindow = window.open(url,'update','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=455,height=570');
 }

function openindex(width,height,theurl) { 
	OpenWindow=window.open(theurl, "newwin", "height="+height+", width=" + width + ",toolbar=no,scrollbars=" + 1 + ",menubar=no,resizable=yes");
self.name="main";
}

function cont(email) {
	var qry = "";
	var win = "/contact.cfm";
	var left = (screen.width/2) - 300;
	var top = (screen.height/2) - 215;
	if (email.length > 0) qry = "?email=" + email; 
	OpenWindow = null;
	OpenWindow = window.open(win + qry, "newwin", 'height=430, width=600,toolbar=no,scrollbars=' + 1 + ',menubar=no,resizable=yes,status=no,left='+left+',top='+top+',screenX='+left+',screenY='+top);
	OpenWindow.focus();
	self.name = "main";
}

function conterr() {
	var win = "/contacterr.cfm";
	var left = (screen.width/2) - 300;
	var top = (screen.height/2) - 215;
	OpenWindow = null;
	OpenWindow = window.open(win, "newwin", 'height=430, width=600,toolbar=no,scrollbars=' + 1 + ',menubar=no,resizable=yes,status=no,left='+left+',top='+top+',screenX='+left+',screenY='+top);
	OpenWindow.focus();
	self.name = "main";
}

function setCookieDup(name, value, nday) {
		var cookieDate = new Date();
		var testcookie = name + "=" + escape(value);
		if(detectPersistantCookies()){
		
		cookieDate.setTime (cookieDate.getTime() + nday*24*60*60*1000);
		testcookie += "; expires=" + cookieDate.toGMTString();
		}
		testcookie += "; path=/;domain=.huduser.org";
		document.cookie = testcookie;

}

function getSettings() {
	var settings = "";
	settings += "Popup Disabled|";
	if(DetectSessionCookies()) {
		settings += "S Cookie Enabled|";
		if(detectPersistantCookies()) {
			settings += "P Cookie Enabled|";
		} else {
			settings += "P Cookie Disabled|";
		}

		var csCookieString = document.cookie || "";
		if(csCookieString.indexOf("isslowline=yes") > 0)
			settings += "Speed-Slow|";
		else
			settings += "Speed-Fast|";

	} else {
		settings += "S Cookie Disabled|P Cookie Disabled|Speed-NA|";
	}
	settings += "Browser-" + navigator.appName + "|" ;
	settings += "Agent-" + navigator.userAgent + "|" ;
	return settings;
}

function getCurrURL() {
	return window.location.href;
}

function declineSurvey() {
		dismissbox();
		if(DetectSessionCookies()) {
			setCookieDup('SurveyDone','SurveyDone',365);
		}
		document.forms[0].surveynumber.value = "Declined";
		document.forms[0].action = "/includes/SaveUnXSurvey.asp";
		document.forms[0].submit();
		dismissbox();
}

function laterSurvey() {
		if(confirm("There is only 1 day left for you to share your opinion with HUD USER. Please do take 2 minutes of your time to respond today.")) {
			return;
		} else {
		dismissbox();
		document.forms[0].surveynumber.value = "Later";
		document.forms[0].action = "/includes/SaveUnXSurvey.asp";
		document.forms[0].submit();
		dismissbox();
		}
}

function doPopup() {


	var info='<TABLE WIDTH=400 BGCOLOR="#000000" CELLPADDING=4 CELLSPACING=0><TR><TD><TABLE BGCOLOR="#FFFFCC" CELLSPACING=0 CELLPADDING=5><TR><TD>'
	+ '<DIV CLASS="header" ALIGN="center"><B>HUD USER Survey Request</B></DIV>'
	+ '  <p align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Thank '
	+ '      you for visiting <a href="http://www.huduser.org/">www.HUDUSER.org</a>. </font></p>'
	+ '    <p align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">We apologize '
	+ '    for this intrusion but HUD USER needs your feedback and assistance.  '
	+ '    Please tell us about your experience at the website. '
	+ '    The survey should take about 1-2 minutes of your time. '
	+ '    The feedback you provide will help us enhance our site and serve you better in the future. '
	+ '    All responses will be kept strictly confidential. </font></p> '
	+ '    <p align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">If '
	+ '      you have any questions or concerns about this survey, please email PD&amp;R '
	+ '      at <a href="mailto:webmaster@huduser.org">webmaster@huduser.org</a> or '
	+ '      contact us at 1-877-964-0355 (toll free). </font><font face="Verdana, Arial, Helvetica, sans-serif"> '
	+ '      </font></p>'
	+ '    <p align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">As '
	+ '      a token of our appreciation, we will give you <em><strong>2 Free PD&amp;R '
	+ '      Publications</strong></em> (up to a maximum value of $10) for completing the '
	+ '      survey.</font> <font face="Verdana, Arial, Helvetica, sans-serif"> '
	+ '      <!--<p><font size="2">To take the survey, please <a href="survey_RBC4.html">click '
	+ '    here</a>.</font></p> '
	+ '  <p><font size="2">I decline to participate in the survey </font></p>-->'
	+ '      </font><font face="Verdana, Arial, Helvetica, sans-serif"> </font></p>'
	+ '    <div align="center"> '
	+ '      <form method="post"> '
	+ '      <INPUT TYPE="HIDDEN" NAME="surveytype" VALUE="' + getSettings() + '"> '
	+ '      <INPUT TYPE="HIDDEN" NAME="surveynumber" VALUE="Abort"> '
	+ '      <INPUT TYPE="HIDDEN" NAME="navtrack" VALUE="' + getCurrURL() + '"> '
	+ '      <a href="/Includes/survey_main.html" onClick="javascript:dismissbox();" target="_new"><img src="/Includes/gotosurvey.jpg" border=0></a> '
	+ '      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '
	+ '      <a href="javascript:laterSurvey();"><img src="/Includes/later.jpg" border=0></a> '
	+ '      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '
	+ '      <a href="javascript:declineSurvey();"><img src="/Includes/decline.jpg" border=0></a> '
	+ '      </form> '
	+ '    </div>'
	+ '</TD></TR></TABLE></TD></TR></TABLE>';
	if (ie) {
		document.all.dropin.innerHTML = info;
		document.all.dropin.left='200';
	}	
  	else if (ns4) {
		document.layers['dropin'].document.open();
		document.layers['dropin'].document.write(info);
		document.layers['dropin'].document.close();
	}
	else if (dom) {
		document.getElementById('dropin').innerHTML= info;
	}


initbox();
}
