function getresponse(url){
	var xmlHttp;
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e)
	{
		// Internet Explorer
		try
			{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		catch (e)
			{
			try
				{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
			catch (e)
				{
				alert("This script requires AJAX to run.  Press OK to be automatically redirected to a non-AJAX version of this page.");
				location.href='?noajax=true';
				return false;
				}
			}
	}
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			document.getElementById('ajax_response').innerHTML=xmlHttp.responseText;
		}else{
			document.getElementById('ajax_response').innerHTML='<h3>Loading...</h3>';
		}
	}
	url='response.php?'+url+'&filter='+checkboxvalue('job')+checkboxvalue('type')+checkboxvalue('technologies');
	xmlHttp.open("get",url,true);
	xmlHttp.send(null);
}

function checkboxvalue(id){
	value='';
	if(document.getElementById(id).className=='selected'){
		input=document.f1[id];
		for(i=0;i<input.length;i++){
			if(input[i].checked) {
				value+=input[i].value+',';
			}
		}
	}
	return value;
}

function nothing(){
}


function showdiv(id){
	document.getElementById(id).style.display='block';
}

arrCurrentImg=new Array();
function changeImg(id,dir){
	if(arrCurrentImg[id]==undefined) arrCurrentImg[id]=0;
	arrCurrentImg[id]+=dir;
	if(arrCurrentImg[id]<0) arrCurrentImg[id]=arrImgs[id].length-1;
	if(arrCurrentImg[id]>=arrImgs[id].length) arrCurrentImg[id]=0;
	document.getElementById('item'+id).style.backgroundImage='url(images/'+arrImgs[id][arrCurrentImg[id]]+')';
}

//initialize
selected=null;
mouseout=null;
arrfilters=new Array('job','type','technologies','all');
for(i=0;i<arrfilters.length;i++){
	document.getElementById(arrfilters[i]).onmouseover=function(){
		this.className='selected';
		if(selected!=null && selected!=this.id) document.getElementById(selected).className=''
		mouseout=null;
	}
	/*document.getElementById(arrfilters[i]+'_link').onclick=function(){
		this.className='selected';
		selected=this.id;
	}*/
	document.getElementById(arrfilters[i]).onmouseout=function(){
		if(selected!=this.id) this.className='';
		if(selected!=null) document.getElementById(selected).className='selected';
		mouseout=this.id;
	}
	input=document.f1[arrfilters[i]];
	if(input!=undefined){
		for(j=0;j<input.length;j++){
			if(input[j]!=undefined){
				input[j].onclick=function(){
					getresponse('response.php');
				}
			}
		}
	}
}
document.onclick=function(){
	if(mouseout!=null){
		document.getElementById(mouseout).className='';
		selected=null;
	}
}
