// -- /////////////////////////////////////////////////////
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 show_hide_span(span_id) { if (span_id.style.display=='none') { span_id.style.display=''; } else { span_id.style.display='none'; } }
      
function checkLen(name_inFrm, maxLen, name_PrnLen, name_Frm)  {
     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);
     in_frm[name_PrnLen].value = (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 showimg(path_img) {
   www = "http://geocapital.com.ua";
   href_img=www+"/module.php?m=photo&op=popup_image&f="+path_img;
   win_features = "width=100; height=100; status=0; middle=1; copyhistory=0; directories=no; menubar=0; location=0; "+
                     "resizable=0; scrollbars=0; top=50; left=50";
   MM_openBrWindow( href_img, 'showimg', win_features );
  }
// --- /////////////////////////////////////////////////
function popup_module(  )  {
   this.www = "http://geocapital.com.ua";
   this.win_features = "width=100; height=100; status=0; middle=1; copyhistory=0; directories=no; "
                                 +"menubar=0; location=0; resizable=0; scrollbars=0; top=50; left=50";
   this.config();
  }; 
        
popup_module.prototype.config = function (config_key, config_value) {
   if (config_key!=undefined && config_value!=undefined) { this[config_key]=config_value; }
   else {
     this.popup_winname  = (this.popup_winname ==undefined)?"module":this.popup_winname;
     this.popup_f = (this.popup_f == undefined)?"module.php":this.popup_f;
     this.popup_m  = (this.popup_m == undefined)?"photo":this.popup_m;
     this.popup_op = (this.popup_op== undefined)?"popup_image":this.popup_op;
     this.popup_uri = (this.popup_uri== undefined)?"&":this.popup_uri;
     this.popup_href = this.www+"/"+this.popup_f+"?m="+this.popup_m+"&op="+this.popup_op+this.popup_uri;
    }
  };
      
popup_module.prototype.show = function ( variable_val ) {
   var window_href = this.popup_href;
   if (variable_val != undefined )  { this.config( 'variable_val', variable_val ); window_href=window_href+this.variable_val;  }
   MM_openBrWindow( window_href, this.popup_winname, this.win_features );
  };
      
popup_module.prototype.show_u = function ( winhref ) {
   if (winhref != undefined )  {   
     alert('this.popup_winname = '+this.popup_winname);
     MM_openBrWindow( winhref, this.popup_winname, this.win_features );
    }
  }
     