/*
===============================================================================
PAGE:			RealMediaNHC.js 

AUTHOR:			Gary Winter

DESCRIPTION:	Javascript Routines for RealMedia calls

INCLUDES:		/HomesCom/Resources/RealMediaNHC.js
	
NOTES:			

START DATE:		December 02, 2005

MODIFICATIONS:
MM/DD/YYYY      Author          Change
===============================================================================
*/

/* Function for parsing querystring */

function GetParam(name,search)
{
	var start=search.indexOf("?"+name+"=");
	if (start < 0) start = search.indexOf("&" + name + "=");
	if (start < 0) return '';
	start += name.length + 2;
	var end = search.indexOf("&",start) - 1;
	if (end < 0) end = search.length;
	var result = location.search.substring(start,end);
	var result = '';
	for( var i = start; i <= end; i++ ) {
		var c = location.search.charAt(i);
		result = result + (c=='+'?' ':c);
	}
	return unescape(result);
}

/* OAS SETUP begin */

//Configuration
// Initilaize variables
//Array of page names the use the Middle1 Position
	//If adding to this, make sure the page name is in lower case
	//  and full script_name is used.
// RealMedia server
var OAS_url = 'http://ads.traderonline.com/RealMedia/ads/';
// RealMeadia page - this is the full location
//OAS_sitepage = 'www.homes.com/homepage.html';
if ( window.location.pathname.toLowerCase() == "/dashboard/" || window.location.pathname.toLowerCase() == "/dashboard/index.cfm" )
	var OAS_sitepage = 'www.homes.com/dashboard/agentlogin.cfm';
else var OAS_sitepage = 'www.homes.com' + window.location.pathname.toLowerCase();
// variable to use so we can compare and not worry about case in the pathname
var page = window.location.pathname.toLowerCase();
// Initialize OAS_listpos ( RealMedia Position List )
var OAS_listpos = "";
// Initialize OAS_target
var OAS_target = '_top';
// Initialize OAS_query ( RealMedia Targeting )
if ( ! OAS_query ) var OAS_query = '';
//alert (page);
	
//OAS Position List Setup Begin
	// Postition List is the same for all pages in the DashBoard
	OAS_listpos = 'Right1,Right2,Right3';
//OAS Position List Setup End
//alert ('OAS_listpos = '+OAS_listpos);
//alert ('OAS_sitepage = '+window.location.pathname.toLowerCase());
OAS_version = 10;
OAS_rn = '00123456789';
OAS_rns = '00123456789';
OAS_rn = new String (Math.random());
OAS_rns = OAS_rn.substring (2, 11);
// this is the nonconforming version of the RealMedia call
function OAS_NORMAL(pos) {
	document.write('<a href="' + OAS_url + 'click_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@'
		+ OAS_listpos + '!' + pos + '?' + OAS_query + '" TARGET=' + OAS_target + '>');
	document.write('<img src=""="' + OAS_url + 'adstream_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@'
		+ OAS_listpos + '!' + pos + '?' + OAS_query + '" TARGET=' + '" border=0></a>');
}	
// Here we check for which navigator is used and show the tags accordingly
OAS_version = 11;
if (( navigator.userAgent.indexOf('Mozilla/3') != -1) || (navigator.userAgent.indexOf('Mozilla/4,0 WebTV') != -1))
	OAS_version = 10;
// This loads in the OAS_RICH function from ad server if the navigator is a standard one
if ( OAS_version >= 11 )
	document.write('<scr' + 'ipt language=JavaScript1.1 src="' + OAS_url + 'adstream_mjx.ads/' + OAS_sitepage + '/1' + 
	OAS_rns + '@' + OAS_listpos + '?' + OAS_query + '">' + OAS_target + '"></script>');
 
document.write('');
// Function called in code to display RealMedia - Must be cased exactly like it is in the position list
function OAS_AD(pos) {
	if ( OAS_version >= 11 )
		OAS_RICH(pos);
	else
		OAS_NORMAL(pos);
}
//-->
/* OAS SETUP end */

