if (document.images)
{
	img1_on = new Image();
	img1_off = new Image();
	img1_grey = new Image();
	img1_on.src = "images/basic-glow.jpg";
	img1_off.src = "images/basic-white.jpg";
	img1_grey.src = "images/basic-grey.jpg";
	
	img2_on = new Image();
	img2_off = new Image();
	img2_grey = new Image();
	img2_on.src = "images/advanced-glow.jpg";
	img2_off.src = "images/advanced-white.jpg";
	img2_grey.src = "images/advanced-grey.jpg";
}

function out(k) {
	if (document.images) {
		if (document.getElementById('type').value == 1) {
			if (k == 2) {
				eval('document.img2.src=img2_grey.src');
			}
		}
		else {
			if (k == 1) {
				eval('document.img1.src=img1_grey.src');
			}
		}
	}
}

function over(k) {
	if (document.images) {
		if (document.getElementById('type').value == 1) {
			if (k == 2) {
				eval('document.img2.src=img2_off.src');
			}
		}
		else {
			if (k == 1) {
				eval('document.img1.src=img1_off.src');
			}
		}
	}
}

function clicked(k) {
	if (document.images) {
		if (k == 1) {
			eval('document.img1.src=img1_on.src');
			eval('document.img2.src=img2_grey.src');
			Element.show('basic');
			Element.hide('advanced');
			document.getElementById('type').value = 'basic';
		}
		else {
			eval('document.img2.src=img2_on.src');
			eval('document.img1.src=img1_grey.src');
			Element.show('advanced');
			Element.hide('basic');
			document.getElementById('type').value = 'advanced';
		}
	}
}

function showSearchForm()
{
	Element.hide('searchContent');
	Element.show('searchForm');
}

function searchLocation(city, state) {
	/* hide search form, show search content */
	Element.hide('searchForm');
	Element.show('searchContent');
	
	/* set text to a loading box */
	$('searchContent').innerHTML = '<img src="images/loading.gif" border="0"> Loading...';

	/* add ajax request to the end of defined url variable */
	var url = 'search_ajax.php?type=location';

	/* make the ajax request for the information */
	new Ajax.Request(url, {
		method: 'post',
		parameters: 'city=' + city + '&state=' + state,
		onSuccess: function(xhrResponse) {
			$('searchContent').innerHTML = xhrResponse.responseText;
		},
		onFailure: function(xhrResponse) {
			$('searchContent').innerHTML = 'Error: ' + xhrReponse.statusText;
		}
	});
}

function openHelp(id)
{
	Element.show('category_' + id);
}

function closeHelp(id)
{
	Element.hide('category_' + id);
}

function saveSearch(keywords, location, category) {
	/* set text to a loading box */
	$('save_a_search').innerHTML = '<img src="images/loading.gif" border="0"> Loading...';

	/* add ajax request to the end of defined url variable */
	var url = 'search_ajax.php?type=save_search';

	/* make the ajax request for the information */
	new Ajax.Request(url, {
		method: 'post',
		parameters: 'keywords=' + keywords + '&location=' + location + '&category=' + category,
		onSuccess: function(xhrResponse) {
			$('save_a_search').innerHTML = xhrResponse.responseText;
		},
		onFailure: function(xhrResponse) {
			$('save_a_search').innerHTML = 'Error: ' + xhrReponse.statusText;
		}
	});
}

function removeResume(id) {
	/* set text to a loading box */
	$('resume').innerHTML = '<img src="images/loading.gif" border="0"> Loading...';

	/* add ajax request to the end of defined url variable */
	var url = 'members_ajax.php?type=drop_resume';

	/* make the ajax request for the information */
	new Ajax.Request(url, {
		method: 'post',
		parameters: 'id=' + id,
		onSuccess: function(xhrResponse) {
			$('resume').innerHTML = xhrResponse.responseText;
		},
		onFailure: function(xhrResponse) {
			$('resume').innerHTML = 'Error: ' + xhrReponse.statusText;
		}
	});
}

function removeMySearch(id) {
	/* set text to a loading box */
	$('removeMySearch').innerHTML = '<img src="images/loading.gif" border="0"> Loading...';

	/* add ajax request to the end of defined url variable */
	var url = 'search_ajax.php?type=remove_my_search';
	
	/* make the ajax request for the information */
	new Ajax.Request(url, {
		method: 'post',
		parameters: 'id=' + id,
		onSuccess: function(xhrResponse) {
			/* remove the saved search */
			Element.remove('my_search_' + id);
			
			$('removeMySearch').innerHTML = xhrResponse.responseText;
		},
		onFailure: function(xhrResponse) {
			$('removeMySearch').innerHTML = 'Error: ' + xhrReponse.statusText;
		}
	});
}

function removePosting(id) {
	/* set text to a loading box */
	$('removePosting').innerHTML = '<img src="images/loading.gif" border="0"> Loading...';

	/* add ajax request to the end of defined url variable */
	var url = 'posting_ajax.php?type=remove_posting';
	
	/* make the ajax request for the information */
	new Ajax.Request(url, {
		method: 'post',
		parameters: 'id=' + id,
		onSuccess: function(xhrResponse) {
			/* remove the saved search */
			Element.remove('posting_' + id);
	
			$('removePosting').innerHTML = xhrResponse.responseText;
		},
		onFailure: function(xhrResponse) {
			$('removePosting').innerHTML = 'Error: ' + xhrReponse.statusText;
		}
	});
}

function applyForJob(id) {
	/* set text to a loading box */
	$('apply_for_job').innerHTML = '<img src="images/loading.gif" border="0"> Loading...';

	/* add ajax request to the end of defined url variable */
	var url = 'posting_ajax.php?type=apply';
	
	/* make the ajax request for the information */
	new Ajax.Request(url, {
		method: 'post',
		parameters: 'id=' + id,
		onSuccess: function(xhrResponse) {
			$('apply_for_job').innerHTML = xhrResponse.responseText;
		},
		onFailure: function(xhrResponse) {
			$('apply_for_job').innerHTML = 'Error: ' + xhrReponse.statusText;
		}
	});
}

function removeJob(id) {
	/* set text to a loading box */
	$('removeJob').innerHTML = '<img src="images/loading.gif" border="0"> Loading...';

	/* add ajax request to the end of defined url variable */
	var url = 'profile_ajax.php?type=remove_job';
	
	/* make the ajax request for the information */
	new Ajax.Request(url, {
		method: 'post',
		parameters: 'id=' + id,
		onSuccess: function(xhrResponse) {
			/* remove the job */
			Element.remove('job_' + id);
			
			$('removeJob').innerHTML = xhrResponse.responseText;
		},
		onFailure: function(xhrResponse) {
			$('removeJob').innerHTML = 'Error: ' + xhrReponse.statusText;
		}
	});
}

function updateStatus(id) {
	/* add ajax request to the end of defined url variable */
	var url = 'posting_ajax.php?type=update_status';
	
	/* make the ajax request for the information */
	new Ajax.Request(url, {
		method: 'post',
		parameters: 'id=' + id
	});
}

function multipleCities() {
	Element.hide('single_city');
	Element.show('multiple_cities');
	
	Element.hide('multi_link');
	Element.show('single_link');
}

function singleCity() {
	Element.hide('multiple_cities');
	Element.show('single_city');
	
	Element.hide('single_link');
	Element.show('multi_link');
	
	document.getElementById('multisingle').value = 1;
}

function populateMultiple(cities, compensation, compensation_rate, compensation_different) {
	/* set text to a loading box */
	$('multiple_cities').innerHTML = '<img src="images/loading.gif" border="0"> Loading...';
	
	document.getElementById('multisingle').value = 2;

	/* add ajax request to the end of defined url variable */
	var url = 'posting_ajax.php?type=populate_cities';
	
	/* make the ajax request for the information */
	new Ajax.Request(url, {
		method: 'post',
		parameters: 'cities=' + cities + '&compensation=' + compensation + '&compensation_rate=' + compensation_rate + '&compensation_different=' + compensation_different,
		onSuccess: function(xhrResponse) {
			$('multiple_cities').innerHTML = xhrResponse.responseText;
		},
		onFailure: function(xhrResponse) {
			$('multiple_cities').innerHTML = 'Error: ' + xhrReponse.statusText;
		}
	});
}
function confirmBox(message, link)
{
	var answer = confirm(message);
	if ( answer )
	{
		parent.window.location.href = link;
	}
}
