function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function openBrWindow(theURL,winName,features,fieldid) { 
  var newwin = window.open(theURL+'?'+fieldid,winName,features);
  newwin.focus()
}

function realestate() {
	var win = window.open('/quote-real-estate-info.html','','scrollbars=no,height=375,width=700,resizable=no');
	win.focus();
}

function mortgage() {
	var win = window.open('/quote-mortgage-info.html','','scrollbars=no,height=400,width=700,resizable=no');
	win.focus();
}

function clicktocall() {
	var win = window.open('http://secure.ifbyphone.com/clickto_getphone.php?click_id=21371&key=d9b3459317993ef66060d4337f031d82db8a9f83&click_key=KH8v6UdI','','scrollbars=no,height=350,width=350,resizable=no');
	win.focus();
}

function getClickThru() {
	if (navigator.cookieEnabled == 1 && getCookie('refset')!='true') {
		if (document.referrer.indexOf(document.domain) == -1 && document.location.toString().indexOf('https://') == -1)  {
			setCookie('ref',document.referrer,1,'/','','');
			setCookie('refset','true',1,'/','','');
			window.location.reload();
		}
	}
}

function highlight(id) {
	try {
		if (id=='') {
			var id = window.location.pathname + window.location.search;
			id = id.replace(/\//g,'_');
			id = id.replace(/\./g,'_');
			id = id.replace(/\?/g,'_');
			id = id.replace(/=/g,'_');
			id = id.replace(/%20/g,'_');
			id = id.replace(/\ /g,'_');
			id = id.replace('_','');
		}

		var lnk = document.getElementById(id);
		lnk.className = 'onpage';
	} catch(err){};
}

function checkSearch() {
	var val = document.getElementById("q").value
	if (val == "") {
		alert("Please enter a search term");
		return false;
	}
	else {
		return true;
	}
}

if (navigator.cookieEnabled == 1) {
	if(getCookie("js")==null) {
		setCookie("js","true",false,"","");
		setCookie("comstr",window.location,false,"","");
		window.location.reload();
	}
}

getClickThru()






