	// JavaScript Document
	
	var index = 0;
	var jobsTitle = "#jobs_title";
	
	$(document).ready(function(){

		// expand/collapse
		$(".expand").click(function(){
			$(this).siblings(".hidden").slideToggle("slow");
			var listitem = $(this).parent().get(0);
			if ( $(listitem).is(".close") ) {
				$(listitem).removeClass("close");
			} else {
				$(listitem).addClass("close");
			}
			return false;
		});
		
		// tabs (werkt, maar pas na opbouwen pagina: geeft hapering op mobile)
		// if ($("#project_1_content")) {
			
			// qs();
			// if (qsParm['p'] == 1) {
				// $("#project_1_content").show();
				// $("#project_2_content").hide();
			// } else if (qsParm['p'] == 2) {
				// $("#project_1_content").hide();
				// $("#project_2_content").show();
			// }
		// }
		
		// jobs
		if ($("#jobs_title").length > 0) {
			
			if (jobs.length > 0 && jobs.length < 2) {
				
				$(jobsTitle).html(jobs[index]);
				
			} else if (jobs.length > 1) {
				
				$(jobsTitle).html(jobs[index]);
				index++;
				
				setTimeout(changeJobTitle,1000);
			}
		}
		
	});
	  
	  
	//scrolldown on load in iphone
	addEventListener("load", function(){ 
		setTimeout(hideURLbar, 0); 
	}, false); 
	
	function hideURLbar(){ 
		window.scrollTo(0, 1); 
	} 

	
	// ready query string
	var qsParm = new Array();

	function qs() {
		
		var query = window.location.search.substring(1);
		var parms = query.split('&');
		
		for (var i=0; i<parms.length; i++) {
			var pos = parms[i].indexOf('=');
			if (pos > 0) {
				var key = parms[i].substring(0,pos);
				var val = parms[i].substring(pos+1);
			qsParm[key] = val;
			}
		}
	} 
	
	// show project
	function showProject(obj) {
		
		objID = $(obj).parent().get(0).id;
		$("#project_1_content").hide();
		$("#project_2_content").hide();
		$("#"+objID+"_content").show();
		
	}
	
	//
	function changeJobTitle() {
		
		if ($(jobsTitle)) {
			
			$(jobsTitle).fadeOut("fast",changeJobTitleNew);
			
		}
	}
	
	//
	function changeJobTitleNew() {
		
		if ($(jobsTitle)) {
		
			$(jobsTitle).html(jobs[index]);
			$(jobsTitle).fadeIn("slow");
			
			index++;
			if (index >= jobs.length) { index = 0; }
			
			setTimeout(changeJobTitle,3000);
		}
	}
	
	function writeEmail(e_mail_account, set_id) {
		var link_string = '<a href="mailto:'+e_mail_account+'@moxio.com"';
		
		if(set_id != false) {
			link_string += ' id="'+set_id+'"';
		}
		
		link_string += '>'+e_mail_account+'@moxio.com</a>';
	
		document.write(link_string);
	}
