function get_OAS_query(){

    this._in_array = function (needle, haystack, argStrict) {
        // Checks if the given value exists in the array  
        // 
        // version: 1008.1718
        // discuss at: http://phpjs.org/functions/in_array
        // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
        // +   improved by: vlado houba
        // +   input by: Billy
        // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
        // *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
        // *     returns 1: true
        // *     example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'});
        // *     returns 2: false
        // *     example 3: in_array(1, ['1', '2', '3']);
        // *     returns 3: true
        // *     example 3: in_array(1, ['1', '2', '3'], false);
        // *     returns 3: true
        // *     example 4: in_array(1, ['1', '2', '3'], true);
        // *     returns 4: false
        var key = '', strict = !!argStrict;

        if (strict) {
            for (key in haystack) {
                if (haystack[key] === needle) {
                    return true;
                }
            }
        } else {
            for (key in haystack) {
                if (haystack[key] == needle) {
                    return true;
                }
            }
        }
        return false;
    }

	this._get_q = function (v) {
		var q = window.location.search.substring(1);
		var vars = q.split("&");
		for (var i=0;i<vars.length;i++) {
			var p = vars[i].split("=");
			if (p[0] == v) return p[1];
			}
		return "";
	}
	
	var portal = ''
	var category = ''
	var subcategory = ''
	var result = ''
	var loc = /^(.+)\:\/\/(.+?)\/([^?]*)\??(.*)/.exec(document.location)
	var path = loc[3].split("/")
	var extra_get_vars = ''
	
	// zope domains (not wickedlocal.com)
	var zope_domains = {}
	zope_domains['www.wickedlocal.com'] = 'wickedlocal'
	zope_domains['www.patriotledger.com'] = 'patriotleder'
	zope_domains['www.enterprisenews.com'] = 'enterprisenews'
	zope_domains['www.heraldnews.com'] = 'heraldnews'
	zope_domains['www.tauntongazette.com'] = 'tauntongazette'
	zope_domains['www.metrowestdailynews.com'] = 'metrowestdailynews'
	zope_domains['www.dailynewstranscript.com'] = 'dailynewstranscript'
	zope_domains['www.dailynewstribune.com'] = 'dailynewstribune'
	zope_domains['www.milforddailynews.com'] = 'milforddailynews'
	
	
	// wickedlocal.com
	if (document.domain == 'www.wickedlocal.com') {
		portal = path[0]
		if (path.length >= 2) {
			category = path[1]
		}
		if (path.length >= 3 && /^x\d+$/.test(path[2]) == false){
			subcategory = path[2]
		}
		if (path.length >= 3 && /^x\d+$/.test(path[path.length-2]) == true) {
			extra_get_vars = extra_get_vars + '&article_id=' + path[path.length-2];
		}
	}
	// real estate
	else if (document.domain == 'realestate.wickedlocal.com'|| document.domain == 'sob.re.adicio.com') {
		portal = "realestate"
		if (this._get_q('qTerms') == 'sell' || this._in_array('for-sale', path)) {
			category = 'for_sale'
		}
		else if (this._get_q('qTerms') == 'rent' || this._in_array('for-rent', path)) {
			category = 'for_rent'
		}
		if (path[1] == 'results' && path[2]) {
		    extra_get_vars = extra_get_vars + '&city=' + escape(path[2])
		}
	}
	// automotive
	else if (document.domain == 'wickedlocalwheels.com'|| document.domain == 'wheels.wickedlocal.com') {
		portal = "automotive"
		// search
		if (/autos\/search/.test(loc[3])){
			if (this._get_q('condradio') == 'new'){
				category = 'search_new'
			} else {
				category = 'search_used'
			}
		}
		if (this._get_q('makes%5B0%5D') != ''){
			subcategory = this._get_q('makes%5B0%5D')
		}
		// build
		else if (/autos\/configurator/.test(loc[3])){
			category = 'build'
		}
		// research
		else if (/autos\/researchCenter|comparator/.test(loc[3])){
			category = 'research'
		}
		// dealers
		else if (/autos\/dealers/.test(loc[3])){
			category = 'dealer'
		}
	}
	// www.wickedlocaljobs.com
	else if (document.domain == 'www.wickedlocaljobs.com') {
		portal = "jobs"
	}
	// non-wickedlocal zope sites
	else if (zope_domains[document.domain]) {
		portal = zope_domains[document.domain]
		if (path.length >= 1) {
			category = path[0]
		}
		if (path.length >= 2) {
			if (/^x\d+$/.test(path[1] == false)) {
				subcategory = path[1]
			}
			if (/^x\d+$/.test(path[path.length-2]) == true) {
				extra_get_vars = extra_get_vars + '&article_id=' + path[path.length-2];
			}
		}
	}
	
	// return stuff	
	if(portal){
		result = 'portal='+portal.toLowerCase()
		if(category){
			result = result+"&category="+category.toLowerCase()
			if(subcategory){
				result = result+"&subcategory="+subcategory.toLowerCase()
			}
		}
	}
	result = window.location.search+extra_get_vars+"&XE&"+result+"+&XE"
	return result
}

/* Specific OAS_sitepage overrides */
if (window['OAS_sitepage'] != undefined && (document.domain == 'www.patriotledger.com' || document.domain == 'www.enterprisenews.com' ) && document.location.pathname.indexOf("/answerbook") == 0) {
	OAS_sitepage = OAS_sitepage.replace("/", "/answerbook/");
}
if (window['OAS_sitepage'] != undefined && OAS_sitepage == "www.wickedlocal.com/paint-it-all-pink") {
	//www.wickedlocal.com/paint-it-all-pink
	OAS_sitepage = "www.wickedlocal.com/pink"
}
