var nIE4Win;    
var nCanPrint;
var printed;

function printPage() {
        printed = "no";
        if (window.print) {
                nCanPrint = "yes";
        } else {
                nCanPrint = "no";
        }

    var agt=navigator.userAgent.toLowerCase()

    nVersion = parseInt(navigator.appVersion);
    nIE  = (agt.indexOf("msie") != -1);
    nWin   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
        nMac = (agt.indexOf("mac") != -1);
        nIE4Win  = (nIE && (nVersion == 4) && nWin);
        doPrint();
}

function doPrint() {
        if (nCanPrint == "yes") {
                printed="yes";
                window.print();

        } else if (nIE4Win) {
                printed="yes";
                IEPrint();
        }
        else
        {
        alert("To print this page, click your browser's Print button or select File - Print from your browser menu.");          
        }
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function popEmailToFriend(thisPage) {
	var openURL = "../../html/emailtoafriend/emailtoafriend.cfm?page="+thisPage ;
	window.open(openURL, "EmailToAFriend", "width=550,height=400,resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no,left=20,top=20");
}

function popPrintable(thisPage) {
	var openURL = "../../html/printable/printable.cfm?page="+thisPage ;
	//window.open(openURL, "PrintablePage", "width=650,height=500,resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no,left=20,top=20");
	window.open(openURL, "PrintablePage", "width=680,height=500,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,directories=no,location=no,status=no,left=20,top=20");
}

function popDetail(model,show,detail) {
	thisURL = "../../html/popups/detail.cfm?whichModel="+model+"&show="+show+"&showDetail="+detail ;
	if (model != "") {
		window.open(thisURL, "ModelDetail", "width=800,height=500,resizable=yes,scrollbars=yes,menubar=no,toolbar=yes,directories=no,location=no,status=no,left=20,top=20");
	}
}

function buyingProcess(region) {
	var openURL = "/homebuying-resources/homebuying-process.cfm"+region ;
	window.open(openURL, "buyingProcess", "width=692,height=500,resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no,left=20,top=20");
	
}

function popup_floorplan(textlink)
{
	var newwindow = window.open(textlink,'popup',config='height=780,width=990,scrollbars=yes,toolbar=no,copyhistory=no,resizable=no,directories=no,menubar=no,status=no,location=no');
	newwindow.moveTo( (screen.availWidth-990)/2, (screen.availHeight-780)/2 );
	newwindow.focus();
}

function popup_video(textlink)
{
	var newwindow = window.open('/videos.cfm?videoUrl='+textlink,'popup',config='width=450,height=274,scrollbars=no,toolbar=no,copyhistory=no,resizable=no,directories=no,menubar=no,status=no,location=no');
	newwindow.moveTo( (screen.availWidth-450)/2, (screen.availHeight-274)/2 );
	newwindow.focus();
}


<!---------------------------------------------------------------------->
<!---------------------------------------------------------------------->
<!--- CHANGING TEXT SIZE                                             --->
<!---------------------------------------------------------------------->
stylesheetTitles = new Array("small","medium","large"); //stores all the stylesheet "titles" in ascending order

<!--- CHANGING STYLESHEETS --------------------------------------------->

function increase()
	{
	if (textsize < stylesheetTitles.length-1)
		{
		textsize++; //increases counter
		var title = stylesheetTitles[textsize]; //gets the correct "title" of the stylesheet
		setActiveStyleSheet(title); //changes the stylesheet
		document.getElementById("minus").src="../../images/common/text_size_minus.gif"; //make sure minus is not grayed out
		if (textsize == stylesheetTitles.length-1)
			{
			document.getElementById("plus").src="../../images/common/text_size_plus_gray.gif"; //gray out plus
			}			
		}
	}
	
function decrease()
	{
	if (textsize > 0)
		{
		textsize--; //decreases counter
		var title = stylesheetTitles[textsize]; //gets the correct "title" of the stylesheet
		setActiveStyleSheet(title); //changes the stylesheet
		document.getElementById("plus").src="../../images/common/text_size_plus.gif"; //make sure plus is not grayed out
		if (textsize == 0)
			{
			document.getElementById("minus").src="../../images/common/text_size_minus_gray.gif"; //gray out minus
			}
		}
	}
	
function setActiveStyleSheet(title)
	{
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) //cycles through all "link" elements
  		{
    	if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) //checks to make sure you are looking at a stylesheet
			{
      		a.disabled = true; //disables all stylesheets
     		if(a.getAttribute("title") == title) a.disabled = false; //enables correct stylesheet by evaluating the "title"
    		}
  		}
	}

<!--- SETTING COOKIES      --------------------------------------------->

window.onunload = function(e)
	{
	createCookie("danryan_style", textsize, 365);
	}

function createCookie(name,value,days)
	{
		if (days)
			{
    			var date = new Date();
				date.setTime(date.getTime()+(days*24*60*60*1000));
				var expires = "; expires="+date.toGMTString();
			}
		else expires = "";
		var textsizeString = String(value); //converts "textsize" to a string
		document.cookie = name+"="+textsizeString+expires+"; path=/"; //writes the cookie
	}

function readCookie(name)
	{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
		{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
	return null;
	}

var cookie = parseInt(readCookie("danryan_style")); //reads the cookie and extracts the preferred stylesheet's number
textsize = (cookie ? cookie : 0); //checks to see if a cookie exists and gives "textsize" the correct value
var title = stylesheetTitles[textsize]; //gets the preferred stylesheet's corresponding title
setActiveStyleSheet(title); //sets the preferred stylesheet