function getObject(objectId) 
{
    if (document.all & !document.getElementById) {
        return document.all(objectId)
    } else {
        return document.getElementById(objectId)
    }
}


function getObjectProperties (object) {
	var result = '';
	for (var property in object) {
		result += property + ': ' + object[property] + '\r\n';
	}
	return result;
}


function setClassById(idVal, classVal) {
	if(getObject(idVal) == undefined) return true
    getObject(idVal).className=classVal
}

function setBgImageById(idVal, classVal) {
	if(getObject(idVal) == undefined) return true
	alert(getObject(idVal).background-image);
    getObject(idVal).className=classVal
}

function setBgColorById(idVal, val) {
    getObject(idVal).bgColor=val
}

function setVisibilityById(idVal , visib)
{
	obj = getObject(idVal);
	if(visib == true)
		obj.style.visibility = "visible";
	else
		obj.style.visibility = "hidden";
}

function setDisplayById(idVal , visib)
{
	obj = getObject(idVal);
	if(visib == true)
		obj.style.display = "block";
	else
		obj.style.display = "none";
}

function switchDisplayById(idVal)
{
	obj = getObject(idVal);

	if(obj.style.display == "none")
	{
		setDisplayById(idVal , true);
	}else
	{
		setDisplayById(idVal , false);
	}
}

function getValById(idVal)
{
    return getObject(idVal).value;
}

function setValById(idVal , val)
{
    getObject(idVal).value=val;
}

function setDisabledById(idVal , disabledVal)
{
	//alert(getObject(idVal).disabled);
	getObject(idVal).disabled=disabledVal;
	//alert(getObject(idVal).disabled);
}

function setReadOnlyById(idVal , ReadOnlyVal)
{
	//alert(getObject(idVal).disabled);
	getObject(idVal).readOnly=ReadOnlyVal;
	//alert(getObject(idVal).disabled);
}


function setClassByGroup(prefix , start , stop , except , classVal )
{
    for( i = start ; i <= stop ; i++)
    {
        if( i != except)
        {
            idObj = prefix + i;
            setClassById(idObj , classVal)
        }
    }
}

function hideAllByGroup(prefix , start , stop , except)
{
    setClassByGroup(prefix , start , stop , except , 'hidden')   
}

function showAllByGroup(prefix , start , stop , except)
{
    setClassByGroup(prefix , start , stop , except , 'visible')
}

function getSelectedOption(selectId)
{
	selectObj = getObject(selectId)
	index = selectObj.selectedIndex
	selectedOption = selectObj.options[index].value
	return selectedOption
}

function move_item_between_selects(fromId, toId)
{
  var f;
  var SI; /* selected Index */
 
  from = getObject(fromId);
  to   = getObject(toId);
  
  if(from.options.length>0)
  {
    for(i=0;i<from.length;i++)
    {
      if(from.options[i].selected)
      {
        SI=from.selectedIndex;
        f=from.options[SI].index;
        to.options[to.length]=new Option(from.options[SI].text,from.options[SI].value);
        from.options[f]=null;
        i--; /* make the loop go through them all */
      }
    }
  }
}

function selectAllOptionsById(idSelect)
{  
  List = getObject(idSelect);
  if( List == null )
  	return false;
  if (List.length == 0)
	return 0;
  
  for (j=0;j<List.length;j++)
  {
     List.options[j].selected = true;
  }
}

function r_u_shore(text)
{
    return confirm(text);
}

function verif_text(idOb)
{
    obj = getObject(idOb);
    
    if(obj.value == '')
    {
        //alert("EMPTY!!");
        return true;
    }else
    {
        //alert("Not Empty!!");
        return false;
    }
}

function verif_empty(idOb)
{
    obj = getObject(idOb);
    
    if(obj.value == '')
    {
        return true;
    }else
    {
        return false;
    }
}

function verif_empty_value(valOb)
{   
    if(valOb == '')
    {
        return true;
    }else
    {
        return false;
    }
}

function verif_selected(idSelected)
{
    selectedVal = getSelectedOption(idSelected);
    
    if(selectedVal == -1 || selectedVal == '')
    {
        return true;
    }else
    {
        return false;
    }    
}

function set_focus(idOb)
{
    obj = getObject(idOb);
    obj.focus();
    obj.focus();
}

function isDefined(variable)
{
return (!(!( variable||false )))
}

function isdefined(varr)
{
	if(typeof(varr) !="undefined")
		return true;
	else
	 	return false;
}

function getFileContents(fileName , parameter , callbackFunc)
{
	fileFullName = fileName;
	if(parameter != "")
		fileFullName += parameter;	

	getFile(fileFullName , callbackFunc);
	//return postFileReady();
}

function getFile(pURL , callbackFunc) {
   if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc 
      xmlhttp=new XMLHttpRequest();
      xmlhttp.onreadystatechange=callbackFunc;
      	xmlhttp.open("GET", pURL, true);

      xmlhttp.send(null);
   } else if (window.ActiveXObject) { //IE 
      xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); 
      if (xmlhttp) {
         xmlhttp.onreadystatechange=callbackFunc;

         xmlhttp.open('GET', pURL, true);


         xmlhttp.send();
      }
   }
}

///
///
function getFileContentsArr(fileName , parameter , callbackFunc , reqArr , indexReq)
{
	fileFullName = fileName;
	if(parameter != "")
		fileFullName += parameter;	

	getFileArr(fileFullName , callbackFunc ,  reqArr[indexReq]);
	//return postFileReady();
}

function getFileArr(pURL , callbackFunc , ajaxReq) {
   if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc 
      ajaxReq=new XMLHttpRequest();
      ajaxReq.onreadystatechange=callbackFunc;
      	ajaxReq.open("GET", pURL, true);

      ajaxReq.send(null);
   } else if (window.ActiveXObject) { //IE 
      ajaxReq=new ActiveXObject('Microsoft.XMLHTTP'); 
      if (ajaxReq) {
         ajaxReq.onreadystatechange=callbackFunc;

         ajaxReq.open('GET', pURL, true);

         ajaxReq.send();
      }
   }
}
///
///

function getInnerHTML(id)
{
	obj = getObject(id);
	//alert(obj.innerHTML);
}

function setInnerHTMLById(id , val)
{
	obj = getObject(id);
	obj.innerHTML = val;
}

function addInnerHTMLById(id , val)
{
	obj = getObject(id);
	obj.innerHTML += val;
}

function checkMail(mailStr)
{
	var x = mailStr;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true;
	return false;
}

function isObject(o)
{
	return (o && "object" == typeof o) || isFunction(o);
}

function checkUncheckAll(theElement) 
{
     var theForm = theElement.form,z = 2;
     while (theForm[z].type == 'checkbox' && theForm[z].name != 'bifeaza') {
      theForm[z].checked = theElement.checked;
      z++;
     }
}

function isNull(val){return(val==null);}

          function showhideBlock(blockId)
          {
			if (document.getElementById(blockId).style.display == "block")
	            document.getElementById(blockId).style.display = "none";
			else
	            document.getElementById(blockId).style.display = "block";
          }
          function showBlock(blockId)
          {
            document.getElementById(blockId).style.display = "block";
          }
          function hideBlock(blockId)
          {
            document.getElementById(blockId).style.display = "none";
          }