function readAffiliate()
{
var expires = 90;
var today = new Date();
var expiry = new Date(today.getTime() + (expires * 86400000));
var affiliate = window.location.search.substring(1).split(/\&/);		//function to check the affiliate  								//url
	if (affiliate.length)
	{

		for (var i=0;i<affiliate.length;i++)
		{
			arrcurr=affiliate[i].split(/\=/)
			if (arrcurr[0]=='id')
			{			
				var affiliateId = '' + arrcurr[1];	//extract the id value of the 
			}								//affiliate url
		}
	}
	if (affiliateId)
	{
	var name = 'id';
	var value = affiliateId;
	var path = '/';
	document.cookie = name + "=" + escape(value) +
	( (expires) ? "; expires=" + expiry.toGMTString() : " ") +
	( (path) ? "; path=" + path : " ");
	}
}
window.readAffiliate();