// JavaScript Document
var count=0;
var count2=0;
var maxImages=0;
var view="more";
var viewclicks = 0;
var cp = 0;
var c = 0;
var totalPages = 0;
var data = Array();
var map = "";
var markers = [];
var infowindows = [];
var iterator = 0;
var tekst = $('.formcontact .column:eq(1)').find('label').text() + " *";

var all_dealers = [
	
	["300","CHRISTOPHE DONCKELS","West-Vlaanderen (West); Vlaams Brabant","","","+32 (0)475 64 01 55","","christophe@jolipa.com","","","50.811447","3.180735"],
	["301","TANGUY HEYTENS","West-Vlaanderen (Oost); Oost-Vlaanderen; Hainaut (Ouest)","","","+32 (0)477 42 58 01","","tanguy@jolipa.com","","","50.794692","3.197386"],
	["302","DIRK VAN DER ELST","Antwerpen; Limburg; Nederlands Limburg; Noord-Brabant","","","+32 (0)475 54 26 81","","dirk.vanderelst@jolipa.com","","","51.000805","4.635659"],
	["304","LUIGI CANI","Luik; Luxembourg; le Luxembourg","","","+32 (0)496 52 20 36","","luigi.cani@jolipa.com","","","49.903954","5.392146"],
	["305","LUIGI CANI","Luik; Luxembourg; le Luxembourg","","","+32 (0)496 52 20 36","","luigi.cani@jolipa.com","","","50.633335","5.566659"],
	["306","LUIGI CANI","Luik; Luxembourg; le Luxembourg","","","+32 (0)496 52 20 36","","luigi.cani@jolipa.com","","","49.611624","6.131934"],
	["307","OLIVIER MOUTUI","Bruxelles; Brabant Wallon; Hainaut (Est); Namur","","","+32 (0)496 97 51 46","/","olivier.moutui@jolipa.com","","","50.43353","4.608193"],
	["308","GREGORY DESCHAMPS","59, 62, 80","","","+33 (0)6 19 88 15 12","","gregory.deschamps@jolipa.com","","","50.385168","3.26424"],
	["309","GREGORY DESCHAMPS","59, 62, 80","","","+33 (0)6 19 88 15 12","","gregory.deschamps@jolipa.com","","","49.914551","2.270704"],
	["310","OLIVIER BOCHET","02, 08, 51, 60, 77, 93","","","+33 (0)6 67 86 12 34","","olivier.bochet@jolipa.com","","","49.476969","3.441735"],
	["311","OLIVIER BOCHET","02, 08, 51, 60, 77, 93","","","+33 (0)6 67 86 12 34","","olivier.bochet@jolipa.com","","","49.762521","4.628503"],
	["312","OLIVIER BOCHET","02, 08, 51, 60, 77, 93","","","+33 (0)6 67 86 12 34","","olivier.bochet@jolipa.com","","","49.128811","4.147553"],
	["313","OLIVIER BOCHET","02, 08, 51, 60, 77, 93","","","+33 (0)6 67 86 12 34","","olivier.bochet@jolipa.com","","","49.421499","2.414639"],
	["314","OLIVIER BOCHET","02, 08, 51, 60, 77, 93","","","+33 (0)6 67 86 12 34","","olivier.bochet@jolipa.com","","","48.841117","2.999358"],
	["315","OLIVIER BOCHET","02, 08, 51, 60, 77, 93","","","+33 (0)6 67 86 12 34","","olivier.bochet@jolipa.com","","","48.913796","2.484565"],
	["316","OLIVIER CROIZE","28, 41, 45, 78, 91","","","+33 (0)6 70 16 58 44","","olivier.croize@jolipa.com","","","47.291392","-0.487776"],
	["317","OLIVIER CROIZE","28, 41, 45, 78, 91","","","+33 (0)6 70 16 58 44","","olivier.croize@jolipa.com","","","47.676237","1.415914"],
	["318","OLIVIER CROIZE","28, 41, 45, 78, 91","","","+33 (0)6 70 16 58 44","","olivier.croize@jolipa.com","","","47.900815","2.201814"],
	["319","OLIVIER CROIZE","28, 41, 45, 78, 91","","","+33 (0)6 70 16 58 44","","olivier.croize@jolipa.com","","","48.785125","1.825659"],
	["320","OLIVIER CROIZE","28, 41, 45, 78, 91","","","+33 (0)6 70 16 58 44","","olivier.croize@jolipa.com","","","48.458612","2.156935"],
	["321","DANIEL SARAVIA","75, 92, 94, 95","","","+33 (0)6 14 22 72 72","","daniel.saravia@jolipa.com","","","48.856652","2.352219"],
	["322","DANIEL SARAVIA","75, 92, 94, 95","","","+33 (0)6 14 22 72 72","","daniel.saravia@jolipa.com","","","48.828548","2.218803"],
	["323","DANIEL SARAVIA","75, 92, 94, 95","","","+33 (0)6 14 22 72 72","","daniel.saravia@jolipa.com","","","48.793175","2.474037"],
	["324","DANIEL SARAVIA","75, 92, 94, 95","","","+33 (0)6 14 22 72 72","","daniel.saravia@jolipa.com","","","49.061632","2.158132"],
	["325","LAURENCE V WYNSBERGHE","14, 27, 50, 53, 61, 72, 76","","","+33 (0)6 71 00 92 82","","laurence@jolipa.com","","","49.121381","-0.433067"],
	["326","LAURENCE V WYNSBERGHE","14, 27, 50, 53, 61, 72, 76","","","+33 (0)6 71 00 92 82","","laurence@jolipa.com","","","49.118219","0.958208"],
	["327","LAURENCE V WYNSBERGHE","14, 27, 50, 53, 61, 72, 76","","","+33 (0)6 71 00 92 82","","laurence@jolipa.com","","","49.114761","-1.311606"],
	["328","LAURENCE V WYNSBERGHE","14, 27, 50, 53, 61, 72, 76","","","+33 (0)6 71 00 92 82","","laurence@jolipa.com","","","48.306166","-0.620937"],
	["329","LAURENCE V WYNSBERGHE","14, 27, 50, 53, 61, 72, 76","","","+33 (0)6 71 00 92 82","","laurence@jolipa.com","","","48.638905","0.084822"],
	["330","LAURENCE V WYNSBERGHE","14, 27, 50, 53, 61, 72, 76","","","+33 (0)6 71 00 92 82","","laurence@jolipa.com","","","47.921744","0.165578"],
	["331","LAURENCE V WYNSBERGHE","14, 27, 50, 53, 61, 72, 76","","","+33 (0)6 71 00 92 82","","laurence@jolipa.com","","","49.605459","0.974838"],
	["332","CHRISTOPHE ADAM","22, 29, 35, 44, 56","","","+33 (0)6 62 04 89 13","","christophe.adam@jolipa.com","","","48.510846","-3.326377"],
	["333","CHRISTOPHE ADAM","22, 29, 35, 44, 56","","","+33 (0)6 62 04 89 13","","christophe.adam@jolipa.com","","","48.252059","-3.930056"],
	["334","CHRISTOPHE ADAM","22, 29, 35, 44, 56","","","+33 (0)6 62 04 89 13","","christophe.adam@jolipa.com","","","48.229242","-1.53008"],
	["335","CHRISTOPHE ADAM","22, 29, 35, 44, 56","","","+33 (0)6 62 04 89 13","","christophe.adam@jolipa.com","","","47.278086","-1.815751"],
	["336","CHRISTOPHE ADAM","22, 29, 35, 44, 56","","","+33 (0)6 62 04 89 13","","christophe.adam@jolipa.com","","","47.885334","-2.900185"],
	["337","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","48.156379","4.37325"],
	["338","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","47.512719","4.635412"],
	["339","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","47.197032","6.3126"],
	["340","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","46.762511","5.672915"],
	["341","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","48.126135","5.107132"],
	["342","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","47.238216","3.529433"],
	["343","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","47.757021","6.155624"],
	["344","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","46.582805","4.486673"],
	["345","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","47.86533","3.607976"],
	["346","CORINNE DOUDOUX","10, 21, 25, 39, 52, 58, 70, 71, 89, 90","","","+33 (0)6 42 17 52 31","","corinne.doudoux@jolipa.com","","","47.594696","6.920767"],
	["347","CHRISTOPHE MELL","01, 38, 42, 69, 73, 74","","","+33 (0)6 68 32 57 87","","christophe.mell@jolipa.com","","","46.247623","5.13076"],
	["348","CHRISTOPHE MELL","01, 38, 42, 69, 73, 74","","","+33 (0)6 68 32 57 87","","christophe.mell@jolipa.com","","","44.995826","5.929344"],
	["349","CHRISTOPHE MELL","01, 38, 42, 69, 73, 74","","","+33 (0)6 68 32 57 87","","christophe.mell@jolipa.com","","","47.763339","-0.329958"],
	["350","CHRISTOPHE MELL","01, 38, 42, 69, 73, 74","","","+33 (0)6 68 32 57 87","","christophe.mell@jolipa.com","","","45.735186","4.610808"],
	["351","CHRISTOPHE MELL","01, 38, 42, 69, 73, 74","","","+33 (0)6 68 32 57 87","","christophe.mell@jolipa.com","","","45.493245","6.472398"],
	["352","CHRISTOPHE MELL","01, 38, 42, 69, 73, 74","","","+33 (0)6 68 32 57 87","","christophe.mell@jolipa.com","","","46.175732","6.538968"],
	["353","LAURENT MESSAGER","16, 17, 36, 37, 49, 79, 85, 86, 87 ","","","+33 (0)6 68 34 25 63","","laurent.messager@jolipa.com","","","45.752042","0.153473"],
	["354","LAURENT MESSAGER","16, 17, 36, 37, 49, 79, 85, 86, 87 ","","","+33 (0)6 68 34 25 63","","laurent.messager@jolipa.com","","","45.749543","-0.773319"],
	["355","LAURENT MESSAGER","16, 17, 36, 37, 49, 79, 85, 86, 87 ","","","+33 (0)6 68 34 25 63","","laurent.messager@jolipa.com","","","47.199492","-1.670003"],
	["356","LAURENT MESSAGER","16, 17, 36, 37, 49, 79, 85, 86, 87 ","","","+33 (0)6 68 34 25 63","","laurent.messager@jolipa.com","","","47.28954","0.816094"],
	["357","LAURENT MESSAGER","16, 17, 36, 37, 49, 79, 85, 86, 87 ","","","+33 (0)6 68 34 25 63","","laurent.messager@jolipa.com","","","47.291385","-0.487784"],
	["358","LAURENT MESSAGER","16, 17, 36, 37, 49, 79, 85, 86, 87 ","","","+33 (0)6 68 34 25 63","","laurent.messager@jolipa.com","","","46.592689","-0.396286"],
	["359","LAURENT MESSAGER","16, 17, 36, 37, 49, 79, 85, 86, 87 ","","","+33 (0)6 68 34 25 63","","laurent.messager@jolipa.com","","","46.661425","-1.44827"],
	["360","LAURENT MESSAGER","16, 17, 36, 37, 49, 79, 85, 86, 87 ","","","+33 (0)6 68 34 25 63","","laurent.messager@jolipa.com","","","45.525619","4.87434"],
	["361","LAURENT MESSAGER","16, 17, 36, 37, 49, 79, 85, 86, 87 ","","","+33 (0)6 68 34 25 63","","laurent.messager@jolipa.com","","","45.743554","1.402545"],
	["362","GAEL BARDINET","24, 32, 33, 40, 46, 47, 64, 65, 82","","","+33 (0)6 03 70 43 43 ","","gael.bardinet@jolipa.com","","","45.146996","0.757209"],
	["363","GAEL BARDINET","24, 32, 33, 40, 46, 47, 64, 65, 82","","","+33 (0)6 03 70 43 43 ","","gael.bardinet@jolipa.com","","","43.636706","0.45023"],
	["364","GAEL BARDINET","24, 32, 33, 40, 46, 47, 64, 65, 82","","","+33 (0)6 03 70 43 43 ","","gael.bardinet@jolipa.com","","","44.849699","-0.450241"],
	["365","GAEL BARDINET","24, 32, 33, 40, 46, 47, 64, 65, 82","","","+33 (0)6 03 70 43 43 ","","gael.bardinet@jolipa.com","","","43.941251","-0.753283"],
	["366","GAEL BARDINET","24, 32, 33, 40, 46, 47, 64, 65, 82","","","+33 (0)6 03 70 43 43 ","","gael.bardinet@jolipa.com","","","44.537973","1.676061"],
	["367","GAEL BARDINET","24, 32, 33, 40, 46, 47, 64, 65, 82","","","+33 (0)6 03 70 43 43 ","","gael.bardinet@jolipa.com","","","44.247101","0.45024"],
	["368","GAEL BARDINET","24, 32, 33, 40, 46, 47, 64, 65, 82","","","+33 (0)6 03 70 43 43 ","","gael.bardinet@jolipa.com","","","43.32702","-0.753283"],
	["369","GAEL BARDINET","24, 32, 33, 40, 46, 47, 64, 65, 82","","","+33 (0)6 03 70 43 43 ","","gael.bardinet@jolipa.com","","","43.019425","0.149503"],
	["370","GAEL BARDINET","24, 32, 33, 40, 46, 47, 64, 65, 82","","","+33 (0)6 03 70 43 43 ","","gael.bardinet@jolipa.com","","","44.247053","0.450235"],
	["371","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","44.759667","4.562445"],
	["372","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","42.932655","1.443468"],
	["373","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","43.072522","2.381353"],
	["374","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","44.218022","2.618919"],
	["375","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","43.944733","4.151375"],
	["376","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","43.401084","1.135298"],
	["377","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","43.591275","3.258369"],
	["378","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","44.494232","3.581272"],
	["379","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","42.601332","2.539604"],
	["380","EMMANUEL GILLIER","07, 09, 11, 12, 30, 31, 34, 48, 66, 81","","","+33 (0)6 01 78 07 51","","emmanuel.gillier@jolipa.com","","","43.926475","1.988155"],
	["381","ALAIN DENEVE","04, 05, 06, 13, 26, 83, 84","","","+33 (0)6 08 92 67 47","","alain.deneve@jolipa.com","","","44.077911","6.237595"],
	["382","ALAIN DENEVE","04, 05, 06, 13, 26, 83, 84","","","+33 (0)6 08 92 67 47","","alain.deneve@jolipa.com","","","44.600905","6.32261"],
	["383","ALAIN DENEVE","04, 05, 06, 13, 26, 83, 84","","","+33 (0)6 08 92 67 47","","alain.deneve@jolipa.com","","","43.946734","7.179023"],
	["384","ALAIN DENEVE","04, 05, 06, 13, 26, 83, 84","","","+33 (0)6 08 92 67 47","","alain.deneve@jolipa.com","","","43.591193","5.310253"],
	["385","ALAIN DENEVE","04, 05, 06, 13, 26, 83, 84","","","+33 (0)6 08 92 67 47","","alain.deneve@jolipa.com","","","44.731225","5.22667"],
	["386","ALAIN DENEVE","04, 05, 06, 13, 26, 83, 84","","","+33 (0)6 08 92 67 47","","alain.deneve@jolipa.com","","","43.467682","6.237592"],
	["387","ALAIN DENEVE","04, 05, 06, 13, 26, 83, 84","","","+33 (0)6 08 92 67 47","","alain.deneve@jolipa.com","","","44.056544","5.143202"],
	["388","DANIELLE DE KOEIJER","Zeeland; Utrecht; Zuid-Holland","","","+31 (0)6 12 40 20 13","","danielle.dekoeijer@jolipa.com","","","51.494073","3.849686"],
	["389","DANIELLE DE KOEIJER","Zeeland; Utrecht; Zuid-Holland","","","+31 (0)6 12 40 20 13","","danielle.dekoeijer@jolipa.com","","","52.090173","5.109669"],
	["390","DANIELLE DE KOEIJER","Zeeland; Utrecht; Zuid-Holland","","","+31 (0)6 12 40 20 13","","danielle.dekoeijer@jolipa.com","","","52.020831","4.493783"],
	["391","DIRK VAN DER ELST","Antwerpen; Limburg; Nederlands Limburg; Noord-Brabant","","","+32 (0)475 54 26 81","","dirk.vanderelst@jolipa.com","","","51.219952","4.396253"],
	["392","DIRK VAN DER ELST","Antwerpen; Limburg; Nederlands Limburg; Noord-Brabant","","","+32 (0)475 54 26 81","","dirk.vanderelst@jolipa.com","","","51.442764","6.060872"],
	["393","DIRK VAN DER ELST","Antwerpen; Limburg; Nederlands Limburg; Noord-Brabant","","","+32 (0)475 54 26 81","","dirk.vanderelst@jolipa.com","","","51.482684","5.232166"],
	["394","UWE NOACK","D01, D02, D04, D05, D06, D07, D08, D09, D98, D99","","","+49 (0)172 39 57 500","","uwe.noack@jolipa.com","","","50.714654","12.496891"],
	["454","UWE NOACK","D01, D02, D04, D05, D06, D07, D08, D09, D98, D99","","","+49 (0)172 39 57 500","","uwe.noack@jolipa.com","","","50.88041","12.081216"],
	["455","UWE NOACK","D01, D02, D04, D05, D06, D07, D08, D09, D98, D99","","","+49 (0)172 39 57 500","","uwe.noack@jolipa.com","","","51.051018","13.733629"],
	["456","UWE NOACK","D01, D02, D04, D05, D06, D07, D08, D09, D98, D99","","","+49 (0)172 39 57 500","","uwe.noack@jolipa.com","","","50.832544","12.924693"],
	["457","UWE NOACK","D01, D02, D04, D05, D06, D07, D08, D09, D98, D99","","","+49 (0)172 39 57 500","","uwe.noack@jolipa.com","","","51.339711","12.371369"],
	["458","UWE NOACK","D01, D02, D04, D05, D06, D07, D08, D09, D98, D99","","","+49 (0)172 39 57 500","","uwe.noack@jolipa.com","","","51.482195","11.965817"],
	["460","RÜDIGER SCHIERHORN","D03, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D39","","","+49 (0)171 79 53 157","","ruediger.schierhorn@jolipa.com","","","51.76077","14.327491"],
	["461","RÜDIGER SCHIERHORN","D03, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D39","","","+49 (0)171 79 53 157","","ruediger.schierhorn@jolipa.com","","","51.838925","12.245163"],
	["462","RÜDIGER SCHIERHORN","D03, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D39","","","+49 (0)171 79 53 157","","ruediger.schierhorn@jolipa.com","","","52.131106","11.636576"],
	["463","RÜDIGER SCHIERHORN","D03, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D39","","","+49 (0)171 79 53 157","","ruediger.schierhorn@jolipa.com","","","52.396891","13.058479"],
	["464","RÜDIGER SCHIERHORN","D03, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D39","","","+49 (0)171 79 53 157","","ruediger.schierhorn@jolipa.com","","","52.523441","13.411401"],
	["465","RÜDIGER SCHIERHORN","D03, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D39","","","+49 (0)171 79 53 157","","ruediger.schierhorn@jolipa.com","","","53.558081","13.261222"],
	["466","RÜDIGER SCHIERHORN","D03, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D39","","","+49 (0)171 79 53 157","","ruediger.schierhorn@jolipa.com","","","54.314017","13.085795"],
	["467","RÜDIGER SCHIERHORN","D03, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D39","","","+49 (0)171 79 53 157","","ruediger.schierhorn@jolipa.com","","","53.625775","11.416892"],
	["468","RÜDIGER SCHIERHORN","D03, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D39","","","+49 (0)171 79 53 157","","ruediger.schierhorn@jolipa.com","","","54.090263","12.132932"],
	["396","PETER WINCKWORTH","Ireland; Northern Ireland","","","+353 (0)87 1222 172","","peter.winckworth@jolipa.com","","","53.344127","-6.267494"],
	["397","PETER WINCKWORTH","Ireland; Northern Ireland","","","+353 (0)87 1222 172","","peter.winckworth@jolipa.com","","","54.597299","-5.930112"],
	["398","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","41.890556","12.494252"],
	["399","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","45.463714","9.188169"],
	["400","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","40.840137","14.251636"],
	["401","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","45.070594","7.686621"],
	["402","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","38.11567","13.361402"],
	["403","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","44.407092","8.933987"],
	["404","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","43.76876","11.256901"],
	["405","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","44.494223","11.346519"],
	["406","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","41.126035","16.868372"],
	["407","TRADE AGENCY","Italia","","","+39 0422 546046","","info@trade-agency.it","","","37.502506","15.087828"],
	["408","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","40.416729","-3.700349"],
	["409","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","41.387956","2.169912"],
	["410","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","39.470272","-0.376805"],
	["411","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","37.382679","-5.996293"],
	["412","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","41.656323","-0.876544"],
	["413","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","36.719685","-4.420015"],
	["414","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","37.983475","-1.129897"],
	["415","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","38.706959","-9.135628"],
	["416","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","41.149997","-8.610243"],
	["417","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","38.762322","-9.23991"],
	["418","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","41.551796","-8.422901"],
	["419","HUCCO","España; Portugal","","","+34 949 207 225","","info@hucco.es","","","40.211527","-8.429199"],
	["420","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","59.913893","10.752246"],
	["421","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","60.391288","5.322057"],
	["422","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","63.43053","10.395059"],
	["423","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","58.969997","5.733101"],
	["424","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","59.744096","10.204458"],
	["425","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","59.220565","10.934703"],
	["426","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","58.150961","7.996193"],
	["427","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","58.853476","5.731674"],
	["428","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","59.332821","18.06449"],
	["429","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","57.697024","11.986502"],
	["430","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","55.60336","13.001308"],
	["431","HERREGARD","Norge; Sverige","","","+47 33 18 39 80","","info@herregard.no","","","59.858162","17.644579"],
	["432","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-23.548893","-46.638817"],
	["433","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-22.903485","-43.209591"],
	["434","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-12.97033","-38.512381"],
	["435","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-19.919017","-43.938578"],
	["436","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-3.718341","-38.543392"],
	["437","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-15.78011","-47.929179"],
	["438","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-25.428322","-49.27325"],
	["439","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-3.106377","-60.026433"],
	["440","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-8.054216","-34.881252"],
	["441","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-30.02767","-51.228734"],
	["442","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-1.454985","-48.502362"],
	["443","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-16.677682","-49.267631"],
	["444","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-23.463404","-46.533452"],
	["445","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-22.907042","-47.063244"],
	["446","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-22.759707","-43.451559"],
	["447","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-22.827058","-43.054377"],
	["448","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-2.530683","-44.306824"],
	["449","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-9.666204","-35.735095"],
	["450","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-22.786791","-43.313103"],
	["451","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-5.79443","-35.210957"],
	["452","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-15.59887","-56.094891"],
	["453","HOME COLLECTION","Brasil","","","+55 11 2779-3321","","contato@homecollection.com.br","","","-20.443468","-54.647759"]
];

$(document).ready(function() {
	
	$('#show_text').hide();
	$('#hide_text').hide();
	
	if($('.block.fade.fast, .whiteblock').length>0){
		_test = setTimeout( function() {
			$('.block, .darkblock, .whiteblock, .lightblock').css({'display':'block'});
			$('.block, .darkblock, .whiteblock, .lightblock').animate({top:'0',opacity:1},1000, function() {
				$('#hide_text').show();
				$('.whiteblock .blockfoot h1, .blockfoot, .blocktop, .blockfoot2').css({'filter':'none', 'position':'relative'});
			});
			//$('.block, .darkblock').fadeTo('slow',1);
		}, 1500 );
	}
	
	if($('.block.fade.slow').length>0){
		_test = setTimeout( function() {
			$('.block, .darkblock, .whiteblock, .lightblock').css({'display':'block'});
			$('.block, .darkblock, .whiteblock, .lightblock').animate({top:'0',opacity:1},1000, function() {
				$('#hide_text').show();
				if($('.tooltip').length > 0){
					$('.tooltip').fadeTo(500,1);
					setTimeout(function() {
						$('.tooltip').fadeTo(500,0, function(){
							$('.tooltip').hide();
						});
					},4000);
				}
				$('.whiteblock .blockfoot h1, .blockfoot, .blocktop, .blockfoot2').css({'filter':'none', 'position':'relative'});
				//Cufon.replace('#menulist li,#menulist li a,.blockfoot h1, .buttonbody h1, .blockfoot2 h1', {hover:true});
			});
			//$('.block, .darkblock').fadeTo('slow',1);
		}, 3000 );
	}
	
	/* TOOLTIP */
	$('#arleft, #arright, #hide_text, #show_text, .folder, .case a, .press-folder a').tooltip({delay: 0, track: true, showURL: false, fade:100});
	
	/*$('.block.fade, .darkblock.fade, .whiteblock').hover(function(){
    	//$('.block').fadeTo('slow', 1);
		//$('.block').css('filter','');
		clearInterval(_test);
		if( $('.block').is(':animated') ) {}else{$('.block, .darkblock, .whiteblock').animate({top:'0',opacity:1},1000);}
	},function(){
		//alert("fadeout");
		//$('#col1').fadeTo('fast',0.1);
		_test = setInterval( function() {
			//$('.block, .darkblock').fadeTo('slow',0);
			$('.block, .darkblock, .whiteblock').animate({top:'-47px',opacity:0},1000);
		}, 2000 );
	});*/
	
	$('#hide_text').click(function() {
		$('.whiteblock .blockfoot h1, .blockfoot2, .blockfoot, .blocktop, .block .blocktop').css({'filter':'inherit', 'position':'static'});
		
		setTimeout(function() {
			clearInterval(_test);
			$('.block, .darkblock, .whiteblock, .lightblock').animate({top:'-47px',opacity:0},1000, function() {
				$('#show_text').show();
				if($('.tooltip_close').length > 0){
					$('.tooltip_close').fadeTo(500,1);
					setTimeout(function() {
						$('.tooltip_close').fadeTo(500,0, function() {
							$('.tooltip_close').hide();
						});
					},4000);
				}
				$('#hide_text').hide();
				$('#content').css({'display':'none'});
			})
		;},1000);
	});
	
	$('#show_text').click(function() {
		$('.whiteblock .blockfoot h1, .blockfoot, .blockfoot2, .blocktop, .block .blocktop').css({'filter':'inherit', 'position':'static'});
		
		setTimeout(function() {
			clearInterval(_test);
			$('#content').css({'display':'block'});
			if( $('.block').is(':animated') ) {}else{$('.block, .darkblock, .whiteblock, .lightblock').animate({top:'0',opacity:1},1000, function() {
				$('#hide_text').show();
				$('#show_text').hide();
				
				$('.whiteblock .blockfoot h1, .blockfoot, .blockfoot2, .blocktop').css({'filter':'none', 'position':'relative'});
			});}
		;},1000);
	});
	
	$('a[rel=external], form[rel=external]').attr('target','_blank');
	
	$('p.readMore').bind('click', function(){
		$(this).hide();
		$(this).parent('.item').find('.moreInfo').show('fast', function(){
			$(this).css('display', 'inline');
		});		
	});
	
	$('p.closeMore').bind('click', function(){
		$(this).parent('div.moreInfo').hide('fast', function(){
			$(this).css('display', 'none');
		});		
		$(this).parent('div.moreInfo').parent('.item').find('p.readMore').show();
	});
	
	if($('.formcontact').length > 0){
		$('.radio input:nth(0)').change(function() {
			showFields();
		});
		
		$('.radio input:nth(1)').change(function() {
			hideFields2();
		});
		
		$('.radio input:nth(2)').change(function() {
			hideFields();
		});
	}
	
	if($('#newsSlides').length>0){
		$('.cycle').cycle({
		
			fx: 'scrollHorz',
			speed: 500,	
			timeout: 6000,
			cleartypeNoBg: true,
			next: '#nextPage',
			prev: '#prevPage'
			
		});
	}
	
	$('#sendbutton').click(function() {
		var action = "http://77.241.87.154/Login.aspx?key=";
		var user = $('#user').val();
		var pass = $('#password').val();
		var key = '';
		
		$.ajax({
			url		: '/ajax.php',
			type	: 'POST',
			data	: {
				userName : user,
				passWord : pass
			},
			success	: function(data){
				key = '';
				key = data;
				
				$('#catalog_form').attr('action', action + key);
				$('#catalog_form').submit();
				/*$.ajax({
					url		: '/ajax.php',
					type	: 'POST',
					data	: {
						key : key
					},
					success	: function(data){
						alert(data);
					}
				})*/
			}
		
		})
		return false;
		
	});

	if($('#gallery #collectieimages').length)
	{
		init();
		showPage(cp);
		$(window).resize(reInit);
		reInit();
	}

	$('#arrowright').click( function() {
		nextimages();
	});
	$('#arrowleft').click( function() {
		previmages();
	});
	
	$('#email').bind('focus',function(){
		$('#email').css({'border':'1px solid #ececec', 'color':'#999999', 'width':'140px'});
	});
	
	$('#newsLetterBtn').bind('click', function(){
		var email = $('#email').val();
		if(!validMail(email)){
			$('#email').css({'border':'1px solid #e9254d', 'color':'#e9254d', 'width':'140px'});
		}else{
			$.ajax({
				url		: '/ajax.php',
				type	: 'POST',
				data	: {
					emailAdres : email
				},
				success	: function(){
					$('#email').val('U bent ingeschreven')
					$('#email').css({'border':'1px solid #9ce23a', 'color':'#9ce23a', 'width':'140px'});
					setTimeout(function(){
						$('#email').css({'border':'0px solid #9ce23a', 'color':'#999999', 'width':'140px'});
						$('#email').val('uw e-mailadres')
					},3000);
				}
			
			})	
		}
		return false;
	});
	
	$('input[type=text],input[type=password],textarea').each(function(){
		if($(this).attr('fail') != 1){
			$(this).attr('textvalue', $(this).val());
		}
	})
	$('input[type=text],input[type=password],textarea').bind('focus', function(){
		//$(this).val('');
		if($(this).val() == $(this).attr('textvalue')){
			$(this).val('');
			if($(this).is('.textField') || $(this).is('.textArea')){
				$(this).css('color', '#353434');
			}
		}
	})
	
	$('input[type=text],input[type=password], textarea').bind('blur', function(){
		//$(this).val('');
		if($(this).val() == ''){
			$(this).val($(this).attr('textvalue'));
			if($(this).is('.textField') || $(this).is('.textArea')){
				$(this).css('color', '#7d7b7a');
			}
		}
	})
	
	$('#sendbutton').bind('click',function(){
		$(this).parent().submit();
	});
	
	$('.view').click( function() {
		$('.view').toggleClass('singleview').toggleClass('moreview');
		
		viewclicks++;
		
		if(viewclicks%2){
			//singleview
			view="single";
			$('#gallery #collectieimages').css('display','none');
			$('#gallery #imagesLarge').css('display','block');
			$('#gallery').css({
					'height'		:		'765px'
			});
			resizeGallery();
			centerGallery();
		}else{
			//moreview
			view="more";
			$('#gallery #collectieimages').css('display','block');
			$('#gallery #imagesLarge').css('display','none');
			$('#gallery').css({
					'height'		:		'300px'
			});
			resizeGallery();
			centerGallery();
		}
	});
	
	if($('#controls').length > 0){
		/* CONTROLS NIEUWS */
		var prevPage = $('#pagelist li.active').index();
		var nextPage = ($('#pagelist li.active').index()+2);
		var size = $('#pagelist li').length;

		if(prevPage > 0){
			$('#prevPage').attr('href', "?p="+prevPage);
		}else{
			$('#prevPage').fadeTo('slow',0.1);
		}

		if(nextPage <= size){
			$('#nextPage').attr('href', "?p="+nextPage);
		}else{
			$('#nextPage').fadeTo('slow',0.1);
		}
		
	}
	
	if($('#back ul li').length > 0){
		var arrImages = [];
		$('#back ul li').each(function() {
			var next = $(this).text();
			
			arrImages.push("/media/img/pics/_large/"+next);
		});
		
		if($('#prevbg').length > 0){
			//  Initialize Backgound Stretcher
			$('#backstretch').bgStretcher({
				images: arrImages,
				imageWidth: 1165,
				imageHeight: 765,
				buttonNext: '#nextbg',
				buttonPrev: '#prevbg',
				transitionEffect: 'simpleSlide',
				slideDirection: 'W',
				preloadImg: true,
				sequenceMode: 'normal',
				slideShowSpeed: 1500,
				nextSlideDelay: 5500,
				anchoring: 'left center',
				anchoringImg: 'left center'
			});
			
			$('#backstretch').bgStretcher.pause();
		}else{
			//  Initialize Backgound Stretcher
			$('#backstretch').bgStretcher({
				images: arrImages,
				imageWidth: 1165,
				imageHeight: 765,
				buttonNext: '#nextbgimg',
				buttonPrev: '#prevbgimg',
				transitionEffect: 'simpleSlide',
				slideDirection: 'W',
				preloadImg: true,
				sequenceMode: 'normal',
				slideShowSpeed: 1500,
				nextSlideDelay: 7500,
				anchoring: 'left center',
				anchoringImg: 'left center'
			});
			
			$('#backstretch').bgStretcher.pause();
		}
		
		//$('#backstretch').bgStretcher.pause();
	}
	
	if($('#imagecontainer a').length > 0)
	{
		/*var act = $('#imagecontainer a.active').children('img').attr('alt');
		$('#backstretch').remove();
		$.backstretch("/media/img/pics/_large/"+act, {speed: 150});
		
		$('#imagecontainer img').click(function() {
			
				if(!$('#backstretch img').is(':animated')){
				var newB = $(this).attr('alt');
			
				$('#imagecontainer a.active').removeClass('active');
				$(this).parent('a').addClass('active');
		
				//$('#backstretch').remove();
				//$.backstretch("/media/img/pics/_large/"+newB, {speed: 150});
				
				var curW = $('#backstretch img').attr('width');
				var curH = $('#backstretch img').attr('height');
				var curT = $('#backstretch img').position().top;
				
				$('#backstretch').append('<img src="/media/img/pics/_large/'+newB+'" alt="" title="" style="display:block;position:absolute;z-index:-9990;top:'+curT+'px;left:0;width:'+curW+'px;height:'+curH+'px;" />');
				
				setTimeout(function() {
					$('#backstretch img:eq(0)').css({'z-index':'-9900'}).fadeTo('slow',0, function() {
						$('#backstretch img:eq(0)').addClass('test');
						$('#backstretch img:eq(1)').css({'position':'relative','z-index':'-9900'});
						$('#backstretch img.test').remove();
					})
				},10);
			
			}
		});*/
	}
	
	$('#nextbgimg').click(function() {
		$('#backstretch').bgStretcher.pause();
		/*
		if(!$('.block').is(':animated') && $('.block').css('opacity')!='0' && $('.block.fade').length>0){clearInterval(_test); $('.block, .darkblock').fadeTo('slow',0);}
		
		if(!$('#backstretch img').is(':animated')){
		
			var next = $('#back ul li.active').next('li').text();
			if(next == undefined || next == ""){
				next = $('#back ul li:first').text();
				$('#back ul li:first').addClass('active');
				$('#back ul li:last').removeClass('active');
			}else{
				$('#back ul li.active').next('li').addClass('active');
				$('#back ul li.active:first').removeAttr('class');
			}
	
			var curW = $('#backstretch img').attr('width');
			var curH = $('#backstretch img').attr('height');
			var curT = $('#backstretch img').position().top;
			
			$('#backstretch').append('<img src="/media/img/pics/_large/'+next+'" alt="" title="" style="display:block;position:absolute;z-index:-9990;top:'+curT+'px;left:0;width:'+curW+'px;height:'+curH+'px;" />');
			
			setTimeout(function() {
				$('#backstretch img:eq(0)').css({'z-index':'-9900'}).fadeTo('slow',0, function() {
					$('#backstretch img:eq(0)').addClass('test');
					$('#backstretch img:eq(1)').css({'position':'relative','z-index':'-9900'});
					$('#backstretch img.test').remove();
				})
			},10);
		
		}
		
		//$('#backstretch').remove();
		//$.backstretch("/media/img/pics/_large/"+next, {speed: 150});
		*/
	});
	
	//fade out on click bg
	$('#backclick').click(function(){
		//if(!$('.block').is(':animated') && $('.block').css('opacity')!='0' && $('.block.fade').length>0){clearInterval(_test); $('.block, .darkblock').fadeTo('slow',0);}
	});
	
	$('#nextbg').click(function() {
		$('#backstretch').bgStretcher.pause();
	/*
		if(!$('.block').is(':animated') && $('.block').css('opacity')!='0' && $('.block.fade').length>0){clearInterval(_test); $('.block, .darkblock').fadeTo('slow',0);}
		
		if(!$('#backstretch img').is(':animated')){
		
			var next = $('#imagecontainer a.active').next('a').children('img').attr('alt');
			
			if(next == undefined){
				next = $('#imagecontainer a:first').children('img').attr('alt');
				$('#imagecontainer a:first').addClass('active');
				$('#imagecontainer a.active:last').removeClass('active');
			}else{
				$('#imagecontainer a.active').next('a').addClass('active');
				$('#imagecontainer a.active:first').removeClass('active');
			}
	
			var curW = $('#backstretch img').attr('width');
			var curH = $('#backstretch img').attr('height');
			var curT = $('#backstretch img').position().top;
			
			$('#backstretch').append('<img src="/media/img/pics/_large/'+next+'" alt="" title="" style="display:block;position:absolute;z-index:-9990;top:'+curT+'px;left:0;width:'+curW+'px;height:'+curH+'px;" />');
			
			setTimeout(function() {
				$('#backstretch img:eq(0)').css({'z-index':'-9900'}).fadeTo('slow',0, function() {
					$('#backstretch img:eq(0)').addClass('test');
					$('#backstretch img:eq(1)').css({'position':'relative','z-index':'-9900'});
					$('#backstretch img.test').remove();
				})
			},10);
		
		}
		
		//$('#backstretch').remove();
		//$.backstretch("/media/img/pics/_large/"+next, {speed: 150});*/
	});
	
	$('#prevbgimg').click(function() {
		$('#backstretch').bgStretcher.pause();
		/*if(!$('.block').is(':animated') && $('.block').css('opacity')!='0' && $('.block.fade').length>0){clearInterval(_test); $('.block, .darkblock').fadeTo('slow',0);}
		
		var prev = $('#back ul li.active').prev('li').text();
		
		if(prev == undefined || prev == ""){
			prev = $('#back ul li:last').text();
			$('#back ul li:last').addClass('active');
			$('#back ul li.active:first').removeAttr('class');
		}else{
			$('#back ul li.active').prev('li').addClass('active');
			$('#back ul li.active:last').removeAttr('class');
		}
		
		var curW = $('#backstretch img').attr('width');
		var curH = $('#backstretch img').attr('height');
		var curT = $('#backstretch img').position().top;
		
		$('#backstretch').append('<img src="/media/img/pics/_large/'+prev+'" alt="" title="" style="display:block;position:absolute;z-index:-9990;top:'+curT+'px;left:0;width:'+curW+'px;height:'+curH+'px;" />');
		
		setTimeout(function() {
			$('#backstretch img:eq(0)').css({'z-index':'-9900'}).fadeTo('slow',0, function() {
				$('#backstretch img:eq(0)').addClass('test');
				$('#backstretch img:eq(1)').css({'position':'relative','z-index':'-9900'});
				$('#backstretch img.test').remove();
			})
		},10);

		//$('#backstretch').remove();
		//$.backstretch("/media/img/pics/_large/"+prev, {speed: 150});
		*/
	});
	
	$('#prevbg').click(function() {
		$('#backstretch').bgStretcher.pause();
		/*
		if(!$('.block').is(':animated') && $('.block').css('opacity')!='0' && $('.block.fade').length>0){clearInterval(_test); $('.block, .darkblock').fadeTo('slow',0);}
		
		var prev = $('#imagecontainer a.active').prev('a').children('img').attr('alt');
		
		if(prev == undefined){
			prev = $('#imagecontainer a:last').children('img').attr('alt');
			$('#imagecontainer a:last').addClass('active');
			$('#imagecontainer a.active:first').removeClass('active');
		}else{
			$('#imagecontainer a.active').prev('a').addClass('active');
			$('#imagecontainer a.active:last').removeClass('active');
		}
		
		var curW = $('#backstretch img').attr('width');
		var curH = $('#backstretch img').attr('height');
		var curT = $('#backstretch img').position().top;
		
		$('#backstretch').append('<img src="/media/img/pics/_large/'+prev+'" alt="" title="" style="display:block;position:absolute;z-index:-9990;top:'+curT+'px;left:0;width:'+curW+'px;height:'+curH+'px;" />');
		
		setTimeout(function() {
			$('#backstretch img:eq(0)').css({'z-index':'-9900'}).fadeTo('slow',0, function() {
				$('#backstretch img:eq(0)').addClass('test');
				$('#backstretch img:eq(1)').css({'position':'relative','z-index':'-9900'});
				$('#backstretch img.test').remove();
			})
		},10);

		//$('#backstretch').remove();
		//$.backstretch("/media/img/pics/_large/"+prev, {speed: 150});
		*/
	});
	
	//set back if IE6
	if(isIE6()){
		var dH = $(document).height();
		$('#noise').css('height',dH+'px');
		$('#backstretch').css('height',dH+'px');
	}
	
	//Cufon.replace('#menulist li,#menulist li a,.blockfoot h1, .buttonbody h1, .blockfoot2 h1', {hover:true});
	
	//google maps in background
	if($('#map_holder').length > 0){
		var count = 0;
		
		$('.bigbutton').bind('click',function(){
			count++;
			$('#backstretch').remove();
			$('#back').remove();
			
			$('.textholder').slideToggle();
			$('.bigbutton').toggleClass('active');
			
			if(count == 1){
				initialize();
				//resizeMap();
			}else{
				
			}
		});
		
		
		var rel=$('.right').attr('rel');
		var original=$('.right').text();
		$('.right').click(function() {
			c++;
			
			if(c % 2){
				$(this).text(rel);
			}else{
				$(this).text(original);
			}
			//Cufon.refresh();
		});
	}
	
});

function init(){
	var totalItems = $('#gallery #collectieimages li').size();
	var screenWidth = ($(window).width()-400);
	
	data = Array();
	var temp = Array();
	var curWidth = 0;
	
	
	$('#gallery #collectieimages li').each(function(){
		var cwidth = $(this).children('img').width();
		
		if(curWidth+cwidth>screenWidth){
			data.push(temp);
			temp = Array();
			curWidth=0;
		}
		
		temp.push($(this));
		curWidth+=cwidth;
	
	});
	
	if(temp.length>0){
		data.push(temp);
	}
	
	totalPages = data.length;
	cp = 0;	
}

function showPage(cp){
	$('#gallery #collectieimages li').removeClass('active');
	
	for(var i=0;i<data[cp].length;i++){
		data[cp][i].addClass('active');
	}
	resizeGallery();
	centerGallery();
}

function resizeGallery(){
	if(view=="more")
	{
		var maxWidth = ($(document).width()-400);
		var gW = 0;
		
		$('#gallery #collectieimages li.active img').each(function() {
			gW += ($(this).width()+20);
		});

		$('#gallery #collectieimages li.active').css('padding','0px 20px 0px 0px');
		$('#gallery #collectieimages li.active:last').css('padding','0');
		
		$('#gallery').css('width',(gW-20)+'px');
	}else{
		var galleryWidth = $('#gallery #imagesLarge li.active img').width();
		
		$('#gallery').css('width',galleryWidth+'px');
	}
	
}

function centerGallery(){
	var width = $(document).width()/2;
	var height = $(document).height()/2;
	var iH = $('#gallery').height()/2;
	var iW = $('#gallery').width()/2;
	
	$('#gallery').css({
		  'left'	:	width-iW+'px',
		  'top'		:	height-iH+'px'
	  });
	$('#arrowleft').css('top','50%');
}

function nextimages(){
	
	if(view=="more")
	{
		if(cp < totalPages-1){
			cp++;
			showPage(cp);
		}
	}else{
		var numLi = 0;
		$('#gallery #imagesLarge li').each(function() {numLi+=1;});
		if((count2+2) < (numLi+1)){
			$('#gallery #imagesLarge li:nth-child('+(count2+1)+')').removeAttr('class');
			$('#gallery #imagesLarge li:nth-child('+(count2+2)+')').removeAttr('class').addClass('active');
			resizeGallery();
			centerGallery();
			count2++;
		}
	}

}

function previmages(){
	if(view=="more"){
		
		if(cp > 0){
			cp--;
			showPage(cp);
		}
	}else{
		
		if((count2) > 0){
			$('#gallery #imagesLarge li:nth-child('+(count2+1)+')').removeClass('active');
			$('#gallery #imagesLarge li:nth-child('+(count2)+')').addClass('active');
			resizeGallery();
			centerGallery();
			count2--;
		}
	}

}

function reInit(){
	init();
	showPage(0);
	resizeGallery();
	centerGallery();
} 

function isIE6(){
	if($.browser.msie && $.browser.version < 7){
		return true;
	} else {
		return false;
	}
}

//tween opacity
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

function validMail(str){
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if(str.indexOf(at)==-1){return false;}
	if(str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){return false;}
	if(str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){return false;}
	if(str.indexOf(at,(lat+1))!=-1){return false;}
	if(str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false;}
	if(str.indexOf(dot,(lat+2))==-1){return false;}	
	if(str.indexOf(" ")!=-1){return false;}
	return true;		
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function initialize() {
    var myLatlng = new google.maps.LatLng(50.821445,3.259249);
    var myOptions = {
      zoom: 3,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
	  
	  panControl: true,
	  zoomControl: true,
	  zoomControlOptions: {
		style: google.maps.ZoomControlStyle.SMALL
	  },

	  mapTypeControl: false,
	  mapTypeControlOptions: {
		  style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
		},
	  scaleControl: false,
	  streetViewControl: false,
	  overviewMapControl: true
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	
	google.maps.event.addListener(map, 'zoom_changed', function() {
     if (map.getZoom() < 3) map.setZoom(3);
   });

    
    setMarkers(map, all_dealers, false);
}

function setMarkers(map, locations, bool) {
  iterator = 0;
  if(!bool){
	  for (var i = 0; i < locations.length; i++) {
		setTimeout(function() {
			addMarker(map,locations,iterator);
			var info = '<h1 style="font-size:14px; color:#911d35;">'+locations[iterator][1]+'</h1><p style="font-size:11px; color:#333333;"><br />T '+locations[iterator][5]+'<br /><a href="mailto:'+locations[iterator][7]+'" style="color:#000000;">'+locations[iterator][7]+'</a><p style="font-size:11px; color:#333333;">'+locations[iterator][2]+'</p>';
			addInfoWindow(info);
			google.maps.event.addListener(infowindows[iterator], "closeclick", stopBouncers);
			eval('google.maps.event.addListener(markers[iterator], "click", function(){toggleBounce(this);closeInfoWindows();infowindows['+iterator+'].open(map,this);});');
			iterator++;
		}, 1000+(i*20));
	  }
  } else {
	for (var i = 0; i < locations.length; i++) {
		addMarker(map,locations,iterator);
		var info = '<h1 style="font-size:14px; color:#911d35;">'+locations[iterator][1]+'</h1><p style="font-size:11px; color:#333333;"><br />T '+locations[iterator][5]+'<br /><a href="mailto:'+locations[iterator][7]+'" style="color:#000000;">'+locations[iterator][7]+'</a><p style="font-size:11px; color:#333333;">'+locations[iterator][2]+'</p>';
		addInfoWindow(info);
		google.maps.event.addListener(infowindows[iterator], "closeclick", stopBouncers);
		eval('google.maps.event.addListener(markers[iterator], "click", function(){toggleBounce(this);closeInfoWindows();infowindows['+iterator+'].open(map,this);});');
		iterator++;
	}
  }
  
}

function addMarker(map, locations, m) {
	
	var location = locations[m];
	// Add markers to the map
 
	// Marker sizes are expressed as a Size of X,Y
	// where the origin of the image (0,0) is located
	// in the top left of the image.

	// Origins, anchor positions and coordinates of the marker
	// increase in the X direction to the right and in
	// the Y direction down.
	var shape = {
		  coord: [0, 5, 0, 32, 32, 32, 32 , 5],
		  type: 'poly'
		};

		var latTemp = location[10];
		var lonTemp = location[11];
		latTemp = latTemp.replace(',','.');
		if(!lonTemp){
			alert(location[1]);
		}
		lonTemp = lonTemp.replace(',','.');
		var myLatLng = new google.maps.LatLng(latTemp, lonTemp);
		markers.push(new google.maps.Marker({
			position: myLatLng,
			map: map,
			draggable: false,
			//animation: google.maps.Animation.DROP,
			shape: shape,
			title: location[1]
		}));
	
}

function addInfoWindow(contentString){
	infowindows.push(new google.maps.InfoWindow({
		content: contentString,
		maxWidth: 200
	}));
}

function toggleBounce(marker) {
	//stop other bouncing markers
	stopBouncers();
	//toggle
	if (marker.getAnimation() != null) {
		marker.setAnimation(null);
	} else {
		marker.setAnimation(google.maps.Animation.BOUNCE);
	}
}

function stopBouncers(){
	for(i=0; i<markers.length; i++){
		markers[i].setAnimation(null);
	}
}

function closeInfoWindows(){
	for(i=0; i<infowindows.length; i++){
		infowindows[i].close();
	}
}

function resizeMap(){
	var curW = $(window).width();
	var curH = $(window).height();
	
	document.getElementById("map_canvas").style.width = '100%';
    document.getElementById("map_canvas").style.height = '100%';
    google.maps.event.trigger(map, 'resize');
}

function showFields(){
	$('.formcontact .column').show();
	$('.formcontact .column:eq(2), .formcontact .column:eq(3), .formcontact .column:eq(4), .formcontact .column:eq(7), .formcontact .column:eq(8), .formcontact .column:eq(9), .formcontact .column:eq(10), .formcontact .column:eq(14), .formcontact .column:eq(12)').find('input').attr('alt','Required');
	$('.formcontact .column:eq(6)').find('select').attr('alt','Required');
	$('.formcontact .column:eq(1)').find('input').attr('alt','');
	$('.formcontact .column:eq(1)').find('label').text(tekst.substring(0,tekst.length-2));
	$('.formcontact .column:eq(1), .formcontact .column:eq(2), .formcontact .column:eq(3), .formcontact .column:eq(7), .formcontact .column:eq(8), .formcontact .column:eq(9), .formcontact .column:eq(13), .formcontact .column:eq(14)').show();
}

function hideFields(){
	$('.formcontact .column').show();
	$('.formcontact .column:eq(2), .formcontact .column:eq(3), .formcontact .column:eq(7), .formcontact .column:eq(8), .formcontact .column:eq(9), .formcontact .column:eq(13), .formcontact .column:eq(14)').find('input').attr('alt','');
	$('.formcontact .column:eq(1)').find('input').attr('alt','');
	$('.formcontact .column:eq(4), .formcontact .column:eq(10), .formcontact .column:eq(12)').find('input').attr('alt','Required');
	$('.formcontact .column:eq(4), .formcontact .column:eq(6)').find('select').attr('alt','Required');
	$('.formcontact .column:eq(1), .formcontact .column:eq(2), .formcontact .column:eq(3), .formcontact .column:eq(7), .formcontact .column:eq(8), .formcontact .column:eq(9), .formcontact .column:eq(13), .formcontact .column:eq(14)').hide();
}

function hideFields2(){
	$('.formcontact .column').show();
	$('.formcontact .column:eq(2), .formcontact .column:eq(3), .formcontact .column:eq(4), .formcontact .column:eq(6), .formcontact .column:eq(7), .formcontact .column:eq(8), .formcontact .column:eq(9), .formcontact .column:eq(10), .formcontact .column:eq(12), .formcontact .column:eq(13)').find('input').attr('alt','');
	$('.formcontact .column:eq(2), .formcontact .column:eq(3), .formcontact .column:eq(4), .formcontact .column:eq(6), .formcontact .column:eq(7), .formcontact .column:eq(8), .formcontact .column:eq(9), .formcontact .column:eq(10), .formcontact .column:eq(12), .formcontact .column:eq(13)').find('select').attr('alt','');
	$('.formcontact .column:eq(1), .formcontact .column:eq(5)').find('input').attr('alt','Required');
	$('.formcontact .column:eq(1)').find('label').text(tekst);
	$('.formcontact .column:eq(2), .formcontact .column:eq(3), .formcontact .column:eq(4), .formcontact .column:eq(6), .formcontact .column:eq(7), .formcontact .column:eq(8), .formcontact .column:eq(9), .formcontact .column:eq(10), .formcontact .column:eq(12), .formcontact .column:eq(13)').hide();
}

function loadBook(xml){
	$('#noise').append('<div id="bookholder"><div id="topright" style="z-index:6005"><a id="close" href="javascript:closeBook();"><div id="closeleft" style="z-index:3005"></div><div id="closecenter" style="z-index:3005">X '+lwclose+'</div><div id="closeright" style="z-index:3005"></div></a></div><div id="overlay" style="z-index:3003"></div><div id="book"></div></div>');
	$('#overlay').css('opacity','1');
	var book = $('#book');
	var wh = $(document).height();
	book.css('top','60px');
	book.css('height',(wh-60)+'px');
	var so = new SWFObject("/media/swf/book.swf", "mc", "100%", "100%", "9", "#bbbbbb");
	so.addVariable("datafile","/media/xml/"+xml);
	so.addVariable("path","/media/img/pages/");
	so.write("book");
}
function closeBook(){
	$('#bookholder').remove();
}
