function validateInt(o)
{     
      return (isInteger(o.value));      
}

function isInteger (s){
      var i;

      if (isEmpty(s))
      if (isInteger.arguments.length == 1) return 0;
      else return (isInteger.arguments[1] == true);

      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);

         if (!isDigit(c)) return false;
      }

      return true;
}

function isEmpty(s){
      return ((s == null) || (s.length == 0))
}

function isDigit (c){
      return ((c >= "0") && (c <= "9"))
}



function deleteConfirmation(url){
			var answer = confirm("Are you sure to delete record (Yes/No)?")
			if (answer){
				//window.location=url;
				alert(url);
				makelinks(url);
			}
}

function deleteConfirmationLoad(url){
			var answer = confirm("Are you sure to delete record (Yes/No)?")
			if (answer){
				window.location=url;				
			}
}

function logoutConfirmation(url){
			var answer = confirm("Are you sure to logout from system (Yes/No)?")
			if (answer){
				mainMenuLinks(url);
			}
}

function getURL(mode){
    var oid = document.getElementById('oid').value;
	var title = document.getElementById('title').value;
	var desc = document.getElementById('description').value;
    if(checkObjectiveNull()){
			var url = "sar/objectives.php?id="+ oid +"&title="+ title +"&desc="+ desc +"&mode="+ mode +"&a=0";			
			makelinks(url);
	}
}

function checkObjectiveNull(){
   form = document.myform;
   if(form.oid.value == ""){
     alert('please fill in objective id');
	 form.oid.focus();
	 return false;
   }
   if(form.title.value == ""){
     alert('please fill in title');
	 form.title.focus();
	 return false;
   }
   if(form.description.value == ""){
     alert('please fill in description');
	 form.description.focus();
	 return false;
   }

   return true;

}

function objToggle(targetId) {
	//alert(targetId);
	//target = document.all(targetId);
	var obj = document.getElementById(targetId);
	//alert(obj.style.display);
	
		if (obj.style.display == "none"){
			obj.style.display="";
			//alert('none');
		} else {	
			obj.style.display="none";
			//alert('blank');
		}

}

//-------------------------------------------------------------------------------------------------------------

function specialtyJump(specialtyID){   
	  //var destinations = document.hotellist.provinces[hotellist.provinces.selectedIndex].value;
	  //check null value;
	  alert(specialtyID);
	  if(specialtyID !=''){
		//jumb to url by set "co" parameter to keep country value;
		window.location = 'index.php?p=search_doctor&specialtyID=' + specialtyID; 
	  }
}


//-------------------------------------------------------------------------------------------------------------
function countryGone(countryValue){   
	  //var destinations = document.hotellist.provinces[hotellist.provinces.selectedIndex].value;
	  //check null value;
	  if(countryValue !=''){
		//jumb to url by set "co" parameter to keep country value;
		window.location = 'hotellist.php?co=' + countryValue; 
	  }
}

//-------------------------------------------------------------------------------------------------------------

function provinceGone(destinationValue, countryValue,sortby){   	
	 //check null value;
	  if((countryValue !='') && (destinationValue != '')){
		//jumb to url by set "co" parameter to keep country value and "des" parameter to keep destination value;
		//window.location = 'hotellist.php?co=' + countryValue + '&des=' + destinationValue+'&sortby='+sortby ; 
		window.location = 'hotellist.php?co=' + countryValue + '&des=' + destinationValue ; 

	  }
}

//------------------------------------------------------------------------------------------------------------

