function fensterinfo(){
         alert("Höhe: "+Fensterhoehe());
         alert("Breite: "+Fensterweite());
}

function chk_links(){
         if(gup('vertriebspartner')!=""){
              navigate('download_vertrieb');
            }
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}


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) {
    document.getElementsByTagName("body")[0].style.setAttribute("height", "100%", "false");
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}

var Weite;
var Hoehe;

function neuAufbau_large() {
      Weite = Fensterweite();
      Hoehe = Fensterhoehe();
      makeSmall();
}

function makeSmall(){
         var str_t="";
         if(gup('vertriebspartner')!=""){
              str_t="?vertriebspartner="+ gup('vertriebspartner');
            }

         if((Weite < 1000) || (Hoehe < 770)){
            window.open("kl.php"+str_t,"_self");
         }else{
            if(gup('vertriebspartner')!=""){
              navigate('download_vertrieb');
            }
         }
}

function neuAufbau_small() {
      Weite = Fensterweite();
      Hoehe = Fensterhoehe();
      makeBig();
}

function makeBig(){
         if((Weite > 1000) && (Hoehe > 770)){
          var str_t="";
            if(gup('vertriebspartner')!=""){
              str_t="?vertriebspartner="+ gup('vertriebspartner');
            }
            window.open("index.php"+str_t,"_self");
         }
}


$(function(){
                     $.fn.supersized.options = {
                             startwidth: 1024,
                             startheight: 768,
                             minsize: .50,
                             slideshow: 0,
                             slideinterval: 5000
                     };
                     $('#supersize').supersized();
                });


/* WEICHE */



var smallStylesheetLink = "small.css";
var normalStylesheetLink = "normal.css";

function setStyle() {
 var width, height;
 if(window.innerWidth) {
     width = window.innerWidth;
     height = window.innerHeight;
 }
 else if(document.documentElement.clientWidth) {
     width = document.documentElement.clientWidth;
     height = document.documentElement.clientHeight;
 }
 else if(document.body.clientWidth) {
     width = document.body.clientWidth;
     height = document.body.clientHeight;
 }
 var stylesheetLink = document.getElementById("stylesheetLink");
 var useSmall = (width <= 940 && height <= 800);
 //stylesheetLink.setAttribute("href", (useSmall ? smallStylesheetLink : normalStylesheetLink));
 if(width<1000 || height<800){

 //window.open('index_small.html','_self');
 }
}

function getSize() {
 var width, height;
 if(window.innerWidth) {
     width = window.innerWidth;
     height = window.innerHeight;
 }
 else if(document.documentElement.clientWidth) {
     width = document.documentElement.clientWidth;
     height = document.documentElement.clientHeight;
 }
 else if(document.body.clientWidth) {
     width = document.body.clientWidth;
     height = document.body.clientHeight;
 }
 alert("Höhe: "+height+"px");
 alert("Breite: "+width+"px");
}


// Menuefunktionen Anfang

function hideAllMenues(){
       for(var i=1;i<7;i++){
             document.getElementById("untermenue_"+i).style.display="none";
       }
}

function showmenue(pInt){
         hideAllMenues();
         document.getElementById("untermenue_"+pInt).style.display="block";
}

// Menuefunktionen Ende

// Navigation Anfang

var arrProjekt = new Array();

var arrContents = new Array('download_vertrieb','aktuelles','downloads','kundenmonitor','presse_uebersicht','unternehmen','philosophie','team','impressum','kontakt','denkmal','projekt_uebersicht');

arrContents = arrPresse.concat(arrContents);

//Counter start
 function close_counter(p_no){
                                       document.getElementById("counter_"+p_no+"_content").style.display="none";
                                       document.getElementById("counter_"+p_no+"_bg").style.display="none";
                                       document.getElementById("counter_"+p_no+"_closed").style.display="block";
                              
                              		     document.getElementById("zaehler_yorckhof").style.display="none";
       					                       document.getElementById("zaehler_bk2").style.display="none";
                              
                              }
                              
                              


 function show_counter(p_no){
                                       document.getElementById("counter_"+p_no+"_content").style.display="block";
                                       document.getElementById("counter_"+p_no+"_bg").style.display="block";
                                       document.getElementById("counter_"+p_no+"_closed").style.display="none";
                                       document.getElementById("zaehler_yorckhof").style.display="block";
       				                         document.getElementById("zaehler_bk2").style.display="block";
                            }
//counter_end
function navigate(pItem){

         close_counter(1);
         for(var i=0;i<arrContents.length;i++){
             obj=document.getElementById("content_"+arrContents[i]);
             obj.style.display='none';
         }

         if(pItem!="start"){
            document.getElementById("content_"+pItem).style.display='block';
            obj=document.getElementById("counter_startseite").style.display='none';
         }else{

            obj=document.getElementById("counter_startseite").style.display='block';
            show_counter(1);
         }
         hideAllMenues();
}

// Navigation Ende


// Mouseover projekte_auswahl

function projekte_auswahl_mo(pObj){
         obj=document.getElementById("projekt_realisiert_hg_"+pObj);
         obj.className="auswahlblock_over";
}

function projekte_auswahl_mout(pObj){
         obj=document.getElementById("projekt_realisiert_hg_"+pObj);
         obj.className="auswahlblock";
}


// Aufklappen projekte

function zu_auf_klappen(pObj,pObj_id){
         obj=document.getElementById(pObj+'_'+pObj_id+'_pfeil');
         if((obj.src.substr((obj.src.length)-9,5))=="unten"){
             obj.src="images/inhalt/pfeil_rechts.png";
             obj=document.getElementById(pObj+'_'+pObj_id);
             obj.style.display='none';
         }else{
             if(pObj=='objekt_merkmale'){
               obj2=document.getElementById('objekt_zahlen_'+pObj_id+'_pfeil');
               if((obj2.src.substr((obj2.src.length)-9,5))=="unten"){
                           obj2.src="images/inhalt/pfeil_rechts.png";
                           obj2=document.getElementById('objekt_zahlen_'+pObj_id);
                           obj2.style.display='none';
               }
             }else{
               obj2=document.getElementById('objekt_merkmale_'+pObj_id+'_pfeil');
               if((obj2.src.substr((obj2.src.length)-9,5))=="unten"){
                           obj2.src="images/inhalt/pfeil_rechts.png";
                           obj2=document.getElementById('objekt_merkmale_'+pObj_id);
                           obj2.style.display='none';
               }
             }
             obj.src="images/inhalt/pfeil_unten.png";
             obj=document.getElementById(pObj+'_'+pObj_id);
             obj.style.display='block';
         }
}


// Mouseovereffekten

function makeOrange(pObj,pObj2){
         obj=document.getElementById(pObj);
         obj.style.color="#ee7d10";
         obj=document.getElementById(pObj2);
         obj.style.color="#ee7d10";
}

function makeWhite(pObj,pObj2){
         obj=document.getElementById(pObj);
         obj.style.color="#ffffff";
         obj=document.getElementById(pObj2);
         obj.style.color="#ffffff";
}

// Lange Text wird abgekurzt (umbruch)

function shortenText(pText,pMax){
         var textLen = pText.length;
         var ret=pText;
         if(textLen>pMax){
            var spacePos=0;
            var str_char="";
            var str_1="";
            var str_2="";

            for(var i=pMax-10;i<pMax;i++){
                str_char=pText.substr(i,1);
                if(str_char=" "){
                   spacePos=i;
                }
            }
            if (spacePos>0){
                str_1=pText.substr(0,spacePos);
                str_2=pText.substr(spacePos);
                ret=str_1+"<br />"+str_2;
            }
         }
         return ret;
}


// Bildergalerie

function play_pause(){
         var obj= document.getElementById('cmd_play_pause');
         var src= (obj.src);
         var vergleich= src.substr(src.length -10);
         //alert(vergleich);
         if(vergleich=="_pause.png"){
            obj.src="images/cmd_play.png";
            $.inAnimation = true;
                     //clearInterval(slideshow_interval);
            $.paused = true;
         }else{
            obj.src="images/cmd_pause.png";
            $.inAnimation = false;
                     //clearInterval(slideshow_interval);
            $.paused = false;
         }
}

function go_back(obj_id,feil){
         window.open(feil+'.php?obj_id='+obj_id,'_self');
}


function gotoForum(){
         alert('Dieser Bereich wird momentan für Sie aufbereitet');
}


function test(){

       /*  for (var i=0;i<arrProjekt.length;i++){
              alert(arrProjekt[i]);
         }

       */
       document.getElementById("zaehler_yorckhof").style.display="block";
       document.getElementById("zaehler_bk2").style.display="block";


}


