$(function() 
{	
	$("a,area,map,object").bind("focus",function(){if($(this).blur)$(this).blur();});	// links blurren
	$(".email").each(function(){v=$(this).html().split('|');if (v[1]){m=v[0]+'@'+v[1];$(this).html('<a href="mailto:'+m+'" title="Stuur een e-mail">'+m+'</a>');}});
	
	$(".overlabel").each(function() { if ($(this).val()=='') { $(this).val($(this).attr("title")).css('color','#666').addClass('overlabel_inactief'); }});
	$(".overlabel").focus(function() { if ($(this).val()==$(this).attr("title")) { $(this).val('').css('color','').removeClass('overlabel_inactief'); }});
	$(".overlabel").blur(function() { if ($(this).val()=='') { $(this).val($(this).attr("title")).css('color','#666').addClass('overlabel_inactief'); }});		

	if ($("#gmap").size()>0)
	{			
		map = new GMap2(document.getElementById("gmap")); 
		map.setUIToDefault();
		
		if ($(".contact .grijskader").hasClass('routeamsterdam')) { locatie = new GLatLng(52.38956107212828, 4.904022216796875); }
		if ($(".contact .grijskader").hasClass('routeeindhoven')) { locatie = new GLatLng(51.448450842174175, 5.491704940795898); }		
		
		map.setCenter(locatie, 12); 
		//map.setMapType(G_HYBRID_MAP);	
		
		function addMarker(point) {
			var icon = new GIcon();
			icon.image = "http://"+document.domain+"/images/marker.png";
			icon.shadow = "http://"+document.domain+"/images/marker_schaduw.png";
			icon.iconSize = new GSize(35.0, 35.0);
			icon.shadowSize = new GSize(53.0, 35.0);
			icon.iconAnchor = new GPoint(17.0, 17.0);
			icon.infoWindowAnchor = new GPoint(17.0, 17.0);
				
			map.addOverlay(new GMarker(point, icon));
		}
		
		addMarker(locatie);				
	}
	
	$(".berekenroute_knop").click(function()
	{
		if ($(".route_input").hasClass("overlabel_inactief")) { notices('error','Vul uw adres/postcode in'); return false; }
		adres = escape($(".route_input").val());
		
		if ($(".contact .grijskader").hasClass('routeamsterdam')) { dest_adres = 'Tibaco Amsterdam'; }
		if ($(".contact .grijskader").hasClass('routeeindhoven')) { dest_adres = 'Tibaco Eindhoven'; }	
		
		window.open('http://maps.google.nl/maps?f=d&source=s_d&saddr='+adres+'&daddr='+dest_adres);
		
	});

	if ($("#flashheader").size()>0) 
	{	
		p = $("body").attr("class").split(' ')[1];
		var params = { allowScriptAccess: "always", wmode: "transparent" };
		var vars = { sCurrentPage: p  };
		swfobject.embedSWF("/swf/header.swf", "flashheader", "980", "273", "8", null, vars, params);
	}
	
	if ($("#cases").size()>0) 
	{	
		var params = { allowScriptAccess: "always", wmode: "transparent" };
		var vars = { pagina: p  };
		swfobject.embedSWF("/swf/cases.swf", "cases", "593", "400", "8", null, vars, params);
	}	
	  	
});



function cs(file,id)
{
	document.getElementById('screenshot_'+id).style.backgroundImage='url(websites_screenshots/screenshots/'+file+'.jpg)';
}

function edit_pagina(id,type)
{
	NewWindow('beheer/edit_pagina.php?id='+id+'&type='+type,965,610,'edit_pagina');
	
}

function NewWindow(mypage,w,h,myname){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
var settings ='height='+h+',';
settings +='width='+w+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars=0,';
settings +='resizable=yes';
win=window.open(mypage,myname,settings);
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
} 
function MM_openBrWindow(theURL,winName,features) { 
window.open(theURL,winName,features);
}