/* OPENWINDOW functions */
function centerWindowV (winHeight, menubar, status, directories, toolbar, location) {
	scrHeight = screen.availHeight;
	titlesize		= 31;
	menubarsize		= 48;
	statussize		= 20;
	directoriessize	= 29;
	toolbarsize		= 29;
	locationsize	= 29;
	winHeight += titlesize;
	if (menubar)		winHeight += menubarsize;
	if (status)			winHeight += statussize;
	if (directories)	winHeight += directoriessize;
	if (toolbar)		winHeight += toolbarsize;
	if (location)		winHeight += locationsize;
	winTop	= ((scrHeight-winHeight)/2);
	return winTop;
}

function centerWindowH (winWidth) {
	scrWidth  = screen.availWidth;
	windowBorders	=  12;
	winWidth		+= windowBorders;
	winLeft 		=  ((scrWidth-winWidth)/2);
	return winLeft;
}

function oCenterWin(url,title,winWidth,winHeight,menubar,status,directories,toolbar,location,scrollbars,resizable) {
	winTop	= centerWindowV (winHeight,menubar,status,directories,toolbar,location);
	winLeft = centerWindowH (winWidth);
	if (typeof winHandle != "undefined" && !winHandle.closed) winHandle.close();
	winHandle=top.open(url,title,'location='+(location?'yes':'no')+',toolbar='+(toolbar?'yes':'no')+',directories='+(directories?'yes':'no')+',status='+(status?'yes':'no')+',scrollbars='+(scrollbars?'yes':'no')+',menubar='+(menubar?'yes':'no')+',resizable='+(resizable?'yes':'no')+',width='+winWidth+',height='+winHeight+',height='+winHeight+',top='+winTop+',left='+winLeft);
	winHandle.focus();
}

function openSitemap(url) {
	winWidth	= 910;
	winHeight	= 730;
	oCenterWin(url, "SITEMAP", winWidth, winHeight, false, true, false, false, false, true, true);
}

function openExternalLink(url) {
	winWidth	= 800;
	winHeight	= 600;
	oCenterWin(url, "EXTERNALWIN", winWidth, winHeight, true, true, true, true, true, true, true);
}

/* Redirect POPUP */
function callRedirectPopup(url, height, width, toolbar, herkunftID, aktionsCode) {
	if (herkunftID==null)	herkunftID = '-1';
	if (aktionsCode==null)	aktionsCode = '';

	var Args = eval("'"+"width="+width+", height="+height+", toolbar="+toolbar+", location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1"+"'");
	m_window = window.open('../../menu/-1_eAXAWEB-POPUP-REDIRECT/index.html?ID='+url+'&HERKUNFTID='+herkunftID+'&AKTIONSCODE='+aktionsCode, '_blank', Args);
	m_window.focus;
	if (m_window.opener == null) {
		m_window.opener = self;
		m_window.focus;
	}
}

/* Redirect POPUP with HTML Paramters */
function callRedirectPopupWithHTMLParam(url, height, width, toolbar, herkunftID, aktionsCode, params) {
	if (herkunftID==null)	herkunftID = '-1';
	if (aktionsCode==null)	aktionsCode = '';

	var Args = eval("'"+"width="+width+", height="+height+", toolbar="+toolbar+", location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1"+"'");
	m_window = window.open('../../menu/-1_eAXAWEB-POPUP-REDIRECT/index.html?ID='+url+'&HERKUNFTID='+herkunftID+'&AKTIONSCODE='+aktionsCode+params, 'm_window', Args);
	m_window.focus;
	if (m_window.opener == null) {
		m_window.opener = self;
		m_window.focus;
	}
}


function callMicrosite(topic, targetURL, idname, id) {	
	var schadenRedirectLink = "../../menu/-1_eAXAWEB-POPUP-REDIRECT-SCHADEN/index.html";
	var schadenRedirectLinkParams = "";
	var menuID = extractMenuId();

	if (idname == null && id == null)
		schadenRedirectLinkParams = "?topic="+topic+"&targetURL="+targetURL+"&refererId="+menuID;
	else
		schadenRedirectLinkParams = "?topic="+topic+"&targetURL="+targetURL+"&idname="+idname+"&id="+id+"&refererId="+menuID;
	
	window.location = schadenRedirectLink+schadenRedirectLinkParams;
}

function checkBrowser() {
	var BrowserName = navigator.appName;
	if (BrowserName == 'Microsoft Internet Explorer')
		return 'IE';
	else if (BrowserName == 'Netscape')
		return 'FF';
	else if (BrowserName == 'Opera')
		return 'OP';
	else
		return 'unknown';
}

function callVideoPopup(url, height, width, toolbar, herkunftID, aktionsCode) {
	if (herkunftID==null)	herkunftID = '-1';
	if (aktionsCode==null)	aktionsCode = '';

	var Args = eval("'"+"width="+width+", height="+height+", toolbar="+toolbar+", location=0,directories=0,modal=1,status=1,menubar=0,scrollbars=1,resizable=1"+"'");
	m_window = window.open(url, 'm_window', Args);
	m_window.focus;
	if (m_window.opener == null) {
		m_window.opener = self;
		m_window.focus;
	}
}

/* allgemein zum Formular oeffnen*/
function callFormularPopup(menuid, width, height, name, params ) {
    var url = "../../menu/"+menuid+"_yno/index.html"+params;
    window.open(url, name, "width="+width+",height="+height+",resizable=yes,scrollbars=yes,location=no,dependent=yes,menubar=no,status=no,toolbar=no");
    }

/* Menu POPUP */
function callMenuPopup(menuid, height, width, toolbar, aflaechenid, refframe, herkunftID, title) {
	var flaeche = "";
	if (aflaechenid!="" && aflaechenid!=null && aflaechenid!='undefined') {
		flaeche = "&aFlaechenID="+aflaechenid;
	}

	if (herkunftID==null) herkunftID = '-1';
	if (title==null) title='';
	var Args = eval("'"+"width="+width+", height="+height+", toolbar="+toolbar+", location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1"+"'");
	window.open("../../menu/"+menuid+"/index.html?HERKUNFTID="+herkunftID+flaeche, title, Args);
}



/* Kontakt POPUP */
function callKontaktPopup(menuid, testmodus, aflaechenid, refframe) {
	var flaeche = "";
	if (aflaechenid!="" && aflaechenid!=null && aflaechenid!='undefined') {
		flaeche = "&aFlaechenID="+aflaechenid;
	}
	window.open("../../menu/"+menuid+"/index.html?test="+testmodus+flaeche, "KontaktWin", "width=660,height=710,resizable=yes,scrollbars=yes,location=no,dependent=yes,menubar=no,status=yes,toolbar=no");
}

/* Kontakt POPUP Neu */
function callKontaktPopup2(menuid, testmodus, aflaechenid, refframe) {
	var flaeche = "";
	if (aflaechenid!="" && aflaechenid!=null && aflaechenid!='undefined') {
		flaeche = "&aFlaechenID="+aflaechenid;
	}
	window.open("../../menu/"+menuid+"/index.html?test="+testmodus+flaeche, "KontaktWin", "width=700,height=700,resizable=yes,scrollbars=yes,location=no,dependent=yes,menubar=no,status=yes,toolbar=no");
}

/* Kontakt POPUP fuer Antraege */
function callAntragPopup(menuid, testmodus, aflaechenid, refframe) {
    var flaeche = "";
    if (aflaechenid!="" && aflaechenid!=null && aflaechenid!='undefined') {
        flaeche = "&aFlaechenID="+aflaechenid;
    }
    window.open("../../menu/"+menuid+"/index.html?test="+testmodus+flaeche, "KontaktWin", "width=660,height=700,resizable=yes,scrollbars=yes,location=no,dependent=yes,menubar=no,status=yes,toolbar=no");
}


// Funktion fuer den Aufruf der Kontaktformular
function callKontaktPopupRefFrame(menuid) {
	window.open("../../menu/"+menuid+"/index.html?test=false", "KontaktWin", "width=630,height=600,resizable=yes,scrollbars=yes,location=no,dependent=yes,menubar=no,status=no,toolbar=no");
}

// Print-Vorschau
function printView(url, offline) {
    if (offline) {
		alert("Diese Funktion steht in der Offline-Version nicht zur Verfuegung.");
	} else {
		pop_up(url,'printview','650','550','yes','no');
	}
}

// Selectboxen URL-Jump Functions
function jumpQuickNavi (which) {
	url = which.options[which.selectedIndex].value;
	if (url!="#") {
		top.location.href=url;
	} else {
		which.selectedIndex = 0;
	}
}

function jumpPresseArchiv(which) {
	archivForm = which.form;
	year = which.options[which.selectedIndex].value;
	if (year!='0') {
		archivForm.submit();
	}
	which.selectedIndex = 0;
}

function submitStellenForm() {
	suchForm = document.suchform;
	if (suchForm.suchbegriffe.value.length > 0) {
		suchForm.companynames.selectedIndex = 0;
	}
	suchForm.submit();
}


/* POP UP OPENER functions */
/*	open urls in opener window */
function sendLinkToOpener(url) {
	try {
		if (window.opener) {
			if (window.opener.closed) {
				openExternalLink(url);
			} else {
				window.opener.location.href=url;
			}
			self.close();
		} else {
			openExternalLink(url);
		}
	} catch (e) {
	}
}

/* MAIL Popups */
function mailWin(url,title,sizeH,sizeV,scrollbars,noFocus) {
      if (scrollbars == null) scrollbars = 'yes';
      else scrollbars = 'no';
      winHandle = top.open(url,title,'toolbar=no,directories=no,status=yes,menubar=no,scrollbars=' + scrollbars + ',resizable=yes,width='+sizeH+',height='+sizeV);
      if (noFocus != true && navigator.appVersion.indexOf("MSIE 3",0) == -1) id = setTimeout('winHandle.focus()',1000);
}

function subMailto(to,id,subject,sublock)
	{
	 var surl="http://www.axacenter.de/axaweb2008/kontaktNormal/axaweb2008/start.do?sendto="+to;
	 var sizeV=950;
	 var sizeH=1050;
	 /*
	 if (to.toLowerCase()=='service@axa.de'){
	 	surl="../../menu/-1_eAXAWEB-MAILTO_pservice/index.html?sendto="+to;
	 	sizeV=720;
	 }
	 */

	 if (id!=null){
	    surl=surl+"&fromid="+id;
	 }
	 if (subject!=null){
	    surl=surl+"&subject="+subject;
	 }
	 if (sublock!=null){
	    surl=surl+"&sublock="+sublock;
	 }
	oCenterWin(surl, "SendMail", sizeH, sizeV, false, true, false, false, false, true, true);
}

// Hide Subject:
function subMailto2(to,id,subject,subhidden)
	{
	 var surl="../../menu/-1_eAXAWEB-MAILTO/index.html?sendto="+to;
	 var sizeV=550;
	 if (to.toLowerCase()=='service@axa.de'){
	 	surl="../../menu/-1_eAXAWEB-MAILTO_pservice/index.html?sendto="+to;
	 	sizeV=720;
	 }

	 if (id!=null){
	    surl=surl+"&fromid="+id;
	 }
	 if (subject!=null){
	    surl=surl+"&subject="+subject;
	 }
	 if (subhidden!=null){
	    surl=surl+"&subhidden="+subhidden;
	 }
	oCenterWin(surl, "SendMail", 630, sizeV, false, true, false, false, false, true, true);
}

// Hide Mailto:
function subMailto3(to,id,subject,mailtohidden)
	{
	 var surl="../../menu/-1_eAXAWEB-MAILTO/index.html?sendto="+to;
	 var sizeV=550;
	 if (to.toLowerCase()=='service@axa.de'){
	 	surl="../../menu/-1_eAXAWEB-MAILTO_pservice/index.html?sendto="+to;
	 	sizeV=720;
	 }

	 if (id!=null){
	    surl=surl+"&fromid="+id;
	 }
	 if (subject!=null){
	    surl=surl+"&subject="+subject;
	 }
	 if (subhidden!=null){
	    surl=surl+"&mailtohidden="+mailtohidden;
	 }
	oCenterWin(surl, "SendMail", 630, sizeV, false, true, false, false, false, true, true);
}

// Hide Mailto and Subject:
function subMailto4(to,id,subject,mailtohidden,subhidden)
	{
	 var surl="../../menu/-1_eAXAWEB-MAILTO/index.html?sendto="+to;
	 var sizeV=550;
	 if (to.toLowerCase()=='service@axa.de'){
	 	surl="../../menu/-1_eAXAWEB-MAILTO_pservice/index.html?sendto="+to;
	 	sizeV=720;
	 }

	 if (id!=null){
	    surl=surl+"&fromid="+id;
	 }
	 if (subject!=null){
	    surl=surl+"&subject="+subject;
	 }
	 if (mailtohidden!=null){
	    surl=surl+"&mailtohidden="+mailtohidden;
	 }
     if (subhidden!=null){
	    surl=surl+"&subhidden="+subhidden;
	 }
	oCenterWin(surl, "SendMail", 630, sizeV, false, true, false, false, false, true, true);
}

/* Seite weiterempfehlen */
function sendToFriend(id,subject)
	{
	 var surl="../../menu/-1_eAXAWEB-EMPFEHLUNG/index.html?fromid="+id;
	 var sizeV=550;

     if (subject!=null){
        surl=surl+"&subject="+subject;
     } else {
	    surl=surl+"&subject=Seite Weiterempfehlen";
     }

	oCenterWin(surl, "SendMail", 630, sizeV, false, true, false, false, false, true, true);
}

/* Seite weiterempfehlen: KFZ-Special */
function sendToFriendKfz(id,subject)
	{
	 var surl="../../menu/-1_eAXAWEB-KFZSPECIAL-EMPFEHLUNG/index.html?fromid="+id;
	 var sizeV=550;

     if (subject!=null){
        surl=surl+"&subject="+subject;
     } else {
	    surl=surl+"&subject=Seite Weiterempfehlen";
     }

	//oCenterWin(surl, "SendMail", 630, sizeV, false, true, false, false, false, true, true);
    window.location.href = surl;
}

// fuer Zurueck-Links, falls Anker in der URL springe 2 zurueck
function jumpHistoryBack() {
	if (window.location.hash)
		history.go(-2);
	else
		history.back();
}

// MY AXA Functions
function myaxa_win()
{
  self.name = "AxaPortal";
  myAxaWindow = window.open("../../menu/-1_eAXAWEB-POPUP-REDIRECT/index.html?ID=MyAxa", "MyAxa", "location=0,status=1,scrollbars=1,toolbar=0,resizable=1,width=1024,height=768");
  if (document.images) setTimeout("myAxaWindow.focus();",1000);
}

function myaxa_reg_win()
{
  self.name = "AxaPortal";
  myAxaWindow = window.open("../../menu/-1_eAXAWEB-POPUP-REDIRECT/index.html?ID=MyAxaRegister", "MyAxa", "location=0,status=1,scrollbars=1,toolbar=0,resizable=1,width=1024,height=768");
  if (document.images) setTimeout("myAxaWindow.focus();",1000);
}
 

/* copied from popup.js */
// -> diese Variable wird bei Aufruf eines Fensters immer zwischen 1 und 0 getauscht
// und ggf. an den Fensternamen angeh&auml;ngt, damit niemals derselbe Fenstername
// hintereinander aufgerufen wird
var WinNum;

// Definiert und Oeffnet ein Popup-Fenster, wechselt die Nummer des Fensters zwischen
// 0 und 1 und setzt falls m&ouml;glich den Focus -> wird von untenstehder Funktion aufgerufen
function neues_popup_definieren(url,name,breit,hoch,scroll,menubar) {
	var fname = name+WinNum;
	fenster = window.open(url,fname,'width='+breit+',height='+hoch+',toolbar=no,location=no,directories=no,status=no,menubar='+menubar+',scrollbars='+scroll+',resizable=yes,copyhistory=yes');
	if (WinNum==0) { WinNum=1; } else { WinNum=0; }
	if (typeof fenster != "undefined") { fenster.focus(); }
}

// Funktion zum Oeffnen eines EINZELNEN Popup-Fensters
// Existiert bereits ein Fenster UND ist dieses offen wird das bestehende
// Fenster zuerst geschlossen
function pop_up(url,name,breit,hoch,scroll,menubar) {
	if (typeof fenster == "undefined" || fenster.closed) {
		neues_popup_definieren(url,name,breit,hoch,scroll,menubar);
	} else {
		fenster.close();
		neues_popup_definieren(url,name,breit,hoch,scroll,menubar);
	}
}
// Standard-Popup mit fixer Gr��e und Namen
function std_pop_up(url) {
	pop_up(url,'axacontext','650','550','yes','no');
}

//PopUpfunktion mit fixen Windowname
function pop_up_name(url,name,breit,hoch,scroll,menubar) {
	fenster=window.open(url,name,'width='+breit+',height='+hoch+',toolbar=no,location=no,directories=no,status=no,menubar='+menubar+',scrollbars='+scroll+',resizable=yes,copyhistory=yes');
	fenster.focus();
}

// fullscreen on explorer
function launchFull(adress) {
	window.open(adress, "assistant", "fullscreen=1, left=0, top=0, menubar=no, resizable=no, status=no, scrollbars=no");
}



/* copied from changeclass.js */
onerror = stopError;
function stopError() {
	return true;
}

// aenderung der klassen wenn der browser DOM-faehig ist
function changeID(id,name) {
	if (document.getElementById)	{
		document.getElementById(id).className = name;
	}
}

function changeHIDE(){
	if (CH = 1) {
		changeID('tblist2','toolboxcontent-V');
		changeID('tb-nav2','toolboxnav-M');
    }
}

function restore()	{
	changeID('tblist1','toolboxcontent-H');
	changeID('tblist2','toolboxcontent-H');
	changeID('tb-nav1','toolboxnav');
	changeID('tb-nav2','toolboxnav');
}

function changeToolbox (suffix) {
	// aenderung der klassen wenn der browser DOM-faehig ist
	if (document.getElementById) {
		headlineClassName = document.getElementById("tb-nav"+suffix).className;
		if (headlineClassName.indexOf("-M")!=-1) {
			document.getElementById("tb-nav"+suffix).className	= "toolboxnav";
			document.getElementById("tblist"+suffix).className	= "toolboxcontent-H";
		} else {
			document.getElementById("tb-nav"+suffix).className	= "toolboxnav-M";
			document.getElementById("tblist"+suffix).className	= "toolboxcontent-V";
		}
	}
}

function changeSitemapLayer (suffix) {
	// aenderung der klassen wenn der browser DOM-faehig ist
	if (document.getElementById) {
		headlineClassName = document.getElementById("slayer"+suffix).className;
		if (headlineClassName.indexOf("-hide")!=-1) {
			document.getElementById("slayer"+suffix).className	= document.getElementById("slayer"+suffix).className.replace("-hide", "");
			document.getElementById("slayer-link"+suffix).className = document.getElementById("slayer-link"+suffix).className + "-hi";
			document.getElementById("slayer-arrow"+suffix).className = document.getElementById("slayer-arrow"+suffix).className + "-hi";
		} else {
			document.getElementById("slayer"+suffix).className	= document.getElementById("slayer"+suffix).className + "-hide";
			document.getElementById("slayer-link"+suffix).className = document.getElementById("slayer-link"+suffix).className.replace("-hi", "");
			document.getElementById("slayer-arrow"+suffix).className = document.getElementById("slayer-arrow"+suffix).className.replace("-hi", "");
		}
	}
}


// ------------------------------
// -- Test String Chars/Length --
// ------------------------------
function testString(string, check, lang)
{
  if (lang)
    if ((string.length)<lang)
      return false;

  for (i=0; i<string.length; i++)
  {
    if (check.indexOf(string.charAt(i))==-1)
    return false;
  }
  return true;
}

function testNaN(str)
{
  if(navigator.appVersion.indexOf("MSIE 3",0)==-1)
    return isNaN(str);
  else
  {
    for(i=0;i<str.length;i++)
      if(str.charAt(i)<'0' || str.charAt(i)>'9') return true;
    return false;
  }
}

// ----------------------------------
// -- Trim Leading/Trailing Spaces --
// ----------------------------------
function trimSpaces(string)
{
  while (string.charAt(0)==' ')
    string = string.substring(1);
  while (string.charAt(string.length-1)==' ')
    string = string.substring(0,string.length-1);
  return string;
}
// ------------------------------
// -- test valid Email         --
// ------------------------------
function isEMail(field) {
  	var string = getValue(field);
  	var atloc,dotloc,i,ch;

  	if (string.length<6)
  		return false;
  	atloc = string.indexOf('@');
  	dotloc = string.lastIndexOf('.');

  	if (atloc==-1 || dotloc==-1 || atloc>dotloc || (string.length-3)<dotloc) {
     	return false;
	}

  	if (string.indexOf('@',atloc+1)!=-1) {
  		return false;
  		}

  	for(i=0; i<string.length; i++) {
    	ch = string.charAt(i);
    	if (!((i<dotloc  && ch>='0' && ch<='9') || (ch>='A'   && ch<='Z') || (ch>='a'   && ch<='z') ||
    		(i<=dotloc && (ch=='.' || ch=='@' || ch=='-' || ch=='_' || ch=='+')))) {
      	return false;
      	}
  }

  return true;
}
// ------------------------------
// -- Return Integer Value     --
// ------------------------------
function pnParseInt(str)
{
  var i;
  for(i=0;i<str.length;i++)   // numeric?
    if(str.charAt(i)<'0' || str.charAt(i)>'9') return(null);
  while(str.charAt(0)=='0')   // trim leading zeros
    str = str.substring(1);
  if(str=="") return(0);      // empty string -> 0
  return(eval(str));          // parse value
}
// uses: pnParseInt
// ------------------------------
// -- Valid Date ?             --
// ------------------------------


function isDate(string)
{
  var i,d,m,y,dd,mm;
  if(string.length != 10) return false;
  for(i=0; i<10; i++)
  {
    if(i==2||i==5)
    {
      if(string.charAt(i)!='.') return false;
    }
    else
    {
      if(string.charAt(i)<'0' || string.charAt(i)>'9') return false;
    }
  }
  d = pnParseInt(string.substring(0,2));
  m = pnParseInt(string.substring(3,5));
  y = pnParseInt(string.substring(6));

  if(d==null||d<1||d>31) return false;
  if(m==null||m<1||m>12) return false;
  if(y==null||y<1850||y>2200) return false;

  var today = new Date("August 9, 1971 12:00:00");
  today.setYear(y);
  today.setDate(d);
  today.setMonth(m-1);
  dd = today.getDate();
  mm = today.getMonth()+1;

  if ((y%4==0) && (d==29) && (m==2)) return true;
  if ((y%4!=0) && (d==29) && (m==2)) return false;
  if ((d!=dd) || (m!=mm)) return false;
  return true;
}

// ------------------------------
// -- Create Assignable Date   --
// ------------------------------
function dateAssign(dateStr)
{
  if (dateStr)
  {
    var dd = dateStr.substring(0,2);  // extract day
    var mm = dateStr.substring(3,5);  // extract month
    var yy = dateStr.substring(6);    // extract year
    return yy+ ', ' +mm+ '-1, ' +dd;
  }
  else return '';
}
// uses: dateAssign
function higherDate(dateStr)
{
  var today = new Date();
  var dateStr = eval("new Date(" +dateAssign(dateStr)+ ", 23, 59, 59);");
  if (dateStr.getTime()<=today.getTime()) return false;
  else return true;
}

function trimTA(which,len)
{
  if (which.value.length>len) which.value = which.value.substring(0,len);
}


// ---------------------------------------
// -- Auswerten des Typs eines Objekts: --
// ---------------------------------------
function getType (obj)
    {
	typ = obj.type;

	if (typ != 'text'
    && typ != 'textarea'
    && typ != 'select-one'
    && typ != 'select-multiple'
    && typ != 'checkbox'
    && typ != 'hidden')
		{
		if (obj.length > 0)
			typ = obj[0].type;
		}
	return typ;
	}

// -----------------------------------------
// -- Auswerten des Wertes eines Objekts: --
// -----------------------------------------
function getValue (obj)
	{
   var i = 0;
    if (obj == null)
		return null;

	typ = getType(obj);
	if (typ == 'text')			return obj.value;
	if (typ == 'textarea')		return obj.value;
	if (typ == 'hidden')			return obj.value;
	if (typ == 'checkbox')		return obj.value;
	if (typ == 'select-one'	||
		typ == 'select-multiple')
		{
		if (obj.selectedIndex >= 0)
			return obj[obj.selectedIndex].value;
		}

	if (typ == 'radio')
		{
		for (i=0; i<obj.length; i++)
			{
			if (obj[i].checked)
				return obj[i].value;
			}
		}
	return null;
	}


// -----------------------------------------
// Check functions
function checkField(which,msg)
{
  if (which.type=='select-one')    return checkSelect(which,msg);
  else if (which.type=='text')     return checkText(which,msg);
  else if (which.type=='textarea') return checkText(which,msg);
  //else if (which.type=='checkbox') return checkCheck(which,msg);
  else if (which[0].type=='radio') return checkRadio(which,msg);
}

// Check for formfield value
function checkSelect(which,msg)
{
  if (which.selectedIndex==0)
  {
    alert(msg);
    which.focus();
    return false;
  }
  return true;
}

function checkText(which,msg)
{
  //alert("Check Text: "+which.name);
  if (!trimSpaces(which.value))
  {
    alert(msg);
    which.focus();
    return false;
  }
  return true;
}

function checkRadio(which,msg)
{
  var dummy = false;
  for (var i=0;i<which.length;i++)
    if (which[i].checked) dummy = true;
  if (!dummy)
  {
    alert(msg);
    which[0].focus();
    return false;
  }
  return true;
}

function checkPLZ(which,req)
{
  // which = formfield object; req = required? (true/false)
  if (!req) req = false;
  if (req && !which.value)
  {
    alert('Bitte geben Sie Ihre Postleitzahl an!');
    which.focus();
    return false;
  }
  else if (which.value && !testString(which.value,'0123456789',5))
  {
    alert('Bitte achten Sie auf die korrekte Form der Postleitzahl!');
    which.focus();
    return false;
  }
  return true;
}

function checkVorwahl(which,req)
{
  // which = formfield object; req = required? (true/false)
  if (!req) req = false;
  if (req && !which.value)
  {
    alert('Bitte geben Sie Ihre Vorwahl an!');
    which.focus();
    return false;
  }
  else if (which.value && !testString(which.value,'0123456789'))
  {
    alert('Bitte verwenden Sie nur Zahlen f�r die Angabe der Vorwahl!');
    which.focus();
    return false;
  }
  else if (which.value && which.value.length<3)
  {
    alert('Bitte achten Sie darauf, da� die angegebene Vorwahl mindestens 3-stellig ist!');
    which.focus();
    return false;
  }
    else if (which.value && which.value.charAt(0)!='0')
  {
    alert('Bitte achten Sie darauf, da� die angegebene Vorwahl mit der Ziffer "0" beginnt!');
    which.focus();
    return false;
  }
  return true;
}

function checkNummer(which,req,msg)
{
  // which = formfield object; req = required? (true/false)
  if (!msg) msg = 'Bitte verwenden Sie nur Zahlen f�r die Angabe der Rufnummer!';
  if (!req) req = false;
  if (req && !which.value)
  {
    alert('Bitte geben Sie Ihre Rufnummer an!');
    which.focus();
    return false;
  }
  else if (which.value && !testString(which.value,'0123456789'))
  {
    alert(msg);
    which.focus();
    return false;
  }
  return true;
}

function checkEmail(which,req)
{
  // which = formfield object; req = required? (true/false)
  if (!req) req = false;
  if (req && !which.value)
  {
    alert('Bitte geben Sie Ihre E-Mail Adresse an!');
    which.focus();
    return false;
  }
  else if (which.value && !isEMail(which))
  {
    alert('Bitte achten Sie auf die korrekte Form der E-Mail Adresse!');
    which.focus();
    return false;
  }
  return true;
}

function checkEmail2(which,req)
{
  // which = formfield object; req = required? (true/false)
  if (!req) req = false;
  if (req && !which.value)
  {
    alert('Bitte geben Sie die E-Mail Adresse des Empf�ngers an!');
    which.focus();
    return false;
  }
  else if (which.value && !isEMail(which))
  {
    alert('Bitte achten Sie auf die korrekte Form der E-Mail Adresse!');
    which.focus();
    return false;
  }
  return true;
}

function checkDatum(which,msg,req)
{
  // which = formfield object; req = required? (true/false)
  if (!req) req = false;
  if (req && !which.value)
  {
    alert(msg);
    which.focus();
    return false;
  }
  else if (which.value && !isDate(which.value))
  {
    alert('Bitte geben Sie ein korrektes Datum im Format TT.MM.JJJJ an!');
    which.focus();
    return false;
  }
  return true;
}

function checkFile(which,msg,req)
{
  if (!req) req = false;
  if (req && !which.value)
  {
    alert(msg);
    which.focus();
    return false;
  }

  var stest = which.value.toLowerCase();

  if (stest.length == 0) {
  	return true;
  }
  if (stest.length < 3) {
     alert("Geben sie den Dateinmane (mit Pfad) an, oder benutzen sie den Durchsuchen-Dialog" );
     return false;
  }
  var endung = stest.substr(stest.length-3,3);
  var sMime3 = " pdf doc";
  if (sMime3.indexOf(endung) < 0) {
      alert("Es k�nnen nur Dateien mit den Endungen " + sMime3 + " beigef�gt werden" );
      return false;
   }
   sTemp = checkFileName(stest)
   if (sTemp != '') {
      alert("Ung�ltiger Dateiname!\nDas Zeichen '" + sTemp + "' ist nicht zul�ssig!");
      return false;
   }
   return true;
}

// -----------------------------------
// Dateiname auf Sonderzeichen pr�fen
// -----------------------------------
function checkFileName(strg)
        {
        var i        = 0;
        var sTemp    = "";
        var sGueltig = "1234567890" +
                       "abcdefghijklmnopqrstuvwxyz" +
                       "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
                       "�������" +
                       " /-_.:@";


        for (i; i<strg.length;i++)
                {
                sTemp = strg.substring(i, i+1);

                if (sGueltig.indexOf(sTemp) == -1)
					{
                        if (sTemp != "\\")
                                return sTemp;
					}
                }

        return "";
        }



function checkKennzeichen(which,req)
{
  if (!req) req = false;
  if (req && !trimSpaces(which.value))
  {
    alert('Bitte geben Sie das Kennzeichen an!');
    which.focus();
    return false;
  }
  else if (!testOccurance(trimSpaces(which.value),'-',1) || !testString(trimSpaces(which.value),' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-0123456789',4))
  {
    alert('Bitte achten Sie auf die korrekte Form des Kennzeichens!');
    which.focus();
    return false;
  }
  return true;
}

function formatMoney(which)
{

    dummy = cleanChars(which.value,'.');
    dummy = cleanChars(dummy,',','.');
    dummy = eval(dummy);
    dummy = Math.round(dummy*100);
    dummy = dummy.toString();
    if (dummy == '0')
      dummy = '000';
    dummy = dummy.substring(0,dummy.length-2) + ',' + dummy.substring(dummy.length-2);
    dummy = tausenderPunkt(dummy);
    if (dummy.charAt(0) == ',')
      dummy = '0'+dummy;
    which.value = dummy;

}

// valid without komma or with 2 digits after komma
function checkBetrag(which,req)
{
  var check ='0123456789';
  var status = true;
  var komma = false;
  var i;
  var vorkomma;
  var nachkomma;

  if (!req) req = false;
  if (req && !trimSpaces(which.value))
  {
    alert('Bitte geben Sie einen Betrag an!');
    which.focus();
    return false;
  }

  if (which.value.length > 0)
  {
    i = which.value.indexOf(',');
	if (i!=-1)
	    {
		vorkomma = which.value.substring(0,i);
		nachkomma = which.value.substring(i+1,which.value.length);
		if (vorkomma.length == 0)
			status=false;
        else
		 if (!testString(vorkomma,'0123456789'))
			status=false;
		 else
		  if (nachkomma.length < 2 || nachkomma.length > 2)
		    	status=false;
          else
		    if (!testString(nachkomma,'0123456789'))
			   status=false;
		}
	else
		{
		if (which.value && !testString(which.value,'0123456789'))
			status=false;
		}
  }
  if (!status)
  {
    alert('Bitte verwenden Sie das Format 0,00 f�r die Eingabe des Betrages!');
    which.focus();
  }

  return status;
}

// valid without komma or with 2 digits after komma, points are ignored
// (e.g. 1.200.300,40 as is in EvfpAngebotBauherren)
function checkBetrag2(which,req)
{
  var check ='0123456789';
  var status = true;
  var komma = false;
  var i;
  var vorkomma;
  var nachkomma;

  if (!req) req = false;
  if (req && !trimSpaces(which.value))
  {
    alert('Bitte geben Sie einen Betrag an!');
    which.focus();
    return false;
  }

  if (which.value.length > 0)
  {
    i = which.value.indexOf(',');
	if (i!=-1)
	    {
		vorkomma = which.value.substring(0,i);
		nachkomma = which.value.substring(i+1,which.value.length);
		if (vorkomma.length == 0)
			status=false;
        else
		 if (!testString(vorkomma,'0123456789.'))
			status=false;
		 else
		  if (nachkomma.length < 2 || nachkomma.length > 2)
		    	status=false;
          else
		    if (!testString(nachkomma,'0123456789'))
			   status=false;
		}
	else
		{
		if (which.value && !testString(which.value,'0123456789'))
			status=false;
		}
  }
  if (!status)
  {
    alert('Bitte verwenden Sie das Format 0,00 f�r die Eingabe des Betrages!');
    which.focus();
  }

  return status;
}

// valid without komma or with 1 digit after komma
function checkWert(which,req)
{
  var check ='0123456789';
  var status = true;
  var komma = false;
  var i;
  var vorkomma;
  var nachkomma;

  if (!req) req = false;
  if (req && !trimSpaces(which.value))
  {
    alert('Bitte geben Sie einen Wert an!');
    which.focus();
    return false;
  }

  if (which.value.length > 0)
  {
    i = which.value.indexOf(',');
	if (i!=-1)
	    {
		vorkomma = which.value.substring(0,i);
		nachkomma = which.value.substring(i+1,which.value.length);
		if (vorkomma.length == 0)
			status=false;
        else
		 if (!testString(vorkomma,'0123456789'))
			status=false;
		 else
		  if (nachkomma.length != 1)
		    	status=false;
          else
		    if (!testString(nachkomma,'0123456789'))
			   status=false;
		}
	else
		{
		if (which.value && !testString(which.value,'0123456789'))
			status=false;
		}
  }
  if (!status)
  {
    alert('Bitte verwenden Sie das Format 0,0 f�r die Eingabe des Wertes!');
    which.focus();
  }

  return status;
}

// valid Timeformat 00:00
function checkTime(which,req)
{
  var check ='0123456789';
  var status = false;

  if (!req) req = false;

  if (req && !trimSpaces(which.value))
  {
    alert('Bitte geben Sie die Uhzeit an!');
    which.focus();
    return false;
  }

  if (which.value.length == 0 && !req)
     return true;

  if (which.value.length = 5)
    if (which.value.indexOf(':') == 2)
	    if (testString(which.value.substring(0,2),'0123456789'))
		   if (testString(which.value.substring(3,5),'0123456789'))
				status=true;


  if (!status)
  {
    alert('Bitte verwenden Sie das Format 00:00 f�r die Eingabe der Uhrzeit!');
    which.focus();
  }

  return status;
}

// ------------------------------
// -- Clean Illegal Characters --
// ------------------------------
function cleanChars(string,chars,subst)
{
  if (!subst)
	  subst = '';
  for (i=0; i<chars.length; i++)
    while (string.indexOf(chars.charAt(i))!=-1)
      string = string.substring(0,string.indexOf(chars.charAt(i))) + subst + string.substring(string.indexOf(chars.charAt(i))+1,string.length);
  return string;
}

// uses: insertChar
// ------------------------------
// --  Set Tausender Punkt     --
// ------------------------------
function tausenderPunkt(string)
{
  count = 0;
  start = string.lastIndexOf(',');
  if (start!=-1)
  {
    for (i=1;i<=start;i++)
    {
      count++;
      if (count==3)
      {
        count = 0;
        if (start-i!=0)
          string = insertChar(string,'.',start-i+1);
      }
    }
    return string;
  }
}

// ------------------------------
// --   Insert Character At    --
// ------------------------------
function insertChar(string,val,loc)
{
  return string.substring(0,loc-1) + val + string.substring(loc-1);
}

//uses: testString, testOccurance, cleanChars, tausenderPunkt
// ------------------------------
// --  Check Money             --
// ------------------------------
function checkMoney(which)
{
   if (which.value)
   {
       if (!testString(which.value,'0123456789,.'))
       {
           alert('Bitte geben Sie nur Zahlen im folgenden Format ein:\n1000 oder 1.000 oder 1.000,00');
           which.value='';
           which.focus();
       } //else if (!testOccurance(which.value,',',1)) {alert("das endere");}
       else
       {
         dummy = cleanChars(which.value,'.');
         dummy = cleanChars(dummy,',','.');
         dummy = eval(dummy);
         dummy = Math.round(dummy*100);
         dummy = dummy.toString();
         if (dummy == '0')
           dummy = '000';
         dummy = dummy.substring(0,dummy.length-2) + ',' + dummy.substring(dummy.length-2);
         dummy = tausenderPunkt(dummy);
         if (dummy.charAt(0) == ',')
           dummy = '0'+dummy;
         which.value = dummy;
       }
   }
}

function checkMoney2(which,msg,req)
{
   if (which.value)
   {
       if (!testString(which.value,'0123456789.'))
       {
           alert('Bitte geben Sie nur ganze Zahlen im folgenden Format ein:\n1000 oder 1.000');
           which.value='';
           which.focus();
           return false;
       }
   }
   else if (req)
   {
     alert(msg);
     which.focus();
     return false;
   }
   return true;
}

function getAge(today,born)
{
  var todayYY = today.getYear();
  if (todayYY<1900) todayYY+=1900;
  var bornYY  = born.getYear();
  if (bornYY<1900) bornYY+=1900;
  var years = todayYY-bornYY;
  if (born.getMonth()>today.getMonth()) years--;
  else if (born.getMonth()==today.getMonth() && born.getDate()>today.getDate()) years--;
  return years;
}

function checkVollj(which)
{
  var today = new Date();
  var born  = eval("new Date(" +dateAssign(which.value)+ ", 12, 00, 00);");
  if (getAge(today,born)<18)
  {
    alert('Der Antragsteller mu� mindestens 18 Jahre alt sein!');
    which.focus();
    return false;
  }
  return true;
}

function testVBeginn(which)
{
  var today = new Date();
  today.setHours(12);
  today.setMinutes(0);
  today.setSeconds(0);
  var begin = eval("new Date(" +dateAssign(which.value)+ ", 12, 00, 00);");
  var born  = eval("new Date(" +dateAssign( VersNehmerGebDatum )+ ", 12, 00, 00);");
  today.setTime(today.getTime()+(86400000*3));
  beginMin = Math.floor(today.getTime()/1000);
  today.setTime(today.getTime()+(86400000*57));
  beginMax = Math.floor(today.getTime()/1000);
  beginIs  = Math.floor(begin.getTime()/1000);
  if (beginIs<beginMin)
  {
    alert('Der fr�hest m�gliche Versicherungsbeginn ist in 3 Tagen!');
    which.focus();
    return false;
  }
  else if (beginIs>beginMax)
  {
    alert('Der sp�test m�gliche Versicherungsbeginn ist in 60 Tagen!');
    which.focus();
    return false;
  }
  else if (getAge(begin,born)>65)
  {
    alert('Der Versicherungsnehmer darf bei Versicherungsbeginn max. 65 Jahre alt sein!');
    which.focus();
    return false;
  }
  return true;
}

function checkDatumVonBis(which,msg,required)
{
  var isOk = true;
  if (required && which.value=='') isOk = false;
  else if (which.value!='')
  {
    if (which.value.charAt(2)!='.'&&which.value.charAt(7)!='-'&&which.value.charAt(10)!='.') isOk = false;
    if ( !testString(which.value.substring(0,2),'0123456789')&&!testString(which.value.substring(3,7),'0123456789')&&!testString(which.value.substring(8,10),'0123456789')&&!testString(which.value.substring(11),'0123456789') ) isOk = false;
    if ( pnParseInt(which.value.substring(0,2))<1||pnParseInt(which.value.substring(0,2))>12||pnParseInt(which.value.substring(8,10))<1||pnParseInt(which.value.substring(8,10))>12 ) isOk = false;
  }

  if (!isOk)
  {
    alert(msg);
    which.focus();
    return false;
  }
  return true;
}

function openTags() {
	document.getElementById("tagcloud").style.display = "block";
}

function closeTags() {
	document.getElementById("tagcloud").style.display = "none";
}

// #############################################################################

/**
 * Extracts the current menu id from the url and returns it
 */
var pageMenuId = '';
function extractMenuId() {
    // MenuId der Seite
    if (pageMenuId == '') {
        pageMenuId = window.location.href.match(/[0-9]{7}/)[0];
    }

    return pageMenuId;
}

/**
 * Extracts the current page name from breadcrumb navigation
 */
var pageName    = '';
function extractPageName() {
    if (pageName == '') {
        pageName = $('#brot span:last-child').text();
    }

    // breadcrumb not available => get pageName from main navigation
    if (pageName == '') {
        pageName = $('#subsubmarker').text();
    }

    if (pageName == '') {
        pageName = $('#submarker, #submarkerlast').text();
    }

    if (pageName == '') {
        pageName = $('#marker, #markerlast').text();
    }

    return pageName;
}


/**
 * Gibt die debug-Nachricht aus
 *
 * @param message debug-Nachricht
 */
var printDebug              = function(message) {
    if (false) {
        if (typeof message == "Array") {
            var text  = "";
            for (var i = 0; i < message.length; ++i) {
                text += message[i];
            }

            message = text;
        }

        alert(message);
    }
}

/**
 * Liefert alle geoeffneten Contentboxen des aktuellen Reiters, der mit der
 * Reiternummer identifiziert wird.
 *
 * @param reiterNummer die Nummer des aktuellen Reiters
 * @returns Array die geoeffneten Contentboxen
 */
function getOpenContentBlocks(reiterNummer) {
    var openBlocks = $('#reitercontainer-' + reiterNummer).find('.opener_closer_open');

    /**
     * Extrahiere die Headline einer Contentbox in Reiter
     *
     * @param contentbox    Contentbox-Element, das unterhalb der Headline angezeigt wird
     */
    var getContentblockHeadline   = function (contentblock) {

        if (contentblock == null || typeof contentblock == 'undefined') {
            printDebug('contentblock is undefined');
        }
        return $(contentblock).siblings('.headline').text().replace(/^\s+/, '')
            .replace(/\s+$/, '');
    }

    var getHeadlines  = function() {
        var headlines   = '';
        $(openBlocks).each(function() {
            headlines   += (',' + getContentblockHeadline(this));
        });

        return headlines.substr(1);
    }

    this.cb_headlines  = getHeadlines();

    printDebug(openBlocks);

    return this;
}

/**
 * Liefert bestimmten Reiter mit Namen und Nummer zurueck
 *
 * Wenn der uebergebene Parameter element nicht gesetzt ist, wird der
 * aktuell geoeffnete Reiter zurueckgegeben. Dieser wird anhand der Klasse
 * ".highTab" als Kindelement von ".reiternavi" identifiziert.
 *
 * Name und Nummer des Reiters koennen ueber die oeffentlichen Variablen
 * rt_name und rt_nummer ausgelesen werden.
 *
 * <code>
 *   var currentReiter  = getReiter();
 *   var reiterName     = currentReiter.rt_name;
 *   var reiterNummer   = currentReiter.rt_nummer;
 * </code>
 *
 * @param element Reiternavigationselement
 * @returns Reiterobject
 */
function getReiter(element) {
    var reiter;

    if (typeof element == 'undefined') {
        reiter = $('.reiternavi').find('.highTab');
    } else {
        reiter = $(element);
    }

    /**
     * Extrahiert die Nummer des Reiters auf dem id-Attribut.<b>
     *
     * Die Nummer des Reiters steht nach dem letztem "-"
     *
     * @param reiter Reiterelement (Tabellenzelle: .highTab)
     * @return Nummer des Reiters
     */
    var getReiterNummer  = function (reiter) {
        var reiterid    = $(reiter).attr('id');
        
        if ( reiterid == undefined )
        	return;
        
        // hole Counter des Reiters: Zeichen nach "-"
        var limiterpos  = reiterid.lastIndexOf('-');

        return reiterid.substring(limiterpos + 1);
    }

    this.rt_nummer = getReiterNummer(reiter);
    this.rt_name   = $(reiter).find('.tabText').text().replace(/^\s+/, '')
        .replace(/\s+$/, '');

    printDebug('[getReiter] ' + this.rt_nummer + ": " + this.rt_name);

    return this;
}

/**
 * Liefert bestimmten Contentblock mit Id und Namen zurueck.
 *
 * Der uebergebene Parameter element ist der HeadlineContainer des Contentblocks
 *
 * Name und Id des Contentblocks koennen ueber die oeffentlichen Variablen
 * cb_name und cb_id ausgelesen werden.
 *
 * <code>
 *   var contentblock       = getContentblock(headlinecontainer);
 *   var contentblockId     = contentblock.cb_id;
 *   var contentblockName   = contentblock.cb_name;
 * </code>
 *
 *
 * @param element .headlinecontainer des Contentblocks
 * @returns Contentblockobjekt
 */
function getContentblock(element) {
    var contentblock    = $(element).parents('.toggleablebox')[0];

    this.cb_id     = '';
    this.cb_name   = '';

    if (typeof contentblock == 'undefined') { return this; }

    this.cb_id     = $(contentblock).attr('id');
    this.cb_name   = $(contentblock).children('.headlinecontainer')
        .children('.headline').text().replace(/^\s+/, '').replace(/\s+$/, '');

    return this;
}

/**

*/
function writePNG(id, url, width, height){
	var aktionsboxKennzeichen = document.getElementById(id);
	aktionsboxKennzeichen.style.width = width;
	aktionsboxKennzeichen.style.height = height;

	aktionsboxKennzeichen.style.backgroundRepeat="no-repeat";
	if (navigator.appName == 'Microsoft Internet Explorer') {
		aktionsboxKennzeichen.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"')";
	}
	else {
		aktionsboxKennzeichen.style.backgroundImage="url('"+url+"')";
	}
}


function printLayer() {
	 try {
	 var newWindow = window.open('../../menu/-1_eAXAWEB-DRUCKANSICHT/index.html', 'printview', 'width=650,height=550,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes');
	 /*
	
	var fnc = function(){
	var obj = newWindow.document.getElementById('printBody');
	 obj.innerHTML = document.getElementById('bs2009_middle').innerHTML;
	 newWindow.focus();
	 newWindow.print();
	 }
	 setTimeout(fnc, 1000);
	 */
	 } catch (e) {
	 }
	 if(!jQuery('.pbcontent').parent().hasClass('wide')){
//		 jQuery('.pbcontent').css('width', '586px');
	 }else{
		 jQuery('.pbcontent').addClass('wide');
	 }
} 





/*
* jQuery SelectBox - v1.0 - 05/14/2010
* http://github.com/cravler/jquery-selectbox/
*
* Copyright (c) 2010 "Cravler"
* Dual licensed under the MIT and GPL licenses.
*/
(function($) {
	$.selectbox = function() {

		if ($.browser.msie && parseInt($.browser.version) < 6) {
			return;
		}

		var _this      = this;
		var focused    = false;
		var moved      = true;
		var mouse_over = null;

		_this._onchange = _this.onchange; _this.onchange  = null;
		_this._onclick  = _this.onclick;  _this.onclick   = null;

		var list = (_this.size || _this.multiple) ? true : false;

		var elem         = $(_this).hide().change(onchange_select);
		var elem_width   = elem.width() + (list ? 5 : 0);
		var selectbox    = elem.wrap('<div class="selectbox' + (list ? ' list' : '') + (_this.disabled ? ' disabled' : '') + '" />').parent('.selectbox');
		var list_visible = list ? true : false;
		var current_html = '<div class="current">' + '<div class="down-arrow">&nbsp;</div>' + '<div class="title">%default_content%</div>' + '</div>';

		// Wrap select tag and provide a default option
		selectbox.append(
			current_html.replace('%default_content%', selectbox.find('select option:selected').text())
		);

		if( ! list && _this.disabled) {
			return;
		}

		// Click outside
		selectbox.bind('clickoutside', function() {

			$(this).find('.down-arrow').removeClass('down-arrow-hover');

			if(typeof _this._onblur == 'function') {
				_this._onblur();
				_this.onblur  = _this._onblur;
				_this._onblur = null;
			}

			focused = false;
			if(typeof _this._onfocus == 'function') {
				_this.onfocus  = _this._onfocus;
				_this._onfocus = null;
			}

			if (list_visible) {

				if ( ! list) {
					/*if ($.browser.msie && parseInt($.browser.version) == 7) {
						$('.selectbox').each(function() {
							if ( ! $(this).hasClass('selected')) {
								$('.selectbox').css('z-index', 0);
							}
						});
						selectbox.removeClass('selected');
					}*/
					dropdown.hide();
					list_visible = false;
				}

				if(typeof _this.onblur == 'function') {
					_this._onblur = _this.onblur;
					_this.onblur  = null;
				}

				if ( ! list) {
					focused = true;
					if(typeof _this.onfocus == 'function') {
						_this._onfocus = _this.onfocus;
						_this.onfocus  = null;
					}
				}
			}
		});

		// Hover
		if ( ! list) {
			selectbox.hover(
				function () {
					$(this).find('.down-arrow').addClass('down-arrow-hover');
				},
				function () {
					if (!list_visible) {
						$(this).find('.down-arrow').removeClass('down-arrow-hover');
					}
				}
			);
		}

		var dropdown = selectbox.append('<ol />').children('ol');

		var size = _this.size ? _this.size : 20;
		if (_this.options.length > size) {
			dropdown.css({
				"height"   : (size * 12) + "px"
			});
		}

		$(_this).find('option').each(function() {
			var _option = this;
			var option  = $(this);

			var li = $('<li>' + '<div class="title">' + option.text() + '</div>' + '</li>');
			li.data('boxvalue', option.val());

			dropdown.append(li);

			if (list && option.attr('selected')) {
				li.addClass('li-hover');
				selectbox.children('ol').animate({scrollTop: '+=' + (li.offset().top - selectbox.children('ol').offset().top) + 'px'}, 0);
			}

			if(list && _this.disabled) {
				return;
			}

			li.hover(function () {
				if (moved && ! list) {
					mouse_over = $(this).data('boxvalue');
					dropdown.find('li').each(function() {
						$(this).removeClass('li-hover');
					});
					$(this).addClass('li-hover');
				}
			},function () {
				// unhover
			}).mousemove(function() {
				moved = true;
				option.mousemove();
			}).mouseenter(function() {
				option.mouseover();
			}).mouseleave(function() {
				option.mouseout();
			}).mousedown(function() {
				option.mousedown();
			}).mouseup(function() {
				option.mouseup();
			}).click(function() {

				if (list) {

					focused = true;
					if(typeof _this.onfocus == 'function') {
						_this.onfocus();
						_this._onfocus = _this.onfocus;
						_this.onfocus  = null;
					}

					if (_this.multiple) {

						if (typeof _this._onchange == 'function') {
							_this._onchange();
						}

						if (typeof _option.onclick == 'function') {
							_option.onclick();
						}

						if (typeof _this._onclick == 'function') {
							_this._onclick();
						}

						if ($(this).hasClass('li-hover')) {
							$(this).removeClass('li-hover');
						}
						else {
							$(this).addClass('li-hover');
						}
					}
					else {
						elem.val($(this).data('boxvalue'));
						dropdown.find('li').each(function() {
							$(this).removeClass('li-hover');
						});
						$(this).addClass('li-hover');
					}
				}
				else {
					elem.val($(this).data('boxvalue'));
				}

				if(typeof _this.onblur == 'function') {
					_this._onblur = _this.onblur;
					_this.onblur  = null;
				}

				if (_this.multiple) {
					if (option.attr('selected')) {
						option.attr('selected', false);
					}
					else {
						option.attr('selected', true);
					}
				}
				else {
					elem.change();
				}
			});
		});

		$(document).keydown(function(event) {
			if(focused) {
				if (list_visible && event.keyCode == '13') {
					dropdown.find('li').each(function() {
						if ($(this).hasClass('li-hover')) {
							elem.val($(this).data('boxvalue')).change();
							return false;
						}
					});
					return false;
				}
				else if (event.keyCode == '38' || event.keyCode == '40') {

					var prev     = null;
					var next     = null;
					var selected = mouse_over != null ? mouse_over : selectbox.find('select option:selected').val();

					moved      = false;
					mouse_over = null;

					dropdown.find('li').each(function() {
						if(selected == $(this).data('boxvalue')) {
							if (selected != selectbox.find('select option:first').val()) {
								prev = $(this).prev();
							}
							if (selected != selectbox.find('select option:last').val()) {
								next = $(this).next();
							}
						}
					});

					if (event.keyCode == '38' && prev != null) {
						if (list_visible) {
							dropdown.find('li').each(function() {
								$(this).removeClass('li-hover');
								if (prev.data('boxvalue') == $(this).data('boxvalue')) {
									var title = $(this).find('div.title').text();
									selectbox.find('.current .title').text(title);
									$(this).addClass('li-hover');

									if (($(this).offset().top - selectbox.children('ol').offset().top) < 0) {
										selectbox.children('ol').animate({scrollTop: '+=' + ($(this).offset().top - selectbox.children('ol').offset().top) + 'px'}, 0);
									}
									elem.val(prev.data('boxvalue'));
								}
							});
						}
						else {
							elem.val(prev.data('boxvalue')).change();
						}
					}
					else if (event.keyCode == '40' && next != null) {
						if (list_visible) {
							dropdown.find('li').each(function() {
								$(this).removeClass('li-hover');
								if (next.data('boxvalue') == $(this).data('boxvalue')) {
									var title = $(this).find('div.title').text();
									selectbox.find('.current .title').text(title);
									$(this).addClass('li-hover');

									if (($(this).offset().top - selectbox.children('ol').offset().top) >= dropdown.height()) {
										selectbox.children('ol').animate({scrollTop: '+=' + ($(this).offset().top - selectbox.children('ol').offset().top - dropdown.height() + 21) + 'px'}, 0);
									}
									elem.val(next.data('boxvalue'));
								}
							});
						}
						else {
							elem.val(next.data('boxvalue')).change();
						}
					}

					return false;
				}
			}
		});

		selectbox.find('.current').mousemove(function() {
			if(typeof _this.onmousemove == 'function') {
				_this.onmousemove();
			}
		}).mouseenter(function(){
			if(typeof _this.onmouseover == 'function') {
				_this.onmouseover();
			}
		}).mouseleave(function(){
			if(typeof _this.onmouseout == 'function') {
				_this.onmouseout();
			}
		}).mousedown(function() {
			if(typeof _this.onmousedown == 'function') {
				_this.onmousedown();
			}
		}).mouseup(function() {
			if(typeof _this.onmouseup == 'function') {
				_this.onmouseup();
			}
		}).click(function() {

			focused = true;
			if(typeof _this.onfocus == 'function') {
				_this.onfocus();
				_this._onfocus = _this.onfocus;
				_this.onfocus  = null;
			}

			if(typeof _this._onclick == 'function') {
				_this._onclick();
			}

			if (list_visible) {

				/*if ($.browser.msie && parseInt($.browser.version) == 7) {
					$('.selectbox').each(function() {
						if ( ! $(this).hasClass('selected')) {
							$('.selectbox').css('z-index', 0);
						}
					});
					selectbox.removeClass('selected');
				}*/

				if ( ! list) {
					dropdown.hide();
					list_visible = false;
				}
			}
			else {

				/*if ($.browser.msie && parseInt($.browser.version) == 7) {
					selectbox.addClass('selected');
					$('.selectbox').each(function() {
						if ( ! $(this).hasClass('selected')) {
							$(this).css('z-index', -1);
						}
					});
				}*/

				list_visible = true;
				dropdown.show();

				dropdown.find('li').each(function() {
					$(this).removeClass('li-hover');
					if(selectbox.find('select option:selected').val() == $(this).data('boxvalue')) {
						$(this).addClass('li-hover');
						selectbox.children('ol').animate({scrollTop: '+=' + ($(this).offset().top - selectbox.children('ol').offset().top) + 'px'}, 0);
					}
				});
			}
		});

		return;

		function onchange_select() {
			var title = $(this).find('option:selected').text();
			if ( ! list) {
				selectbox.children('ol').hide();
				list_visible = false;
			}
			selectbox.find('.current .title').text(title);

			if(typeof this._onchange == 'function') {
				this._onchange();
			}

			//$(this).find('option:selected').click();

			if(typeof this._onclick == 'function') {
				this._onclick();
			}
		}
	};

	$.fn.selectbox = function() {
		this.each($.selectbox);
		return this;
	};
})(jQuery);

/*
* jQuery outside events - v1.1 - 3/16/2010
* http://benalman.com/projects/jquery-outside-events-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,c,b){$.map("click dblclick mousemove mousedown mouseup mouseover mouseout change select submit keydown keypress keyup".split(" "),function(d){a(d)});a("focusin","focus"+b);a("focusout","blur"+b);$.addOutsideEvent=a;function a(g,e){e=e||g+b;var d=$(),h=g+"."+e+"-special-event";$.event.special[e]={setup:function(){d=d.add(this);if(d.length===1){$(c).bind(h,f)}},teardown:function(){d=d.not(this);if(d.length===0){$(c).unbind(h)}},add:function(i){var j=i.handler;i.handler=function(l,k){l.target=k;j.apply(this,arguments)}}};function f(i){$(d).each(function(){var j=$(this);if(this!==i.target&&!j.has(i.target).length){j.triggerHandler(e,[i.target])}})}}})(jQuery,document,"outside");

function openPlayer(flashPath, headerLine){
	var head = headerLine;
	if (head == undefined || head == null || head==""){
		head = "Video";
	}
	if($("#bs2009_middle div").hasClass('video_layer')){
		$('#bs2009_middle .video_layer').show();	
	}else{
		$("#bs2009_middle").append('<div class="video_layer" style="top: 250px;">'
				+'<div class="header">'
				+'<div class="headline">'+head+'</div>'
				+'<div class="closer" onclick="closeVideoPlayer();">&nbsp;</div></div>'
				+'<div class="innerBox"><div class="content">&nbsp;</div></div></div>');
		$('#bs2009_middle .video_layer').show();		
	}
	/**
     * Fuege den entsprechenden HTML-Schnipsel in dem
     * das Flashvideo angezeigt werden soll in den
     * Content des Video layers ein
     */
    $('.video_layer .innerBox .content').html('<div id="hr_video_flashcontent"><strong>You need to upgrade your Flash Player to version 9<\/strong><\/div>');
    
    /**
     * Benutze SWFObject um das Flash-Video einzubinden
     */
    var flashvars = {};
    flashvars.videoFile = flashPath;
    flashvars.autoPlay = "true";
    var params = {};
    params.quality = "best";
    params.bgcolor = "#ffffff";
    params.base = "";
    params.allowScriptAccess = "always";
    var attributes = {};
    /*attributes.id = "flashVideoplayer";*/
    attributes.id = "hr_video_flashcontent";
    swfobject.embedSWF("/axaweb/flash/bs2009/hr/videoplayer.swf", "hr_video_flashcontent", "400", "260", "8.0.0", "", flashvars, params, attributes);
    
}
function closeVideoPlayer(){
	$('#bs2009_middle .video_layer').hide();
	$('#bs2009_middle .video_layer .innerBox .content').html('');
}
function addMarkerForTable(cl, trSize) {
	var x = cl-1;
	$('table.t-white tr th:eq('+cl+')').addClass('d-blue');
	$('table.t-white tr th:eq('+cl+')').wrapInner('<div class="h"><div class="highlight"><div class="top-round-th"><div class="bottom-round-th" /></div></div></div>');
	$('table.t-white tr th:eq('+cl+') .top-round-th').before('<div class="top-img-ie" />');
	$('table.t-white tr th:eq('+x+')').css('border-right', 'none');
//	$('table.t-white tr:eq(1) td:eq('+cl+')').css('border', 'none');
	
	$('table.t-white tr').each(function(){
		$(this).find('td:eq('+cl+')').addClass('d-blue');
		$(this).find('td:eq('+x+')').css('border-right', 'none');
		$(this).find('td:eq('+cl+')').wrapInner('<div class="h" />');
	});
	$('table.t-white tr:last td:eq('+cl+')').removeClass('d-blue');
	$('table.t-white tr:eq('+(trSize-3)+') td:eq('+cl+') .h').addClass('last-td');
	/*$('table.t-white tr:eq('+(trSize-3)+') td:eq('+cl+')').css('padding-bottom', '0');*/
	$('table.t-white tr:eq('+(trSize-2)+') td:eq('+cl+') .h').append('<div class="highlight-bottom" />');
	$('table.t-white tr:eq('+(trSize-2)+') td').css({padding: '0',border: 'none'});
	$('table.t-white tr:last td:eq('+x+')').css('border-right', '1px solid #D2D2D2');
	if(cl == 3){
		$('table.t-white .d-blue').css({'background-position': 'right center'});
		if($.browser.msie){
			$('table.t-white th.d-blue .highlight').css('left', '1px');
			$('table.t-white .d-blue .h').css({ 'left': '20px'});
			$('table.t-white th.d-blue .h').css({ 'left': '10px'});
			$('table.t-white td.d-blue .highlight-bottom').css('left', '1px');
		}else{
			$('table.t-white th.d-blue .highlight').css('left', '-10px');
			$('table.t-white .d-blue .h').css({'padding-left': '25px', 'width': '120px'});
			$('table.t-white td.d-blue .highlight-bottom').css('left', '15px');
		}
	}
}

jQuery(document).ready(function(){

	if(organummer){
		/*prod*/
		$('a[href="../../menu/1004881/index.html"]').attr('href', '#').click(function () { 
			top.callKontaktPopup('1054545','false'); 
		});
		/*dev*/
		$('a[href="../../menu/1199812/index.html"]').attr('href', '#').click(function () {
			top.callKontaktPopup('1054545','false'); 
		});		
		
		
	}
	
	
	/*
	 * Parameter aus URL auslesen und die jeweilige Spalte in der Leistungstabelle markieren
	 */
	if($('.maincontent table').hasClass('t-white')){
		var url = location.href;
		var cl1 = url.indexOf('cl=1');
		var cl2 = url.indexOf('cl=2');
		var cl3 = url.indexOf('cl=3');
		var trSize = $('table.t-white tr').size();
		if ($.browser.msie) {
			$('.maincontent .t-white td:first-child').css('border-left', '1px solid #D2D2D2');
			$('.maincontent .t-white tr:last-child td').css('border-bottom', '1px solid #D2D2D2');
			$('.maincontent .t-white th:last-child').css('border-right', 'none');
		}
		if(cl1 != -1){
			addMarkerForTable(1, trSize);
		}else if(cl2 != -1){
			addMarkerForTable(2, trSize);
		}else if(cl3 != -1){
			addMarkerForTable(3, trSize);
		}
	}
	
	/*
	 * Wenn es einen neuen Sidebarteaser gibt, dann setzte hier die Ueberschrift aus dem Layer (sidebar-headline),
	 * diese ist die Seitenueberschrift des Teasers.
	 */
	$('.sidebar-neu div').each(function(){
		if($(this).hasClass('sidebar-headline')){
			var teaserHead = $(this).parent().find('.sidebar-headline').text();
			$(this).parent().find('h3.teaser-head').text(teaserHead);
			
		}

		/*
		 * Wenn der neue Sidebarteaser einen Layer mit der Klasse: sidebar-link enthaelt,
		 * dann ersetze den Link im Layer 'info-layer'.
		 */
		if($(this).hasClass('sidebar-link')){
			var teaserLink = $(this).parent().find('.sidebar-link a').attr("href");
			$(this).parent().find('.info-link a').attr('href', teaserLink);
		}
	});

	
	// set style for teaser-box, if there are more then one box, show other style
	var tbSize = jQuery('.teaser-box').size();
	for(var i = 0; i<tbSize; i++){
		jQuery('.teaser-box:eq('+i+')').addClass('b'+i);
		var boxSize = jQuery('.teaser-box.b'+i+' .t-box-content ').size();
		jQuery('.teaser-box.b'+i).addClass('box'+boxSize);
		if(boxSize>1){
			jQuery('.teaser-box.b'+i+' .t-box-content:last').css('margin-right', '0');
			
			jQuery('.teaser-box.b'+i+' .teaser-box-container').addClass('btn-bottom');
			var firstBox = jQuery('.teaser-box.b'+i+' .t-box-content:first ').outerHeight();
			var lastBox = jQuery('.teaser-box.b'+i+' .t-box-content:last ').outerHeight();
//			alert("firstBox: "+firstBox+" lastBox: "+lastBox);
			if(firstBox > lastBox){
				jQuery('.teaser-box.b'+i+' .t-box-content:last ').css('height', (firstBox+46)+'px');
				jQuery('.teaser-box.b'+i+' .t-box-content:first').css('height', (firstBox+46)+'px');
			}else{
				jQuery('.teaser-box.b'+i+' .t-box-content:first').css('height', (lastBox+46)+'px');
				jQuery('.teaser-box.b'+i+' .t-box-content:last ').css('height', (lastBox+46)+'px');
			}
		}else{
//			alert("i: "+i);
//			var firstBox = jQuery('.teaser-box.b'+i+' .t-box-content ').outerHeight();
//			jQuery('.teaser-box.b'+i+' .t-box-content ').css('height', (firstBox)+'px');
			
		}
		
	}
	

	jQuery('.toggle-box-blue-w .head').unbind().bind('click', function(){
		if(jQuery(this).parent().parent().hasClass('closed')){
			jQuery(this).parent().parent().removeClass('closed');
		}else{
			jQuery(this).parent().parent().addClass('closed');			
		}
	});
	
	// neue Toggleboxen fuer die FAQ Seite
	jQuery('.toggle-box-blue-w').each(function(){
		jQuery(this).find('.toggle-box:last').addClass('last-element');
	});
	jQuery('.toggle-box-blue-w .toggle-box .t-b-header').unbind().bind('click', function(){
		if(jQuery(this).hasClass('opened')){
			jQuery(this).removeClass('opened');
			jQuery(this).siblings('.t-b-content').removeClass('opened-item');
		}else{
			jQuery(this).addClass('opened');			
			jQuery(this).siblings('.t-b-content').addClass('opened-item');
		}
	});
	
	
	jQuery('.doppel-box-blau .box:first').css('border-right', '1px solid #ffffff');
	jQuery('.doppel-box-blau .box:last ').css('border-right', '1px solid #ffffff');
	/*	Help Tips	*/
	jQuery(".tipIcon").each(function(){
		jQuery(this).mouseenter(function(){
			pos = jQuery(this).position();
			jQuery(this).next(".tipItem").css("left",pos.left+10);
			jQuery(this).next(".tipItem").css("top",pos.top-10);
			jQuery(this).next(".tipItem").addClass("show");
		});
		jQuery(this).mouseleave(function(){
			jQuery(this).next(".tipItem").removeClass("show");
		});
	});
	/* set style for select boxes */
	jQuery('.transformSelectBox').selectbox();

	// z-index fix for ie7 and ie6
	if(jQuery('.selectbox').length >0){
		var selectbox = jQuery('.selectbox').length;
		for(var i = 0; i<selectbox; i++){
			jQuery(".selectbox:eq("+i+")").css("z-index", 100-i);
		}		
	}
	
	jQuery('#maincontent .reiternavi.k-herbst2011').unbind().bind('click', function() {
		jQuery('.AxaSwitchHeadline3').each(function(){
			sIFR.replace( itc_franklin_gothik_std_med_ohne_switch, {
				selector: '.AxaSwitchHeadline3',
				wmode:'transparent',
				tuneHeight: '-6',
				css: ['.sIFR-root { text-align: left; color: #103184; font-size:20; letter-spacing:0.5;}']
			});
		});
		jQuery('.AXASwitchHeadline16px').each(function(){
			sIFR.replace( itc_franklin_gothik_std_med_ohne_switch, {
				selector: '.AxaSwitchHeadline3',
				wmode:'transparent',
				tuneHeight: '-6',
				css: ['.sIFR-root { text-align: left; color: #103184; font-size:16; letter-spacing:0.5;}']
			});
		});
	});

	// Togglebox fuer den Adminbereich
	if($('.wrapper-copy-to-cms7 .container-copy-to-cms7 p').hasClass('errormsg')){
		$('.wrapper-copy-to-cms7 .container-copy-to-cms7').show();
	}
	$('.wrapper-copy-to-cms7 .open-to-copy').click(function(){
		$(this).parent().find('.container-copy-to-cms7').toggle("fast");
	});
	
jQuery('#maincontent .reiternavi.k-herbst2011').parent().find('.reiternavi_content').addClass('k-herbst2011-c');

});
/*	SWFObject v2.0 <http://code.google.com/p/swfobject/>
Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();
