
function switchColor(id){
	new Ajax('/ajx/ajx.php?action=switchColor&id='+id, { 
		method: 'get',
		onComplete:function(returnValue){
			var values = returnValue.split('___');
			$('product_image').setProperty('src',values[0]);
			$('product_link').setProperty('href',values[1]);	
			$('large_image').setProperty('href',values[1]);		
			if($chk($('product_image2'))){ 
				$('product_image2').setProperty('src',values[2]);
				$('product_link2').setProperty('href',values[3]);	
			}
			if($chk($('product_image3'))){ 
				$('product_image3').setProperty('src',values[4]);
				$('product_link3').setProperty('href',values[5]);	
			}		
			if($chk($('product_image4'))){ 
				$('product_image4').setProperty('src',values[6]);
				$('product_link4').setProperty('href',values[7]);	
			}	
			if($chk($('product_image5'))){ 
				$('product_image5').setProperty('src',values[8]);
				$('product_link5').setProperty('href',values[9]);	
			}	
			$('referentie').setHTML(values[10]);	
			$('color').setHTML(values[11]);				
			$('locate_store').setProperty('href',$('strLocation').value+"/"+$('strProdid').value+"/"+values[11]);
			$$('.combination_advice').each(
				function(itm, idx){
					$(itm).setStyle('display','none');
				}//each
			); 
			$('combination_'+id).setStyle('display','block');
		}//onComplete						 
	}).request(); 			
}//switchColor

function startGallery() { 
	var picture1 = new gallery($('picture1'), { timed: true, showArrows: false, showInfopane: false, showCarousel: false, embedLinks: false, delay: 9000 });
	document.gallery = picture1;
	(function(){ 
	var picture2 = new gallery($('picture2'), { timed: true, showArrows: false, showInfopane: false, showCarousel: false, embedLinks: false, delay: 9000 });
	document.gallery = picture2; }).delay(3000);	
	(function(){
	var picture3 = new gallery($('picture3'), { timed: true, showArrows: false, showInfopane: false, showCarousel: false, embedLinks: false, delay: 9000 });
 	document.gallery = picture3; }).delay(6000);	
}

function locateShops(zip,ownlist){
	var locatie = $('city').value;
	var zip = zip;
	new Ajax('/ajx/ajx.php?action=locateShops&id='+locatie+'&zip='+zip, { 
		method: 'get',
		onComplete:function(request){
			  if (GBrowserIsCompatible()) {

				var coordinates = request.split('__');
				var center = coordinates[0];
				var map = new GMap2(document.getElementById("map"));
				var loc = center.split(',');				
				var zoom = 15;
				map.setCenter(new GLatLng(loc[1],loc[0]), 10);
				coord = coordinates[1].split('|');
				map.addControl(new GSmallZoomControl());	
				if(ownlist!='') coord = ownlist.split('|');
				coord.each(function(loc){
					if(loc!=''){
						var degrees = loc.split('<>');	
						var point = new GLatLng(degrees[1],degrees[0]);					
						var marker = new GMarker(point, mymarkeroptions());
						//if(degrees[4].length>65) var image = '<img id="store_img" src="'+degrees[4]+'">';
						//else var image = '';
						var image = '';
						GEvent.addListener(marker, "click", function() { loadStore(degrees[2]) });
						map.addOverlay(marker);
					}//if
				});		
			  }//if
		}//onComplete						 
	}).request(); 			
}//locateShops

function loadStore(id){
	new Ajax('/ajx/ajx.php?action=locateAddress&id='+id, { 
		method: 'get',
		onComplete:function(request){
			$('address').setHTML(request);
		}//onComplete						 
	}).request(); 	
}//locateShop

function mymarkeroptions(){
var tinyIcon = new GIcon();
tinyIcon.image = "http://labs.google.com/ridefinder/images/mm_20_gray.png";
tinyIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
tinyIcon.iconSize = new GSize(12, 20);
tinyIcon.shadowSize = new GSize(22, 20);
tinyIcon.iconAnchor = new GPoint(6, 20);
	return markerOptions = { icon:tinyIcon };	
}//mymarkeroptions

function lookupZipcode(){
	var where = $('strCity').value;
	new Ajax('/ajx/ajx.php?action=lookupZipcode&where='+where, { 
		method: 'get',
		onComplete:function(request){
			$('strPostalcode').setProperty('value',request);
		}//onComplete						 
	}).request(); 	
}//lookupZipcode

function showCatalog(){
	$('catalog_firefox').setStyle('display','block');
}//showCatalog
