

function cms_linkTo(s) {
	location.href=cms_decryptString(s, -3);
}

function cms_protect(s) {
	document.write(cms_decryptString(s, -3));
}

function cms_decryptString(s,offset) {
	var dec="";
	var len=s.length;

	for(var i=0; i < len; i++)	{
		var n=s.charCodeAt(i);
		if (n >= 0x2B && n <= 0x3A) {
			dec+=cms_decryptCharcode(n, 0x2B, 0x3A, offset);
		}
		else if (n >= 0x40 && n <= 0x5A) {
   		dec+=cms_decryptCharcode(n, 0x40, 0x5A, offset);
  		}
		else if (n >= 0x61 && n <= 0x7A) {
			dec+=cms_decryptCharcode(n, 0x61, 0x7A, offset);
		}
		else {
			dec+=s.charAt(i);
		}
	}
	return dec;
}

function cms_decryptCharcode(n,start,end,offset) {
	n=n+offset;
	if (offset > 0 && n > end) {
		n=start+(n-end-1);
	}
	else if (offset < 0 && n < start) {
 		n=end-(start-n-1);
	}
	return String.fromCharCode(n);
}

function parseCookie(myCookie) {
	var myVariables = myCookie.split(";");
	var returnvalue = new Array();
	for(var i = 0; i <= myVariables.length; i++) {
		if (myVariables[i]) {
			thisValues = myVariables[i].split("=");
			thisVar = trim(thisValues[0].toLowerCase());
			thisVal = trim(thisValues[1]);
			returnvalue[thisVar]= thisVal;
		}
	}
	return returnvalue;
}

var ccErrorNo = 0;
var ccErrors = new Array ()

ccErrors [0] = "Unknown card type";
ccErrors [1] = "No card number provided";
ccErrors [2] = "Credit card number is in invalid format";
ccErrors [3] = "Credit card number is invalid";
ccErrors [4] = "Credit card number has an inappropriate number of digits";

function checkCreditCard (cardnumber, cardname) {
  // Array to hold the permitted card characteristics
  var cards = new Array();

  // Define the cards we support. You may add addtional card types.

  //  Name:      As in the selection box of the form - must be same as user's
  //  Length:    List of possible valid lengths of the card number for the card
  //  prefixes:  List of possible prefixes for the card
  //  checkdigit Boolean to say whether there is a check digit

  cards [0] = {name: "Visa",
               length: "13,16",
               prefixes: "4",
               checkdigit: true};
  cards [1] = {name: "MasterCard",
               length: "16",
               prefixes: "51,52,53,54,55",
               checkdigit: true};
  cards [2] = {name: "DinersClub",
               length: "14,16",
               prefixes: "300,301,302,303,304,305,36,38,55",
               checkdigit: true};
  cards [3] = {name: "CarteBlanche",
               length: "14",
               prefixes: "300,301,302,303,304,305,36,38",
               checkdigit: true};
  cards [4] = {name: "AmEx",
               length: "15",
               prefixes: "34,37",
               checkdigit: true};
  cards [5] = {name: "Discover",
               length: "16",
               prefixes: "6011,650",
               checkdigit: true};
  cards [6] = {name: "JCB",
               length: "15,16",
               prefixes: "3,1800,2131",
               checkdigit: true};
  cards [7] = {name: "enRoute",
               length: "15",
               prefixes: "2014,2149",
               checkdigit: true};
  cards [8] = {name: "Solo",
               length: "16,18,19",
               prefixes: "6334, 6767",
               checkdigit: true};
  cards [9] = {name: "Switch",
               length: "16,18,19",
               prefixes: "4903,4905,4911,4936,564182,633110,6333,6759",
               checkdigit: true};
  cards [10] = {name: "Maestro",
               length: "16",
               prefixes: "5020,6",
               checkdigit: true};
  cards [11] = {name: "VisaElectron",
               length: "16",
               prefixes: "417500,4917,4913",
               checkdigit: true};

  // Establish card type
  var cardType = -1;
  for (var i=0; i<cards.length; i++) {

    // See if it is this card (ignoring the case of the string)
    if (cardname.toLowerCase () == cards[i].name.toLowerCase()) {
      cardType = i;
      break;
    }
  }

  // If card type not found, report an error
  if (cardType == -1) {
     ccErrorNo = 0;
     return false;
  }

  // Ensure that the user has provided a credit card number
  if (cardnumber.length == 0)  {
     ccErrorNo = 1;
     return false;
  }

  // Now remove any spaces from the credit card number
  cardnumber = cardnumber.replace (/\s/g, "");

  // Check that the number is numeric
  var cardNo = cardnumber
  var cardexp = /^[0-9]{13,19}$/;
  if (!cardexp.exec(cardNo))  {
     ccErrorNo = 2;
     return false;
  }

  // Now check the modulus 10 check digit - if required
  if (cards[cardType].checkdigit) {
    var checksum = 0;                                  // running checksum total
    var mychar = "";                                   // next char to process
    var j = 1;                                         // takes value of 1 or 2

    // Process each digit one by one starting at the right
    var calc;
    for (i = cardNo.length - 1; i >= 0; i--) {

      // Extract the next digit and multiply by 1 or 2 on alternative digits.
      calc = Number(cardNo.charAt(i)) * j;

      // If the result is in two digits add 1 to the checksum total
      if (calc > 9) {
        checksum = checksum + 1;
        calc = calc - 10;
      }

      // Add the units element to the checksum total
      checksum = checksum + calc;

      // Switch the value of j
      if (j ==1) {j = 2} else {j = 1};
    }

    // All done - if checksum is divisible by 10, it is a valid modulus 10.
    // If not, report an error.
    if (checksum % 10 != 0)  {
     ccErrorNo = 3;
     return false;
    }
  }

  // The following are the card-specific checks we undertake.
  var LengthValid = false;
  var PrefixValid = false;
  var undefined;

  // We use these for holding the valid lengths and prefixes of a card type
  var prefix = new Array ();
  var lengths = new Array ();

  // Load an array with the valid prefixes for this card
  prefix = cards[cardType].prefixes.split(",");

  // Now see if any of them match what we have in the card number
  for (i=0; i<prefix.length; i++) {
    var exp = new RegExp ("^" + prefix[i]);
    if (exp.test (cardNo)) PrefixValid = true;
  }

  // If it isn't a valid prefix there's no point at looking at the length
  if (!PrefixValid) {
     ccErrorNo = 3;
     return false;
  }

  // See if the length is valid for this card
  lengths = cards[cardType].length.split(",");
  for (j=0; j<lengths.length; j++) {
    if (cardNo.length == lengths[j]) LengthValid = true;
  }

  // See if all is OK by seeing if the length was valid. We only check the
  // length if all else was hunky dory.
  if (!LengthValid) {
     ccErrorNo = 4;
     return false;
  };

  // The credit card is in the required format.
  return true;
}

function updateWMTT(e) {
	try {
		x=(document.all) ? window.event.x + document.documentElement.scrollLeft + document.getElementsByTagName("div")[1].scrollLeft: e.pageX;
		y=(document.all) ? window.event.y + document.documentElement.scrollTop + document.getElementsByTagName("div")[1].scrollTop: e.pageY;
		if (wmtt != null) {
			wmtt.style.left=(x - 150) + "px";
			wmtt.style.top=(y + 20) + "px";
		}
	}
	catch(e) { }
}

function showTT(id) {
	wmtt=document.getElementById(id);
	wmtt.style.display="block"
}

function hideTT() {
	wmtt.style.display="none";
}

function cms_showpic(file,width,height,scrollbar) {
	var scroll = "no";

	if(!cms_showpic.arguments[1]) {
		width="";
	}
	if(!cms_showpic.arguments[2]) {
		height="";
	}
	if(cms_showpic.arguments[1] || cms_showpic.arguments[2]) {
		scroll="yes";
	}
	//Scrollbars "yes" OR "no"
	if(cms_showpic.arguments[3]) {
		var scroll = scrollbar;
	}

	//Bildgrösse bekannt
	lenWidth = width.replace(/\r/g, " ");
	lenHeight = height.replace(/\r/g, " ");

	//Bildpfad speichern
	path = "/g3framework/g3v1/cmsAdmin/modules/popup.cfm?picfile="+file;

	//Breite und Höhe wird übergeben, sofern vorhanden
	if (lenWidth != '' && lenHeight != '') {
		path = path+"&width="+width+"&height="+height;
	}

	var picwindow=window.open(path, "picwindow", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + scroll + ",resizable=yes,top=50,left=50");
  picwindow.focus();
}

function trim(item)	{
	return item.replace(/^\s*(\b.*\b|)\s*$/, '$1');
}

function isdate(datum) {
	date = trim(datum);
	if (date.length > 0) {
		if (date.search(/\d\d.\d\d.\d\d/) != -1 || date.search(/\d\d.\d\d.\d\d\d\d/) != -1 || date.search(/\d.\d.\d\d/) != -1 || date.search(/\d.\d.\d\d\d\d/) != -1 || date.search(/\d\d.\d.\d\d/) != -1 || date.search(/\d\d.\d.\d\d\d\d/) != -1 || date.search(/\d.\d\d.\d\d/) != -1 || date.search(/\d.\d\d.\d\d\d\d/) != -1) {
			aDate = date.split(".");
			iDay = 1 * aDate[0];
			iMonth = 1 * aDate[1];
			iYear = 1 * aDate[2];
			sYear = "" + iYear;
			if (sYear.length != 4 && iYear >= 51 && iYear <= 99) {
				iYear = 1900 + iYear;
			}
			else if (sYear.length != 4 && iYear >= 0 && iYear <= 50) {
				iYear = 2000 + iYear;
			}
			else if (sYear.length != 4 && iYear > 99) {
				iDay = 99;
				iMonth = 99;
			}
			else if (sYear.length == 4 && iYear < 1951) {
				iDay = 99;
				iMonth = 99;
			}
			if (iYear == "2000") {
				isLeapyear = false;
			}
			else {
				leapyear = Math.ceil(iYear / 4);
				calc = 4 * leapyear;
				if (calc == iYear) {
					isLeapyear = true;
				}
				else {
					isLeapyear = false;
				}
			}
			iDayCount = 0;
			switch(iMonth) {
				case 1:
					iDayCount = 31;
				break;
				case 2:
					if (isLeapyear == true) {
						iDayCount = 29;
					}
					else {
						iDayCount = 28;
					}
				break;
				case 3:
					iDayCount = 31;
				break;
				case 4:
					iDayCount = 30;
				break;
				case 5:
					iDayCount = 31;
				break;
				case 6:
					iDayCount = 30;
				break;
				case 7:
					iDayCount = 31;
				break;
				case 8:
					iDayCount = 31;
				break;
				case 9:
					iDayCount = 30;
				break;
				case 10:
					iDayCount = 31;
				break;
				case 11:
					iDayCount = 30;
				break;
				case 12:
					iDayCount = 31;
				break;
			}
			if (iDay >= 1 && iDay <= iDayCount) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			return false;
		}
	}
	else {
		return false;
	}
}
function ismail(mail) {
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(mail)) {
		return true;
	}
	else {
		return false;
	}
}

function cms_reload() {
	location.reload();
}
function cms_popup(Ziel,Breite,Hoehe,Status,Toolbar,Location,Menu) {
	popup=window.open(Ziel,"PopUp","status=" + Status + ",toolbar=" + Toolbar + ",location=" + Location + ",menu=" + Menu + ",width=" + Breite + ",height=" + Hoehe + ",left=" + (screen.width - Breite) / 2 +	",top=" + (screen.height - Hoehe) / 2);
	popup.focus();
}



var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = Base64._utf8_encode(input);

		while (i < input.length) {

			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}



//Lightbox
if(jQuery().lightBox) {
	$(function() {
		$('a[rel=lightbox]').lightBox({
		overlayBgColor: '#000000',
		overlayOpacity: 0.8,
		containerBorderSize: 10,
		containerResizeSpeed: 400,
		imageLoading: '/lib/javascript/jquery/plugins/lightbox/leandrovieira/0.5/images/loading.gif',
		imageBtnClose: '/lib/javascript/jquery/plugins/lightbox/leandrovieira/0.5/images/close.gif',
		imageBtnPrev: '/lib/javascript/jquery/plugins/lightbox/leandrovieira/0.5/images/prev.gif',
		imageBtnNext: '/lib/javascript/jquery/plugins/lightbox/leandrovieira/0.5/images/next.gif',
		txtImage: 'Bild',
		txtOf: 'von'
	   });
	});
} <!--
/**
 * FlashObject v1.2.3: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2005 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof com == "undefined") var com = new Object();
if(typeof com.deconcept == "undefined") com.deconcept = new Object();
if(typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
if(typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
com.deconcept.FlashObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, redirectUrl, detectKey){
   this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
   this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
   this.params = new Object();
   this.variables = new Object();
   this.attributes = new Array();

   if(swf) this.setAttribute('swf', swf);
   if(id) this.setAttribute('id', id);
   if(w) this.setAttribute('width', w);
   if(h) this.setAttribute('height', h);
   if(ver) this.setAttribute('version', new com.deconcept.PlayerVersion(ver.toString().split(".")));
   if(c) this.addParam('bgcolor', c);
   //var q = quality ? quality : 'high';
   this.addParam('quality', quality);
   this.setAttribute('redirectUrl', '');
   if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
   if(useExpressInstall) {
   // check to see if we need to do an express install
   var expressInstallReqVer = new com.deconcept.PlayerVersion([6,0,65]);
   var installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion();
      if (installedVer.versionIsValid(expressInstallReqVer) && !installedVer.versionIsValid(this.getAttribute('version'))) {
         this.setAttribute('doExpressInstall', true);
      }
   } else {
      this.setAttribute('doExpressInstall', false);
   }
}
com.deconcept.FlashObject.prototype.setAttribute = function(name, value){
	this.attributes[name] = value;
}
com.deconcept.FlashObject.prototype.getAttribute = function(name){
	return this.attributes[name];
}
com.deconcept.FlashObject.prototype.getAttributes = function(){
	return this.attributes;
}
com.deconcept.FlashObject.prototype.addParam = function(name, value){
	this.params[name] = value;
}
com.deconcept.FlashObject.prototype.getParams = function(){
	return this.params;
}
com.deconcept.FlashObject.prototype.getParam = function(name){
	return this.params[name];
}
com.deconcept.FlashObject.prototype.addVariable = function(name, value){
	this.variables[name] = value;
}
com.deconcept.FlashObject.prototype.getVariable = function(name){
	return this.variables[name];
}
com.deconcept.FlashObject.prototype.getVariables = function(){
	return this.variables;
}
com.deconcept.FlashObject.prototype.getParamTags = function(){
   var paramTags = ""; var key; var params = this.getParams();
   for(key in params) {
        paramTags += '<param name="' + key + '" value="' + params[key] + '" />';
    }
   return paramTags;
}
com.deconcept.FlashObject.prototype.getVariablePairs = function(){
	var variablePairs = new Array();
	var key;
	var variables = this.getVariables();
	for(key in variables){
		variablePairs.push(key +"="+ variables[key]);
	}
	return variablePairs;
}
com.deconcept.FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
        flashHTML += '<embed type="application/x-shockwave-flash" wmode="transparent" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') + '" name="'+ this.getAttribute('id') +'"';
		var params = this.getParams();
        for(var key in params){ flashHTML += ' '+ key +'="'+ params[key] +'"'; }
		pairs = this.getVariablePairs().join("&");
        if (pairs.length > 0){ flashHTML += ' flashvars="'+ pairs +'"'; }
        flashHTML += '></embed>';
    } else { // PC IE
        if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') +'">';
        flashHTML += '<param name="wmode" value="transparent" /><param name="movie" value="' + this.getAttribute('swf') + '" />';
		var tags = this.getParamTags();
        if(tags.length > 0){ flashHTML += tags; }
		var pairs = this.getVariablePairs().join("&");
        if(pairs.length > 0){ flashHTML += '<param name="flashvars" value="'+ pairs +'" />'; }
				//flashHTML += '<param name="wmode" value="transparent" />';
        flashHTML += '</object>';
    }
		//alert(flashHTML);
    return flashHTML;
}
com.deconcept.FlashObject.prototype.write = function(elementId){
	if(this.skipDetect || this.getAttribute('doExpressInstall') || com.deconcept.FlashObjectUtil.getPlayerVersion().versionIsValid(this.getAttribute('version'))){
		if(document.getElementById){
		   if (this.getAttribute('doExpressInstall')) {
		      this.addVariable("MMredirectURL", escape(window.location));
		      document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		      this.addVariable("MMdoctitle", document.title);
		   }
			document.getElementById(elementId).innerHTML = this.getHTML();
		}
	}else{
		if(this.getAttribute('redirectUrl') != "") {
			document.location.replace(this.getAttribute('redirectUrl'));
		}
	}
}
/* ---- detection functions ---- */
com.deconcept.FlashObjectUtil.getPlayerVersion = function(){
   var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (window.ActiveXObject){
	   try {
   	   var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
   		PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
	   } catch (e) {}
	}
	return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion){
	this.major = parseInt(arrVersion[0]) || 0;
	this.minor = parseInt(arrVersion[1]) || 0;
	this.rev = parseInt(arrVersion[2]) || 0;
}
com.deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
com.deconcept.util.getRequestParameter = function(param){
	var q = document.location.search || document.location.href.hash;
	if(q){
		var startIndex = q.indexOf(param +"=");
		var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
		if (q.length > 1 && startIndex > -1) {
			return q.substring(q.indexOf("=", startIndex)+1, endIndex);
		}
	}
	return "";
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use / backwards compatibility */
var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;
//-->

