var popwin;
var fullscreenpop;

function nonStandardPopUp(theURL, width, height, name, left, top, theanchor)
{
	if(theURL.indexOf('?') < 0)
	{
		theFullURL = theURL + '?';
	}
	else
	{
		theFullURL = theURL + '&';
	}
	
	popwin = window.open(theFullURL+'x='+width+'&y='+height+'#' + theanchor,name,'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+',top='+top);
	popwin.focus();
}

function standardPopUp(theURL)
{
	nonStandardPopUp(theURL, '450', '400', 'popwin', '50', '50');
}

function anotherStandardPopUp(theURL)
{
	nonStandardPopUp(theURL, '450', '400', 'popwin2', '200', '200');
}

function healthcarePopUp(theURL,theanchor)
{
	//nonStandardPopUp(theURL, '450', '520', 'HCPwindow', '100', '100');
	nonStandardPopUp(theURL, '450', '450', 'HCPwindow', '100', '100',theanchor);
}

function securePopUp(theURL)
{
	nonStandardPopUp(theURL, '550', '500', 'popwin3', '100', '100');
}

function productZoomPopUp(productID)
{
	closeExistingFullScreenPopUp();
	fullscreenpop = window.open('fullScreen_product.cfm?ID=' + productID,'fullscreenpop','fullscreen');
	fullscreenpop.focus();
}

function closeExistingFullScreenPopUp()
{
	if ( fullscreenpop && !fullscreenpop.closed )
	  {
		 fullscreenpop.close();
	  }
}

function focusAndGoHome()
{
	window.focus();
	window.document.location="http://www.promensil.com/";
}

function goToConsumerSite()
{
	if(window.name == "HCPwindow")
	{
		if(window.opener != null)
		{
			if(!window.opener.closed)
			{
				window.opener.focusAndGoHome();
				window.close();
			}
			else
			{
				theURL='http://www.promensil.com/';
				popwin = window.open(theURL);
				window.close();
			}
		}
	}
	else
	{
		// RYAN CHANGED THIS - document.location='http://genaka/sites/promensil2/';
		document.location='http://www.promensil.com/'; // TO THIS
	}
}

