// 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 addDoubleClickPixel(cat, qty, cost, pkgId, id) {
	var szProtocol = window.location.protocol;
	var host = "//ad.doubleclick.net/activity";
	var src  = "1195272";
	var type = "booki262";
	
	var url = szProtocol + host + ';src=' + src + ';type=' + type + ';cat=' + cat + ';qty=' + qty + ';cost=' + cost +';u=' + pkgId + ';ord=' + id +'?';
	document.write('<img src="' + url + '" width="1" height="1" border="0">');
}

function addServedByPixel() {
    var szProtocol = window.location.protocol;
	var url = szProtocol + "//servedby.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">');
}
//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 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);
}

//Promotions Matrix Function
function addGBCPixel(id, param){
	var szProtocol = window.location.protocol;
	var szRandom = Math.random() * 1000000;
	document.write('<img src="' + szProtocol + '//rccl.bridgetrack.com/track/?id=' + id + '&SPECIAL_PROMO_1=' + param + '&r=' + szRandom + '" width="1" height="1"border="0">');
}

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