
var curpos = 0;
var timerid = 0;
var lefttoright = 1;
var gallwindow = '';
var mapwindow = '';
var tourwindow = '';
var calcwindow = '';

function scrollheader() {

	clearTimeout(timerid);
	
	var headerimg = document.getElementById("divHeaderScroll");
	
	if (lefttoright == 1) {
		curpos = curpos - 2;
		if (curpos < -2099) {
			lefttoright = 0;
			curpos = -2099;
		}

	} else {
		curpos = curpos + 2;
		if (curpos >= 0) {
			lefttoright = 1;
			curpos = 0;
		}
	}
	
	headerimg.style.backgroundPosition = "" + curpos + "px 0px";
	
	timerid = setTimeout('scrollheader();',60);
}

function popup_gallery(propertyid) {

	if (!gallwindow.closed && gallwindow.location) {
		gallwindow.location.href = 'gallery.php?id='+propertyid
	}
	else {
		gallwindow=window.open('gallery.php?id='+propertyid,'name','height=575,width=875,scrollbars=no');
		if (!gallwindow.opener) gallwindow.opener = self;
	}
			
	if (window.focus) {gallwindow.focus()}
	

}

function popup_map(propertyid, linkid) {

	if (!mapwindow.closed && mapwindow.location) {
		mapwindow.location.href = '/include/popmap.php?id='+propertyid+'&link='+linkid
	}
	else {
		mapwindow=window.open('/include/popmap.php?id='+propertyid+'&link='+linkid,'name','height=500,width=650,scrollbars=no');
		if (!mapwindow.opener) mapwindow.opener = self;
	}
			
	if (window.focus) {mapwindow.focus()}
	

}


function popup_tour(tourlink) {

	if (!tourwindow.closed && tourwindow.location) {
		tourwindow.location.href = 'http://'+tourlink;
	}
	else {
		tourwindow=window.open('http://'+tourlink,'name','height=550,width=865,scrollbars=no');
		if (!tourwindow.opener) tourwindow.opener = self;
	}
			
	if (window.focus) {tourwindow.focus()}
	

}


function popup_calculator() {

	if (!calcwindow.closed && calcwindow.location) {
		calcwindow.location.href = 'http://www.shreal.com/include/mortgagesuite/canmcalc.htm';
	}
	else {
		tourwindow=window.open('http://www.shreal.com/include/mortgagesuite/canmcalc.htm','name','height=300,width=485,scrollbars=no');
		if (!tourwindow.opener) tourwindow.opener = self;
	}
			
	if (window.focus) {tourwindow.focus()}
	

}