var winh=(screen.availHeight);
var winw=(screen.availWidth); 
var popped;
function popwin(HREF,name,width,height,scrollBars,resizable,toolBar,location,directories,status,menuBar,copyHistory) {
	var set = '';
	if (!toolBar) {set = 'toolbar = 0,';} else {set += "toolbar=" + toolBar + ",";}
	if (!location) {set += "location=0,";} else {set += "location=" + location + ",";}
	if (!directories) {set += "directories=0,";} else {set += "directories=" + directories + ",";}
	if (!status) {set += "status=0,";} else {set += "status=" + status + ",";}
	if (!menuBar) {set += "menubar=0,";} else {set += "menubar=" + menuBar + ",";}
	if (!scrollBars) {set += "scrollbars=0,";} else {set += "scrollbars=" + scrollBars + ",";}
	if (!resizable) {set += "resizable=0,";} else {set += "resizable=" + resizable + ",";}
	if (!copyHistory) {set += "copyHistory=0,";} else {set += "copyHistory=" + copyHistory + ",";}
	if (!width) {set += "width=330,";} else {set += "width=" + width + ",";}
	if (!height) {set += "height=530";} else {set += "height=" + height + "";}
	
	if(!popped || popped.closed){
		
		popped = window.open(HREF,name, set);
		popped.moveTo(((winw/2)-(width/2)),((winh/2) - (height/2)));  
		popped.focus();
		 	
     }
	else {
			popped.resizeTo(width + 10, height + 29);
			popped.location.href = HREF;
			popped.focus();
	}
}

