// JavaScript Document

//Celebrity Cruises Pixel Matrix Functions

function getHost(id){
	var szProtocol = window.location.protocol;
	var host = '//rccl.bridgetrack.com/track/ccl/?id=' + id;
	var url = szProtocol + host;
	return url;
}

function getHostGbC(id){
	var szProtocol = window.location.protocol;
	var host = '//rccl.bridgetrack.com/track/?id=' + id;
	var url = szProtocol + host;
	return url;
}

function addDrivePMPixel(cat) {
	var szProtocol = window.location.protocol;
	var host = "//view.atdmt.com/action/"
	var url =  szProtocol + host + cat;
	document.write('<img src="' + url + '" width="1" height="1" border="0">');
}

function addPlatformAPixelOctEight(cat, id1, id2) {
	var szProtocol = window.location.protocol;
	var host = '//leadback.advertising.com/adcedge/lb';
	var site = '695501';
	var url = szProtocol + host + '?site=' + site + '&srvc=1&betr=' + cat + '=1&betq=' + id1 + '=' + id2;
	document.write('<img src="' + url +'" width="1" height="1" border="0">');
}

function addDoubleClickPixel(cat, qty, cost) {
	var szProtocol = window.location.protocol;
	var szRandom = Math.random() * 1000000;
	var host = "//ad.doubleclick.net/activity";
	var src  = "2010860";
	var type = "celeb150";
	
	var url = szProtocol + host + ';src=' + src + ';type=' + type + ';cat=' + cat + ';qty=' + qty + ';cost=' + cost +';ord=' + szRandom +'?';
	document.write('<img src="' + url + '" width="1" height="1" border="0">');
}

function addServedByPixel() {
    var szProtocol = window.location.protocol;
	var url = szProtocol + "//ace-tag.advertising.com/action/type=647762472/bins=1/rich=0/mnum=1516/logs=0/site=695501/betr=celebcrz_cs=2";
	document.write('<img src="' + url + '" width="1" height="1" border="0">');
}

//Optimization on PlatformA Pixel - March 05 2009
function addPlatformAPixel() {
    var szProtocol = window.location.protocol;
	var url = szProtocol + "//secure.ace-tag.advertising.com/action/type=139293849/bins=1/rich=0/mnum=1516/logs=0";	
	document.write('<img src="' + url + '" width="1" height="1" border="0">');
}

//Pixel Matrix Function
function addPixel(id){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHost(id) + '&r=' + szRandom + '" width="1" height="1" border="0">';
	
	document.write(url);
}

function addPixelGbC(id){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHostGbC(id) + '&r=' + szRandom + '" width="1" height="1" border="0">';
	
	document.write(url);
}

function addPixelOptin(id){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHost(id) + '&optin=1&r=' + szRandom + '" width="1" height="1" border="0">';
	document.write(url);
}

function addPixelRef(id){
	var url = '<img src="' + getHost(id) +  btref() + '" width="1" height="1" border="0">';
	document.write(url);
}

function addPixelCaptain(id){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' +  getHost(id) + '&CC=1&r=' + szRandom + '" width="1" height="1" border="0">';
	document.write(url);
}

function addPixelNewRegistrationDest(id,dest){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' +  getHost(id) + '&dest='+dest+ '&newreg=1&r=' + szRandom + '" width="1" height="1" border="0">';
	document.write(url);
}

function addPixelOptinDest(id,dest){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHost(id) + '&dest='+dest+'&newreg=1&optin=1&r=' + szRandom + '" width="1" height="1" border="0">';
	document.write(url);
}

function addPixelDest(id,dest){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHost(id) + '&dest='+dest+'&r=' + szRandom + '" width="1" height="1" border="0">';
	document.write(url);
}

//Pixel Matrix Function
function addPixelEx(id, param){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHost(id) + '&' + param + '&r=' + szRandom + '" width="1" height="1" border="0">';
	document.write(url);
}

function btref() { 
	var d = document; 
	var e = escape; 
	var r = d.referrer; 
	var szRandom = Math.random() * 1000000;
	return '&ref='+e(r)+'&r='+szRandom;
}

//Pixel Matrix Function which includes a product code
function addPixel(id, productCode){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHost(id) + '&PID=' + productCode + '&r=' + szRandom + '" width="1" height="1" border="0">';
	
	document.write(url);
}

//GBC Pixel Matrix Function which includes a product code
function addGBCPixel(id, productCode){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHostGbC(id) + '&PID=' + productCode + '&r=' + szRandom + '" width="1" height="1" border="0">';
	
	document.write(url);
}

//Pixel Matrix Function which includes the environments that the pixel is running in
function addEnvPixel(id, environment){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHost(id) + '&env=' + environment + '&r=' + szRandom + '" width="1" height="1" border="0">';
	
	document.write(url);
}

//Pixel Matrix Function which includes a product code to distinguish between the environments that the pixel is running in
function addPixel(id, productCode, environment){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHost(id) + '&PID=' + productCode + '&env=' + environment + '&r=' + szRandom + '" width="1" height="1" border="0">';
	
	document.write(url);
}

//Pixel Matrix Function which includes a product code to distinguish between products, ship, and the environment that the pixel is running in
function addPixel(id, productCode, shipCode, environment){
	var szRandom = Math.random() * 1000000;
	var url = '<img src="' + getHost(id) + '&PID=' + productCode + '&SHIP=' + shipCode + '&env=' + environment + '&r=' + szRandom + '" width="1" height="1" border="0">';
	
	document.write(url);
}
