// <SCRIPT>
<!-- //
// ONLOAD

	function fncOnLoad() { 
		// Changes target on external links and media
		// To use this function add this in all body tags: onload="fncOnLoad()"
		if (!(null==document.links) && document.links.length>0) {
			for (i=0;i<document.links.length;i++) {
				if ( document.links[ i ].hostname > '' && 'http:' == document.links[ i ].protocol && (document.links[ i ].pathname.toLowerCase().indexOf('showmedium.asp')>0 || document.links[ i ].pathname.toLowerCase().indexOf('edia(')>0 || document.links[ i ].pathname.toLowerCase().indexOf('.pdf')>0 || (document.links[ i ].hostname.toLowerCase().indexOf(document.location.hostname)==-1 ) ))  
					// Change link target to siteExtern
					document.links[ i ].target = 'siteExtern';
			}
		}
	}


// GLOBAL VARIABLES
// ----------------------------------------------------------
//MSIE?
var bMSIE=(navigator.appVersion.indexOf("MSIE") != -1)?true:false;
//Firefox?
var bFirefox=(navigator.userAgent.indexOf("Firefox/") != -1)?true:false;
//Windows?
var bWin=(navigator.platform.indexOf("Win") != -1)?true:false;

//page heading
var pageHeading='';

//flash
var MM_contentVersion=6;
var MM_FlashCanPlay=false;
var plugin_flash = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin_flash) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i){
		if (isNaN(parseInt(words[i]))) continue;
		var MM_PluginVersion = words[i]; 
	}
	MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
} else if (bMSIE && bWin) {
	try{
		var flashObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + MM_contentVersion);
		MM_FlashCanPlay=true;
		flashObj=null;
	} catch(e){
		MM_FlashCanPlay=false;
	}
}

// GLOBAL FUNCTIONS
// ----------------------------------------------------------

	function getArgs(){	
		var args = new Object(); 
		var query = location.search.substring(1); 
		var pairs = query.split("&"); 
		for (i=0;i<pairs.length;i++){ 
			var pos = pairs[i].indexOf('='); 
			if (pos == -1) continue; 
			var argname = pairs[i].substring(0,pos); 
			var value = pairs[i].substring(pos+1); 
			args[argname] = unescape(value); 
		} 
		return args;	
	} 

	var args = getArgs();

	function fncValidateForm(aryArgs, lngLCID)  { 
		// v3.0 browsers
		// This function validates forms
		// The input is an array of arguments with 3 arguments per form field
		// The array must have this syntax: 'Form field name', 'Text to alert in case of error', 'Type of validation'
		// Example: 'companyName', 'Company name', 'R', 'email', 'Email', 'RisEmail'
		// Requires the function fncFindObj()
		// Version 1.0, dec 2000, by Søren Larsen
		var objField; // The form field object matching the given field name
		var strFieldAlertText; // The given text that represent the form field in the alert box
		var strTypeOfValidation; // The given validation string
			// Possible values: 
			// - R - input is required
			// - RisEmail - input is required, must be an email address (one or more characters + @ + 3 or more characters and at least one dot after the first lette after the @)
			// - NisEmail - input is NOT required, but if input is given it must be an email address
			// - RisChecked2:3 - input is required, between 2 and 3 of the checkboxes must checked
			// - NisChecked0:3 - input is not required, no more that 3 of the checkboxes can be checked
			// - RisNum - input is required, must be a number
			// - NisNum - input is NOT required, but if input is given it must be a number
			// - RinRange10:400 - input is required, must be a number in this case in the range 10 to 400
			// - NinRange1:5 - input is NOT required, but if input is given it must be a number in this case in the range 1 to 5
		var i;	// Counter for iterations
		var pAt;	// Pointer for email '@'
		var pDot;	// Pointer for email '.'
		var lngCheckedFields; // Count number of checked checkboxes
		var n; // Counter for array of checkboxes / radio buttons
		var pColon;	// Pointer for ':' in numeric ranges
		var lngMin;	// Minimum value for numeric ranges
		var lngMax;	// Maximum value for numeric ranges
		var strErrors = ''; // Used to build string for alert box

		var strMsgIsEmail = 'must contain a valid e-mail address';
		var strMsgIsChecked1 = ' (you must check no more than ';
		var strMsgIsChecked2 = ' (you must check at least ';
		var strMsgIsChecked3 = ' (you must check ';
		var strMsgIsChecked4 = ' (you must check between ';
		var strMsgIsChecked5 = ' of the checkboxes';
		var strMsgIsNum = 'must contain a number';
		var strMsgInRange1 = ' (must contain a number between ';
		var strMsgAnd = ' and ';

		for (i = 0; i < (aryArgs.length - 2); i += 3) { 
			objField = fncFindObj(aryArgs[i]);
			if (objField) { 
				valField = objField.value;
				strFieldAlertText = aryArgs[i+1];
				strTypeOfValidation = aryArgs[i+2]; 

				// save status of array of checkboxes or radio buttons in variable.
				lngCheckedFields = 0;
				
				//jspr
				if (objField.type!=null && objField.type!='textarea' && (objField.type == "checkbox" || objField.type == "radio" || (objField[1]!=null&&objField[1].type == "checkbox") || (objField[1]!=null&&objField[1].type == "radio")))
					if (objField.checked) // Mark if only one checkbox exists i.e. there is no array (possible in dynamic arrays)
						lngCheckedFields = 1;
					else
						for (n = 0; n < objField.length; n++)
							if (objField[n].checked)
								lngCheckedFields++;

				if ((valField == '') || (valField == null && lngCheckedFields == 0 ) || (((objField.type!=null&&objField.type == "checkbox") || (objField.type!=null&&objField.type == "radio")) && objField.checked == false)) { // If no input was given
					if (strTypeOfValidation.charAt(0) == 'R') { // and input is required
						strErrors += '- ' + strFieldAlertText + '\n'; //build error string
					}
				}
				else { // Input was given
					if (strTypeOfValidation.indexOf('isEmail') != -1) { 
						pAt = valField.indexOf('@')
						pDot = valField.indexOf('.', pAt)
						if (pAt < 1 || pAt == (valField.length - 3) || pDot < 1|| pDot == (valField.length - 1) )
							strErrors += '- ' + strFieldAlertText + ' (' + strMsgIsEmail + ')\n';
					}
					else if (strTypeOfValidation.indexOf('isChecked') != -1) {
						pColon = strTypeOfValidation.indexOf(':');
						lngMin = strTypeOfValidation.substring( 10, pColon ); 
						lngMax = strTypeOfValidation.substring( pColon + 1 );
						if (lngCheckedFields < lngMin || lngMax < lngCheckedFields) {
							if (lngMin == 0)
								strErrors += '- ' + strFieldAlertText + strMsgIsChecked1 + lngMax + strMsgIsChecked5 + ')\n';
							else if ((lngMax == 9999) && (lngCheckedFields > 9998)) //9999 means unlimited
								strErrors += '- ' + strFieldAlertText + strMsgIsChecked2 + lngMin + strMsgIsChecked5 + ')\n';
							else if (lngMin == lngMax)
								strErrors += '- ' + strFieldAlertText + strMsgIsChecked3 + lngMin + strMsgIsChecked5 + ')\n';
							else
								strErrors += '- ' + strFieldAlertText + strMsgIsChecked4 + lngMin + strMsgAnd + lngMax + strMsgIsChecked5 + ')\n';
						}
					}
					else if (strTypeOfValidation != 'R') { // The rest of the validation types are numeric
						if (valField != '' + parseFloat(valField)) 
							strErrors += '- ' + strFieldAlertText + ' (' + strMsgIsNum + ')\n';
						else { // Value is a number
							if (strTypeOfValidation.indexOf('inRange') != -1) { 
								pColon = strTypeOfValidation.indexOf(':');
								lngMin = strTypeOfValidation.substring( 8, pColon ); 
								lngMax = strTypeOfValidation.substring( pColon + 1 );
								if (lngMin*1 > valField*1 || valField*1 > lngMax*1)
									strErrors += '- ' + strFieldAlertText + strMsgInRange1 + lngMin + strMsgAnd + lngMax + ')\n';
							}
						} 
					} 
				}
			} // Field not found
		} // End of loop
		if (strErrors) {
			alert(strMsgGeneral1 + '\n\n' + strMsgGeneral2 + '\n' + strErrors + '\n' + strMsgGeneral3 + '\n\n');
		}
		document.blnReturnValue = (strErrors == '');
		return (strErrors == '');
	}

	function fncFindObj(strFormFieldName, d) { //v3.0
		var p, i, x;

		if (!d) 
			d = document; 
		if ((p = strFormFieldName.indexOf("?") ) > 0 && parent.frames.length) {
			d = parent.frames[strFormFieldName.substring(p + 1)].document; 
			strFormFieldName = strFormFieldName.substring(0, p);
		}
		if (! (x = d[strFormFieldName]) && d.all) 
			x = d.all[strFormFieldName]; 
		for (i = 0; ! x && i < d.forms.length; i++) 
			x = d.forms[i][strFormFieldName];
		for (i = 0; ! x && d.layers && i < d.layers.length; i++) 
			x = fncFindObj(strFormFieldName,d.layers[i].document); 
		return x;
	}

	function fncGetRadioValue(aryName){
		var aryFields;
		var objValue = '';
		aryFields = fncFindObj(aryName);
		if (aryFields) {
			if (aryFields.checked) // Mark if only one radiobutton exists i.e. there is no array (possible in dynamic arrays)
				objValue = aryFields.value;
			else
				for (n = 0; n < aryFields.length; n++)
					if (aryFields[n].checked)
						objValue = aryFields[n].value;
			return objValue;
		}
	}


// SEARCH FOR A TERM IN A TARGET STRING AND REPLACE IT
	// replace(targetString,oldTerm,newTerm,caseSensitive,wordOrSubstring) 
	// where caseSenstive is a boolean value and wordOrSubstring is a boolean
	// value and true means whole words, false means substrings

	function replace(target,oldTerm,newTerm,caseSens,wordOnly) {

		var work = target;
		var ind = 0;
		var next = 0;

		if (!caseSens) {
			oldTerm = oldTerm.toLowerCase();
			work = target.toLowerCase();
		}

		while ((ind = work.indexOf(oldTerm,next)) >= 0) {
			if (wordOnly) {
				var before = ind - 1;
				var after = ind + oldTerm.length; 
				if (!(space(work.charAt(before)) && space(work.charAt(after)))) {
					next = ind + oldTerm.length; 
					continue;
				}
			}
			target = target.substring(0,ind) + newTerm + 
			target.substring(ind+oldTerm.length,target.length); 
			work = work.substring(0,ind) + newTerm + 
			work.substring(ind+oldTerm.length,work.length); 
			next = ind + newTerm.length;
			if (next >= work.length) { break; } 
		}

		return target;
	}

	function space( chrChar ) {
		if ( ' ' == chrChar || 'x-' == chrChar || '.' == chrChar || ',' == chrChar )
			return true;
		else
			return false;
	}


// COOKIE FUNCTIONS

	function loadFormFromCookies( frmHtmlForm ) {
		var aryCookieValues = document.cookie.split('; ');
		for (var i=0; i<aryCookieFormFields.length; i++)
			for (var j=0; j<aryCookieValues.length; j++)
				if (aryCookieFormFields[i] == unescape(aryCookieValues[j].split('=')[0]))
					frmHtmlForm[ aryCookieFormFields[i] ].value = unescape(aryCookieValues[j].split('=')[1]);
	}
	
	function saveFormToCookies(frmHtmlForm) {
		for (var i=0; i<aryCookieFormFields.length; i++)
			if (null != frmHtmlForm[ aryCookieFormFields[i] ] && null != frmHtmlForm[ aryCookieFormFields[i] ].value && frmHtmlForm[ aryCookieFormFields[i] ].value > '')
				document.cookie = aryCookieFormFields[i] + '=' + escape(frmHtmlForm[ aryCookieFormFields[i] ].value) + '; expires=Mon, 03-Jan-2011 00:00:00 GMT';
	}

	function cookieExists(cookieName) {
		var allCookies = document.cookie;
		var cookiePosInArray = allCookies.indexOf(cookieName);
			// If the index is found, the cookie exist
		return (cookiePosInArray != -1);
	}

	function clearCookie(cookieName){
		var a=new Date();
		document.cookie = cookieName + "=; path=/; expires=" + a.toGMTString();
		document.location = "/";
	}
	
	function returnCookie(cookieName) {
		var cookieArray = document.cookie.split('; ');
		for(var i=0;i<cookieArray.length;i++){
			if(cookieArray[i].split('=')[0]==cookieName)
				return cookieArray[i].split('=')[1];
		}
	}

// DOM - GET OBJECT
	if(document.getElementById) {
		window.getObj = function(id) {
			return document.getElementById(id);
		}
	} else {
		window.getObj = function(id) {
			return false;
		}
	}

// PRINT
	function doPrint(objname){
		var i,j,idx;
		var objContent=getObj((objname?objname:'content'));
		var content='';
		
		if (!objContent || (bMSIE && !bWin)) {
			if(window.print){
				window.print();
			} else {
				alert('Please use your browsers normal print-function.');
			}
			return;
		} else {
			content=objContent.innerHTML.replace(/\"media%28(\d+),(\d+)%29\//gi,"media($1,$2)/");
		}
		
		var stylesheetimports=getObj('stylesheetimports').innerHTML;
		
		//Opera fix
		if (!stylesheetimports||stylesheetimports==''){
			//add basic stylesheet
			stylesheetimports='@import url("/public.css");'
		}
		
		var title=document.title;
		var objWrite=null;
		var html='';
		
		if ((bMSIE||bFirefox) && bWin){
			html='<html><head><title>'+title+'</title><style type="text/css" media="all">'+stylesheetimports+'</style><scr'+'ipt src="/script/general.js" type="text/javascript"></scr'+'ipt></head><body style="margin: 10px;" onload="window.print();window.history.go(-1);"><h1>'+pageHeading+'<br><br><br></h1>'+content+'</body></html>';
			objWrite=window.document;
		} else if (bFirefox){
			html='<html><head><title>'+title+'</title><style type="text/css" media="all">'+stylesheetimports+'</style><scr'+'ipt src="/script/general.js" type="text/javascript"></scr'+'ipt><scr'+'ipt language="javascript">function printIt(){window.print();window.history.go(-1);}</scr'+'ipt></head><body style="margin: 10px;" onload="window.setTimeout(\'printIt()\',500);"><h1>'+pageHeading+'<br><br><br></h1><br>'+content+'</body></html>';
			objWrite=window.document;
		} else {
			var win=window.open('','printwin');
			html='<html><head><title>'+title+'</title><style type="text/css" media="all">'+stylesheetimports+'</style><scr'+'ipt src="/script/general.js" type="text/javascript"></scr'+'ipt><scr'+'ipt language="javascript">function printIt(){window.print();}</scr'+'ipt></head><body style="margin: 10px;" onload="window.setTimeout(\'printIt()\',1000);"><h1>'+pageHeading+'<br><br><br></h1>'+content+'</body></html>';
			objWrite=win.document;
		}
		
		if (objWrite){
			objWrite.open("text/html");
			objWrite.write(html);
			objWrite.close();
		}
	}

// FLASH CONTENT
	function embedFlash(movie,width,height,altHTML,bPlay,altTitle,bgcolor,align,paramtags){
		if ( MM_FlashCanPlay ) {
			document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
			document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+MM_contentVersion+',0,0,0" ');
			document.write(' width="'+width+'" height="'+height+'" align="'+(align?align:'')+'"'+(altTitle?' title="'+altTitle+'" alt="'+altTitle+'"':'')+'>');
			document.write(' <param name="movie" value="'+movie+'">');
			document.write(' <param name="wmode" value="transparent">');
			document.write(' <param name="quality" value="best"> <param name="bgcolor" value="'+(bgcolor?bgcolor:'#ffffff')+'">  ' );
			if (bPlay) document.write('  <param name="play" value="true">  ');
			if (paramtags) document.write(paramtags);
			document.write(' <embed src="'+movie+'" wmode="transparent" quality="best" bgcolor="'+(bgcolor?bgcolor:'#ffffff')+'"  ');
			document.write(' swLiveConnect="FALSE" width="'+width+'" height="'+height+'" align="'+(align?align:'')+'"'+(altTitle?' title="'+altTitle+'" alt="'+altTitle+'"':''));
			document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
			document.write(' </embed>');
			document.write(' </object>');
		} else{
			if (altHTML) document.write(altHTML);
		}
	}

	function embedHeadingFlash(movie,width,height,altHTML,bPlay,bgcolor,align,paramtags){
		if ( MM_FlashCanPlay && !(bWin && bFirefox)) {
			document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
			document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+MM_contentVersion+',0,0,0" ');
			document.write(' width="'+width+'" height="'+height+'" align="'+(align?align:'')+'">');
			document.write(' <param name="movie" value="'+movie+'">');
			document.write(' <param name="wmode" value="transparent">');
			document.write(' <param name="quality" value="best"> <param name="bgcolor" value="'+(bgcolor?bgcolor:'#ffffff')+'">  ' );
			if (bPlay) document.write('  <param name="play" value="true">  ');
			if (paramtags) document.write(paramtags);
			document.write(' <embed src="'+movie+'" wmode="transparent" quality="best" bgcolor="'+(bgcolor?bgcolor:'#ffffff')+'"  ');
			document.write(' swLiveConnect="FALSE" width="'+width+'" height="'+height+'" align="'+(align?align:'')+'"');
			document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
			document.write(' </embed>');
			document.write(' </object>');
		} else{
			if (altHTML) document.write(altHTML);
		}
	}

// --></SCRIPT>
