var _POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=800,height=750';
var TabsArray = [];
var ImageArray = [];
function raw_popup(url, target, features) {
	if (features == undefined) {
		features = _POPUP_FEATURES;
	}
	if (target == undefined) {
		target = '_blank';
	}
	var theWindow = window.open(url, target, features);
	theWindow.focus();
	return theWindow;
}
function link_popup(src, features) {
	return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }

    return vars;
}
/***************Start Other Web Stories Module Codes*********************
* This function is being used for the OtherStoriesOnTheWeb pagelet on the business homepage
* It will swap the display/no display for
* all content within span/div tags identified by the id
*/
function ShowOtherWebStuff(current)
{
	for(i=0;i < TabsArray.length;i++)
	{
		if(current != TabsArray[i])
		{
			document.getElementById(TabsArray[i]).style.display = "none";
			document.getElementById(TabsArray[i]+'Tab').className = "";
		}
		else
		{
			document.getElementById(current).style.display = "block";
			document.getElementById(current+'Tab').className = "current";
			document.getElementById('BestOfTheWebImg').src = ImageArray[i];
		}
	}
}
/***************End Other Web Stories Module Codes*********************/

/******* Start Behavioural Targeting *******/

	var DocReferrer		= document.referrer;
	var sQueryString	= location.search.substring(1);//query string of current url - this code is not needed
	var sQueryString	= '';
	var sSearchStr		= '';
	var s				= '';
	var aQueryString	= '';
	var aTemp			= false;
	
	//only run these codes if there is a referrer available
	//and
	//if the referrer is www.google
	if(DocReferrer.length && DocReferrer.indexOf('http://www.google') != -1){
		//if there is a query string in the referrer
		if(DocReferrer.indexOf('?') != -1){
			aTemp			= DocReferrer.split('?');
			sQueryString	= aTemp[1];
			
			if (sQueryString.length != 0){
				aQueryString = sQueryString.split('&');
				for (s in aQueryString){
					if(aQueryString[s].indexOf('q=') != -1){
						sSearchStr	= '&' + aQueryString[s];
						break;
					}
				}
			}
		}
	}

/******* End Behavioural Targeting *******/
