var popupwin = null;
function popup(psize, url)
{
	var findx = psize.indexOf("x", 0);
	
	if(findx != -1)
	{
		//Found the character x, assume that the psize string contains an XxY notation
		var x = psize.substr(0, findx);
		var y = psize.substr(findx+1, psize.length-findx-1);
		dopopup(x, y, url, "_blank");
	}
	else
	{
		switch(psize)
		{
			case "TINY":
				dopopup(200, 120, url, "_blank");	
				break;
			case "SMALL":
				dopopup(320, 240, url, "_blank");
				break;
      case "CUSTOM":
				dopopup(456, 400, url, "_blank");
				break;
			case "MED":
			  dopopup(640, 480, url, "_blank");
				break;
      case "REQUIRED":
			  dopopup(640, 400, url, "_blank");
				break;
			case "BIG":
				dopopup(750, 500, url, "_blank");
				break;
      case "BIGGER":
				dopopup(800, 750, url, "newwindow");
				break;
      case "BIGHM":
				donewpopup(800, 750, url, "_blank");
				break;   
			default:
				dopopup(580, 400, url, "_blank");
				break;
		}
	}
}
function dopopup(wx, wy, url, name)
{
	var nwidth = (window.screen.width / 2) - ((wx / 2) + 10);
	var nheight = (window.screen.height / 2) - ((wy / 2) + 50);
	popupwin = window.open(url, name, "location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=1,resizable=yes,height=" + wy + ",width=" + wx + ",left=" + nwidth + ",top=" + nheight + ",screenX=" + nwidth + ",screenY=" + nheight );
	popupwin.focus();
}

//the following is needed for the popup for "Collecting for Kids" right nav link in the /personal/collecting section
function newpopup(psize, url)
{
	var findx = psize.indexOf("x", 0);
	
	if(findx != -1)
	{
		//Found the character x, assume that the psize string contains an XxY notation
		var x = psize.substr(0, findx);
		var y = psize.substr(findx+1, psize.length-findx-1);
		donewpopup(x, y, url, "_blank");
	}
	else
	{
		switch(psize)
		{
			case "TINY":
				donewpopup(200, 120, url, "_blank");	
				break;
			case "SMALL":
				donewpopup(320, 240, url, "_blank");
				break;
			case "MED":
				donewpopup(640, 480, url, "_blank");
				break;
			case "BIG":
				donewpopup(750, 500, url, "_blank");
				break;
      case "BIGGER":
				donewpopup(750, 750, url, "_blank");
				break;
      case "REDIRECT":
        donewpopup(750, 750, url, "redirect");
				break;
      case "BIGHM":
				donewpopup(800, 750, url, "_blank");
				break;
			default:
				donewpopup(580, 400, url, "_blank");
				break;
		}
	}
}
function donewpopup(wx, wy, url, name)
{
	var nwidth = (window.screen.width / 2) - ((wx / 2) + 10);
	var nheight = (window.screen.height / 2) - ((wy / 2) + 50);
  popupwin = window.open( url,name,"toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=1,resizable=yes,height=" + wy + ",width=" + wx + ",left=" + nwidth + ",top=" + nheight + ",screenX=" + nwidth + ",screenY=" + nheight )
	popupwin.focus();
}

//this popup function was coded for small popup for which scrollbars are not required
function nspopup(psize, url)
{
	var findx = psize.indexOf("x", 0);
	
	if(findx != -1)
	{
		//Found the character x, assume that the psize string contains an XxY notation
		var x = psize.substr(0, findx);
		var y = psize.substr(findx+1, psize.length-findx-1);
		donspopup(x, y, url, "_blank");
	}
	else
	{
		switch(psize)
		{
			case "TINY":
				donspopup(200, 120, url, "_blank");	
				break;
			case "SMALL":
				donspopup(320, 240, url, "_blank");
				break;
      case "CUSTOM":
				donspopup(456, 400, url, "_blank");
				break;
			case "MED":
			  donspopup(640, 480, url, "_blank");
				break;
      case "REQUIRED":
			  donspopup(640, 400, url, "_blank");
				break;
			case "BIG":
				donspopup(750, 500, url, "_blank");
				break;
      case "BIGGER":
				donspopup(800, 750, url, "newwindow");
				break;
      case "BIGHM":
				donspopup(800, 750, url, "_blank");
				break;   
			default:
				donspopup(580, 400, url, "_blank");
				break;
		}
	}
}
function donspopup(wx, wy, url, name)
{
	var nwidth = (window.screen.width / 2) - ((wx / 2) + 10);
	var nheight = (window.screen.height / 2) - ((wy / 2) + 50);
	popupwin = window.open(url, name, "location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=no,resizable=yes,height=" + wy + ",width=" + wx + ",left=" + nwidth + ",top=" + nheight + ",screenX=" + nwidth + ",screenY=" + nheight );
	popupwin.focus();
}

//added for POOL Desktop apps
function HelpPopup(sURL,PageTitle)
{

 

/*    alert(PageName);

    alert(PageTitle);

*/    

      window.open(sURL, PageTitle, 'toobar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,left=150,top=150,width=730,height=500');


}

