/**
Функции открытия и закрытия подкатегории
Пример:
<div class="emHead"><a href="javascript: shide('answer1')">Вопрос</a></div><div id="answer1" class="em" style="display: none;"><br/>Ответ ответ ответ<br/></div>
*/

function ge()
{
  var ea;
  for( var i = 0; i < arguments.length; i++ ) {
    var e = arguments[i];
    if( typeof e == 'string' )
      e = document.getElementById(e);
    if( arguments.length == 1 )
      return e;
    if( !ea )
      ea = new Array();
    ea[ea.length] = e;
  }
  return ea;
}

function show()
{
  for( var i = 0; i < arguments.length; i++ ) {
    var element = ge(arguments[i]);
    if (element && element.style) element.style.display = 'block';
  }
}

function hide()
{
  for( var i = 0; i < arguments.length; i++ ) {
    var element = ge(arguments[i]);
    if (element && element.style) element.style.display = 'none';
  }
}

function shown(el) {
    el = ge(el);
    return (el.style.display != 'none');
}

function shide(el) {if (shown(el)) {hide(el);} else {show(el);}}


/**
функция открытия нового окна с большой фотографией
работает в: FF,IE,NN,Opera
пример: <a href="javascript:Start('big_img.png', 600, 400)";><img src="small_img.png" alt=""/></a>
**/

timeout = 0;
function Start(URL, WIDTH, HEIGHT) {
windowprops = "width=" + (WIDTH+2) + ",height=" + (HEIGHT+2);
text = "<html><head><title>Photo</title></head><body bgcolor='#dddddd' style='padding: 1px; margin: 0'";
if (timeout != 0) text +=" onLoad=\"setTimeout('window.close()', " + timeout*1000 + ");\"";
text += "><div align=center><a href='javascript:top.window.close();'><img src='" + URL + "' border='0'>";
if (timeout != 0) text +="<br><span style='Tahoma, helvetica' size='-1'>Preview closes after " + timeout + " seconds.</span>";
text += "</a></div></body></html>";
preview = window.open("", "preview", windowprops);
preview.document.open();
preview.document.write(text);
preview.document.close();
}


/**
refreshCaptcha
use:
<input type="hidden" name="captcha_sid" value="31fc87e85f3f2b95fa6eaef2b2068ecb" /><img src="http://www.expodns.org/bitrix/tools/captcha.php?captcha_sid=31fc87e85f3f2b95fa6eaef2b2068ecb" width="180" height="40" id="capchaHolder"/> <a class="reload" href="javascript:refreshCaptcha('capchaHolder')">Обновить цифры</a>
**/
function refreshCaptcha(imgId) {
    var dtNowDate;
    dtNowDate = new Date();
    nMilliseconds = dtNowDate.getTime();
    document.getElementById(imgId).src += '&refresh=' + nMilliseconds;
}


/**
сколько дней осталось до даты?
**/
/**
var today = new Date;
var Future0 = new Date;
ThisYear = "2010";
var FutureMonth = "08"; //январь=00, декабрь=11
var FutureDate = "21"; //1=01, 31=31
var faraevent = "";

Future0.setMonth(FutureMonth, FutureDate);
Future0.setFullYear(ThisYear);
today1 = Date.parse(today);
future1 = Date.parse(Future0);
secleft = future1 - today1;
miliday = 24 * 60 * 60 * 1000;
daysleft = secleft/miliday;
daysleftint = Math.round(daysleft);

if (daysleftint > 1)
document.write("<span style='color:#3E62AE;font-size:110%'>До начала выставки</span><br/><span style='color:#ff0000;font-size:120%'>", daysleftint, "</span><br/><span style='color:#3E62AE;font-size:110%'>дней", faraevent , "!</span>");
else if (daysleftint == 1)
document.write(faraevent, "<span style='color:#ff0000;font-size:120%'>Открытие завтра!</span>");
else if (today1 == future1)
document.write(faraevent, "<span style='color:#ff0000;font-size:120%'>Выставка открыта!</span>");
**/
