function gup( name ){  
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
var regexS = "[\\?&]"+name+"=([^&#]*)";  
var regex = new RegExp( regexS );  
var results = regex.exec( window.location.href );  
if( results == null )    return "";  
else    return results[1];
}
var marketing_identifier = 'mpch=ads'; // set this to the value passed through on all marketing urls
var referringurl = document.referrer.toLowerCase();
var	landingpage = document.URL.toLowerCase();
var pixel = '';
var rnd = Math.floor(Math.random()*1000000000000000000);

if(referringurl != '') {
	// exclude traffic referred from following urls	
	if(referringurl.indexOf('http://book.flythomascook.com/') >= 0 || referringurl.indexOf('http://www1.flythomascook.com/') >= 0 || referringurl.indexOf('https://book.flythomascook.com/skylights') >= 0  || referringurl.indexOf('http://my.flythomascook.com') >= 0 || referringurl.indexOf('http://accept.flythomascook.com') >= 0  || referringurl.indexOf('https://www1.flythomascook.com/') >= 0 || referringurl.indexOf('http://www.flythomascook.com/') >= 0) {// if an ftc page do nothing
		}
		else 	{// if there is a referring url and it is not an ftc page
				if(landingpage.indexOf(marketing_identifier) <= 0) {
				document.write('<iframe frameborder="0" width="1" height="1" src="http://reporting.blmquantum.co.uk/ftc/ns/index.php?ref=' + escape(referringurl) +'&page=' + escape(landingpage) + '&rnd=' + rnd + '"/></iframe>');
				}
				else {
				// if marketing identifier is present we do nothing
				}
		}
}	
else {// NO REFERRING URL ==> DIRECT TRAFFIC
pixel = "<img width='1' height='1' src='http://my.flythomascook.com/cm/tr/11501-90694-29592-0?mpt=" + rnd + "'/>"; 
document.writeln(pixel); 
}