﻿
//MYR CUSTOMS LINKS/BUTTONS METRICS FUNCTIONS

function SendSignInOmniture() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'MYR - Sign in Now');

}
//Used within MYR JS
//Using Portal Page

function SendSearchOmniture() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'MYR Show Reservation');

}

//Using Landing Page MYR

function SendSearchMyr() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'MYR Show Reservation Landing Page');
}

function SendLoginOmniture() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'MYR Login botton');
}


function SendMyrPrint() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'MYR Imprimir');
}


function SendMyrByEmail() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'MYR Enviar por correo electronico');
}


function SendPayOne() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Pay botton #1');
}

function SendPayTwo() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Pay botton #2');
}
//COPAAIR CUSTOMS LINKS/BUTTONS METRICS FUNCTIONS

function SendRoundTripOption() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Round trip option');
}

function SendOneWayOption() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'One way option');
}

function SendBookMultiCityLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Book Multi-city link');

}

function SendLowestFareGuaranteedLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Lowest fare guaranteed link');

}

function SendUsePromotionCodeLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Use a promotion code link');

}

function SendSearchFlightsBotton() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Search flights botton');

}

function SendLinkPromotionFlashBanner() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Link promotion flash banner');

}


function SendMoreDealsLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'More Deals link');

}

function SendLoginContinueLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Login Continue link');

}

function SendViewAllReservationsLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'View all reservations link');

}
/*Refactored */
//function SendViewWebDealsOferts() {
//    s = s_gi(myVar);
//    //  alert(s);
//    s.tl(this, 'o', 'View Web Deals');

//}

/*Web Deals Factoring*/
function SendViewWebDealsOfertsOne() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Web Deals #1');

}
function SendViewWebDealsOfertsTwo() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Web Deals #2');

}

function SendViewWebDealsOfertsThree() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Web Deals #3');

}
/*End Web Deals Factoring*/


function SendWebCheckInBotton() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Web check in botton');

}


function SendJoinNowLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Join now link');

}

function SendSignInBotton() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Sign In botton');

}

function SendMyProfileLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'My profile link');

}

function SendSignOutLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Sign out link');

}

function SendMyOnePassMilesLink() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'My one pass miles link');

}

function SendChangeCountryLanguageBotton() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Change country & language botton');

}

function SendWeatherAlert() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Weather alert - Flight status link');

}

function SendFlightStatus() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Check status flifo botton');
}

function SendMoreNews() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'More News');
}

function SendFlightInfoCityPairs() {
    var test = new Array();
    var i = 0;
    $(".standard").each(function() {
        test[i] = $(this).val();
        i++;
    });
    s = s_gi(myVar);
    s.linkTrackVars = "eVar31";
    //    alert(test[0]);
    //    alert(test[1]);
    s.eVar31 = test[0] + "-" + test[1];
    if (s.eVar31 == "0-0") {
        s.eVar31 == "";
    }
    else {
        s.eVar31 = test[0] + "-" + test[1];
        SendFlightStatus()
    }


}

/*Travel Info Metrics*/
function SendLuggage() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Content - Que es Equipaje');
}

function SendTrackLuggage() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Content - Rastree su equipaje');
}

function SendLuggagePets() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Content - Mascotas');
}

function SendSpecialPets() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Mascotas - Serv. Especiales');
}
function SendNotAllowItems() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Content - Articulos no permitidos');
}

function SendChildrensAlone() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Content - Niños viajando solos');
}

function SendInfants() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Content - Infantes');
}

function SendOxygenService() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Content - Servicio de oxigeno medico');
}

function SendWheelChair() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Content - Sillas de Rueda');
}
/*End Travel Info Metrics*/


/*Migration Documents*/
function SendMigrationDocuments() {
    s = s_gi(myVar);
    //  alert(s);
    s.tl(this, 'o', 'Content - Buscar Documentos Migratorios');
}
/*End Migration Documents*/


/*CHAT LINK */
function SendChatLink() {
    s = s_gi(myVar);
    s.linkTrackVars = "events";
    s.linkTrackEvents = "event7";
    s.events = "event7";
    s.tl(this, 'o', 'Chat Link');
}

/*END CHAT CLICK*/

//JQUERY EVENTS (CLICK / KEYPRESS/ KEYUP)
$(document).ready(function() {

    //Applying MYR Metrics

    $('.ButtonSign').click(function() { return SendLoginOmniture(); });
    $('.contenturl').click(function() { return SendSignInOmniture(); });
    $('.ButtonSearch').click(function() { return SendSearchMyr(); });
    $('.MyrPayButtonOneCss').click(function() { return SendPayOne(); });
    $('.MyrPayButtonSecondCss').click(function() { return SendPayTwo(); });
    $('.MyrPrintCss').click(function() { return SendMyrPrint(); });
    $('.MyrSendByEmailCss').click(function() { return SendMyrByEmail(); });

    //Applying Flight Information Metrics
    $('.btnFlightInformationButton').click(function() { return SendFlightInfoCityPairs(); });

    function SendFlightInfoCityPairsFromShortCut() {
        var pair1 = $('.FlightOriginCss').val();
        var pair2 = $('.FlightDestinationCss').val();
        pair1 = getSegParam(pair1);
        pair2 = getSegParam(pair2);
        if (pair1 != "" && pair2 != "") {
            s = s_gi(myVar);
            s.linkTrackVars = "eVar31";
            s.eVar31 = pair1 + "-" + pair2;
            SendFlightStatus()
        }
    }

    function getSegParam(valu) {
        var strReturn = "";
        var strHref = valu;
        if (strHref.indexOf(",") > -1) {
            var strQueryString = strHref.substr(strHref.indexOf(",")).toUpperCase();
            var aQueryString = strQueryString.split(" ");
            strReturn = aQueryString[2];
        }

        return strReturn;
    }

    $('.CheckFlightStatusCss').click(function() { return SendFlightInfoCityPairsFromShortCut(); });
    //End Flight Information Metrics


    //Applying COPAAIR Metrics

    $('.FlightSearchCss').click(function() {
        SendSearchFlightsBotton();
        var i = $('.TypeFlightCss').find("input[@checked]").val();
        if (i == 'Radiobutton1') {
            SendRoundTripOption();
        }
        else {
            SendOneWayOption();
        }

		
    });

    //Applying 2 Metrics
    $('.MultiCityCss').click(function() { return SendBookMultiCityLink(); });

    //Applying 3 Metrics
    $('.PromotionalCodeCss').click(function() { return SendUsePromotionCodeLink(); });


    //Applying 5 Metrics
    $('.OfertsCss').click(function() { return SendMoreDealsLink(); });

    //Applying 6 Metrics
    $('.LoginCss').click(function() { return SendSignInBotton(); });


    //Applying 7 Metrics
    $('.RegisterToCss').click(function() { return SendJoinNowLink(); });

    //Applying 18 Metrics
    $('.OnePassMilesCss').click(function() { return SendMyOnePassMilesLink(); });

    //Applying 8 Metrics
    $('.WebCheckInCss').click(function() { return SendWebCheckInBotton(); });

    //Applying 14 Metrics
    $('.ViewReservationCss').click(function() { return SendViewAllReservationsLink(); });

    //Applying 17 Metrics
    $('.MoreNewsCss').click(function() { return SendMoreNews(); });

    //Applying 11 Metrics
    $('.MyTravelsCss').click(function() { return SendSearchOmniture(); });


    //Applying 12 Metrics
    $('.MyProfileCss').click(function() { return SendMyProfileLink(); });

    //Applying 13 Metrics
    $('.LogoutCss').click(function() { return SendSignOutLink(); });

    //Applying 9 Metrics
    $('.ChangeStoreFrontCss').click(function() { return SendChangeCountryLanguageBotton(); });

    //Applying 15 Metrics - MOVED
//    $('.WebDealCss').click(function() { return SendViewWebDealsOferts(); });

    $('.promoImage').click(function() { return SendLinkPromotionFlashBanner(); });
    /*web deals calling*/

    $('.WebDealCss0').click(function() { return SendViewWebDealsOfertsOne(); });
    $('.WebDealCss1').click(function() { return SendViewWebDealsOfertsTwo(); });
    $('.WebDealCss2').click(function() { return SendViewWebDealsOfertsThree(); });

    /*end web deals calling*/


    /* Wheather Alert*/
    $('.WeatherAlertCss').click(function() { return SendWeatherAlert(); });
    
    //End Applying COPAAIR Metrics


    /*Applying travel info calling */

    $('.LuggageCss').click(function() { return SendLuggage(); });
    $('.TrackLuggageCss').click(function() { return SendTrackLuggage(); });
    $('.NotAllowedItemCss').click(function() { return SendNotAllowItems(); });
    $('.LuggagePetCss').click(function() { return SendLuggagePets(); });
    $('.ChildrensAloneCss').click(function() { return SendChildrensAlone(); });
    $('.InfantsCss').click(function() { return SendInfants(); });
    $('.SpecialPetsCss').click(function() { return SendSpecialPets(); });
    $('.MedicalOxygenCss').click(function() { return SendOxygenService(); });
    $('.WheelChairCss').click(function() { return SendWheelChair(); });
    $('.WheelChairCss').click(function() { return SendWheelChair(); });

    /*end travel info calling*/
    

    /*Applying Inmigrations Documents */
    $('.TimaticButton').click(function() { return SendMigrationDocuments(); });
    /*End Inmigrations Documents*/

    /*Applying Chat Link */
    $('.ChatLinkMessageCss').click(function() { return SendChatLink(); });
    /*End Chat Link*/

});