function get_page_ad_source()
{
    var source = '';
	var doc = document;

    if ( doc.location == null ) { return 's1homes-global' }

    if ( doc.location.hostname.indexOf('s1homes') != -1 )
	{
	    source = 's1homes-';
	    var testRE = new RegExp ( "(/[^/]*/?)", "i" );
	    switch ( doc.location.pathname.match(testRE)[0] )
		{
			case "/" :  source += 'homepage'; return source;
			case "/myaccount/" : true;
			case "/buying/" : source += 'buying-'; break;
		    case "/newhomes/" : source += 'newhomes-'; break;
			case "/selling/" : source += 'selling-'; break;
			default: return 's1homes-buying-global';
		}
	}
    else if ( doc.location.hostname.indexOf('s1rental') != -1 )
	{
	    source = 's1rental-';
	}
    else { return 's1homes-buying-global' }

    var testRE = new RegExp( "^/([^/]+/)?(index.s?html)?$" );
    if ( doc.location.pathname.match(testRE) )
	{
	    source += 'homepage';
	}
    else if ( doc.location.search.match(/^.*location=([^&;]+).*$/))
	{
	    source += 'location-' + doc.location.search.replace(/^.*location=([^&;]+).*$/, "$1");
	}
    else
	{
	    source += 'global';
	}
    return source;
}
