 
// main
(function($) {
$(document).ready(function() {  

    //select all the a tag with name equal to modal
    $('a[name=modal1]').click(function(e) {
        //Cancel the link behavior
        e.preventDefault();
        
        //Get the A tag
        var targ1 = $(this).attr('href');
        var id = '#traviframe';
    
        var maskHeight = $(window).height();
        var scrollTop = $(window).scrollTop();
    
        //Get the window height and width
        var winH = maskHeight;
              
        //Set the popup window to center
//        $('#traviframe').html('');
        $('#traviframe div').html('<iframe src="#" >Your browser does not support iframes</iframe>');
        $('#traviframe iframe').attr('src',targ1);
        $('#traviframe iframe').css('height',winH  - 70);
        $(id).css('top', scrollTop -200 );
    
        //transition effect
        $(id).show();    
        $(id).css('opacity', 0);
        $(id).animate({opacity: 1.0}, {queue: false, duration: 1000});
    
    });
    
    //if close button is clicked
    $('#traviframe .close').click(function (e) {
        //Cancel the link behavior
        e.preventDefault();
        $('#traviframe').hide();
    });     
    
});
})(jQuery)

