/** console.log(t) **/ $(document).ready(function() { //default function $('#category_menu input#bCompany, #category_menu input#bs').removeAttr("value"); $('#category_menu input#bCompany').attr("value", "4"); $('#category_menu input#bs').attr("value", "6"); $('b.choose_category').html('Location categorys:'); $('#europe li').html('Europe'); $('#de li').html('Germany'); var actCountry = ''; var actCity = ''; var actCountry = 'global'; if(actCountry != "undefined" && actCountry != null && actCountry != '' && actCountry != 'global'){ if(actCountry == 'cn' || actCountry == 'us' || actCountry == 'tr'){ $("#map_standortmap area#"+actCountry).trigger('click'); getList(actCity, actCountry, '4,6'); getMouseleave(); getHover(); onclick(); }else{ onclick(); $("#map_menu a#europe").trigger('click'); getList(actCity, actCountry, '4,6'); getMouseleave(); getHover(); onclick(); $("#map_standortmap area#"+actCountry).trigger('click'); getList(actCity, actCountry, '4,6'); getMouseleave(); getHover(); onclick(); } $('#city option[value="'+actCity+'"]').attr('selected','selected'); $('#country option[value="'+actCountry+'"]').attr('selected','selected'); }else{ getList(0, 0, '4,6'); getMouseleave(); getHover(); onclick(); } }); ////////////////////////////////////////////// /*button - map menu - bildaustausch bei click */ function onclick() { $("#map_standortmap area, #map_menu ul a").unbind('click').bind("click", (function () { //$("#map_standortmap area, #map_menu ul a").click(function(){ var source = ($(this).attr('id')); if(source == 'us' || source == 'cn' || source == 'tr'){ var setActive = 'global'; }else if(source == 'uk' || source == 'es' || source == 'fr' || source == 'tr' || source == 'hun' || source == 'ro' || source == 'at'){ var setActive = 'europe'; }else{ var setActive = source } $('#map_menu ul a').removeClass("active"); $('#map_menu ul a#'+setActive+'').addClass("active"); ////////////////////////////////////////////// /*map europa*/ if(source == 'europe' || source == 'es' || source == 'fr' || source == 'uk' || source == 'hun' || source == 'ro' || source == 'at'){ $('#map_standortmap').empty(); $('#map_standortmap').append(' '); getHover(); getMouseleave(); onclick(); $('#markermap').empty(); $('.standort-list').empty(); $('#category_menu').css("display", "none"); $('#markermap').css("margin-left", "0px"); $('.map img').css("margin-left", "0px"); if ( !(source == 'europe') ){ var curESrc = ($('#standortmap').attr('src')); var n = curESrc.length-6; var curESrca = curESrc.substr(n); if(curESrca == "02.jpg"){ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+source+'02.jpg'); }else{ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_europe02.jpg'); }; getList(0, source, '4,6'); }else{ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_europe02.jpg'); getList(0, 0, '4,6'); } } ////////////////////////////////////////////// /*map global*/ if(source == 'global' || source == 'us' || source == 'cn' || source == 'tr'){ $('#map_standortmap').empty(); $('#map_standortmap').append(' '); $('#markermap').empty(); $('.standort-list').empty(); $('#markermap').css("margin-left", "0px"); $('#category_menu').css("display", "none"); $('.map img').css("margin-left", "0px"); getHover(); getMouseleave(); onclick(); if ( !(source == 'global') ){ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+source+'01.jpg'); getList(0, source, '4,6'); }else{ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap01.jpg'); getList(0, 0, '4,6'); } } ////////////////////////////////////////////// /*map deutschland*/ if(source == "de") { $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+source+'03.jpg'); /*categroy filter*/ countChecked(); $(":checkbox[@name=chooseCat]").click(countChecked); /*map area ausblenden*/ $('#map_standortmap').empty(); /*category menu einblenden*/ $('#category_menu').css("display", "block"); /*german map nach links verschieben*/ if ( !($.browser.msie && $.browser.version == 7.0) ){ $('#markermap').css("margin-left", "80px"); } //$('.map img').css("margin-left", "80px"); } })); }; ////////////////////////////////////////////// /*ausgew�hlte category filtern*/ function countChecked() { var elements = $('input:checkbox[@name=chooseCat]:checked'); var curCategory = ''; $.each(elements, function(index, item) { curCategory += $(this).val()+','; }); curCategory = curCategory.substr(0, curCategory.length -1); if(curCategory.length > 0){ //ist bereits stadt & land gew�hlt? var curCity = ($('select#city option:checked').attr('value')); if(curCity > '' ){ getList(curCity, 'de', curCategory); }else{ getList(0, 'de', curCategory); } get(curCategory); }else{ alert('Bitte waehlen Sie eine Kategroie!'); } } ////////////////////////////////////////////// /*get hover*/ function getHover() { /*map - bildaustausch bei hover */ $('#map_standortmap area').mouseenter("click", (function () { var source = ($(this).attr('id')); var curESrc = ($('#standortmap').attr('src')); var n = curESrc.length-6; var curESrca = curESrc.substr(n); if(curESrca == "01.jpg"){$('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+source+'01.jpg');}; if(curESrca == "02.jpg"){$('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+source+'02.jpg');}; })); } ////////////////////////////////////////////// /*get hover*/ function getMouseleave() { /*map - bildaustausch bei mouseleave,nur auf der world-view */ $('#map_standortmap area').unbind('mouseleave').bind('mouseleave', (function() { var curSrc = ($('#standortmap').attr('src')); var curClass = ($('#standortmap').attr('class')); var curSrca = curSrc.substr(-6); var n = curSrca.length-6; var curSrca = curSrca.substr(n); var curCountry = ($('select#country_new option:checked').attr('value')); if(!(curCountry) ){ if(curSrca == '01.jpg'){$('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap01.jpg');}; if(curSrca == "02.jpg"){$('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_europe02.jpg');}; }else{ if(curCountry == 'us' || curCountry == 'cn' || curCountry == 'tr' ){ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+curCountry+'01.jpg'); }else{ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+curCountry+'02.jpg'); } } })) } ////////////////////////////////////////////// /*map anzeigen*/ function get(categroy) { var eLink = '&L=1&category='+categroy; $('#markermap img').remove(); /*geocord aus db holen*/ $.getJSON('?eID=locationfinder'+eLink, function(data) { $.each(data, function(key, val) { var t = getGeoCoords(val.lat, val.long, val.id); var curCountry = val.country; var category = val.category; var category = category.replace(' ',''); if(curCountry == 'de'){ var elements = $('input:checkbox[@name=chooseCat]:checked'); var curCategory = ''; $.each(elements, function(index, item) { curCategory += $(this).val()+','; }); curCategory = curCategory.substr(0, curCategory.length -1); if(curCategory == '4'){ if(category == '4' || category == '4,6' || category == '4,8'){ $('#markermap').append(''); } } if(curCategory == '6'){ if(category == '6' || category == '4,6' || category == '6,8'){ $('#markermap').append(''); } } if(curCategory == '4,6'){ if(category == '4' || category == '4,8'){ $('#markermap').append(''); } if(category == '4,6' || category == '4,6,8'){ $('#markermap').append(''); } if(category == '6' || category == '6,8'){ $('#markermap').append(''); } } /*liste anzeigen*/ $('.standortlist').css("display", "block"); $('#markermap img').unbind().bind({ mouseenter: function() { var curClass = ($(this).attr('class')); var exploded = curClass.split(';'); var curLeft = ($(this).css('left')); var curTop = ($(this).css('top')); var curLinkID = ($(this).attr('id')); $(this).addClass('activeDialog'); if(curCategory == '4'){ if(exploded[2] == '4' || exploded[2] == '4,6' || exploded[2] == '4,8'){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/markerDialog_blue.png'); } } if(curCategory == '6'){ if(exploded[2] == '4' || exploded[2] == '4,6' || exploded[2] == '6,8'){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/markerDialog_green.png'); } } if(curCategory == '4,6'){ if(exploded[2] == '4' || exploded[2] == '4,8'){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/markerDialog_blue.png'); } if(exploded[2] == '4,6' || exploded[2] == '4,6,8'){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/markerDialog_bluegreen.png'); } if(exploded[2] == '6' || exploded[2] == '6,8'){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/markerDialog_green.png'); } } var exploded = curClass.split(';'); $('#markermap').append(''+exploded[1]+''); var len = $('#markermap span').html().length; if(len > 16){ $('#markermap span').css("margin-top","2px"); }else{ $('#markermap span').css("margin-top","6px"); } }, mouseleave: function() { $(this).removeClass('activeDialog'); var curClass = ($(this).attr('class')); var exploded = curClass.split(';'); $('#markermap span').remove(); if(curCategory == '4'){ if(exploded[2] == '4' || exploded[2] == '4,6' || exploded[2] == '4,8'){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/marker_blue.png'); } } if(curCategory == '6'){ if(exploded[2] == '6' || exploded[2] == '4,6' || exploded[2] == '6,8'){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/marker_green.png'); } } if(curCategory == '4,6'){ if(exploded[2] == '4' || exploded[2] == '4,8'){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/marker_blue.png'); } if(exploded[2] == '4,6' || exploded[2] == '4,6,8'){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/marker_bluegreen.png'); } if(exploded[2] == '6' || exploded[2] == '6,8' ){ $(this).attr('src','typo3conf/ext/rsn_standortmap/res/marker_green.png'); } } $(this).css({'margin-top' : '0px', 'margin-left':'0px'}) }, click: function() { var curClass = ($(this).attr('class')); var exploded = curClass.split(';'); getList(exploded[0], 'de', curCategory); } }); }; }); }); var source = ($('#map_standortmap area').attr('id')); if(source == 'de'){}else{$('#markermap').empty();}; }; ////////////////////////////////////////////// //visitenkarten - liste function getList(selectedCity, selectedCountry, categroy) { if(selectedCity == 0){ var eLink = '&category='+categroy+'&country='+selectedCountry+'&L=1'; }else{ var eLink = '&country='+selectedCountry+'&city='+selectedCity+'&category='+categroy+'&L=1'; } //standort-liste aus db $.post('?eID=locationlist'+eLink, function(data) { $('.location-finder-items').empty(); $('.location-finder-items').append('

Bertrandt worldwide

'+data); onchange(categroy, selectedCountry) }); }; ////////////////////////////////////////////// /*onchange*/ function onchange(categroy, selectedCountry) { //map neu laden bei 'st�dteauswahl' $('#city').change(function(){ selectedCity = $(this).attr('value'); if(selectedCountry == 0){ getList(selectedCity, 'de', categroy); }else{ getList(selectedCity, selectedCountry, categroy); } }); //map neu laden bei 'l�nderauswahl' $('#country_new').change(function(){ selectedCountry = $(this).attr('value'); if(selectedCountry == 'us' || selectedCountry == 'gloabl' || selectedCountry == 'cn' || selectedCountry == 'tr' ){ curCountry = 'global'; }else if(selectedCountry == 'de'){ curCountry = 'de'; }else{ curCountry = 'europe'; } onclick(); $("#map_menu ul a#"+curCountry).trigger('click'); var curSrc = ($('#standortmap').attr('src')); var curClass = ($('#standortmap').attr('class')); var curSrca = curSrc.substr(-6); var n = curSrca.length-6; var curSrca = curSrca.substr(n); var curCountry = ($('select#country_new option:checked').attr('value')); if(!(curCountry) ){ if(curSrca == '01.jpg'){$('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap01.jpg');}; if(curSrca == "02.jpg"){$('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_europe02.jpg');}; }else{ if(curCountry == 'us' || curCountry == 'cn' || curCountry == 'tr'){ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+curCountry+'01.jpg'); }else if(curCountry == 'de'){ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+curCountry+'03.jpg'); }else{ $('#standortmap').attr('src','typo3conf/ext/rsn_standortmap/res/standortmap_'+curCountry+'02.jpg'); } } getMouseleave(); getHover(); getList(0, selectedCountry, categroy); }); }; ////////////////////////////////////////////// /*geocords umrechnen*/ function geo() { this.x = 0; this.y = 0; } geo.prototype.init = function() {}; function getGeoCoords(lat,lng) { //Kartenausschnitt (Deutschland) var latPos0 = 54.701882; var latPos1 = 47.061601; var lngPos0 = 5.833741; var lngPos1 = 14.937993; var lngRange = Math.abs(lngPos0 - lngPos1); //Mercator-Projektion var phi = lat * Math.PI / 180; var MercY = Math.log(Math.tan(Math.PI/4 + phi/2)); var phi0 = latPos1 * Math.PI / 180; var MercY0 = Math.log(Math.tan(Math.PI/4 + phi0/2)); var phi1 = latPos0 * Math.PI / 180; var MercY1 = Math.log(Math.tan(Math.PI/4 + phi1/2)); //Umrechnung auf Kartengr��e var xPos = (lng - lngPos0) * (261 / lngRange); var yPos = (1 - (MercY - MercY0)/(MercY1 - MercY0)) * 354; var geodata = new geo(); geodata.x = Math.round(xPos-10);//-130; geodata.y = Math.round(yPos-10);//-166; //console.log(geodata.x + " "+ geodata.y); //console.log("-------------------------"); return geodata; }