var rg = /(\?|&)aff=([^&]+)/i;
if (rt = rg.exec(location.search))
{
		var expire = new Date();
		expire.setTime(expire.getTime() + 3600000*24*730);
document.cookie='aname='+(rt[2])+';expires='+expire.toGMTString();
}

function getaff()
{
	var rg = /aname=([\w0-9]+)/;
	if (rt = rg.exec(document.cookie))
	 return rt[1].toString();
	else
	{
	 return '';
	}
}

function sendpulse(param,unique, pid, aff_id, tid)
{
var doit=false;
if (unique)
 {
  var rg = new RegExp('pulsemark_'+param);
  //alert('cookie '+rg+' already set');
  if (!rg.test(document.cookie))
	doit=true;


 }
else
  doit=true;

if (doit)
	{
	if (aff_id==0)
	{
		aff_id=getaff();
	}
	document.write('<iframe width=1 height=1 frameborder=0 src=https://www.primescratchcards.com/PP/?AFF='+aff_id+'&AC='+param+'&PID='+pid+'&TID='+tid+'></iframe>');
	}

if (unique) document.cookie='pulsemark_'+param+'=1';
 }

