
if (google_analytics == null) var google_analytics = true;

if (google_analytics)
{ // google analytics active
var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-16777299-1']);
  _gaq.push(['_setDomainName', 'none']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
}

var document_cursor_posX = 0, document_cursor_posY = 0; // Переменные координат.
var mouse_object = true;
var sls = true;

// Получим userAgent браузера и переведем его в нижний регистр
function broswer()
{
 var ua = navigator.userAgent.toLowerCase();
 // Определим Internet Explorer
 isIE = (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1); 
 // Opera
 isOpera = (ua.indexOf("opera") != -1); 
 // Gecko = Mozilla + Firefox + Netscape
 isGecko = (ua.indexOf("gecko") != -1);
 // Safari, используется в MAC OS
 isSafari = (ua.indexOf("safari") != -1);
 // Konqueror, используется в UNIX-системах
 isKonqueror = (ua.indexOf("konqueror") != -1);
 // Простая проверка с помощью document.write
 if (isIE) return "ie";
 if (isOpera) return "op";
 if (isGecko) return "ge";
 if (isSafari) return "sa";
 if (isKonqueror) return "kon";
}

var ind = 0;
var blink_color1 = "#009900";
var blink_color2 = "#FF0000";
var blink_type = 1; // 1- мигает текст, 2 - мигает область под текстом DIV
var blink_timer = 1000;

function link_blink() {
 var vis = gebi("id_link_blink");
 if (vis){
 if (ind==0) {
	 if (blink_type==1)  vis.style.color = blink_color1;
	 if (blink_type==2)  vis.style.backgroundColor = blink_color1;
  ind=1;
 }
 else {
	 if (blink_type==1)  vis.style.color = blink_color1;
	 if (blink_type==2)  vis.style.backgroundColor = blink_color2;
  ind=0;
  }}
}

 function link_blink_start()
 {
	setInterval('link_blink()',blink_timer)
 }

function link_blink_id(id) {
 var vis = gebi(id);
 if (vis){
 if (ind==0) {
	 if (blink_type==1)  vis.style.color = blink_color1;
	 if (blink_type==2)  vis.style.backgroundColor = blink_color1;
  ind=1;
 }
 else {
	 if (blink_type==1)  vis.style.color = blink_color1;
	 if (blink_type==2)  vis.style.backgroundColor = blink_color2;
  ind=0;
  }}
}

 function link_blink_start_id(id)
 {
	setInterval('link_blink_id(\''+id+'\')',blink_timer)
 }

// JavaScript Document координаты объекта
function absPosition(obj) { 
      var x = y = 0;
      while(obj) {
            x += obj.offsetLeft;
            y += obj.offsetTop;
            obj = obj.offsetParent;
      }
      return {x:x, y:y}
}

function getDocumentSize(doc) { // getting a real size document with scrolling etc.
  var r = { width: 0, height: 0 };
  var width1=0, width2=0, width3=0, width4=0, maxWidth=0;
  var height1=0, height2=0, height3=0, height4=0, maxHeight=0;
  
  
  if (doc.width) maxWidth = doc.width; 
  if (doc.body) { 
	if (doc.body.scrollWidth) width1 = doc.body.scrollWidth;
	if (doc.body.offsetWidth) width2 = doc.body.offsetWidth; 
  }
  if (doc.documentElement) {
	width3 = doc.documentElement.scrollWidth; 
	width4 = doc.documentElement.clientWidth;
  } 
  
  maxWidth = Math.max(Math.max(Math.max(width1, width2), Math.max(width3, width4)),maxWidth);
  
  if (doc.height) maxHeight = doc.height;
  if (doc.body) {
	if (doc.body.scrollHeight) height1 = doc.body.scrollHeight;
	if (doc.body.offsetHeight) height2 = doc.body.offsetHeight;
  }
  if (doc.documentElement) {
	height3 = doc.documentElement.scrollHeight;
	height4 = doc.documentElement.clientHeight;
  }
  maxHeight = Math.max(Math.max(Math.max(height1, height2), Math.max(height3, height4)),maxHeight);
  
  r.width = maxWidth;
  r.height = maxHeight;
  
  return r;
}

        //start autologged >>> var idTimeLogin = setInterval("autologged('"+login+"',1)",5000);
	    function autologged(login,dirtype,prm) // load info status files on server?
        {
		 //===================================================
		 if (login!='') { clearInterval(idTimeLogin); return; }	
		   else
		    {
				var dir_exch = '';
				if (dirtype==1) dir_exch = "exchange-web/autologged.php"; 
				if (dirtype==2) dir_exch = "autologged.php"; 
				if (dirtype==3) dir_exch = "../exchange-web/autologged.php"; 
				//======================
				$.ajax({   
				url: dir_exch,   
                cache: false,   
                success: function(html)
				{
				  if (html=='rs') 
				  {
					if (prm=='')  location.reload(); else location.href="?"+prm;
				  } 
				}   
                  });
			}
		}   
		
	    function query_files_load(login) // load info status files on server?
        {
		//===================================================
		    $.ajax({   
				url: "server_files.php?login="+login,   
                cache: false,   
                success: function(html)
				{
				  $("#result_Lfiles").html(html);
				}   
                  });  
		}   
 
	    
        function new_bonus_online(login, id, buy_units, info_index) // load info status Active BONUS! on server?
        {
		//===================================================
		    $.ajax({   
				url: "active_bonusLoad.php?login="+login+"&id="+id+"&buy_units="+buy_units+"&info_index="+info_index,
                cache: false,   
                success: function(html)
				{
				//	info_index
				$("#bonus_status").html(html);
				}   
                  });  
		}   
		
		function sendmyclick(login,kuka,name_units,date_bonus,bid,z)
		{
		//===================================================
		    $.ajax({   
				url: "user_statbon_ok.php?login="+login+"&kuka="+kuka+"&date_bonus="+date_bonus+"&bid="+bid,   
                cache: false,   
                success: function(html)
				{
					var lx = html;
					if (html == lx) 
					   { $("#idpr7_"+z).html('Да'); 
					     alert('Фабрика Скидок дарит Вам 5 '+name_units);
					   }
				       else alert('Спасибо, Вам уже было начисленно 5 бонусных '+name_units);
				}   
                  });  			
		}
		
		function send_mail_active_me()
		{
		    $.ajax({   
				url: "../include/ajax_load_params_catalog.php?load_datas=20&service="+service_load,   
                cache: false,   
                success: function(html)
				{
				 //----------
				 var result = co_parseQuery(html);
				 //----------
				 if (result['connect']=='send_mail_220')
				   prsndmail(result);
				 else
				 alert('Ошибка, обратитесь в техническую поддержку support@contep.com.ua');
				}
			});
		}
		
		
var glob_search_logo_click = false;
function search_logo_click(view)
{
    var obj = gebi("idword_query");
	if (obj.value == 'Что вы хотите купить?') { obj.value = ""; obj.style.color = "#0066CC"; }
    glob_search_logo_click = view;
	search_logo();
}
	
function search_logo()
{
 var obj = gebi("idword_query");
 if (obj) { if (obj.value=='' && !glob_search_logo_click) { if (general_page && general_page=='yes') { obj.value="Что вы хотите купить?"; obj.style.color = "#CCCCCC"; }  else obj.value = ''; glob_search_logo_click = false; obj.className = 'style_search_input_no'; }
            else 
			if (obj.value=='')  obj.className = 'style_search_input_no';
			}
}

function search_logo_start() // start time logo visible/hidden
{
 setInterval("search_logo()",500);
}


//Ставим позицию курсора в конец строки
//moveCaretToEnd(document.search_form.word_query)
function moveCaretToEnd(inputObject)
 {  
   if (broswer()=='ie')
   {
     if (inputObject.createTextRange)  
     { var r = inputObject.createTextRange();   
       r.collapse(false);   
       r.select(); } 
   }
   else
   {
    if (inputObject.selectionStart)
    { var end = inputObject.value.length;  
    inputObject.setSelectionRange(end,end);  
    inputObject.focus(); }
   }
 }
 
 
function screenSize() {
    var w, h;
    w = (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));
    h = (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));
    return {w:w, h:h}; 
}

 
// change page functional
window.onresize = function ()
{
  if (typeof repositions_lm == 'function') repositions_lm();
  if (typeof update_coords == 'function') update_coords();
  if (typeof sel_menu_mouse == 'function') sel_menu_mouse();
  if (typeof coords_menu_layer == 'function') coords_menu_layer();
  if (typeof cart_animate_start == 'function') cart_animate_start(0);
}

//auto coord. info img.bonus
var frameWidth = 0, new_fw = 0;
function update_coords()
{
 obj_rol = gebi('zRolik');
 if (obj_rol)
  {
	 obj_rol_posit = gebi('zRolik_posit');
	 //.. && obj_rol.style.width==260+'px' 
	 if (obj_rol.style.left != (absPosition(obj_rol_posit).x-296) && obj_rol.style.width==572+'px') { obj_rol.style.left = (absPosition(obj_rol_posit).x-296)+"px"; obj_rol.style.top = (absPosition(obj_rol_posit).y-101)+"px"; }
	 else
	 {
		 if (obj_rol.style.left != (absPosition(obj_rol_posit).x+5) ) { obj_rol.style.left = (absPosition(obj_rol_posit).x+4)+"px"; obj_rol.style.top = (absPosition(obj_rol_posit).y+100)+"px"; }
	 }
	 //=======
  }
 //--------------------------------------  
 new_fw = document.body.clientWidth; 
 if (frameWidth==new_fw) return;
 frameWidth = new_fw; 
 var z=0;
 while (z<28) 
 {
  z++;
  var obj_lay_bonus = gebi("layer_bonus"+z);
  var obj_lay_newbonus = gebi("layer_newbonus"+z);
  if (obj_lay_bonus)
  {
   var ourDiv = gebi("tbl"+z);
   var fdx = absPosition(ourDiv).x+80;
   var fdy = absPosition(ourDiv).y+33;
   //======================
   obj_lay_bonus.style.left=fdx+"px";
   obj_lay_bonus.style.top=fdy+"px";
  }
  //------------------
  if (obj_lay_newbonus)
  {
   var ourDiv = gebi("tbl"+z);
   var fdx = absPosition(ourDiv).x-30;
   var fdy = absPosition(ourDiv).y-15;
   //======================
   obj_lay_newbonus.style.left=fdx+"px";
   obj_lay_newbonus.style.top=fdy+"px";
  }
 }
} 


function gebi(object)
{
 return document.getElementById(object);
}


var tmp_id_cp = "";
function class_photo(id,type,style)
 {
  if (tmp_id_cp==id && type) return;
  if (type==false || tmp_id_cp=='') tmp_id_cp = id; else id = tmp_id_cp;
  //-------
  if (type=='st2') gebi(id).className="ph_bort_style2";
  else
  {
   //---------
   if (type) gebi(id).className="ph_bort_style1";
        else 
		{ 
		 //-----------
		 tmp_id_cp = ""; 
		 if (style=='st3') gebi(id).className="ph_bort_style4";
         else gebi(id).className="ph_bort_style3"; 
		 //-----------
		}
  }
  
 }
 
//Координаты мыши
function mousePageXY(event) {
    if (!document || !window) return;
	//--------------
	var x = y = 0;
    if (document.attachEvent != null && document.documentElement!=null && window.event) { // Internet Explorer & Opera
	    x = window.event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
        y = window.event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
    } else if (!document.attachEvent && document.addEventListener) { // Gecko
        x = event.clientX + window.scrollX;
        y = event.clientY + window.scrollY;
    } else {
        // Do nothing
    }
    return {x:x, y:y};
}


var IsiPhoneOS;

$(document).ready(function(){
						   
 // mouse settings
 setTimeout(function(){
	document.onmousemove = function(event) {
    var event = event || window.event;
	var mCur = mousePageXY(event); 
	document_cursor_posX = mCur.x; 
	document_cursor_posY = mCur.y; 
	}},1000);

 setTimeout(function(){preloading('start_load')},1000);

 var useragent = navigator.userAgent;
     useragent = useragent.toLowerCase(); 
	 //----------------------------------
 var IsiPhone = useragent.indexOf("iphone") != -1 ;
 var IsiPod = useragent.indexOf("ipod") != -1 ;
 var IsiPad = useragent.indexOf("ipad") != -1 ;
 var IsiPlayBook = useragent.indexOf("playbook") != -1 ;

 IsiPhoneOS = IsiPhone || IsiPad || IsiPod || IsiPlayBook; 
 
});

function text_no_script(text)
{
  strInputCode = text.replace(/&(lt|gt);/g, function (strMatch, p1){return (p1 == "lt")? "<" : ">";});
  var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
  return strTagStrippedText;
}

function string_replace(s,pos_s,replace_s)
 {
  s = s + '';
  while (s.indexOf(pos_s)>=0)
  {
   s = s.replace(pos_s,replace_s);
  }
  return s;
 }

//------------------------------
function string_replace_err(s)
 {
  s = s + '';
  while (s.indexOf("\"")>=0)
  {
   s = s.replace("\"",'&#34;');
  }
  while (s.indexOf("'")>=0)
  {
   s = s.replace("'",'&#39;');
  }
  return s;
 }

//------------------------------
/*function string_replace_post(s)
 {
  s = s + '';
  while (s.indexOf('quot;')>=0)
  {
   s = s.replace('quot;',"\"");
  }
  while (s.indexOf('quot1;')>=0)
  {
   s = s.replace('quot1;',"'");
  }
  return s;
 }*/
 
function string_replace_err_post(s)
 {
  s = s + '';
  while (s.indexOf("\"")>=0)
  {
   s = s.replace("\"",'&#34;');
  }
  while (s.indexOf("'")>=0)
  {
   s = s.replace("'",'&#39;');
  }
  while (s.indexOf("&nbsp;")>=0)
  {
   s = s.replace("&nbsp;",'');
  }
  while (s.indexOf("&lt;")>=0)
  {
   s = s.replace("&lt;",'');
  }
  while (s.indexOf("&gt;")>=0)
  {
   s = s.replace("&gt;",'');
  }
  return s;
 }
 
// replace 148.45618 на 148,45  Standart = false >>> меняет "." на "," и наоборот
function zamena_tochka(summa)
   {
	var napr1,napr2,ostat;
    //---------------
    napr1 = ','; napr2 = '.';
	//---------------
	var gx = summa.indexOf(napr1);
	summa = summa.replace(napr1, napr2); 
	if (gx>0) ostat = summa.substring(gx+1,gx+3);
	if (ostat && ostat.length==0) ostat = '00';
    if (ostat && ostat.length==1) ostat = ostat+'0';
	//==========
	slx = summa.indexOf(napr2);
	if (slx==0) slx = summa.length;
	//=======================
	if (gx>0) summa = summa.substring(0,slx)+napr2+ostat;
    return summa;
   }
   

function prop_imgW(obj_img, img_sm_icoW, img_sm_icoH, heightOk)
 {
   var img_sm_icoW = obj_img.width; // width;
   var img_sm_icoH = obj_img.height; // height;
   //================
   var w = img_sm_icoW;
   var iHeight = img_sm_icoH;
   while (true)
   {
    iHeight--;
	if (iHeight<heightOk) break;
	w = Math.round(iHeight / img_sm_icoH * img_sm_icoW); 
   }
   return w;
 }  
 
 
//Функция переводит символы русского текста в английский 
function imTranslite(str){
	var new_text = '';
	var tbl= new Array(
		['а','a'], ['б','b'], ['в','v'], ['г','g'], ['д','d'], ['е','e'], ['ж','g'], ['з','z'],
		['и','i'], ['й','y'], ['к','k'], ['л','l'], ['м','m'], ['н','n'], ['о','o'], ['п','p'],
		['р','r'], ['с','s'], ['т','t'], ['у','u'], ['ф','f'], ['ы','i'], ['э','e'], ['А','A'],
		['Б','B'], ['В','V'], ['Г','G'], ['Д','D'], ['Е','E'], ['Ж','G'], ['З','Z'], ['И','I'],
		['Й','Y'], ['К','K'], ['Л','L'], ['М','M'], ['Н','N'], ['О','O'], ['П','P'], ['Р','R'],
		['С','S'], ['Т','T'], ['У','U'], ['Ф','F'], ['Ы','I'], ['Э','E'], ['ё',"yo"], ['х',"h"],
		['ц',"ts"], ['ч',"ch"], ['ш',"sh"], ['щ',"shch"], ['ъ',""], ['ь',""], ['ю',"yu"], ['я',"ya"],
		['Ё',"YO"], ['Х',"H"], ['Ц',"TS"], ['Ч',"CH"], ['Ш',"SH"], ['Щ',"SHCH"], ['Ъ',""], ['Ь',""],
		['Ю',"YU"], ['Я',"YA"], ['і',"i"], ['І',"I"], ['ї',"i"], ['Ї',"I"], [' ',"_"]
	);

    var i=0, j=0, found_index=-1;
	while (i<str.length)
	{
	 j=0; found_index=-1;
	 while (j<tbl.length)
	 {
	  if (str[i]==tbl[j][0]) { found_index = j; break; }
	  j++;
	 }
	 if (found_index==-1)  new_text = new_text+str[i]; else new_text = new_text+tbl[found_index][1];
	 i++;
	}
    return new_text;
}



function tb_inline_close(show_message_new_now)
{
 tb_remove(show_message_new_now);
 msg_params.show_message = false;
 //---------------
}

function include_messages(page_name)
{
 msg_params.wwwpage_name = page_name;
 //----- messages
 document.write('<div style="display:none;"><a href="'+msg_params.wwwpage_name+'#TB_inline?height=100&width=200&inlineId=id_infoTB"  title="Информация" class="thickbox" id="link_id_info">инфо</a><div id="id_infoTB" style="display:none" class="style_mx9"><div id="idhelp_message">text</div></div></div>');	
 //----- titles menu
 document.write('<div style="display:none; position:absolute; background-color:#FFFFFF; z-index:9999; padding:5px; border:1px solid #CCCCCC;" class=\"style_mx9\" id=\"id_titles_menu\" onMouseMove=\"javascript:tmmove=true;\" onMouseOut=\"javascript:tmmove=false;\">test</div>');	
 //---------- 
}


function show_message_box()
{
	//--------------------------------
	var obj_message = gebi('idhelp_message');
    var obj_message_link = gebi('link_id_info');
	var button_variant;
	if (obj_message_link && obj_message)
	{
	 if (msg_params.title_box!='')  obj_message_link.title = msg_params.title_box; else obj_message_link.title = 'Сообщение'; 
     obj_message_link.href = msg_params.wwwpage_name+"#TB_inline?height="+msg_params.height+"&width="+msg_params.width+"&inlineId=id_infoTB";
	 //------------------------------
	 if (msg_params.variant==1) 
	 { 
	   var fc = "javascript:tb_inline_close('false')";
	   if (msg_params.function_cancel!='') fc="javascript:"+msg_params.function_cancel+"; tb_inline_close('false'); ";
	   button_variant = "<div style=\"padding:10px;\" align=\"center\"><a href=\"javascript:"+msg_params.function_ok+"; tb_inline_close('false');\" id=\"lws_but2\" onfocus=\"this.blur()\">"+msg_params.button_name1+"</a> <a href=\""+fc+"\" id=\"lws_but2\" onfocus=\"this.blur()\">Отменить</a></div>"; }
	 else
	 if (msg_params.variant==2) 
	 { button_variant = "<div style=\"padding:10px; padding-right:15px;\" align=\"center\"><a href=\"javascript:tb_inline_close('false')\" id=\"lws_but2\" onfocus=\"this.blur()\">"+msg_params.button_name2+"</a></div>"; }
	 else
	 if (msg_params.variant==3) 
	 { 
	   //-----------
	   //<a href=\"javascript:"+msg_params.function_ok+"; tb_inline_close('false');\" id=\"lws_but2\">"+msg_params.button_name1+"</a>
	   button_variant = "<div style=\"padding:10px;\" align=\"center\"> <a href=\"javascript:tb_inline_close('false')\" onfocus=\"this.blur()\" id=\"lws_but2\">Отменить</a></div>"; 
	 }
	 else
	 if (msg_params.variant==4) 
	 { 
	   var fc = "javascript:tb_inline_close('false')";
	   if (msg_params.function_cancel!='') fc="javascript:"+msg_params.function_cancel+"; tb_inline_close('false'); ";
	   button_variant = "<div style=\"padding:10px;\" align=\"center\"><a href=\"javascript:"+msg_params.function_ok+"; tb_inline_close('false');\" onfocus=\"this.blur()\" id=\"lws_but2\">"+msg_params.button_name1+"</a> <a href=\""+fc+"\" id=\"lws_but2\" onfocus=\"this.blur()\">Закрыть</a></div>"; }
	 else
	 if (msg_params.variant==5) 
	 { 
	   var fc = "javascript:tb_inline_close('false')";
	   if (msg_params.function_cancel!='') fc="javascript:"+msg_params.function_cancel+"; tb_inline_close('false'); ";
	   button_variant = "<div style=\"padding:10px;\" align=\"center\"><a href=\"javascript:"+msg_params.function_ok+"; \" onfocus=\"this.blur()\" id=\"lws_but2\">"+msg_params.button_name1+"</a> <a href=\""+fc+"\" id=\"lws_but2\" onfocus=\"this.blur()\">Закрыть</a></div>"; }
	 else
	 if (msg_params.variant==6) 
	 { 
	   var fc = "javascript:tb_inline_close('false')", div_block = "";
	   if (msg_params.function_cancel!='') fc="javascript:"+msg_params.function_cancel+"; tb_inline_close('false'); ";
	   if (msg_params.div_block!='') div_block = msg_params.div_block+" ";
	   //---------------
	   button_variant = "<div style=\"padding:10px;\" align=\"center\"><div style=\"float:left;\">"+div_block+"</div> <div style=\"float:left; padding-left:10px; padding-top:5px;\"><a href=\"javascript:"+msg_params.function_ok+"; tb_inline_close('false');\" id=\"lws_but2\" onfocus=\"this.blur()\">Выбрать</a></div> <div style=\"float:left; padding-left:10px; padding-top:5px;\"><a href=\""+fc+"\" id=\"lws_but2\" onfocus=\"this.blur()\">Отменить</a></div></div>";
	 }
	 else
	 if (msg_params.variant==7) 
	 { 
	   var fc = "javascript:tb_inline_close('false')", div_block = "";
	   if (msg_params.function_cancel!='') fc="javascript:"+msg_params.function_cancel+"; tb_inline_close('false'); ";
	   if (msg_params.div_block!='') div_block = msg_params.div_block+" ";
	   //---------------
	   button_variant = "<div style=\"padding:10px;\" align=\"center\"><div style=\"float:left;\">"+div_block+"</div><div style=\"float:left; padding-left:10px; padding-top:5px;\"><a href=\"javascript:"+msg_params.function_ok+"; tb_inline_close('false');\" id=\"lws_but2\" onfocus=\"this.blur()\">"+msg_params.button_name1+"</a></div> <div style=\"float:left; padding-left:10px; padding-top:5px;\"><a href=\""+fc+"\" id=\"lws_but2\" onfocus=\"this.blur()\">Отменить</a></div></div></div>";
	 }
	 else button_variant = '';
	 //------------------------------
	 obj_message.innerHTML = "<div style=\"padding:10px;\">"+msg_params.text+"</div>"+button_variant;
	
     tb_show(obj_message_link.title, obj_message_link.href, false);
	 msg_params.show_message = true;
	 //---------
	}
	//--------------
}

function load_text_jcl(text)
{
  //--------------------------
 var tmp_obj = text.substr(text.indexOf(":")+1,text.length);
 //-----------------------------
 if (mb_jcl_mas_box[tmp_obj] == undefined || mb_jcl_mas_box[tmp_obj] == '') return 'error_jcl';
                  else return mb_jcl_mas_box[tmp_obj];
}

var msg_params = {width:300, height:150, text:'', variant:'', function_ok:'', function_cancel:'', title_box:'', wwwpage_name:'', div_block:'', button_name1:'Да', button_name2:'Ok', button_name3:'Выбрать', show_message:false };
function message_box(width, height, text, variant, function_ok, title_box, show_message_new_now, function_cancel)
 {
	//-------------------------
	if (text.indexOf('mjcl:')>=0) text = load_text_jcl(text);
	//-------------------------
	variant = variant+"";
	msg_params.width = width;
	msg_params.height = height;
	msg_params.text = text;
	msg_params.variant = variant;
	msg_params.function_ok = function_ok;
	if (function_cancel!=undefined) msg_params.function_cancel = function_cancel;
	msg_params.title_box = title_box;
	//-------------------------
	// rename buttons click
	if (variant.indexOf('name1:')!=-1)
	 {
	   msg_params.button_name1 = variant.substring(6,variant.length);
	   msg_params.variant = 1;
	 }
	// rename buttons click
	if (variant.indexOf('name1-close:')!=-1)
	 {
	   msg_params.button_name1 = variant.substring(12,variant.length);
	   msg_params.variant = 4;
	 }
 	// rename buttons click
	if (variant.indexOf('div_block:')!=-1)
	 {
	   msg_params.div_block = variant.substring(10,variant.length);
	   msg_params.variant = 6;
	 }
 	// rename buttons click
	if (variant.indexOf('div_block-')!=-1)
	 {
	  msg_params.div_block = variant.substring(variant.indexOf(';')+1,variant.length);
	  msg_params.button_name1 = variant.substring(10,variant.indexOf(';'));
	  msg_params.variant = 7;
	 }
	// rename 2 buttons click
	if (variant.indexOf('name2-close:')!=-1)
	 {
	  msg_params.button_name1 = variant.substring(12,variant.length);
	  msg_params.variant = 5;
	 }
	//-------------------------
	if (variant.indexOf('name2:')!=-1)
	 { 
	  msg_params.button_name2 = variant.substring(6,variant.length);
	  msg_params.variant = 2;
	 } 
	//-------------------------
	if (variant.indexOf('name1-disabled:')!=-1)
	 { 
	  msg_params.button_name2 = variant.substring(15,variant.length);
	  msg_params.variant = 3;
	 } 
	//-------------------------
	if (show_message_new_now) tb_inline_close('true');
	else show_message_box();
 }
 
function num_string(number, titles)   
 {   
   var cases = new Array(2, 0, 1, 1, 1, 2);   
   return titles[ (number % 100 > 4 && number % 100 < 20) ? 2 : cases[Math.min(number % 10, 5)] ];   
 }   
 
// query = [id1=>text1&end&id2=>text2]
function co_parseQuery(query) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split('&end&');
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=>');
      if ( ! KeyVal || KeyVal.length != 2 ) { continue; }
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

// query2 = [id1->text1[end]id2->text2]
function co_parseQuery2(query) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split('[end]');
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('->');
      if ( ! KeyVal || KeyVal.length != 2 ) { continue; }
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

// query3 = {{[id1->text1[end]id2->text2]}}-end-
function co_parseQuery3(query) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split('-end-');
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('-->');
      if ( ! KeyVal || KeyVal.length != 2 ) { continue; }
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}


//Функция анимирует radioboxs
function click_rad(index, id_lab, id_chk, count_max)
{
 var i=0;
 while (i<count_max)
 {
  i++;
  var obj_lab = gebi(id_lab+i);
  var obj_chk = gebi(id_chk+i);
  //-------------
  if (!obj_lab || !obj_chk) continue;
  //-------
  if (i==index) 
  {
    obj_lab.className = "rLabelSelected";
	obj_chk.checked = true;
  }
  else
  {
    obj_lab.className = "rLabelunSelected";
	obj_chk.checked = false;
  }
 }
 //-------
}

function select_value_sel(object, value, type_search)
{
 // type_search - [text] or [value]
 // [text]  => search value in text options object
 // [value] => search value in value options object
 var i=0;
 while (i<object.length)
 {
  if ( (object.options[i].text==value && type_search=='text') || (object.options[i].value==value && type_search=='value') )
  {
   object.selectedIndex = i;
   return;
  }
  i++;
 }
}

//Функция анимирует чекбоксы
function click_chk(id_lab, id_chk, type)
{
  var obj_lab = gebi(id_lab);
  var obj_chk = gebi(id_chk);
  //-------------
  if (!obj_lab || !obj_chk) return;
  //-------
  if (obj_chk.checked==false) 
  {
    obj_lab.className = type+"LabelSelected";
	obj_chk.checked = true;
  }
  else
  {
    obj_lab.className = type+"LabelunSelected";
	obj_chk.checked = false;
  }
  //-------
}

 function rand( min, max ) { // Generate a random integer  
     if( max ) {  
         return Math.floor(Math.random() * (max - min + 1)) + min;  
     } else {  
         return Math.floor(Math.random() * (min + 1));  
     }  
  } 

 function replace_kav(s, sing)
 {
  if (s=='') return;
  //-----------------
  if (sing=='in') 
  {
   s = string_replace(s,"'", "&#39;");
   s = string_replace(s,"\"", "&#34;");
   return s;
  }
  else
  if (sing=='out') 
  {
   s = string_replace(s,"&quot;","\"");
   s = string_replace(s,"&apos;","'");
   s = string_replace(s,"&#39;","'");
   s = string_replace(s,"&#34;","\"");
   return s;
  }
  else
  if (sing=='in_system') 
  {
   s = string_replace(s,"'", "(39;)");
   s = string_replace(s,"\"", "(34;)");
   s = string_replace(s,"&apos;", "(apos;)");
   s = string_replace(s,"&quot;", "(34;)");
   s = string_replace(s,"quot;", "(34;)"); // ?
   s = string_replace(s,"&amp;", "(and;)");
   s = string_replace(s,"&lt;", "(lt;)");
   s = string_replace(s,"&gt;", "(gt;)");
   s = string_replace(s,"&", "(and;)");
   s = string_replace(s,"#", "(resh;)");
   return s;
  }
  else
  if (sing=='out_system') 
  {
   s = string_replace(s,"(39;)", "'");
   s = string_replace(s,"(34;)", "\"");
   s = string_replace(s,"(apos;)", "'");
   s = string_replace(s,"(34;)", "&quot;");
   s = string_replace(s,"(and;)", "&amp;");
   s = string_replace(s,"(lt;)", "&lt;");
   s = string_replace(s,"(gt;)", "&gt;");
   s = string_replace(s,"(resh;)", "#");
   return s;
  }
 }

 function prsndmail(res)
 {
   $.ajax({   
				url: res['link_send']+"&user_query=1",   
                cache: false,   
                success: function(html)
				{
				 //----------
				 if (html=='send_mail_220') 
				  {
					alert('Письмо отправлено на указанный электронный адрес');
				  }
				 else
				 alert('Ошибка, обратитесь в техническую поддержку support@contep.com.ua');
				 //---------- 
				}
			});
 }


 /*
 if (document.images) 
  {	
   var general_imgs = new Object();
   general_imgs["preloader"] = new Image(64, 64);
   general_imgs["preloader"].src = "../styles/loading3.gif";
  }
 */

 function settings_preloader(obj_preloader, type)
 {
  var text = "загрузка..";
  if (type=='text1')  text = "выполняю..";
  //-------------
  obj_preloader.style.display = "none";
 // obj_preloader.innerHTML = "<div class=\"style_mx9\" style=\"background-Color:#FFFFFF; padding:5px; border:1px solid #FFCC00; width:75px; height:75px;\"><img src=\""+general_imgs["preloader"].src+"\"><br><strong>"+text+"</strong></div>";
  obj_preloader.innerHTML = "<div class=\"style_mx9\" style=\"background-Color:#FFFFFF; padding:5px; border:1px solid #FFCC00; width:90px; height:80px;\" align=\"center\"><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0'  height=\"64\" width=\"64\"><param name=\"allowScriptAccess\" value=\"sameDomain\"><param name='movie' value='../styles/preloader.swf'><param name=\"allowFullScreen\" value=\"true\"><param name=\"allowScriptAccess\" value=\"always\"><param name='quality' value='high'><param name=\"wmode\" value=\"opaque\"><param name=\"loop\" value=\"true\"><param name=\"flashvars\"><embed src=\"../styles/preloader.swf\" name=\"flashVars\" allowscriptaccess=\"sameDomain\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" bgcolor=\"#ffffff\" height=\"64\" width=\"64\"></embed></object><br><strong>"+text+"</strong></div>";
  obj_preloader.style.position = "absolute";
  obj_preloader.style.zIndex = 999999;
  obj_preloader.style.opacity = 9;
  obj_preloader.style.filter = 'alpha(opacity=90)';
  obj_preloader.style.MozOpacity = 9;
  //-------------
 }

 function preloading(type)
 {
//  mouse_docXY();
  var obj_preloader = gebi("id_preloader");
  if (!obj_preloader) return;
  //----------------------------------
  var timeout = 250; // ms timeout
  if (type==false) {  setTimeout(function(){ obj_preloader.style.display = "none"; },timeout); return; }
  //----------------------------------
  if (document_cursor_posX==0)
  {
	 var event = event || window.event;
	 var mCur = mousePageXY(event); 
	 document_cursor_posX = mCur.x; 
	 document_cursor_posY = mCur.y; 
  }
  //-----
  if (type=='start_load') settings_preloader(obj_preloader, type); // auto settings
  else
  {
   if (obj_preloader.innerHTML == "") settings_preloader(obj_preloader, type);
   //-------------------------------------
   setTimeout(function(){
   obj_preloader.style.left = (document_cursor_posX - 43)+"px";
   obj_preloader.style.top = (document_cursor_posY - 40)+"px";
   obj_preloader.style.display = "block"; }, timeout);
  }
					 
 }
 
 
 function url_now_plus(params)
 {
  var array_formats = new Array('php','html'), end_url = '';
  var reload_url = window.location+"", xpos = reload_url.indexOf("#"), x = 0;
  if (xpos>0) reload_url = reload_url.substring(0,xpos);
  //------
  while (x<array_formats.length)
  {
   var z = reload_url.indexOf(array_formats[x]);
   if (z==-1) { x++; continue; }
   //-------------
   z=z+array_formats[x].length;
   if (z==reload_url.length && reload_url.indexOf(params)==-1) 
      { 
	   reload_url = reload_url + "?" + params;
       end_url = reload_url; 
	   break;
	  }
   x++;
  }
  //------
  if (end_url=='')
  {
  if (reload_url.indexOf(params)==-1)  end_url = reload_url + "&" + params;
                                  else end_url = reload_url;
  }
  //-------- Обработка параметров url
  
  // ....
   
  //--------
  return end_url;
  //--------
 }
 
 
 function razdelitel(summ)
 {
  var _next = ''; summ = summ + "";
  //===================
  var dop_sum = '';
  var summ = string_replace(summ, ".", ",");
  var x = summ.indexOf(",");
  if (x>0)
  {
   dop_sum = ","+summ.substring(x+1,summ.length).substring(0,2);
   summ = summ.substring(0,x);
  }
  //===================
 if (summ.length==10) //1 111 280 000
 { 
  zet0 = summ.substring(0,1);
  zet1 = summ.substring(1,4);
  zet2 = summ.substring(4,7);
  zet3 = summ.substring(7,10);
  _next = zet0 +" "+ zet1 +" "+ zet2 +" "+ zet3;
 }
 else
 if (summ.length==9) //111 280 000
 { 
  zet1 = summ.substring(0,3);
  zet2 = summ.substring(3,6);
  zet3 = summ.substring(6,9);
  _next = zet1 +" "+ zet2 +" "+ zet3;
 }
 else
 if (summ.length==8) //11 280 000
 { 
  zet1 = summ.substring(0,2);
  zet2 = summ.substring(2,5);
  zet3 = summ.substring(5,8);
  _next = zet1 +" "+ zet2 +" "+ zet3;
 }
 else
 if (summ.length==7) //1 280 000
 { 
  zet1 = summ.substring(0,1);
  zet2 = summ.substring(1,4);
  zet3 = summ.substring(4,7);
  _next = zet1 +" "+ zet2 +" "+ zet3;
 }
 else
 if (summ.length==6) //128 000
 { 
  zet1 = summ.substring(0,3);
  zet2 = summ.substring(3,6);
  _next = zet1 +" "+ zet2;
 }
 else
 if (summ.length==5) //12 800
 { 
  zet1 = summ.substring(0,2);
  zet2 = summ.substring(2,5);
  _next = zet1 +" "+ zet2;
 }
 else
 if (summ.length==4) //1 280
 { 
  zet1 = summ.substring(0,1);
  zet2 = summ.substring(1,4);
  _next = zet1 +" "+ zet2;
 }
 else // <1000
 {
  _next = summ;
 }

 return _next+dop_sum;
 }
 
 function set_eftm(obj_title)
 {
   obj_title.style.display = "none";
 }
 
 var tmmove = false;
 function hide_title_menu(timeout)
 {
  var obj_title = gebi("id_titles_menu");
  if (!obj_title) return;
  //----
  if (timeout>0)
  {
  setTimeout(function(){ 
					    if (tmmove==false) { set_eftm(obj_title);  return; }
					   },timeout);
  }
  else if (tmmove==false || timeout=='cart') set_eftm(obj_title);
 //----------------
}

 
 var tmp_id_tv = 0;
 function title_view(text_html, style, width, obj_now)
 {
  var obj_title = gebi("id_titles_menu");
  if (!obj_title || document_cursor_posX==0) return;
  //------
  if (style)
  { 
   //-------------------
   if (style==1) obj_title.style.backgroundColor = "#FFFFEA";
   //-------------------
   if (style==2)
   {
    var ourDiv = gebi(obj_now);
    var fdx = absPosition(ourDiv).x+130;
    var fdy = absPosition(ourDiv).y-document.documentElement.scrollTop;
   
	obj_title.style.position = "fixed";
    obj_title.style.left = fdx+"px";  
    obj_title.style.top = fdy+"px";
   }
   else
   if (style==3)
   {
    var ourDiv = gebi(obj_now);
    var fdx = absPosition(ourDiv).x-320;
	var fdy = absPosition(ourDiv).y-document.documentElement.scrollTop;
   
	obj_title.style.position = "fixed";
    obj_title.style.left = fdx+"px";  
    obj_title.style.top = fdy+"px";
   }
   else
   {
	obj_title.style.left = (document_cursor_posX+10)+"px";
    obj_title.style.top = (document_cursor_posY+10)+"px";
   }
   //------------
  }
  if (width && width!='') obj_title.style.width = width+"px"; else obj_title.style.width  = '';
  //----------------
  if (obj_now && obj_now!=tmp_id_tv)
  {
   tmp_id_tv = obj_now;
  }
  //----------------
  obj_title.style.zIndex = 999999;
  obj_title.innerHTML = text_html;
  tmmove = true;
  obj_title.style.display = "block";
  //------
 }
 
 var tmp_id_vpm = -1;
 function view_photo_max(id, w, h, view, event)
 {
  var obj = gebi(id);
  if (!obj) return; 
  //------------------------------------------
  dy = event.clientY;
  if (dy>=(screen.height-(h+100))) dy = dy - (h+100);   
  //-------------------  
  obj.style.left = (document_cursor_posX+20)+"px";
  obj.style.top = (dy+20)+"px"; 
  //--------------------------------
  if (tmp_id_vpm==id && view) return;
  if (view==false || tmp_id_vpm=='') tmp_id_vpm = id; else id = tmp_id_vpm;
  //-------------------
  if (view) obj.style.display = "block";
       else { obj.style.display = "none"; tmp_id_vpm = ""; }
  //-------------------
 }
 
 function move_units_block(html)
 {
  var obj_id_miu = gebi("id_miu");
  if (!obj_id_miu) return;
  //-----------------------
  _x=window.event.clientX-100; 
  _y=window.event.clientY+20; 
  _dx=5;
   obj_id_miu.style.height = 200;
   obj_id_miu.style.width = 250;
   obj_id_miu.className = 'active_info_block1';
  //----------------------
  obj_id_miu.style.left=_x; 
  obj_id_miu.style.top=_y; 
  //----------------------
  obj_id_miu.innerHTML = html;
  obj_id_miu.style.display = "block"; 
 }
 
 function hide_units_block()
 {
  var obj_id_miu = gebi("id_miu");
  if (!obj_id_miu) return;
  //-----------------------
  obj_id_miu.style.display = "none";
 }
 
var sve_dx=10;
var In_vis_ef = true;
 
function start_process_visual_effects()
{
 var obj_visual_n1 = gebi("visual_blocks_n1");
 var obj_visual_n2 = gebi("visual_blocks_n2");
 if (!obj_visual_n1 || !obj_visual_n2 || In_vis_ef==false) return;
 //------------------
 sve_dx = sve_dx+10;
 msm = 0 + (sve_dx / 100);
 msm = msm.toFixed(2); 
 //----------
 if (msm<=0) msm = 0;
 if (msm>=1) msm = 1;
 //----------
 obj_visual_n1.style.opacity = msm;
 obj_visual_n1.style.filter = 'alpha(opacity='+(sve_dx)+')';
 obj_visual_n1.style.MozOpacity = msm;
 //----------
 obj_visual_n2.style.opacity = msm;
 obj_visual_n2.style.filter = 'alpha(opacity='+(sve_dx)+')';
 obj_visual_n2.style.MozOpacity = msm;
 obj_visual_n2.style.paddingRight = "15px";
 //----------
 if (sve_dx>=100) { In_vis_ef = false; return; }
 //----------------
 setTimeout("start_process_visual_effects()",10);
}

function start_visual_effects()
{
 if (typeof login == 'undefined' || login=='') { return; }
 //--------------------------- right_ico
  var obj_visual_n1 = gebi("visual_blocks_n1");
  if (obj_visual_n1) 
  setTimeout(function(){ obj_visual_n1.style.display = "block"; start_process_visual_effects(); },2000);
}

 function contep_redirect_url(url)
 {
	location.href = general_preloge+"help.php#hlp4";
 }
 
 var hny2012 = false;
 
 function happy_new_year2012()
 {
  var obj = gebi("id_happy_newyear");
  var obj_year_left = gebi("id_newyear_2012"); 
  if (!obj || !obj_year_left) return;
  //------------
  var happy_text = "";
  $.ajax({   
				url: "../include/ajax_load_params_catalog.php?load_datas=happy2012&service="+service_load,   
                cache: false,   
                success: function(html)
				{
				 //----------
				 var result = co_parseQuery(html);
				 //----------
				 if (result['connect']=='happy2012') happy_text = result['happy_text'];
				 //----------
				 obj.innerHTML = happy_text;
                 obj_year_left.innerHTML = "<a href=\"http://www.contep.com.ua/exchange-web/help.php\" style=\"font-weight:bold; font-size:11px;\" id=\"lws2\">С новым<br>2012 годом!</a>";
                 //----------
				}
			});
	  
  //------------
 }
 
 function timeleft_newyear() 
 {
	//------------------------------
		 Now = new Date();
		 if (Now.getFullYear()=='2012') { hny2012 = true; happy_new_year2012(); return; }
		 day = Now.getDate();
		 //===============
		 tchs = Now.getHours();
		 if (tchs<10) tchs = '0'+tchs;
		 tmin = Now.getMinutes();
		 if (tmin<10) tmin = '0'+tmin;		
		 tsec = Now.getSeconds();
		 if (tsec<10) tsec = '0'+tsec;		
		 
		 var h = 31-day;
		 var x = 24-tchs-1;
		 var z = 60-tmin-1;
		 var y = 60-tsec-1;
		 if (x==0 && z==0 && y==0) { hny2012 = true; happy_new_year2012(); }
		 fulltime = x+' '+num_string(x, Array(' час', 'часа', 'часов')) + ' ' + (z) + ' ' + num_string(z, Array(' минута', 'минуты', 'минут')) + " " + (y) + ' '+num_string(y, Array(' секунда', 'секунды', 'секунд'));
		 //===========================
		 return h+' '+num_string(h, Array(' день', 'дня', 'дней')) + ' ' +' '+fulltime;
 }

 function new_year2012_timeleft()
 {
   var obj = gebi("id_tl_newyear");
   if (!obj || hny2012) return;
   //----------------
   obj.innerHTML = timeleft_newyear();
   //----------------
 }

 function new_year2012(type)
 {
	if (type=='start')
	{
	  new_year2012_timeleft();
	  setInterval("new_year2012_timeleft()",1000);
	}
	else
	{
	 document.write("<div id=\"id_new_year\" style=\"position:absolute; font-size:11px; width:100px; line-height:1.3; color:#FFFFFF;\" align=\"center\"><a href=\"http://www.contep.com.ua/exchange-web/help.php\" style=\"font-weight:bold; font-size:11px;\"><img  onMouseMove=\"javascript:class_photo(this.id,true);\"  onMouseOut=\"javascript:class_photo(this.id,false,'st2');\"  class=\"ph_bort_style3\" id=\"id_new_year_img\" src=\"http://www.contep.com.ua/styles/new_year2012.gif\" height=\"100\"></a><div style=\"height:50px; padding-top:10px;\" id=\"id_newyear_2012\"><a href=\"http://www.contep.com.ua/exchange-web/help.php\" style=\"font-weight:bold; font-size:11px;\" id=\"lws2\">С Новым<br>2012 Годом!</a></div></div>");
	}
 }
 
// new_year2012('default'); // start effects
 
   // Функция проверки на валидность значений
   // return true = data is correct, false - incorrect
 function string_ok(s,sing)
	 {
	  if (sing=="text" || sing=="specification") text_analize = /^[a-zа-я0-9іїєгё \s\—\&\#\$\_\]\[\}\{\/\\\\™\®\@\:\"\)\(\%\,\.\!\:\;\*\+\=\-\?\№\'\^\|]{1,9999}$/i; // обычный текст до 5000 символов
	 else if (sing=="textAZ") text_analize = /^[a-zа-я0-9іїєгё \-\—\&\.\,\/\\]{1,9999}$/i; // обычный правильный текст
     else if (sing=="text_html") text_analize = /^[a-zа-я0-9іїєгё \&\s\#\$\_\<\>\]\[\}\{\/\\\\™\®\@\—\«\»\:\"\)\(\%\,\.\!\:\;\*\+\=\-\?\№\'\^\|]{1,9999}$/i; // html
     else if (sing==1) text_analize = /^[a-zа-я0-9іїєгё \—\&\#\$\_\]\[\}\{\/\\\\™\®\@\:\"\)\(\%\,\.\!\:\;\*\+\=\-\?\№\'\^\|]{1,500}$/i; // обычный правильный текст до 100 символов
     else if (sing==2) text_analize = /^[0-9\.,]+$/i; // число (денежная сумма) с разделителем запятой или без нее
     else if (sing==3 || sing=='mail') text_analize = /^(?:[a-z0-9-_\.]+(?:[-_\.]?[a-z0-9]+)?@[a-z0-9-]+(?:\.?[a-z0-9]+)?\.[a-z]{2,5})$/i; // mail
     else if (sing==4 || sing=='phone') text_analize = /^[0-9]{5,15}$/i; // номер телефона
     else if (sing==5 || sing=='adress') text_analize = /^[a-zа-я0-9іїєгё \—\&\/\:\"\)\(\%\,\.\!\:\;\*\+\=\-\?\№\']{4,500}$/i; // адрес
     else if (sing==6 || sing=='company_name') text_analize = /^[a-zа-я0-9іїєгё \—\&\/\\\\™\®\:\"\'\,\-\;\+\!\:\=\.\%]{4,255}$/i; // названия(компания)
     else if (sing==7 || sing=='url') text_analize = /^(http:\/\/|https:\/\/)?([^\.\/]+\.)*([a-zA-Z0-9])([a-zA-Z0-9-]*)\.([a-zA-Z]{2,4})(\/.*)?$/i; // url
     else if (sing==8 || sing=='summa') text_analize = /^[0-9\,\.]+$/i; // число (денежная сумма) с разделителем запятой или без нее
      //================================================================
     else if (sing==9) text_analize = /^[a-zа-я]{2,2}[0-9]{6,6}$/i; // Паспорт Украины
     else if (sing==10) text_analize = /^[a-zа-я0-9іїєгё \.]{5,100}$/i; // Фамилия Имя Отчество
     else if (sing==11 || sing=='country' || sing=='city' || sing=='region' || sing=='fam' || sing=='dolgnost') text_analize = /^[a-zа-яіїєгё -\.]{2,30}$/i; // Фамилия, Имя, Отчество, Страна, Город, Регион ... и т.д
     else if (sing=='icq') text_analize = /^[0-9]{3,12}$/i; // icq 322223085
	 else if (sing=='login' || sing=='skype') text_analize = /^[a-z0-9-_\.\@]{1,30}$/i; // login - baysov_p
	 else if (sing=='password') text_analize = /^[a-z0-9\!\№\;\%\:\?\*\(\)\_\+\=\-\@\#\$\^\&]{6,50}$/i; // pasw - x54xx03se22t
     else if (sing=='int'  || sing=='inn' || sing=='ndc') text_analize = /^[0-9]+$/i; // чистое число
     else if (sing=='okpo') text_analize = /^[0-9]{6,10}$/i; // Код ЕДРПОУ = ОКПО
     else if (sing=='imgname') text_analize = /^[a-zа-я0-9іїєгё \#\$\_\]\[\}\{\/\\\\™\®\@\:\"\)\(\,\.\!\:\;\*\+\=\-\?\№\']{1,255}$/i; // Код ЕДРПОУ = ОКПО
     //============================================
	 if (text_analize.exec(s) == null) return false; else return true;
    } 
