// Bilder managen
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Marken und Modelle

autos = new Array(5);
for (i=0;i<5;i++)
{
	autos[i] = new Array();	
}
// *** Audi Modele ***
autos[1][0]='100';
autos[1][1]='200';
autos[1][2]='80';
autos[1][3]='90';
autos[1][4]='A1';
autos[1][5]='A2';
autos[1][6]='A3';
autos[1][7]='A4';
autos[1][8]='A4 Allroad';
autos[1][9]='A5';
autos[1][10]='A6';
autos[1][11]='A6 Allroad';
autos[1][12]='A7';
autos[1][13]='A8';
autos[1][14]='Cabriolet';
autos[1][15]='Coupé';
autos[1][16]='Q3';
autos[1][17]='Q5';
autos[1][18]='Q7';
autos[1][19]='QUATTRO';
autos[1][20]='R8';
autos[1][21]='RS2';
autos[1][22]='RS3';
autos[1][23]='RS4';
autos[1][24]='RS5';
autos[1][25]='RS6';
autos[1][26]='S2';
autos[1][27]='S3';
autos[1][28]='S4';
autos[1][29]='S5';
autos[1][30]='S6';
autos[1][31]='S8';
autos[1][32]='TT';
autos[1][33]='V8';

// *** VW Modele ***
autos[2][0]='Beetle';
autos[2][1]='Bora';
autos[2][2]='Buggy';
autos[2][3]='Corrado';
autos[2][4]='Eos';
autos[2][5]='Fox';
autos[2][6]='Golf';
autos[2][7]='Golf Plus';
autos[2][8]='Iltis';
autos[2][9]='Jetta';
autos[2][10]='Karmann Ghia';
autos[2][11]='Käfer';
autos[2][12]='LT';
autos[2][13]='Lupo';
autos[2][14]='New Beetle';
autos[2][15]='Passat';
autos[2][16]='Phaeton';
autos[2][17]='CC';
autos[2][18]='Polo';
autos[2][19]='Routan';
autos[2][20]='Santana';
autos[2][21]='Scirocco';
autos[2][22]='Sharan';
autos[2][23]='Taro';
autos[2][24]='Tiguan';
autos[2][25]='Touareg';
autos[2][26]='Touran';
autos[2][27]='up!';
autos[2][28]='Vento';


// *** Volkswagen Nutzfahrzeuge ***
autos[3][0] = "Amarok";
autos[3][1] = "Caddy";
autos[3][2] = "Caddy Kastenwagen";
autos[3][3] = "Caddy Combi";
autos[3][4] = "Caravelle";
autos[3][5] = "California";
autos[3][6] = "Crafter Kastenwagen";
autos[3][7] = "Crafter Kombi";
autos[3][8] = "Crafter Fahrgestell";
autos[3][9] = "Crafter Pritschenwagen";
autos[3][10] = "Multivan";
autos[3][11] = "Transporter Kastenwagen";
autos[3][12] = "Transporter Kombi";
autos[3][13] = "Transporter Fahrgestell";
autos[3][14] = "Transporter Pritschenwagen";

// *** Hyundai Modele ***
autos[4][0]='Accent';
autos[4][1]='Atos';
autos[4][2]='Azera';
autos[4][3]='Coupe';
autos[4][4]='Elantra';
autos[4][5]='Excel';
autos[4][6]='Galloper';
autos[4][7]='Genesis';
autos[4][8]='Getz';
autos[4][9]='Grandeur';
autos[4][10]='H 100';
autos[4][11]='H 200';
autos[4][12]='H-1';
autos[4][13]='H-1 Starex';
autos[4][14]='i10';
autos[4][15]='i20';
autos[4][16]='i30';
autos[4][17]='i40';
autos[4][18]='i50';
autos[4][19]='ix20';
autos[4][20]='ix35';
autos[4][21]='ix55';
autos[4][22]='Lantra';
autos[4][22]='Matrix';
autos[4][23]='Pony';
autos[4][24]='S-Coupe';
autos[4][25]='Santa Fe';
autos[4][26]='Santamo';
autos[4][27]='Sonata';
autos[4][28]='Terracan';
autos[4][29]='Trajet';
autos[4][30]='Tucson';
autos[4][31]='Veloster';
autos[4][32]='Veracruz';
autos[4][33]='XG 30';
autos[4][34]='XG 350';
autos[4][35]='Andere';



function setMarke(was,vMarke,vModell,m)
{
	if (m!="")
	{
		m=was.options[was.selectedIndex].value;
	}
	document.forms[vMarke].elements[vModell].length=0;

	document.forms[vMarke].elements[vModell][0]=new Option("Alle Modelle",0)	

	if (m>4)
		{
			//document.forms[vMarke].elements[vModell][0]=new Option("Alle Modelle",0)
		}
		else
		{
			for (i=1;i<=autos[m].length;i++)
			{
				document.forms[vMarke].elements[vModell][i]=new Option(autos[m][i-1],autos[m][i-1])
			}
		}
}

// Google Maps
  
  var geocoder;
  var map;
  var marker;
  
function test() {
    geocoder = new google.maps.Geocoder();
    var address = "Dritz-Zubeil-Straße 72,  14482 Potsdam";
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
	    var latlng = new google.maps.LatLng(results[0].geometry.location);

	    var myOptions = {
	      zoom: 15,
	      center: latlng,
	      mapTypeId: google.maps.MapTypeId.ROADMAP
	    }
	    map = new google.maps.Map(document.getElementById("karte"), myOptions);

        map.setCenter(results[0].geometry.location);
        marker = new google.maps.Marker({
            map: map, 
            position: results[0].geometry.location
        });
        
            
    var contentString="Autohaus Babelsberg GmbH & Co. KG<br><a target='_blank' href='http://maps.google.de/maps?daddr=Fritz-Zubeil-Stra%C3%9Fe+72,+14482+Potsdam&hl=de&ie=UTF8&sll=52.381677,13.110187&sspn=0.012744,0.033023&geocode=CUA7P3g2mJjAFW49HwMdMvvHACnBxmYrZl-oRzFwXXhnjEiXbw&vpsrc=0&mra=ls&t=h&z=16'>Routenplaner</a>";
	var infowindow = new google.maps.InfoWindow({ 
		content: contentString
	}); 
	google.maps.event.addListener(marker, 'click', function() {
	infowindow.open(map,marker); 
	});
        
        
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
    });
  }  
  
 // Slideshow
 
 	$(document).ready(function(){
		$("a[rel^='prettyPhoto']").prettyPhoto({
			animation_speed: 'fast', /* fast/slow/normal */
			slideshow: 5000, /* false OR interval time in ms */
			autoplay_slideshow: false, /* true/false */
			opacity: 0.80, /* Value between 0 and 1 */
			show_title: true, /* true/false */
			allow_resize: true, /* Resize the photos bigger than viewport. true/false */
			default_width: 500,
			default_height: 344,
			counter_separator_label: ' von ', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			horizontal_padding: 20, /* The padding on each side of the picture */
			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
			wmode: 'opaque', /* Set the flash wmode attribute */
			autoplay: true, /* Automatically start videos: True/False */
			modal: false, /* If set to true, only the close button will close the window */
			deeplinking: false, /* Allow prettyPhoto to update the url to enable deeplinking. */
			overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
			keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
			changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
			callback: function(){}, /* Called when prettyPhoto is closed */
			ie6_fallback: true,
			markup: '<div class="pp_pic_holder"> \
						<div class="ppt">&nbsp;</div> \
						<div class="pp_top"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
						<div class="pp_content_container"> \
							<div class="pp_left"> \
							<div class="pp_right"> \
								<div class="pp_content"> \
									<div class="pp_loaderIcon"></div> \
									<div class="pp_fade"> \
										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
										<div class="pp_hoverContainer"> \
											<a class="pp_next" href="#">next</a> \
											<a class="pp_previous" href="#">previous</a> \
										</div> \
										<div id="pp_full_res"></div> \
										<div class="pp_details"> \
											<div class="pp_nav"> \
												<a href="#" class="pp_arrow_previous">Previous</a> \
												<p class="currentTextHolder">0/0</p> \
												<a href="#" class="pp_arrow_next">Next</a> \
											</div> \
											<p class="pp_description"></p> \
											{pp_social} \
											<a class="pp_close" href="#">Close</a> \
										</div> \
									</div> \
								</div> \
							</div> \
							</div> \
						</div> \
						<div class="pp_bottom"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
					</div> \
					<div class="pp_overlay"></div>',
			gallery_markup: '<div class="pp_gallery"> \
								<a href="#" class="pp_arrow_previous">Previous</a> \
								<div> \
									<ul> \
										{gallery} \
									</ul> \
								</div> \
								<a href="#" class="pp_arrow_next">Next</a> \
							</div>',
			image_markup: '<img id="fullResImage" src="{path}" />',
			flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
			quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
			inline_markup: '<div class="pp_inline">{content}</div>',
			custom_markup: '',
			social_tools: ''
		});
	});
