
ajaxObject = function() {
  try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch(e){
  try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch(e){
  try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e){
  try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){
  try { return new XMLHttpRequest() } catch(e){
  throw new Error( "This browser does not support XMLHttpRequest." );
}}}}}}

beeAjax = new ajaxObject();

function submitResume(inputID, jobID, student_id){
 	beeAjax.open("GET", "/bee/sendResume.php?beeListingID=" + jobID + "&student_id=" + student_id + "&", false);
    beeAjax.send(null);
    if(beeAjax.responseText == "TRUE"){
    //Input Should be a link
    	inputObj = document.getElementById(inputID);
    	bookmarkObj = document.getElementById(jobID + "_bookmark");
    	if(inputObj.type == "button"){
    		inputObj.value = "Application Sent";
    	} else {
			inputObj.innerHTML = "Application Sent";
		}
		if(bookmarkObj != null){
			if(bookmarkObj.type == "button"){
				bookmarkObj.value = "Bookmarked";
			} else {
				bookmarkObj.innerHTML = "Bookmarked";
			}
			bookmarkObj.disabled = true;			
		}
		inputObj.disabled = true;

	} else {
		var beeAjax_response_text = "<span style=\"color: white;\">" + beeAjax.responseText + "</span>";
		if(window.bee_json){
			alert(beeAjax.responseText.replace(/<br\/>/gi, "\n"));
		} else {
			tb_remove();
			setTimeout("tb_show('Error' , '/showerror_thickbox.php?message=" + beeAjax_response_text +"&TB_iframe=true&height=100&width=200','false')", 500);
		}
	}    
}
function bookmarkJob(inputID, jobID){
 	beeAjax.open("GET", "/bee/bookmarkjoblisting.php?beeListingID=" + jobID + "&", false);
    beeAjax.send(null);
    if(beeAjax.responseText == "TRUE"){
    //Input Should be a link
    	inputObj = document.getElementById(inputID);
    	if(inputObj.type == "button"){
    		inputObj.value = "Bookmarked";
    	} else {
			inputObj.innerHTML = "Bookmarked";
		}
		inputObj.disabled = true;
	} else {
		
		var beeAjax_response_text = "<span style=\"color: white;\">" + beeAjax.responseText + "</span>";
		if(window.bee_json){
			alert(beeAjax.responseText.replace(/<br\/>/gi, "\n"));
		} else {
			tb_remove();
			setTimeout("tb_show('Error' , '/showerror_thickbox.php?message=" + beeAjax_response_text +"&TB_iframe=true&height=100&width=200','false')", 500);
		}
	}    
}

function acceptJobOffer(inputID, jobID){
 	beeAjax.open("GET", "/bee/acceptJobOffer.php?beeListingID=" + jobID + "&", false);
    beeAjax.send(null);
    if(beeAjax.responseText == "TRUE"){
    //Input Should be a link
    	inputObj = document.getElementById(inputID + "_accept");
    	inputObj2 = document.getElementById(inputID + "_reject");
    	if(inputObj2 != null){
	    	inputObj2.style.display = "none";
	    	inputObj2.disabled = "disabled";
    	}

    	if(inputObj.type == "button"){
    		inputObj.value = "Accepted";
    	} else {
			inputObj.innerHTML = "Accepted";
		}
		inputObj.disabled = true;
	} else {
	
		var beeAjax_response_text = "<span style=\"color: white;\">" + beeAjax.responseText + "</span>";
		if(window.bee_json){
			alert(beeAjax.responseText.replace(/<br\/>/gi, "\n"));
		} else {
			tb_remove();
			setTimeout("tb_show('Error' , '/showerror_thickbox.php?message=" + beeAjax_response_text +"&TB_iframe=true&height=100&width=200','false')", 500);
		}
	}    
}

function rejectJobOffer(inputID, jobID){
 	beeAjax.open("GET", "/bee/rejectJobOffer.php?beeListingID=" + jobID + "&", false);
    beeAjax.send(null);
    if(beeAjax.responseText == "TRUE"){
    //Input Should be a link
    	inputObj = document.getElementById(inputID + "_reject");
    	inputObj2 = document.getElementById(inputID + "_accept");
    	if(inputObj2 != null){
	    	inputObj2.style.display = "none";
	    	inputObj2.disabled = "disabled";
    	}
    	if(inputObj.type == "button"){
    		inputObj.value = "Withdrawn";
    	} else {
			inputObj.innerHTML = "Withdrawn";
		}
		inputObj.disabled = true;
	} else {
		
		var beeAjax_response_text = "<span style=\"color: white;\">" + beeAjax.responseText + "</span>";
		if(window.bee_json){
			alert(beeAjax.responseText.replace(/<br\/>/gi, "\n"));
		} else {
			tb_remove();
			setTimeout("tb_show('Error' , '/showerror_thickbox.php?message=" + beeAjax_response_text +"&TB_iframe=true&height=100&width=200','false')", 500);
		}
	}    
}


