function netFave(unid,option,i)
{
		
	AjaxRequest.get(
	  {
		'url':'../../inc/js/ajax/netFave.php?unid=' + unid + "&option=" + option + "&i=" + i
		,'onSuccess':function(req){
			
			document.getElementById('favelabel_'+i).innerHTML = req.responseText;
	
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { document.getElementById('favelabel_'+i).innerHTML = '<img src="images/4-1.gif" />'; }

			
	  }
	);
	
}

function netFave2(relid,option,i)
{
		
	AjaxRequest.get(
	  {
		'url':'../../inc/js/ajax/netFave2.php?relid=' + relid + "&option=" + option + "&i=" + i
		,'onSuccess':function(req){
			
			document.getElementById('favelabel_'+i).innerHTML = req.responseText;
	
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { document.getElementById('favelabel_'+i).innerHTML = '<img src="images/4-1.gif" />'; }

			
	  }
	);
	
}

function move(mode,relid,i)
{
		
	AjaxRequest.get(
	  {
		'url':'../../inc/js/ajax/mode.php?mode=' + mode + '&relid=' + relid + "&i=" + i
		,'onSuccess':function(req){
			
			document.getElementById('userbox_'+i).innerHTML = req.responseText;
	
			},
			'onError':function(req){
			//alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { document.getElementById('userbox_'+i).innerHTML = '<center><img src="images/4-1.gif" /></center>'; }

			
	  }
	);
	
}




function niceMove(mode,relid,i)
{
	$(function() {
	
	$(".delbutton").click(function(){
	var del_id = element.attr("id");
	var info = 'mode=' + mode + '&relid=' + relid + '&i=' + i
	if(confirm("Sure you want to move this user? "))
	{
	$.ajax({
	type: "GET",
	url: "mode.php",
	data: info,
	success: function(){
	}
	});
	$(this).parents(".record").animate({ backgroundColor: "#fbc7c7" }, "fast")
	.animate({ opacity: "hide" }, "slow");
	}
	return false;
	});
	});	
	
}






function saveDirectorNote(mceid,appid)
{
	var ed = tinyMCE.get('director_note_'+mceid);
	ed.setProgressState(1); // Show progress
	var dirnotes
	dirnotes = document.getElementById("dirnotes_"+mceid)
	
	var msgspan = document.getElementById("msgreturn_"+mceid)
	
	var content
	content = ed.getContent();
	//alert(content);	
	if (content == '')
	content = '-'
	
	AjaxRequest.get(
	  {
		'url':'../../inc/js/ajax/saveNote.php?note=' + content + "&appid=" + appid 
		,'onSuccess':function(req){
			
			//alert(req.responseText);
			dirnotes.innerHTML = '';
			dirnotes.innerHTML = content;
			msgspan.innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { msgspan.innerHTML = '<img src="images/4-1.gif" />'; }

			
	  }
	);

}


function saveGeneralNote(userid)
{
	var ed = tinyMCE.get('note');
	//ed.setProgressState(1); // Show progress
	
	
	var msgspan = document.getElementById("notepad");
	
	var content
	content = ed.getContent();
	//alert(content);	
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/saveGenNote.php?note=' + content + "&userid=" + userid 
		,'onSuccess':function(req){
			
			msgspan.innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { msgspan.innerHTML = '<center><br/><br/><img src="images/24-0.gif" /></center>'; }

			
	  }
	);

}

function deleteGeneralNote(id,userid)
{
	
	
	var msgspan = document.getElementById("notepad")
	
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/deleteGenNote.php?id=' + id + '&userid=' + userid
		,'onSuccess':function(req){
			
			msgspan.innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { msgspan.innerHTML = '<center><br/><br/><img src="images/24-0.gif" /></center>'; }

			
	  }
	);

}


function updateNote(appid)
{
	var ed = tinyMCE.get('note');
	//ed.setProgressState(1); // Show progress
	
	//var msgspan = document.getElementById("note")
	
	var content
	content = ed.getContent();
	if (content == '')
	content = '-'
	
	//alert(escape(content));	
	
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/saveNote.php?note=' + content + "&appid=" + appid 
		,'onSuccess':function(req){
			
			//alert(req.responseText);
			
			document.getElementById('applybox').innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { document.getElementById('applybox').innerHTML = '<img src="images/4-1.gif" />'; }

			
	  }
	);

}





function saveScore(score,appid)
{
	var msgspan = document.getElementById("score_"+appid)
	
	AjaxRequest.get(
	  {
		'url':'../../inc/js/ajax/saveScore.php?score=' + score + "&appid=" + appid 
		,'onSuccess':function(req){
			
			msgspan.innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { msgspan.innerHTML = '<img src="images/4-1.gif" />'; }

			
	  }
	);

}



function sendInvite(addresses,msg)
{
	var msgspan = document.getElementById("applybox");
	
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/sendInvite.php?addresses=' + addresses + "&msg=" + msg 
		,'onSuccess':function(req){
			
			msgspan.innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { msgspan.innerHTML = '<center><img src="images/4-1.gif" /></center>'; }

			
	  }
	);

}





function sendJob(addresses,msg,jobid)
{
	var msgspan = document.getElementById("applybox");
	
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/sendJob.php?addresses=' + addresses + "&msg=" + msg + "&job=" + jobid
		,'onSuccess':function(req){
			
			msgspan.innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { msgspan.innerHTML = '<center><img src="images/4-1.gif" /></center>'; }

			
	  }
	);

}


function setSetting(mkj,msg,jobid)
{
	var msgspan = document.getElementById("applybox");
	
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/sendJob.php?addresses=' + addresses + "&msg=" + msg + "&job=" + jobid
		,'onSuccess':function(req){
			
			msgspan.innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { msgspan.innerHTML = '<center><img src="images/4-1.gif" /></center>'; }

			
	  }
	);

}





function sendList(addresses,msg,jobid)
{
	var msgspan = document.getElementById("applybox");
	
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/sendList.php?addresses=' + addresses + "&msg=" + msg + "&job=" + jobid
		,'onSuccess':function(req){
			
			msgspan.innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { msgspan.innerHTML = '<center><img src="images/4-1.gif" /></center>'; }

			
	  }
	);

}






function forgotPass(email)
{
		
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/frgtpass.php?email=' + email
		,'onSuccess':function(req){
			
			document.getElementById('applybox').innerHTML = req.responseText;
	
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { document.getElementById('applybox').innerHTML = '<img src="images/4-1.gif" />'; }

			
	  }
	);
	
}

function forgotUser(email)
{
		
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/frgtuser.php?email=' + email
		,'onSuccess':function(req){
			
			document.getElementById('applybox').innerHTML = req.responseText;
	
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { document.getElementById('applybox').innerHTML = '<img src="images/4-1.gif" />'; }

			
	  }
	);
	
}






function toggleStyle(tdid)
{
	var td;
	td = document.getElementById(tdid);
	//alert(td);
	if (td.style == "")	
	{
	td.style = "border:1px solid #999;";
	} else if (td.style == "border:1px solid #999;") {
	td.style = "";	
	}
}

function toggleStyle2(tdid)
{
	
	var currentcss;
	currentcss = $("#"+tdid+"").css("border");
	if (currentcss == "")
	{
		$("#"+tdid+"").css({"border" : "1px solid gray"});
	} else if (currentcss == "1px solid gray") {
		$("#"+tdid+"").css({"border" : ""});	
	}
	
}

function toggledatebox(names)
{
	var arrayofnames=names.split(","); 	
	//var theform = formname;
	
	for ( keyVar in arrayofnames ) {
   		//alert(arrayofnames[keyVar]);
		//document.form1.address2.disabled=false;

		if (document.getElementById(arrayofnames[keyVar])  !== null)
		{
			if (document.getElementById(arrayofnames[keyVar]).disabled == true)
			{
				document.getElementById(arrayofnames[keyVar]).disabled = false;
			} else if (document.getElementById(arrayofnames[keyVar]).disabled == false) {
				document.getElementById(arrayofnames[keyVar]).disabled = true;
			}
		}
		
	}
	
	
}



function setUser(usertypec)
{
	//alert("testing")
	document.getElementById("choice_Agent").style.background = "white";
	document.getElementById("choice_Director").style.background = "white";
	document.getElementById("choice_Other").style.background = "white";
	
	var thebox
	thebox = document.getElementById("usertype");
	
	if (usertypec == "Other")
	{
	usertypec = "Director"
	document.getElementById("choice_Other").style.background = "#FFFF66";
	thebox.value = usertypec;
	} else {
	document.getElementById("choice_"+usertypec).style.background = "#FFFF66";
	thebox.value = usertypec;
	}
	
	document.getElementById("signupbutton").disabled = false;
	document.getElementById("signupbutton").style.color = "#000000";
}

function show_hide(text)
{
	
	var tr
	tr = document.getElementById(text);
	if (tr.style.visibility == "visible")
	{
		tr.style.visibility = "collapse";
	} else if (tr.style.visibility == "collapse") {
		tr.style.visibility = "visible";
	}
	
}


function popup(url)
{var newwindow;
	newwindow=window.open(url,'name','height=700,width=600');
	if (window.focus) {newwindow.focus()}
}


function showdiv(divid)
{
	var thediv;
	thediv = document.getElementById(divid);
	if (thediv.className == "hideit")
	{
		thediv.className = "showit"
	} else if (thediv.className == "showit") {
		thediv.className = "hideit"
	}
	
}




   function checkAll(status)
    {
	  var inputs = document.getElementsByTagName('input');
        var checkboxes = [];
        for (var i = 0; i < inputs.length; i++) 
		{

			if (inputs[i].type == 'checkbox') {
				inputs[i].checked =status;
			}
    	}
    }
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	function in_array(neddle, haystack){
for (var i=0; i < haystack.length; i++) {
if (haystack[i] == neddle){
return true;
}
}
return false;
}

//var LEFT = "boxa";
//var RIGHT = "boxb";

function select_txtCompare(a, b){
if( a.text > b.text ) return 1;
else if (a.text < b.text) return -1;
else if (a.text == b.text) {
if (a.value > b.value) return 1;
else if(a.value < b.value) return -1;
}
return 0;
}

function oneright(a, b){
var LEFT = a;
var RIGHT = b;

var a = document.getElementById(LEFT);
var b = document.getElementById(RIGHT);
var al = a.length;
var sv = new Array( );
var st = new Array( );
/* collect selected from a box */
for (var i = 0; i < al; i++) {
if (a.options[i].selected) {
sv[sv.length] = a.options[i].value;
st[st.length] = a.options[i].text;
//a.options[i].selected = false;
}
}
alert (sv.length);
/* colect b box */
var bl = b.length;
var bv = new Array( );
var bt = new Array( );
var sl = sv.length;
var opts = new Array( );

for ( i = 0; i <bl; i++){
bv[bv.length] = b.options[i].value;
bt[bt.length] = b.options[i].text;
opts[opts.length] = new Option (b.options[i].text, b.options[i].value);
}

for (i=0; i<sl; i++){
if ( ! in_array(sv[i], bv) ) {
opts[opts.length] = new Option( st[i], sv[i] );
}
}
b.options.length = 0;
opts.sort(select_txtCompare);

for (i=0; i<opts.length; i++) {
b.options[i] = opts[i];
//b.options[i].selected = true;
}
}

function oneleft(a, b){
var LEFT = a;
var RIGHT = b;

/* colect b box */
var b = document.getElementById(RIGHT);
var bl = b.length;
var bv = new Array( );
var bt = new Array( );
var opts = new Array( );

for ( var i=0; i<b.length; i++ ){
if (!b.options[i].selected)
opts[opts.length] = new Option (b.options[i].text, b.options[i].value);
}

b.options.length = 0;
opts.sort(select_txtCompare);
for (i=0; i<opts.length; i++) {
b.options[i] = opts[i];
}

}

function b_select(box){
	
	var m = document.getElementById(box);
	var ml = m.length;	

	for (var i = 0; i < ml; i++){
		m.options[i].selected = true;
	}

return true;
}





/*
 +-------------------------------------------------------------------+
 |                   J S - T O O L T I P   (v1.3)                    |
 |                                                                   |
 | Copyright Gerd Tentler               www.gerd-tentler.de/tools    |
 | Created: Feb. 15, 2005               Last modified: Dec. 16, 2005 |
 +-------------------------------------------------------------------+
 | This program may be used and hosted free of charge by anyone for  |
 | personal purpose as long as this copyright notice remains intact. |
 |                                                                   |
 | Obtain permission before selling the code for this program or     |
 | hosting this software on a commercial website or redistributing   |
 | this software over the Internet or in any other medium. In all    |
 | cases copyright must remain intact.                               |
 +-------------------------------------------------------------------+

======================================================================================================

 This script was tested with the following systems and browsers:

 - Windows XP: IE 6, NN 4, NN 7, Opera 7, Firefox 1
 - Mac OS X:   IE 5, Safari 1

 If you use another browser or system, this script may not work for you - sorry.

------------------------------------------------------------------------------------------------------

 USAGE:

 Use the toolTip-function with mouse-over and mouse-out events (see example below).

 - To show a tooltip, use this syntax: toolTip(text, width in pixels, opacity in percent)
   Note: width and opacity are optional

 - To hide a tooltip, use this syntax: toolTip()

------------------------------------------------------------------------------------------------------

 EXAMPLE:

 <a href="#" onMouseOver="toolTip('Just a test', 150)" onMouseOut="toolTip()">some text here</a>

======================================================================================================
*/

  var OP = (navigator.userAgent.indexOf('Opera') != -1) ? true : false;
  var IE = (navigator.userAgent.indexOf('MSIE') != -1 && !OP) ? true : false;
  var GK = (navigator.userAgent.indexOf('Gecko') != -1) ? true : false;
  var NN4 = document.layers;
  var DOM = document.getElementById;

  function TOOLTIP() {
//----------------------------------------------------------------------------------------------------
// Configuration
//----------------------------------------------------------------------------------------------------
    this.width = 200;                     // width (pixels)
    this.bgColor = '#e9f1ff';             // background color
    this.textColor = '#333333';           // text color
    this.borderColor = '#a1b6db';         // border color
    this.opacity = 85;                    // opacity (percent) - doesn't work with all browsers
    this.cursorDistance = 10;              // distance from cursor (pixels)

    // don't change
    this.text = '';
    this.height = 0;
    this.obj = 0;
    this.sobj = 0;
    this.active = false;

// -------------------------------------------------------------------------------------------------------
// Functions
// -------------------------------------------------------------------------------------------------------
    this.create = function() {
      if(!this.sobj) this.init();

      var t = '<table border=0 cellspacing=0 cellpadding=4 width=' + this.width + ' bgcolor=' + this.bgColor + '><tr>' +
              '<td align=center><font color=' + this.textColor + '>' + this.text + '</font></td></tr></table>';

      if(NN4) {
        t = '<table border=0 cellspacing=0 cellpadding=1><tr><td bgcolor=' + this.borderColor + '>' + t + '</td></tr></table>';
        this.sobj.document.write(t);
        this.sobj.document.close();
      }
      else {
        this.sobj.border = '1px solid ' + this.borderColor;
        this.setOpacity();
        if(document.getElementById) document.getElementById('ToolTip').innerHTML = t;
        else document.all.ToolTip.innerHTML = t;
      }
      if(DOM) this.height = this.obj.offsetHeight;
      else if(IE) this.height = this.sobj.pixelHeight;
      else if(NN4) this.height = this.obj.clip.bottom;

      this.show();
    }

    this.init = function() {
      if(DOM) {
        this.obj = document.getElementById('ToolTip');
        this.sobj = this.obj.style;
      }
      else if(IE) {
        this.obj = document.all.ToolTip;
        this.sobj = this.obj.style;
      }
      else if(NN4) {
        this.obj = document.ToolTip;
        this.sobj = this.obj;
      }
    }

    this.show = function() {
      var ext = (document.layers ? '' : 'px');
      var left = mouseX;
      var top = mouseY;

      if(left + this.width + this.cursorDistance > winX) left -= this.width + this.cursorDistance;
      else left += this.cursorDistance;

      if(top + this.height + this.cursorDistance > winY) top -= this.height;
      else top += this.cursorDistance;

      this.sobj.left = left + ext;
      this.sobj.top = top + ext;

      if(!this.active) {
        this.sobj.visibility = 'visible';
        this.active = true;
      }
    }

    this.hide = function() {
      if(this.sobj) this.sobj.visibility = 'hidden';
      this.active = false;
    }

    this.setOpacity = function() {
      this.sobj.filter = 'alpha(opacity=' + this.opacity + ')';
      this.sobj.mozOpacity = '.1';
      if(this.obj.filters) this.obj.filters.alpha.opacity = this.opacity;
      if(!document.all && this.sobj.setProperty) this.sobj.setProperty('-moz-opacity', this.opacity / 100, '');
    }
  }

//----------------------------------------------------------------------------------------------------
// Build layer, get mouse coordinates and window width, create tooltip-object
//----------------------------------------------------------------------------------------------------
  var tooltip = mouseX = mouseY = winX = winY = 0;

  if(document.layers) {
    document.write('<layer id="ToolTip"></layer>');
    document.captureEvents(Event.MOUSEMOVE);
  }
  else document.write('<div id="ToolTip" style="position:absolute; z-index:99"></div>');
  document.onmousemove = getMouseXY;

  function getMouseXY(e) {
    if(IE) {
      mouseX = event.clientX + document.body.scrollLeft;
      mouseY = event.clientY + document.body.scrollTop;
    }
    else {
      mouseX = e.pageX;
      mouseY = e.pageY;
    }
    if(mouseX < 0) mouseX = 0;
    if(mouseY < 0) mouseY = 0;

    else if(GK || NN4) {
      winX = window.innerWidth - 25;
      winY = window.innerHeight;
    }
    else if(DOM) {
      winX = document.body.offsetWidth - 25;
      winY = document.body.offsetHeight;
    }
    else {
      winX = screen.width - 25;
      winY = screen.height;
    }
    if(tooltip && tooltip.active) tooltip.show();
  }

  function toolTip(text, width, opacity) {
    if(text) {
      tooltip = new TOOLTIP();
      tooltip.text = text;
      if(width) tooltip.width = width;
      if(opacity) tooltip.opacity = opacity;
      tooltip.create();
    }
    else if(tooltip) tooltip.hide();
  }
  
  
function SelectMoveRows(SS1,SS2){
    var SelID='';
    var SelText='';
    
	
	// Move rows from SS1 to SS2 from bottom to top
    for (i=SS1.options.length - 1; i>=0; i--)
    {
        if (SS1.options[i].selected == true)
        {
            SelID=SS1.options[i].value;
            SelText=SS1.options[i].text;
            var newRow = new Option(SelText,SelID);
            SS2.options[SS2.length]=newRow;
            SS1.options[i]=null;
        }
    }
    //SelectSort(SS2);
}
function SelectSort(SelList){
    var ID='';
    var Text='';
    for (x=0; x < SelList.length - 1; x++)
    {
        for (y=x + 1; y < SelList.length; y++)
        {
            if (SelList[x].text > SelList[y].text)
            {
                // Swap rows
                ID=SelList[x].value;
                Text=SelList[x].text;
                SelList[x].value=SelList[y].value;
                SelList[x].text=SelList[y].text;
                SelList[y].value=ID;
                SelList[y].text=Text;
            }
        }
    }
}




	
	
function testEmail()
{
	var message
	var subject
	message = escape(document.getElementById("messageBody").value);
	subject = escape(document.getElementById("messageSubject").value);
	
	//alert(message);	
	if (content == '') {
		alert('Messages cannot be empty.');
	} else {
		
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/testEmail.php?message=' + message + "&subject=" + subject
		,'onSuccess':function(req){
			
			//alert(req.responseText);
			
			document.getElementById('test_email_msg').innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { document.getElementById('test_email_msg').innerHTML = '<img src="images/4-1.gif" />'; }
	
			
	  }
	);
	
	}
	
	

}	
	
	
	
	
	
	

function AddMessage(appid,userid,to)
{
	var ed = tinyMCE.get('message_add');
	//ed.setProgressState(1); // Show progress
	
	//var msgspan = document.getElementById("note")
	
	var content
	content = ed.getContent();
	
	//alert(escape(content));	
	if (content == '') {
		alert('Messages cannot be empty.');
	} else {
		
	AjaxRequest.get(
	  {
		'url':'../inc/js/ajax/addMessage.php?message=' + content + "&appid=" + appid + "&userid=" +  userid + "&to=" + to
		,'onSuccess':function(req){
			
			//alert(req.responseText);
			
			document.getElementById('message_box').innerHTML = req.responseText;
			
			},
			'onError':function(req){
			alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
			},
			'onLoading':function() { document.getElementById('message_box').innerHTML = '<img src="images/4-1.gif" />'; }
	
			
	  }
	);
	
	}
	
	ed.setContent('');

}
	
	
	
function toggleEditor(id) {
	if (!tinyMCE.get(id))
		tinyMCE.execCommand('mceAddControl', false, id);
	else
		tinyMCE.execCommand('mceRemoveControl', false, id);
}	
	
	
function removeEditor(id) {
	if (!tinyMCE.get(id))
	tinyMCE.execCommand('mceRemoveControl', false, id);
}



function checkAllByClass(clazz) {
	var array = document.getElementsByTagName("input");

		for(var ii = 0; ii < array.length; ii++)
		{
		
			   if(array[ii].type == "checkbox")
			   {
					   if(array[ii].className == clazz)
					   {
						
							if (array[ii].checked == true)
							{
							array[ii].checked = false;
							} else {
							array[ii].checked = true;
							}
						} 
					
			
			   }
		}
	
}




function setVals4(clazz,val) 
{
	
	var array = document.getElementsByTagName("select");
	
	for(var g = 0; g < array.length; g++)
	{
		
			
			sel = array[g];
			//sel = document.myform.sel[g];
			
			for (i=0; i<sel.options.length; i++) {
			//alert(sel.options[i].value)
			
				if (sel.className == clazz) 
				{
					if (sel.options[i].value == val) {
						sel.selectedIndex = i;
						
					}
				}
				
			}
		
	
	
	
	}

	
}









function changePage(newLoc)
 {
   nextPage = newLoc.options[newLoc.selectedIndex].value
		
   if (nextPage != "")
   {
      document.location.href = nextPage
   }
 }
 
 
 
 
 
 

function insertAtCaret(areaId,text) {
	var txtarea = document.getElementById(areaId);
	var scrollPos = txtarea.scrollTop;
	var strPos = 0;
	var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ? 
		"ff" : (document.selection ? "ie" : false ) );
	if (br == "ie") { 
		txtarea.focus();
		var range = document.selection.createRange();
		range.moveStart ('character', -txtarea.value.length);
		strPos = range.text.length;
	}
	else if (br == "ff") strPos = txtarea.selectionStart;
	
	var front = (txtarea.value).substring(0,strPos);  
	var back = (txtarea.value).substring(strPos,txtarea.value.length); 
	txtarea.value=front+text+back;
	strPos = strPos + text.length;
	if (br == "ie") { 
		txtarea.focus();
		var range = document.selection.createRange();
		range.moveStart ('character', -txtarea.value.length);
		range.moveStart ('character', strPos);
		range.moveEnd ('character', 0);
		range.select();
	}
	else if (br == "ff") {
		txtarea.selectionStart = strPos;
		txtarea.selectionEnd = strPos;
		txtarea.focus();
	}
	txtarea.scrollTop = scrollPos;
}



function dsp(loc){
   if(document.getElementById){
      var foc=loc.firstChild;
      foc=loc.firstChild.innerHTML?
         loc.firstChild:
         loc.firstChild.nextSibling;
      foc.innerHTML=foc.innerHTML=='+'?'-':'+';
      foc=loc.parentNode.nextSibling.style?
         loc.parentNode.nextSibling:
         loc.parentNode.nextSibling.nextSibling;
      foc.style.display=foc.style.display=='block'?'none':'block';}}


