// JavaScript Document
function clear1(){
	var t = document.getElementById('username');
    t.value = '';
}

function clear2(){
	var t = document.getElementById('password');
    t.value = '';
}

function topmenus(a){
	window.location=a;
} 

function newindow(a){
	window.open(a);
}

function formload(a){
	mywindow = window.open("jobForm.php?account="+a,"mywindow","location=1,status=1,scrollbars=1,width=700,height=680");
    mywindow.moveTo(300, 200);
}

function prevnxt(a){
	var pags = a;
	var k = document.getElementById('key').value;
	var o = document.getElementById('option').value;
	var c = document.getElementById('cat').value;
	param = pags+'|'+k+'|'+o+'|'+c;
	swoosh(param,'paginationSearchresult.php','searchResult');
}	

function resources(a){
	param = "id="+a;
	Ajax_Send("POST","resourceslist.php",param,show);	
}

function show(data){
	document.getElementById('down'+param).innerHTML = data;
	document.getElementById('down'+param).style.display=(document.getElementById('down'+param).style.display== 'block')?'none':'block';
}

function formloadresources(a){
	mywindow = window.open("downloadform.php?h="+a,"mywindow","location=1,status=1,scrollbars=1,width=570,height=350");
    mywindow.moveTo(300, 300);
}

function downloadform(a){
	nam = document.getElementById("name").value;
	emal = document.getElementById("email").value;
	phon = document.getElementById("phone").value;
	compname = document.getElementById("companyname").value;
	poction = document.getElementById("position").value;
	addres = document.getElementById("add").value;
	
	if(nam=="" || emal=="" || phon=="" || compname=="" ){
		alert('Fill up the important information (*).');
	}else{
		info = a+'|'+nam+'|'+emal+'|'+phon+'|'+compname+'|'+poction+'|'+addres;
		swoosh(info,'downloadform.php','downloadform');
	}
}

function saveEditPass(a){
	c = document.getElementById("cPass").value;
	n = document.getElementById("nPass").value;
	cn = document.getElementById("cnPass").value;
	if(n==cn){
	pass = a+'|'+c+'|'+n+'|'+cn;
	swoosh(pass,'saveInfo.php','savePass');
	}else{
		alert('Check your new password.');
	}
}

function currentPass(a){
	c = document.getElementById("cPass").value;
	if(c==''){
		alert('Enter your current password.');
	}else{
		pass = a+'|'+c;
		swoosh(pass,'saveInfo.php','checkPass');
	}
}

function alphaPage(a){
	param = "page="+a;
	Ajax_Send("POST","pdi_administrator_page/admin_contents/resumePagination.php",param,showAlpha);	
}

function showAlpha(data){
	document.getElementById('alphabet').innerHTML = data;
}
	
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function prevnext(a){
	param = "limit="+a;
	Ajax_Send("POST","gallerylist.php",param,nextlist);
}

function nextlist(data){
	document.getElementById('down').innerHTML = data;
}

function gall(a){
	param = "img="+a;
	Ajax_Send("POST","gallerylist.php",param,bigp);
}

function bigp(data){
	document.getElementById('gal').innerHTML = data;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function jobcat(a){
	param = "id="+a;
	Ajax_Send("POST","jobapplicantlist.php",param,applist);	
}

function applist(data){
	document.getElementById('down'+param).innerHTML = data;
	document.getElementById('down'+param).style.display=(document.getElementById('down'+param).style.display== 'block')?'none':'block';
}

function updatejobpostinglist(a){
	del = a.split('|');
	cnfrm = del[0];
	if (cnfrm == 'delete'){
		var agree=confirm("Are you sure you want to job post?");
		if (agree){
			 param = "id="+a;
			 Ajax_Send("POST","jobpostlist.php",param,updatelist);	
		}else{
			 close();
		}
	}else{
		mywindow = window.open("updatejobpost.php?id="+a,"mywindow","status=1,scrollbars=1,width=800,height=800");
    	mywindow.moveTo(200, 100);
		//param = "id="+a;
		//Ajax_Send("POST","jobpostlist.php",param,updatelist);
	}
}

function updatelist(data){
	document.getElementById('currentjob').innerHTML = data;
}

function saveupdatedjobpost(a){
	tag = a.split('|');
	cnfrm = tag[0];
	if (cnfrm == 'cancel'){
		close();
	}else{
		jobname = document.getElementById("jobTitle").value;
		jobtype = document.getElementById("jobType").value;
		jobcat = document.getElementById("jobCat").value;
		jobloc = document.getElementById("jobLocation").value;
		jobind = document.getElementById("workIndustry").value;
		jobq = document.getElementById("jobQual").value;
		jobr = document.getElementById("jobRes").value;
		jobi = document.getElementById("jobInfo").value;
		jobc = document.getElementById("jobComp").value;
		jobsd = document.getElementById("jobSdate").value;
		jobn = document.getElementById("jobNum").value;
		jobe = document.getElementById("jobEduc").value;
		jobf = document.getElementById("Femail").value;
		label = a;
		param = 'id='+label+'|'+jobname+'|'+jobtype+'|'+jobcat+'|'+jobloc+'|'+jobind+'|'+jobq+'|'+jobr+'|'+jobi+'|'+jobc+'|'+jobsd+'|'+jobn+'|'+jobe+'|'+jobf;
		Ajax_Send("POST","jobpostlist.php",param,savejob);
	}
}

function savejob(data){
	document.getElementById('jobpostupdate').innerHTML = data;
}

var rotatingTextElement;
var rotatingTextElementsem;
var rotatingText = new Array();
var rotatingTextsem = new Array();
var ctr = 0;
var ctrsem = 0;
		
function initRotateTextsem() {
	rotatingTextElementsem = document.getElementById("textToChangesem");
	totalsem = document.getElementById("allsem").value;
	rotatingTextsem[0] = rotatingTextElementsem.innerHTML; // store the content that's already on the page
	for (xx=1;xx<=totalsem;xx++){
	textlistsem = document.getElementById("semlist"+xx).value;
	rotatingTextsem[xx] = textlistsem;
	}
	setInterval(rotateTextsem, 6000);
}
function rotateTextsem() {
	ctrsem++;
		if(ctrsem >= rotatingTextsem.length) {
		ctrsem = 0;
		}
		rotatingTextElementsem.innerHTML = rotatingTextsem[ctrsem];
		}
	
function initRotateText() {
	rotatingTextElement = document.getElementById("textToChange");
	total = document.getElementById("all").value;
	rotatingText[0] = rotatingTextElement.innerHTML; // store the content that's already on the page
	for (x=1;x<=total;x++){
	textlist = document.getElementById("feadlist"+x).value;
	rotatingText[x] = textlist;
	}
	setInterval(rotateText, 15000);
}
function rotateText() {
	ctr++;
		if(ctr >= rotatingText.length) {
		ctr = 1;
		}
		rotatingTextElement.innerHTML = rotatingText[ctr];
		}
	
function twoonload(){
	initRotateText();
	initRotateTextsem();
}

//window.onload = twoonload;

function catlist(a){
	window.location="careerCenterJobBoard.php?h="+a;
}

////////////////////////////////////////HOW DID YOU HEAR US//////////////////////////
function rdio(){
	ttal = document.getElementById("total").value;
	thow = document.getElementById("otherhow");
	 for (x=1;x<=ttal;x++){
		txt = document.getElementById("how"+x);
		if(txt.checked==true){
			txt.checked = false;
			thow.checked=true;
		}
		if(txt.checked==false){
			w = document.getElementById("otherhow");
			w.checked = true;
		}
	 } 
}
	
function submitna(){
	ttal = document.getElementById("total").value;
	txtinfo = document.getElementById("otherinfo").value;
	if (txtinfo==''){
		for (x=1;x<=ttal;x++){
		txt = document.getElementById("how"+x);
			if(txt.checked==true){
				nohowdid = document.getElementById("how"+x).value;
			}
		}
		emailadd = document.getElementById("eadd").value;
		if(emailadd==''){
			alert('Enter your email address.');
		}else{
			txtinfo = '';
			param = 'info='+nohowdid+'|'+emailadd+'|'+txtinfo;
			Ajax_Send("POST","howdid.php",param,savehow);
		}
	}else{
		txtinfo = document.getElementById("otherinfo").value;
		emailadd = document.getElementById("eadd").value;
		
		if(emailadd==''){
			alert('Enter your email address.');
		}else{
			nohowdid = '8';
			param = 'info='+nohowdid+'|'+emailadd+'|'+txtinfo;
			Ajax_Send("POST","howdid.php",param,savehow);
		}
	}
}

function savehow(data){
	document.getElementById('showresult').innerHTML = data;
}

function cleartxt(){
	txtinfo = document.getElementById("otherinfo");
	txtinfo.value = '';
}

function assessement(){
	mywindow = window.open('http://www.testing.assessmentcenter.ph?fdcheck=1','ACSite','status=0,toolbar=0,menubar=0,directories=0,resizable=0,fullscreen=yes,scrollbars=1');
}
