// JavaScript Document
//--------- Insert Flash -----------//
var output='';

if(document.layers) document.captureEvents(Event.MOUSEMOVE);

function start(){
  
}
//----------------------------------Mouse Position---------------------------------//
//------ Position eines Elementes.
//benutzung findeO(this) für absolute oben ----- findeL(this) für absolute Left
	function findeL(obj){ 
	var lPos = 0; 
	if (obj.offsetParent){ 
	while (obj.offsetParent){ 
	lPos += obj.offsetLeft 
	obj = obj.offsetParent; 
	} 
	} 
	else if (obj.x) 
	lPos += obj.x; 
	return lPos; 
	} 
	function findeO(obj){ 
	var oPos = 0; 
	if (obj.offsetParent){ 
	while (obj.offsetParent){ 
	oPos += obj.offsetTop 
	obj = obj.offsetParent; 
	} 
	} 
	else if (obj.y) 
	oPos += obj.y; 
	return oPos; 
	} 
//--------------------------
	
//----------------------------------Mouse Position---------------------------------//
//Flash Insert Funktionen
function showchartflash(id){ 
   if(FLASH_XML!='' && FLASH_XML!=null && document.getElementById("e-pop_chart")){
     if(id==0){
      flash_inhalt='<embed src="/images/flash/charts/'+ChartAuswahl+'?chartWidth='+Chartattr[0]+'&chartHeight='+Chartattr[1]+'" FlashVars="&dataXML='+FLASH_XML+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+Chartattr[0]+'" height="'+Chartattr[1]+'">';
      document.getElementById("e-pop_chart").innerHTML=flash_inhalt;
     }
     if(id==1){
       flash_inhalt='<embed src="/images/flash/charts/'+ChartAuswahl+'?chartWidth=430&chartHeight=340" FlashVars="&dataXML='+FLASH_XML+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="430" height="340">';
       document.getElementById("gesamtSeite").innerHTML='<div style="margin-top:0px; margin-right:10px; text-align:right;">'+
                                                        '<a href="javascript:location.reload()"><img src="/images/kundenbereich/chart_lupe-.jpg" border=0 alt="Grafik verkleinern"></a></div>'+
                                                        '<div style="margin-top:0px">'+flash_inhalt+'</div>';
     }
   }
}
function showchartflashepops(divIDent,id){   
   //alert(divIDent)
   if(FLASH_XML!='' && FLASH_XML!=null){
     if(id==0){
      flash_inhalt='<embed src="/images/flash/charts/'+ChartAuswahl+'?chartWidth='+Chartattr[0]+'&chartHeight='+Chartattr[1]+'" FlashVars="&dataXML='+FLASH_XML+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+Chartattr[0]+'" height="'+Chartattr[1]+'" class="'+divIDent+'_1">';
      document.getElementById(divIDent).innerHTML=flash_inhalt;
     }
     if(id==1){
       flash_inhalt='<embed src="/images/flash/charts/'+ChartAuswahl+'?chartWidth=430&chartHeight=340" FlashVars="&dataXML='+FLASH_XML+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="430" height="340">';
       document.getElementById("gesamtSeite").innerHTML='<div style="margin-top:0px; margin-right:10px; text-align:right;">'+
                                                        '<a href="javascript:location.reload()"><img src="/images/kundenbereich/chart_lupe-.jpg" border=0 alt="Grafik verkleinern"></a></div>'+
                                                        '<div style="margin-top:0px">'+flash_inhalt+'</div>';
     }
   }
}
function amiDatumInteger(){
  var date=new Date();  
  var dd=date.getDate();  
  var mm=date.getMonth() + 1;  
  var yy=date.getYear();  
  var HH=date.getHours();  
  var MM=date.getMinutes(); 
  var SS=date.getSeconds();
  return yy+''+mm+''+dd+''+HH+''+MM+''+SS;
}
function getDatum(){
  var date=new Date();  
  var dd=date.getDate();  
  var mm=date.getMonth() + 1;  
  var yy=date.getYear();  
  var HH=date.getHours();  
  var MM=date.getMinutes(); 
  var SS=date.getSeconds();
  return dd+'.'+mm+'.'+yy+'-'+HH+':'+MM;
}
function showflash(flash,DivID)
{
   
   //Flash vars für die Hauptseite//
   
   header='flash_header=1';    
     
   button_text_6=''; 
   button_link_6='button_link_6=/itseiten/kontakt.php';
   button_ziel_6='button_ziel_6=' ;
   //--neu--
   
   //var_searchname= 'var_searchname=search' ;
   button_link_search= 'button_link_search=/itseiten/search.php' ;
   button_ziel_search= 'button_ziel_search=cont' ;

   
   flagge_link_d='flagge_link_d=?language=de' ;
   flagge_ziel_d='flagge_ziel_d=' ;
   
   flagge_link_e='flagge_link_e=?language=en';
   flagge_ziel_e='flagge_ziel_e=' ;

   
   intro='intro=0'+Check_First_Load() ;
   xmas='xmas=0'; 
   neujahr='neujahr=0' ;

      
   verz='programm_verzeichnis=/images/flash/'
   
   
   id0text=neujahr+'&'+xmas+'&'+intro+'&'+button_text_1+'&'+button_link_1+'&'+button_ziel_1+'&'+
           button_text_2+'&'+button_link_2+'&'+button_ziel_2+'&'+
           button_text_3+'&'+button_link_3+'&'+button_ziel_3+'&'+
           button_text_4+'&'+button_link_4+'&'+button_ziel_4+'&'+
           button_text_5+'&'+button_link_5+'&'+button_ziel_5+'&'+
           button_text_6+'&'+button_link_6+'&'+button_ziel_6+'&'+
           feld1_text_1+'&'+feld1_text_2+'&'+feld1_link+'&'+feld1_ziel+'&'+
           feld2_text_1+'&'+feld2_text_2+'&'+feld2_link+'&'+feld2_ziel+'&'+
           var_searchname+'&'+button_link_search+'&'+button_ziel_search+'&'+
           flagge_link_d+'&'+flagge_ziel_d+'&'+flagge_link_e+'&'+flagge_ziel_e+'&'+
           verz+'&';
           
   
   falshsrc="/images/flash/firstload.swf?flash_header=2&"+id0text; 
   insertflash(falshsrc,DivID,900,270,'white');
}
function ChartInfo(Antwortid){
   alert(Antwortid);
   
}
function Check_First_Load(){
  if(getCookie("FirstLoad")==''){
    setCookie("FirstLoad");    
    return 1;
  }
  else{
    return 0;
  }
}

function insertflash(flash,DivID,width,height,vmode){       
       var fo = new SWFObject(flash, "testflash", width, height, "8.0.0", "");
       fo.addParam("wmode", vmode);
       fo.write(DivID);
}
function insertWerbung(flash,DivID,width,height,vmode){
    if(getCookie("Werbung")==''){
       document.getElementById("werbung").className='werbung';
       insertflash(flash,DivID,width,height,vmode)
       setCookie("Werbung");
    }
    else{      
      document.getElementById("werbung").innerHTML='';
    }
}
function hideWerbung(){
       document.getElementById("werbung").innerHTML='';
       document.getElementById("werbung").className='hideWerbung';
}
//Cookie Funktions//
function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}
//---------------- is integer und is float funktionen --------------------------//
function isInteger (s){
      var i;
      //if(s== null || s==''){s=0;}	  
      if (isEmpty(s))
      if (isInteger.arguments.length == 1) return 0;
      else return (isInteger.arguments[1] == true);
      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);

         if (!isDigit(c)) return false;
      }
      return true;
}
function isEmpty(s){
      return ((s == null) || (s.length == 0))
}
function isDigit (c){
      return ((c >= "0") && (c <= "9"))
}
function isFloat(s){
   if(s== null || s==''){return '0,00';}
   s=s.replace(",",".");
   sList=s.split(".");
   if(sList[1]==null || sList[1]==''){sList[1]='00';}
   if(isInteger(sList[0])==true && isInteger(sList[1])==true){
      return true;
   }
   return false;
}
//System Check 

function detectflash(){
	if ((navigator.appName == "Microsoft Internet Explorer" 
		&& navigator.appVersion.indexOf("Mac") == -1 
		&& navigator.appVersion.indexOf("3.1") == -1) 
		|| (navigator.plugins && navigator.plugins["Shockwave Flash"])
		|| navigator.plugins["Shockwave Flash 2.0"])
	{
		document.write("<b>OK</b>");
	}
	else {
		document.write("<b>nicht Aktive</b>");
	}
}
function detectJS(){
  document.write("<b>OK</b>");
}
function detectCookie(){
  setCookie("CheckCookie");
  if(getCookie("CheckCookie")==''){
	document.write("<b>nicht Aktive</b>");
  }
  else {
	document.write("<b>OK</b>");
  }
}
function detectBrowser(){
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	if ((browser=="Netscape"||browser=="Microsoft Internet Explorer")
	  && (version>=4))
	  {
	  document.write("<b>OK</b>");
	  }
	else
	  {
	  document.write("<b>nicht OK</b>");
	  }
}
 function checkBrowserName(name){
   var agent = navigator.userAgent.toLowerCase();
   if (agent.indexOf(name.toLowerCase())>-1) {
     return true;
   }
   return false;
 }
alteMarkierungsID='';
function MarkThisField(obj){
  if(alteMarkierungsID!=''){
    document.getElementById(alteMarkierungsID).style.backgroundColor=""
  }
   document.getElementById(obj.id).style.backgroundColor="yellow";
   alteMarkierungsID=obj.id;
}
function UnMarkThisField(obj){
   //document.getElementById(obj.id).style.backgroundColor=""
}
function radioWert(rObj) {
    for (var i=0; i<rObj.length; i++) if (rObj[i].checked) return rObj[i].value;
    return false;
  }
function select(obj){
  obj.className="selected";
}
function unselect(obj){
  obj.className="unselect";
}
function ChartInfo(obj,Antwortid){
   tempY1=findeO(obj);
   tempX1=findeL(obj);
    parent.document.getElementById("InformationFenster").style.marginTop = (-350)+"px";
    parent.document.getElementById("InformationFenster").className = "Chartdrillen";
	parent.document.getElementById("InformationFenster").innerHTML= '<div id="InformationFensterNav"><div style="float:left;">Chart Optionen</div><div style="float:right"><a href="javascript:hideInformationFenster(\'InformationFenster\');"><img src="/images/kundenbereich/menuButtonClose.jpg" style="width:50;height:22;border:0px;"></a></div></div><div id="InformationFensterInhalt"><p>'+
																	''+ 
															  '</div>';   
   
}
function stripHTML(str){ return str.replace(/<[^>]*>/g, "");}
function trim (str) {return str.replace(/[\n\r]/g, '').replace(/ +/g, ' ').replace(/^\s+/g, '').replace(/\s+$/g, ''); } 
function OnEnter(e)
{
	var keynum;
	var keychar;
	var numcheck;

	if(window.event) // IE
	{
	   keynum = e.keyCode;
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
	   keynum = e.which;
	}
	if(keynum==13) return true;
	else return false;
}
function hideInformationFenster(Divid){
  document.getElementById(Divid).innerHTML='';
  document.getElementById(Divid).className = "";
  document.getElementById(Divid).style.top = 0+"px";
  document.getElementById(Divid).style.left = 0+"px";
}
function help(obj,helpID){
  tempY1=findeO(obj);
  tempX1=findeL(obj); 
  document.getElementById("InformationFenster").className = "AnswerOption";
  document.getElementById("InformationFenster").style.top = (tempY1)+"px";
  document.getElementById("InformationFenster").style.left = (tempX1-248)+"px";
  document.getElementById("InformationFenster").innerHTML= '<div id="InformationFensterNav"><div style="float:left;">Information</div><div style="float:right"><a href="javascript:hideInformationFenster(\'InformationFenster\');"><img src="/images/kundenbereich/menuButtonClose.jpg" style="width:50;height:22;border:0px;"></a></div></div><div id="InformationFensterInhalt"><p>'+
															  '<div id="HelpFensterDiv" style="margin:10px"></div>'+																    
															'</div>'; 
  Ajax_Datensenden("/itseiten/kundenbreich/e-pops/inc/bib.inc.php?action=Info&InfoID="+helpID,'HelpFensterDiv');  
}
function helpInDiv(DIVID,helpID){
  Ajax_Datensenden("/itseiten/inc/info.php?InfoID="+helpID,DIVID);  
}
function calculate(){ //Kosten kalkulator
    fragen=document.getElementById("anzahlfragen").value;
    screening=document.getElementById("anzahlscreening").value*0.15;
    complet=document.getElementById("completes").value;
    rabatt=document.getElementById("neukundenrabatt").checked==true?0.8:1;
	
	document.getElementById("gesamtsumme").value=((fragen*complet*0.15)+(screening*complet))*rabatt+(' €');
	
}
function EmailCheck(mail){
   mail=mail.split("@");
   if(mail.length!=2) return false;
   mail1=mail[1].split(".");
   if(mail1.length!=2){
     return false;
   }
   return true;
}
function KontaktForumularSenden(){
    betreff=document.getElementById("Betreff");
    firma=document.getElementById("Firma");
    apname=document.getElementById("APName");
    telefon=document.getElementById("Telefon");
    email=document.getElementById("Email");
	fehler=0;
	if(fehler==0 && betreff.value==""){fehler=1;betreff.style.backgroundColor="yellow";}
	if(fehler==0 && firma.value==""){fehler=1;firma.style.backgroundColor="yellow";}
	if(fehler==0 && apname.value==""){fehler=1;apname.style.backgroundColor="yellow";}
	if(fehler==0 && telefon.value==""){fehler=1;telefon.style.backgroundColor="yellow";}
	if(fehler==0 && EmailCheck(email.value)==false){fehler=1;email.style.backgroundColor="yellow";}
	if(fehler==0){
		submitForm('KontaktFormular','/itseiten/inc/kontaktFormular.php','Information');	
	}
}
function BestellungForumularSenden(){
    LizenzVersion=document.getElementById("lizenzen");	
    firma=document.getElementById("Firma");
    apname=document.getElementById("APName");
    telefon=document.getElementById("Telefon");
    email=document.getElementById("Email");
	Fax=document.getElementById("Fax");
	adresse=document.getElementById("Adresse");
	postleitzahl=document.getElementById("PLZ");
	fehler=0;
	if(fehler==0 && LizenzVersion.value==""){fehler=1;LizenzVersion.style.backgroundColor="yellow";}
	if(fehler==0 && firma.value==""){fehler=1;firma.style.backgroundColor="yellow";}
	if(fehler==0 && apname.value==""){fehler=1;apname.style.backgroundColor="yellow";}
	if(fehler==0 && adresse.value==""){fehler=1;adresse.style.backgroundColor="yellow";}
	if(fehler==0 && postleitzahl.value==""){fehler=1;postleitzahl.style.backgroundColor="yellow";}
	if(fehler==0 && telefon.value==""){fehler=1;telefon.style.backgroundColor="yellow";}
	if(fehler==0 && Fax.value==""){fehler=1;Fax.style.backgroundColor="yellow";}
	if(fehler==0 && EmailCheck(email.value)==false){fehler=1;email.style.backgroundColor="yellow";}
	if(fehler==0){
		submitForm('KontaktFormular','/itseiten/inc/kontaktFormular.php','Information');	
	}
}
//---------------- Drag and Drop Divs---------------------
 
//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//*****************************************************************************
 
// Determine browser and version.
 
function Browser() {
 
  var ua, s, i;
 
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
 
  ua = navigator.userAgent;
 
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
 
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
 
  // Treat any other "Gecko" browser as NS 6.1.
 
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
 
var browser = new Browser();
 
// Global object to hold drag information.
 
var dragObj = new Object();
dragObj.zIndex = 0;
 
function dragStart(event, id) {
  var el;
  var x, y;
 
  // If an element id was given, find it. Otherwise use the element being
  // clicked on.
 
  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;
 
    // If this is a text node, use its parent element.
 
    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }
 
  // Get cursor position with respect to the page.
 
  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }
 
  // Save starting positions of cursor and element.
 
  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);
 
  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;
 
  // Update element's z-index.
 
  dragObj.elNode.style.zIndex = ++dragObj.zIndex;
 
  // Capture mousemove and mouseup events on the page.
 
  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}
 
function dragGo(event) {
 
  var x, y;
 
  // Get cursor position with respect to the page.
 
  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }
 
  // Move drag element by the same amount the cursor has moved.
 
  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";
 
  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}
 
function dragStop(event) {
 
  // Stop capturing mousemove and mouseup events.
 
  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}
function hideScrollbar(obj){
  document.getElementById(obj.id).style.overflowY="hidden";
}
function showScrollbar(obj){
  document.getElementById(obj.id).style.overflowY="auto";
}
function checkPopUpBlocker(){
 var ergebnis;
 var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
 if(mine){ 
	mine.close();
	ergebnis=false;
 }
 else{
	alert("Bitte POP-UP Blocker ausschalten und F5-Taste drücken.");
	ergebnis=true;
 }
 return ergebnis;
}
function Fensterweite () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function Fensterhoehe () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}
function getURLVaraible(variable){
	var strVars = window.location.search;
	strVars = strVars.replace("?","");
	var splitVars = new Array();
	var vars = new Array();
	splitVars = strVars.split("&");
	for(i=0;i<splitVars.length;i++)
	{
	var tmp = splitVars[i].split("=");
	var nname = tmp[0];
	vars[nname] = tmp[1];
	}

	//falls wir die variable "xyz" haben wollen:
	return(vars[variable]);
}
function decode_utf8(utftext) {  
           var plaintext = ""; var i=0; var c=c1=c2=0; 
           while(i<utftext.length) 
                { 
               c = utftext.charCodeAt(i); 
               if (c<128) { 
                    plaintext += String.fromCharCode(c); 
                     i++;} 
                else if((c>191) && (c<224)) { 
                   c2 = utftext.charCodeAt(i+1); 
                    plaintext += String.fromCharCode(((c&31)<<6) | (c2&63)); 
                    i+=2;} 
                 else { 
                    c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); 
                   plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63)); 
                  i+=3;} 
                } 
             return plaintext; 
}  
function genHex(){
	colors = new Array(14)
	colors[0]="0"
	colors[1]="1"
	colors[2]="2"
	colors[3]="3"
	colors[4]="4"
	colors[5]="5"
	colors[5]="6"
	colors[6]="7"
	colors[7]="8"
	colors[8]="9"
	colors[9]="a"
	colors[10]="b"
	colors[11]="c"
	colors[12]="d"
	colors[13]="e"
	colors[14]="f"

	digit = new Array(5)
	color=""
	for (i=0;i<6;i++){
	digit[i]=colors[Math.round(Math.random()*14)]
	color = color+digit[i]
	}
	return color;
}
function weiterleitung(url){
  if(url!=""){
	location.href=url;
  }
}
