
// for ajax caling
function refreshContent() {
	loadContent();	
	setInterval("loadContent()", 20000);
}	

function loadContent() {		
	if(document.getElementById("center_content")) {		
		var url = "center_home.jsp" + "?t=" + (new Date()).getTime();						
		loadResponse("center_content", url, "GET", init); 
	}
}	


function loadInsideContent(divid, url) {
	if(document.getElementById(divid)) {				
		loadResponse(divid, url, "GET", null); 
	}
}

// end of ajax caling

// show-hide script for tender and career
function showContent(vThis)
{
vParent = vThis.parentNode;
vSibling = vParent.nextSibling;
while (vSibling.nodeType==3) { // Fix for Mozilla/FireFox Empty Space becomes a TextNode or Something
vSibling = vSibling.nextSibling;
};
if(vSibling.style.display == "none")
{
vThis.src="img/collapse.gif";
vThis.alt = "Hide Div";
vSibling.style.display = "block";
} else {
vSibling.style.display = "none";
vThis.src="img/expand.gif";
vThis.alt = "Show Div";
}
return;
}

// end of show-hide script for tender and career

// submit form for tentative vacancy, 10th RLST
function validateSchoolsChooseForm(){
	
	if(document.atpheduVac.medium.selectedIndex==0){
		alert("Please select a medium");
		return false;
	}
	else if(document.atpheduVac.schooltype.selectedIndex==0){
		alert("Please select a school type");
		return false;
	}	
	else if(document.atpheduVac.category.selectedIndex==0){
		alert("Please select a category");
		return false;
	}	
	
	else { 
		document.getElementById("loadingSchool").innerHTML= "<img src='images/indicator.gif'>";
		return true;
	}	

	
	}

function validateBankForm(){
	
	if(document.atVac.region.selectedIndex==0){
		alert("Please select a Region");
		return false;
	}
	else if(document.atVac.district.selectedIndex==0){
		alert("Please select a District");
		return false;
	}	
	
	else { 
		return true;
	}	

	
}





function validateAdmitForm(){	
var formno = document.hmAdmit.formshtno.value;
//alert(formno);
	if(formno==''){
		alert("Please Enter a Form No.");
		return false;
	}	
	else if(formno!='' && formno.length<6){
		alert("Please Enter a 6-digit Form No.");
		return false;
	}
	else { 
		document.getElementById("loading123").innerHTML= "<img src='images/indicator.gif'>";
		return true;
	}	
}


function submitAdmitForm() {
	var formno =  document.hmAdmit.formshtno.value;
	//alert(formno);
	url = "hmadmit/submitAdmitForm.jsp?t=" + new Date().getTime();
	var poststr = "&formshtno=" +  formno;
	url += poststr;
	loadResponse('admitresult', url,'GET',removeLoading);
	
}

function validatePanelForm(){	
var rollno = document.panelform.rollno.value;
//alert(formno);
	if(rollno==''){
		alert("Please Enter your Roll No.");
		return false;
	}	
	else if(rollno!='' && rollno.length<8){
		alert("Please Enter your 8-digit Roll No. for 9th RLST(AT) in Physical Education only");
		return false;
	}
	else if(rollno.substring(0,1)!=3){
		alert("Roll No. " + rollno + " is not valid for 9th RLST(AT) in Physical Education of Southern Region");
		return false;
	}
	else { 
		document.getElementById("loading123").innerHTML= "<img src='images/indicator.gif'>";
		return true;
	}	
}


function submitPanelForm() {
	var rollno = document.panelform.rollno.value;
	//alert(formno);
	url = "panelat9thPhED/submitForm.jsp?t=" + new Date().getTime();
	var poststr = "&rollno=" +  rollno;
	url += poststr;
	//alert(url);
	loadResponse('panelresult', url,'GET',removeLoading);
	
}

function removeLoading(){
	document.getElementById("loading123").innerHTML="";
}

function get() {
var regionval = encodeURI( document.getElementById('region').value);
//alert(regionval);
var mediumval = encodeURI( document.getElementById('medium').value);
//alert(mediumval);
var subjectval = encodeURI( document.getElementById('subject').value);
//alert(subjectval);


      var poststr = "?region=" +  regionval  + "&medium=" +  mediumval  +	"&subject=" +  subjectval;
//alert(poststr);
var url = 'at_vac_tentative_10th_rlst/result.jsp' + poststr;
//alert(url);
	  loadInsideContent('center_content', url);
   }
   
// end of submit form for tentative vacancy, 10th RLST

	
function getSchools() {
var medium =  document.getElementById('medium').value;
var schooltype =  document.getElementById('schooltype').value;
var category =  document.getElementById('category').value;
//alert(medium);

var poststr = "?t=pd" + new Date().getTime() + "&medium=" +  medium  + "&schooltype=" +  schooltype  +	"&category=" +  category;
//alert(poststr);
var url = 'couns_school_PHEDU_SR/result.jsp' + poststr ;
//alert(url);
//var url = "";
	  loadInsideContent('center_content', url);
   }
   
// end of submit form for schools for counseling of SR in Pysical Education, 10th RLST



function getBankDetails() {
var regionval = encodeURI( document.getElementById('region').value);
//alert(regionval);
var distval = encodeURI( document.getElementById('district').value);
//alert(mediumval);
var poststr = "?region=" +  regionval  + "&district=" +  distval;
var url = 'bakdetails_atvac/result.jsp' + poststr;
//alert(url);
	  loadInsideContent('center_content', url);
  }
  
  
 function getBankDetailsforHM() {
var regionval =  document.getElementById('region').value;
//alert(regionval);
var distval =  document.getElementById('district').value;
//alert(mediumval);
var poststr = "&region=" +  regionval  + "&district=" +  distval;
var url = 'bankdetails_hmVac/result.jsp?t=' + new Date().getTime() + poststr;
//alert(url);
	  loadResponse('vacresultid', url);
  }

   
// end of submit form for tentative vacancy, 10th RLST

// START NT VACANCY

function validateNTVacForm(){
	
	if(document.atVac.post.selectedIndex==0){
		alert("Please select a Category of Post");
		return false;
	}
	
	

	
	
	else if(document.atVac.post.value=='GROUPD'){
		if(document.atVac.subpost.selectedIndex==0){
			alert("Please select a Sub-category of Post Type");
			return false;
		}
		if(document.atVac.region.selectedIndex==0){
			alert("Please select a Region");
			return false;
		}
	
		if(document.atVac.district.selectedIndex==0){
			alert("Please select a District");
			return false;
		}
		else if(document.atVac.medium.selectedIndex==0){
			alert("Please select a Medium");
			return false;
		}
		else{
			return true;
		}
		
	}	
	
	else if(document.atVac.post.value!='LIBRARIAN'){
		if(document.atVac.region.selectedIndex==0){
			alert("Please select a Region");
			return false;
		}
		if(document.atVac.district.selectedIndex==0){
			alert("Please select a District");
			return false;
		}
		else if(document.atVac.medium.selectedIndex==0){
			alert("Please select a Medium");
			return false;
		}
		else{
			return true;
		}
	}
	
	else if(document.atVac.post.value=='LIBRARIAN'){
		if(document.atVac.region.selectedIndex==0){
			alert("Please select a Region");
			return false;
		}
		
		else if(document.atVac.medium.selectedIndex==0){
			alert("Please select a Medium");
			return false;
		}
		else{
			return true;
		}
	}
	
	
	
	else { 
		return true;
	}	

	
}

function getNTVacancyDetails() {
	var regionval = encodeURI( document.getElementById('region').value);
	var distval = encodeURI( document.getElementById('district').value);
	var medval = encodeURI( document.getElementById('medium').value);
	var postval = encodeURI( document.getElementById('post').value);
	var subpostval;
	if(postval=='GROUPD'){
		subpostval = encodeURI( document.getElementById('subpost').value);
	}
	
	var poststr = "?region=" +  regionval  + "&district=" +  distval  + "&medium=" +  medval  + "&post=" +  postval;
	
	if(postval=='GROUPD'){
		poststr += "&subpost=" +  subpostval;
	}
	
	var url = 'VacancyNT/result.jsp' + poststr;
	url += "&t=" + (new Date()).getTime();			
	//alert(url);
	loadInsideContent('center_content', url);
  }


// END NT VACANCY



// START 10th RLST(HM) VACANCY

function validateHMVacForm(){
	
	if(document.hmVac.region.selectedIndex==0){
		alert("Please select a region");
		return false;
	}
		
	else if(document.hmVac.medium.selectedIndex==0){
		alert("Please select a Medium");
		return false;
	}
	else{
		return true;
	}
	
}

function getHMVacancyDetails() {
	var regionval =  document.getElementById('region').value;
	var medval =  document.getElementById('medium').value;
	var poststr = "?region=" +  regionval  + "&medium=" +  medval;
	var url = 'VacancyHM/result.jsp' + poststr;
	url += "&t=" + (new Date()).getTime();	
	//alert(url);
	loadResponse('divhmvacancy', url);
  }


// END 10th RLST(HM) VACANCY


function popupForentativeVacancy() {
	var url = "printvacancy/" + "?region=" + document.getElementById('region1').value;
	url = url +  "&medium=" + document.getElementById('medium1').value;
	url = url +  "&subject=" + document.getElementById('subject1').value;
	//alert(url);
	newwindow=window.open(url,'name','height=600,width=800');
	if (window.focus) {newwindow.focus()}
	return false;
}


function popupBigView() {
	var url = "imageView/"
	newwindow=window.open(url,'name','height=638,width=900');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popupBigView1() {
	var url = "imageView1/"
	newwindow=window.open(url,'name','height=638,width=900');
	if (window.focus) {newwindow.focus()}
	return false;
}



function checkSyllabus(){
	if(document.getElementById('syllabus').value==0){
		alert('Please select a subject');
		return false;
	}
	else{
		return true;
	}
}



function actionPostCounseling() {
	var region = encodeURI( document.getElementById('region').value);
	var district = encodeURI( document.getElementById('district').value);
	var medium = encodeURI( document.getElementById('medium').value);
	var schtype = encodeURI( document.getElementById('schtype').value);
	var schoolname = encodeURI( document.getElementById('schoolname').value).replace(/&/, '~utnipdebnath~').replace('+', '~utnipdebnathPlus~'); 
	var poststr = "?region=" +  region  + "&district=" +  district  +	"&medium=" +  medium;
	poststr += "&schtype=" +  schtype  +	"&schoolname=" +  schoolname;	
	var url = 'pc/center_pc_result.jsp' + poststr;
	loadInsideContent('center_content', url);
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
			
 		 return true					
		
	}

function uploadingFile(val){
	if(document.getElementById('resume').value!="" && document.getElementById('photo').value!=""){
		val.innerHTML='Please wait. Files are being uploaded....';
		//val.innerHTML='<img src=\'images/loading.gif\'';
	}
}




