var ce_bi;
function GetCookie(name) {
var ref;
ref = ""+escape(document.referrer);
var cetui = GetCookievalue('_cetui');
var cetsi = GetCookievalue('_cetsi');
if(!cetui){ cetui = SetCookie('_cetui', "" +  new Date().getTime() + Math.round(Math.random()*21474), 5000); }
if(!cetsi){ cetsi = SetCookie('_cetsi', "" +  new Date().getTime() + Math.round(Math.random()*21474)); }
result = GetCookievalue(name) + "&ref=" + ref + "&cetui=" + cetui + "&cetsi=" + cetsi + ce_bi;
return result;
}
function GetCookievalue(name) {
var result = null;
var myCookie = " " + document.cookie + ";";
var searchName = " " + name + "=";
var startOfCookie = myCookie.indexOf(searchName);
var endOfCookie;
if (startOfCookie != -1 ) {
startOfCookie +=searchName.length;
endOfCookie = myCookie.indexOf(";", startOfCookie);
result = unescape(myCookie.substring(startOfCookie, endOfCookie));
}
return result;
}
function SetCookie(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value) + ";path=/" + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
return value;
}
function TryCookie (name) {
var test = new Date().getTime();
SetCookie(name,test);
}
function ceParseBookInfo(bdt,sci){
if(bdt){
ce_AI = "";
ce_XI = "";
if(bdt.AccommodationItems){ tAI = bdt.AccommodationItems; for(var i in tAI){ if(tAI[i] && tAI[i].ServiceProvider && tAI[i].ServiceProvider.Id) { ce_AI = ce_AI + tAI[i].ServiceProvider.Id; if(tAI[i].Products){ tAIP = tAI[i].Products; tAIPs = 0; for(var k in tAIP){ if(tAIP[k].Price){ tAIPs = tAIPs +  tAIP[k].Price; } } if (tAIPs > 0){ ce_AI = ce_AI + '$' + escape('p=' + tAIPs); } } ce_AI = ce_AI + ','; } } }
if(bdt.BrochureItems){ tBI = bdt.BrochureItems; for(var i in tBI){ if(tBI[i] && tBI[i].Id) { ce_XI = ce_XI + tBI[i].Id; if(tBI[i].Name){ ce_XI = ce_XI + '$' + escape('n=' + tBI[i].Name); } ce_XI = ce_XI + ','; } } }
ce_bi = "&ums="+bdt.TotalAmount + "&meta=";
if(ce_AI){
    var sct = 7;
    if(sci && sci.SalesChannelType){ sct = sci.SalesChannelType; }
    ce_bi = ce_bi + escape('&' + sct + '=' + ce_AI);
}
if(ce_XI){ ce_bi = ce_bi + escape('&9=' + ce_XI); }
if(sci){ ce_bi = ce_bi + escape('&sci=' + sci.SalesChannelGuid ); }
}    
return true;
}
