int_obj = '';

function loadField(id) {

	if($(id)) {

		attachTooltip(id);
		Highlight(id);
		clearInterval(int_obj);
	}
}

//Baloon functions

function attachTooltip(elementId){
	if($(elementId)){
		Event.observe(elementId, 'focus', onfocusEle, false);
		Event.observe(elementId, 'blur', onblurEle, false);
		//	   Event.observe(elementId, 'mouseover', onfocusEle, false);
		//	   Event.observe(elementId, 'mouseout', onblurEle, false);
	}
};
function setPage(ele, to_show, sortField, sort){
	
	 if (ele == 1)
	 {
       dispData(0, sortField, sort,ele);
	 }
	 else{
		 var str = (ele - 1) * to_show;
		  dispData(str, sortField, sort,ele);
	 }
}

	
//only for home page tool-tip

function onblurEle(e){
	var id = Event.element(e).id;
	$(id).className = "inputstyle" ;
	$("h-" + id).className = "field-hint-inactive" ;
};

function onfocusEle(e){

	if($(selected_field)) {
		$("h-" + selected_field).className = "field-hint-inactive" ;
		$(selected_field).className = "inputstyle" ;
	}
	var id = Event.element(e).id;
	$(id).className = "inputstyle-focus" ;
	$("h-" + id).className = "field-hint" ;
};

selected_field = '';

function Highlight(id){
	selected_field = id;
	$(id).focus();
};

var corX = 5;
var corY = 30;
function TrapRight(e) {
		if (navigator.appName == 'Netscape'){
				if(e.which == 3) {
					return false;
				}
				else if(e.which == 1) {
					return false;
				}
				
		}
		else if(navigator.appName == 'Microsoft Internet Explorer') {
			if(event.button == 2) {
					return false;
				}
				else if(event.button == 1) {
					return false;
				}
		
		}
 }
function getXY(e) {
  if(navigator.appName == 'Netscape'){
   corX = e.pageX;
   corY = e.pageY;
  }
  else{
   corX = event.clientX;
   corY = event.clientY; 
  }
}

/*
 * The purpose of the function is to select and deselect of checkbox
 */

function dispData(start,sortField,sort,page_no){
	//showLoader(1);	
	var url =  'events.php';
	var myAjax = new Ajax.Request(
	url,
	{
		method: 'get',
		parameters: {mode:'view',start:start,sortField:sortField,sort:sort,page_no:page_no},
		onComplete:showData
	});
}
/*
 The function is placed the result in the div of dispData  return by ajax    
 */
function showData(originalRequest){
	$('dispData').innerHTML = originalRequest.responseText;
	//showLoader(0);
}


