
function NewWindow(mypage,myname,w,h,scroll,locat,direct,stat,men,tool,res,pos) {
var win=null;
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location='+locat+',directories='+direct+',status='+stat+',menubar='+men+',toolbar='+tool+',resizable='+res+'';
win=window.open(mypage,myname,settings);
win.focus();
}

function action_check(str, rep) {
   var b = confirm(str);
   if (rep == 'yes') {
      if (b) location.href = this.href;
   }
   return b;
}


function field_check(names, fieldlabels) {
   var fields = new Array();
   var k = 0;
   for (i=0; i<names.length; i++) {
      if (document.form1.elements[names[i]].value == "") {
	     fields[k] = fieldlabels[i];
		 k++;
	  }
   }
   if (fields.length>0) {
	  var result = "The field(s) '" + fields.join(", ") + "' should be is filled !!";
      alert(result);
      return false;
   }
   return true;
}



function block_visible(el_id) {
   arr = Array("bl_add_picture");
   if (document.getElementById(el_id).style.display=='none') {
      document.getElementById(el_id).style.display = 'block';
   }
   else if (document.getElementById(el_id).style.display=='block') {
      document.getElementById(el_id).style.display = 'none';
   }
   for (i=0; i<arr.length; i++) {
      if (arr[i] != el_id) document.getElementById(arr[i]).style.display = 'none';
   }
}


function one_or_two_rows() {
   var sel = document.form1.block1.value;
   if (sel==1) {
      document.form1.block2.disabled = true;
   }
   else if (sel==2) {
      document.form1.block2.disabled = false;
   }
}


function make_modul_string() {
   var modul = new String(document.form1.name_eng.value);
   modul = modul.toLowerCase();
   modul = modul.replace(/ /g, "_");
   modul = modul.replace(/\W/g, "_");
   document.form1.modul.value = modul;
}

function showPic(pic,width,height)
{ 
sDesrc = "width=" + width + ", height=" + height +
		", status=no, toolbar=no, menubar=no, scrollbars=no";
win=window.open("Gallery", "displayWindow", sDesrc);
win.document.write("<html><style>body{padding:0px;margin:0px;}</style><body>");
win.document.write("<img src='"+pic+"' width='"+width+"' height='"+height+"'><br>");
win.document.write("</body></html>");
} 




