

function swapContent ( id ) {
	if (document.getElementById("Content" + id).style.display == 'none') {
		document.getElementById("Content" + id).style.display = "block";
	} else {
		document.getElementById("Content" + id).style.display = "none";
	}
}



function selectAll () {
	var count;
	var i;
			
	count = document.form.userCheck.length;

	for ( i=0; i<count; i++ ) {
		if ( document.getElementById("masterCheck").checked == false )
			document.getElementsByName("userCheck")[i].checked = false;
		else if ( document.getElementById("masterCheck").checked == true )
			document.getElementsByName("userCheck")[i].checked = true;
	}	
}

function ajax_addUser () {

	var count;
	var i;
	var args = "";
	count = parent["sendSearch"].document.form.countResult.value;
	for ( i=0; i<count; i++ ) {
		args = args +"&add_user_"+ i +"="+ parent["sendSearch"].document.getElementsByName("userCheck")[i].value;
	}	
	
	var myAjax = new Ajax.Request(
	  "test.php",
	  { method: 'get', 
	    parameters: args,
	    onComplete: showUser }
	);
	return false;
}
function ajax_delUser () {

	var count;
	var i;
	var args = "d=smartStart_userList";
	count = document.form.userCheck.value;
	for ( i=0; i<count; i++ ) {
		args = args +"&del_user_"+ i +"="+ document.getElementsByName("userCheck")[i].value;
	}	
	
	var myAjax = new Ajax.Request(
	  "index.php",
	  { method: 'get', 
	    parameters: args,
	    onComplete: showUser }
	);
	return false;
}

function showUser( originalRequest ) {
	document.getElementById('output').innerHTML = "";
 	document.getElementById('output').innerHTML = originalRequest.responseText;
}

/*******************************************************************************
 * Cool DHTML tooltip script II- © Dynamic Drive DHTML code library
 * (www.dynamicdrive.com) This notice MUST stay intact for legal use Visit
 * Dynamic Drive at http://www.dynamicdrive.com/ for full source code
 ******************************************************************************/

var offsetfromcursorX=12; //Customize x offset of tooltip
var offsetfromcursorY=10; //Customize y offset of tooltip

var offsetdivfrompointerX=10; //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=18; //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

var enabletip=false;

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function ddrivetip(thetext, thewidth, thecolor){

	if (typeof thewidth!="undefined") 
		$('dhtmltooltip').style.width=thewidth+"px";
	if (typeof thecolor!="undefined" && thecolor!="") 
		$('dhtmltooltip').style.backgroundColor=thecolor;
	$('dhtmltooltip').innerHTML=thetext;
	enabletip=true;

	return false;
}

function positiontip(e){
	if (enabletip){
		var nondefaultpos=false;
		
		var curX = document.all ? window.event.clientX : e.pageX;
		var curY = document.all ? window.event.clientY : e.pageY;
		
		// Find out how close the mouse is to the corner of the window
		var winwidth=document.all&&!window.opera? ietruebody().clientWidth : window.innerWidth-20;
		var winheight=document.all&&!window.opera? ietruebody().clientHeight : window.innerHeight-20;
	
		var rightedge=document.all&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX;
		var bottomedge=document.all&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY;
	
		var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000;
	
		// if the horizontal distance isn't enough to accomodate the width of the
		// context menu
		if (rightedge<$('dhtmltooltip').offsetWidth){
			// move the horizontal position of the menu to the left by it's width
			$('dhtmltooltip').style.left=curX-tipobj.offsetWidth+"px";
			nondefaultpos=true;
		} else if (curX<leftedge)
			$('dhtmltooltip').style.left="5px";
	else{
		// position the horizontal position of the menu where the mouse is
		// positioned
		$('dhtmltooltip').style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px";
		$('dhtmlpointer').style.left=curX+offsetfromcursorX+"px";
	}

	// same concept with the vertical position
	if (bottomedge< $('dhtmltooltip').offsetHeight){
		$('dhtmltooltip').style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px";
		nondefaultpos=true;
	} else{
		$('dhtmltooltip').style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px";
		$('dhtmlpointer').style.top=curY+offsetfromcursorY+"px";
	}
	$('dhtmltooltip').style.visibility="visible";
	if (!nondefaultpos)
		$('dhtmlpointer').style.visibility="visible";
	else
		$('dhtmlpointer').style.visibility="hidden";
	}
}

function hideddrivetip(){

		enabletip=false;
		$('dhtmltooltip').style.visibility="hidden";
		$('dhtmlpointer').style.visibility="hidden";
		$('dhtmltooltip').style.left="-1000px";
		$('dhtmltooltip').style.backgroundColor='';
		$('dhtmltooltip').style.width='';

}
