/** * -------------- * © 2008 - 2010 * ------- * THIS CODE IS NOT FREE, IT IS INTELLECTUAL PROPTERTY AND NOT! RELEASED INTO * THE PUBLIC DOMAIN. YOU MAY NOT COPY ANYTHING, NOT EVEN PARTS OF THIS FILE, WITHOUT PERMISSION. * ------- * Any intelligent fool can make things bigger, more complex, and more violent. * It takes a touch of genius -- and a lot of courage -- to move in the opposite direction * -------------- */ //document.write('
Loading...';
var h = $H({callsign: callsign, hex: hex.trim() });
var url = "./_json/planeInfoAndTrail_nocache.php?" + new Date().getTime();
genericJsonRetriever(url, parseplanedata, h, "");
// is ran when data is fetched
function parseplanedata(oReq){
var evaledJson = oReq.responseText.evalJSON(true);
var trailArr = evaledJson.t;
printLine2(trailArr.toArray());
var pdata = evaledJson.i;
// console.log(pdata);
// if(callsign == ""){
//onCloseInfoWin();
//}else{
// console.log(pdata.toArray());
printMenuPlaneKlicked2( pdata.toArray(), hex, callsign);
markMenuTab();
//}
}
/**
** internal func ***
* now using the array fetched together with traildata
* @param dataArr
* @return
*/
function printMenuPlaneKlicked2(dataArr, hex, callsign){
if(callsign=="00000000" || callsign == "" || callsign == "@@@@@@@@"){var callError = " (error)" ;}else{var callError = "";};
if(dataArr.length < 1 ){return false;};
clearInterval(clockinterval);
// var hex = dataArr[3];
// var callsign = dataArr[2];
// from the overlaytracker array
var mda = returnMarkerData(hex);
var rdr = mda[19];
var hdg = mda[20];
var lat = mda[21];
var lon = mda[22];
var spd = mda[23];
var kmph = Math.round((spd*1.852*1)/1);
var mph = Math.round(spd*1.15077945);
var spdx = spd + ' knots ' + airportFact + '
' + '' + airportFact + '
' + '
Loading...';
var page = "planeinfo2.php?id=" + Math.floor(Math.random()*5000+1) ;
new Ajax.Updater('rightcontentdivinnner', '_ajax/'+page, {
method:'GET',
parameters : {id : planeId, language : language}
});
}
/**
* same function as loadmenu() but for radars not hooked on id
*/
function loadMenuRadarClicked(name){
clearInterval(clockinterval);
$('rightcontentdivinnner').innerHTML = '
Loading...';
var page = "radarinfo.php";
new Ajax.Updater('rightcontentdivinnner', '_ajax/'+page, {
method:'GET',
parameters : {name : name }
});
}
function genericJsonRetriever(url, functionToProcess, hash, param2){
var evaledJson = "";
//if(idx=="" || filex==""){return false;};
//var url = "url";
new Ajax.Request(url, {
method: 'get',
requestHeaders: {Accept: 'application/json'},
parameters: hash,
onSuccess: functionToProcess,
onCreate: function(){},
onLoading: function(){},
onComplete: function(transport){},
onFailure: function() {
//alert('error!');
}//
});
}
/*
* @param id
* @return
*/
function markMenuTab(id){
//console.log("markMenuTab");
// remove all classnames
if($('menu0').hasClassName('active')){$('menu0').removeClassName('active');}
/* if($('menu1').hasClassName('active')){$('menu1').removeClassName('active');} */
if($('menu2').hasClassName('active')){$('menu2').removeClassName('active');}
if($('menu3').hasClassName('active')){$('menu3').removeClassName('active');}
if($('menu4').hasClassName('active')){$('menu4').removeClassName('active');}
if($('menu5').hasClassName('active')){$('menu5').removeClassName('active');}
if($('menu6').hasClassName('active')){$('menu6').removeClassName('active');}
if(id!=""){ // passsed no args, defocus menu
// add classname
if(id=="menu6" ){ $('menu6').removeClassName('yellowify'); $('menu6').addClassName('active'); }
$(id).addClassName("active");
}
}
/**
* on filtermenu click
* @param event
* @return
*/
function activateFilters(){
// remove active color on tab if so
if(gup('fa')=="1"){
$('menu6').style.backgroundColor = "";
$('menu6').style.color = "";
}
var CValAirports = (get_cookie('airports2') == "on" ) ? "checked" : "";
var CValCallsign = (get_cookie('callsign2') == "on" ) ? "checked" : "";
var CValWeather = (get_cookie('weatherlayer') == "on" ) ? "checked" : "";
var ps1="";var ps2="";var ps3="";
if( get_cookie('planesize') == "1" ){ ps1 = " checked "; }
if( get_cookie('planesize') == "0" ){ ps2 = " checked "; }
if( get_cookie('planesize') == "5" ){ ps3 = " checked "; }
if(ps1=="" && ps2=="" && ps3==""){ ps2 = " checked "; } ;
// filters Markup
var xhtml = 'Some adjustmends first, below several filters.
' + '' + '
Loading...';
// var code = "";
if(element.id != "menu0"){
new Ajax.Updater('rightcontentdivinnner', '_ajax/'+page, {
method:'get',
parameters : { language : language}
}
);
// fixes sorting of the list
if(element.id == "menu4"){
setTimeout(sortables_init,500)
}
clearInterval(clockinterval);
}else{ // firstpage
markMenuTab(element.id);
clearInterval(clockinterval);
addFistpageInfoToFirtstTab(); // adds divs to bee filled with times, amounts, etc...
showPresentPosition();
}
currentlyPlaneInfoShownInWinodowHex = ""; // if menu item clicked, potentially active planedata will be removed
}
/**
* returns bool
*/
function getRand (truePercentage){
truePercentage = truePercentage / 10;
if(Math.floor(Math.random()*11)<=truePercentage){
return true;
}else{
return false;
}
}
function addFistpageInfoToFirtstTab(){
clearInterval(clockinterval);
var charterbanner = '';
var flygresorbanner = '';
// randomize the swedish banner
if(getRand(50)){
var swedishBannerLink = charterbanner + flygresorbanner;
}else{
var swedishBannerLink = flygresorbanner + charterbanner;
}
// banner image
switch(countryCode){
case "sv" : var bannerImg = swedishBannerLink; break;
default : var bannerImg = '';
}
// introtext
var introtext = 'Flightradar24.com shows live airtraffic in the airspace above Europe.
Click here to get more information about how Flightradar24.com works and how to contribute.
Please visit our forum to ask questions and to get answers.
Download Flightradar24 to your iPhone or iPad in App Store
Flightradar24 Free or Flightradar24 Pro
Follow us on Twitter
Follow us on Facebook
'; $('rightcontentdivinnner').innerHTML = introtext + '' + '' + //'' + //'
'+lastUpdate+'
' + '' + ' Users online: ≈' + userCount + '
' + ' ' + WORD_search_flight_to + " " + airportName + ' ';
//airportFact = airportFact + '
' + WORD_search_flight_from + " " + airportName + " " + '
' + WORD_search_flight_to + " " + airportName + ' ';
airportFact = airportFact + '
' + WORD_search_flight_from + " " + airportName + " " + '
' + message + '
'; middle2("alertdiv"); Effect.Appear('alertdiv', { duration: 0.1 }); new Draggable('alertdiv', { }); // get enviroment params Event.observe('closebtn', 'click', function(event) { closeNiceAlertWin(); }); /* Event.observe(document, 'keypress', function(event){ if(event.keyCode == Event.KEY_TAB) { closeNiceAlertWin(); } }); */ } /** * closes the alertwindow * @return */ function closeNiceAlertWin(){ Effect.Fade('alertdiv', { duration: 0.2 }); } //--------- // //--------- function middle2(id){ // get enviroment params var vpHeight = document.viewport.getHeight(); var vpWidth = document.viewport.getWidth(); var alertWidth = $(id).getWidth(); var alertheight = $(id).getHeight(); // align correctly var lalign = ( (vpWidth/2)-(alertWidth/2) ) + document.viewport.getScrollOffsets().left + "px"; var talign = (vpHeight/2)-(alertheight/2) + document.viewport.getScrollOffsets().top + "px"; $(id).style.left = lalign; $(id).style.top = talign; } function chatWindowOpen(){ window.open("./chat/index.php", "Window1", "menubar=no,width=550,height=600,toolbar=no" ); }