/*
    **************************************************************
      NetFace SmallPortal|engine v2.1 @BETA | XHTML 1.0 | CSS 2.0
      created: 04/10/2006
      common.js
      
      functions list:
                - generatePicturePopup
                - generatePrintPopup
                - getObj
                - reload
                - loadImage
                - submitEnter
      
      author:  Gabor Nemeth | www.netface.hu | ngabor@netface.hu
      All rights reserved!
    **************************************************************      
*/

 function generatePicturePopup( pictureSrc ) { 
     var pictureSrc;
     window.open( "popup.php?picture="+pictureSrc, 
                  "",  
                  "scrollbars=1,resizable=0,height=1,width=1"
     ); 
 } 
 
 function generatePrintPopup( Src, h, w ) { 
     var pictureSrc;
     window.open( Src, 
                  "sp_print",  
                  "scrollbars=1,resizable=0,height="+h+",width="+w+""
     ); 
 }  

 function getObj(str){
     if(document.getElementById(str))
       return document.getElementById(str);
     else
       return false;
 }

 function reload( w, h ) { 
     window.resizeTo(w, h); 
 } 
  
 function loadImage(target, id, windowWidth, windowHeight ){
     if( getObj(target+id) ){
        reload( 1, 1 ); 
        if ( getObj(target+id).complete ) {
           clearInterval(eval('img_timer_'+id));
           getObj(target+id).style.display = '';
           getObj('pictureLoader_'+id).style.display = 'none';    
           if( windowWidth>0 && windowHeight>0 ) {
             reload( windowWidth, windowHeight );
           }
        }
     }
 }

 function submitEnter(evt,frmId) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode :
        ((evt.which) ? evt.which : evt.keyCode);
    if (charCode == 13 || charCode == 3) {
        document.getElementById(frmId).submit();
    }
} 
