function popUp(URL) {
	window.open(URL,'',"toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=500,left=0,top=0");
}
function popUpWide(URL) {
	window.open(URL,'',"toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=525,height=500,left=0,top=0");
}

function sendFriendMessage(id) {
  popUp('/sendfriendmessage.php?id=' + id);
}

function sendFriendMessageMedia(id) {
  popUp('/sendfriendmedia.php?id=' + id);
}

function printMessage(id) {
  url = '/printmessage.php?id=' + id;
  window.open(url,'',"toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=400,height=500,left=0,top=0");
}

function printEntry(id) {
  url = '/printentry.php?id=' + id;
  window.open(url,'',"toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=400,height=500,left=0,top=0");
}

function printJournal(ymd) {
  dates = ymd.split('-');
  url = '/printjournal.php?y=' + dates[0] + '&m=' + dates[1] + '&d=' + dates[2];
  window.open(url,'',"toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=450,height=500,left=0,top=0");
}

function openContact(URL) {
		var width= 400;
		var height=525;
    x = (640 - width)/2, y = (480 - height)/2;

    if (screen) {
        y = (screen.availHeight - height)/2;
        x = (screen.availWidth - width)/2;
    }
		window.open(URL,'','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x);		
}

function openAmazon() {
	
		window.open('http://www.amazon.com/Middle-Horn-Leader-2006-Version/dp/1419647709/ref=pd_bbs_sr_1/002-9093979-7095258?ie=UTF8&s=books&qid=1181654081&sr=8-1','','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=800, height=650');		
}

var hasOpenPopup = 0;
// this is for opening pop-up windows
function openPopup( url, name, widgets, openerUrl ) {
	var host = location.hostname;
	if (window == top) { window.top.name = "opener"; }
	var popupWin = window.open( url, name, widgets );
	if (popupWin) {hasOpenPopup = 1;}
	if (popupWin && popupWin.opener ) {
		if (openerUrl) { popupWin.opener.location = openerUrl; }
	}
	if (popupWin) { popupWin.focus(); }
}

function popTumorPhoto(num) {
	window.open('/photos/photo'+num+'.html', '', 'width=600, height=650, scrollbars=yes');
	return;
}

function popTumorPhoto2(num) {
	window.open('/tumorphotos/photo'+num+'.html', '', 'width=600, height=650, scrollbars=yes');
	return;
}

function popLifePhoto(location) {
	window.open('/photos/'+location+'.html', '', 'width=600, height=650, scrollbars=yes');
	return;
}

function popThankYou (location) {
	window.open('test.html', '', 'width=300, height=300, scrollbars=no');
	return;
}

function legality(url) {
	window.open(url,'', 'width=650, height=650, scrollbars=yes, toolbar=yes, location=yes, menubar=yes');
	return;
}

function popRadio(url) {
	window.open(url,'radioplayer','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=145');
	return;
}

function popGrandTotal(url) {
	window.open(url,'/images/grand-total_large.gif','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=750,height=525');
	return;
}