
function logJsRnWebHit(acc, key, domainEntryCode, builderID, builderCommunityID, adFilterID, clientID, zipCode) {
	var location = document.location
	var host = location.host
	var path = location.pathname
	
	//if ClientID passed in, lets tack it to the queystring
	var qClientID = clientID ? '&clientID=' + clientID : '';
	
	//if zipcode passed in, lets tack it to the queystring
	var qZipCode = zipCode ? '&zipcode=' + zipCode : '';

	if (domainEntryCode.length == 0) {
	    var cookieMatch = document.cookie.match("(?:^|;)[ ]?domainentrycode=([^;]*)(?:;|$)");
	    if (cookieMatch != null) {
	        domainEntryCode = unescape(cookieMatch[1]);
	    }
	}
	
	var sitedirectory = path.substring(0, path.indexOf('/',1))
	var imgpath = 'http://' + host + sitedirectory + '/modules/internet/logging/logwebhit.aspx';
	//prompt('', imgpath + '?acc=' + acc + '&keyname=' + key  + '&domainentrycode=' + domainEntryCode + '&rnd=' + Math.floor(Math.random() * (new Date()) + 1));
	rnImage = new Image();
	rnImage.src = imgpath + '?acc=' + acc + '&keyname=' + key  + '&domainentrycode=' + domainEntryCode + '&bldrID=' + builderID + '&bcID=' + builderCommunityID + '&adfilterid=' + adFilterID + qClientID + qZipCode + '&rnd=' + Math.floor(Math.random() * (new Date()) + 1);
	rnImage.onload = function() {return;}
	return;
}

function logJsRnBuilderCommunityWebHit(acc, key, domainEntryCode, builderCommunityCompanyID, mlsCity,  stateAbbreviation, builderCommunityID, builderID, adFilterID, zipCode) {
	logJsRnListingWebHit(acc, key, domainEntryCode, builderCommunityCompanyID, '', '', mlsCity, '', '', '', stateAbbreviation, builderCommunityID, builderID, adFilterID, zipCode); 
	return;
}

function logJsRnListingWebHit(acc, key, domainEntryCode, listingCompanyID, listingLag, listPrice, mlsCity, mlsID, mlsNumber, mlsNumberAlpha, stateAbbreviation, builderCommunityID, builderID, adFilterID, zipCode) {
	var location = document.location;
	var host = location.host;
	var path = location.pathname;
	var builderIDQuerystring='';
	var builderCommunityIDQuerystring='';
	var qAdFilterID ='';
	
	var qZipCode = zipCode ? '&zipcode=' + zipCode : '';
	
	if (builderID > 0) {
		builderIDQuerystring = '&bldrID=' + builderID
	}

	if (builderCommunityID > 0) {
		builderCommunityIDQuerystring = '&bcID=' + builderCommunityID
	}
	
	//if AdFilterID passed in, lets tack it to the queystring
	if (adFilterID > 0) {
	 qAdFilterID = '&adfilterid=' + adFilterID;
	}
	
	var sitedirectory = path.substring(0, path.indexOf('/',1));
	var imgpath = 'http://' + host + sitedirectory + '/modules/internet/logging/logwebhit.aspx';
	//prompt('', imgpath + '?acc=' + acc + '&keyname=' + key  + '&domainentrycode=' + domainEntryCode + '&listingcompanyid=' + listingCompanyID  + '&listinglag=' + listingLag + '&listprice=' + listPrice  + '&mlscity=' + mlsCity  + '&mlsnumber=' + mlsNumber + '&mlsnumberalpha=' + mlsNumberAlpha + '&stateabbreviation=' + stateAbbreviation +  '&rnd=' + Math.floor(Math.random() * (new Date()) + 1));
	rnImage = new Image();
	rnImage.src = imgpath + '?acc=' + acc + '&keyname=' + key  + '&domainentrycode=' + domainEntryCode + '&listingcompanyid=' + listingCompanyID  + '&listinglag=' + listingLag + '&listprice=' + listPrice  + '&mlscity=' + mlsCity  + '&mlsid=' + mlsID + '&mlsnumber=' + mlsNumber + '&mlsnumberalpha=' + mlsNumberAlpha + '&stateabbreviation=' + stateAbbreviation + qZipCode  + builderIDQuerystring + builderCommunityIDQuerystring + qAdFilterID + '&rnd=' + Math.floor(Math.random() * (new Date()) + 1);
	rnImage.onload = function() {return;}
	return;
}

function logJsAndAdRedirect(acc, adFilterID, url, domainEntrycode, zipCode, clientID, zipCode){
	height = window.screen.height * .85;
	width = window.screen.width * .85;
	window.open(url, null, 'toolbar=yes,location=no,scrollbars=yes,menubar=no,status=yes,resizable=yes,width='+width+',height='+height);
	logJsRnWebHit(acc, 'AdClick', domainEntrycode, '', '', adFilterID, clientID, zipCode);
}


function logSearch(acc) {

	var location = document.location
	var host = location.host
	var path = location.pathname
	var sitedirectory = path.substring(0, path.indexOf('/',1))
	var imgpath = 'http://' + host + sitedirectory + '/modules/internet/logging/logsearch.aspx';
	
	rnImage = new Image();
	rnImage.src = imgpath + '?acc=' + acc + '&x=' + Math.floor(Math.random() * (new Date()) + 1);
	rnImage.onload = function() {return;}
	return;
}

function logSearchResultsHistory(mlsIDs, mlsNumbers) {

	var location = document.location
	var host = location.host
	var path = location.pathname
	var sitedirectory = path.substring(0, path.indexOf('/',1))
	var imgpath = 'http://' + host + sitedirectory + '/modules/internet/logging/logsearchresultshistory.aspx';
	
	rnImage = new Image();
	rnImage.src = imgpath + '?M1=' + mlsIDs + '&M2=' + mlsNumbers;
	rnImage.onload = function() {return;}
	return;
}