//------------------------------------------------------------------------------------//
// NB: All methods with absolute paths in them (ending with Abs) are used exclusively //
// for the payment module.				  											  //
//------------------------------------------------------------------------------------//

//------------------------------------------------------------------------------------//
// Function to determine screen resolution											  //
//------------------------------------------------------------------------------------//
// Deze funktie gaat er vanuit dat het scherm standaard 1024x768 is en geeft dan ook de 
// waarde 1024 terug. Indien de breedte groter is dan 1024 en de hoogte groter dan 1023
// wordt de waarde 1280 teruggegeven.

function getResolution(){
	var naam = '1024';
	if (screen.width > 1024 && screen.height > 1023) {
		naam = '1280';
	}
	return naam;
}

var schermResolutie = getResolution();

//------------------------------------------------------------------------------------//
// Function to display the backgroundpicture for the header							  //
//------------------------------------------------------------------------------------//
function header(){	
	document.write ('<img src=\"'+ schermResolutie + '/graphics/header.jpg\" id=\"header\">');
}

function headerAbs(scheme, server, contextpath){	
	document.write ('<img src=\"'+ scheme + '://' + server + contextpath + '/' + schermResolutie + '/graphics/header.jpg\" id=\"header\">');
}

//------------------------------------------------------------------------------------//
// Function to display choice buttons 												  //
//------------------------------------------------------------------------------------//
function buttons(){
	document.write ('<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">');
	document.write ('<tr>');
	document.write ('<td class=\"navigation\"><a style=\"color: white\" href=\"index.html\">Home</a></td>');
	document.write ('<td class=\"navigation\"><a style=\"color: white\" href=\"somatology1.html\">Somatology</a></td>');	
	document.write ('<td class=\"navigation\"><a style=\"color: white\" href=\"emile.html\">Emile Ratelband</a></td>');
	document.write ('<td class=\"navigation\"><a style=\"color: white\" href=\"resultaten.html\">Resultaten</a></td>');	
	document.write ('<td class=\"navigation\"><a style=\"color: white\" href=\"referenties.html\">Referenties</a></td>');
	document.write ('<td class=\"navigation\"><a style=\"color: white\" href=\"seminar1.html\">Seminars</a></td>');	
	document.write ('<td class=\"navigation\">&nbsp;</td>');
	document.write ('<td class=\"navigation\">&nbsp;</td>');
	document.write ('<td class=\"navigation\">&nbsp;</td>');
	document.write ('<td class=\"navigation\">&nbsp;</td>');
	document.write ('</tr>');
	document.write ('</table>');
}

//------------------------------------------------------------------------------------//
// Function to display the starttag for the table of the page						  //
//------------------------------------------------------------------------------------//
function tableStart(){		
	document.write ('<table align=\"center\" id=\"general\" style=\"background: transparent url('+ schermResolutie + '/graphics/contentfill.jpg)\";\" border=\"0\">');
}

function tableStartAbs(scheme, server, contextpath){
	document.write ('<table align=\"center\" id=\"general\" style=\"background: transparent url('+ scheme + '://' + server + contextpath + '/' + schermResolutie + '/graphics/contentfill.jpg)\";\" border=\"0\">');
}
 
//------------------------------------------------------------------------------------//
// Functions to display an inputbutton with a picture 								  //
//------------------------------------------------------------------------------------//
function inputButton(buttonName, tabindex, value){
	document.write ('<input type=\"image\" src=\"' + schermResolutie + '/graphics/buttons/' + buttonName + '\" tabindex=\"' + tabindex + '\" value=\"'+ value + '\" />');
}

function inputProduct(imgName){
	document.write ('<input type=\"image\" src=\"' + schermResolutie + '/graphics/products/' + imgName + '\" />');
}

//------------------------------------------------------------------------------------//
// Functions to display an image or a button										  //
//------------------------------------------------------------------------------------//
function displayImage(imageName, border, align) {
	if (align != "") {
		document.write ('<img src=\"' + schermResolutie + '/graphics/' + imageName + '\" border=\"' + border + '\" align=\"'+ align + '\">');	
	}
	else {
		document.write ('<img src=\"' + schermResolutie + '/graphics/' + imageName + '\" border=\"' + border + '\">');
	}
}

function displayButton(buttonName){
	document.write ('<img src=\"' + schermResolutie + '/graphics/buttons/' + buttonName + '\" />');
}

function displayInfoText(infotext){	
	document.write ('<img src=\"' + schermResolutie + '/graphics/info-inline.gif\"  alt=\"' + infotext + '\" title=\"' + infotext + '\" />');
}

//------------------------------------------------------------------------------------//
// Function to display an url														  //
//------------------------------------------------------------------------------------//
function displayUrl(name, title, text) {
	document.write('<a href=\"' + schermResolutie + '/docs/' + name + '\" title=\"' + title + '\" target="_blank">' + text + '</a>');
}

//------------------------------------------------------------------------------------//
// Function to display a textHead based on given name								  //
//------------------------------------------------------------------------------------//
function textHead(textHeadName){	
	document.write ('<img src=\"' + schermResolutie + '/graphics/textHead/' + textHeadName + '\">');
}

function textHeadAbs(textHeadName, scheme, server, contextpath){
	document.write ('<img src=\"' + scheme + '://' + server + contextpath + '/' + schermResolutie + '/graphics/textHead/' + textHeadName + '\">');
}

//------------------------------------------------------------------------------------//
// Function to display the footer td line											  //
//------------------------------------------------------------------------------------//
function tdFooter(){
	document.write ('<td><img src=\"' + schermResolutie + '/graphics/footer.jpg\" id=\"footer\" usemap=\"#tokenred\"></td>');	
	document.write('<map name="tokenred">');
	document.write('<area shape="rectangle" coords="643,1,990,41" href="http://www.tokenred.com/klantReferenties.html" target="_blank">');
	document.write('</map');
}

function tdFooterAbs(scheme, server, contextpath){
	document.write ('<td><img src=\"' + scheme + '://' + server + contextpath + '/' + schermResolutie + '/graphics/footer.jpg\" id=\"footer\"></td>');
}

//------------------------------------------------------------------------------------//
// Function to determine the css depending on the settings of the screen (Start)	  //
//------------------------------------------------------------------------------------//
function writeBrowserBasedStartCSS(){
	var browserType;
	if (navigator.appName == "Microsoft Internet Explorer"){
		browserType='somatologyStartIE';
	}
	else if (navigator.appName == "Netscape"){
		browserType='somatologyStartFF';
	}
	document.write ('<link rel=\"stylesheet\" href=\"' + schermResolutie + '/css/' + browserType + '.css\" type=\"text/css\">');
}

function writeBrowserBasedStartCSSAbs(scheme, server, contextpath){
	var browserType;
	if (navigator.appName == "Microsoft Internet Explorer"){
		browserType='somatologyStartIE';
	}
	else if (navigator.appName == "Netscape"){
		browserType='somatologyStartFF';
	}
	document.write ('<link rel=\"stylesheet\" href=\"' + scheme + '://' + server + contextpath + '/' + schermResolutie + '/css/' + browserType + '.css\" type=\"text/css\">');
}

//------------------------------------------------------------------------------------//
// Function to determine the css depending on the settings of the screen (average)	  //
//------------------------------------------------------------------------------------//
function writeBrowserBasedCSS(){
	var browserType;
	if (navigator.appName == "Microsoft Internet Explorer"){
		browserType='somatologyIE';
	}
	else if (navigator.appName == "Netscape"){
		browserType='somatologyFF';
	}
	document.write ('<link rel=\"stylesheet\" href=\"' + schermResolutie + '/css/' + browserType + '.css\" type=\"text/css\">');	
}

function writeBrowserBasedCSSAbs(scheme, server, contextpath){
	var browserType;
	if (navigator.appName == "Microsoft Internet Explorer"){
		browserType='somatologyIE';
	}
	else if (navigator.appName == "Netscape"){
		browserType='somatologyFF';
	}
	document.write ('<link rel=\"stylesheet\" href=\"' + scheme + '://' + server + contextpath + '/' + schermResolutie + '/css/' + browserType + '.css\" type=\"text/css\">');
}

//------------------------------------------------------------------------------------//
// Function to determine the css depending on the settings of the screen (Start)	  //
//------------------------------------------------------------------------------------//
function writeBrowserBasedShopCSS(){
	var browserType;
	if (navigator.appName == "Microsoft Internet Explorer"){
		browserType='somatologyShopIE';
	}
	else if (navigator.appName == "Netscape"){
		browserType='somatologyShopFF';
	}
	document.write ('<link rel=\"stylesheet\" href=\"' + schermResolutie + '/css/' + browserType + '.css\" type=\"text/css\">');
}

function writeBrowserBasedShopCSSAbs(scheme, server, contextpath){
	var browserType;
	if (navigator.appName == "Microsoft Internet Explorer"){
		browserType='somatologyShopIE';
	}
	else if (navigator.appName == "Netscape"){
		browserType='somatologyShopFF';
	}
	document.write ('<link rel=\"stylesheet\" href=\"' + scheme + '://' + server + contextpath + '/' + schermResolutie + '/css/' + browserType + '.css\" type=\"text/css\">');
}

//------------------------------------------------------------------------------------//
// Function to determine the height of the DIVs dependent on the height of the screen //
//------------------------------------------------------------------------------------//
function getHeight(){
	var divHeight;
	var margin = 7;

		if (schermResolutie == '1024')
		{
			var divSubtract = 198;
		} else
		{
			var divSubtract = 265;
		}

	if (self.innerHeight) 
		{ // all except Explorer
			divHeight = self.innerHeight - margin - divSubtract;
		} else if (document.documentElement && document.documentElement.clientHeight) 
		{ // Explorer 6 Strict Mode
			divHeight = document.documentElement.clientHeight - margin - divSubtract;
		} else if (document.body) 
		{ // other Explorers
			divHeight = document.body.clientHeight - margin - divSubtract + 5;
		}
	return divHeight ;
}

//------------------------------------------------------------------------------------//
// Bereken de hoogte van de DIV articleList									  		  //
//------------------------------------------------------------------------------------//
function getHeightArticleList(extraspace, details){
	var shopTextHeader = 150;
	if (extraspace != null) {
		shopTextHeader = 240;
	}
	if (details != null) {
		shopTextHeader = 140;
	}
	var content = getHeight();
	var correctie = 0;
	var shopArticleList = 0;
	shopArticleList = content - shopTextHeader - correctie;
	
	return shopArticleList;
}

//------------------------------------------------------------------------------------//
// Bereken de hoogte van de DIV notaBestelRegels									  //
//------------------------------------------------------------------------------------//
function getHeightNotaBestelRegels(){
	var content = getHeight();
	var notaHeader = 160;
	var notaFooter = 90;
	var notaBestelRegels = 0;

	if (schermResolutie == '1280') {
		notaHeader = 213;
		notaFooter = 119;
	}
	notaBestelRegels = content - notaHeader - notaFooter;
	return notaBestelRegels;
}

//------------------------------------------------------------------------------------//
// Bereken de hoogte van de DIV aan de linkerkant									  //
//------------------------------------------------------------------------------------//
function makeLeftPanelDiv(){
	document.write('<div id="content_1" style="height:' + getHeight() + 'px;">');
}

//------------------------------------------------------------------------------------//
// Bereken de hoogte van de DIV aan de rechterkant									  //
//------------------------------------------------------------------------------------//
function makeRightPanelDiv(){
	var wid;
	if (navigator.appName == "Microsoft Internet Explorer"){wid=16;}
	else if (navigator.appName == "Netscape"){wid=500;}
	document.write('<div id="content_2" style="height:' + getHeight() + 'px;margin-left: ' + wid + 'px; ">');
}

function makeRightPanelWebshopDiv(){
	var wid;
	if (navigator.appName == "Microsoft Internet Explorer"){wid=-20;}
	else if (navigator.appName == "Netscape"){wid=600;}
	document.write('<div id="content_2" style="height:' + getHeight() + 'px;margin-left: ' + wid + 'px; ">');
}

//------------------------------------------------------------------------------------//
// Bereken de hoogte van de DIV voor de nota van de webshop (header en footer		  //
//------------------------------------------------------------------------------------//
function makeShopNotaHeader(){
	if (schermResolutie == "1280") {
		document.write('<div id="shopNotaHeader" style="height: 213px">	</div>');
	}
	else {
		document.write('<div id="shopNotaHeader"></div>');	
	}
}

function makeShopNotaFooter(){
	var resolutie =  getResolution();
	if (resolutie == "1280") {
		document.write('<div id="shopNotaFooter" style="height: 119px">');
	}
	else {
		document.write('<div id="shopNotaFooter">');	
	}
}

//------------------------------------------------------------------------------------//
// Function to redraw the screen when the window is resized                           //
//------------------------------------------------------------------------------------//
function refresh(){
  //window.location.reload(true); // IE, maar geen mozilla!
  window.location.href=window.location.href; // ook voor browsers die geen javascript 1.2 ondersteunen...
}
window.onresize = refresh;