function apply_for_job(jobid,uid,ugroup,jobtitle) 
{
	var url = "../index_server.php";
	var myRequest = new ajaxObject(url, apply_for_job_status);
	var POSTDATA="action=apply_for_job"+"&jobid="+encodeURIComponent(jobid)+"&uid="+encodeURIComponent(uid)+"&ugroup="+encodeURIComponent(ugroup)+"&jobtitle="+encodeURIComponent(jobtitle);
    myRequest.update(null, POSTDATA, 'post');	
}

function apply_for_job_status(responseText, responseStatus, responseXML, divid)
{
	if (responseStatus == 200) 
	{
		
		alert(responseText);
	} 
	else 
	{
		alert(responseStatus);
	}		
}

function index_job_search(keyword,location,httproot)
{
	
	var key = keyword.value;
	var loc = location.value;
	if(key=="Enter the search keyword here" || key=="") key="default";
	if((key != "default") || (loc != "default"))
	{window.location=httproot+"/search/index.php?keyword="+encodeURIComponent(key)+"&location="+encodeURIComponent(loc);}
}

function checkEnterPressed(e,keyword,location,httproot)
{
	var Ucode=e.keyCode? e.keyCode : e.charCode
    if (Ucode == 13)
    {
		index_job_search(keyword,location,httproot);
		return false;
    }
}
////////////////////////////////////////////////////////////////////
function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value==""||value=="<br>")
		{document.getElementById(alerttxt).style.color="#ff0000";return false}
	else 
		{document.getElementById(alerttxt).style.color="#000000";return true}
	}
}
/////////////////////////////////////////////////////////////////////
function send_testimonial_mail(thisform) 
{
	with(thisform)
	{
	var name=thisform.name_inp.value;
	var college=thisform.college_inp.value;
	var testimonial=thisform.testi_txtarea.value;
	
	if (validate_required(name_inp,"name_txt")==false)
  		{name_inp.focus();return false}
		
		if (validate_required(college_inp,"col_txt")==false)
  		{college_inp.focus();return false}
		
		if (validate_required(testi_txtarea,"testi_txt")==false)
  		{testi_txtarea.focus();return false}
		
		var url = "index_server.php";
		var myRequest = new ajaxObject(url, send_testimonial_mail_status);
		var POSTDATA="action=send_testimonial_mail"+"&name="+encodeURIComponent(name)+"&college="+encodeURIComponent(college)+"&testimonial="+encodeURIComponent(testimonial);
		myRequest.update('testimonials_center', POSTDATA, 'post');	
		
	}
}

function showForm() 
{
	var url = "index_server.php";
	var myRequest = new ajaxObject(url, send_testimonial_mail_status);
	var POSTDATA="action=showForm";
    myRequest.update('testimonials_center', POSTDATA, 'post');	
}


function send_testimonial_mail_status(responseText, responseStatus, responseXML, divid)
{
	if (responseStatus == 200) 
	{
		document.getElementById(divid).innerHTML=responseText;	
		//alert(responseText);
	} 
	else 
	{
		alert(responseStatus);
	}		
}
function get_testimonial(lower,higher) 
{
	var url = "index_server.php";
	var myRequest = new ajaxObject(url, send_testimonial_mail_status);
	var POSTDATA="action=get_testimonial&lower="+encodeURIComponent(lower)+"&higher="+encodeURIComponent(higher);
    myRequest.update('testimonials', POSTDATA, 'post');	
}
function events_links1(uid,divid,page)
{
		var url = "index_server.php";
		var myRequest = new ajaxObject(url, send_testimonial_mail_status);
var POSTDATA="action=events_links1&uid="+encodeURIComponent(uid)+"&divid="+encodeURIComponent(divid)+"&page="+encodeURIComponent(page);
		myRequest.update(divid, POSTDATA, 'post');
}

function topjobs_links(uid,divid,page)
{
		var url = "index_server.php";
		var myRequest = new ajaxObject(url, send_testimonial_mail_status);
var POSTDATA="action=topjobs_links&uid="+encodeURIComponent(uid)+"&divid="+encodeURIComponent(divid)+"&page="+encodeURIComponent(page);
		myRequest.update(divid, POSTDATA, 'post');
}

function bothevents_links1(uid,divid,page)
{
		var url = "index_server.php";
		var myRequest = new ajaxObject(url, send_testimonial_mail_status);
var POSTDATA="action=bothevents_links1&uid="+encodeURIComponent(uid)+"&divid="+encodeURIComponent(divid)+"&page="+encodeURIComponent(page);
		myRequest.update(divid, POSTDATA, 'post');
}
function vote_index_poll(pollid,uid,ugroup,httproot)
{
	if(ugroup==2)
	{
		//alert(pollid+"-"+uid);
		var flag=false;
		for (var i=0; i < document.campus_polls.answer_select.length; i++)
   			{
			   if (document.campus_polls.answer_select[i].checked)
			   {
      				var answer = document.campus_polls.answer_select[i].value;
					flag=true;
			   }
		   }		
			//createRequest();		
			if(flag)
			{
				var url = "index_server.php";
				var myRequest = new ajaxObject(url, send_testimonial_mail_status);
		var POSTDATA="action=vote_index_poll&uid="+encodeURIComponent(uid)+"&pollid="+encodeURIComponent(pollid)+"&answer="+encodeURIComponent(answer);
				myRequest.update('campus_poll', POSTDATA, 'post');
			}
			else
			{//alert("Please select an option.");
			document.getElementById('err_txt_poll').innerHTML="Please select an option.";}
		
	}
	else
		if(ugroup==0)
		{
			//alert("Please Login to vote."+httproot);	
			window.location=httproot+"/generic_login.php";
		}
		else		
			{
				//alert("Only a Candidate can vote.");	
				document.getElementById('err_txt_poll').innerHTML="Only a Candidate can vote.";
			}
}

