function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

				
function show_chapter(chapter_id)
{
	document.getElementById('bericht_wissel').innerHTML= '<img src="http://www.isonthemove.com/images/ajax-loader-large.gif" style="margin-top: 100px; margin-left: 200px">';
	var strURL="http://atle.isonthemove.com/ajax/load_chapter/"+chapter_id;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{	
					//change_ad(chapter_id);
					document.getElementById('bericht_wissel').innerHTML= req.responseText
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function show_reactions(chapter_id)
{
	var strURL="http://atle.isonthemove.com/ajax/load_reactions/"+chapter_id;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('geplaatste_reacties').innerHTML= req.responseText
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function load_fotoalbum(album_id, site_user_id)
{
	document.getElementById('album').innerHTML= '<img src="http://www.isonthemove.com/images/ajax-loader-large.gif" style="margin-top: 100px; margin-left: 200px">';
	
	var strURL="http://atle.isonthemove.com/ajax/load_album/"+album_id+"/"+site_user_id;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					//change_ad();
					document.getElementById('album').innerHTML= req.responseText
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}


function select_album(album_id)
{
	var strURL="http://atle.isonthemove.com/ajax/change_album_id/"+album_id;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('albumselecter').innerHTML= req.responseText
					document.getElementById('story_id').value = album_id;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}



function addEvent(element, eventType, lamdaFunction, useCapture) {
	if (element.addEventListener) {
		element.addEventListener(eventType, lamdaFunction, useCapture);
		return true;
	} else if (element.attachEvent) {
		var r = element.attachEvent('on' + eventType, lamdaFunction);
		return r;
	} else {
		return false;
	}
}

function knackerEvent(eventObject) {
	if (eventObject && eventObject.stopPropagation) {
		eventObject.stopPropagation();
	}
	if (window.event && window.event.cancelBubble ) {
		window.event.cancelBubble = true;
	}
	
	if (eventObject && eventObject.preventDefault) {
		eventObject.preventDefault();
	}
	if (window.event) {
		window.event.returnValue = false;
	}
}				



function save_mailinglist(e) { 	

	knackerEvent(e);
	
	var name =		 	document.getElementById('mailinglist_name').value;
	var email = 		document.getElementById('mailinglist_email').value;
	var user_id = 		document.getElementById('mailinglist_user_id').value;
 
	name = name.replace(/&/g,"-en-");

	if(name == '')
	{
		alert ('Please provide your name');	
	}
	else if(email == '')
	{
		alert ('Please provide your email address');	
	}
	else
	{
		var xmlHttp = GetXmlHttpObject();
	
		xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/save_mailinglist', true);
	
		var name =		 	document.getElementById('mailinglist_name').value;
		var email = 		document.getElementById('mailinglist_email').value;
		var user_id = 		document.getElementById('mailinglist_user_id').value;

		name = name.replace(/&/g,"-en-");
		
		xmlHttp.onreadystatechange = function()
		{	
			if(xmlHttp.readyState==4){			
				document.getElementById('response_mailinglist').innerHTML = xmlHttp.responseText;		
				document.getElementById('mailinglist_form').style.display = 'none';
			}	
		}	
		
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
		xmlHttp.send('name=' + name + '&email=' + email + '&user_id=' + user_id );	
	}
}


addEvent('mailinglist_form', 'submit', save_mailinglist, false);	

function save_reactie(e) { 	

	knackerEvent(e);
	
	
	var name =		 	document.getElementById('reactie_name').value;
	var email = 		document.getElementById('reactie_email').value;
	var chapter_id = 	document.getElementById('reactie_chapter_id').value;
	var text =	 		document.getElementById('reactie_text').value;

	text = text.replace(/&/g,"-en-");
	name = name.replace(/&/g,"-en-");
	if(name == '')
	{
		alert ('Please provide your name');	
	}
	else if(email == '')
	{
		alert ('Please provide your email address');	
	}
	else if(text == '')
	{
		alert ('Please provide your message!');	
	}
	else
	{
	
	
		var xmlHttp = GetXmlHttpObject();
	
		var data = 			document.getElementById("reactie_response");	
		
		xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/save_reactie', true);
	
		xmlHttp.onreadystatechange = function()
		{	
			if(xmlHttp.readyState==4){			
				data.innerHTML = xmlHttp.responseText;		
				hide('reactie_form');

				
				show_reactions(chapter_id);
			}	
		}	
		
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
		xmlHttp.send('name=' + name + '&email=' + email + '&chapter_id=' + chapter_id + '&text=' + text );	
	}
}



addEvent('reactie_form', 'submit', save_reactie, false);	

function login(e) 
{ 	
	knackerEvent(e);

	var password =		document.getElementById('login_password').value;
	var user_id = 		document.getElementById('login_user_id').value;
	var sitename = 		document.getElementById('login_sitename').value;
	
	if(password == '')
	{
		alert ('Please provide your password');	
	}
	else
	{
		var xmlHttp = GetXmlHttpObject();
	
		if(!xmlHttp && typeof XMLHttpRequest!= 'undefined'){
		xmlHttp = new XMLHttpRequest();
		} 
		xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/login', true);
		 
		
		xmlHttp.onreadystatechange = function()
		{	
			if(xmlHttp.readyState==4)
			{			
				document.getElementById("login_response").innerHTML = xmlHttp.responseText;	
				if(xmlHttp.responseText.match("Oops"))
				{
				}
				else
				{
					window.location.href='http://' + sitename + '.isonthemove.com/manager';
				}
			}	
		}	
		
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
		xmlHttp.send('password=' + password + '&user_id=' + user_id);	
	}
}

addEvent('login_form', 'submit_login', login, false);	

function save_guestbook(e) 
{ 	
	knackerEvent(e);
	
	var name =		 	document.getElementById('guestbook_name').value;
	var email = 		document.getElementById('guestbook_email').value;
	var user_id = 		document.getElementById('guestbook_user_id').value;
	var text = 			document.getElementById('guestbook_text').value;

	name = name.replace(/&/g,"-en-");
	text = text.replace(/&/g,"-en-");

	if(name == '')
	{
		alert ('Please provide your name');	
	}
	else if(email == '')
	{
		alert ('Please provide your email address');	
	}
	else if(text == '')
	{
		alert ('Please provide your message');	
	}
	else
	{
		var xmlHttp = GetXmlHttpObject();
	
		xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/save_guestbook', true);
		
		xmlHttp.onreadystatechange = function()
		{	
			if(xmlHttp.readyState==4){			
				document.getElementById('response_guestbook').innerHTML = xmlHttp.responseText;		
				hide('guestbook_form');
				show_guestbook(user_id);
			}	
		}	
		
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
		xmlHttp.send('name=' + name + '&email=' + email + '&user_id=' + user_id + '&text=' + text);	
	}
}

addEvent('guestbook_form', 'submit', save_guestbook, false);	

function show_guestbook(user_id)
{
	
	var strURL="http://atle.isonthemove.com/ajax/load_guestbook/"+user_id;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('gastenboek').innerHTML= req.responseText
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}



function rotatepic(pic_id, direction)
{
	
	var strURL="http://atle.isonthemove.com/ajax/rotate_pic/"+pic_id+ "/" + direction;
	
	var target = document.getElementById('pic_' + pic_id);
	
	target.innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader.gif" style="margin-top: 20px; margin-left: 20px">';
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					target.innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}



function move_chapter(chapter_id, direction)
{
	
	var strURL="http://atle.isonthemove.com/ajax/move_chapter/"+chapter_id+ "/" + direction;
	
	var target = document.getElementById('chapter_overview');
	
	target.innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader-large.gif" style="margin-top: 200px; margin-left: 200px">';
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					target.innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}



addEvent('changedes', 'submit', change_description, false);	


function change_description(pic_id, e) { 	

	knackerEvent(e);
	
	var textarea = 'img_description_'+ pic_id;
	var textarea_value = document.getElementById(textarea).value;

	textarea_value = textarea_value.replace(/&/g, '-en');

	var xmlHttp = GetXmlHttpObject();

	xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/change_pic_description', true);
	
	xmlHttp.onreadystatechange = function()
	{	
		if(xmlHttp.readyState==4)
		{			
			hide('pic_des_' + pic_id ); 
			show('des_' + pic_id ); 
			document.getElementById('des_' + pic_id).innerHTML = xmlHttp.responseText;
		}	
	}	
	
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	xmlHttp.send('pic_id=' + pic_id + '&des=' + textarea_value );	
}

function movepic(pic_id, direction)
{
	
	var strURL="http://atle.isonthemove.com/ajax/move_pic/"+pic_id+ "/" + direction;
	
	var target = document.getElementById('pic_overview');
	
	target.innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader-large.gif" style="margin-top: 200px; margin-left: 200px">';
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					target.innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function delete_message(chapter_id)
{
	if (confirm("Weet je zeker dat je dit bericht wilt verwijderen? Alle reacties worden ook verwijderd!")) 
	{
		
		
		var strURL="http://atle.isonthemove.com/ajax/delete_chapter/"+chapter_id;
		
		var target = document.getElementById('chapter_overview');
		
		target.innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader.gif" style="margin-top: 200px; margin-left: 200px">';
		
		var req = GetXmlHttpObject();
		if (req)
		{
			req.onreadystatechange = function()
			{
				if (req.readyState == 4)
				{
					// only if ok
					if (req.status == 200)
					{
						target.innerHTML = req.responseText;
					}
					else
					{
						alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}
	
	}
}


function showmorepics(album_id, mode)
{
	
	var strURL="http://atle.isonthemove.com/ajax/showmorepics/"+album_id+"&mode="+mode;
	
	var target = document.getElementById('fototabel');
	
	target.innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader.gif" style="margin-top: 20px; margin-left: 200px">';
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					target.innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function toggle_picstory(pic_id)
{
	if(document.getElementById(pic_id).className == '' || document.getElementById(pic_id).className == 'none'  )
	{
		document.getElementById(pic_id).className = 'pic_selected';
		var new_status = 'selected'
	}
	else
	{	
		document.getElementById(pic_id).className = 'none';
		var new_status = 'unselected'
	}
	
	var strURL="http://atle.isonthemove.com/ajax/select_pics/"+pic_id+"/"+new_status;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}

function toggle_picslideshow(pic_id)
{
	if(document.getElementById(pic_id).className == '' || document.getElementById(pic_id).className == 'none'  )
	{
		document.getElementById(pic_id).className = 'pic_selected';
		var new_status = 'selected'
	}
	else
	{	
		document.getElementById(pic_id).className = 'none';
		var new_status = 'unselected'
	}
	
	var strURL="http://atle.isonthemove.com/ajax/toggle_pics_slideshow/"+pic_id+"/"+new_status;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}


function show_example(show_wysiwyg)
{
	var xmlHttp = GetXmlHttpObject();

	xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/show_preview', true);
	
	xmlHttp.onreadystatechange = function()
	{	
		if(xmlHttp.readyState==4)
		{			
			showLayer('example', '550')
			document.getElementById('example').innerHTML = xmlHttp.responseText;
			window.scrollTo(0,0) 
		}	

	}	
	
	title = document.getElementById('title').value;
	title = title.replace(/&/g, '-en-');
	
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	xmlHttp.send('title=' + title + '&dag='+ document.getElementById('day').value + '&maand='+ document.getElementById('month').value + '&jaar='+ document.getElementById('year').value);	


}

function show_example_new(show_wysiwyg)
{
	var xmlHttp = GetXmlHttpObject();

	xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/show_example_new', true);
	
	xmlHttp.onreadystatechange = function()
	{	
		if(xmlHttp.readyState==4)
		{			
			showLayer('example', '550')
			document.getElementById('example').innerHTML = xmlHttp.responseText;
			window.scrollTo(0,0) 
		}	

	}	
	
	title = document.getElementById('title').value;
	title = title.replace(/&/g, '-en-');
	
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	xmlHttp.send('title=' + title + '&dag='+ document.getElementById('day').value + '&maand='+ document.getElementById('month').value + '&jaar='+ document.getElementById('year').value);	


}



addEvent('changetripdes', 'submit', change_trip_description, false);	


function change_trip_description(trip_id, e) { 	

	knackerEvent(e);
	
	var textarea = 'trip_description_'+ trip_id;
	var textarea_value = document.getElementById(textarea).value;


	var xmlHttp = GetXmlHttpObject();

	xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/change_trip_title/', true);
	
	xmlHttp.onreadystatechange = function()
	{	
		if(xmlHttp.readyState==4)
		{			
			hide('trip_des_' + trip_id ); 
			show('des_' + trip_id ); 
			document.getElementById('des_' + trip_id).innerHTML = xmlHttp.responseText;
		}	
	}	
	
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	xmlHttp.send('trip_id=' + trip_id + '&title=' + textarea_value );	
}


function move_story(story_id, direction)
{
	
	var strURL="http://atle.isonthemove.com/ajax/move_story/"+story_id+ "/m" + direction;
	
	var target = document.getElementById('story_overview');
	
	target.innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader.gif" style="margin-top: 200px; margin-left: 200px">';
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					target.innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function delete_pic(pic_id)
{
	if (confirm("Are you sure?")) 
	{
	
		var strURL="http://atle.isonthemove.com/ajax/delete_pic/"+pic_id;
		
		var req = GetXmlHttpObject();
		if (req)
		{
			req.onreadystatechange = function()
			{
				if (req.readyState == 4)
				{
					// only if ok
					if (req.status == 200)
					{
						hide('pic_row_'+pic_id);
					}
					else
					{
						alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}
	}
}


function select_view_album(album_id)
{

	if(album_id != '')
	{
		var strURL="http://atle.isonthemove.com/ajax/select_album/"+album_id;
		

		var target = document.getElementById('pic_overview');
		
		target.innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader-large.gif" style="margin-top: 200px; margin-left: 200px">';
		
		var req = GetXmlHttpObject();
		if (req)
		{
			req.onreadystatechange = function()
			{
				if (req.readyState == 4)
				{
					// only if ok
					if (req.status == 200)
					{
						target.innerHTML = req.responseText;
					}
					else
					{
						alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}
	}

}


function show_my_reactions(show)
{
	
	var strURL="http://atle.isonthemove.com/ajax/show_reactions/"+show;
	
	var req = GetXmlHttpObject();
	
	document.getElementById('reactions').innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader.gif" style="margin-top: 200px; margin-left: 200px">';


	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('reactions').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}

}

function delete_reaction(reaction_id)
{
	if (confirm("Are you sure?")) 
	{
	
		var strURL="http://atle.isonthemove.com/ajax/delete_reaction/"+reaction_id;
		
		var req = GetXmlHttpObject();
		if (req)
		{
			req.onreadystatechange = function()
			{
				if (req.readyState == 4)
				{
					if (req.status == 200)
					{
						document.getElementById('reaction_'+ reaction_id).innerHTML = req.responseText;
					}
					else
					{
						alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}
	}
}


function show_reply(reaction_id)
{
	showLayer('reaction', 700);
	var strURL="http://atle.isonthemove.com/ajax/fill_reaction_layer/"+reaction_id;
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					//hide('reaction_'+reaction_id);
					document.getElementById('reaction_layer_2').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}

function hidescreen()
{
	hideLayer('reaction')
}

function hidescreen_gb()
{
	hideLayer('gb_reply')
}


function send_reaction_reply(e)
{
	knackerEvent(e);
	
	var text = document.getElementById('reaction').value;
	var to = document.getElementById('to').value;
	var reaction_id = document.getElementById('reaction_id').value;
	var gb = document.getElementById('gb').value;

	var xmlHttp = GetXmlHttpObject();

	xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/reaction_reply', true);
	
	xmlHttp.onreadystatechange = function()
	{	
		if(xmlHttp.readyState==4)
		{			

			if(gb == 1)
			{
				document.getElementById('gb_reply_layer_2').innerHTML = xmlHttp.responseText;
				setTimeout('hidescreen_gb()', '2500');
			}
			else
			{
				document.getElementById('reaction_layer_2').innerHTML = xmlHttp.responseText;
				setTimeout('hidescreen()', '2500');
			}
			
		}	
	}	
	
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	xmlHttp.send('text=' + text + '&to=' + to + '&reaction_id=' + reaction_id + '&gb=' + gb);	
}

addEvent('reaction_reply', 'submit', send_reaction_reply, false);	




function show_my_gb(show)
{
	
	var strURL="http://atle.isonthemove.com/ajax/show_gb/"+show;
	
	var req = GetXmlHttpObject();
	
	document.getElementById('gb').innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader.gif" style="margin-top: 140px; margin-left: 140px">';


	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('gb').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}

}

function delete_gb(reaction_id)
{
	if (confirm("Are you sure?")) 
	{
	
		var strURL="http://atle.isonthemove.com/ajax/delete_gb/"+reaction_id;
		
		var req = GetXmlHttpObject();
		if (req)
		{
			req.onreadystatechange = function()
			{
				if (req.readyState == 4)
				{
					// only if ok
					if (req.status == 200)
					{
						//hide('reaction_'+reaction_id);
						hide('gb_'+ reaction_id);
					}
					else
					{
						alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
					}
				}
			}
			req.open("GET", strURL, true);
			req.send(null);
		}
	}
}


function show_reply_gb(reaction_id)
{
	showLayer('gb_reply', 700);
	var strURL="http://atle.isonthemove.com/ajax/fill_gb_layer/"+reaction_id;
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					//hide('reaction_'+reaction_id);
					document.getElementById('gb_reply_layer_2').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}


function show_skins(type)
{
	var strURL="http://atle.isonthemove.com/ajax/show_skins/"+type;
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					//hide('reaction_'+reaction_id);
					document.getElementById('skins').innerHTML = req.responseText;
					if(type == "all" || type == "all_wizard")
						hide('more_colors');
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}


function select_skin(id)
{
	var strURL="http://atle.isonthemove.com/ajax/select_skin/"+id;
	document.getElementById('skin_'+id).innerHTML = 'Changing skin...';
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					
					document.getElementById('colorstyle').href = req.responseText;
					document.getElementById('skin_' + id).innerHTML = '<a href="javascript: select_skin('+id+')">Choose this skin</a>';
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function change_layout(side)
{
	var strURL="http://atle.isonthemove.com/ajax/change_layout/"+side;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('layoutstatus').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function show_headers(type)
{
	var strURL="http://atle.isonthemove.com/ajax/show_headers/"+type;
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('headers').innerHTML = req.responseText;
					if(type == "all" || type == "all_wizard")
						hide('more_headers');
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function select_header(id)
{
	var strURL="http://atle.isonthemove.com/ajax/select_header/"+id;
	var req = GetXmlHttpObject();
	
	document.getElementById('header_'+id).innerHTML = 'Changing header...one moment please.';
	
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					arr_result = req.responseText.split("----");
					/*
					alert('bg '+ arr_result[0]);
					alert('height '+ arr_result[1]);
					alert('header_id '+ arr_result[2]);
					alert('headerh1 '+ arr_result[3]);
					alert('headersub '+ arr_result[4]);
					*/
					document.getElementById('header').style.background = arr_result[0];
					document.getElementById('header').style.height = arr_result[1];
					document.getElementById('header_'+id).innerHTML = arr_result[2];
					document.getElementById('headerh1').style.color = arr_result[3];
					document.getElementById('headersub').style.color = arr_result[4];
					window.scrollTo(0,0);
				
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function show_preview_reaction()
{
	showLayer('prevreact' ,400);



	var xmlHttp = GetXmlHttpObject();
	xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/show_preview_reaction', true);
	
	xmlHttp.onreadystatechange = function()
	{	
		if(xmlHttp.readyState==4)
		{			
			document.getElementById('prevreact_layer_2').innerHTML = xmlHttp.responseText;
			window.scrollTo(0,0) 
		}	

	}	
	
	var text = document.getElementById('reactie_text').value;
	var name = document.getElementById('reactie_name').value;
	
	var newtext = encodeURIComponent(text);
	newtext = newtext.replace(/&/g, '-en-');
	name = name.replace(/&/g, '-en-');
	
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	xmlHttp.send('text=' + newtext+ '&name='+name );	
	
}


function select_personal_header(type, header)
{
	var strURL="http://atle.isonthemove.com/ajax/select_personal_header/"+header+"/"+type;
	var req = GetXmlHttpObject();
	
	
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					arr_result = req.responseText.split("----");
					document.getElementById('header').style.background = arr_result[0];
					document.getElementById('header').style.height = '170px';
					document.getElementById('headerh1').style.color = '#ffffff';
					document.getElementById('headersub').style.color = '#ffffff';
					window.scrollTo(0,0)
				
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}

function delete_personal_header(type, header)
{
	var strURL="http://atle.isonthemove.com/ajax/delete_personal_header/"+header+"/"+type;
	var req = GetXmlHttpObject();
	
	
	if (req)
	{
		req.onreadystatechange = function()
		{
			if(type == 3)
			{
				history.back(-2);
			}
			else
			{
				if (req.readyState == 4)
				{
					// only if ok
					if (req.status == 200)
					{
						hide('header_'+header);
					}
					else
					{
						alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
					}
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}

function select_package(package_id, user_id)
{
	var strURL="http://atle.isonthemove.com/ajax/select_package/"+package_id + "/" + user_id;
	var req = GetXmlHttpObject();
	
	
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('fotoruimte').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}


function show_overschrijving(package_id, user_id)
{

	var strURL="http://atle.isonthemove.com/ajax/show_overschrijving/"+package_id + "/"+user_id;
	var req = GetXmlHttpObject();
	
	
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('fotoruimte').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
			
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}


function list_packages(user_id)
{
	var strURL="http://atle.isonthemove.com/ajax/list_packages/"+user_id;
	var req = GetXmlHttpObject();
	
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('fotoruimte').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
			
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}

function confirm_overschrijving(package_id)
{

	var xmlHttp = GetXmlHttpObject();
	var text = document.getElementById('text').value;
	var name = document.getElementById('name').value;
	var email = document.getElementById('email').value;
	var user_id = document.getElementById('user_id').value;

	if(email == '')
	{
		alert('Please provide your name');
	}
	else if(name == '')
	{
		alert('Please provide your email');
	}

	else
	{
		xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/confirm_overschrijving/', true);
		
		xmlHttp.onreadystatechange = function()
		{	
			if(xmlHttp.readyState==4)
			{			
				document.getElementById('fotoruimte').innerHTML = xmlHttp.responseText;
			}	
	
		}	
		
		
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
		xmlHttp.send('text=' + text+ '&name='+name+ '&email=' + email + "&package=" + package_id + "&user_id=" + user_id);
	}
}

function confirm_ideal(package_id)
{

	var xmlHttp = GetXmlHttpObject();
	var text = document.getElementById('text').value;
	var name = document.getElementById('name').value;
	var email = document.getElementById('email').value;
	var user_id = document.getElementById('user_id').value;

	if(email == '')
	{
		alert('Please provide your name');
	}
	else if(name == '')
	{
		alert('Please provide your email');
	}

	else
	{
		xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/confirm_ideal/', true);
		xmlHttp.onreadystatechange = function()
		{	
			if(xmlHttp.readyState==4)
			{			
				document.getElementById('fotoruimte').innerHTML = xmlHttp.responseText;
			}	
	
		}	
		
		
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
		xmlHttp.send('text=' + text+ '&name='+name+ '&email=' + email + "&package=" + package_id + "&user_id=" + user_id);
	}
}



function show_ideal(package_id, user_id)
{
	var strURL="http://atle.isonthemove.com/ajax/show_ideal/"+package_id + "/"+user_id;
	var req = GetXmlHttpObject();
	
	
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('fotoruimte').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
			
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}


function loadcontent(page)
{
	var strURL="http://atle.isonthemove.com/ajax/show_content/"+page;
	var req = GetXmlHttpObject();

	document.getElementById('variable_content').innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader-large.gif" style="margin-top: 100px; margin-left: 360px; margin-bottom: 400px">';

	document.getElementById('menu_item_home').className = '';
	document.getElementById('menu_item_fotos').className = '';
	document.getElementById('menu_item_mijn-profiel').className = '';
	//change_ad();
	var kaart = document.getElementById('menu_item_kaart');
	if(kaart)
	{
		document.getElementById('menu_item_kaart').className = '';
	}
	
	var gastenboek = document.getElementById('menu_item_gastenboek');
	if(gastenboek)
	{
		document.getElementById('menu_item_gastenboek').className = '';
	}
	
	var video = document.getElementById('menu_item_video');
	if(video)
	{
		document.getElementById('menu_item_video').className = '';
	}

	document.getElementById('menu_item_'+page).className = 'open';


	
	
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('variable_content').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
			
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
	
}



function mail_password(e)
{
	knackerEvent(e);
	var xmlHttp = GetXmlHttpObject();
	var email = document.getElementById('email_pass').value;
	var user_id = document.getElementById('login_user_id').value;
	if(email == '')
	{
		alert('Je hebt geen e-mail ingevoerd');
	}
	else
	{
		xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/mail_password/', true);
		xmlHttp.onreadystatechange = function()
		{	
			if(xmlHttp.readyState==4)
			{			
				document.getElementById('mail_pass_response').innerHTML = xmlHttp.responseText;
			}	
	
		}	
		
		
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
		xmlHttp.send('email=' + email + '&user_id= '+ user_id);
	}
}


addEvent('mail_password', 'submit_mail_pass', mail_password, false);



function reset_account(user_id)
{
	var xmlHttp = GetXmlHttpObject();

	if(user_id == '')
	{
		alert('Onbekende fout');
	}
	else
	{
		xmlHttp.open("POST", 'http://atle.isonthemove.com/ajax/reset_account/', true);
		xmlHttp.onreadystatechange = function()
		{	
			if(xmlHttp.readyState==4)
			{			
				document.getElementById('reset_info').innerHTML = xmlHttp.responseText;
			}	
		}	
		
		
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
		xmlHttp.send('user_id=' + user_id);
	}
}

function toggle_move_pics(pic_id)
{
	if(document.getElementById('move_pic_'+ pic_id).checked)
	{
		var new_status = 'selected'
	}
	else
	{	
		var new_status = 'unselected'
	}
	
	var strURL="http://atle.isonthemove.com/ajax/select_move_pics/"+pic_id+"/"+new_status;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}


function move_pic_story()
{
	var story_id = document.getElementById('select_story_move').value;
	var strURL="http://atle.isonthemove.com/ajax/move_pic_story/"+story_id;
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					document.getElementById('pic_overview').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}

}

function show_chapters(story_id)
{
	var strURL="http://atle.isonthemove.com/ajax/show_chapters/"+story_id;
	
	var target = document.getElementById('chapter_overview');
	
	target.innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader-large.gif" style="margin-top: 200px; margin-left: 200px">';


	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					target.innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}

}


function change_ad(chapter_id)
{
	if(chapter_id == '')
	{
		chapter_id = 0;
		document.getElementById('ad').src = 'http://www.isonthemove.com/ad.php?site_name=atle';
	}	
	else
	{
		document.getElementById('ad').src = 'http://www.isonthemove.com/ad.php?site_name=atle&chapter_id='+chapter_id;
	}
}


function select_pics_slideshow(new_status)
{


	var strURL="http://atle.isonthemove.com/ajax/select_pics_slideshow/"+new_status;
	
	var target = document.getElementById('fototabel');
	
	target.innerHTML = '<img src="http://www.isonthemove.com/images/ajax-loader-large.gif" style="margin-top: 20px; margin-left: 120px">';

	

	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					target.innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}


function subscribe_me(reaction_id)
{
	var strURL="http://atle.isonthemove.com/ajax/subscribe_me/"+reaction_id;
	
	var target = document.getElementById('mailinglist_subscribe');
	
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{
					target.innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function hide_pic_warning()
{
	hide('pic_warning');
	var strURL="http://atle.isonthemove.com/ajax/hide_pic_warning";
	var req = GetXmlHttpObject();
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				// only if ok
				if (req.status == 200)
				{	
					document.getElementById('pic_warning').innerHTML = req.responseText;
				}
				else
				{
					alert("Oops! The server seems pretty busy, your request could not be handeled. Please try again.." + req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}

