/* Funciones del menu de HEADER */
 

function mtPopUp(address, width, height) {
	if(typeof width  == 'undefined'){ width  = 560; }
	if(typeof height == 'undefined'){ height = 300; }
	var winPopUp;
	winPopUp = window.open(address, '', 'toolbar=0,statusbar=0,scrollbars=yes,location=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left = 100,top = 100');
} 
function mtPopUpText(address) {
	var winPopUp;
	winPopUp = window.open(address, '', 'toolbar=0,statusbar=0,scrollbars=yes,location=0,menubar=0,resizable=1,width=700,height=500,left=100,top=100');
} 
function mtMenuHeaderOut(oThis){
	oThis.className='ButtonHeader';
	oThis.style.cursor = 'default';
}

function mtMenuHeaderOver(oThis){
	oThis.className='ButtonHeaderSelect';
	oThis.style.cursor = 'hand';
}

function mtMenuHeaderOutSelected(oThis){
	oThis.style.cursor = 'default';
}

function mtMenuHeaderOverSelected(oThis){
	oThis.style.cursor = 'hand';
}

function mtMenuHeaderClick(oThis, sUrl){
		window.location=sUrl;
}


/* Funciones del menu de LEFT */

var arrMenuLabel = new Array();
			

function mtMenuSectionsOut(oName){
	identity=document.getElementById("tr"+oName);
	identity.className='boton-bg';
	identity.style.cursor = 'default';

	var imgFlecha;	
	imgFlecha=document.getElementById("imgFlecha"+oName);
	if (imgFlecha != null){
		imgFlecha.src="/images/boton-flecha.gif"
	}
	
	
	var imgBordeDerecho;	
	imgBordeDerecho=document.getElementById("imgBordeDerecho"+oName);
	if (imgBordeDerecho != null){
		imgBordeDerecho.src="/images/boton-rightborder.gif"
	}
	
}

function mtMenuSectionsChildOut(oNameOption, oNameSelectedOption){
	
	if (oNameOption!=oNameSelectedOption){
		mtMenuSectionsOut(oNameOption);
	}
	
}

function mtMenuSectionsOver(oName){
	identity=document.getElementById("tr"+oName);
	identity.className='boton-bgSelect';
	identity.style.cursor = 'hand';

	var imgFlecha;	
	imgFlecha=document.getElementById("imgFlecha"+oName);
	if (imgFlecha != null){
		imgFlecha.src="/images/boton-flecha-over.gif"
	}
	
	var imgBordeDerecho;	
	imgBordeDerecho=document.getElementById("imgBordeDerecho"+oName);
	if (imgBordeDerecho != null){
		imgBordeDerecho.src="/images/boton-rightborder-over.gif"
	}
	
}


function mtMenuSectionsClick(oName){
	oThis=document.getElementById("LinkMenu"+oName);
	if(event.srcElement.tagName=='TD'){
		oThis.children.tags('A')[0].click();
	 }
}






/* Ver que quitar */


// MENU MOUSE OVER 
function menuOver(itemName) {
 clearTimeout(timeOn)
 menuActive = 1
}

// MENU MOUSE OUT 
function menuOut(itemName) {
 if(document.layers) {
 	menuActive = 0 
 	timeOn = setTimeout("hideAllMenus()", 400)
  }
}

// SET BACKGROUND COLOR 
function getImage(name) {
  if (document.layers) {
    return findImage(name, document);
  }
  return null;
}



function findImage(name, doc) {
  var i, img;
  for (i = 0; i < doc.images.length; i++)
    if (doc.images[i].name == name)
      return doc.images[i];
  for (i = 0; i < doc.layers.length; i++)
    if ((img = findImage(name, doc.layers[i].document)) != null) {
      img.container = doc.layers[i];
      return img;
    }
  return null;
}



function getImagePageLeft(img) {
  var x, obj;
  if (document.layers) {
    if (img.container != null)
      return img.container.pageX + img.x;
    else
      return img.x;
  }
  return -1;
}

function getImagePageTop(img) {
  var y, obj;
  if (document.layers) {
    if (img.container != null)
      return img.container.pageY + img.y;
    else
      return img.y;
  }
  return -1;
}

//document.write('<style> .menu{position: absolute;}</style>');
var timeOn = null
numMenus = 100;
document.onmouseover = hideAllMenus;
document.onclick = hideAllMenus;
window.onerror = null;

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} 

// getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	//we couldn't find the object, so we can't change its visibility
	return false;
    }
}


 // changeObjectVisibility


function showMenu(menuNumber, eventObj, labelID) {
    hideAllMenus();
	if(document.layers) {
	img = getImage("img" + menuNumber);
 	x = getImagePageLeft(img);
 	y = getImagePageTop(img);
 	menuTop = y; // LAYER TOP POSITION
	eval('document.layers["menu'+menuNumber+'"].top="'+menuTop+'"');
 	eval('document.layers["menu'+menuNumber+'"].left="'+x+'"');
	}
	eventObj.cancelBubble = true;
    var menuId = 'menu' + menuNumber;
    if(changeObjectVisibility(menuId, 'visible')) {
	return true;
    } else {
	return false;
    }
}

function hideAllMenus() {
    for(counter = 1; counter <= numMenus; counter++) {
	changeObjectVisibility('menu' + counter, 'hidden');
    }
}




function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject





// ***********************
// hacks and workarounds *
// ***********************

// initialize hacks whenever the page loads
window.onload = initializeHacks;

// setup an event handler to hide popups for generic clicks on the document
function initializeHacks() {
    // this ugly little hack resizes a blank div to make sure you can click
    // anywhere in the window for Mac MSIE 5
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	window.onresize = explorerMacResizeFix;
    }
    resizeBlankDiv();
    // this next function creates a placeholder object for older browsers
    createFakeEventObj();
}



function createFakeEventObj() {
    // create a fake event object for older browsers to avoid errors in function call
    // when we need to pass the event object to functions
    if (!window.event) {
	window.event = false;
    }
} // createFakeEventObj



function resizeBlankDiv() {
    // resize blank placeholder div so IE 5 on mac will get all clicks in window
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}

function explorerMacResizeFix () {
    location.reload(false);
}

function mClk(src){ 
	if(event.srcElement.tagName=='TD')
		src.children.tags('A')[0].click();
}


function getObject(objectId) {
    // cross-browser function to get an object's style object given its id
    
   // cross-browser function to get an object's style object given its id
	if (document.all && document.all(objectId)) {
		// MSIE 4 DOM
		return document.all(objectId);}
	else{
		if(document.getElementById(objectId)) {
			// W3C DOM
			return document.getElementById(objectId);
			}
		else{
		
			if (document.layers && document.layers[objectId]) {
				// NN 4 DOM.. note: this won't find nested layers
				return document.layers[objectId];
				} 
			else
				{
				return false;
				}
			}
		}
} 

function mtCheckRbt(chkCurrent, rbtCurrent){
	document.getElementById(chkCurrent).checked = true;
}

function mtUnCheckChk(chkCurrent, rbtCurrent){
	if (document.getElementById(rbtCurrent).checked){
		document.getElementById(chkCurrent).checked = true;
	}
}

function updateOrder(idsArray, section){
	currentOrder=document.getElementById("ddl"+section).value;
	values=new Array(idsArray.length);		// The key is the sorting value, if the value is null, then it's the missing one!
	oldOrder=0;
	toReplace=null;
	for(i=0; i<idsArray.length; ++i){			// Loop through all dropdowns
		ddl=document.getElementById("ddl"+idsArray[i]);
		values[ddl.value-1]="";		// The order's value has been found 
		if((idsArray[i]!=section) && (ddl.value==currentOrder)){
			toReplace=ddl;		// This is the control to update
			cId=idsArray[i];
		}
	}
	for(i=0; i<values.length; ++i){
		if(values[i]==null){		// Then this value wasn't found
			toReplace.options[i].selected=true;
			break;
		}
	}
}


function mtChangeVisibilityDIV(divVisibleText, divInvisibleText, divID)
{
if (document.getElementById(divID).style.display=='none')
{
document.getElementById(divID).style.display='block';
document.getElementById(divVisibleText).style.display='none';
document.getElementById(divInvisibleText).style.display='block';
}
else
{
document.getElementById(divID).style.display='none';
document.getElementById(divVisibleText).style.display='block';
document.getElementById(divInvisibleText).style.display='none';
}
}

function mtControlContactBox()
{
	var flagName;
	var flagSurname;
	var flagEmail;
	flagName = '';
	flagSurname = '';
	flagEmail = '';
	
	// get control values by ID
	var nameVal = document.getElementById('nameContact').value;
	var surnameVal = document.getElementById('surnameContact').value;
	var emailVal = document.getElementById('emailContact').value;
	var checkAccept = document.getElementById('checkAccept').checked;
	
	
	if (!checkAccept)
	{
		alert('Obbligatorio accettare il Dlgs');
		return false;
	}

	// clean help text
	if(nameVal=='il tuo nome')
	{
		nameVal = '';
	}

	if(surnameVal=='il tuo cognome')
	{
		surnameVal = '';
	}

	if(emailVal=='il tuo email')
	{
		emailVal = '';
	}

	// check for name length
	if(!nameVal.length > 0)
	{
		flagName = 'noName';
	}

	// check for surname length
	if(!surnameVal.length > 0)
	{
		flagSurname = 'noSurname';
	}

	// check for email length
	if(!emailVal.length > 0)
	{
		flagEmail = 'noEmail';
	}
	else
	{
		if (!emailCheck(emailVal))
		{
			flagEmail = 'invalidEmail';
		}
	}
	
	if (flagName == '' && flagSurname == '' && flagEmail == '')
	{
		return true;
	}
	else
	{
		var textAlert;
		textAlert = 'Dati obbligatorio mancanti';
		if (flagName == 'noName')
		{
			//alert('You must specify a contact name');
			textAlert = 'You must specify a contact name';
		}
		
		if (flagSurname == 'noSurname')
		{
			if (textAlert.length > 0)
			{
			textAlert = textAlert + '\r\n';
			}
			//alert('You must specify a contact surname');
			textAlert = textAlert + 'You must specify a contact surname';
		}
		
		if (flagEmail == 'noEmail')
		{
			if (textAlert.length > 0)
			{
			textAlert = textAlert + '\r\n';
			}
			//alert('You must specify a contact email');
			textAlert = textAlert + 'You must specify a contact email';
		}

		if (flagEmail == 'invalidEmail')
		{
			if (textAlert.length > 0)
			{
			textAlert = textAlert + '\r\n';
			}
			//alert('You must specify a contact email');
			textAlert = textAlert + 'You must specify a valid email address';
		}

		alert('Dati obbligatorio mancanti');
		return false;
	}
}

function emailCheck (emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("The username doesn't seem to be valid.")
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.")
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("The address must end in a three-letter domain, or two letter country.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}
//  End -->


function switchTFType(){
	var o       = $('#txtToolPass');
	var wrapper = $('#tft_swapper');
	
	// check for required elems existance
	if(o.length == 0 || wrapper.length == 0) return false;
	
	if(o.attr('type') == 'password' && o.attr('value').length == 0){
		o.before("<input type=\"text\" class=\"textBox\" name=\"txtToolPass\" id=\"txtToolPass_text\" value=\"password\"/>");
		o.remove();
		o = $('#txtToolPass_text');
		o.attr('id', 'txtToolPass');		
	}else{
		new_o = $(document.createElement('input'));
		new_o.attr('type', 'password');
		new_o.attr('id', 'txtToolPass');
		new_o.attr('class', 'textBox');
		new_o.attr('name', 'txtToolPass');
		o.replaceWith(new_o);
		new_o.get(0).focus();
	}
}

$.toggleize = function(){
	// toggleize .toggle divs and stuff
	$(".toggle").each(function(index, trigger){
		var trigger = $(trigger);         // the trigger
		var dest_id = trigger.attr('rel');// the destination id
		
		if(typeof dest_id != 'string') return;
		
		var dest    = $('#' + dest_id) // the destination		
		
		if(dest.length == 0) return;
		
		// sets visibility to none by default
		dest.hide();
		
		// converts trigger tags into link if the are not so by default
		if(trigger.get(0).tagName != 'A'){
			var new_trigger = $(document.createElement('A'));
			new_trigger.html(trigger.html());
			trigger.html("");
			trigger.removeAttr('rel');
			trigger.append(new_trigger);
			
			var trigger = new_trigger;
		}
		trigger.attr('href', 'javascript:void(0)');
		trigger.attr('rel', dest_id);
		trigger.attr('title', TOGGLE_SHOW_LABEL);
		
		// creates a flexible trigger indicator
		var trigger_i = $(document.createElement('img'));
		trigger_i.attr('src', TOGGLE_IMG_SHOW);
		trigger_i.attr('border', 0);
		trigger.prepend(trigger_i);
		
		// sets callback
		trigger.click(function(){
			var trigger   = $(this);
			var trigger_i = trigger.children('img');
			var dest      = $('#' + trigger.attr('rel'));
			
			var status_prev = dest.css('display'); 
			var status_next = status_prev == 'none'? '': 'none';
			
			// sets the new status
			status_next == ''? dest.fadeIn(300): dest.fadeOut(300);
			
			// updates trigger and indicator too
			trigger.attr('title', status_next == 'none'? TOGGLE_SHOW_LABEL: TOGGLE_HIDE_LABEL);
			trigger_i.attr('src', status_next == 'none'? TOGGLE_IMG_SHOW: TOGGLE_IMG_HIDE);		
		})
	});
}

$.overlay = {
	obj: 			undefined,
	dialog_obj:		undefined,
	buttons_obj:    undefined,	
	inited: 		false,
	overlay_id: 	'overlay',
	overlay_class: 	'overlay',
	dialog_id: 		'dialog',
	dialog_class:   'dialog',
	opacity: 		0.4,   		// ranges from 0 to 1, gets automatically set for IE
	delay:			300,		// delay for toggling overlay
	
	init: function(css){
		if(this.inited) return false;
		
		var obj = $(document.createElement('div'));
		obj.attr('id', this.overlay_id);
		obj.attr('class', this.overlay_class);
		
		// sets required css properties
		obj.css({
			opacity:				this.opacity,
			filter:                 'alpha(opacity=' + (this.opacity * 100) + ')',
			position: 				'absolute',
			display:  				'none',
			top:	  				'0px',
			left:	  				'0px',
			height:					'100%',
			'z-index':  			990
		});
		
		//if defined, set the user defined properties
		if(typeof css == 'object'){
			obj.css(css);
		// sets some standard css properties
		}else{
			obj.css({
				'background-color':		'#000'
			});		
		}		
		
		var adapt_dimension = function(){
			$.overlay.obj.css({
				width: 	  ($(window).scrollLeft() > 0? $(window).scrollLeft() + $(window).width(): $(window).width()),
				height:   ($(window).scrollTop() > 0? $(window).scrollTop() + $(window).height(): $(window).height())
			});		
		}
		
		// if window is resized then reposition the overlay box
		$(window).scroll(adapt_dimension);	
		$(window).resize(adapt_dimension);	
		
		$('body').append(obj);
		this.obj = $('#' + this.overlay_id);
		this.inited = true;
	},
	show: function(){
		if(typeof this.obj == 'undefined') return false;
		
		this.obj.css({
			width: 	  ($(window).scrollLeft() > 0? $(window).scrollLeft() + $(window).width(): $(window).width()),
			height:   ($(window).scrollTop() > 0? $(window).scrollTop() + $(window).height(): $(window).height())			
		});
		
		this.obj.fadeIn(this.delay);
	},
	hide: function(){
		if(typeof this.obj == 'undefined') return false;
		
		this.obj.fadeOut(this.delay);
	},
	dialog: function(html, css){		
		var dialog_obj = $(document.createElement('div'));
		dialog_obj.attr('id', this.dialog_id);
		dialog_obj.attr('class', this.dialog_class);	
		dialog_obj.html(html);

		dialog_obj.css({
			position: 				'absolute',		
			'z-index':  			991,			
			opacity:				'none'
		});
		
		//if defined, set the user defined properties
		if(typeof css == 'object'){
			dialog_obj.css(css);
		}else{
			dialog_obj.css({
				'background-color':		'#fff',
				width:					'500px'
			});		
		}
		
		var buttons_obj = $(document.createElement('div'));
		buttons_obj.attr('id', this.dialog_id + '_buttons');
		buttons_obj.attr('class', this.dialog_id + '_buttons');
		dialog_obj.append(buttons_obj);
		
		$.overlay.show();
		$('body').append(dialog_obj);		
		this.dialog_obj  = $('#' + this.dialog_id);		
		
		//sets margins according to user-defined size and scroll
		var adapt_position = function(){
			var left = (($(window).width() - $.overlay.dialog_obj.outerWidth()) / 2) + $(window).scrollLeft();
			var top  = (($(window).height() - $.overlay.dialog_obj.outerHeight()) / 2) + $(window).scrollTop();
			$.overlay.dialog_obj.css({ left: left + 'px', top: top + 'px' });				
		}
		
		// if window is resized then reposition the overlay box
		adapt_position();
		$(window).scroll(adapt_position);	
		$(window).resize(adapt_position);			
		
		this.buttons_obj = $('#' + this.dialog_id + '_buttons');				
		this.dialog_action('Proceed', function(){ 
			$.overlay.dialog_obj.remove(); 
			$.overlay.hide();
		});
	},
	dialog_action: function(label, fn, css){
		if(typeof this.buttons_obj == 'undefined') return false;
		if(typeof label    != 'string')  label = "Undo";
		if(typeof fn       != 'function') return false;
		
		
		var button = $(document.createElement('button'));
		button.text(label);
		if(typeof css == 'object') button.css(css);
		button.click(fn);
		this.buttons_obj.append(button);
		return true;
	}
}

$.Netscience = {
	init: function(){
		$.overlay.init();		
		$.toggleize();		
		// default ajax settings
		$.ajaxSetup({
			async: 		true,
			//timeout:	1000,
			type: 		'GET',			
			beforeSend: function(){ $.overlay.show(); },
			//complete:   function(){ $.overlay.hide(); },
			error:		function(XMLHttpRequest, textStatus, errorThrown){ $.Netscience.cb.ajaxError(XMLHttpRequest, textStatus, errorThrown); }
		});
	},
	cb: {
		ajaxError: function(XMLHttpRequest, textStatus, errorThrown){
			var msg = "";
			switch(XMLHttpRequest.status){
				case 403:
				msg = "The page you have requested requires you to be authenticated. Please reload the page in your browser to perform authentication.";
				break;
				default:
				msg = "The page you have requested has generated a fatal error (status code: " + XMLHttpRequest.status + ")";
				break;
			}
			var p = $(document.createElement('p'));
			p.attr('class', 'error-message');
			p.text(msg);
			$.overlay.dialog(p);
		},
		ajaxSuccess: function(){
		},
		ajaxUsrChkBoxSelection: function(xml){
			var r = $('RESPONSE', xml);
			$('ITEM', r).each(function(){
				var id      = $(this).attr('id');
				var checked = $(this).attr('checked') == 'True'? true: false;
				
				if(typeof id != 'undefined' && $('#chkBoxUsers' + id).length == 1){
					$('#chkBoxUsers' + id).attr('checked', checked);
				}
			});	
			$.overlay.hide();
		},
		ajaxContentsChkBoxSelection: function(xml){
			var r = $('RESPONSE', xml);
			$('GROUP', r).each(function(){
				var g    = $(this);
				var name = g.attr('name');
				if(typeof name == 'undefined') return false;

				$('ITEM', g).each(function(){
					var id      = $(this).attr('id');
					var checked = $(this).attr('checked') == 'True'? true: false;
					var group   = $(this).parent().attr('name');
					var chkobj  = $('#chkBoxContents_' + group + id);
					
					if(chkobj.length == 1) chkobj.attr('checked', checked);
				});				
			});			
			$.overlay.hide();		
		}
	}
}

$(function (){	
	$.Netscience.init();
	
	switchTFType();
	
	// make user field empty when focused
	$("#txtToolUserName").focus(function(){ 
		this.value = ''; 
	});
	
	// make the trick with password field too
	$("#txtToolPass").focus(function(){ 
		switchTFType();
	});	
});
