//=====================================================//
function cancelEdit(){
   msg = "Are you sure to cancel this? \n\nYou will loose the changes";
   if ( confirm (msg) )
   {
      history.back();
   }
}

//=====================================================//
function save(){
   document.forms['edit'].submit();
}

//=====================================================//
function apply(){
   document.forms['edit'].apply.value = "1";
   document.forms['edit'].submit();
}

//=====================================================//
function saveList(task){
   
   frmObj = document.forms['list'];

   if ( frmObj.boxChecked.value == 0 )
   {
      alert("Please tag the record(s) before you proceed");
      return;
   }
   frmObj.task.value = task;
   frmObj.submit(); 
}

//=====================================================//
function saveOrder(){
   
   frmObj = document.forms['list'];
   frmObj.task.value = "order";
   frmObj.submit(); 
}

//=====================================================//
function isChecked(isItChecked){
	if (isItChecked == true){
		document.list.boxChecked.value++;
	}
	else {
		document.list.boxChecked.value--;
	}
}
//=====================================================//
function checkAll( n, fldName ) {
  if (!fldName) {
     fldName = 'cb';
  }
	var f = document.list;
	var c = f.toggle.checked;
	var n2 = 0;
	for (i=0; i < n; i++) {
		cb = eval( 'f.' + fldName + '' + i );
		if (cb) {
			cb.checked = c;
			n2++;
		}
	}
	if (c) {
		document.list.boxChecked.value = n2;
	} else {
		document.list.boxChecked.value = 0;
	}
}

//=====================================================//
function addMedia(room, recordType, id ){
  url = "index.php?_spAction=selectMedia&room=" + room + "&recordType=" + recordType + "&id=" + id ;
  a = window.open(url,"","height=100,width=250,scrollbars=no," +
       "resizable=yes" + ",left=" + (screen.width-250)/2 + ",top=" + (screen.height-100)/2);

}

//=====================================================//
function deleteMedia(room, recordType, id ){
  url = "index.php?_spAction=deleteMedia&room=" + room + "&recordType=" + recordType + "&media_id=" + id ;
  a = window.open(url,"","height=100,width=250,scrollbars=no," +
       "resizable=yes" + ",left=" + (screen.width-250)/2 + ",top=" + (screen.height-100)/2);

}

//=====================================================//
