// -- /////////////////////////////////////////////////////
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
      
function AddBookmark(mark_href, mark_title)  { window.external.addFavorite(mark_href, mark_title); }
      
function MM_swapImgRestore() { //v3.0
   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  }
     
function MM_findObj(n, d) { //v4.01
   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);  }
   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
   if(!x && d.getElementById) x=d.getElementById(n); return x;
  }
      
function MM_swapImage() { //v3.0
   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
      
function MM_openBrWindow(theURL, winName, features) { //v2.0
   window.open( theURL, winName, features );
  }
     
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

var curent_img = '';
			function set_img(src){curent_img = src.replace('_tn', '_full')}

// -- /////////////////////////////////////////////////////

function click_confirm_url(txt, url_loacation) { 
   cw=window.confirm( txt ); if (!cw) return false;  else { document.location.href=url_loacation; return false; }
  }

function show_hide_span(span_id) { if (span_id.style.display=='none') { span_id.style.display=''; } else { span_id.style.display='none'; } }
function show_hide_span_by_val(span_id, val) { if (val==-1) { span_id.style.display=''; } else { span_id.style.display='none'; } }
      
function checkLen(name_inFrm, maxLen, name_PrnLen, name_Frm, use_dom )  {
   var in_frm=document.forms[name_Frm];
   str = in_frm[name_inFrm].value;
   len = str.length;
   if ( len > maxLen) in_frm[name_inFrm].value = str.substring(0,maxLen);
   if ( typeof(use_dom) == 'undefined' ) {in_frm[name_PrnLen].value = (maxLen - in_frm[name_inFrm].value.length); }
   else { document.getElementById(name_PrnLen).innerHTML= ( maxLen - in_frm[name_inFrm].value.length ); }
  }
      
function checkEmail(email)  {  if(email == "") return true; 
   atPos = email.indexOf("@"); 
    if(atPos == -1) { return false; } domain = email.substring(atPos+1, email.length-1);
    if(domain.indexOf(".") == -1) { return false; }
    return true;
}
      
function showProperties(obj, objName)   {
   var result = "The properties for the " + objName + " object:" + "\n\n";
   for (var i in obj) {result += i + " = " + obj[i] + " ";}
   return result;
  }


function SelectAll_items( is_checked, item_name, form_name, elements_type )  {
     
   if ( typeof( is_checked ) == 'undefined' ) { alert( 'Undefined is_checked' ); return false;   }
   if ( typeof( item_name ) == 'undefined' ) { alert( 'Undefined item_name' ); return false;   }
   if ( typeof( form_name ) == 'undefined' ) { alert( 'Undefined form_name' ); return false;   }
   if ( typeof( elements_type ) == 'undefined' ) { alert( 'Undefined elements_type' ); return false;   }
     
   // инит формы 
   var F = document.forms[form_name];
   if ( typeof( F ) == 'undefined' )  { alert( 'Undefined form name F = '+form_name    ); return false; }
     
   // ставим или убираем пометку на checkbox-ах   
   if ( elements_type == 'checkbox' ) { for (i = 0; i < F.elements.length; i++) {  var item = F.elements[i]; if ( item.name == item_name )  { item.checked = is_checked; } } } 
     
  }
     
function popup_window( www, win_name, win_features ) {
   if ( typeof(www) != 'undefined' ) { this.config('www', www ); }
   if ( typeof(win_features) != 'undefined' ) { this.config('win_features', win_features);} else {
     var features ="width=200, height=200, top=20, left=50, "
                         + "status=0, middle=1, copyhistory=0, directories=no, menubar=0, location=0, resizable=0, scrollbars=0, ";
     this.config('win_features', features );
    }
   if ( typeof(win_name) != 'undefined' ) { this.config( 'win_name', win_name ); }  else { this.config( 'win_name', 'popup_window' ); }
     
  };
      
popup_window.prototype.config = function ( config_key, config_value )  {
   if ( typeof(config_key) != undefined && typeof(config_value) != undefined )  {
     this[config_key]=config_value;
    }
  };
      
popup_window.prototype.open = function ( uri ) {
   var win_href = ( typeof(uri) != 'undefined' )?this.www+"&"+uri:this.www;
   MM_openBrWindow( win_href, this.win_name, this.win_features );
   return false;
  };
      

// -- /////////////////////////////////////////////////////
// получить html_content по ID 
function get_id_html( element_id )  {
      var html_content = '';
      if ( typeof( element_id ) == 'undefined' ) { var element_id = ''; } 
      if ( typeof( document.getElementById( element_id ) ) != 'undefined' ) { html_content = document.getElementById( element_id ).innerHTML; } 
           
      return html_content;
    }
// установить html_content по ID 
function set_id_html( set_id, get_id )  {
      if ( typeof( set_id ) == 'undefined' ) { var set_id = ''; } 
      if ( typeof( get_id ) == 'undefined' ) { var get_id = ''; } 
      if ( typeof( document.getElementById( set_id ) ) != 'undefined' && typeof( document.getElementById( get_id ) ) != 'undefined'  )  {
           document.getElementById( set_id ).innerHTML = get_id_html( get_id );
          }
    }
// -- /////////////////////////////////////////////////////


