function mover(t) {
	l=t.src.length;
	if (t.src.substr(l-5,1)=='A') return;
	e=t.src.substr(l-4,4);
	i=t.src.substr(0,l-4);
	t.src=i+"A"+e;
}

function mout(t) {
	l=t.src.length;
	if (t.src.substr(l-5,1)=='A') {
		e=t.src.substr(l-4,4);
		i=t.src.substr(0,l-5);
		t.src=i+e;
	}
}

var dragObject, offsetX, offsetY, isDragging=false;
var moveX,moveY;
document.onmousemove = mM;
document.onmouseup = mU;

function rand(a,b) {
	var rand_no = Math.random();
	rand_no = rand_no * (b-a);
	rand_no = Math.ceil(rand_no) + a;	
	return rand_no;
}

ie5 = (document.all && document.getElementById);
ns6 = (!document.all && document.getElementById);
opac = 0;
function fadein(id) {
	var ob = document.getElementById(id);
	if(opac < 100){
		opac+=10;
		if (opac>100) opac=100;
		if (ie5) ob.style.filter='alpha(opacity='+opac+')';
		if (ns6) ob.style.MozOpacity = opac/100;
		if (ns6) ob.style.opacity = opac/100;
		setTimeout("fadein('"+id+"')", 10);
	}
}

function domaincheck(lang,exit) {
	t=document.getElementById("domainField");
	if (lang=='nl') d='domein.nl'; else d='domain.com';
	if (exit==1) {
		if (t.value=='') t.value=d;
	} else
		if (t.value==d) t.value='';	
}

function antispam(u,f,d) {
	document.location='mai'+'lto:'+u+'@'+d;
}

function init() {
	var ob = document.getElementById("bg");
	ob.ondrag=function(){return false;};
	ob.onselectstart=function(){return false;};
	posX=new Array();
	posY=new Array();
	posX[0]=-679;
	moveX=rand(-800,-500);
	moveY=rand(-1000,-300);
	ob.style.left=moveX+"px";
	ob.style.top=moveY+"px";
	ob.style.display='block';
	fadein('bg');
}

function mD(ob,e) {
	dragObject = ob;
	ob.ondrag=function(){return false;};
	ob.onselectstart=function(){return false;};
	if (window.event) e=window.event;
	var dragX = parseInt(dragObject.style.left);
	var dragY = parseInt(dragObject.style.top);
	var mouseX = e.clientX;
	var mouseY = e.clientY;
	offsetX = mouseX - dragX;
	offsetY = mouseY - dragY;
	isDragging = true;
	window.status=dragObject.style.left+","+dragObject.style.top;
	return false;
}
function mM(e) {
	if (!isDragging) return;
	if (window.event) e=window.event;
	var newX = e.clientX - offsetX;
	var newY = e.clientY - offsetY;
	dragObject.style.left = newX + "px";
	dragObject.style.top = newY + "px";
	window.status=dragObject.style.left+","+dragObject.style.top;
	return false;
}
function mU() {
	if (!isDragging) return;
	isDragging = false;
	return false;
}

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];}
}

function enlarge(url,opac) {
	if (opac==undefined) opac=70;
	y=document.body.scrollTop;
	e=document.getElementById('enlargepic');
	e.style.display="";
	e2=document.getElementById('enlargepicbg');
	e2.style.display="";
	i=document.getElementById('enlargepic2');
	i.src=url;
	e2.style.MozOpacity=opac/100;
	e2.style.opacity=opac/100;
	e2.style.filter='alpha(opacity='+opac+')';
	e2.style.top=y;
	e.style.top=y;
}
function enlargeclose() {
	e=document.getElementById('enlargepic');
	e.style.display="none";
	e2=document.getElementById('enlargepicbg');
	e2.style.display="none";
	i=document.getElementById('enlargepic2');
	i.src='';
}
function enlargefr(url,opac) {
	if (opac==undefined) opac=70;
	y=document.body.scrollTop;
	e=document.getElementById('enlargefr');
	e.style.display="";
	e2=document.getElementById('enlargefrbg');
	e2.style.display="";
	i=document.getElementById('enlargefr2');
	i.src=url;
	e2.style.MozOpacity=opac/100;
	e2.style.opacity=opac/100;
	e2.style.filter='alpha(opacity='+opac+')';
	e2.style.top=y;
	e.style.top=y;
}
  function showhide(id) {
    target=document.getElementById(id);
    if (target.style.display=="none")
      target.style.display="";
    else
      target.style.display="none";
  }	
function enlargefrclose() {
	e=document.getElementById('enlargefr');
	e.style.display="none";
	e2=document.getElementById('enlargefrbg');
	e2.style.display="none";
	i=document.getElementById('enlargefr2');
	i.src='';
}
	function loadGoogleMap() {
		if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById("map"));
			var directionsPanel;
	    var directions;
			var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20));
			map.setCenter(new GLatLng(52.09271,5.12312), 16, G_NORMAL_MAP); // G_HYBRID_MAP G_SATELLITE_MAP G_NORMAL_MAP G_PHYSICAL_MAP
			//map.enableGoogleBar();
			map.enableScrollWheelZoom();
			//map.addControl(new GScaleControl(), bottomRight);
			//map.addControl(new GLargeMapControl());
			map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());
			directions = new GDirections(map, directionsPanel);
			directions.load("from: Acaciatraat, Utrecht to: Drift 1, Utrecht");

			//map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));

			//map.addOverlay(new GMarker(new GLatLng(52.100994,5.100689)));
			
			var baseIcon = new GIcon();
			baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
			baseIcon.iconSize = new GSize(20, 34);
			baseIcon.shadowSize = new GSize(37, 34);
			baseIcon.iconAnchor = new GPoint(9, 34);
			baseIcon.infoWindowAnchor = new GPoint(9, 2);
			baseIcon.infoShadowAnchor = new GPoint(18, 25);
			
			function createMarker(point, letter, info) {
				var letteredIcon = new GIcon(baseIcon);
				if (letter!='')
					letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";
				else
					letteredIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png";
				markerOptions = { icon:letteredIcon };
				var marker = new GMarker(point, markerOptions);
				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml(info);
				});
				return marker;
			}
			map.addOverlay(createMarker(new GLatLng(52.09274,5.12316), 'A', "<b>amphora.</b>interactive<br>Drift 1<br>3512 BP &nbsp;Utrecht<br>030-2447744<br><a href='http://www.amphora.nl/' target='_blank'>www.amphora.nl</a>"));
			map.addOverlay(createMarker(new GLatLng(52.100994,5.100689), 'A', "<b>amphora.</b>interactive<br>Postadres<br>Acaciastraat 11<br>3551 BD &nbsp;Utrecht"));
		}
	}
	function validatebesteldomein () {
		if (document.besteldomein.contactpersoon.value=='') { alert ('Contactpersoon is verplicht'); document.besteldomein.contactpersoon.focus(); return false; }
		if (document.besteldomein.adres.value=='') { alert ('Adres is verplicht'); document.besteldomein.adres.focus(); return false; }
		if (document.besteldomein.postcode.value=='') { alert ('Postcode is verplicht'); document.besteldomein.postcode.focus(); return false; }
		if (document.besteldomein.plaats.value=='') { alert ('Plaats is verplicht'); document.besteldomein.plaats.focus(); return false; }
		if (document.besteldomein.telefoon.value=='') { alert ('Telefoon is verplicht'); document.besteldomein.telefoon.focus(); return false; }
		if (document.besteldomein.email.value=='') { alert ('Email is verplicht'); document.besteldomein.email.focus(); return false; }
		if (document.besteldomein.betaling[0].checked) {
			if (document.besteldomein.rekening.value=='') { alert ('Bang/Giro is verplicht'); document.besteldomein.rekening.focus(); return false; }
			if (document.besteldomein.tnv.value=='') { alert ('Op naam van is verplicht'); document.besteldomein.tnv.focus(); return false; }
		}
		return confirm('Contract opstellen?');
	}
