function SelectCountry(country)
{
	var page="order.php?choice=1&country="+country;
	window.open(page, '_parent');
}

function SelectRegion(country, region)
{
	var page="order.php?choice=1&country="+country+"&region="+region;
	window.open(page, '_parent');
}

function SelectPlace(country, region, place)
{
	var page="order.php?choice=1&country="+country+"&region="+region+"&place="+place;
	window.open(page, '_parent');
}



function banners(i,banCount)
{
	    for (var jj=0; jj<banCount; jj++)
	       document.all("b00"+jj).style.display = "none";

	       if (i == banCount) i = 0;
	       document.all("b00"+i).style.display = "";
	       i=i+1;
	       if (i == banCount) i = 0;
	       document.all("b00"+i).style.display = "";
	       i=i+1;
	       if (i == banCount) i = 0;
	       document.all("b00"+i).style.display = "";

	     j= i + 1;
	     ban = banCount;
	     timerID = setTimeout("banners(j,ban)",3000);
}
//------------------------------------------------------------------------------

  function ShowSearchFormIfOrder() {
    var str = window.location.href;
    var pos = str.indexOf('/order.php');
    if (pos > -1) onloadwindow();
  }
//------------------------------------------------------------------------------

/*
 * Comment
 */
function cls_opn(id_tbl,id_spn) {
  if (this.document.getElementById(id_spn).innerHTML == 'скрыть') {
    document.getElementById(id_spn).innerHTML = 'показать';
    document.getElementById(id_tbl).style.display = 'none';
  } else {
    document.getElementById(id_spn).innerHTML = 'скрыть';
    document.getElementById(id_tbl).style.display = '';
  }
}
//------------------------------------------------------------------------------

function cls_opn1(id_tbl,id_css) {
  document.getElementById(id_tbl).className = 'block_text_cls'+id_css;
  document.getElementById(id_tbl+'_textcls').className = 'block_title'+id_css;
  document.getElementById(id_tbl+'_text').style.paddingBottom = 5;
}
//------------------------------------------------------------------------------

function cls_opn2(id_tbl,id_css,title) {
  if (this.document.getElementById(id_tbl+'_textspan').innerHTML == 'ПОКАЗАТЬ ПОЛНЫЙ СПИСОК'+title) {
    document.getElementById(id_tbl).className = 'block_text'+id_css;
//    document.getElementById(id_tbl+'_').className = 'block_title_cls';
    document.getElementById(id_tbl+'_text').style.paddingBottom = 0;
    document.getElementById(id_tbl+'_textspan').innerHTML = 'СВЕРНУТЬ';
  } else {
    cls_opn1(id_tbl,id_css);
    document.getElementById(id_tbl+'_textspan').innerHTML = 'ПОКАЗАТЬ ПОЛНЫЙ СПИСОК'+title;
  }
}
//------------------------------------------------------------------------------

  function check_order() {
    if (document.form_order.name.value == '') {
      alert ('Укажите, пожалуйста, Ваше имя.');
      return false;
    }
    if (document.form_order.telephone.value == '') {
      alert ('Укажите, пожалуйста, Ваш телефон.');
      return false;
    }
    if (document.form_order.wishes.value == '') {
      alert ('Укажите, пожалуйста, Ваш заказ.');
      return false;
    }
    return true;
  }
//------------------------------------------------------------------------------

  function check_search() {
    if (document.form_search.key.value == '') {
      alert ('Укажите, что искать.');
      return false;
    }
    return true;
  }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------


function formatCurrency(num) {
  var num2 = '';
  num = num.toString().replace(/\$|\,/g,'');
  num = Math.floor(num).toString();
  if (isNaN(num)) {
    num2 = '0';
  } else {
    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) {
      num2 = num.substring(0,num.length-(4*i+3))+'&nbsp;'+num.substring(num.length-(4*i+3));
    }
    if (num2=='') {
      num2=num;
    }
  }
  return (num2);
}
//------------------------------------------------------------------------------
/*
function linkmenu(obj){
    menus=document.getElementsByTagName("em");

    for( var i=0;  i < menus.length; i++){
            var r=menus.item(i);
                if(!r.getAttribute('skip'))
                        r.className = "";
    }
    obj.className = "selected";
}
*/
//------------------------------------------------------------------------------

function calc2(c){
	if(c ==null)c=1;

	var list=document.getElementById('prices').getElementsByTagName('td');
	if(list !=null){
		for(var i=0; i<list.length; i++){
			var v=list.item(i).getAttribute('v');
			if(v == null){
				v=list.item(i).innerHTML;
				v=parseFloat(v);
				if(0 < v){
					list.item(i).setAttribute('v',v);
				}else{
					v=null;
				}
			}
			if(v != null){
				list.item(i).innerHTML=formatCurrency(v * c);
			}
		}
	}
}
//------------------------------------------------------------------------------

  function calc(c) {
    var val = '&nbsp;&euro;'
    if(c==null) {
      c=1;
      document.getElementById('curs_e').className = 'curs_sel';
      document.getElementById('curs_r').className = 'curs';
      document.getElementById('curs_e').innerHTML = 'Цены в Евро';
      document.getElementById('curs_r').innerHTML = 'Показать цены в Рублях';
    } else {
      val = '&nbsp;р.'
      document.getElementById('curs_e').className = 'curs';
      document.getElementById('curs_r').className = 'curs_sel';
      document.getElementById('curs_e').innerHTML = 'Показать цены в Евро';
      document.getElementById('curs_r').innerHTML = 'Цены в Рублях';
    }

    var list=document.getElementById('prices').getElementsByTagName('td');
    if(list!=null) {
      for(var i=0; i<list.length; i++) {
        var v=list.item(i).getAttribute("v");
        if(v!=null) {
          list.item(i).innerHTML='<b>'+formatCurrency(v * c)+'</b>'+val;
        }
      }
    }
 }
//------------------------------------------------------------------------------

  function view_avia(if_view) {
    document.getElementById('div3').style.display = (if_view==3) ? '' : 'none';
    document.getElementById('div4').style.display = (if_view==4) ? '' : 'none';
 }
//------------------------------------------------------------------------------
