
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 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 lang(lang)
{
var current=window.location.href;
var new_loc;
if(/l=/.test(current))
 new_loc=current.replace(/l=\w*/,"l="+lang);
else if(/\?/.test(current))
  new_loc=current+"&l="+lang;
else 
  new_loc=current+"?l="+lang;  
window.location.replace(new_loc);
}
