/***********
Pop-up script
Usage - 
HTML - 
	<html><head>
	...
	<script language="JavaScript" type="text/JavaScript" src="popup.js"></script>
	...
	</head><body>
	...
	<a href="#" onclick="popup('pop.html','moobits',400,400,'no','no','no','no','no','no','no');">POP VARS</a>
	...
	</body></html>
***********/

function popup( purl, ptitle, pwidth, pheight, ptool, pdir, ploc, pstat, pmenu, presize, pscroll ){
	var total = "";
		total = total + "width=" + pwidth;
		total = total + ",height=" + pheight;
		total = total + ",toolbar=" + ptool;
		total = total + ",directories=" + pdir;
		total = total + ",location=" + ploc;
		total = total + ",status=" + pstat;
		total = total + ",menubar=" + pmenu;
		total = total + ",resizable=" + presize;
		total = total + ",scrollbars=" + pscroll;
		total = total + "";
	var titlevar = "";
		titlevar = titlevar + "ptitle"+"";
	var awin = window.open( purl, titlevar, total );
	awin.focus();
	return false;
}

/************
Prev/Next links (for popups)
==============================
Usage - 
        Pages must be numbered sequentially (pag1.html, page2.html, etc)
HTML - 
    <head>
	...
	<script language="JavaScript" type="text/JavaScript" src="popup.js"></script>
	...
    </head>
    <body>
	  <a href="#" onclick="this.href=prev_page();">PREV</a>    
      <a href="#" onclick="this.href=next_page();">NEXT</a>
    </body>
************/

function curr_page(){
    var patt = /\w+\d.html?/;
    var pg = document.URL.match(patt);
    return pg[0];
}
function prev_page(){
    var cp=curr_page();
    var patt = /\d+/;
    var nm = cp.match(patt);
    nm[0]--;
    if(nm[0] < 0)
        nm[0] = 0;
    return cp.replace(patt, nm[0]);
}
function next_page(){
    var cp=curr_page();
    var patt = /\d+/;
    var nm = cp.match(patt);
    nm[0]++;
    return cp.replace(patt, nm[0]);
} 