 function dn(){    

 }

 function printPage(){
    window.open(location.href + "&action=print",'print','width=650,height=550,status=yes,scrollbars=yes,location=no,toolbars=yes');
 }
 function confirmDelete(fname)
  {
    if (confirm('Are you sure?'))
    {
      return true;
    }
    return false;
  }
 function copySelToTxt(srcSel, trgTxt){
   if(srcSel.selectedIndex > 0){
    trgTxt.disabled=true;
    trgTxt.value = srcSel.options[srcSel.selectedIndex].text;
   }else{ 
    trgTxt.disabled=false;
    trgTxt.value = "";
   }
 }
 function chkChange(objChk, url){
    var val = 0;
    if(objChk.checked == true) val=10;
    window.location = url + '&val=' + val;
 }
 function fm_filter(url){
   o=document.getElementById('p1');
   if(o!=null && o.options.length>0) url = url + '&p1=' + o.options[o.selectedIndex].value;
   f=document.getElementById('p2');
   if(f!=null && f.options.length>0) url = url + '&p2=' + f.options[f.selectedIndex].value;
   location = url; 
 }


      /***** CUSTOMIZE THESE VARIABLES *****/
      // width to resize large images to
      var maxWidth=175;
      // height to resize large images to
      var maxHeight=300;
      // valid file types
      var fileTypes=["bmp","gif","png","jpg","jpeg","png"];
      // the id of the preview image tag
      var outImage="previewField";
      // what to display when the image is not valid
      var defaultPic="spacer.gif";
 function preview(what){
   var source=what.value;
   var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
   for (var i=0; i<fileTypes.length; i++){
     if (fileTypes[i]==ext){
        break;
     }
   }
   globalPic=new Image();
   if (i<fileTypes.length){
     //Obtenemos los datos de la imagen de firefox
     try{
        globalPic.src=what.files[0].getAsDataURL();
     }catch(err){
        globalPic.src=source;
     }
   }else {
     globalPic.src=defaultPic;
     alert("Pole oige faili tyyp!!!"+fileTypes.join(", "));
   }
   setTimeout("applyChanges()",200);
 }
          
 var globalPic;
 function applyChanges(){
   var field=document.getElementById(outImage);
   var x=parseInt(globalPic.width);
   var y=parseInt(globalPic.height);
   if (x>maxWidth) {
     y*=maxWidth/x;
     x=maxWidth;
   }
   if (y>maxHeight) {
     x*=maxHeight/y;
     y=maxHeight;
   }
   field.style.display=(x<1 || y<1)?"none":"";
   field.src=globalPic.src;
   field.width=Math.floor(x);
   field.height=Math.floor(y);
   document.getElementById("prevURL").href=field.src;         
 }



