// JavaScript Document

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

/*
pop-up window code
Author: Eric King http://redrival.com/eak/
*/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

/* 
pop-up window usage:
<a href="page.htm" onclick="NewWindow(this.href,'main','800','450','no','center');return false">LINK</a>
*/

/* background position swap for demographic section home image rollovers */

function moveHouseImg(num) {
if (num==1){var posy=0}
if (num==2){var posy=-190}
if (num==3){var posy=-380}
if (num==4){var posy=-570}
if (num==5){var posy=-760}
if (num==6){var posy=-950}
if (num==7){var posy=-1140}
if (num==8){var posy=-1330}
if (num==9){var posy=-1520}
document.getElementById('house-rollover').style.backgroundPosition="0px "+posy+"px";
}

/* slide to page top */
$(function(){
  $('a[href*=#]').click(function() {
  if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
    && location.hostname == this.hostname) {
      var $target = $(this.hash);
      $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
      if ($target.length) {
        var targetOffset = $target.offset().top;
        $('html,body').animate({scrollTop: targetOffset}, 800);
        return false; 
      } 
    }
  });
});


/* ------------------------------------------------ */
/* start window popup defining w/h within js, for stickings,360x360 */

function NewWindowA(mypage,myname)
{
	var w = 360;
	var h = 410;
	var scroll = "no";
	var pos = "center";

	if(pos=="random"){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center") {
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null) { 
		LeftPosition=0;
		TopPosition=20;
	}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=yes,status=no,menubar=no,toolbar=no,resizable=yes';
	win=window.open(mypage,myname,settings);
}

/* end window popup 2 defining w/h within js */
/* ------------------------------------------------ */

