
// Function to execute store link
function uselink(linkto)
{
	blankWin = window.open(linkto,'_blank');
}

// First we check to see if the variable "version" has been defined at all.  If not, default to using link1 & link2 declared from origin page.  
// Often, the case where the default is triggered, will simply be that there is only a need for one buy now button on the origin page (such as in
// a header but not elsewhere).  
//
// However, in other cases where there are multiple buttons, the problem where link1 & link2 contains the data (i.e. links) from 
// the last time they are declared on the origin page, will still exist (thus earlier buttons links will be overwritten if they 
// also use "link1" & "link2").  So, be sure to declare subsequent buttons links as "link3" & "link4" and so on, and set the "version" 
// variable to avoid this (doing so without setting the version variable will still trigger the default).
// 
// If a button uses the same links as a previous button on the page, we can forgo declaring the links, and simply set the version as it was for the
// previous button and call this javascript.

if(typeof( version ) == 'undefined'){
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track1 ) == 'undefined'){
			var track1="";
		}
		if(typeof( track2 ) == 'undefined'){
			var track2="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track2)' href='javascript:uselink(link2)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track1)' href='javascript:uselink(link1)'>GospelPublishing.com</a>");
}

// Otherwise, we have declared that there are multiple buy now buttons that require a different set of links, thus "version" has been declared
// on the origin page.  If the variable has been declared anywhere on the page, it will trigger this code.  So, the final "else" is the default,
// which points to link1 & link2 as declared on the origin page.
else
{
	if (version==1)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track1 ) == 'undefined'){
			var track1="";
		}
		if(typeof( track2 ) == 'undefined'){
			var track2="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track2)' href='javascript:uselink(link2)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track1)' href='javascript:uselink(link1)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else if (version==2)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track3 ) == 'undefined'){
			var track3="";
		}
		if(typeof( track4 ) == 'undefined'){
			var track4="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track4)' href='javascript:uselink(link4)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track3)' href='javascript:uselink(link3)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else if (version==3)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track5 ) == 'undefined'){
			var track5="";
		}
		if(typeof( track6 ) == 'undefined'){
			var track6="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track6)' href='javascript:uselink(link6)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track5)' href='javascript:uselink(link5)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else if (version==4)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track7 ) == 'undefined'){
			var track7="";
		}
		if(typeof( track8 ) == 'undefined'){
			var track8="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track8)' href='javascript:uselink(link8)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track7)' href='javascript:uselink(link7)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else if (version==5)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track9 ) == 'undefined'){
			var track9="";
		}
		if(typeof( track10 ) == 'undefined'){
			var track10="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track10)' href='javascript:uselink(link10)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track9)' href='javascript:uselink(link9)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else if (version==6)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track11 ) == 'undefined'){
			var track11="";
		}
		if(typeof( track12 ) == 'undefined'){
			var track12="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track12)' href='javascript:uselink(link12)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track11)' href='javascript:uselink(link11)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else if (version==7)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track13 ) == 'undefined'){
			var track13="";
		}
		if(typeof( track14 ) == 'undefined'){
			var track14="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track14)' href='javascript:uselink(link14)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track13)' href='javascript:uselink(link13)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else if (version==8)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track15 ) == 'undefined'){
			var track15="";
		}
		if(typeof( track16 ) == 'undefined'){
			var track16="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track16)' href='javascript:uselink(link16)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track15)' href='javascript:uselink(link15)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else if (version==9)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track17 ) == 'undefined'){
			var track17="";
		}
		if(typeof( track18 ) == 'undefined'){
			var track18="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track18)' href='javascript:uselink(link18)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track17)' href='javascript:uselink(link17)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else if (version==10)
	{
		// To prevent script errors, check to see if the tracking variables are defined.  If not, set them to null, so they will at least exist.
		if(typeof( track19 ) == 'undefined'){
			var track19="";
		}
		if(typeof( track20 ) == 'undefined'){
			var track20="";
		}
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track20)' href='javascript:uselink(link20)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track19)' href='javascript:uselink(link19)'>GospelPublishing.com</a>");
		version=0;
	}
	
	else 
	{
		document.write("<strong>Purchase from:</strong><img src='images/trans.gif' height='20' alt='GPH' align='absmiddle' /><BR />");
		document.write("<img src='images/mhc.png' alt='MHC' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track2)' href='javascript:uselink(link2)'>MyHealthyChurch.com</a><BR />");
		document.write("<img src='images/trans.gif' height='10' /><BR />");
		document.write("<img src='images/GPH.png' alt='GPH' align='absmiddle' />&nbsp;&nbsp;&nbsp;<a ONCLICK='VSLT(track1)' href='javascript:uselink(link1)'>GospelPublishing.com</a>");
	}
}


