//POPUP

// Link example:
//<a href="my-pop-up-window.htm" onclick="popUp(this.href,'console',600,600,'windowName');return false;" target="_blank">This is my link</a>
var newWin = null;
function popUp(strURL, strType, strHeight, strWidth, strName) {
if (newWin != null && !newWin.closed)
	newWin.close();  
	var strOptions="";
	if (strType=="console")    
	strOptions="resizable,scrollbars,height="+
		strHeight+",width="+strWidth;  
	if (strType=="fixed")
		strOptions="height="+      
			strHeight+",width="+strWidth;  
	if (strType=="elastic")
		strOptions="toolbar,menubar,scrollbars,"+
			"resizable,location,height="+      
			strHeight+",width="+strWidth;
	newWin = window.open(strURL, strName, strOptions);  
	newWin.focus();
}

function openPopupWin(URLtoOpen, windowName, hauteurPopup, largeurPopup, scrollOrNot) { 
  var hauteurPopup;
  var largeurPopup;
  var H = (screen.height - hauteurPopup) / 2;
  var L = (screen.width - largeurPopup) / 2;
  document.open(URLtoOpen,windowName,'height='+hauteurPopup+',width='+largeurPopup+',top='+H+',left='+L+',toolbar=no,scrollbars='+scrollOrNot+',resizable=no');
}


//PAGE MANAGER

function goToNxtPg(frm) {
  if (parseInt(frm.pNL.value)+1 < parseInt(frm.totP.value)) {	
	 frm.pNL.value = parseInt(frm.pNL.value) + 1;
	 frm.PgNo.value = "";
	 frm.submit();
  }
}
function goToPrvPg(frm) {
  if (parseInt(frm.pNL.value)> 0) {
	frm.pNL.value = parseInt(frm.pNL.value) - 1;
	 frm.PgNo.value = "";
    frm.submit();
  }
}
function goToPgX(frm) {
  if (parseInt(frm.PgNo.value) > 0) { 
	if (parseInt(frm.PgNo.value) <= parseInt(frm.totP.value)) {
	  frm.pNL.value = parseInt(frm.PgNo.value) - 1 ;
	  frm.PgNo.value = "";
	  frm.submit();
	}
  }
}


// ...
function search_word(frm) { 
  frm.PgNo.value = "";
  frm.pNL.value = "";
  frm.pMX.value = "";
  frm.pOL.value = "";
  frm.tRL.value = "";
  frm.submit(); 
}
function Confirm_ref( newhref) {
   if (!confirm("<?= confirm_delete ?>")){ 
      this.location = this.location;  
   } else { 
     this.location = newhref ;
   } 
}


//SCREEN

function test_scr(OptW, OptH, mess) {
 if (screen.width < OptW || screen.height < OptH ) alert(mess + " " + screen.width + "x" + screen.height);
}

function do_max(){
window.moveTo(0,0);
window.resizeTo(screen.width,(screen.height-25))
}


do_max();
test_scr('1024','768', 'Site optimised for this screen resolution:');