
function change_leng( leng ){
  if(leng==0) text='it:Per la tua regione si sono già impostare la lingua predefinita.';
  else if(leng==1) text='en:For your region have already set the default language.';
  else if(leng==2) text='ru:Для Вашего региона уже задан язык по умолчанию.';
  else  text='it:Per la tua regione si sono già impostare la lingua predefinita.<br>en:For your region have already set the default language.<br>ru:Для Вашего региона уже задан язык по умолчанию.';
  
  jQuery.modal.close();
  jQuery.modal("<div><br>"+text+"</div>", { closeHTML:"<a title='Close' class='modalCloseImg' style='cursor:pointer;'><img src='"+HTTP_HOST+"images/x.png'></a>", containerCss:{ backgroundColor:"#fff", borderColor:"#fff", height:90, padding:0, width:330 }, overlayClose:true});
  setTimeout( function() {
    jQuery.modal.close();
  },4000);
}

function change_distributor(country){
  ffcv = 'For the following countries:';
  ffca={};
  ffca['Italy']='Italy,Portugal,USA,Canada,Spain,Croatia,France,Belgum,Austria,Greece.';
  ffca['Germany']='Germany,Netherlands.';
  ffca['China']='Turkey,China,Arabia,India,Pakistan,Korea,Japan.';
  ffca['Ukraine']='Ukraine, Russia, Greece, Belarus,Estonia,Latvia,Lithuania,Moldova.';

  if(country!='Ukraine')
	showModal( country+' for the following countries: '+ffca[country]+' <br><br>Региональный дистрибьютор - '+country+' не будет определенн! Для Вашего региона, определенного на основе Вашого ip (с учетом PROXY), выбран региональный дестрибьютор - Ukraine.', 490, 290, 5000);
  else
	showModal(country+' for the following countries: '+ffca[country]+' <br><br>Региональный дистрибьютор - Ukraine , уже определенн.', 390, 190, 5000);
}

function searchAfter(str,afret){
  indexFirstAppearance = str.indexOf(afret); //позиция первого вхождения элемента
  if(indexFirstAppearance>=0){
	indexA=afret.length+indexFirstAppearance;
	indexB=indexA+3; //длина искомого значения = 2
	find=str.substring(indexA,indexB);
	find=find.replace("/",""); //убираем из строки знак '/'
	
	return( find );
  }else
	return( false );
}

function strpos (haystack, needle, offset) {
  var i = (haystack+'').indexOf(needle, (offset || 0));
  return i === -1 ? false : i;
}

function find_on_url(arr){
  res=false;
  lp = location.pathname;
  len_lp = lp.length;
  jQuery.each(arr,function(key,val) {
	val = '/'+val;
	pos_v = lp.indexOf(val);
	len_v = val.length;
	ch_aft = lp.charAt(pos_v+len_v);
	if((ch_aft=='/' || ch_aft=='') && len_v<=len_lp) res=true;
  });
  return res;
}

function fade_div(){
  $("body").append('<div id="fade" ></div>');
  body_height = document.height || document.documentElement.scrollHeight;
  $("body #fade").css("height",body_height)
  $("body #fade").fadeTo(0, 0.4);
}
function close_div(id){
  $("#"+id).hide(100)
  $("#fade").remove()
}
//body.fade {position: absolute;top:0px;top:0px;left:0px;width:100%;height:100%;background-color:#000;z-index:1;right: 0px; bottom:0}


