/**
	* AVATEC CMS Javascript library
**/

<!-- 
function opacity(id, opacStart, opacEnd, millisec) {

    var speed = Math.round(millisec / 100);
    var timer = 0;

    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function closeBox(id)
{
	opacity('alpha_bg',85,0,1500);
	opacity(id,85,0,150);
	
	document.cookie = 'box_newsletter=1;'
	document.getElementById(id).style.display = "none";
	document.getElementById('alpha_bg').style.display = "none";
}

hex = '0123456789ABCDEF';

function encode(theForm) {
  
  new_text = hex_string('document.write(\'<a href=\"mailto:' + theForm.email.value + '\">' + theForm.name.value + '</a>\')');
  theForm.encoded_txt.value = '<script language=\"JavaScript\">eval(unescape(\'' + new_text + '\'))</script>';
}

function hex_string(mystring) {
  newstring = '';
  for (i=0; i<mystring.length; i++) {
    newstring = newstring + '%' + tohex(mystring.charCodeAt(i));
  }
  return newstring;
}

function tohex(n) {
    var hs='0123456789ABCDEF'
    return hs.charAt(Math.floor(n/16))+hs.charAt(n%16);
}


function openWin(url,name) 
{
   popupWin = window.open(url, name,"'toolbar=no,menubar=no,scrollbars=no,resizable=no,height=255,width=521,left=0,top=0");
}

//-->