

function openTellafriend()
{
	var urlToOpen, thisURL, thisHostname, Querystring, aPopUp;
	var checkchild = new RegExp('object','gi');	// Regular expression
	//preview
	urlToOpen = 'http://tellafriend.adamaspharma.com/tellafriend.asp';
	//live
	//urlToOpen = 'http://tellafriend.adamaspharma.com/tellafriend.asp';
	thisURL = location.href;
	if (thisURL.indexOf('?') != -1) {
	//We clear out the any variables off the end of the actual URL
		thisURL = escape(thisURL);
	}
	thisHostname = location.hostname;
	Querystring = '?url=' + thisURL + '&hostname=' + thisHostname;

	aPopUp= window.open(urlToOpen + Querystring,'Tellafriend','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,copyhistory=yes,width=800,height=750');
	if(!checkchild.test(String(aPopUp))) alert('Warning: A pop-up blocker is enabled! Please disable your pop-up blocker for this site.');
	else aPopUp.focus();
}

function goToPrintable()
{
	var aPopUp;
	var checkchild = new RegExp('object','gi');	// Regular expression
	var thisURL = location.href;
	thisURL = thisURL.substring(0, thisURL.length-6);
	thisURL = thisURL + "_print.shtml";
	aPopUp= window.open(thisURL ,'Printable','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=yes,width=540,height=600');
	if(!checkchild.test(String(aPopUp))) alert('Warning: A pop-up blocker is enabled! Please disable your pop-up blocker for this site.');
	else aPopUp.focus();
}
function openDocument(URL)
{
	var aPopUp;
	aPopUp= window.open(URL,'Document','toolbar=no,location=no,directories=no,status=no,scrollbars=auto,resizable=yes,copyhistory=yes,width=470,height=660,left=200,top=30');
}

function openPrint(command)
{
	var location = document.location;					// complete URL of the current page
	var search = document.location.search;		// '?' + querystring
	var newUrl = '';
	
	// Strip the command of the leading '?" if it is present
	// For now, we assume the 'command' always has a leading '?'
	var commandCleaned = command.substr(1);
	
	//  Build the newUrl
	search == '' ? newUrl = location + '?' + commandCleaned : newUrl = location + '&' + commandCleaned;
   	
	// Open new window (print version of page) and give it the focus
	aPopUp=window.open(newUrl,'print','toolbar=yes,menubar=no,location=yes,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=1000,height=550,left=150,top=50')
   	self.aprintWin = aPopUp
   	aPopUp.focus();
}

function openTCAD(URL)
{
	var aPopUp;
	aPopUp= window.open(URL,'TCAD','toolbar=no,location=no,directories=no,status=no,scrollbars=auto,resizable=yes,copyhistory=yes,width=820,height=650,left=100,top=50');
}
