var urlBRUNSON_POP = 'http://www.thebossbuster.com/js/exitpop/BrunsonFiles.html'; 
var urlAFFILIATE_POP = 'http://www.thebossbuster.com/js/exitpop/Affiliate.html';
var urlTWITTER_POP = 'http://www.thebossbuster.com/js/exitpop/Twitter.html';
var url7DAY_POP = 'http://www.thebossbuster.com/js/exitpop/7day.html';
var urlCONT_POP = 'http://www.thebossbuster.com/js/exitpop/Cont.html';
var urlJUSTMC_POP = 'http://www.thebossbuster.com/js/exitpop/JustMCRevealed.html';
var urlARTICLE_POP = 'http://www.thebossbuster.com/js/exitpop/ArticleMarketing.html';
var urlMMFROMTRAFFIC_POP = 'http://www.thebossbuster.com/js/exitpop/MMFromTraffic.html';
var urlNOBONUS_POP = 'http://www.thebossbuster.com/js/exitpop/NoBonus.html';
var urlNEWTRAFFIC_POP = 'http://www.thebossbuster.com/js/exitpop/NewTraffic.html';

var urlBRUNSON = 'http://www.thebossbuster.com/BrunsonFiles'; 
var urlAFFILIATE = 'http://www.thebossbuster.com/AffiliateProfits';
var urlTWITTER = 'http://www.thebossbuster.com/TwitterTraffic';
var url7DAY = 'http://www.thebossbuster.com/SevenDay';
var urlCONT = 'http://www.thebossbuster.com/MassControlRevealed';
var urlARTICLE = 'http://www.thebossbuster.com/ArticleMarketing';
var urlMMFROMTRAFFIC = 'http://www.thebossbuster.com/MoneyFromTraffic';
var urlNOBONUS = 'http://www.thebossbuster.com/BigDiscount';
var urlNEWTRAFFIC = 'http://www.thebossbuster.com/NewWebTraffic';
var urlPARTNER = 'http://www.thebossbuster.com/Partnership';
var urlFINALTHANKS = '';

function Set_Cookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

// this fixes an issue with the old method, ambiguous values
// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}
function noThanks97()
{
	Set_Cookie('node', '8', 60, '/');
	strURL = url7DAY;
	//parent.onbeforeunload = null;

	window.open(strURL);
	//parent.location = strURL;

}

function goFromSoft()
{
	var strURL = "";
	var strNode = Get_Cookie('node');

	if (strNode == '0')
	{
		Set_Cookie('node', '10', 60, '/');
		strURL = urlCONT; 
	}
	else if (strNode == '1')
	{
		Set_Cookie('node', '4', 60, '/');
		strURL = urlBRUNSON; 
	}
	else if (strNode == '2')
	{
		Set_Cookie('node', '12', 60, '/');
		strURL = 'http://digi-sell.com/jvm2/s18132/1151oe/order';
	}
	else if (strNode == '3')
	{
		Set_Cookie('node', '11', 60, '/');
		strURL = 'http://www.google.com';//NEED TO FIX THIS!!!;
	}
	else if (strNode == '4')
	{
		Set_Cookie('node', '5', 60, '/');
		strURL = urlNEWTRAFFIC;
	}
	else if (strNode == '5')
	{
		Set_Cookie('node', '7', 60, '/');
		strURL = urlTWITTER;
	}
	else if (strNode == '6')
	{
		Set_Cookie('node', '15', 60, '/');
		strURL = urlARTICLE;
	}
	else if (strNode == '7')
	{
		Set_Cookie('node', '6', 60, '/');
		strURL = urlMMFROMTRAFFIC;
	}
	else if (strNode == '8')
	{
		Set_Cookie('node', '1', 60, '/');
		strURL = urlAFFILIATE;
	}
	else if (strNode == '10')
	{
		Set_Cookie('node', '3', 60, '/');
		strURL = 'http://digi-sell.com/jvm2/s18132/1151oe/order';
	}
	else if (strNode == '11')
	{
		Set_Cookie('node', '8', 60, '/');
		strURL = url7DAY;
	}
	else if (strNode == '12')
	{
		Set_Cookie('node', '1', 60, '/');
		strURL = urlAFFILIATE;
	}
	else if (strNode == '13')
	{
		Set_Cookie('node', '5', 60, '/');
		strURL = urlNEWTRAFFIC;
	}
	else if (strNode == '14')
	{
		Set_Cookie('node', '7', 60, '/');
		strURL = urlTWITTER;
	}
	else if (strNode == '51')
	{
		Set_Cookie('node', '52', 60, '/');
		strURL = 'http://digi-sell.com/jvm2/s18132/1151oe/order';
	}
	else if (strNode == '52')
	{
		Set_Cookie('node', '8', 60, '/');
		strURL = url7DAY;
	}
	else if (strNode == '53')
	{
		Set_Cookie('node', '5', 60, '/');
		strURL = urlNEWTRAFFIC;
	}

	parent.oldbeforeunload = parent.onbeforeunload;
	parent.onbeforeunload = null;
	parent.setTimeout( function() {
	parent.onbeforeunload = parent.oldbeforeunload;
	parent.oldbeforeunload = null;
	}, 1000 );
	
	parent.location = strURL;
}

function thankRedirect()
{
	var strURL = "";
	var strNode = Get_Cookie('node');
	alert(strNode);
	if (strNode == '0')
	{
		Set_Cookie('node', '2', 60, '/');
		strURL = urlCONT; 
	}
	else if (strNode == '1')
	{
		Set_Cookie('node', '4', 60, '/');
		strURL = urlBRUNSON; 
	}
	else if (strNode == '2')
	{
		Set_Cookie('node', '4', 60, '/');
		strURL = urlBRUNSON;
	}
	else if (strNode == '3')
	{
		Set_Cookie('node', '4', 60, '/');
		strURL = urlBRUNSON;
	}
	else if (strNode == '4')
	{
		Set_Cookie('node', '13', 60, '/');
		strURL = urlPARTNER;
	}
	else if (strNode == '5')
	{
		Set_Cookie('node', '7', 60, '/');
		strURL = urlTWITTER;
	}
	else if (strNode == '6')
	{
		Set_Cookie('node', '15', 60, '/');
		strURL = urlARTICLE;
	}
	else if (strNode == '7')
	{
		Set_Cookie('node', '6', 60, '/');
		strURL = urlMMFROMTRAFFIC;
	}
	else if (strNode == '8')
	{
		Set_Cookie('node', '1', 60, '/');
		strURL = urlAFFILIATE;
	}
	else if (strNode == '10')
	{
		Set_Cookie('node', '4', 60, '/');
		strURL = urlBRUNSON;
	}
	else if (strNode == '11')
	{
		Set_Cookie('node', '1', 60, '/');
		strURL = urlAFFILIATE;
	}
	else if (strNode == '12')
	{
		Set_Cookie('node', '4', 60, '/');
		strURL = urlBRUNSON;
	}
	else if (strNode == '13')
	{
		Set_Cookie('node', '-1', 60, '/');
		strURL = urlFINALTHANKS;
	}
	else if (strNode == '14')
	{
		Set_Cookie('node', '7', 60, '/');
		strURL = urlTWITTER;
	}
	else if (strNode == '51')
	{
		Set_Cookie('node', '53', 60, '/');
		strURL = urlBRUNSON;
	}
	else if (strNode == '52')
	{
		Set_Cookie('node', '53', 60, '/');
		strURL = urlBRUNSON;
	}
	else if (strNode == '53')
	{
		Set_Cookie('node', '5', 60, '/');
		strURL = urlNEWTRAFFIC;
	}
	
	document.write('<meta HTTP-EQUIV="REFRESH" content="0; url=' + strURL + '">');
}

