function popUp (url, name, width, height, center, resize, scroll, posleft, postop) {

	if (posleft != 0) { X = posleft }
    if (postop  != 0) { Y = postop  }

    if (!scroll) { scroll = 'yes' }
    if (!resize) { resize = 'yes' }

    if ((parseInt (navigator.appVersion) >= 4 ) && (center)) {
      X = (screen.width  - width ) / 2;
      Y = (screen.height - height) / 2;
    }
    
    if (scroll != 0) { scroll = 1 }

	if (!Win || Win.closed)
	{
	    // display the popup window
	    var Win = window.open(url, name,'width='+width+',height='+height+',top='+Y+',left='+X+',resizable='+resize+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no');   
	}
	else
	{
		// window is already open, update with content
		Win.location = url;
	}    
    Win.focus();
}


function openWin (url, name) {

	if (mainWin) {
		mainWin.focus();
		mainWin.location = url;
	}
	else if (window.opener) {
		window.opener.location = url;
		window.opener.focus();
	}
	else {
	    var mainWin = window.open(url, name );   
	}
}
