var myEleCurrncy = document.getElementById("adivaha-currency-container");
console.log('myEleCurrncy:'+myEleCurrncy);
if(myEleCurrncy){
document.getElementById("adivaha-currency-container").innerHTML='';
}
var myEleCurrncy = document.getElementById("adivaha-currency-container1");
if(myEleCurrncy){
document.getElementById("adivaha-currency-container1").innerHTML='';
}
/*=== onload show currency ===*/
var urlParams = new URLSearchParams(window.location.search);
var active_currency = urlParams.get('currency');
var tt =document.getElementById("currency_"+active_currency);
if ( typeof(active_currency) !== "undefined" && active_currency !== null && typeof(active_currency) !== "tt" && tt !== null){
var active_currency_symbol = document.getElementById("currency_"+active_currency).getAttribute("data-symbol");
var active_currency_title = document.getElementById("currency_"+active_currency).getAttribute("data-title");
/*===document.getElementById("adh_currSymbol").innerHTML=active_currency_symbol;===*/
document.getElementById("adh_currTitle").innerHTML=active_currency_title;
document.getElementById("adh_currName").innerHTML=active_currency;
}
/*=== End onload show currency ===*/
function changeCurrency(currency){
var pageURL = window.location.href;
if( (pageURL.indexOf('currency=') != -1) || (pageURL.indexOf('curr=') != -1) ){
var newUrl = pageURL.replace(/\bcurrency=[0-9a-zA-Z_@.#+-]{1,50}\b/, 'currency=' + currency);
newUrl = newUrl.replace(/\bcurr=[0-9a-zA-Z_@.#+-]{1,50}\b/, 'curr=' + currency);
window.location.href=newUrl;
}
else{
if(pageURL.indexOf('?') != -1){
var newUrl = pageURL +'¤cy='+currency;
}
else{
var newUrl = pageURL +'?currency='+currency;
}
window.location.href=newUrl;
}
}
var parent_idle_timeout_over ='No';
var child_idle_timeout_over='No';
console.clear();
console.log("IPAddress:172.70.131.7");
LoadAdivaha();
function LoadAdivaha(){
var qs = window.location.search;
qs = qs.replace("?", '');
var urlParams = new URLSearchParams(qs);
var getToken =urlParams.get('token');
if( getToken=='' || getToken === null || typeof getToken==='undefined' ){
getToken ='';
}
console.log('getToken from url:'+getToken);
if(qs=='action=logout'){
delete_cookie('userid');
delete_cookie('useremail');
delete_cookie('username');
delete_cookie('usertype');
delete_cookie('login_page');
delete_cookie('user_token');
}
if(qs=='action=adhlogout'){
delete_cookie('userid');
delete_cookie('useremail');
delete_cookie('username');
delete_cookie('usertype');
delete_cookie('login_page');
delete_cookie('user_token');
}
var aid='';
var userid =getCookie('userid');
var usertype =getCookie('usertype');
if( (userid!='') && (typeof userid !== 'undefined') && (userid != 'null') ){
var aid=userid;
var usertype =usertype;
}
var ParentRestParam='';
if(document.getElementById("ParentRestParam")){
var ParentRestParam= document.getElementById("ParentRestParam").value;
}
document.getElementById("adivaha-wrapper").style.width = "100%";
var mt = urlParams.get('mt');
var bgcolor = '#0c2e60';
if(getToken != '') {
/* dashboard */
bgcolor = '#0c2e60';
} else if( (mt == '') || (typeof mt == 'undefined') || (mt == null) ) {
bgcolor='#FFF';
} else if(mt == 'mt') {
bgcolor = '#FFF';
} else {
bgcolor='#0c2e60';
}
/*document.getElementById("adivaha-wrapper").innerHTML=*/
document.getElementById("adivaha-wrapper").insertAdjacentHTML('beforeBegin','
');
/* jq162 = jQuery.noConflict( false );*/
var attr_lang = document.getElementById("adivaha-wrapper").getAttribute('language');
var attr_curr = document.getElementById("adivaha-wrapper").getAttribute('currency');
var adh_language='';
if(attr_lang != '' && attr_lang !== null) {
var adh_language = attr_lang;
} else if(document.getElementById("adh_language")) {
var adh_language = document.getElementById("adh_language").value;
}
var attribute_currency='';
if(attr_curr != '' && attr_curr !== null) {
var attribute_currency = '¤cy=' + attr_curr;
}
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=false;
s1.src='https://www.abengines.com//wp-content/plugins/adivaha/iframe-resizer-master/js/iframeResizer.min.js';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s1.setAttribute('id','iFrameresizer');
s0.parentNode.insertBefore(s1,s0);
if(document.querySelector('#adivaha-wrapper').getAttribute('jquery') == 'false'){
if(!window.jQuery) {
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=false;
s1.src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js';
s1.charset='UTF-8';s1.setAttribute('crossorigin','*');s0.parentNode.insertBefore(s1,s0);
}
}
if(qs.indexOf('tphotel=Yes') != -1) {
var srcz = "https://www.abengines.com/tp-hotel-search/?version=v2&pid=77A92131&mid=GJNDR6586MY6&mt=&"+qs+"/#/hotels?"+qs;
} else if(qs.indexOf('tpflight=Yes') != -1) {
var srcz = "https://www.abengines.com/tp-flights-search/?version=v2&pid=77A92131&mid=GJNDR6586MY6&mt=&"+qs+"/#/flights?"+qs;
} else {
var srcz = "https://www.abengines.com//?version=v2&pid=77A92131&mid=GJNDR6586MY6&mt=&wlaid=&aid="+aid+"&lang="+adh_language+""+attribute_currency+"&usertype="+usertype+"&"+qs+"&ip=172.70.131.7&ParentRestParam="+ParentRestParam;
}
var container = document.createElement("div");container.style.width = "100%";container.setAttribute("id", "adivaha-wrapper-container");container.setAttribute("class", "");document.getElementById("adivaha-wrapper").appendChild(container);
var ifrm = document.createElement("iframe");ifrm.setAttribute("src", srcz);ifrm.setAttribute("scrolling", "no");ifrm.setAttribute("frameborder", "0");ifrm.style.width = "100%";ifrm.style.float = "left";ifrm.style.zIndex = "999";
/* ifrm.style.overflow = "hidden";*/
ifrm.style.height = "1000px";document.getElementById("adivaha-wrapper-container").appendChild(ifrm);
/* === If post message not working then close loader by time=== */
setTimeout(function() {
/*document.getElementById("adivahaloading").innerHTML='';*/
var elems = document.getElementsByClassName("adivahaloading");
for(var i = 0; i < elems.length; i++) {
elems[i].innerHTML = '';
}
},20000);
var readyStateCheckInterval = setInterval(function() {iFrameResize({ onMessage: function(messageData) {
var mydata =JSON.stringify(messageData.message);
/* console.log("Testing...");
console.log(messageData.message);
id = document.getlementbyi("TCID");
console.log("Testsdds : "+messageData.message.TC_action);
if(messageData.message.TC_action == "save_TC_Cookie_ID"){
var TC_ID = getCookie('TC_ID');
if(typeof(TC_ID) == "undefined"){
setCookie("TC_ID","AEXPRL",'1');
console.log("Getting Cookie: "+getCookie('TC_ID'));
}else{
console.log("User Already Logged in : "+TC_ID);
}
}
var TC_ID = getCookie('TC_ID');
if(TC_ID == ""){
if(messageData.message.TC_action == "save_TC_Cookie_ID"){
setCookie("TC_ID","AEXPRL",'1');
}
}else{
console.log("User Already Logged in : "+TC_ID);
}
*/
if(messageData.message.iframeLoaded == 'Yes') {
// console.log("Iframe Loaded : "+messageData.message.iframeLoaded);
/*document.getElementById("adivahaloading").innerHTML='';*//*== Remove Loader==*/
var elems = document.getElementsByClassName("adivahaloading");
for(var i = 0; i < elems.length; i++) {
elems[i].innerHTML = '';
}
}
if(messageData.message.child_idle_timeout_over!=''){
child_idle_timeout_over=messageData.message.child_idle_timeout_over;
}
if(messageData.message.p=='reload_parent_url'){
window.location.href='';
}
if(messageData.message.p=='login'){
var user_id =messageData.message.user_id;
var user_email =messageData.message.user_email;
var user_name =messageData.message.user_name;
var user_type =messageData.message.user_type;
var loginpage =messageData.message.loginpage;
var token = messageData.message.token;
var parent_token = messageData.message.parent_token;
var newtab = messageData.message.newtab;
var nextpage =messageData.message.nextpage;
setCookie("userid",user_id,'1');
setCookie("useremail",user_email,'1');
setCookie("username",user_name,'1');
setCookie("usertype",user_type,'1');
setCookie("login_page",loginpage,'1');
setCookie("mybooking_page",nextpage,'1');
setCookie("user_token",token,'1');
setCookie("parent_token",parent_token,'1');
if(typeof token =='undefined'){
window.location.href=nextpage;
} else{
if(newtab=='Yes'){
var taburl =nextpage + "?token="+token+"&subagent=yes";
window.open(taburl);
} else {
if(parent_token!='' && typeof parent_token!='undefined'){
window.location.href=nextpage + "?token="+token+"&parent_token="+parent_token;
}
else{
window.location.href=nextpage + "?token="+token;
}
}
}
} else if(messageData.message.p=='paymentform'){
/*ifrm.style.height = "550px"; */
} else if (messageData.message.p=='recheckAuthentication'){
var message = JSON.stringify({channel: 'FROM_FRAME_A'});
} else if (messageData.message.p=='trip_composer'){
var elemDiv = document.createElement("div");
elemDiv.setAttribute("id", "trip_comp_map");
document.body.appendChild(elemDiv);
var head = document.getElementsByTagName('HEAD')[0];
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'https://www.abengines.com/ui/trip-composer.css?var=132';
head.appendChild(link);
var elemDiv_load = document.createElement("div");
elemDiv_load.setAttribute("id", "trip_comp_map_load");
elemDiv_load.innerHTML = "Please Wait!
We are busy searching for the
BEST DEALS!
";
document.getElementById("trip_comp_map").appendChild(elemDiv_load);
var ifrm2 = document.createElement("iframe");ifrm2.setAttribute("src", messageData.message.nextpage);ifrm2.setAttribute("scrolling", "no");ifrm2.setAttribute("frameborder", "0");ifrm2.style.height = "650px";ifrm2.style.width = "100%";
document.getElementById("trip_comp_map").appendChild(ifrm2);
var elemDiv = document.createElement("div");
elemDiv.setAttribute("id", "trip_comp_map_cross");
function remove_map_loader() {
document.getElementById("trip_comp_map_load").style.display="none";
document.getElementById("trip_comp_map").appendChild(elemDiv);
document.getElementById("trip_comp_map_cross").onclick = function(){
document.getElementById("trip_comp_map").remove();
}
}
setTimeout(remove_map_loader, 2000);
} else if (messageData.message.p=='FREEPLUGIN365'){
//alert("FREEPLUGIN365 Running");
console.log("FREEPLUGIN365 Running");
if(messageData.message.targetElement) {
document.getElementById("trip_comp_map").remove();
} else {
var elemDiv = document.createElement("div");
elemDiv.setAttribute("id", "trip_comp_map");
document.body.appendChild(elemDiv);
var head = document.getElementsByTagName('HEAD')[0];
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'https://www.abengines.com/ui/trip-composer.css?var=132';
head.appendChild(link);
var ifrm2 = document.createElement("iframe");ifrm2.setAttribute("src", messageData.message.nextpage+"?id="+window.location);ifrm2.setAttribute("scrolling", "no");ifrm2.setAttribute("frameborder", "0");ifrm2.style.height = "650px";ifrm2.style.width = "100%";
document.getElementById("trip_comp_map").appendChild(ifrm2);
var elemDiv = document.createElement("div");
elemDiv.setAttribute("id", "trip_comp_map_cross");
document.getElementById("trip_comp_map").appendChild(elemDiv);
}
} else if (messageData.message.p=='saveCookieData'){
var cookie_name = messageData.message.cookie_name;
var cookie_data = JSON.stringify(messageData.message.cookie_data);
setCookie(cookie_name, cookie_data, 365);
} else {
document
.getElementsByTagName('iframe')[0]
.iFrameResizer.sendMessage('Hello back from parent page')
}
} });}, 10);
/*=== Add resizer for car result ====*/
window.addEventListener('message', function(e) {
if (typeof jQuery !== 'undefined') {
var $iframe = jQuery("#iFrameResizer0");
} else {
var $iframe = document.getElementById("iFrameResizer0");
}
var eventName = e.data[0];
var data = e.data[1];
var featureType = e.data[2];
if( (featureType=='CarResult') || (featureType=='Razorpay') ) {
switch(eventName) {
case 'setHeight':
$iframe.height(data);
break;
}
}
// console.log('');
}, false);
}
window.onload=function(){
console.log("Details");
console.log(ABE.Config.Settings);
document.getElementById("iFrameResizer0").click();
//var availHeight = document.body.offsetHeight;
var availHeight = window.innerHeight;
var availWidth = document.body.offsetWidth;
var headerheight = jQuery(".trip_compositor_height").height();
//console.clear();
console.log("Main Screen Height : "+headerheight);
headerheight = headerheight + 5;
document.getElementsByTagName('iframe')[0].iFrameResizer.sendMessage('{"messageval":"Screensize", "width":'+availWidth+', "height":'+(availHeight-headerheight)+'}');
};
var userid = getCookie('userid');
var usernamexx = getCookie('username');
if( (userid!='') && (typeof userid !== 'undefined') && (userid != 'null') ) {
var loginPage =getCookie('login_page');
var mybooking_page =getCookie('mybooking_page');
var token =getCookie('user_token');
var countLoginBo = document.getElementsByClassName("adhCustomerLoginBox").length;
console.clear;
console.log(usernamexx + "VVV");
console.log('loginPage:' + loginPage);
var html='Hi, '+usernamexx+' ';
for(var i=0;i= IDLE_TIMEOUT) {
parent_idle_timeout_over ='Yes';
}
//console.log("Parent idle timeout!"+parent_idle_timeout_over+" Child idle timeout!"+child_idle_timeout_over);
if(parent_idle_timeout_over=='Yes' && child_idle_timeout_over=='Yes'){
var userid =getCookie('userid');
//console.log('userid:'+userid);
if( (userid!='') && (typeof userid !== 'undefined') && (userid != 'null') ){
var loginPage =getCookie('login_page');
window.location.href = loginPage+"?action=adhlogout";
}
}
}
setTimeout(function() {
var referrer_url = window.location.href;
jQuery.ajax({
type: 'POST',
url: 'https://www.abengines.com/ui/console-ajax.php',
data: {
action: 'save_searchbox_url',
pid:'77A92131',
mt:'',
referrer_url: referrer_url,
},
success: function(response) {
}
})
},300);
console.log('policy:');