function r2(n) {

  ans = n * 1000
  ans = Math.round(ans /10) + ""
  while (ans.length < 3) {ans = "0" + ans}
  len = ans.length
  ans = ans.substring(0,len-2) + "." + ans.substring(len-2,len)
  return ans
} 

function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
	}


function clickchange(cnt,val)
	{
	var req = getXMLHTTP();
	
	if (req) {	
		var query = document.getElementById('showhide'+cnt).src;	
		imgname = query.substr(query.lastIndexOf("/")+1);
		
		if(imgname == 'icon-32-apply.png')
		{	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('showhide'+cnt).src='../images/icon-32-cancel.png';
					if(val != 'user')
					document.getElementById('showhide'+cnt).title='Publish';
					else
					document.getElementById('showhide'+cnt).title='Yes';
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('showhide'+cnt).src='../images/loadingIcon.gif';
					}		
				
			}
			
			
			
			if(val == 'course')
			strURL ='course_enable.php?mode=unpub&id='+cnt;
			else if(val == 'school')
			strURL ='school_enable.php?mode=unpub&id='+cnt;
			else if(val == 'cityad')
			strURL ='city_enable.php?mode=unpub&id='+cnt;
			else if(val == 'county')
			strURL ='country_enable.php?mode=unpub&id='+cnt;
			else if(val == 'newssn')
			strURL ='newssection_enable.php?mode=unpub&id='+cnt;
			else if(val == 'news')
			strURL ='news_enable.php?mode=unpub&id='+cnt;
			else if(val == 'artic')
			strURL ='articles_enable.php?mode=unpub&id='+cnt;
			else if(val == 'artsec')
			strURL ='articlesection_enable.php?mode=unpub&id='+cnt;
			else if(val == 'hours')
			strURL ='hours_enable.php?mode=unpub&id='+cnt;
			else if(val == 'weeks')
			strURL ='weeks_enable.php?mode=unpub&id='+cnt;
			else if(val == 'major')
			strURL ='coursemajor_enable.php?mode=unpub&id='+cnt;
			else if(val == 'annou')
			strURL ='announce_enable.php?mode=unpub&id='+cnt;
			else if(val == 'user')
			strURL ='ourstudent_enable.php?mode=unpub&id='+cnt;
			else
			strURL ='date_enable.php?mode=unpub&id='+cnt;
			
			
			req.open("GET", strURL, true);
			req.send(null);
		
		}
		else
		{
		
		req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('showhide'+cnt).src='../images/icon-32-apply.png';
					if(val != 'user')
					document.getElementById('showhide'+cnt).title='Unpublish';
					else
					document.getElementById('showhide'+cnt).title='No';
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('showhide'+cnt).src='../images/loadingIcon.gif';
					}		
				
			}			
			if(val == 'course')
			strURL ='course_enable.php?mode=pub&id='+cnt;
			else if(val == 'school')
			strURL ='school_enable.php?mode=pub&id='+cnt;
			else if(val == 'cityad')			
			strURL ='city_enable.php?mode=pub&id='+cnt;
			else if(val == 'county')
			strURL ='country_enable.php?mode=pub&id='+cnt;
			else if(val == 'newssn')
			strURL ='newssection_enable.php?mode=pub&id='+cnt;
			else if(val == 'news')
			strURL ='news_enable.php?mode=pub&id='+cnt;
			else if(val == 'artic')
			strURL ='articles_enable.php?mode=pub&id='+cnt;
			else if(val == 'artsec')
			strURL ='articlesection_enable.php?mode=pub&id='+cnt;
			else if(val == 'hours')
			strURL ='hours_enable.php?mode=pub&id='+cnt;
			else if(val == 'weeks')
			strURL ='weeks_enable.php?mode=pub&id='+cnt;
			else if(val == 'major')
			strURL ='coursemajor_enable.php?mode=pub&id='+cnt;
			else if(val == 'annou')
			strURL ='announce_enable.php?mode=pub&id='+cnt;
			else if(val == 'user')
			strURL ='ourstudent_enable.php?mode=pub&id='+cnt;
			else 
			strURL ='date_enable.php?mode=pub&id='+cnt;
			
			
			req.open("GET", strURL, true);
			req.send(null);
		
	
	
		}
	}
	
}

function deletearticles(id)
{
	if(confirm("Are you sure you want to delete this record?"))
	{
		location.href = 'delcourse.php?id='+id
		
	}
	
	
	
}

function deletemajor(id)
{
	if(confirm("Are you sure you want to delete this record?"))
	{
		location.href = 'delcoursemajor.php?id='+id
		
	}
	
	
	
}

function editrecord(id)
{
			location.href = 'editarticles.php?id='+id
		
	
}

function deletedates(did,id)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('maindate').innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('maindate').src='../images/loadingIcon.gif';
					}		
				
			}			
			
			if(confirm("Are you sure you want to delete?"))
			{
			strURL ='date_del.php?did='+did+'&id='+id;
			req.open("GET", strURL, true);
			req.send(null);
			}
		
		
	}
	
}

function adddates(id,txtfld)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
	
	var f = document.forms['frmdates'];
	var datfild = eval('f.'+txtfld+'.value');
	if(datfild == "")
	{
		alert("please enter date eg: dd/mm/yyyy");
		return false;
	}
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('maindate').innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('maindate').src='../images/loadingIcon.gif';
					}		
				
			}			
			
			
			
			strURL ='date_added.php?id='+id+'&val='+datfild;
			req.open("GET", strURL, true);
			req.send(null);
			
		
		
	}
	
}



function clickchangefields(id,imgid,val)
	{
	var req = getXMLHTTP();
	
	if (req) {	
		var query = document.getElementById(imgid).src;	
		imgname = query.substr(query.lastIndexOf("/")+1);
		
		if(imgname == 'icon-32-apply.png')
		{	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById(imgid).src='../images/icon-32-cancel.png';
					document.getElementById(imgid).title='Publish';
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById(imgid).src='../images/loadingIcon.gif';
					}		
				
			}			
			
			
			strURL ='fields_enable.php?mode=unpub&id='+id+'&fldid='+val;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
		else
		{
		
		req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById(imgid).src='../images/icon-32-apply.png';
					document.getElementById(imgid).title='Unpublish';
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById(imgid).src='../images/loadingIcon.gif';
					}		
				
			}			
			
			strURL ='fields_enable.php?mode=pub&id='+id+'&fldid='+val;
			req.open("GET", strURL, true);
			req.send(null);
		
	
	
		}
	}
	
}


function changeprovince(strval)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
	
		
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('provincechange').innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('provincechange').src='../images/loadingIcon.gif';
					}		
				
			}			
			
			
			
			strURL ='province_change.php?val='+strval;
			req.open("GET", strURL, true);
			req.send(null);
			
		
		
	}
	
	
}

function changecity(strval)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
	
		
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('citychange').innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('citychange').src='../images/loadingIcon.gif';
					}		
				
			}			
			
			
			
			strURL ='city_change.php?val='+strval;
			req.open("GET", strURL, true);
			req.send(null);
			
		
		
	}
	
	
}


function addcity(id,txtfld)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
	
	var f = document.forms['frmlist'];
	var datfild = eval('f.'+txtfld+'.value');
	if(datfild == "")
	{
		alert("please enter province name");
		return false;
	}
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('maincity').innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('maincity').src='../images/loadingIcon.gif';
					}		
				
			}			
			
			
			
			strURL ='city_added.php?id='+id+'&val='+encodeURIComponent(datfild);
			req.open("GET", strURL, true);
			req.send(null);
			
		
		
	}
	
}

function grandtotalfinal(sramt)
{
				
				var summer = 0;
				var txtplac = 0;
				
				if(document.getElementById('coursetotalamot'))	
				var txtcour = document.getElementById('coursetotalamot').value;
				else
				var txtcour = 0;
				
				if(document.getElementById('majcoursetotalamot'))	
				var txtcourmaj = document.getElementById('majcoursetotalamot').value;
				else
				var txtcourmaj = 0;
				
				if(document.getElementById('txtamountsfamily'))				
				var txtfam = document.getElementById('txtamountsfamily').value;
				else
				var txtfam = 0;
				
				if(document.getElementById('txtamountsstudent'))	
				var txtstd = document.getElementById('txtamountsstudent').value;
				else
				var txtstd = 0;
				
				if(document.getElementById('course_registraion'))	
				var txtreg = document.getElementById('course_registraion').value;
				else
				var txtreg = 0;
				
				if(document.getElementById('course_material'))	
				var txtmat = document.getElementById('course_material').value;
				else
				var txtmat = 0;
				
				if(document.getElementById('course_gardian'))	
				var txtgard = document.getElementById('course_gardian').value;
				else
				var txtgard = 0;
				
				if(document.getElementById('txtamountsfamily'))	{			
					if(document.getElementById('txtamountsfamily').value != 0) {
						if(document.getElementById('accom_place'))	
						var txtplac = document.getElementById('accom_place').value;
						else
						var txtplac = 0;
					}
					else
					{
						txtplac = 0;	
					}
				}
				
				
				if(document.getElementById('txtamountsstudent')) {	
				if(document.getElementById('txtamountsstudent').value != 0) {
						if(document.getElementById('accom_place'))	
						var txtplac = document.getElementById('accom_place').value;
						else
						var txtplac = 0;
					}
					else
					{
						txtplac = 0;	
					}
				}
				
				
				if(document.getElementById('course_extra1'))	
				var txtex1 = document.getElementById('course_extra1').value;
				else
				var txtex1 = 0;
				
				if(document.getElementById('course_extra2'))	
				var txtex2 = document.getElementById('course_extra2').value;
				else
				var txtex2 = 0;
				if(document.getElementById('course_extra3'))	
				var txtex3 = document.getElementById('course_extra3').value;
				else
				var txtex3 = 0;
				if(document.getElementById('course_extra4'))	
				var txtex4 = document.getElementById('course_extra4').value;
				else
				var txtex4 = 0;
				
				if(document.getElementById('course_extra5'))	
				var txtex5 = document.getElementById('course_extra5').value;
				else
				var txtex5 = 0;
				
				if(document.getElementById('course_extra6'))	
				var txtex6 = document.getElementById('course_extra6').value;
				else
				var txtex6 = 0;
				
				if(document.getElementById('summersup'))	
				{
					if(document.getElementById('summersup').checked == true)
					{
						var summer = document.getElementById('course_summer').value;
					}
					else
					{
						var summer = 0;	
					}
				}
				
				var extratotal = parseFloat(txtreg) + parseFloat(txtmat) + parseFloat(txtgard) + parseFloat(txtplac) + parseFloat(txtex1) + parseFloat(txtex2) + parseFloat(txtex3) + parseFloat(txtex4) + parseFloat(txtex5) + parseFloat(txtex6) + parseFloat(summer)
				
				
				if(document.getElementById('txtamountssirport'))
					var txtair = document.getElementById('txtamountssirport').value;
					else
					var txtair = 0;
					if(document.getElementById('txtamountsmedical'))
					var txtmed = document.getElementById('txtamountsmedical').value;
					else
					var txtmed = 0;
					
				
					
					var maintotal =  parseFloat(txtcour) + parseFloat(txtcourmaj) + parseFloat(txtfam) + parseFloat(txtstd) + parseFloat(txtair) + parseFloat(txtmed) + parseFloat(extratotal);
					
					document.getElementById('total_amt').value = r2(maintotal);
					if(sramt != 0)
					var godtotal = parseFloat(sramt) * parseFloat(maintotal);
					else
					var godtotal = maintotal;
					document.getElementById('total_sr').value= r2(godtotal) 
}

function addprovcity(id,cid,txtfld)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
	
	var f = document.forms['frmaddcitylist'];
	var datfild = eval('f.'+txtfld+'.value');
	if(datfild == "")
	{
		alert("please enter city name");
		return false;
	}
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('mainprovcity').innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('mainprovcity').src='../images/loadingIcon.gif';
					}		
				
			}			
			
			var desc = document.getElementById('desc_city').value;
			
			strURL ='provcity_added.php?id='+id+'&cid='+cid+'&val='+encodeURIComponent(datfild)+'&desc='+encodeURIComponent(desc);
			req.open("GET", strURL, true);
			req.send(null);
			
		
		
	}
	
}

function editcitybox(id)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('editcontrols').innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('editcontrols').innerHTML="<img src='../images/loadingIcon.gif' />";
					}		
				
			}			
			
			
			
			strURL ='provcity_edit.php?id='+id;
			
			req.open("GET", strURL, true);
			req.send(null);
			
		
		
	}
	
}



function deletecity(id,cnid)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('maincity').innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('maincity').src='../images/loadingIcon.gif';
					}		
				
			}			
			
			if(confirm("Are you sure you want to delete?"))
			{
			strURL ='city_del.php?cid='+id+'&id='+cnid;
			req.open("GET", strURL, true);
			req.send(null);
			}
		
		
	}
	
}


function deleteprovcity(id,cnid)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('mainprovcity').innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('mainprovcity').src='../images/loadingIcon.gif';
					}		
				
			}			
			
			if(confirm("Are you sure you want to delete?"))
			{
			strURL ='provcity_del.php?id='+id+'&pid='+cnid;
			req.open("GET", strURL, true);
			req.send(null);
			}
		
		
		
	}
	
}


function changebanner(id,val)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					document.getElementById(val).src=req.responseText;
					document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById(val).src='../images/loadingIcon.gif';
					}		
				
			}			
			
			
			strURL ='changebanner.php?id='+id+'&val='+val;
			req.open("GET", strURL, true);
			req.send(null);
			
		
		
	}
	
}

function savebanner()
{
	var f = document.forms['frmbanner'];
	if(document.getElementById('sel_banner1').value == '' || document.getElementById('sel_banner2').value == '')
	{
		alert('Please select banner image');
		return false;
	}
	f.action = 'bannersave.php';
	f.submit();
	
}

function display_schoolcount(val,str)
{
	
	var req = getXMLHTTP();
	
	if (req) {	
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					var count = req.responseText;
					//alert(req.responseText)
					var mySplitResult = req.responseText.split("~");
					document.getElementById('coursechangemain').innerHTML=mySplitResult[1];
					document.getElementById('schoolcount').innerHTML=mySplitResult[0];
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					if(mySplitResult[1] == 0)
					document.getElementById('gobtn').innerHTML="<img  src=image/greygo.png align=absmiddle>";
					else
					document.getElementById('gobtn').innerHTML="<img  src='image/go.png' onclick='school_display();' style='cursor:pointer;' >";
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('coursechangemain').innerHTML="<div style='text-algin:center;'><img src='images/loadingIcon.gif' align='absmiddle'></div>";
					}		
				
			}
			
		
			var type_sel = document.getElementById('type_sel').value;
			strURL ='changeschoolcount.php?type_sel='+type_sel;			
			req.open("GET", strURL, true);
			req.send(null);
	}
	
}

function display_schoolcountcourse(val,str)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						
					var count = req.responseText;
					
					var mySplitResult = req.responseText.split("~");
					
					document.getElementById('citychangemain').innerHTML=mySplitResult[1];
					document.getElementById('schoolcount').innerHTML=mySplitResult[0];
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					if(mySplitResult[1] == 0 || mySplitResult[0] == 0)
					document.getElementById('gobtn').innerHTML="<img  src=image/greygo.png align=absmiddle>";
					else
					document.getElementById('gobtn').innerHTML="<img  src='image/go.png' onclick='school_display();' style='cursor:pointer;' >";
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('citychangemain').innerHTML="<div style='text-algin:center;'><img src='images/loadingIcon.gif' align='absmiddle'></div>";
					}		
				
			}
			
		
			var courses = document.getElementById('courses').value;
			var type_sel = document.getElementById('type_sel').value;
			strURL ='changeschoolcountcity.php?courses='+courses+'&type_sel='+type_sel;	
			req.open("GET", strURL, true);
			req.send(null);
	}
}


function display_countrycount(val,str)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					var count = req.responseText;
					document.getElementById('schoolcount').innerHTML=req.responseText;
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					if(count == 0)
					document.getElementById('gobtn').innerHTML="<img  src=image/greygo.png align=absmiddle>";
					else
					document.getElementById('gobtn').innerHTML="<img  src='image/go.png' onclick='school_display();' style='cursor:pointer;' >";
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('schoolcount').innerHTML="<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				
			}
			
		
			var courses = document.getElementById('courses').value;
			var type_sel = document.getElementById('type_sel').value;
			var country = document.getElementById('country').value;
			var city = document.getElementById('city').value;
			var cat_sel = document.getElementById('cat_sel').value;

			strURL ='countcountryschool.php?courses='+courses+'&type_sel='+type_sel+'&city='+city+'&country='+country+'&cat_sel='+cat_sel;	
			req.open("GET", strURL, true);
			req.send(null);
	}
	
}

function display_provincecount(val,str)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					var count = req.responseText;
					document.getElementById('schoolcount').innerHTML=req.responseText;
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					if(count == 0)
					document.getElementById('gobtn').innerHTML="<img  src=image/greygo.png align=absmiddle>";
					else
					document.getElementById('gobtn').innerHTML="<img  src='image/go.png' onclick='school_display();' style='cursor:pointer;' >";
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('schoolcount').innerHTML="<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				
			}
			
		     
			var courses = document.getElementById('courses').value;
			var type_sel = document.getElementById('type_sel').value;
			var province = document.getElementById('province').value;
			var cat_sel = document.getElementById('cat_sel').value;
			strURL ='countprovinceschool.php?courses='+courses+'&type_sel='+type_sel+'&province='+province+'&cat_sel='+cat_sel;	
			req.open("GET", strURL, true);
			req.send(null);
	}
	
}
		
function display_citycount(val,str)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					var count = req.responseText;
					document.getElementById('schoolcount').innerHTML=req.responseText;
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					if(count == 0)
					document.getElementById('gobtn').innerHTML="<img  src=image/greygo.png align=absmiddle>";
					else
					document.getElementById('gobtn').innerHTML="<img  src='image/go.png' onclick='school_display();' style='cursor:pointer;' >";
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('schoolcount').innerHTML="<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				
			}
			
		
			var courses = document.getElementById('courses').value;
			var type_sel = document.getElementById('type_sel').value;
			var country = document.getElementById('country').value;
			var city = document.getElementById('city').value;
			var cat_sel = document.getElementById('cat_sel').value;
			strURL ='countcityschool.php?courses='+courses+'&type_sel='+type_sel+'&city='+city+'&country='+country+'&cat_sel='+cat_sel;	
			req.open("GET", strURL, true);
			req.send(null);
	}
	
}

function changeschoolinfo(id,el, col1, col2)
{
	
	
for (i = 0; i < el.parentNode.childNodes.length; i++)
if (el.parentNode.childNodes[i].tagName)
el.parentNode.childNodes[i].style.backgroundColor=col2
el.style.backgroundColor=col1

	var req = getXMLHTTP();
	
	if (req) {		
				req.onreadystatechange = function() {			
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
					//alert(req.responseText)
					document.getElementById('subtable').innerHTML=req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('subtable').innerHTML='<div style="text-align:center;"><img src="images/loading.gif" align="absmiddle" title="Loading..."></div>';
					}		
				
			}
			
			strURL ='schoolchangeifo.php?id='+id;			
			req.open("GET", strURL, true);				
			req.send(null);
	}
}

function changeschoolinfobranches(id)
{
	
	

	var req = getXMLHTTP();
	
	if (req) {		
				req.onreadystatechange = function() {			
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
					//alert(req.responseText)
					document.getElementById('subtable').innerHTML=req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('subtable').innerHTML='<div style="text-align:center;"><img src="images/loading.gif" align="absmiddle" title="Loading..."></div>';
					}		
				
			}
			
			strURL ='schoolchangeifo.php?id='+id;			
			req.open("GET", strURL, true);				
			req.send(null);
	}
}





function sortingschool(ids,fields)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					
					document.getElementById('schoollist').innerHTML=req.responseText;
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('schoollist').src='../images/loadingIcon.gif';
					}		
				
			}
			
			
			
			
			
			
			strURL ='schoolsorting.php?ids='+id+'&field='+fields;
			req.open("GET", strURL, true);
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=Windows-1256");  			
			req.send(null);
	}
	
}

function xchangeamount(val,cid,schid,str,sramt)
{
	var req = getXMLHTTP();
	
	if (req) {	
			
					
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('amountxcng'+cid+schid).innerHTML='<input type="text" name="txtamounts'+cid+schid+'" id="txtamounts'+cid+schid+'" value="'+r2(req.responseText)+'" class="smalltxtboxes1" style="border:1px solid #ffffff;"/>';
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					var selectedweekArray = new Array();
					  var z = "";
					  var countw = 0;
					  for (z=1; z<=100; z++) {					
							
						  if(document.getElementById('txtamounts'+z+schid))
						  {
							  if(document.getElementById('txtamounts'+z+schid).value != '0')
							  {
							 selectedweekArray[countw] = document.getElementById('txtamounts'+z+schid).value;							 
							 countw++;
							  }
						  }
						
					
					  }
					
					
				
				
				var total = 0;
				for(var i = 0; i < selectedweekArray.length; i++){
				 var thisVal = parseFloat(selectedweekArray[i]);
				 if(!isNaN(thisVal)){
				  total += thisVal;
				 }
				}
				if(document.getElementById('txtamountsfamily'))				
				var txtfam = document.getElementById('txtamountsfamily').value;
				else
				var txtfam = 0;
				
				if(document.getElementById('txtamountsstudent'))	
				var txtstd = document.getElementById('txtamountsstudent').value;
				else
				var txtstd = 0;
				
				if(document.getElementById('txtamountssirport'))
					var txtair = document.getElementById('txtamountssirport').value;
					else
					var txtair = 0;
					if(document.getElementById('txtamountsmedical'))
					var txtmed = document.getElementById('txtamountsmedical').value;
					else
					var txtmed = 0;
					
					var maintotal = parseFloat(txtfam) + parseFloat(txtstd) + parseFloat(txtair) + parseFloat(txtmed) + parseFloat(total);
					document.getElementById('total_amt').value = r2(maintotal);
					if(sramt != 0)
					var godtotal = parseFloat(sramt) * parseFloat(maintotal);
					else
					var godtotal = maintotal;
					
					document.getElementById('total_sr').value= r2(godtotal) 
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('amountxcng'+cid+schid).innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				
			}
			
			
			if(str == 'hours')
			{
				opthr = val
			}
			else
			{
				opthr = document.getElementById('courseopthourse'+cid+'_'+schid).value;
			}
			
			if(str == 'weeks')
			{
				optwk = val
			}
			else
			{
				optwk = document.getElementById('courseoptweeks'+cid+'_'+schid).value;
			}
			
			
			
			
			strURL ='xchangeamount.php?cid='+cid+'&schid='+schid+'&opthr='+opthr+'&optwk='+optwk;
			req.open("GET", strURL, true);
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=Windows-1256");  			
			req.send(null);
	}	
	
}





function xchangeamountfamilyopt1(val,sid,sramt,board)
{
	
	
	var req = getXMLHTTP();
	
	if (req) {	
			
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					
					if (req.status == 200) {
						
						
						var mySplitResult = req.responseText.split("~");
						if(mySplitResult[0] == 1)
						{
							var finalamt = mySplitResult[1];
						}
						else
						{
							
							if(document.getElementById('fullborad').value != '')
							{
							var famwks = document.getElementById('fullborad').value;							
							var finalamt = parseInt(mySplitResult[1]) + parseInt(famwks);
							}
							else
							{
								var finalamt = 0;
							}
						}
					
					
					document.getElementById('amountfamily').innerHTML='<input type="text" name="txtamountsfamily" id="txtamountsfamily" value="'+finalamt+'" class="smalltxtboxes1" style="border:1px solid #ffffff;"/>';
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					
					if(document.getElementById('coursetotalamot'))	
				var txtcour = document.getElementById('coursetotalamot').value;
				else
				var txtcour = 0;
				
				if(document.getElementById('majcoursetotalamot'))	
				var txtcourmaj = document.getElementById('majcoursetotalamot').value;
				else
				var txtcourmaj = 0;
				
				if(document.getElementById('txtamountsfamily'))				
				var txtfam = document.getElementById('txtamountsfamily').value;
				else
				var txtfam = 0;
				
				if(document.getElementById('txtamountsstudent'))	
				var txtstd = document.getElementById('txtamountsstudent').value;
				else
				var txtstd = 0;
				
				if(document.getElementById('txtamountssirport'))
					var txtair = document.getElementById('txtamountssirport').value;
					else
					var txtair = 0;
					if(document.getElementById('txtamountsmedical'))
					var txtmed = document.getElementById('txtamountsmedical').value;
					else
					var txtmed = 0;
					
				
					
					var maintotal =  parseFloat(txtcour) + parseFloat(txtcourmaj) + parseFloat(txtfam) + parseFloat(txtstd) + parseFloat(txtair) + parseFloat(txtmed);
					
					document.getElementById('total_amt').value = r2(maintotal);
					if(sramt != 0)
					var godtotal = parseFloat(sramt) * parseFloat(maintotal);
					else
					var godtotal = maintotal;
					
					document.getElementById('total_sr').value= r2(godtotal) 
					
					  
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('amountfamily').innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				
			}
			
			var famwks = document.getElementById('familyweeks').value;
			
			
			if(board == 'normal')			
			strURL ='xchangeamountfamily.php?val='+val+'&schid='+sid;
			else
			strURL ='xchangeamountboard.php?val='+val+'&schid='+sid+'&numwks='+famwks;
			
			req.open("GET", strURL, true);
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=Windows-1256");  			
			req.send(null);
	}	
	
}



function xchangeamountstudentopt1(val,sid,sramt,shared)
{
	
	var req = getXMLHTTP();
	
	if (req) {	
			
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						var mySplitResult = req.responseText.split("~");
						if(mySplitResult[0] == 1)
						{
							var finalamt = mySplitResult[1];
						}
						else
						{
							if(document.getElementById('residancy').value != '')
							{
							var famwks = document.getElementById('residancy').value;							
							var finalamt = parseInt(mySplitResult[1]) + parseInt(famwks);
							}
							else
							{
								var finalamt = 0;
							}
						}
					//alert(req.responseText)
					document.getElementById('amountstudent').innerHTML='<input type="text" name="txtamountsstudent" id="txtamountsstudent" value="'+finalamt+'" class="smalltxtboxes1" style="border:1px solid #ffffff;"/>';
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					if(document.getElementById('coursetotalamot'))	
				var txtcour = document.getElementById('coursetotalamot').value;
				else
				var txtcour = 0;
				
				if(document.getElementById('majcoursetotalamot'))	
				var txtcourmaj = document.getElementById('majcoursetotalamot').value;
				else
				var txtcourmaj = 0;
				
				if(document.getElementById('txtamountsfamily'))				
				var txtfam = document.getElementById('txtamountsfamily').value;
				else
				var txtfam = 0;
				
				if(document.getElementById('txtamountsstudent'))	
				var txtstd = document.getElementById('txtamountsstudent').value;
				else
				var txtstd = 0;
				
				if(document.getElementById('txtamountssirport'))
					var txtair = document.getElementById('txtamountssirport').value;
					else
					var txtair = 0;
					if(document.getElementById('txtamountsmedical'))
					var txtmed = document.getElementById('txtamountsmedical').value;
					else
					var txtmed = 0;
					
				
					
					var maintotal =  parseFloat(txtcour) + parseFloat(txtcourmaj) + parseFloat(txtfam) + parseFloat(txtstd) + parseFloat(txtair) + parseFloat(txtmed);
					
					document.getElementById('total_amt').value = r2(maintotal);
					if(sramt != 0)
					var godtotal = parseFloat(sramt) * parseFloat(maintotal);
					else
					var godtotal = maintotal;
					
					document.getElementById('total_sr').value= r2(godtotal) 
					 
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('amountstudent').innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				
			}
			
			var stdwks = document.getElementById('studentweeks').value;
			
			
			if(shared == 'normal')			
			strURL ='xchangeamountstudent.php?val='+val+'&schid='+sid;
			else
			strURL ='xchangeamountstudentshared.php?val='+val+'&schid='+sid+'&stdwks='+stdwks;
			
			req.open("GET", strURL, true);
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=Windows-1256");  			
			req.send(null);
	}	
}

function changehomesoption(val,id,srmt)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('singleshared').innerHTML=req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('singleshared').innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				}
						
			strURL ='xchangehomeoptions.php?val='+val+'&schid='+id+'&tot='+srmt;
			req.open("GET", strURL, true);
			req.send(null);
	}	
	
	
}

function dispvalueweeks(val,id,str,sramt)
{
	
	var req = getXMLHTTP();
	
	if (req) {	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					document.getElementById('amountfamily').innerHTML='<input type="text" name="txtamountsfamily" id="txtamountsfamily" value="'+req.responseText+'" class="smalltxtboxes1" style="border:1px solid #ffffff; text-align:left"/>'
					grandtotalfinal(sramt);
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('amountfamily').innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				}
			var weekval = document.getElementById('familyweeks').value;		
			strURL ='xchangehomeoamount.php?val='+val+'&schid='+id+'&weeks='+weekval+'&optacc='+str;
			req.open("GET", strURL, true);
			req.send(null);
	}	
	
}

function xchangeamountfamily(val,sid,sramt)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					document.getElementById('amountfamily').innerHTML='<input type="text" name="txtamountsfamily" id="txtamountsfamily" value="'+req.responseText+'" class="smalltxtboxes1" style="border:1px solid #ffffff; text-align:left; "/>'
					grandtotalfinal(sramt);
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('amountfamily').innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				}
			var fullboard = document.getElementById('fullboard').value;	
			var optacc = document.getElementById('singleshare').value;				
			strURL ='xchangehomeamounttxt.php?val='+val+'&schid='+sid+'&fullboard='+fullboard+'&optacc='+optacc;
			req.open("GET", strURL, true);
			req.send(null);
	}	
}

function xchangeamountstudent(val,sid,sramt)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					document.getElementById('amountstudent').innerHTML='<input type="text" name="txtamountsstudent" id="txtamountsstudent" value="'+req.responseText+'" class="smalltxtboxes1" style="border:1px solid #ffffff; text-align:left"/>'
					grandtotalfinal(sramt);
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('amountstudent').innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				}
			var studentweeks = document.getElementById('studentweeks').value;		
			strURL ='xchangeresiopt.php?val='+val+'&schid='+sid+'&studentweeks='+studentweeks;
			req.open("GET", strURL, true);
			req.send(null);
	}
	
}

function xchangeamountstudentweeks(val,sid,sramt)
{
	var req = getXMLHTTP();
	
	if (req) {	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					document.getElementById('amountstudent').innerHTML='<input type="text" name="txtamountsstudent" id="txtamountsstudent" value="'+req.responseText+'" class="smalltxtboxes1" style="border:1px solid #ffffff; text-align:left"/>'
					grandtotalfinal(sramt);
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('amountstudent').innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				}
			var residancy = document.getElementById('residancy').value;		
			
			strURL ='xchangeresioptamt.php?val='+val+'&schid='+sid+'&studentweeks='+residancy;
			req.open("GET", strURL, true);
			req.send(null);
	}
	
}

function xchangeamountairport(val,sid,sramt)

{
	var req = getXMLHTTP();
	
	if (req) {	
			
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						if(val != 4)
						{
					//alert(req.responseText)
					document.getElementById('airamtid').style.display='block';
							document.getElementById('amountairport').style.display='block';							
							document.getElementById('includedtext').style.display='none';
					document.getElementById('amountairport').innerHTML='<input type="text" name="txtamountssirport" id="txtamountssirport" value="'+req.responseText+'" class="smalltxtboxes1" style="border:1px solid #ffffff; text-align:left;"/>';
					
						}
						else
						{
							document.getElementById('airamtid').style.display='none';
							document.getElementById('amountairport').style.display='none';							
							document.getElementById('includedtext').style.display='block';
							
						}
					
					grandtotalfinal(sramt);
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('amountairport').innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				
			}
			
			
			
			
			
			
			strURL ='xchangeamountairport.php?val='+val+'&schid='+sid;
			req.open("GET", strURL, true);
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=Windows-1256");  			
			req.send(null);
	}	
	
}


function xchangeamountmedical(val,amt,sid,sramt)
{
	if(val != '')
	{
		var total = parseInt(amt) * parseInt(val);				
		total = total;
	
	}
	else
	{
		total = 0;
			
	}
	document.getElementById('amountmedical').innerHTML='<input type="text" name="txtamountsmedical" id="txtamountsmedical" value="'+total+'" class="smalltxtboxes1" style="border:1px solid #ffffff; text-align:left;"/>';
  grandtotalfinal(sramt);
}

function xchangeamountmedicalopt1(val,sid,sramt)
{
	
	var req = getXMLHTTP();
	
	if (req) {	
			
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('amountmedical').innerHTML='<input type="text" name="txtamountsmedical" id="txtamountsmedical" value="'+req.responseText+'" class="smalltxtboxes1" style="border:1px solid #ffffff; text-align:left;"/>';
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
					  grandtotalfinal(sramt);
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('amountmedical').innerHTML = "<img src='images/loadingIcon.gif' align='absmiddle'>";
					}		
				
			}
			
			
			
			
			
			
			strURL ='xchangeamountmedical.php?val='+val+'&schid='+sid;
			req.open("GET", strURL, true);
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=Windows-1256");  			
			req.send(null);
	}	
}

function summercalc(sid,sramt)
{
				if(document.getElementById('coursetotalamot'))	{			
					if(document.getElementById('coursetotalamot').value != 0) {
						grandtotalfinal(sramt);
					}
					
				}
				
				
				if(document.getElementById('majcoursetotalamot')) {	
				if(document.getElementById('majcoursetotalamot').value != 0) {
						grandtotalfinal(sramt);
					}
						
				}
}


function school_display()
{
		var req = getXMLHTTP();
	
	if (req) {	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {					
					//alert(req.responseText)
					document.getElementById('maintable').innerHTML=req.responseText;
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('maintable').innerHTML ='<div style="text-align:center;"><img src="images/loading.gif" align="absmiddle" title="Loading..."></div>';
					}		
				
			}
			
			var country = document.getElementById('country').value;
			var province = document.getElementById('province').value;
			var city = document.getElementById('city').value;
			var courses = document.getElementById('courses').value;
			var cat_sel = document.getElementById('cat_sel').value;
			var type_sel = document.getElementById('type_sel').value;
			
			
			strURL ='changeschooldetails.php?country_sel='+country+'&province_sel='+province+'&city_sel='+city+'&course_sel='+courses+'&cat_sel='+cat_sel+'&type_sel='+type_sel;			
			req.open("GET", strURL, true);
			req.send(null);
	}
	
}


function SchoolControl_display()
{
		var req = getXMLHTTP();
	
	if (req) {	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {					
					//alert(req.responseText)
					document.getElementById('Result_search').innerHTML=req.responseText;
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('Result_search').innerHTML ='<div style="text-align:center;"><img src="../images/loading.gif" align="absmiddle" title="Loading..."></div>';
					}		
				
			}
			
			var country = document.getElementById('country').value;
			var province = document.getElementById('province').value;
			var city = document.getElementById('city').value;
			var type_sel = document.getElementById('type_sel').value;
			
			         
			strURL ='changeschoolcontroldetails.php?country_sel='+country+'&province_sel='+province+'&city_sel='+city+'&type_sel='+type_sel;			
			req.open("GET", strURL, true);
			req.send(null);
	}
	
}


 function Ajax_changeRowsDisplay_Search(startfrom,id)
					{
						
						var req = getXMLHTTP();
	
	if (req) {	
						var form_name			=		document.forms['frmschool'];
					   
						display =		1;
					
						
					
						
						if(startfrom=='')	
						var startfrom			=		form_name.startfrom.value;
						else
						var startfrom			=		startfrom;
						
			
			
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('Search_pictures').innerHTML=req.responseText;
					//document.getElementById(val).innerHTML="<img src=../images/banners/thumbs/"+req.responseText+">";
									
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('Search_pictures').src='../images/loadingIcon.gif';
					}		
				
			}
			
			
			
			
			
			strURL ="pictures_index.php?startfrom="+startfrom+"&display="+display+"&skulid="+id;				
			req.open("GET", strURL, true);
			req.send(null);
	}
						
						
					}
						
								

function loginclick()
{
	
	var f = document.forms['frmlogin'];
	username = document.getElementById('username');
	obj_title = "username";	
	if(mandatory(username,obj_title) == false)
	{
		username.focus();
		return false;
	}
	
	username = document.getElementById('username');
	obj_title = 'the valid email address';
	if(validEmail(username,obj_title) == false)
	{
		username.focus();
		return false;
	}
	
	password = document.getElementById('password');
	obj_title = "password";	
	if(mandatory(password,obj_title) == false)
	{
		password.focus();
		return false;
	}
	
	/*var req = getXMLHTTP();	
	if (req) {	
	
	
	
	
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					var mySplitResult = req.responseText.split("~");
					
					if(mySplitResult[0] == 1)
					{
						document.getElementById('toploginpanel').innerHTML=mySplitResult[1];				
						location.href = 'ucpprofile.php'
					}
					else
					{
						document.getElementById('username').value = '';
						document.getElementById('password').value = '';
						document.getElementById('loginerror').innerHTML=mySplitResult[1];
					}
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						//document.getElementById(divid).src='../images/loadingIcon.gif';
					}		
				
			}	*/	
					var uname = document.getElementById('username').value;
					var pwd = document.getElementById('password').value;
					strURL ='loginsuccess.php?uname='+uname+'&pwd='+pwd;
					location.href=strURL;
					//req.open("GET", strURL, true);
					//req.send(null);
				
			
	
	  //}
	
	
}				

function logoutpanel()
{	
location.href = 'logoutsuccess.php';					
}

function adcomment(id)
{
	
	if(trim(document.getElementById('txtcomments').value) == '')
	{
		alert('Please enter comment')	;
		document.getElementById('txtcomments').focus();
		return false;
		
	}
	
	/*var req = getXMLHTTP();	
	if (req) {	
	
	
	
	
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					
						document.getElementById('adcomment').innerHTML=req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('adcomment').src='../images/loadingIcon.gif';
					}		
				
			}		
					
					var val = document.getElementById('txtcomments').value;
					
					strURL ='commentsajax.php?id='+id+'&val='+val;
					req.open("GET", strURL, true);
					req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");  
					req.send(null);
				
			
	
	  }*/
	  var f = document.forms['frmcomments'];
	  f.submit();
}

function adcommentadmin(id,uid)
{
	
	if(trim(document.getElementById('txtcomments').value) == '')
	{
		alert('Please enter comment')	;
		document.getElementById('txtcomments').focus();
		return false;
		
	}
	
	
	var f = document.forms['frmuserstatus'];
	f.action = 'admincommentsajax.php?id='+id+'&uid='+uid;
	f.submit();
	
	/*var req = getXMLHTTP();	
	if (req) {	
	
	
	
	
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					
						document.getElementById('adcomment').innerHTML=req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('adcomment').src='../images/loadingIcon.gif';
					}		
				
			}		
					
					var val = document.getElementById('txtcomments').value;
					
					strURL ='admincommentsajax.php?id='+id+'&val='+val;
					req.open("GET", strURL, true);
					req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=Windows-1256");  
					req.send(null);
				
			
	
	  }*/
}

function emailcheck(val)
{
	
		var req = getXMLHTTP();	
	if (req) {	
	
	
	
	
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					result = req.responseText;
					
					if(result == 'success')
					{
						
						document.getElementById('message').innerHTML='Email address already exist';		
						document.getElementById('submitbtn').innerHTML= '<img src="image/submitgrey.png" align="absmiddle" />';
					}
					else
					{
						document.getElementById('message').innerHTML= '';
						document.getElementById('submitbtn').innerHTML= '<img src="image/submit.png" align="absmiddle" onclick="booking(0); return false;" style="cursor:pointer;" />';
					}
					
						//document.getElementById('submitbtn').innerHTML=req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('submitbtn').innerHTML = "<img src='images/loadingIcon.gif'>";
					}		
				
			}		
					
					
					strURL ='checkemail.php?val='+val;
					req.open("GET", strURL, true);					
					req.send(null);
				
			
	
	  }
	
}

function addreview(id,uid)
{
	if(trim(document.getElementById('txtreview').value) == '')
	{
		alert('Please enter your review')	;
		document.getElementById('txtreview').focus();
		return false;
		
	}
	
	
	
	var req = getXMLHTTP();	
	if (req) {	
	
	
	
	
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
						document.getElementById('rev_msg').style.display='none';
						document.getElementById('addreviewbox').style.display='none';	
						document.getElementById('review_msg').style.display='block';
						
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('rev_msg').style.display='block';
						document.getElementById('rev_msg').innerHTML = "<img src='images/loadingIcon.gif'>";
					}		
				
			}	
			
			var review = document.getElementById('txtreview').value;
			var faci = document.getElementById('rev_faci').value;
			var techi = document.getElementById('rev_teacher').value;
			var loci = document.getElementById('rev_location').value;
			var advi = document.getElementById('rev_courses').value;
			var reweeks = document.getElementById('rev_weeks').value;
			
			var remonthd = document.getElementById('rev_months').value;
			var rewyear = document.getElementById('rev_years').value;
			
			
			var val = 0;

			for( i = 0; i < document.frmschool.revsummer.length; i++ )
			{
			if( document.frmschool.revsummer[i].checked == true )
			val = document.frmschool.revsummer[i].value;
			}
			
			
			

			
			var gift = '';
			 
			if(document.getElementById('gift'))
			{
				if(document.getElementById('gift').checked == true)
				gift = 'Y';
				else
				gift = 'N';
			}
			else
			{
				gift = 'N';
			}
			
					
					
					strURL ='addreview_action.php?id='+id+'&uid='+uid+'&review='+encodeURIComponent(review)+'&faci='+faci+'&techi='+techi+'&loci='+loci+'&advi='+advi+'&gift='+gift+'&reweeks='+reweeks+'&remonthd='+remonthd+'&rewyear='+rewyear+'&revsummer='+val;
					req.open("GET", strURL, true);					
					req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;charset=UTF-8');				
					req.send(null);
				
			
	
	  }
	
}

function statussave(id,uid)
{
	
	var f = document.forms['frmuserstatus'];
	if(document.getElementById('test1').value == 0)
	{
		alert('Please select any one status');
		return false;
	}
	f.action = 'adminusersstatus.php?id='+id+'&uid='+uid;
	f.submit();
}

function changestatus(id,imgid)
{
	
	var req = getXMLHTTP();
	
	if (req) {	
		var query = document.getElementById(imgid+id).src;	
		imgname = query.substr(query.lastIndexOf("/")+1);
		if(imgname == 'activate.png')
		{	
	
				req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById(imgid+id).src='../image/pending.png';
					document.getElementById(imgid+id).title='Pending';
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById(imgid+id).src='../images/loadingIcon.gif';
					}		
				
			}			
			
			
			strURL ='users_activate.php?mode=activate&id='+id;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
		else
		{
		
		req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById(imgid+id).src='../image/activate.png';
					document.getElementById(imgid+id).title='Activate';
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById(imgid+id).src='../images/loadingIcon.gif';
					}		
				
			}			
			
			strURL ='users_activate.php?mode=pending&id='+id;
			req.open("GET", strURL, true);
			req.send(null);
		
	
	
		}
	}
	

	
}

function delimageusr(id)
{
	var req = getXMLHTTP();
	
	if (req) {	
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('imageid').innerHTML ='<img src="../images/no_photo_50.jpg" align="absmiddle" />';
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('imageid').src='../images/loadingIcon.gif';
					}		
				
			}			
			
			strURL ='users_imgdel.php?id='+id;
			req.open("GET", strURL, true);
			req.send(null);
		
	
	
		}
}

function votethumb(vote,rid,uid)
{
	var req = getXMLHTTP();
	
	if (req) {	
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					document.getElementById('thumbvoting'+rid).innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('thumbvoting'+rid).innerHTML='<img src="../images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			
			strURL ='votin_review.php?vote='+vote+'&rid='+rid+'&uid='+uid;
			req.open("GET", strURL, true);
			req.send(null);
		
	
	
		}
}

function showreply(rid)
{
	document.getElementById('replyrev'+rid).style.display='block';
	
}
function closereply(rid)
{
	document.getElementById('replyrev'+rid).style.display='none';
}

function addreplyreview(rid)
{
	document.getElementById('addrerev'+rid).style.display='block';
	
}
function closeaddreply(rid)
{
	document.getElementById('addrerev'+rid).style.display='none';
}

function addreplyaction(rid,uid)
{
	
	
	var req = getXMLHTTP();
	
	if(document.getElementById('replyreviewtxt'+rid).value == "")
	{
		alert('Please enter reviews reply')
		document.getElementById('replyreviewtxt'+rid).focus();
		return false;
	}
	if (req) {	
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText);
					//document.getElementById('showhide'+id).src=req.responseText;
					
					document.getElementById('mainreplyreview'+rid).innerHTML = req.responseText;
					
					
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('mainreplyreview'+rid).innerHTML='<img src="../images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			var comments = document.getElementById('replyreviewtxt'+rid).value;
			strURL ='adding_reviewreply.php?rid='+rid+'&uid='+uid+'&reply='+encodeURIComponent(comments);
			req.open("GET", strURL, true);
			req.send(null);
		
	
	
		}
	
}

function deletehomeamt(id,wk,acid)
{
	
	var req = getXMLHTTP();
	if (req) {
		if(confirm('Are you sure you want to delete this amount?'))
		{
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					document.getElementById('accvisid').innerHTML = req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						
					}		
				
			}			
			
			strURL ='delete_homeamount.php?id='+id+'&acid='+acid+'&wk='+wk;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
	
		}
}


function deleteresidamt(id,wk,acid)
{
	
	var req = getXMLHTTP();
	if (req) {
		if(confirm('Are you sure you want to delete this amount?'))
		{
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						//alert(req.responseText)
					document.getElementById('studvisid').innerHTML = req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						
					}		
				
			}			
			
			strURL ='delete_resiamount.php?id='+id+'&acid='+acid+'&wk='+wk;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
	
		}
}

function deleteairportamt(id,wk,acid)
{
	
	var req = getXMLHTTP();
	if (req) {
		if(confirm('Are you sure you want to delete this amount?'))
		{
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						//alert(req.responseText)
					document.getElementById('airport_div').innerHTML = req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						
					}		
				
			}			
			
			strURL ='delete_airportamount.php?id='+id+'&acid='+acid+'&wk='+wk;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
	
		}
}

function deletemedamt(id,wk,acid)
{
	
	var req = getXMLHTTP();
	if (req) {
		if(confirm('Are you sure you want to delete this amount?'))
		{
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
						//alert(req.responseText)
					document.getElementById('accmonth').innerHTML = req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						
					}		
				
			}			
			
			strURL ='delete_medicalamount.php?id='+id+'&acid='+acid+'&wk='+wk;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
	
		}
}

function changecourses(val)
{
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('schoolsearchbox').innerHTML = req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('schoolsearchbox').innerHTML='<img src="images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			
			strURL ='displaycourses.php?val='+val;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
	
	
}

function changecitysearch(valc)
{
	
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('citycountryid').innerHTML = req.responseText;
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('citycountryid').innerHTML='<img src="images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			var institute = document.getElementById('insti_sel').value;
			strURL ='displaycitues.php?valcourse='+valc+'&intl='+institute;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
}

function changeweeksamtcourse(val,id,sramt)
{
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('weeksamountshow').innerHTML = req.responseText;					
					grandtotalfinal(sramt)
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('weeksamountshow').innerHTML='<img src="images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			var cid = document.getElementById('selcourses').value;
			strURL ='changeweeksamt.php?val='+val+'&id='+id+'&cid='+cid+'&convamt='+sramt;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
	
	
}

function changeweeksfinalamt(val,id,sramt)
{
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('tothrwkamt').innerHTML = req.responseText;
					
					grandtotalfinal(sramt)
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('tothrwkamt').innerHTML='<img src="images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			var cid = document.getElementById('selcourses').value;
			var hrs = document.getElementById('coursehour').value;
			strURL ='changeweekshrsamt.php?val='+val+'&id='+id+'&cid='+cid+'&hrs='+hrs;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
	
}

function changefullcoursedetail(val,id,sramt)
{
	
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('hoursweeksamount').innerHTML = req.responseText;
					grandtotalfinal(sramt)
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('hoursweeksamount').innerHTML='<img src="images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			
			strURL ='changefullcourse.php?val='+val+'&id='+id+'&convamt='+sramt;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
}

function changecourseduration(val,id,sramt)
{
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('totdurationamt').innerHTML = req.responseText;					
					grandtotalfinal(sramt);
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('totdurationamt').innerHTML='<img src="images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			var cid = document.getElementById('selcoursesmajor').value;
			strURL ='changemajoramt.php?val='+val+'&id='+id+'&cid='+cid;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
	
}

function changefullmajorcoursedetail(val,id,sramt)
{
	
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('courseduration').innerHTML = req.responseText;
					grandtotalfinal(sramt);
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('courseduration').innerHTML='<img src="images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			
			strURL ='changemajoramtfulldetails.php?val='+val+'&id='+id+'&convamt='+sramt;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
}

function grandtotal(sramt)
{
				if(document.getElementById('coursetotalamot'))	
				var txtcour = document.getElementById('coursetotalamot').value;
				else
				var txtcour = 0;
				
				if(document.getElementById('majcoursetotalamot'))	
				var txtcourmaj = document.getElementById('majcoursetotalamot').value;
				else
				var txtcourmaj = 0;
				
				if(document.getElementById('txtamountsfamily'))				
				var txtfam = document.getElementById('txtamountsfamily').value;
				else
				var txtfam = 0;
				
				if(document.getElementById('txtamountsstudent'))	
				var txtstd = document.getElementById('txtamountsstudent').value;
				else
				var txtstd = 0;
				
				if(document.getElementById('txtamountssirport'))
					var txtair = document.getElementById('txtamountssirport').value;
					else
					var txtair = 0;
					if(document.getElementById('txtamountsmedical'))
					var txtmed = document.getElementById('txtamountsmedical').value;
					else
					var txtmed = 0;
					
				
					
					var maintotal =  parseFloat(txtcour) + parseFloat(txtcourmaj) + parseFloat(txtfam) + parseFloat(txtstd) + parseFloat(txtair) + parseFloat(txtmed);
					
					document.getElementById('total_amt').value = r2(maintotal);
					if(sramt != 0)
					var godtotal = parseFloat(sramt) * parseFloat(maintotal);
					else
					var godtotal = maintotal;
					
					document.getElementById('total_sr').value= r2(godtotal) 
}

function delannounceimg(id)
{
	
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('announceimg').innerHTML = 'Image deleted successfully';
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('announceimg').innerHTML='<img src="../images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			
			strURL ='delannounceimg.php?id='+id;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
}

function delauthimg(id)
{
	
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('authimg').innerHTML = 'Image deleted successfully';
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('authimg').innerHTML='<img src="../images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			
			strURL ='delauthimg.php?id='+id;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
}

function delauthattimg(id)
{
	
	var req = getXMLHTTP();
	if (req) {		
	req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {
					//alert(req.responseText)
					document.getElementById('authattimg').innerHTML = 'Image deleted successfully';
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
				else{
						document.getElementById('authattimg').innerHTML='<img src="../images/loadingIcon.gif" align="absmiddle">';
					}		
				
			}			
			
			strURL ='delauthattimg.php?id='+id;
			req.open("GET", strURL, true);
			req.send(null);
		
		}
}
