var standardSizeAndPosition = 'height=630,left=200,top=100';
var bigSizeAndPosition = 'height=820,left=200,top=20';
var extraBigSizeAndPosition = 'height=840,left=200,top=20';

function openCTSParticipant(name) { 
  	participantWin = window.open('/public/participants/' + name, 'CTSParticipantWindow', 'width=500,' + standardSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!participantWin.opener) {
  		participantWin.opener = self;
  	} 
  	participantWin.focus();
}

function openPublication(name) { 
  	publicationWin = window.open('/public/publications/' + name, 'CTSPublicationWindow', 'width=700,' + standardSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!publicationWin.opener) {
  		publicationWin.opener = self;
  	}
  	publicationWin.focus();
}

function openPDFPublication(name) { 
  	pdfPublicationWin = window.open('http://ctsweb.ads.krz.uni-heidelberg.de/ctsintranet/papers/' + name, 'CTSPDFPublicationWindow', 'width=700,' + standardSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!pdfPublicationWin.opener) {
  		pdfPublicationWin.opener = self;
  	}
  	pdfPublicationWin.focus();
}

function openNewsletter(name) { 
  	newsletterWin = window.open(name + "?ts=" + Math.round(Math.random() * 10000000000000000), 'CTSPublicationWindow', 'width=800,' + standardSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!newsletterWin.opener) {
  		newsletterWin.opener = self;
  	}
  	newsletterWin.focus();
}

function openHelp(name) { 
  	helpWin = window.open('/public/help/' + name, 'CTSHelpindow', 'width=700,' + standardSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!helpWin.opener) {
  		helpWin.opener = self;
  	}
  	helpWin.focus();
}

function openCenterArea() { 
  	centerAreaWin = window.open('/public/centerarea.jsp', 'CTSCenterArea', 'width=700,' + standardSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!centerAreaWin.opener) {
  		centerAreaWin.opener = self;
  	}
  	centerAreaWin.focus();
}

function openAnalyse(link) {
  	analyseWin = window.open(link, 'CTSAnalyseArea', 'width=900,' + standardSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!analyseWin.opener) {
  		analyseWin.opener = self;
  	}
  	analyseWin.focus();
}

function openSample(groupname) { 
  	imageWin = window.open('/servlet/ArchiveServlet?group=' + groupname + '&archivemode=false', 'CTSImageArea', 'width=670,' + standardSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!imageWin.opener) {
  		imageWin.opener = self;
  	}
  	imageWin.focus();
}

function openArchive(groupname) { 
  	archiveWin = window.open('/servlet/ArchiveServlet?group=' + groupname, 'CTSArchiveArea', 'width=670,' + standardSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!archiveWin.opener) {
  		archiveWin.opener = self;
  	}
  	archiveWin.focus();
}

function openAllResults(groupsname) { 
  	allResultsWin = window.open('/servlet/Groups2SessionServlet?groups=' + groupsname + '&destination=/servlet/ShowAllServlet', 'CTSAllResults', 'width=670,' + bigSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!allResultsWin.opener) {
  		allResultsWin.opener = self;
  	}
  	allResultsWin.focus();
}

function openCertificate(link) {
  	certificateWin = window.open(link, 'CTSCertificate', 'width=600,' + extraBigSizeAndPosition + ',resizable=yes,scrollbars=yes');
  	if (!certificateWin.opener) {
  		certificateWin.opener = self;
  	}
  	certificateWin.focus();
}

function openPicture(picname) { 
  	picWin = window.open('/images/impressions/' + picname + '.jpg', 'CTSPictureArea', 'width=680,height=680,left=200,top=100' + ',resizable=yes,scrollbars=yes');
  	if (!picWin.opener) {
  		picWin.opener = self;
  	}
  	picWin.focus();
}

function goToAnalyse(link) {
	window.resizeTo(900, 660);
	window.location.href = link;
}
