if(!document.getElementById){
 if(document.all)document.getElementById=function(){
    if(typeof document.all[arguments[0]]!="undefined"){ return document.all[arguments[0]];}
    else { return null;}
  }
  else if(document.layers)
  document.getElementById=function(){
    if(typeof document[arguments[0]]!="undefined"){ return document[arguments[0]];}
    else { return null;}
  }
}

function closeAlert()
{
document.getElementById('messageDIV').style.visibility="hidden"
document.getElementById('messageDIV').innerHTML="";
document.getElementById('messageDIV').style.top=-1000+"px";
document.getElementById('messageDIV').style.left=-1000+"px";
}

function showAlert(msgAlert)
{
var scrOfY = 0;
 if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;}
 else if(document.body && (document.body.scrollLeft || document.body.scrollTop)){scrOfY = document.body.scrollTop;}
 else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)){scrOfY = document.documentElement.scrollTop;}
 if(typeof(window.innerWidth)=='number'){myWidth = window.innerWidth;}
 else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){myWidth = document.documentElement.clientWidth;}
 else if(document.body && (document.body.clientWidth || document.body.clientHeight)){myWidth = document.body.clientWidth;}
var x=(myWidth-340)/2;
var y=200;
document.getElementById('messageDIV').innerHTML="<a href='javascript:closeAlert()'><img src='/images/close.gif' width='14' height='13' alt='x' border=0 style='float:right'><\/a><div style=\"padding: 16px 13px 16px 13px;\">"+msgAlert+"<\/div>";
document.getElementById('messageDIV').style.visibility="visible";
document.getElementById('messageDIV').style.top=scrOfY+y+"px";
document.getElementById('messageDIV').style.left=x+"px";
}

function showContacts()
{
showAlert('<h3>За контакти<\/h3><p>За контакти с Фондация Годишни награди за пътна безопасност използвайте телефон 02 952 6666 или e-mail: info@nagradi.org<\/p>');
}

function showSM(menuID)
{
document.getElementById(menuID).style.display="block";
}

function hideSM(menuID)
{
document.getElementById(menuID).style.display="none";
}

function getKey(e)
{
if(window.event) {keynum=e.keyCode;}
else if(e.which) {keynum=e.which;}
if(parseInt(keynum)==27){if(typeof hideImage=='function'){hideImage();}closeAlert();}
if(typeof showDir=='function'){
 if(parseInt(keynum)==39){showDir(1);}
 if(parseInt(keynum)==37){showDir(-1);}
 }
}
