// JavaScript Document
// 17.03.11

function opennewwindow(url,params){
	w = window.open(url,'newwindow',params);
	w.focus();
	return false;
}


function validatePhone(phoneField, format) {
    var num = phoneField.value.replace(/[^\d]/g,'');
    switch(format) {
            
            default: //Format xxxxxxxxxx
                phoneField.value = num;
                break;
        }
	if(num.length <= 8) {
        //Alert the user that the phone number entered was invalid.
        //alert('Die eingegebene Nummer ist zu kurz');                    
    } else {
        //Email was valid.  If format type is set, format the Phone to the desired style.
       
    }
}

function validateAW(awField, format) {
    var awnum = awField.value.replace(/[^\w]/g,'');
    switch(format) {
            
            default:
                awField.value = awnum;
                break;
        }
	if(awnum.length <= 2) {
        //Alert the user that the phone number entered was invalid.
        //alert('Die eingegebene Nummer ist zu kurz');                    
    } else {
        //Email was valid.  If format type is set, format the Phone to the desired style.
       
    }
}

function CheckLength()
{
var msg_area = document.getElementById("Message");
msg_area.innerHTML = "";
if (document.getElementById("password1").value.length < 4) {
msg_area.innerHTML = "Mit einem * gekennzeichnete Felder sind Pflichtfelder. Bitte f&uuml;llen Sie diese vollst&auml;ndig aus.<br />- Ihr Kennwort muss aus mindestens 4 Zeichen bestehen.";
return false;
}
else if (document.getElementById("users__first_name").value.length < 2) {
msg_area.innerHTML = "Mit einem * gekennzeichnete Felder sind Pflichtfelder. Bitte f&uuml;llen Sie diese vollst&auml;ndig aus.<br />- Vorname und Nachname m&uuml;ssen aus mindestens 2 Zeichen bestehen.";
return false;
}
else if (document.getElementById("users__last_name").value.length < 2) {
msg_area.innerHTML = "Mit einem * gekennzeichnete Felder sind Pflichtfelder. Bitte f&uuml;llen Sie diese vollst&auml;ndig aus.<br />- Vorname und Nachname m&uuml;ssen aus mindestens 2 Zeichen bestehen.";
return false;
}

 return true;
}

function setcontact(){

if(document.getElementById('users__email').value.length == 0){
setTextOfTextfield('communication_type','','0');
	}
else {
setTextOfTextfield('communication_type','','1');
}

}


function toggleMe(a){
  var e=document.getElementById(a);
  if(!e)return true;
  if(e.style.display=="none"){
    e.style.display="block"
  } else {
    e.style.display="none"
  }
  return true;
}

function toggleMe2(a){
  var e=document.getElementById(a);
  if(!e)return true;
  if(e.style.display=="none"){
    e.style.display="none"
  } else {
    e.style.display="none"
  }
  return true;
}

function toggleMe3(a){
  var e=document.getElementById(a);
  if(!e)return true;
  if(e.style.display=="block"){
    e.style.display="none"
  } else {
    e.style.display="none"
  }
  return true;
}

function toggleMe4(a){
  var e=document.getElementById(a);
  if(!e)return true;
  if(e.style.display=="none"){
    e.style.display="block"
  } else {
    e.style.display="block"
  }
  return true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/* Altersabfrage   */

function checkCheckBox(f){

var dob=new Date();
var date=dob.getDate();
var month=dob.getMonth() + 1;
var year=dob.getFullYear();

var birthmonth=parseInt(document.getElementById("birthmonth").options[document.getElementById("birthmonth").selectedIndex].value);
var birthday=parseInt(document.getElementById("birthday").options[document.getElementById("birthday").selectedIndex].value);
var birthyear=parseInt(document.getElementById("birthyear").options[document.getElementById("birthyear").selectedIndex].value);

age=year-birthyear;

if(birthmonth>month){age--;}

else{if(birthmonth==month && birthday>=date){age--;}}

if(birthmonth==0){return true;}
else if(birthday==0){return true;}
else if(birthyear==2005){return true;}
else if(age<18){
if(age<16){return true;}
else if(!document.getElementById("agree").checked){
	setTextOfLayer('error','','Die Einwilligung meines Erziehungsberechtigten zum Abschluss dieses Vertrages liegt vor. Zur Best&auml;tigung der Einwilligung werde ich diese innerhalb von 2 Wochen nach Absendung meiner Bestellung mit folgendem <a href="http://www.fonic.de/html/pdf/FONIC-EinwilligungErziehungsberechtigter.pdf" target="_blank" onclick="unica_download (this,\'FONIC-EinwilligungErziehungsberechtigter\',\'pdf\');">Formular</a> schriftlich nachreichen. Das Vertragsverh&auml;ltnis mit FONIC steht unter der Bedingung, dass die schriftliche Best&auml;tigung fristgerecht nachgereicht wird. Andernfalls ist FONIC berechtigt, das Vertragsverh&auml;ltnis zu beenden.');showHideLayers('error','','show');showHideLayers('16check','','show');
;return false;
}

}

}

function checkAgeCheckBox(f){

var dob=new Date();
var date=dob.getDate();
var month=dob.getMonth() + 1;
var year=dob.getFullYear();

var birthmonth=parseInt(document.getElementById("birthmonth").options[document.getElementById("birthmonth").selectedIndex].value);
var birthday=parseInt(document.getElementById("birthday").options[document.getElementById("birthday").selectedIndex].value);
var birthyear=parseInt(document.getElementById("birthyear").options[document.getElementById("birthyear").selectedIndex].value);

age=year-birthyear;

if(birthmonth>month){age--;}

else{if(birthmonth==month && birthday>=date){age--;}}

if(birthmonth==0){return false;}
else if(birthday==0){return false;}
else if(birthyear==2005){return false;}
else if(age<18){
if(age<16){
	setTextOfLayer('error','','Wenn Sie unter 16 Jahre alt sind, ist es nicht m&ouml;lich, diesen Dienst zu bestellen.');
	showHideLayers('16check','','hide');showHideLayers('error','','show');
	
;return false;}
else
	setTextOfLayer('error','','Die Einwilligung meines Erziehungsberechtigten zum Abschluss dieses Vertrages liegt vor. Zur Best&auml;tigung der Einwilligung werde ich diese innerhalb von 2 Wochen nach Absendung meiner Bestellung mit folgendem <a href="http://www.fonic.de/html/pdf/FONIC-EinwilligungErziehungsberechtigter.pdf" target="_blank" onclick="unica_download (this,\'FONIC-EinwilligungErziehungsberechtigter\',\'pdf\');">Formular</a> schriftlich nachreichen. Das Vertragsverh&auml;ltnis mit FONIC steht unter der Bedingung, dass die schriftliche Best&auml;tigung fristgerecht nachgereicht wird. Andernfalls ist FONIC berechtigt, das Vertragsverh&auml;ltnis zu beenden.');showHideLayers('16check','','show');showHideLayers('error','','show');
	
	return false;
}

else{
setTextOfLayer('error','','');showHideLayers('error','','hide');showHideLayers('16check','','hide')

return true;}

}

function showHideLayers() { //v9.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}

function setTextOfLayer(objId,x,newText) { //v9.0
  with (document) if (getElementById && ((obj=getElementById(objId))!=null))
    with (obj) innerHTML = unescape(newText);
}



function setTextOfTextfield(objId,x,newText) { //v9.0

  with (document){ if (getElementById){

    var obj = getElementById(objId);} if (obj) obj.value = newText;

  }

}


function getUrlVars()
{
    var vars = [], hash;
var hashes = window.location.href.split('/');
//alert(hashes.length);
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i];
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }

if (hashes[5]=="SavePersonalInfo")
{
checkAgeCheckBox(this)
document.getElementById('agree').checked = true
//alert("is-so");
}
    return vars;

}


var currentItem = "link_1";
 function Navigation(Id) {
	
	var CssClassActive = "faq-subnav-aktiv";
	var CssCLassInactive = "faq-subnav";
	
	// Altem Item inaktive Klasse zuweisen
	if(currentItem != "") {
	   document.getElementById(currentItem).className = CssCLassInactive;
	}
	
	// Neuem Item aktive Klasse zuweisen
	document.getElementById(Id).className = CssClassActive;
	
	// Neues Item merken
	currentItem = Id;
	
	//unica Event Tracking
	
	if (ntptEventTag) {
		ntptEventTag("faq_nr="+Id);
		}
	
	
 }
 
 function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}


function limitTextp(limitFieldp, limitCountp, limitNump) {
	if (limitFieldp.value.length >= limitNump) {
		//limitField.value = limitField.value.substring(0, limitNum);
		mySwf.Play(); 
		limitFieldp.style.borderColor = '#cc0000';
		
		setTextOfLayer('textf','','Ihr Passwort hat die maximale L&auml;nge von 10 Zeichen erreicht!<br/><br/>');
		
	} else {
		limitCountp.value = limitNump - limitFieldp.value.length;
		setTextOfLayer('textf','','');
		limitFieldp.style.borderColor = '#999999';
		
	}
}

/*
	Header Information------------------------------------[Do Not Remove This Header]--
	Title: OO Dom Image Rollover
	Description: This script makes it easy to add rollover/ mousedown 
  	effects to any image on the page, including image submit buttons. Automatically 
  	preloads images as well. Script works in all DOM capable browsers- IE5+, NS6+, 
  	Opera7+.
	
	Legal: Copyright 2005 Adam Smith
	Author Email Address: ibulwark@hotmail.com
	Date Created: June 6, 2005
	Website: Codevendor.com | eBadgeman.com
	Script featured on Dynamic Drive: http://www.dynamicdrive.com
	-----------------------------------------------------------------------------------
*/

function imageholderclass(){
	this.over=new Array();
	this.down=new Array();
	this.src=new Array();
	this.store=store;
	
	function store(src, down, over){
		var AL=this.src.length;
		this.src[AL]=new Image(); this.src[AL].src=src;
		this.over[AL]=new Image(); this.over[AL].src=over;
		this.down[AL]=new Image(); this.down[AL].src=down;
	}
}

var ih = new imageholderclass();
var mouseisdown=0;

function preloader(t){
	for(i=0;i<t.length;i++){
		if(t[i].getAttribute('srcover')||t[i].getAttribute('srcdown')){
			
			storeimages(t[i]);
			var checker='';
			checker=(t[i].getAttribute('srcover'))?checker+'A':checker+'';
			checker=(t[i].getAttribute('srcdown'))?checker+'B':checker+'';
			
			switch(checker){
			case 'A' : mouseover(t[i]);mouseout(t[i]); break;
			case 'B' : mousedown(t[i]); mouseup2(t[i]); break;
			case 'AB' : mouseover(t[i]);mouseout(t[i]); mousedown(t[i]); mouseup(t[i]); break;
			default : return;			
			}
			
			if(t[i].src){t[i].setAttribute("oldsrc",t[i].src);}
		}
	}
}
function mouseup(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");this.oldmouseup();}

	}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");}}
	t.onmouseup=newmouseup;
}

function mouseup2(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");this.oldmouseup();}
		}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");}}
	t.onmouseup = newmouseup;
}

function mousedown(t){
	var newmousedown;
	if(t.onmousedown){
		t.oldmousedown=t.onmousedown;
		newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");this.oldmousedown();}}
	}
	else{newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");}}}
	t.onmousedown=newmousedown;
}

function mouseover(t){
	var newmouseover;
	if(t.onmouseover){
		t.oldmouseover=t.onmouseover;
		newmouseover=function(){this.src=this.getAttribute("srcover");this.oldmouseover();}
	}
	else{newmouseover=function(){this.src=this.getAttribute("srcover");}}
	t.onmouseover=newmouseover;
}

function mouseout(t){
	var newmouseout;
	if(t.onmouseout){
		t.oldmouseout=t.onmouseout;
		newmouseout=function(){this.src=this.getAttribute("oldsrc");this.oldmouseout();}
	}
	else{newmouseout=function(){this.src=this.getAttribute("oldsrc");}}
	t.onmouseout=newmouseout;
}

function storeimages(t){
	var s=(t.getAttribute('src'))?t.getAttribute('src'):'';
	var d=(t.getAttribute('srcdown'))?t.getAttribute('srcdown'):'';
	var o=(t.getAttribute('srcover'))?t.getAttribute('srcover'):'';
	ih.store(s,d,o);
}

function preloadimgsrc(){
	if(!document.getElementById) return;
	var it=document.getElementsByTagName('IMG');
	var it2=document.getElementsByTagName('INPUT');
	preloader(it);
	preloader(it2);
}
/*
		if(window.addEventListener){window.addEventListener("load", preloadimgsrc, false);} 
		else{
			if(window.attachEvent){window.attachEvent("onload", preloadimgsrc);}
			else{if(document.getElementById){window.onload=preloadimgsrc;}}
		}
*/

$(document).ready(function() {
	if(document.getElementById("BillingGroupUsage")==null) {
		preloadimgsrc();

	}
});

////
// settings
var wing_cookiename='fonic_customer';
var wing_removeCookie =365;
var wing_default_customer=false;
var wing_customer=false;
//settings

var wing_ablauf = new Date();
var wing_deletecookiein= wing_ablauf.getTime() + (wing_removeCookie * 24 * 60 * 60 * 1000);
wing_ablauf.setTime(wing_deletecookiein);


function wing_readcookie2(read_cookie) {
	if (document.cookie) {
		var wing_cookie = document.cookie;
		var wing_ac=wing_cookie.split("; ");
		for (var i=0;i<wing_ac.length;i++) {
			var wing_tmp=wing_ac[i].split("=");
			var wing_wert=wing_tmp[0];
			var wing_val=wing_tmp[1];
			if (wing_wert==read_cookie) {
				return wing_val;
			}
		}
		return "NULL";
	} else {
		return "NULL";
	}
}

function wing_costumer_write_cookie() {
	if (wing_readcookie2(wing_cookiename)=="true") {
		document.cookie = wing_cookiename+"=true; expires=" + wing_ablauf.toGMTString()+"; path=/";
	} else {
		document.cookie = wing_cookiename+"="+wing_customer+"; expires=" + wing_ablauf.toGMTString()+"; path=/";
	}
}


function wing_write_iframe() {
	if (wing_readcookie2(wing_cookiename)=="NULL" || wing_readcookie2(wing_cookiename)=="false") {
		//kein kunde
		//iframe
		document.write('<ifr'+'ame width="1" height="1" scrolling="no" frameborder="0" src="/html/dat/nocustomer.htm"></ifr'+'ame>');
	} else {
		//ein kunde
		//iframe
		document.write('<ifr'+'ame width="1" height="1" scrolling="no" frameborder="0" src="/html/dat/customer.htm"></ifr'+'ame>');
	}
}

function unica_download(ref, download_name, download_type) {
   
   ntptAddPair( "download_name", download_name );
   ntptAddPair( "download_type", download_type );
  
   setTimeout( function(){ntptEventTag("ev=download" )},1000);
   
}

function unica_link(ref, download_name,extra) {
	   
	ntptAddPair( "linkname", download_name );
	if (extra)
		ntptAddPair( "parameter", extra );
	setTimeout( function(){ntptEventTag("ev=link" )},1000);
	 
	}


function handleWindow(_8,_9,_a,_b,_c,x,y,_f,_10,_11){
	if(_9!=null&&_9=="1"){
		if((top.opener!=null)&&(typeof top.opener.closed=="boolean")&&(!top.opener.closed)){
			top.opener.location.href=_8;
			if(_b!=null&&_b=="1"){
				top.opener.focus();
			}
			if(_a!=null&&_a=="1"){
				top.close();
			}
		}else{
			openWindow(_8);
			if(_a!=null&&_a=="1"){
				top.close();
			}
		}
	}else{
		if(_c!=null||_11!=null){
			openWindow(_8,_c,x,y,_f,_10,_11);
			if(_a!=null&&_a=="1"){
				top.close();
			}
		}else{
			window.location.href=_8;
		}
	}
};
function openWindow(url,_5c,x,y,_5f,_60,_61){
	if(_5c!=null){
		_5c=_5c.replace(/ /g,"");
	}
	if(!isNaN(x)&&x>0){
		_61+=",left="+x;
	}
	if(!isNaN(y)&&y>0){
		_61+=",top="+y;
	}
	if(!isNaN(_5f)&&_5f>0){
		_61+=",width="+_5f;
	}
	if(!isNaN(_60)&&_60>0){
		_61+=",height="+_60;
	}
	if(_61!=null&&_61.charAt(0)==","){
		_61=_61.substring(1);
	}
	var win=window.open(url,_5c,_61);
	if(win){
		win.focus();
	}
};
//jQ:THICKBOX

/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
		  
var tb_pathToImage = "https://www.fonic.de/html/dat/loadingAnimation.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
(function($)
{$(document).ready(function(){   
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	$(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			$("body","html").css({height: "100%", width: "100%"});
			$("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			$("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		$('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }
	   
	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
				
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = $("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Schliessen'>Schliessen</a></div>"); 		
			
			$("#TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				$("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				$("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			$("#TB_load").remove();
			$("#TB_ImageOff").click(tb_remove);
			$("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;
			
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					$("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Schliessen'>Schliessen</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					$("#TB_overlay").unbind();
						$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if($("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>Schliessen</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						$("#TB_overlay").unbind();
						$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						$("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						$("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						$("#TB_ajaxContent")[0].scrollTop = 0;
						$("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			$("#TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					$("#TB_ajaxContent").append($('#' + params['inlineId']).children());
					$("#TB_window").unload(function () {
						$('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					$("#TB_load").remove();
					$("#TB_window").css({display:"block"}); 
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if($.browser.safari){//safari needs help because it will not fire iframe onload
						$("#TB_load").remove();
						$("#TB_window").css({display:"block"});
					}
				}else{
					$("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						$("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						$("#TB_window").css({display:"block"});
					});
				}
			
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
}
} )(jQuery);

//helper functions below
function tb_showIframe(){
	$("#TB_load").remove();
	$("#TB_window").css({display:"block"});
}

function tb_remove() {
 	$("#TB_imageOff").unbind("click");
	$("#TB_closeWindowButton").unbind("click");
	$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	$("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}



//COOKIE

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
(function ($) {
    var m = {
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        },
        s = {
            'array': function (x) {
                var a = ['['], b, f, i, l = x.length, v;
                for (i = 0; i < l; i += 1) {
                    v = x[i];
                    f = s[typeof v];
                    if (f) {
                        v = f(v);
                        if (typeof v == 'string') {
                            if (b) {
                                a[a.length] = ',';
                            }
                            a[a.length] = v;
                            b = true;
                        }
                    }
                }
                a[a.length] = ']';
                return a.join('');
            },
            'boolean': function (x) {
                return String(x);
            },
            'null': function (x) {
                return "null";
            },
            'number': function (x) {
                return isFinite(x) ? String(x) : 'null';
            },
            'object': function (x) {
                if (x) {
                    if (x instanceof Array) {
                        return s.array(x);
                    }
                    var a = ['{'], b, f, i, v;
                    for (i in x) {
                        v = x[i];
                        f = s[typeof v];
                        if (f) {
                            v = f(v);
                            if (typeof v == 'string') {
                                if (b) {
                                    a[a.length] = ',';
                                }
                                a.push(s.string(i), ':', v);
                                b = true;
                            }
                        }
                    }
                    a[a.length] = '}';
                    return a.join('');
                }
                return 'null';
            },
            'string': function (x) {
                if (/["\\\x00-\x1f]/.test(x)) {
                    x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
                        var c = m[b];
                        if (c) {
                            return c;
                        }
                        c = b.charCodeAt();
                        return '\\u00' +
                            Math.floor(c / 16).toString(16) +
                            (c % 16).toString(16);
                    });
                }
                return '"' + x + '"';
            }
        };

	$.toJSON = function(v) {
		var f = isNaN(v) ? s[typeof v] : s['number'];
		if (f) return f(v);
	};
	
	$.parseJSON = function(v, safe) {
		if (safe === undefined) safe = $.parseJSON.safe;
		if (safe && !/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(v))
			return undefined;
		return eval('('+v+')');
	};
	
	$.parseJSON.safe = false;

})(jQuery);

//jQ:CAROUSEL

/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(i){var q={vertical:false,rtl:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null, itemFallbackDimension:null},r=false;i(window).bind("load.jcarousel",function(){r=true});i.jcarousel=function(a,c){this.options=i.extend({},q,c||{});this.autoStopped=this.locked=false;this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;if(!c||c.rtl===undefined)this.options.rtl=(i(a).attr("dir")||i("html").attr("dir")||"").toLowerCase()=="rtl";this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical?this.options.rtl? "right":"left":"top";for(var b="",d=a.className.split(" "),f=0;f<d.length;f++)if(d[f].indexOf("jcarousel-skin")!=-1){i(a).removeClass(d[f]);b=d[f];break}if(a.nodeName.toUpperCase()=="UL"||a.nodeName.toUpperCase()=="OL"){this.list=i(a);this.container=this.list.parent();if(this.container.hasClass("jcarousel-clip")){if(!this.container.parent().hasClass("jcarousel-container"))this.container=this.container.wrap("<div></div>");this.container=this.container.parent()}else if(!this.container.hasClass("jcarousel-container"))this.container= this.list.wrap("<div></div>").parent()}else{this.container=i(a);this.list=this.container.find("ul,ol").eq(0)}b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass("jcarousel-clip"))this.clip=this.list.wrap("<div></div>").parent();this.buttonNext=i(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext= this.clip.after(this.options.buttonNextHTML).next();this.buttonNext.addClass(this.className("jcarousel-next"));this.buttonPrev=i(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next();this.buttonPrev.addClass(this.className("jcarousel-prev"));this.clip.addClass(this.className("jcarousel-clip")).css({overflow:"hidden",position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden", position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"});!this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var j=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;b=this.list.children("li");var e=this;if(b.size()>0){var g=0,k=this.options.offset;b.each(function(){e.format(this,k++);g+=e.dimension(this, j)});this.list.css(this.wh,g+100+"px");if(!c||c.size===undefined)this.options.size=b.size()}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display","block");this.funcNext=function(){e.next()};this.funcPrev=function(){e.prev()};this.funcResize=function(){e.reload()};this.options.initCallback!==null&&this.options.initCallback(this,"init");if(!r&&i.browser.safari){this.buttons(false,false);i(window).bind("load.jcarousel",function(){e.setup()})}else this.setup()}; var h=i.jcarousel;h.fn=h.prototype={jcarousel:"0.2.7"};h.fn.extend=h.extend=i.extend;h.fn.extend({setup:function(){this.prevLast=this.prevFirst=this.last=this.first=null;this.animating=false;this.tail=this.timer=null;this.inTail=false;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var a=this.pos(this.options.start,true);this.prevFirst=this.prevLast=null;this.animate(a,false);i(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize)}}, reset:function(){this.list.empty();this.list.css(this.lt,"0px");this.list.css(this.wh,"10px");this.options.initCallback!==null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!==null&&this.inTail&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;this.options.reloadCallback!==null&&this.options.reloadCallback(this);if(this.options.visible!==null){var a=this,c=Math.ceil(this.clipping()/this.options.visible),b=0,d=0; this.list.children("li").each(function(f){b+=a.dimension(this,c);if(f+1<a.first)d=b});this.list.css(this.wh,b+"px");this.list.css(this.lt,-d+"px")}this.scroll(this.first,false)},lock:function(){this.locked=true;this.buttons()},unlock:function(){this.locked=false;this.buttons()},size:function(a){if(a!==undefined){this.options.size=a;this.locked||this.buttons()}return this.options.size},has:function(a,c){if(c===undefined||!c)c=a;if(this.options.size!==null&&c>this.options.size)c=this.options.size;for(var b= a;b<=c;b++){var d=this.get(b);if(!d.length||d.hasClass("jcarousel-item-placeholder"))return false}return true},get:function(a){return i(".jcarousel-item-"+a,this.list)},add:function(a,c){var b=this.get(a),d=0,f=i(c);if(b.length===0){var j,e=h.intval(a);for(b=this.create(a);;){j=this.get(--e);if(e<=0||j.length){e<=0?this.list.prepend(b):j.after(b);break}}}else d=this.dimension(b);if(f.get(0).nodeName.toUpperCase()=="LI"){b.replaceWith(f);b=f}else b.empty().append(c);this.format(b.removeClass(this.className("jcarousel-item-placeholder")), a);f=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;d=this.dimension(b,f)-d;a>0&&a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))-d+"px");this.list.css(this.wh,h.intval(this.list.css(this.wh))+d+"px");return b},remove:function(a){var c=this.get(a);if(!(!c.length||a>=this.first&&a<=this.last)){var b=this.dimension(c);a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+b+"px");c.remove();this.list.css(this.wh,h.intval(this.list.css(this.wh))- b+"px")}},next:function(){this.tail!==null&&!this.inTail?this.scrollTail(false):this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.tail!==null&&this.inTail?this.scrollTail(true):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(a){if(!(this.locked|| this.animating||!this.tail)){this.pauseAuto();var c=h.intval(this.list.css(this.lt));c=!a?c-this.tail:c+this.tail;this.inTail=!a;this.prevFirst=this.first;this.prevLast=this.last;this.animate(c)}},scroll:function(a,c){if(!(this.locked||this.animating)){this.pauseAuto();this.animate(this.pos(a),c)}},pos:function(a,c){var b=h.intval(this.list.css(this.lt));if(this.locked||this.animating)return b;if(this.options.wrap!="circular")a=a<1?1:this.options.size&&a>this.options.size?this.options.size:a;for(var d= this.first>a,f=this.options.wrap!="circular"&&this.first<=1?1:this.first,j=d?this.get(f):this.get(this.last),e=d?f:f-1,g=null,k=0,l=false,m=0;d?--e>=a:++e<a;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g=this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(l)k+= m;if(this.first!==null&&(this.options.wrap=="circular"||e>=1&&(this.options.size===null||e<=this.options.size)))b=d?b+m:b-m}f=this.clipping();var p=[],o=0,n=0;j=this.get(a-1);for(e=a;++o;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j.length===0?this.list.prepend(g):j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g= this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(m===0)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...");if(this.options.wrap!="circular"&&this.options.size!==null&&e>this.options.size)p.push(g);else if(l)k+=m;n+=m;if(n>=f)break;e++}for(g=0;g<p.length;g++)p[g].remove();if(k>0){this.list.css(this.wh,this.dimension(this.list)+k+"px");if(d){b-=k;this.list.css(this.lt,h.intval(this.list.css(this.lt))-k+"px")}}k=a+o-1;if(this.options.wrap!="circular"&& this.options.size&&k>this.options.size)k=this.options.size;if(e>k){o=0;e=k;for(n=0;++o;){g=this.get(e--);if(!g.length)break;n+=this.dimension(g);if(n>=f)break}}e=k-o+1;if(this.options.wrap!="circular"&&e<1)e=1;if(this.inTail&&d){b+=this.tail;this.inTail=false}this.tail=null;if(this.options.wrap!="circular"&&k==this.options.size&&k-o+1>=1){d=h.margin(this.get(k),!this.options.vertical?"marginRight":"marginBottom");if(n-d>f)this.tail=n-f-d}if(c&&a===this.options.size&&this.tail){b-=this.tail;this.inTail= true}for(;a-- >e;)b+=this.dimension(this.get(a));this.prevFirst=this.first;this.prevLast=this.last;this.first=e;this.last=k;return b},animate:function(a,c){if(!(this.locked||this.animating)){this.animating=true;var b=this,d=function(){b.animating=false;a===0&&b.list.css(b.lt,0);if(!b.autoStopped&&(b.options.wrap=="circular"||b.options.wrap=="both"||b.options.wrap=="last"||b.options.size===null||b.last<b.options.size||b.last==b.options.size&&b.tail!==null&&!b.inTail))b.startAuto();b.buttons();b.notify("onAfterAnimation"); if(b.options.wrap=="circular"&&b.options.size!==null)for(var f=b.prevFirst;f<=b.prevLast;f++)if(f!==null&&!(f>=b.first&&f<=b.last)&&(f<1||f>b.options.size))b.remove(f)};this.notify("onBeforeAnimation");if(!this.options.animation||c===false){this.list.css(this.lt,a+"px");d()}else this.list.animate(!this.options.vertical?this.options.rtl?{right:a}:{left:a}:{top:a},this.options.animation,this.options.easing,d)}},startAuto:function(a){if(a!==undefined)this.options.auto=a;if(this.options.auto===0)return this.stopAuto(); if(this.timer===null){this.autoStopped=false;var c=this;this.timer=window.setTimeout(function(){c.next()},this.options.auto*1E3)}},stopAuto:function(){this.pauseAuto();this.autoStopped=true},pauseAuto:function(){if(this.timer!==null){window.clearTimeout(this.timer);this.timer=null}},buttons:function(a,c){if(a==null){a=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap== "first")&&this.options.size!==null&&this.last>=this.options.size)a=this.tail!==null&&!this.inTail}if(c==null){c=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1)c=this.tail!==null&&this.inTail}var b=this;if(this.buttonNext.size()>0){this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext);a&&this.buttonNext.bind(this.options.buttonNextEvent+ ".jcarousel",this.funcNext);this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?false:true);this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){b.options.buttonNextCallback(b,this,a)}).data("jcarouselstate",a)}else this.options.buttonNextCallback!==null&&this.buttonNextState!=a&&this.options.buttonNextCallback(b,null,a);if(this.buttonPrev.size()>0){this.buttonPrev.unbind(this.options.buttonPrevEvent+ ".jcarousel",this.funcPrev);c&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev);this.buttonPrev[c?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",c?false:true);this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=c&&this.buttonPrev.each(function(){b.options.buttonPrevCallback(b,this,c)}).data("jcarouselstate",c)}else this.options.buttonPrevCallback!==null&&this.buttonPrevState!=c&&this.options.buttonPrevCallback(b, null,c);this.buttonNextState=a;this.buttonPrevState=c},notify:function(a){var c=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",a,c);if(this.prevFirst!==this.first){this.callback("itemFirstInCallback",a,c,this.first);this.callback("itemFirstOutCallback",a,c,this.prevFirst)}if(this.prevLast!==this.last){this.callback("itemLastInCallback",a,c,this.last);this.callback("itemLastOutCallback",a,c,this.prevLast)}this.callback("itemVisibleInCallback", a,c,this.first,this.last,this.prevFirst,this.prevLast);this.callback("itemVisibleOutCallback",a,c,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(a,c,b,d,f,j,e){if(!(this.options[a]==null||typeof this.options[a]!="object"&&c!="onAfterAnimation")){var g=typeof this.options[a]=="object"?this.options[a][c]:this.options[a];if(i.isFunction(g)){var k=this;if(d===undefined)g(k,b,c);else if(f===undefined)this.get(d).each(function(){g(k,this,d,b,c)});else{a=function(m){k.get(m).each(function(){g(k, this,m,b,c)})};for(var l=d;l<=f;l++)l!==null&&!(l>=j&&l<=e)&&a(l)}}}},create:function(a){return this.format("<li></li>",a)},format:function(a,c){a=i(a);for(var b=a.get(0).className.split(" "),d=0;d<b.length;d++)b[d].indexOf("jcarousel-")!=-1&&a.removeClass(b[d]);a.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",c);return a},className:function(a){return a+" "+a+(!this.options.vertical? "-horizontal":"-vertical")},dimension:function(a,c){var b=a.jquery!==undefined?a[0]:a,d=!this.options.vertical?(b.offsetWidth||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginLeft")+h.margin(b,"marginRight"):(b.offsetHeight||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginTop")+h.margin(b,"marginBottom");if(c==null||d==c)return d;d=!this.options.vertical?c-h.margin(b,"marginLeft")-h.margin(b,"marginRight"):c-h.margin(b,"marginTop")-h.margin(b,"marginBottom");i(b).css(this.wh, d+"px");return this.dimension(b)},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-h.intval(this.clip.css("borderLeftWidth"))-h.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-h.intval(this.clip.css("borderTopWidth"))-h.intval(this.clip.css("borderBottomWidth"))},index:function(a,c){if(c==null)c=this.options.size;return Math.round(((a-1)/c-Math.floor((a-1)/c))*c)+1}});h.extend({defaults:function(a){return i.extend(q,a||{})},margin:function(a,c){if(!a)return 0; var b=a.jquery!==undefined?a[0]:a;if(c=="marginRight"&&i.browser.safari){var d={display:"block","float":"none",width:"auto"},f,j;i.swap(b,d,function(){f=b.offsetWidth});d.marginRight=0;i.swap(b,d,function(){j=b.offsetWidth});return j-f}return h.intval(i.css(b,c))},intval:function(a){a=parseInt(a,10);return isNaN(a)?0:a}});i.fn.jcarousel=function(a){if(typeof a=="string"){var c=i(this).data("jcarousel"),b=Array.prototype.slice.call(arguments,1);return c[a].apply(c,b)}else return this.each(function(){i(this).data("jcarousel", new h(this,a))})}})(jQuery);

//jQ:TIMERS
/**
 * jQuery.timers - Timer abstractions for jQuery
 * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 2009/10/16
 *
 * @author Blair Mitchelmore
 * @version 1.2
 *
 **/

jQuery.fn.extend({
	everyTime: function(interval, label, fn, times) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, times);
		});
	},
	oneTime: function(interval, label, fn) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, 1);
		});
	},
	stopTime: function(label, fn) {
		return this.each(function() {
			jQuery.timer.remove(this, label, fn);
		});
	}
});

jQuery.extend({
	timer: {
		global: [],
		guid: 1,
		dataKey: "jQuery.timer",
		regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
		powers: {
			// Yeah this is major overkill...
			'ms': 1,
			'cs': 10,
			'ds': 100,
			's': 1000,
			'das': 10000,
			'hs': 100000,
			'ks': 1000000
		},
		timeParse: function(value) {
			if (value == undefined || value == null)
				return null;
			var result = this.regex.exec(jQuery.trim(value.toString()));
			if (result[2]) {
				var num = parseFloat(result[1]);
				var mult = this.powers[result[2]] || 1;
				return num * mult;
			} else {
				return value;
			}
		},
		add: function(element, interval, label, fn, times) {
			var counter = 0;
			
			if (jQuery.isFunction(label)) {
				if (!times) 
					times = fn;
				fn = label;
				label = interval;
			}
			
			interval = jQuery.timer.timeParse(interval);

			if (typeof interval != 'number' || isNaN(interval) || interval < 0)
				return;

			if (typeof times != 'number' || isNaN(times) || times < 0) 
				times = 0;
			
			times = times || 0;
			
			var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});
			
			if (!timers[label])
				timers[label] = {};
			
			fn.timerID = fn.timerID || this.guid++;
			
			var handler = function() {
				if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
					jQuery.timer.remove(element, label, fn);
			};
			
			handler.timerID = fn.timerID;
			
			if (!timers[label][fn.timerID])
				timers[label][fn.timerID] = window.setInterval(handler,interval);
			
			this.global.push( element );
			
		},
		remove: function(element, label, fn) {
			var timers = jQuery.data(element, this.dataKey), ret;
			
			if ( timers ) {
				
				if (!label) {
					for ( label in timers )
						this.remove(element, label, fn);
				} else if ( timers[label] ) {
					if ( fn ) {
						if ( fn.timerID ) {
							window.clearInterval(timers[label][fn.timerID]);
							delete timers[label][fn.timerID];
						}
					} else {
						for ( var fn in timers[label] ) {
							window.clearInterval(timers[label][fn]);
							delete timers[label][fn];
						}
					}
					
					for ( ret in timers[label] ) break;
					if ( !ret ) {
						ret = null;
						delete timers[label];
					}
				}
				
				for ( ret in timers ) break;
				if ( !ret ) 
					jQuery.removeData(element, this.dataKey);
			}
		}
	}
});

jQuery(window).bind("unload", function() {
	jQuery.each(jQuery.timer.global, function(index, item) {
		jQuery.timer.remove(item);
	});
});

//SEGMENT
var fuser = {
		 _cookieName:"fncseg",
		 _cookieOptions: {expires:365,path:"/"},
		 _defaultData:{current:{last:null,type:"p"}},
		 _data: this._defaultData,
		 _loggedInURLs:  ["/servlet/"],
		 _ignoreURLs:    ["/servlet/ContactMail",
		                  "/servlet/ConfirmContactMail",
		                  "/servlet/PasswordForgotten",
		                  "/servlet/Loginbox"],
		                  
		 _loggedOutURLs: ["/servlet/TypePersonalInfo",
		                  "/servlet/Start",
		 				  "/servlet/SignupPayment",
		 				  "/servlet/SignupDirectDebit",
		 				  "/servlet/SaveBankInfoOnline",
		                  "/servlet/SignupPaymentOnline",
		                  "/servlet/LicenseOnline",
		                  "/servlet/License",
		                  "/servlet/CompleteSignup",
		                  "/servlet/PrintSignupInfo",
		                  "/servlet/ActivationInfo",
		                  "/servlet/CheckActivationInfo",
		                  "/servlet/Login"
		                  ],
		 _urlParams:[],
		 matchesURL: function (urls)
		 {
			 var matches=false;
			 var path = window.location.pathname;
			 jQuery(urls).each(
					 function(){
						if (path.lastIndexOf(this)!=-1)
						{
							matches=true;
							return false;
						}
					 });
			 
			 return matches;
		 },
		  encstr:function (str)
		 {
		 	xor_key=7;
		 	var the_res="";
		 	for(i=0;i<str.length;++i)
		 	{
		 		the_res+=String.fromCharCode(xor_key^str.charCodeAt(i));
		 	}
		 	return the_res;
		 },
		 decstr:function (str) 
		 {
			
				var xor_key=7;
				var the_res="";
				for(i=0;i<str.length;i++)
				{
					the_res+=String.fromCharCode(xor_key^str.charCodeAt(i));
				}
		 return the_res;	
		 },


         serialize : function (_obj)  
         {		
			  return $.toJSON(_obj);
        	   
			  
        	},
        	getCookie: function ()
        	{
				cookie=jQuery.cookie(this._cookieName);
				
				if (cookie!=null)
				{
					this._data=eval("("+this.decstr(cookie)+")");
				}
        	},
        	setCookie: function ()
        	{
        		jQuery.cookie(this._cookieName,this.encstr(this.serialize(this._data)),this._cookieOptions);
        		
        	},
		   setCustomer:function (ms)
		   {
        		date = new Date();
        		this.getCookie();
        		if (ms==null)
        		{
        			ms=this._data.current.m;
        		}
        		this._data.current={type:"c", last: date.getTime(), m:ms, session:date.getTime()};
        		this.setCookie();
		   },
		   setProspect:function (ms)
		   {
        		date = new Date();
        		this.getCookie();
        		this._data.current={type:"p", last: date.getTime(), m:ms};
        		this.setCookie();
		   },
		   updateHistory:function (key,val)
		   {
			   this.getCookie();
			   if (!this._data.history)
				   this._data.history={};
			   if (!this._data.history[this._data.current.m])
				   this._data.history[this._data.current.m]={};
			   this._data.history[this._data.current.m][key]=val;
			   this.setCookie();
		   },
		   unsetHistory:function(key,undefined_msisdn)
		   {
			   this.getCookie();
			   if (!this._data.history)
				   return;
			   msisdn=this._data.current.m;
			   if (undefined_msisdn)
				   msisdn="undefined"
			   if (!this._data.history[msisdn]) 
				   return;
			   delete (this._data.history[msisdn][key]);
			   this.setCookie();
		   }
		   ,
		   setPreCustomer:function (p)
		   {
        		date = new Date();
        		this.getCookie();
        		this._data.current={type:"pc", last: date.getTime(), pak:p};
        		this.setCookie();
		   },
		   hasSession:function()
		   {
			   if (this._data.current.session==null)
			   {
				   return false;
			   }
			   date= new Date();
			   if (date.getTime() < this._data.current.session + 600000 ) 
			   {
				   return true;
			   }
			   return false;
		   },
		   setSession: function()
		   {
			   
		   },
		   clearSession: function()
		   {
			   this._data.current.session=null;
			   this.setCookie();
			   },
		   checkCustomer: function()
		   {
			   this.getCookie();
			   if (this._data==null) this._data=this._defaultData;
			   if (this._data.current.last==null || this._data.current.last==undefined)
			   {   
				   
				   date = new Date();
				   this._data.current.last=date.getTime();
				  		  
				   this.setCookie();
			   }
			   this.trackCustomer();
			   return this._data.current;
		   },
		   trackCustomer: function ()
		   {
			  
			   if (typeof ntptAddPair == "function")
			   {	   
			   ntptAddPair( "type",  this._data.current.type);
			   ntptEventTag( "ev=segment" );
			   }
		   },
		   renderSegments: function () 
		   {
			   jQuery(".segment").hide().removeClass("visible");
			   jQuery(".segment.nosession").show();
			   
			   switch(this._data.current.type) {
			   	   case "c": 
			   		   jQuery(".segment.customer").show().addClass("visible");
			   		   if (this.hasSession())
			   		   {
			   			jQuery(".segment.session").show().addClass("visible"); 
			   			jQuery(".segment.nosession").hide().removeClass("visible"); 
			   		   }
						if (this.matchesURL(["2/","3/"])) { // lidl
							jQuery("#Header-Logo").attr("href","/selfcare2/servlet/Start");
						} else {
							jQuery("#Header-Logo").attr("href","/selfcare/servlet/Start");
						}
    			   	   break;
			   	   case "pc": jQuery(".segment.pre-customer").show().addClass("visible"); break;
			   	   case "p": jQuery(".segment.prospect").show().addClass("visible"); break;
			   	   
			   }   
			   },
		   init: function ()
		   {
				   var self=this;
				   this.checkCustomer();
				   this.checkURLs();
				   this.getURLparams();
				   this.checkDeepLinks();
				   this.renderSegments();
				   this.fixLoginForm();
				   
		   },
		   fixLoginForm: function()
		   {
			   $form= $("#loginBigContainer form, #customerLoginForm");
			   if ($form)
			   {
				   target=$form.attr("action");
				   if( target  && target.substr(0,1)=="/")
				   {
					   domain=window.location.host;
					   $form.attr("action","https://"+domain+target);
				   }
			   }
		   },
		   checkURLs:function()
		   {
			   
			   if (this.matchesURL(this._loggedInURLs))
			   {
				   if (!this.matchesURL(this._ignoreURLs.concat(this._loggedOutURLs)))
				   {	   
				   this.setCustomer();
				   }
				   
			   }
			   if (this.matchesURL(this._loggedOutURLs))
			   {
				   this.clearSession();
			   }
			   
		   },
		   checkLoggedIn:function(callback)
		   {
			   $.ajax({
				   url: "/selfcare/servlet/Loginbox",
				    success: function(data){
				     $logoutbutton=$(data).find("a.LogoutButton");
				     if ($logoutbutton.length>0)
				     {
				    	 callback(true);
				     }
				     else
				     {
				    	 callback(false); 
				     }
				   }
				 });
		   },
		   checkDeepLinks: function(){
			   if(this._urlParams['tduid']){  
			   		__date = new Date();
			   		__date.setTime(__date.getTime() + (10 * 60 * 1000));
			   		jQuery.cookie('__paybackpunkteshow','ja',{path:"/",expires:__date});
			   }
			   if (this._urlParams.deeplink || this._data.deeplink )
				   {
				    //this.setCustomer();
				   	if(this._urlParams['tduid']!=''){
				   		jQuery.cookie('___lastschrifteinzug_paybackid_set','ja',{path:"/"});
				   		jQuery.cookie('___lastschrifteinzug_paybackid',this._urlParams['ref'],{path:"/"});
				   		jQuery.cookie('___lastschrifteinzug_tduid',this._urlParams['tduid'],{path:"/"});
				   	}
				   if (this._urlParams.deeplink && this._urlParams.deeplink.lastIndexOf("/selfcare")==0) this._data.deeplink= this._urlParams.deeplink ;
				    this.setCookie();
				   this.checkLoggedIn(this.loginCallback); 
				   
				   }
			  
				    
		   }
		   
		   ,
		   loginCallback:function(loggedIn)
		   {
			   
			   
			   if (loggedIn)
			   {
				   deeplink=fuser._data.deeplink;
				   fuser._data.deeplink=null;
				   fuser.setCookie();
				   window.location.href=deeplink;
				  
			   }
			  
		   },
		   getURLparams:function()
		   {
			   var self=this;
			   
			   hash=window.location.hash.replace("#","");
			   hash=hash.replace("?","&"); //payback fix
			   
			   
			   if (hash.lastIndexOf("=")!=-1)
			   {
			   hash_array=hash.split("&");
			   var params=[];
			   $(hash_array).each(
					   function()
					   {
						  if (this.lastIndexOf("=")!=-1)
						  {
						  	
							  pair=this.split("=");
							  self._urlParams[pair[0]]=pair[1];
						  }
						  else
						  {
							  self._urlParams[this]=true;  
						  }
					   });
			   }else{
				   
				   self._urlParams[hash]=true;  
			   }
		   },
		   clean: function ()
		   {
			   
			   jQuery.cookie(this._cookieName,null,this._cookieOptions);
			   this._data=this._defaultData;
		   }
			   
			   
		   
		
};

fuser._data=fuser._defaultData;

//CVB
var cvb = {
		stage:{},
		initModal: function()
		{
			
			var thismodal = this;
			$(".CVB_button").click(function(){ thismodal.openModal(this); return false;});
			
			if (!this.loader)
			{	
			 this.loader=$("<dif id='loader' class='loading'></div>").appendTo(document.body);
			 this.loader.jqm({modal:true});
			 this.loader.hide();
			}
			
		},
		openModal: function(el)
		{
			var thismodal=this;
			this.loader.jqmShow();
			if (thismodal.stage.modalWindow) this.stage.modalWindow.remove();
			this.stage.modalWindow= $("<div id='fonicModal' class='CVB jqmWindow' style='position:absolute' ></div>"); // jqModal 
			this.stage.modalContent =$("<div id='cvbModalContent'></div>").appendTo(this.stage.modalWindow); 
			
			closebutton=$("<a href='#' class='cvbModalCloseButton jqmClose'></a>").appendTo(this.stage.modalWindow);
		    this.stage.modalWindow.jqmAddClose(closebutton);
			
			this.stage.modalWindow.appendTo('body')
			
			
			
			this.stage.modalWindow.jqm({modal:true});
			this.stage.modalWindow.css("top",$(window).scrollTop()+$(window).height()/5)
			
			var $form=$($(el).parent());
	    	formdata= $form.serialize();
	    	
	    	$.post($form.attr("action"),formdata,
			    	function(data)
			    	{
			    		$content=$(data).find("#cvb_pack_change")
			    		
			    		if($content.size())
			    			{
			    			$(thismodal.stage.modalContent).html($content.html())	
			    			thismodal.loader.jqmHide();
			    			thismodal.stage.modalWindow.jqmShow();
			    			thismodal.initChange();
			    			$("#cvbModalContent .ErrorTxt").hide();			
			    			}
			    		else
			    		{
			    		$form.submit();	
			    		}
			    	});
	    	
	    	
		    
		},
		
		initOptions : function()
		{
			this.transformationsOptions();
			this.initModal();
			
		
		},
		initChange :function ()
		{
			
			if ($(".walhalla_nobank,.walhalla_autopayment_end , .walhalla_nodebitpermit ").size())
				this.showNobank();
			
			cvb.transformationsChange();
			
		},
		transformationsChange:function ()
		{

			var activePack = $("#CVB_ActiveOption").html();
			var activeUntil = $("#CVB_ActiveUntil").html();
			var activeFrom = $("#CVB_ActiveFrom").html();
			var nextPack = $("#CVB_NextOption").html();
			
			if (activeUntil) 
			{
			activeUntil=formatDate(activeUntil);
			}
		if (activeFrom) 
			{
			activeFrom=formatDate(activeFrom);
			}

			if (activePack&&nextPack)
				{
				
				
				if (activePack=="Handy Internet Flat Promo" && (nextPack=="Handy-Internet-Flatrate"||nextPack=="Handy Internet Flat"))
				{
					$("#CVB_confirmation_title").html("Verl�ngerung");
					$("#CVB_confirmation_text").html("Die Verl�ngerung der "+nextPack+" erfolgt automatisch nach ende des Kostenlosen Testmonats am "+ activeUntil +".");
				}
				
				}
			
			$date=$("#CVB_confirmation_date");
			date=$date.html();
			if (date)
				{
			$date.html(formatDate(date));
			
				}
		},
		transformationsOptions: function ()
		{
			if ($(".CVB_button").length==0)
			{
			 $("#CVB_header").hide();
			 $("#CVB_header_pending").show();
			}
		
		
		var activePack = $("#CVB_ActiveOption").html();
		var activeUntil = $("#CVB_ActiveUntil").html();
		var activeFrom = $("#CVB_ActiveFrom").html();
		var nextPack = $("#CVB_NextOption").html();
		
		if (activeUntil) 
			{
			activeUntil=formatDate(activeUntil);
			}
		if (activeFrom) 
			{
			activeFrom=formatDate(activeFrom);
			}
		
		if (activePack)
		{
		nameActive=$(".CVB_name:contains('"+activePack+"')");
		var activeBlock= $($(nameActive).first()).parent().parent();
	    }
		
		if (activePack &&  nextPack)
	     {
			nameActive=$(".CVB_name:contains('"+activePack+"')");
			nameNext=$(".CVB_name:contains('"+nextPack+"')");
			
			
			if (nameActive && nameNext)
				{
		         var nextBlock= $($(nameNext).first()).parent().parent();
		         
		         if ( activeBlock && activeFrom && activeUntil)
		        	 {
		        	  activeBlock.find(".CVB_date_container").html("<p class='CVB_date_ends'>endet am "+activeUntil+"</p>");
		        	  nextBlock.find(".CVB_date_container").html("<p class='CVB_date_starts'>aktiv ab "+activeFrom+"</p>")
		        	 }
				}
	     }
	    if (nextPack=="Handy-Internet-Flatrate" || activePack=="Handy-Internet-Flatrate"){
	    	//payback begin
			if(jQuery.cookie('___lastschrifteinzug_paybackid_set')=='ja'){
					if(jQuery.cookie('___lastschrifteinzug_hif_send')!='ja'){
						jQuery.cookie('___lastschrifteinzug_hif_maketrackingpixel','ja');
										
						jQuery.cookie('___lastschrifteinzug_paybackid_set',null);
					
				}
			}
			//payback end
	    	
	    }
		if ($("#FNC_HIF_PROMO_container").length>0)
			{
			$("#FNC_HIF_container,#HANDY_INET_PACK_container").hide();
			if (activePack=="Handy Internet Flat Promo"){
				
				
				form = $("#FNC_HIF_container .CVB_status_action").html();
				if (!form) 
					{
					form = $("#HANDY_INET_PACK_container .CVB_status_action").html();
					}
				$("#FNC_HIF_PROMO_container .CVB_status_action").html(form);
				$("#FNC_HIF_PROMO_container .CVB_status_action .CVB_button").addClass("extend");
				
				if (nextPack && (nextPack=="Handy-Internet-Flatrate"))
					{
					 if (activeBlock && activeUntil && activeFrom)
						 {
						 
						activeBlock.find(".CVB_date_container").remove();
						$(".CVB_pack_price_large.FNC_HIF_PROMO").after("<div style='float:left'><p>kostenloses Testmonat endet am "+activeUntil +"</p><p class='CVB_date_starts'>regul�re Handy-Internet-Flatrate aktiv ab "+activeFrom+"</p></div>");
						 } 
					}else
						{
						dateEnds=activeBlock.find(".CVB_cycle_date").html();
						activeBlock.find(".CVB_date_container").remove();
						
						
						$(".CVB_pack_price_large.FNC_HIF_PROMO").after("<div id='CVB_ends' style='float:left'><p>kostenloses Testmonat</p></div>");
						if (dateEnds)
						{
							$("#CVB_ends").append("<p class='CVB_date_ends'>endet am "+formatDate(dateEnds)+"</p>")
						    activeBlock.find(".clearer.status").remove();
						}
						
						}
				}
			
			}

		},
		showNobank :function ()
		{
			$("#walhalla_nobank_form").show();
			$("#walahalla_weiter_info").show();
			$(".CVB_button.small").show();
			/*$.nmTop().sizes.minH=600;
			$.nmTop().resize(true);
			$.nmTop()._unreposition()
			$.nmTop()._reposition()*/
			
			$("#cvb_pack_change_form").submit(function(){cvb.checkBank();return false;})
			
			
		},
		checkBank : function()
		{
			$("#walhalla_errors").html("");
			if (!$("#walhalla_direct_debit_permit").is(":checked"))
				{
				$("#walhalla_errors").html("<p class='ErrorTxt'>Sie m&uuml;ssen der Einzugserm&auml;chtigung zustimmen</p>");
				return false;
				}
			$.post("SaveBankDetails",
					{bank_reg_number:$("#walhalla_bank_reg_number").val(),
				     bank_account_number:$("#walhalla_bank_account_number").val(),
				     direct_debit_permit:$("#walhalla_direct_debit_permit").val()},
				     function(data)
				      {
				    	 $data=$(data);
				    	 if ($data.find(".okTxt").size())
				    		 {
				    		 $("#cvb_pack_change_form").unbind("submit");
				    		 $("#cvb_pack_change_form").trigger("submit");
				    		 }
				    	 else
				    		 {
				    		 $("#walhalla_errors").append($data.find(".ErrorTxt"));
				    		 }
				      }
			
			)
					
		}
		
}

//SEG INIT

$(document).ready(function(){	
   $("ul.jcarousel li").css("position","relative");
   
   $(".clickable").each(function(){
       $(this).css("cursor","pointer");
        $(this).click(function(){window.location=$(this).find("a:first").attr("href")});
       });
       
   $(".clickablelink_blank").each(function(){
       $(this).css("cursor","pointer");
       $(this).append('<a href="'+$(this).find("a:first").attr("href")+'" target="_blank" class="clickablelink_a"></a>');
   });
   $(".clickablelink_self").each(function(){
       $(this).css("cursor","pointer");
       $(this).click(function(){
       	$(this).find("a:first").click();
       });
    });
	 
	$("#noClient").click(function(){fuser.setProspect(); window.location.href="/html/index.html"})
  /*	newAction=jQuery("#customerLoginForm").attr("action").replace("www.fonic.de",window.location.hostname);
	jQuery("#customerLoginForm").attr("action",newAction); */
	fuser.init();
	jQuery(' .jcarousel').jcarousel({
		scroll:1,
		itemFallbackDimension: 300

	});
});

//NAVIGATION
var _activeMenuEl='';
jQuery(document).ready(function(){
	jQuery('#MainNav>ul>li>a').each(function(i){
		jQuery(this).append('<span class="navipfeil"></span>');
	});
	jQuery('#MainNav>ul>li').each(function(i){
		jQuery(this).addClass('menufirstlevelli_'+i);
	});
	jQuery('#MainNav>ul>li').mouseover(function(){
		jQuery('#MainNav>ul>li').stopTime();
		if(_activeMenuEl!=jQuery(this).attr('class')){
			jQuery('#MainNav>ul>li').removeClass('open');
			jQuery(this).addClass('open');
			_activeMenuEl=jQuery(this).attr('class');
		}
	});
	jQuery('#MainNav>ul>li').mouseout(function(){
		jQuery(this).oneTime(0, function() {
			jQuery(this).removeClass('open');
			_activeMenuEl='';
		});
	});
	/*
	jQuery('.navigationlayer').each(function(i){
 		var navlayer=jQuery(this);
 		jQuery(this).append('<span class="close"></span>');
 		jQuery(this).find('.close').click(function(){
 			navlayer.hide();
 		});
 	});
 	*/
});

function getUrlVars(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}
function formatDate(date)
{
	y=date.substr(0,4);
	m=date.substr(5,2);
	d=date.substr(8,2);
	
	return d+"."+m+"."+y;
	}
	
	
	
function showPaybackPunkte(){
	if(jQuery.cookie('__paybackpunkteshow')=='ja'){
		return true;
	}else{
		return false;
	}
}

function explidoActionallocator(orderid,reveneu,produktid){
	jQuery('body').append('<iframe name="actionallocator" frameborder="0" width="1" height="1" src="https://www.actionallocator.com/cget/?fid=23&kid=113&product='+produktid+'&shop=1&order='+orderid+'&value='+reveneu+'"></iframe>');
}
