// 
// sdPopup ver 13-12-02  
// 
// note: usage javascript:sdPopup('http://url','name','420','310','','front') 
// note: creates multiple pages, just sends old one behind opener. 
// note: safer to use absolute url address. Can preview from frontpage then. 

var sdPopupWindow=null; 
var baseUrl=''; //leave blank if unused 

function sdPopup(mypage,myname,w,h,pos,infocus){ 
	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=10;TopPosition=10; 
	} 
	
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=no,dependent=no'; 
	sdPopupWindow=window.open(baseUrl + mypage,myname,settings); 
	
	if(infocus=='front'){ 
		sdPopupWindow.focus(); 
		sdPopupWindow.location=baseUrl + mypage; 
	} 
}