document.write("<style type='text/css'>#navigation { visibility: hidden; }</style>");

var _isNZAU = false;
var _changeLock = false;

function getParameter(paramName) {
  var searchString = window.location.search.substring(1),
      i, val, params = searchString.split("&");

  for (i=0;i<params.length;i++) {
    val = params[i].split("=");
    if (val[0] == paramName) {
      return unescape(val[1]);
    }
  }
  return null;
}



jQuery(document).ready(function($){

    $.ajax({
      type: "POST",
      url: "../../landing.php",
      data: "CityTo="+getParameter('CityTo')+"&CityFrom="+getParameter('CityFrom')+"&price="+getParameter('price'),
      success: function(msg){
         tmp = msg.split('<|split|>');
         for(i = 0; i < tmp.length; i++){
             tmp2 = tmp[i].split('|');
             if (tmp2[0] == "#topTab1 h1"){
                 $('#topTab1').css('width', '510px');
             }
             if (tmp2[0] == "#topTab1 h1" || tmp2[0] == "span#right-box-title" || tmp2[0] == "span#right-box-pricing"){
                 $(tmp2[0]).html(tmp2[1]); 
             }else{
                 $(tmp2[0]).val(tmp2[1]);   
             }
         }
         
         if(getParameter('CityTo') && !getParameter('CityFrom')){
             $('input#CityFrom').focus();
         }         
         
         if(getParameter('Class')){
             $('#TravelClass:select').val(getParameter('Class'));
         }
//         if( window.location.href != "http://www.webjet.com/cars/" && window.location.href != "http://cms.webjet.com/cars/" && window.location.href != "http://www.webjet.com/vuelos/" && window.location.href != "http://cms.webjet.com/vuelos/"){
//            $('#topTab1').css('width', '510px');
//         }
      }
    });
  // add a version class to the footerlinks
  $('#footerv2').parent().addClass('v2footer');
  
		/* wrap the main navigation link text in a span, this is used in the CSS for the rounded tab corners */
    	$("#subnavigation ul:first > li").children("a").each(function() {
    		$(this).wrapInner("<span></span>");
    	});
		
		$("#nav ul:first li:lt(4)").each(function() {
			$(this).addClass("important");
		});
		
		/* insert a blank list item to the navigation menu, this is used for the drop shadow on the last tab */
		$("#nav ul:first").append("<li class=\"last\"></li>");
		
		$("#subnavigation ul:first").addClass('subnavigation');
		$("#navigation").css('visibility','visible');
		$("#subnavigation").addClass('menu_activated');
        $("#subnavigation ul.subnavigation li li:has(ul)").addClass("subarrows");
		$("#subnavigation ul.subnavigation").superfish();
								
		// the homepage iframe tables need to have a class added to the right column of each row to allow for individual styling
		$("#wrapper table.homepage-iframe-table tr td:nth-child(3)").addClass("right");
		$("#wrapper table.homepage-iframe-table tr th:nth-child(2)").addClass("right");
		$("#wrapper table.homepage-iframe-table.middle tr th:nth-child(2)").addClass("right");
		$("#wrapper table.homepage-iframe-table.middle tr td:nth-child(2)").addClass("right");
		$("#homepage-content-frame #wrapper a").attr("target", "_top");
        
		
		// make sure links and forms in the standalone navigation open the whole screen
		$( 'body.standalone #navigation a, body.standalone #promotion form' ).attr( 'target', '_top' );
		   
        // make all external links open in new window
    	$.each( $("a"), function() {
    			 var el = $(this);
    			 if ( el.attr("href") && el.attr("href").indexOf("http://") > -1 && !(el.attr("href").indexOf("webjet.co.nz") > -1) && !(el.attr("href").indexOf("etiaustralia.com.au") > -1) && !(el.attr("href").indexOf("webjet.com") > -1) && !(el.attr("href").indexOf("www.webjet") > -1)    )
    					el.attr({ target: "_blank" });
                 // make the insurance disclaimer open in a popup window
                 if ( el.attr("href") == 'https://itravel.etiaustralia.com.au/webjetnz/disclaimer.aspx' ) 
                 {
                     $(el).click( function() {
                         window.open( $(this).attr( 'href' ), 'form_popup', 'toolbar=0,resizable=0,scrollbars=1,left=2,top=2,width=800,height=550');
                         return false;
                     });
                 }
                  if ( el.attr("href") == 'http://www.webjet.co.nz/change-my-booking/' ||  el.attr("href") == 'http://www.webjet.co.nz/webjet' ) 
		  {
		      $(el).click( function() {
			  window.open( $(this).attr( 'href' ), 'form_popup', 'menubar=1,toolbar=1,resizable=1,scrollbars=1,location=yes,status=yes,left=2,top=2,width=1029,height=766');
			  return false;
		      });
                 }
                 
    	});
        
    	$.each( $("#search-side .mod_linklist li a"), function() {
    		 var el = $(this);
    		 if ( el.attr("class") != "nolink" && el.attr("class") != "nopop" && el.attr("href").indexOf("webjet.co.nz") > 0 )
             {
    	 		el.click( function() {
                    if($(this).text() == "Feedback")
			{
				window.open($(this).attr("href"),'','top=100,left=100,height=800,width=1040,menubar=yes,toolbar=yes,scrollbars=yes,location=yes,status=yes');
			}
			else
			{
				window.open($(this).attr("href"),'','top=100,left=100,height=666,width=610,resizable=0,menubar=no,toolbar=no,scrollbars=yes');
			}
                    return false;
                });
             }
    	});
        
        // make all external links with a class of popup open in a new window
        $( 'a.popup, a.popUp, a.PopUp').click( function(){
             window.open( $(this).attr( 'href' ), 'link_popup', 'toolbar=0,resizable=0,scrollbars=1,left=2,top=2,width=800,height=550');
             return false;
        });
        
        $( 'a.popup_stripped').click( function(){
		     window.open( $(this).attr( 'href' ), 'link_popup', 'toolbar=0,resizable=0,scrollbars=0,menubar=0,left=2,top=2,width=610,height=666');
		     return false;
        });
		
		// make any form with a class of "popup" submit to a small popup window
		$('form.popup').submit(function( event ) {
			window.open('', 'form_popup', 'toolbar=0,resizable=0,scrollbars=0,left=2,top=2,width=450,height=350');
			$(this).attr("target", "form_popup");
		});
			   
		// generic button hover
		$('.button').hover(function() {
			$(this).attr("src", "/site/images/"+ $(this).attr("id") +"_over.gif");
		}, function() {
			$(this).attr("src", "/site/images/"+ $(this).attr("id") +".gif");
		});
		
		// add classes to tables in the content body to allow zebra and rollover styling
		$("#content table tr:nth-child(even), body.body #main table tr:nth-child(even)").addClass("even");
		$("#content table tr th:first-child, body.body #main table tr th:first-child").addClass("first");
		$("#content table tr td:first-child, body.body #main table tr td:first-child").addClass("first");
		$("#content table tr, body.body table tr").hover(function() {
				$(this).addClass("over");							  
		},
		function() {
				$(this).removeClass("over");	  
		});
		
		// any image with a class of rollover in a link will automatically have an image rollover effect applied
		$("a img.rollover").hover(function() {
				$(this).attr("src", $(this).attr("src").replace(".", "_over." ) );
		},
		function() {
				$(this).attr("src", $(this).attr("src").replace( "_over.", "." ) );
		});
        		
		// magic dealfinder table click through controls
		$("td.InterMatrix_Table_Prices_Display a").click( function() {
					$(this).attr("alt", $(this).attr("title") );			   
					$(this).attr("title", "FLIGHT SEARCH");
					var dates = $(this).attr("onclick").toString().match(/\("(.*)"\)/gm)[0].replace(/["\(\)]/g, '').split(",");
					var day = dates[0];
					var yearmonth= dates[1];
					var shref = "/standalone/bookings/?day=" + encodeURIComponent(day) + "&yearmonth=" + encodeURIComponent(yearmonth);
					shref += "&CityFrom=";// + encodeURIComponent(CityFrom);
					shref += "&CityTo=";// + encodeURIComponent(CityTo);
					shref += "&TravelClass=" + encodeURIComponent(TravelClass);
					shref += "&AirlinePref=" + encodeURIComponent(AirlinePref);
					shref += "&TripType=" + encodeURIComponent(TripType);
					shref += "&NumAdult=" + encodeURIComponent(NumAdult);
					shref += "&NumChild=" + encodeURIComponent(NumChild);
					shref += "&NumInfant=" + encodeURIComponent(NumInfant);
					shref += "&lockallfieldsexceptreturn=true&showtips=true&hideoneway=true&KeepThis=true&TB_iframe=true&height=250&width=600";
					$(this).attr("href", shref );
			});
			$("td.InterMatrix_Table_Prices_Display a").addClass("thickbox");
            
    		// A hack for IE6 layout of MDF page
            if($.browser.msie&&/6.0/.test(navigator.userAgent))
    		    $("td.InterMatrix_Dates_Small.first table").css('margin-top', '60px');
			
			// lightbox search for flight specials pages
			$("body.flights a.lightbox").click( function() {	   
					var attr_title = $(this).attr("title");
					var CityTo = attr_title;
					if ( attr_title.indexOf("Search for flights to") == -1 )
						$(this).attr("title", "Search for flights to " + CityTo);
					else
						CityTo = attr_title.substring( 22, attr_title.length );
					var day = "";
					var yearmonth= "";
					var CityFrom = "";
					var shref = "/standalone/bookings/?day=" + encodeURIComponent(day) + "&yearmonth=" + encodeURIComponent(yearmonth);
					shref += "&CityFrom=";// + encodeURIComponent(CityFrom);
					shref += "&CityTo=";// + encodeURIComponent(CityTo);
					if ( location.href.indexOf( "business-class" ) > 0 )
						shref += "&TravelClass=" + encodeURIComponent("BUSINESS");
					shref += "&lockallfieldsexceptreturnandorigin=true&showtips=true&KeepThis=true&TB_iframe=true&height=250&width=500";
					$(this).attr("href", shref );			
			});
			$("body.flights a.lightbox").addClass("thickbox");
                        
			$("body.flights a.deal_lightbox").click( function() {	   
					var attr_title = $(this).attr("title");
					var CityTo = attr_title;
					if ( attr_title.indexOf("Search for flights to") == -1 )
						$(this).attr("title", "Search for flights to " + CityTo);
					else
						CityTo = attr_title.substring( 22, attr_title.length );
					var CityFrom = $(this).attr("cityfrom");
					var cityfrom_code= $(this).attr("cityfrom_code");
					var cityto_code = $(this).attr("cityto_code");
					var start_date= $(this).attr("start_date");
					var end_date = $(this).attr("end_date");
					var shref = "/standalone/bookings/?";//day=" + encodeURIComponent(day) + "&yearmonth=" + encodeURIComponent(yearmonth);
					shref += "CityFrom="+encodeURIComponent(CityFrom);// + encodeURIComponent(CityFrom);
					shref += "&CityTo="+encodeURIComponent(CityTo);// + encodeURIComponent(CityTo);
					shref += "&cityfrom_code="+encodeURIComponent(cityfrom_code);// + encodeURIComponent(CityTo);
					shref += "&cityto_code="+encodeURIComponent(cityto_code);// + encodeURIComponent(CityTo);
					shref += "&start_date="+encodeURIComponent(start_date);// + encodeURIComponent(CityTo);
					shref += "&end_date="+encodeURIComponent(end_date);// + encodeURIComponent(CityTo);
					if ( location.href.indexOf( "business-class" ) > 0 )
						shref += "&TravelClass=" + encodeURIComponent("BUSINESS");
					shref += "&lockallfieldsexceptreturnandorigin=true&showtips=true&KeepThis=true&TB_iframe=true&height=250&width=500";
					$(this).attr("href", shref );			
			});
			$("body.flights a.deal_lightbox").addClass("thickbox");                           
            
            // a specially formed link to a dealfinder page can automatically trigger the lightbox
           // if($_get('triggerLightbox')&&$_get('DateOut'))
           // {
           //     var DateParts = $_get('DateOut').split('/');
           //     setTimeout(function(){
           //         tb_show('FLIGHT SEARCH','/standalone/bookings/?day=' + (DateParts[2] - 1) + '&yearmonth=' + DateParts[0] + '%2F' + DateParts[1] + '&CityFrom=' + $_get('mdf_depart') + '&CityTo=' + $('#frmMain').attr('action').match(/DestinationPoint=(.[^&]+)&/)[1] + '&TravelClass=ECONOMY&AirlinePref=0&TripType=Return&NumAdult=2&NumChild=0&NumInfant=0&lockallfieldsexceptreturnandorigin=true&showtips=true&KeepThis=true&TB_iframe=true&height=250&width=500');
           //     }, 500);
           // }
            
		if($_get('triggerLightbox')&&$_get('DateOut'))
		{
		    var DateParts = $_get('DateOut').split('/');
		    setTimeout(function(){
		    var rtnDate = "";
		    if($_get('rtnDate'))
		    {
			rtnDate = "&rtnDateAuto=true&rtnDate=" + encodeURIComponent($_get('rtnDate'));
		    }

                        /*$_get('mdf_depart')*/
                         /*$_get('mdf_to')*/
			tb_show('FLIGHT SEARCH','/standalone/bookings/?day=' + (DateParts[2] - 1) + '&yearmonth=' + DateParts[0] + '%2F' + DateParts[1] + rtnDate + '&CityFrom='+'&CityTo='+'&TravelClass=ECONOMY&AirlinePref=0&TripType=Return&NumAdult=2&NumChild=0&NumInfant=0&lockallfieldsexceptreturnandorigin=true&showtips=true&KeepThis=true&TB_iframe=true&height=250&width=500');
		    }, 500);
            }
            
			
			// subscribe box function
			$("#webjetMail input.field-subscribe").focus( function() {
				if ( this.value == "Enter your email address" || true ) {
						this.value = "";	
				}
			});
			
			// location validator for booking form
			if ( $("form.validate_flight_search") )
			{
				
				tmp_CityFrom = $_get("CityFrom");
				if ( tmp_CityFrom.length > 0 )
				{
                    // Need to change if the name is Melbourne as the drop down lists it as Melbourne - All Airports
                    if( tmp_CityFrom == "Melbourne" )
                    {
                        tmp_CityFrom = "Melbourne - All Airports";
                    }
					$("#CityFrom").val( tmp_CityFrom );
                    $("#CityFrom2 option[value='" + tmp_CityFrom + "']").attr( 'selected', 'selected' );
					$("#CityFrom2 option:contains('" + tmp_CityFrom + "')").attr( 'selected', 'selected' );
				}
				
				tmp_CityTo = $_get("CityTo");
				if ( tmp_CityTo.length > 0 )
				{
                    if ( tmp_CityTo.indexOf(',') > 0 )
                    {
                        $( '#CityTo, #CityTo2' ).each( function(){
                            var this_id = $(this).attr('id');
                            $( this ).replaceWith( '<select name="CityTo" id="' + this_id + '"><option value="">Select:</option></select>');
                            $.each( $_get("CityTo").split(','), function(){
                                  $( '#' + this_id ).append( '<option value="' + this + '">' + this + '</option>');
                            });
                            $( '#' + this_id + ' option:first' ).attr('selected','selected');
                        })
                    }
                    else
                    {
    					$("#CityTo").val( tmp_CityTo );
    					$("#CityTo2").val( tmp_CityTo );
                    }
				}

  
				
		$("form.validate_flight_search, form.validate_flight_search_test").submit( function( event ){
		
		
		var AUCITIES = "|ABX|Albury|ABX|Wodonga|ABX|Albury|ADL|Adelaide|ARM|Armidale|ASP|Alice Springs|AVV|Avalon|AYQ|Uluru|AYQ|Ayers Rock|BCI|Barcaldine|BDB|Bundaberg|BHQ|Broken Hill|BLT|Blackwater|BNE|Brisbane|BNK|Ballina|BNK|Byron|BNK|Byron Bay|BRK|Bourke|BWT|Burnie|CBR|Canberra|CCK|Cocos Island|CED|Ceduna|CFS|Coffs Coast|CNS|Cairns|CNS|Port Douglas|CPD|Coober Pedy|CTL|Charleville|CVQ|Carnarvon|DBO|Dubbo|DGE|Mudgee|DPO|Devonport|DRW|Darwin|EMD|Emerald|EXM|Exmouth Gulf|EXM|Exmouth|GET|Geraldton|GFF|Griffith|GFN|Grafton|GLT|Gladstone|GOV|Nhulunbuy|GTE|Groote|HBA|Hobart|HID|Horn Island|HTI|Hamilton Island|HVB|Fraser Coast|HVB|Hervey Bay|ISA|Mount Isa|IVR|Inverell|KGC|Kingscote|KGI|Kalgoorlie|KNS|King Island|KNX|Kununurra|KTA|Karratha|LDH|Lord Howe Island|LEA|Learmonth|LER|Leinster|LNO|Leonora|LRE|Longreach|LST|Launceston|LSY|Lismore|LVO|Laverton|MBH|Maryborough|MCY|Maroochydore|MCY|Noosa|MCY|Sunshine Coast|MEL|Melbourne|MGB|Mount Gambier|MGB|Mt Gambier|MIM|Merimbula|MKR|Meekathara|MKY|Mackay|MMG|Mount Magnet|MMG|Mt Magnet|MOV|Moranbah|MQL|Mildura|MRZ|Moree|MYA|Moruya|NAA|Narrabri|NLK|Norfolk Island|NRA|Narrandera|OAG|Orange|OLP|Olympic Dam|OLP|Roxby Downs|OOL|Gold Coast|PBO|Paraburdoo|PER|Perth|PHE|Port Hedland|PKE|Parkes|PLO|Port Lincoln|PPP|Airlie Beach|PPP|Proserpine|PPP|Whitsunday Coast|PQQ|Port Macquarie|PUG|Port Augusta|RMA|Roma|ROK|Rockhampton|SYD|Sydney|TMW|Tamworth|TRO|Taree|TSV|Townsville|TWB|Toowoomba|ULP|Quilpie|WAY|Whyalla|WEI|Weipa|WGA|Wagga Wagga|WNR|Windorah|WOL|Wollongong|XCH|Christmas Island|ZBL|Biloela|ZBL|Thangool|ZNE|Newman|";
		var NZCITIES = "|AKL|Auckland|CHC|Christchurch|DUD|Dunedin|ZQN|Queenstown|WLG|Wellington|NPE|Napier|NPE|Hastings|GIS|Gisborne|INV|Invercargill|NPL|New Plymouth|PMR|Palmerston North|ROT|Rotorua|BHE|Blenheim|TRG|Tauranga|KKE|Kerikeri|TUO|Taupo|WAG|Wanganui|WRE|Whangarei|WHK|Whakatane|";
		var fromCityToCheck = $("input[name=txtDepCity1]", this).val();
		
		var isES = false;
		
		if($("input[name=isES]", this).val())
		{
			isES = true;	
		}
		
		if(_isNZAU)
		{
			if(AUCITIES.toLowerCase().indexOf("|" + fromCityToCheck.toLowerCase() + "|") != -1)
			{
				alert("You are on the Webjet North America website.\nFor travel originating in Australia visit Webjet.com.au");
				return false;
			}
			if(NZCITIES.toLowerCase().indexOf("|" + fromCityToCheck.toLowerCase() + "|") != -1)
			{
				alert("You are on the Webjet North America website.\nFor travel originating in New Zealand visit Webjet.co.nz");
				return false;
			}
		}
                    
                  // this is a bug fix for a weird issue where as space is added to the option value
                  $("select[name=CityFrom] option").each(function(){
                     $(this).val($.trim($(this).val())); 
                  });
				
                
				  // check that the from date is before the to date                  
                  var objDateOut = new Date();
                  var dateOutParts = $('input[name=txtdate1]', this).val().split('/');
                  objDateOut.setFullYear(dateOutParts[0],(parseInt(dateOutParts[1]) - 1),dateOutParts[2]);
                  
                  var objDateBack = new Date();
                  var dateBackParts = $('input[name=txtdate2]', this).val().split('/');
                  objDateBack.setFullYear(dateBackParts[0],(parseInt(dateBackParts[1]) - 1),dateBackParts[2]);
                  
                  $("#txtArrCity2").val($("#CityFrom").val());
                  $("#txtDepCity2").val($("#CityTo").val());
                  
                  if($("#CityFrom_hidden"))
                  {
                      if($("#CityFrom_hidden").val() != ''){
                  	$("#txtArrCity2").val($("#CityFrom_hidden").val());
                  	$("#txtDepCity2").val($("#CityTo_hidden").val());                          
                      }else{
                	$("#txtDepCity2").val($("#CityTo").val());
                  	$("#CityFrom_hidden").val($("#CityFrom").val());                              
                      }

                  }
                  
                  if($("#CityFrom_hidden").val() != ''){
                        $("#CityTo_hidden").val($("#CityTo").val());
                        //$("#txtArrCity2").val($("#CityFrom").val());
                     
                  }else{
                      
                  }
                  
 
                  if ( $("input[name=txtDepCity1]", this).val() == "" ) {
                        if(isES)
                                alert( "Por Favor escoja la ciudad de 'Origen'");
                        else
                                alert( "Please select a 'from' city");
                        $("select[name=txtDepCity1]", this).focus();
                        return false;
                  }
				  
                  if ( $("*[name=txtArrCity1]", this).val() == "" ) {
                        if(isES)
                                alert( "Por Favor escoja la ciudad de 'Destino'");
                        else
                                alert( "Please select a 'to' city");
                        $("input[name=txtArrCity1]", this).focus();
                        return false;
                  } 
 
 
                  if(objDateOut>objDateBack)
                  {
                  	if($("input[name=TripType]:checked").val() == '')
                  	{
                      		alert('Return date must be on or after departure date.');
                      		$('input[id^="return"]', this).focus();
				      return false;
			}
  }


				});
                
			}
			
			// open and close controls for online answers standalone menu
			$( "ul.animated_menu a" ).each( function() {
				if ( $(this).attr("href") == "#" )
				{
					$(this).click( function( event ) {
						event.preventDefault();
						var expand = true;
						if ( $(this).is('a.selected') )
						{
							expand = false;
						}
						$( "ul.animated_menu ul" ).hide("slow");
						$( "ul.animated_menu li a" ).removeClass("selected");
						if ( expand )
						{
							$(this).addClass("selected");
							$( "ul", $(this).parent() ).show("slow");
						}
						
					});
				}
				else if ( $(this).attr("class") == "popup" )
				{
					$(this).click( function( event ) {
						event.preventDefault();
						window.open($(this).attr("href"),'','top=100,left=100,height=630,width=540,l,menubar=no,toolbar=no,scrollbars=yes');
					});
				}
			});
            
            // style hacks for unsupported css selectors
            //$('#content .mod_tellafriend:first-child').css({ marginTop: '40px', marginRight: '20px'});
            
            // global google maps code
            // load google map if the container named "google-map" exists
            if ( $( "#google-map-global" ).attr("title") ) {
              
              var map = new GMap2( document.getElementById( "google-map-global" ) );
              map.setCenter( new GLatLng( -33.86950, 151.211399695135), 12 );
              map.addControl(new GLargeMapControl());
              map.addControl(new GOverviewMapControl());
              map.addControl(new GMapTypeControl());
              
              if( $( "#google-map-global" ).attr("title") )
              {
               geocoder = new GClientGeocoder();
               geocoder.getLatLng(  $( "#google-map-global" ).attr("title"), function( point ) { map.setCenter(point); }); 
              }
            }
            
            // behaviors for packages grid tables
            $( '#content table.hpg tr:last' )
                .addClass( 'last' );
                
            $( '#content table.hpg tr' )
                .css({
                    cursor: 'pointer'
                })
                .click( function(){
                    tb_show( $( 'a', this ).attr( 'title' ), $( 'a', this ).attr( 'href' ) );
                })
                .find( 'td:last' )
                .addClass( 'last' )
                .end()
                .find( 'td.hpg_price' )
                .hover( 
                    function(){ 
                    
                        $( this ).addClass( 'hover' );
                            
                        if( $(this).hasClass( 'hotel1' ) )
                        {
                            $( '#hpg_hotel_1').addClass( 'hover' );
                            $( '#content .hpg_price.hotel1' ).addClass( 'hoversibling' );
                        }
                        else
                        {
                            $( '#hpg_hotel_2').addClass( 'hover' );
                            $( '#content .hpg_price.hotel2' ).addClass( 'hoversibling' );
                        }
                        
                    },
                    function(){ 
                    
                        $( this ).removeClass( 'hover' );
                            
                        if( $(this).hasClass( 'hotel1' ) )
                        {
                            $( '#hpg_hotel_1').removeClass( 'hover' );
                            $( '#content .hpg_price.hotel1' ).removeClass( 'hoversibling' );
                        }
                        else
                        {
                            $( '#hpg_hotel_2').removeClass( 'hover' );
                            $( '#content .hpg_price.hotel2' ).removeClass( 'hoversibling' );
                        }
                        
                    }
                );
	$("#webjetLanguagePicker").msDropDown();
});


function resetTimeout() {

}

function $_get( key ) {
	var sReturn = "";
	q_string = location.search.substring( 1 ).split( "&" );
	q_array = new Array();
   for( i=0; i < q_string.length; i++ ) {
	  pair = q_string[ i ].split( "=" );
	  if ( key == pair[ 0 ].toString() )
			sReturn = unescape( pair[ 1 ] ).toString();
   } 	
   return sReturn;
}

function winPop( url, width, height, scrollable, left, top) {
	
		if ( scrollable && ( scrollable == 1 || scrollable == "true" ) )	
				scrollit = 1;
		else		
				scrollit = 0;
				
		if ( !width ) {
				width = 350;
		}
		
		if ( !height ) {
				height = 250;
		}
		
		if ( !left ) {
				left = 20;
		}
		
		if ( !top ) {
				top = 20;
		}
	
		window.open(url, 'pop', 'toolbar=0,resizable=1,scrollbars=' + scrollit + ',left=' + left + ',top=' + top + ',width=' + width + ',height=' + height);
	
}

/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-07-11 23:15:17 -0500 (Wed, 11 Jul 2007) $
 * $Rev: 2324 $
 *
 * Version 2.1
 */
// (function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0) this.insertBefore(document.createElement('html'),this.firstChild);});}return this;};})(jQuery);


/*
 * Superfish v1.3.4 - jQuery menu widget
 *
 * Copyright (c) 2007 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 */

(function($){
	$.fn.superfish = function(o){
		var $sf = this,
			defaults = {
			hoverClass	: 'sfHover',
			pathClass	: 'overideThisToUse',
			delay		: 800,
            showdelay		: 500,
			animation	: {opacity:'show'},
			speed		: 'normal',
			onshow		: function(){} // in your function, 'this' is the revealed ul
		},
			over = function(){
				//alert( $('a', this).attr("href").indexOf("/about/media/") );
				link_url = $('a', this).attr("href");
				if ( link_url &&  link_url.indexOf("/about/media/") != 0 ) // exclude the media submenu because it is far too long
				{
				clearTimeout(this.sfTimer);
                var $$ = $(this);
                this.sfTimer=setTimeout(function(){
    				$$.showSuperfishUl(o)
    				.siblings()
    				.hideSuperfishUl(o)
                    .parents().eq(1).addClass("forced-hover");
                    if($.browser.msie&&/6.0/.test(navigator.userAgent))
                        $('#content select, #content input').css('visibility','hidden');
					},o.showdelay);
				}
			},
			out = function(){
                clearTimeout(this.sfTimer);
				var $$ = $(this);
				if ( !$$.is('.'+o.bcClass) ) {
					this.sfTimer=setTimeout(function(){
						$$.hideSuperfishUl(o);
						var sf = $$.parents('ul.superfish:first')[0];
						if (!$('.'+o.hoverClass,sf).length) {
							over.call(sf.o.$currents.hideSuperfishUl(o));
                            if($.browser.msie&&/6.0/.test(navigator.userAgent))
                                $('#content select, #content input').css('visibility','visible');
						}
					},o.delay);
				}	
			};
		$.fn.extend({
			hideSuperfishUl : function(o){                
                $('li.'+o.hoverClass,this)
				.andSelf()
                    .removeClass("forced-hover")
					.removeClass(o.hoverClass)
					.find('>ul')
						.hide()
						.css('visibility','hidden');
				return this;
			},
			showSuperfishUl : function(o){
				return this
					.addClass(o.hoverClass)
					.find('>ul:hidden')
						.css('visibility','visible')
						.animate(o.animation,o.speed,function(){
							o.onshow.call(this);
						})
					.end();
			},
			applySuperfishHovers : function(){
				return this[($.fn.hoverIntent) ? 'hoverIntent' : 'hover'](over,out);
			}
		});
		
		return this
		.addClass('superfish')
		.each(function(){
			o = $.extend({bcClass:'sfbreadcrumb'},defaults,o);
			o = $.extend(o,{$currents:$('li.'+o.pathClass,this)});
			this.o = o;
			
			if (o.$currents.length) {
				o.$currents.each(function(){
					$(this)
					.addClass(o.hoverClass+' '+o.bcClass)
					.filter(':has(ul)')
						.removeClass(o.pathClass);
				});
			}
			
			var $sfHovAr=$('li',this)
				.applySuperfishHovers(over,out)
				.not('.'+o.bcClass)
					.hideSuperfishUl(o)
				.end();
			
			$('a',this).each(function(){
				var $a = $(this), $li = $a.parents('li');
				$a.focus(function(){
					over.call($li);
					return false;
				}).blur(function(){
					$li.removeClass(o.hoverClass);
				});
			});
		});
	};
	$(window).unload(function(){
		$('ul.superfish').each(function(){
			$('li:has(ul)',this).unbind('mouseover').unbind('mouseout');
			this.o = this.o.$currents = null; // clean up
		});
	});
})(jQuery);

/*
 * Thickbox 3 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
var _base = $( 'base' ).attr( 'href' );
var tb_pathToImage = ( _base ? _base : '' ) + "/lib/images/loadingAnimation.gif";
jQuery( 'head' ).append( '<link rel="stylesheet" href="' + ( _base ? _base : '' ) + '/lib/css/jquery/thickbox.css"></script>' ); 
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}));


function languagePick(vv)
{
	//alert("fine");
	if(vv == "en")
	{
		location = '/flights/';
	}
	else if(vv == "es")
	{
		location = '/vuelos/';
	}
}
