// JavaScript Document
//////building function for ersp evaluation

function openERSPProjectEvaluation(secuerdSt,studentId)
{
	window.open('../evaluationErsp?typeRequested=1&assesment=project&studentId='+studentId+'&secuerdSt='+secuerdSt,'Window',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
//////building function for ersp evaluation
function openERSPCVEvaluation(secuerdSt,studentId)
{
	window.open('../evaluationErsp?typeRequested=1&assesment=cv&studentId='+studentId+'&secuerdSt='+secuerdSt,'Window',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
function openERSPProjectPrinciples(secuerdSt,studentId)
{
	window.open('../evaluationErsp?typeRequested=1&assesment=projectPrinciples&studentId='+studentId+'&secuerdSt='+secuerdSt,'Window',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
function openERSPSchoolVisitEvaluation(studentId)
{
	window.open('../evaluationErsp?typeRequested=1&assesment=schoolVisit&studentId='+studentId,'Window',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
//ajaxMarkSave save ersp marks data to db using ajax 
var ids='';
function ajaxMarkSave(userId,type)
{
	ids=userId;
	doLodingButton(userId);
		var projectValue=0;
		var cvValue=0;
		var attendancValuee=0;
		var finalValue=0;
		var project=document.getElementById('project_'+userId).value;
		if(parseFloat(project)=='NaN')
		{
			projectValue=parseInt(project);
		}
		else
		{
			projectValue=parseFloat(project);
		}
		
		var cv=document.getElementById('cv_'+userId).value;
		if(parseFloat(cv)=='NaN')
		{
			cvValue=parseInt(cv);
		}
		else
		{
			cvValue=parseFloat(cv);
		}
		
		/*var attendance=document.getElementById('attendance_'+userId).value;
		if(parseFloat(attendance)=='NaN')
		{
			attendancValuee=parseInt(attendance);
		}
		else
		{
			attendancValuee=parseFloat(attendance);
		}
		*/
		var final=document.getElementById('final_'+userId).value;
		if(parseFloat(final)=='NaN')
		{
			finalValue=parseInt(final);
		}
		else
		{
			finalValue=parseFloat(final);
		}
		
	var total=projectValue+cvValue+attendancValuee+finalValue;
	var url='';
	//url='project='+projectValue+'&cv='+cvValue+'&attendanc='+attendancValuee+'&final='+finalValue+'&total='+total+'&studentType='+type;
	url='project='+projectValue+'&cv='+cvValue+'&final='+finalValue+'&total='+total+'&studentType='+type;
	var nocache=Math.random();
	http.open('GET','?typeRequested=1&type=45&addERSPmark=1&studentId='+userId+'&'+url+'&nocache='+nocache,true);
	http.onreadystatechange = confirmAddingMarks;
	http.send('');
}
function confirmAddingMarks()
{
	if(http.readyState == 4)
	{	
		var response = http.responseText;
		document.getElementById("saveButton_"+ids).innerHTML =response;
		//emptyCells(userId);
	}
}
function ajaxMarkDelete(studentId)
{
	ids=studentId;
	var nocache=Math.random();
	http.open('GET','?typeRequested=1&type=45&removeERSPmark=1&studentId='+studentId+'&nocache='+nocache,true);
	http.onreadystatechange = confirmDeleteMarks;
	http.send('');
}
function confirmDeleteMarks()
{
	if(http.readyState == 4)
	{	
		var response = http.responseText;
		document.getElementById("project_"+ids).value=0;
		document.getElementById("cv_"+ids).value=0;
		//document.getElementById("attendance_"+ids).value=0;
		document.getElementById("final_"+ids).value=0;
		document.getElementById("total_"+ids).innerHTML=0;
		document.getElementById("deleteButton_"+ids).innerHTML =response;
		 
		//emptyCells(userId);
	}
}

function doLodingButton(userId)
{
	document.getElementById("saveButton_"+userId).innerHTML ='<img src=../images/littleloaderiw6.gif width=16px height=16px />';
}
///count final ersp mark and check the float and integers numbers 
function countMark(value,id,userId)
{
	if(document.getElementById('final_'+userId).value>50)
	{
		alert('Error in Value its should be less or equal 50 for final mark');
		document.getElementById(id).value='0';
	}
	/*else
	if(document.getElementById('attendance_'+userId).value>10)
	{
		alert('Error in Value its should be less or equal 50 for final mark');
		document.getElementById(id).value='0';
	}*/
	else
	if(document.getElementById('project_'+userId).value>20 || document.getElementById('cv_'+userId).value>20  )
	{
		alert('Error in Value its should less or equal 20 ');
		document.getElementById(id).value='0';
	}
	else
	if(isNaN(value)==true)
	{
		alert('Error in Value its should less or equal 20 ');
		document.getElementById(id).value='0';
	}
	else
	{
		var projectValue=0;
		var cvValue=0;
		var attendancValuee=0;
		var finalValue=0;
		var project=document.getElementById('project_'+userId).value;
		if(parseFloat(project)=='NaN')
		{
			projectValue=parseInt(project);
		}
		else
		{
			projectValue=parseFloat(project);
		}
		
		var cv=document.getElementById('cv_'+userId).value;
		if(parseFloat(cv)=='NaN')
		{
			cvValue=parseInt(cv);
		}
		else
		{
			cvValue=parseFloat(cv);
		}
		
		/*var attendance=document.getElementById('attendance_'+userId).value;
		if(parseFloat(attendance)=='NaN')
		{
			attendancValuee=parseInt(attendance);
		}
		else
		{
			attendancValuee=parseFloat(attendance);
		}
		*/
		var final=document.getElementById('final_'+userId).value;
		if(parseFloat(final)=='NaN')
		{
			finalValue=parseInt(final);
		}
		else
		{
			finalValue=parseFloat(final);
		}
		
	}
	if(projectValue=='NaN')
		projectValue=0;
	if(cvValue=='NaN')
		cvValue=0;
	/*if(attendancValuee=='NaN')
		attendancValuee=0;*/
	if(finalValue=='NaN')
		finalValue=0;
		//var total=projectValue+cvValue+attendancValuee+finalValue;
		var total=projectValue+cvValue+finalValue;
		//parseFloat(document.getElementById('project_'+userId).value)+parseFloat(document.getElementById('cv_'+userId).value)+parseFloat(document.getElementById('attendance_'+userId).value)+parseFloat(document.getElementById('attendance_'+userId).value)+parseFloat(document.getElementById('final_'+userId).value);
		document.getElementById('total_'+userId).innerHTML=total;
}
function buildingMarkDigrams()
{
	window.open('?typeRequested=1&type=38&digram=1','Window',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
function openclassList(id)
{
	doLoding();
	var nocache=Math.random();
	http.open('GET','?typeRequested=1&type=42&openClassList='+id+'&nocache='+nocache,true);
	http.onreadystatechange = openclassListData;
	http.send('');
}
function openclassListData()
{
	if(http.readyState == 4)
	{	
		var response = http.responseText;
		document.getElementById('main_data').innerHTML =response;
		emptyCells();
	}
}

function openMarksDetails(recId)
{
	window.open('?typeRequested=1&type=showMarkDetails&recordId='+recId,'Window',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}

function openERSPUserScdules(user_id_schdule)
{
	//?type='.$_GET['type'].'&user_id_schdule='..'.
	window.open('?typeRequested=1&type=28&user_id_schdule='+user_id_schdule,'Window',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
//deleteErspUserRecord
function deleteErspUserRecord(id)
{
	var res=confirm('Are You Sure?');
	if(res==true)
		window.location='?type=42&request=deleteRecord&id='+id;
}

///------------------------functions for creation an ersp programs
function openWorkShopERSPData(recordId,dataType)
{
	doLoding();
	var nocache=Math.random();
	http.open('GET','?typeRequested=1&type=42&recordId='+recordId+'&dataType='+dataType+'&nocache='+nocache,true);
	http.onreadystatechange = viewUserWorkShopErsp;
	http.send('');
}
function viewUserWorkShopErsp()
{
	if(http.readyState == 4)
	{	
		var response = http.responseText;
		document.getElementById('main_data').innerHTML =response;
		emptyCells();
	}
}

///get semester list for the program value
function getSemesterProgrameList(idValue)
{
	doLoding();
	var nocache=Math.random();
	http.open('GET','?typeRequested=1&type=42&semesterList=1&progId='+idValue+'&nocache='+nocache,true);
	http.onreadystatechange = buildingSemesterListForProg;
	http.send('');
}
//---------------------------
function buildingSemesterListForProg()
{
	if(http.readyState == 4)
	{	
		var response = http.responseText;
		document.getElementById('semesterList').innerHTML =response;
		emptyCells();
	}
}
///js for student info page
function openEditingUserSchdule(id)
{
	window.open('?typeRequested=1&editSchudleForm='+id,'Editing',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
///open new window
function gettingTransportationWindow()
{
	window.open('?typeRequested=1&type=43&x=y&school_name='+document.getElementById('activityType').value+'&from='+document.getElementById('from').value+'&to='+document.getElementById('to').value,'NewRequest',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
///open new window
function openDetailsForMovment(userId)
{
	window.open('?typeRequested=1&type=43&user_id='+userId+'&x=y&school_name=1&from='+document.getElementById('from').value+'&to='+document.getElementById('to').value,'NewRequest',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}

//mohammed al shareif
/////////-----------
function filterLetters()
{
	window.location='?type=44&details='+document.getElementById('letter_id').value;
}

//sending request
function openReplyCalling(id)
{
	window.open(pathG+'?typeRequested=1&request=callingReply&id='+id,'NewRequest',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
function sendingUserRequest()
{
	window.open(pathG+'?typeRequested=1&request=addNewCall','NewRequest',"width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
///---------------function for sql
function fileTableName()
{
	document.getElementById('qStatment').value=' select * from  cader_'+document.getElementById('tableName').value;
}
function getAjaxTableCoulmns()
{
		var tblName=document.getElementById('tableName').value;
		doLoding();
		var nocache = Math.random();
		http.open('GET','?typeRequested=1&type=28&randomNumberXwZy=random&tableSelected='+tblName+'&nocache='+nocache,true);
		http.onreadystatechange = returnCoulmnList;
		http.send('');
}
////delete student reg
var studId;
var studName;

function deleteStudentFromSection(stud_id,class_id,name)
{
		//doLoding();
		studId=stud_id;
		classId=class_id;
		studName=name;
		var nocache = Math.random();
		var msg=confirm('Are You sure , to remove'+studName+' from your section ');
		if(msg==true)
		{
			http.open('GET','?typeRequested=1&type=28&deletingStudentFromClass=1&stud_id='+stud_id+'&nocache='+nocache,true);
			http.onreadystatechange = deleteingStudentFromClass;
			http.send('');
		}
}

function deleteingStudentFromClass()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	alert(' You Have Been Delete student name: '+studName+' form your section when you come again he will not be in your list');
}
}

function getMultipleTabelsSelection()
{
	var ob=document.getElementById("coulms");
	var countList=0;
	document.getElementById("selectedColumns").value='';
	while (ob.length>countList)
  	 {
		if(ob.options[countList].selected == true)
	   {
				document.getElementById("selectedColumns").value+=ob.options[countList].value+",";
	   }
		countList++;
   	}
}
function filleSelectedColToTex()
{
	document.getElementById('qStatment').value='';
	var selectedCol=document.getElementById("selectedColumns").value;
	
	var q=' select ';
		q+=selectedCol
		q+=' from ';
		q+=' cader_'+document.getElementById('tableName').value;
		document.getElementById('qStatment').value=q;
}

function returnCoulmnList()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	document.getElementById('listOfColumns').innerHTML =response;
	emptyCells();
	}
}
//fill year 
function fillYearIdAsses()
{
	document.getElementById('selectedYear1').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear2').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear3').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear4').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear5').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear6').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear7').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear8').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear9').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear10').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear11').value=document.getElementById('year_value').value;
	document.getElementById('selectedYear12').value=document.getElementById('year_value').value;
}
//fill year id for the assesmetnt after adding the year id filter
///----------------
function viewPlusIcone()
{
	if(document.getElementById('semesterIndex').value!='-1')
	{
		if(document.getElementById('themeIndex').value!='-1')
		{
			if(document.getElementById('cityIndex').value!='-1')
			{
				document.getElementById('addName').innerHTML='Click To Add';
				document.getElementById('addIcon').innerHTML='<a href=javascript:addSchduleEntry() >Add Now</a>';
			}
		else
			{
				alert(' Please Select City');
			}
		}
	else
		{
			alert(' Please Select Theme');
		}
	}
	else
	{
		alert(' Please Select Semester');
	}
}
function doLoding()
{
	var width=((screen.width)/2);
	var height=((screen.height)/2);
	document.getElementById('image_div').style.left=width-100;
	document.getElementById('image_div').style.top=height-200;
	document.getElementById('image_div').style.visibility='visible';
	var data="";
	data+="<table border=0 align=center cellpadding=0 cellspascing=0 bgcolor=#ffffff><tr><td ><img src=../images/loading_aqua.gif width=300 height=290 /></td>";
	data+="</table>";
	document.getElementById("image_div").innerHTML=data;
}
///calling for ajac function 
function addSchduleEntry()
{
	if(document.getElementById('semesterIndex').value!='-1')
	{
		if(document.getElementById('themeIndex').value!='-1')
		{
			if(document.getElementById('cityIndex').value!='-1')
			{
				var numberOnsite=document.getElementById('number_onsite').value;
				doLoding();
				var nocache = Math.random();
				document.getElementById('viewingForm').innerHTML='';
				http.open('GET','?typeRequested=1&type=2&buildAddingSchudleForm=1&numberOnsite='+numberOnsite+'&nocache='+nocache,true);
				http.onreadystatechange = buildAddingSchudleForm;
				http.send('');
			}
		}
	}
}
function buildAddingSchudleForm()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	document.getElementById('viewingForm').innerHTML =response;
	document.getElementById('addName').innerHTML='';
	document.getElementById('addIcon').innerHTML='';
	emptyCells();
	}
}
//pop up schdule
function UsersSchdules()
{
	window.open('?typeRequested=1&type=2&showSchdules=1',"Report","width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
//cancel for adding form
function cancelForm(id)
{
	document.getElementById(id).innerHTML ='';;
	document.getElementById('cityIndex').value='-1';
}
//delete from schdule
function deleteContent(id)
{
	doLoding();
	var nocache = Math.random();
	http.open('GET','?typeRequested=1&deleteAddingSchudleForm='+id+'&nocache='+nocache,true);
	http.onreadystatechange = deleteAddingSchudleForm;
	http.send('');
}//delete from schdule
function editContent(id)
{
	doLoding();
	var nocache = Math.random();
	http.open('GET','?typeRequested=1&editSchudleForm='+id+'&nocache='+nocache,true);
	http.onreadystatechange = editSchudleForm;
	http.send('');
}
function editSchudleForm()
{
	if(http.readyState == 4)
	{	
		var response = http.responseText;
		document.getElementById('main_data').innerHTML =response;
		emptyCells();
	}
}

///deleting
function deleteAddingSchudleForm()
{
	if(http.readyState == 4){	
	
	emptyCells();
	window.location='?deletedRecordSchdule=1';
}
}
//fill requestd data for deletion in array
function fillArryDelReg(studId)
{
	alert(studId);
}
//fill id for master trainer for get assesment marks
function fillYearId()
{
	document.getElementById('selectedYearId1').value=document.getElementById('cader_year').value;
	document.getElementById('selectedYearId2').value=document.getElementById('cader_year').value;
	document.getElementById('selectedYearId3').value=document.getElementById('cader_year').value;
	document.getElementById('selectedYearId4').value=document.getElementById('cader_year').value;
	document.getElementById('selectedYearId5').value=document.getElementById('cader_year').value;
	document.getElementById('selectedYearId6').value=document.getElementById('cader_year').value;
	
}

//change status for the class if open to close or oppiste
function openCloseClass(id)
{
	var id=id;
	var nocache = Math.random();
	document.getElementById('updatedMsg').innerHTML ='';
	http.open('GET','?typeRequested=1&type=28&changeStatusForClassOpenClose='+id+'&nocache='+nocache,true);
	http.onreadystatechange = changeClassStatus;
	http.send('');
}
function changeClassStatus()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	// else if login is ok show a message: "Site added+ site URL".
	document.getElementById('updatedMsg').innerHTML =response;//'Update Done....!';
	}
}


function getdeatilsForTheErspProg()
{
	var id=document.getElementById('programId').value;
	var nocache = Math.random();
	http.open('GET','?typeRequested=1&returnProgramDetailsForErsp='+id+'&nocache='+nocache,true);
	http.onreadystatechange = showERSPProgramDetails;
	http.send('');
}
function showERSPProgramDetails()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	// else if login is ok show a message: "Site added+ site URL".
	document.getElementById('showProgDetails').innerHTML =response;
	}
}
var i=0;
	var array=new Array();
	array=['u','p','d','a','t','i','n','&nbsp;','d','o','n','e','&nbsp;','p','l','e','a','s','e','&nbsp;','w','a','i','t','<br/>','w','h','i','l','e','&nbsp;','t','h','i','s','&nbsp;','p','a','g','e','&nbsp;','c','l','o','s','i','n','g'];
function closingPage()
{
	document.getElementById('msgHere').innerHTML+=array[i];
	if(i<47)
		setTimeout(closingPage,50);
	else
		setTimeout(fillTdwithPrintingMsg,100);
	++i;
}
function fillTdwithPrintingMsg()
{
	window.close();
}
function getAllInfoABoutErspStud(id,folderTraget)
{
	if(folderTraget=='1')
	window.open('../evaluation/?typeRequested=1&studentIdInfoRequested='+id,"Report","width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
	else
	window.open('?typeRequested=1&studentIdInfoRequested='+id,"Report","width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
//-------
function viewERSPSTudents(id)
{
	var width=((screen.width)/2);
	var height=((screen.height)/2);
	document.getElementById('image_div').style.left=width-100;
	document.getElementById('image_div').style.top=height-200;
	document.getElementById('image_div').style.visibility='visible';
	var data="";
	data+="<table border=0 align=center cellpadding=0 cellspascing=0 bgcolor=#ffffff><tr><td ><img src=../images/loading_aqua.gif width=300 height=290 /></td>";
	data+="</table>";
	document.getElementById("image_div").innerHTML=data;
	var nocache = Math.random();
	http.open('GET','index.php?typeRequested=1&showErspStudentSheetfor='+id+'&nocache='+nocache,true);
	http.onreadystatechange = showSheet;
	http.send('');
}
function showSheet()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	// else if login is ok show a message: "Site added+ site URL".
//	alert(response);
	document.getElementById('main_data').innerHTML =response;
	emptyCells();
	}
}
//mark on the fly for the assesment data
function changeTherehersalMark()
{
	var mark=0;
	var evaluatedData=0;
	for(var k=1;k<17;k++)
	{
		if(parseInt(document.getElementById('value'+k).value)!='-1')
		{
			mark+=parseInt(document.getElementById('value'+k).value);
			evaluatedData++;
		}
	}
	var lastValue=(mark/(evaluatedData*3))*100+'%';
	document.getElementById('markOnThFly').innerHTML=lastValue;
}
							
/////showing user history
function showAssesmentHistory(userId,ersp)
{
	//alert(ersp);
	window.open('?typeRequested=1&userId='+userId+'&ersp='+ersp,"Report","width=2000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
//building assesment form for the user 
function buildTheUserAssesmentForm()
{
	var id=document.getElementById('mtListNotMultiple').value;
	document.getElementById('userSelectedId').value=id;
	//alert(document.getElementById('userSelectedId').value);
	userAssesment.submit();
}
//print unfilled data
function printUnFilled(request)
{
	window.open('?typeRequested=1&type=38&request='+request,"Report","width=2000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
/////printing result for marketing data
function printFilterReportResult(request)
{
	var where=document.getElementById('filterWhere').value;
	window.open('?typeRequested=1&type=38&request='+request+'&where='+where,"Report","width=2000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
		
}
////////////////show markting reports
function showMarketingData(userId,startingPeriod,endingPeriod)
{
	window.open('?typeRequested=1&userId='+userId+'&startingPeriod='+startingPeriod+'&endingPeriod='+endingPeriod,"Report","width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
}
/////-----------events function
//edit event 
function editEvents()
{
	var width=((screen.width)/2);
	var height=((screen.height)/2);
	document.getElementById('image_div').style.left=width-100;
	document.getElementById('image_div').style.top=height-200;
	document.getElementById('image_div').style.visibility='visible';
	var data="";
	data+="<table border=0 align=center cellpadding=0 cellspascing=0 bgcolor=#ffffff><tr><td ><img src=../images/loading_aqua.gif width=300 height=290 /></td>";
	data+="</table>";
	document.getElementById("image_div").innerHTML=data;
	var nocache = Math.random();
	http.open('GET','index.php?typeRequested=editEvents&editEventsNow=1&nocache='+nocache,true);
	http.onreadystatechange = showEditEvents;
	http.send('');
}
function showEditEvents()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	// else if login is ok show a message: "Site added+ site URL".
	document.getElementById('main_data').innerHTML =response;
	emptyCells();
	}
}
//view events on mouse over
function viewEventsInDay(data)
{
//	var x=(event.screenX)-200;
	document.getElementById("image_div").innerHTML=data;
	document.getElementById('image_div').style.padding='300 100 400 400px';
	document.getElementById('image_div').style.visibility='visible';
}
///ading events
function addingEvent(day,month,year)
{
	var data='';
	data='<form method=post name=sendEvent id=sendEvent action=? >';
	data+='<input type=hidden name=eventDay id=eventDay value='+day+' />';
	data+='<input type=hidden name=eventMonth id=eventMonth value='+month+' />';
	data+='<input type=hidden name=eventYear id=eventYear value='+year+' />';
	data+='<table border=1 align=center cellpadding=2 cellspascing=2 bgcolor=#ffffff width=40%>';
	data+='<tr><td class=normal_text colspan=2><strong>Adding Event for '+day+'/'+month+'/'+year+'</strong></td></tr>';
	data+='<tr><td class=normal_text colspan=2><strong>Please select the type carfully , public event will be seen by all of users and the prive one it will just for you.</strong></td></tr>';
	data+='<tr><td class=normal_text><strong>private</strong><input type=radio name=eventType id=eventType value=1></td><td><strong>public</strong><input type=radio name=eventType id=eventType value=2></td></tr>';
	data+='<tr><td class=normal_text><strong>Title</strong>:</td><td><input type=text name=titleEvent id=titleEvent size=25 /></td></tr>';
	data+='<tr><td class=normal_text><strong>Details</strong>:</td><td><textarea name=details id=details rows=15 cols=40 ></textarea></td></tr>';
	data+='<tr><td class=normal_text><input type=submit name=send id=send value=send /> </td><td><input type=button name=cancel id=cancel value=Cancel onclick=javascript:cancelEvent() /></td></tr>';
	data+='</table>';
	data+='</form>';
	document.getElementById("image_div").innerHTML=data;
	document.getElementById('image_div').style.padding='200 100 400 400px';
	document.getElementById('image_div').style.visibility='visible';
}
function cancelEvent()
{
	document.getElementById("image_div").innerHTML='';
}
///---nxt month
function nxtMonth(value,yValue)
{
	var data="";
	data+="<table border=0 align=center cellpadding=0 cellspascing=0 bgcolor=#ffffff><tr><td ><img src=../images/loading_aqua.gif width=300 height=290 /></td>";
	data+="</table>";
	document.getElementById("image_div").innerHTML=data;
	document.getElementById('image_div').style.padding='200 100 400 400px';
	document.getElementById('image_div').style.visibility='visible';
	var nocache = Math.random();
	http.open('GET','index.php?typeRequested=nextMonth&nextMonthValue='+value+'&nextYearhValue='+yValue+'&nocache='+nocache,true);
	http.onreadystatechange = showNextMonth;
	http.send('');
}
function showNextMonth()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	// else if login is ok show a message: "Site added+ site URL".
	document.getElementById('main_data').innerHTML =response;
	emptyCells();
	}
}
//-----------------------------
//----------------------------viweing ajax tech
function validationSearch(id,update)
{
	var width=((screen.width)/2);
	var height=((screen.height)/2);
	document.getElementById('image_div').style.left=width-100;
	document.getElementById('image_div').style.top=height-200;
	document.getElementById('image_div').style.visibility='visible';
	var data="";
	data+="<table border=0 align=center cellpadding=0 cellspascing=0 bgcolor=#ffffff><tr><td ><img src=../images/loading_aqua.gif width=300 height=290 /></td>";
	data+="</table>";
	document.getElementById("image_div").innerHTML=data;
	//if editing not viwing just
	if(update==1)
	{
		var nocache = Math.random();
		var uni_id=document.getElementById("uni_id").value;
		var name=document.getElementById("name").value;
		var phone=document.getElementById("phone").value;
		var trainer_campus=document.getElementById("trainer_campus").value;
		var place_campus=document.getElementById("place_campus").value;
		var day_campus=document.getElementById("day_campus").value;
		var time_campus=document.getElementById("time_campus").value;
		var trainer_onsite=document.getElementById("trainer_onsite").value;
		var place_onsite=document.getElementById("place_onsite").value;
		var day_onsite=document.getElementById("day_onsite").value;
		var time_onsite=document.getElementById("time_onsite").value;
		var school_name=document.getElementById("school_name").value;
		var school_place=document.getElementById("school_place").value;
		var DC=document.getElementById("DC").value;
		var t1=document.getElementById("t1").value;
		var t2=document.getElementById("t2").value;
		var t3=document.getElementById("t3").value;
		var t4=document.getElementById("t4").value;
		var t5=document.getElementById("t5").value;
		var t6=document.getElementById("t6").value;
		var area=document.getElementById("area").value;
		var status=document.getElementById("status").value;
		var scholarship=document.getElementById("scholarship").value;
		var start_study=document.getElementById("start_study").value;
		var reg_material=document.getElementById("reg_material").value;/**/
		//&name='+name+'&phone='+phone+'&trainer_campus='+trainer_campus+'&place_campus='+place_campus+'&day_campus='+day_campus+'&time_campus='+time_campus+'&trainer_onsite='+trainer_onsite+'&place_onsite='+place_onsite+'&day_onsite='+day_onsite+'&time_onsite='+time_onsite+'&school_name='+school_name+'&school_place='+school_place+'&DC='+DC+'&t1='+t1+'&t2='+t2+'&t3='+t3+'&t4='+t4+'&area='+area+'&status='+status+'&scholarship='+scholarship+'&start_study='+start_study+'&reg_material='+reg_material+'
		http.open('GET','index.php?typeRequested=updateUsers&uni_id='+uni_id+'&name='+name+'&id='+id+'&phone='+phone+'&trainer_campus='+trainer_campus+'&place_campus='+place_campus+'&day_campus='+day_campus+'&time_campus='+time_campus+'&trainer_onsite='+trainer_onsite+'&place_onsite='+place_onsite+'&day_onsite='+day_onsite+'&time_onsite='+time_onsite+'&school_name='+school_name+'&school_place='+school_place+'&DC='+DC+'&t1='+t1+'&t2='+t2+'&t3='+t3+'&t4='+t4+'&t5='+t5+'&t6='+t6+'&area='+area+'&status='+status+'&scholarship='+scholarship+'&start_study='+start_study+'&reg_material='+reg_material+'&nocache='+nocache,true);
		http.onreadystatechange = updateAccNewValue;
		http.send('');
	}
	else
	{
		var nocache = Math.random();
		http.open('GET','index.php?typeRequested=editUsers&id='+id+'&nocache='+nocache,true);
		http.onreadystatechange = updateAccNewValue;
		http.send('');
	}
	//setTimeout(emptyCells,1000);
}
//updating
function updateAccNewValue()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	// else if login is ok show a message: "Site added+ site URL".
	document.getElementById('main_data').innerHTML =response;
	emptyCells();
	}
}
//calling for empty image
function emptyCells()
{
	document.getElementById("image_div").innerHTML='';
}
//updating data
function update(id)
{
	validationSearch(id,1);
}
//return year for the program
function getYearProg(type)
{
		doLoding()
		var prog=document.getElementById("programId").value;
		var nocache = Math.random();
		http.open('GET','?typeRequested=1&type='+type+'&action=getDirectoratList&progId='+prog+'&nocache='+nocache,true);
		http.onreadystatechange = getDirectoratList;
		http.send('');
}
function getDirectoratList()
{
	if(http.readyState == 4){	
	var response = http.responseText;
	// else if login is ok show a message: "Site added+ site URL".
	document.getElementById('directorateSelect').innerHTML =response;
	emptyCells()
	}
}
//get multiple dayes selection
function getMultipleDayesSelectionForERSPSchdules()
{
	var ob=document.getElementById("dayListERSP");
	var count=0;
	document.getElementById("daysIds2").value='';
	while(ob.length>count)
	{
		if(ob.options[count].selected==true)
		{
			document.getElementById("daysIds2").value+=ob.options[count].value+",";	
		}
		count++;
	}

}
function editErspStudentAttendence(id)
{
	window.open('../evaluation/?typeRequested=1&student='+id,"Report","width=1000,height=600,top=100,left=250,scrollbars=yes,resizable=yes");
	
}

