function setStyleProps(object, string){
	var props = string.split(';');
	for (i=0; i<props.length; i++){
		var curr = trim(props[i]);
		if (curr!=''){
			var key = trim(curr.split(':')[0]).toLowerCase();
			var value = trim(curr.split(':')[1]).toLowerCase();
			if (isIEBrowser()){
				//Elimina i "trattini" e imposta a Maiuscola la prima lettera dopo il trattino
				var index = key.indexOf('-');
				while (index !=-1){
					key = key.substring(0, index) + key.substring(index+1, index+2).toUpperCase() + key.substring(index+2, key.length);
					index = key.indexOf('-');
				}
				// object.style.getAttribute(keye);
				object.style.setAttribute(key, value);
				}
			else
				// object.style.getPropertyValue(key);
				object.style.setProperty(key, value, null);
		}
	}
}

function getObject(id){
	return document.getElementById('id');
}

function test(object) {
	object.className='wso0204_selric';
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}

function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

function isIEBrowser(){
	return getBrowser()=='IE';
}

function getBrowser(){
	browsername=navigator.appName;
	if (browsername.indexOf('Netscape')!=-1) {
		browsername="NS";
	}
	else{
		if (browsername.indexOf('Microsoft')!=-1) {
			browsername="IE";
		}
		else {
			browsername="N/A";
		}
	}
	return browsername;
}

function navigateTo(url){
	window.location.href=url;
}	

function aggiorna(componentid,newvalue){	
	document.getElementById(componentid).value = newvalue;
}	

function getParameter(parameter) { 
  var loc = location.search.substring(1, location.search.length);
  var param_value = false;

  var params = loc.split("&");
  for (i=0; i<params.length;i++) {
      param_name = params[i].substring(0,params[i].indexOf('='));
      if (param_name == parameter) {
          param_value = params[i].substring(params[i].indexOf('=')+1)
      }
  }
  if (param_value) {
      return param_value;
  }
  else {
      return false; //Here determine return if no parameter is found
  }
}

function changeImage(object, value){
	object.setAttribute('src',value);
}

function transferFocus(object){
	alert(object);
	object.setFocus();
}

function F11(page) {
	window.open(page,'','channelmode');
} 

function findOffset(obj) { 
	/**
	* Rileva la posizione dell'oggetto ricevuto in input
	*/
  var curleft = curtop = 0;
  if (obj.offsetParent) {
    curleft = obj.offsetLeft
    curtop = obj.offsetTop
    while (obj = obj.offsetParent) {
      curleft += obj.offsetLeft
      curtop += obj.offsetTop
    }
  }
  return [curleft,curtop];
}

function setStyleDisplay(id, value){
	document.getElementById(id).style.display=value;
}

function getStyleDisplay(id){
	return document.getElementById(id).style.display;
}

function clearInputText(object,text){
	if (object.value==text){
		object.value='';
		}
}

function resetInputText(object,text){
	if (object.value==''){
		object.value=text;
		}
}

function setSpanValue(id, value){
	// Imposta il valore di un elemento <span> HTML avendo come input l'id dell'elemento span e il valore da assegnare
	if (document.getElementById(id)!=null){
		if (document.getElementById(id).firstChild==null){
			var txt = document.createTextNode(value);
			document.getElementById(id).appendChild(txt);
		}
		else{
			document.getElementById(id).firstChild.nodeValue=value;
		}
	}
}

function findPosX(obj) {
  var curleft = 0;

  if(obj.offsetParent) {
    while(1) {
      curleft += obj.offsetLeft;
      if(!obj.offsetParent)
        break;
      obj = obj.offsetParent;
    }
  } else if(obj.x) {
    curleft += obj.x;
  }

  obj.style.position = "static";

  return curleft;
}

function findPosY(obj) {
  var curtop = 0;

  if(obj.offsetParent) {
    while(1) {
      curtop += obj.offsetTop;
      if(!obj.offsetParent)
        break;
      obj = obj.offsetParent;
    }
  } else if(obj.y) {
    curtop += obj.y;
  }

  return curtop;
}

function findPos(obj) {
  var left = findPosX(obj);
  var top = findPosY(obj);

  return [left , top];
}

function findPosition( oElement ) {
  if( typeof( oElement.offsetParent ) != 'undefined' ) {
    for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
      posX += oElement.offsetLeft;
      posY += oElement.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oElement.x, oElement.y ];
  }
}

function sleep(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if ((new Date().getTime() - start) > milliseconds){
      break;
    }
  }
}



/*  
  Original: daniusr   
  You are welcomed to modify this script to your needs.
  This script retrieves the time from the internal system clock,
  so it is up to you to make sure the time is accurate or correct.  
  */      
  /*  
function clock(visSec) {
	// Il parametro visSec specifica se visualizzare la dicitura "sec"
	var today = new Date();
	var hours = today.getHours();
	var minutes = today.getMinutes();
	var seconds = today.getSeconds();
	var time_holder; // holds the time
	
	//if the first radio button is checked display 12-hours format time  
	
	if(0==1){  
		// add "AM" or "PM" if the 12-hours format is chosen  
		var ampm = ((hours >= 12) ? " PM" : " AM");  
		// convert the hour to 12-hours format  
		// javascript returns midnight as 0, but since the time is in the 12-hours format  
		// force javascript to return 12
		hours = ((hours == 0) ? "12" : (hours > 12) ? hours - 12 : hours);      
		// add a leading zero if less than 10  
		minutes = ((minutes < 10) ? "0" + minutes : minutes);  
		seconds = ((seconds < 10) ? "0" + seconds : seconds);
		time_holder = hours + ":" + minutes + ":" + seconds + ampm;
		document.getElementById('jsClock').innerHTML = time_holder;  
	}
	
	if(0==0){
		// add a leading zero if less than 10
		hours = ((hours < 10) ? "0" + hours : hours);  
		minutes = ((minutes < 10) ? "0" + minutes : minutes);  
		seconds = ((seconds < 10) ? "0" + seconds : seconds);  
		time_holder = hours + ":" + minutes
		time_holder2 = seconds + (visSec ? " sec" : "");  
		document.getElementById('jsClockMin').innerHTML = time_holder;  
		document.getElementById('jsClockSec').innerHTML = time_holder2;  
	}
 
	// keep the clock ticking  
	setTimeout("clock("+visSec+")", 1000);  
}    */ 
