// set search engine HTML content to display
var seAdContent = '<a href="http://www.allhemorrhoids.com/products/hmiracle"><img src="http://www.allhemorrhoids.com/wp-content/uploads/2011/10/hemorrhoids.gif" width="225" height="225" class="alignnone size-full wp-image-1163" /></a>';
var seAdContent2 = '<div align="center"><font size="5"><b><a href="http://www.allhemorrhoids.com/products/hmiracle" style="text-decoration: underline;color:blue">Get Rid Of Hemorrhoids Right Now</a></b></font></div>';
var seAdContent3 = '<div align="center"><a href="http://www.allhemorrhoids.com/products/hmiracle"><img class="alignnone" src="http://www.allhemorrhoids.com/wp-content/uploads/2011/10/h-miracle.png" alt="acne treatment" width="450" height="300" /></a></div>'
// set NON-search engine HTML content to display
var nonSEAdContent = '<div align="left">If you are looking for a hemorrhoids treatment please consider our affiliate <a href="http://www.allhemorrhoids.com/products/hmiracle" style="text-decoration: underline;color:blue">H Miracle</a>. We will get a commission if you decide to buy through our affiliate link.</div>';
var nonSEAdContent2 = '<p>AGAIN - I Thank You For Visiting My Little Site.</p>';
var nonSEAdContent3 = '<p>AGAIN - I Thank You For Visiting My Little Site.</p>';

// set search engine cookie name/value pair
var seCookieName = 'isSEVisitor';
var seCookieVal = '1';

// set NON-search engine cookie name/value pair
var cookieName = 'isSEVisitor';
var cookieVal = '0';

function onlylevis() { setAdContent(1, seAdContent, nonSEAdContent); }

function onlylenonvis() { setAdContent(0, seAdContent, nonSEAdContent); }

function onlylevis2() { setAdContent(1, seAdContent2, nonSEAdContent2); }

function onlylenonvis2() { setAdContent(0, seAdContent2, nonSEAdContent2); }

function onlylevis3() { setAdContent(1, seAdContent3, nonSEAdContent3); }

function onlylenonvis3() { setAdContent(0, seAdContent3, nonSEAdContent3); }

function setAdContent(setForSE, seAdCnt, stdAdCnt)
{
var cookie = getSECookieData();
var isSE = 0;
	if (cookie != '')
	{
		if (cookie != '0') isSE = 1;
	}
	else
	{
	var ref = document.referrer;
	var SE = new Array('web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '.yahoo.','/url','/search','.google.','.ask.','.baidu.','.bing.','.aol.','.answers.','.twitter.');
		for (var src in SE)
		{
			if (ref.indexOf(SE[src]) != -1)
			{
			isSE = 1;
			break;
			}
		}
		isSE ? setCookie(seCookieName, seCookieVal) : setCookie(cookieName, cookieVal);
	}
	if (setForSE && isSE) document.write(seAdCnt);
	else if (!setForSE && !isSE) document.write(stdAdCnt);
return;
}

function getSECookieData()
{
	if (document.cookie.length > 0)
	{
	start = document.cookie.indexOf('isSEVisitor=');
		if (start != -1)
		{
		start = start + "isSEVisitor".length + 1;
		end = document.cookie.indexOf(";", start);
			if (end == -1) end = document.cookie.length;
		return unescape( document.cookie.substring(start, end) );
		}
	}
return '';
}

function setCookie(name, val)
{
// set 24 hour cookie
var expDate = new Date();
expDate.setTime(expDate.getTime() + (24*60*60*1000));
document.cookie = name + '=' + escape(val) + "; expires=" + expDate.toGMTString() + '; path=/';
}
