//if (document.all) document.onselectstart = function () { return false; }; 

cntState=false;

function SubmitPage(strURL)
{
    document.master.method ="POST";
    document.master.action = strURL;
    document.master.submit();
}

function SubmitPMPage(strURL)
{
    document.master.method ="POST";
    document.master.action = strURL;
    document.master.submit();
}

function SubmitColorPage(strURL)
{
    document.master.method ="POST";
    document.master.action = strURL;
    document.master.submit();
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function checkBrowser() {
        this.ver=navigator.appVersion;
        this.dom=document.getElementById?1:0;
        this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
        this.ie4=(document.all && !this.dom)?1:0;
        this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
        this.ns4=(document.layers && !this.dom)?1:0;
        this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5 );
        return this;
}

function makeObj(obj,nest) {
        this.el=0;
        this.css=0;

        if (bw.dom) {
                this.el=document.getElementById(obj);
                this.css=document.getElementById(obj).style;
                this.scrollHeight=this.el.offsetHeight;
                this.clipHeight=this.el.offsetHeight;
        } else if (bw.ie4) {
                this.el=document.all[obj];
                this.css=document.all[obj].style;
                this.scrollHeight=this.el.offsetHeight;
                this.clipHeight=this.el.offsetHeight;
	} else if (bw.ns4) {
	        if (!nest) {
			nest='';
		} else {
			nest='document.'+nest+'.';
		}
                this.el=eval(nest+'document.'+obj);
                this.css=eval(nest+'document.'+obj);
                this.scrollHeight=this.css.document.height;
                this.clipHeight=this.css.clip.height;
	}
        return this;
}

function createScrollLayer(boundinglayer,contentlayer,btnuplayer,btndownlayer,scrollspeed,timeout,id) {
        this.id=id;
        this.bound=new makeObj(boundinglayer);
        this.cont=new makeObj(contentlayer,boundinglayer);

        this.up=new makeObj(btnuplayer);
        this.down=new makeObj(btndownlayer);

        if (this.bound.clipHeight< this.cont.scrollHeight) {
                this.down.css.visibility='visible';
        }

	this.cont.css.top=0;
        this.cont.css.left=0;

	this.cont.css.visibility='visible';
//        this.cont.css.display='block';
        this.bound.css.visibility='visible';
        this.loaded=true;
        this.speed=scrollspeed;

        this.timeout=timeout;
        this.ypos=0;

        this.scroll=scroll;
        return this;
}

function scroll(direction) {
	if(this.loaded) {
                if(direction>0) {
	                this.loop=true;
	                if ( this.ypos>(-this.cont.scrollHeight+this.bound.clipHeight)) {
                                this.cont.css.top=(this.ypos=this.ypos-this.speed);
	                        if (this.loop) this.timer=setTimeout(this.id+'.scroll(1)',this.timeout);
	                        this.up.css.visibility='visible';
	                } else {
	                        this.down.css.visibility='hidden';
	                }
                } if (direction<0) {
	                this.loop=true;
		        if (this.ypos<0) {
                                this.cont.css.top=(this.ypos=this.ypos+this.speed);
	                        if (this.loop) this.timer=setTimeout(this.id+'.scroll(-1)',this.timeout);
				this.down.css.visibility='visible';
		        } else {
				this.up.css.visibility='hidden';
		        }
		} else if (direction==0) {
                        this.loop=false;
                        if (this.timer) clearTimeout(this.timer);
                }
        }
}


function scrollInit() {
	sl1=new createScrollLayer('divCont','divText','divUp','divDown',7,50,'sl1');
	sl2=new createScrollLayer('divCont2','divText2','divUp2','divDown2',7,50,'sl2');
	cntState=true;
}

function scrollHide() {
	MM_showHideLayers('divCont','','hide');
	MM_showHideLayers('divText','','hide');
	MM_showHideLayers('divCont2','','hide');
	MM_showHideLayers('divText2','','hide');
	MM_showHideLayers('divUp2','','hide');
	MM_showHideLayers('divDown2','','hide');
	MM_showHideLayers('divUp','','hide');
	MM_showHideLayers('divDown','','hide');
}

function toggle() {
	if (cntState) {
		MM_showHideLayers('OV3','','hide');
		scrollHide();
		MM_showHideLayers('OV2','','hide');
		MM_showHideLayers('OV1','','show');
		MM_showHideLayers('BG1','','hide');		
		cntState=false;
	} else {
		MM_showHideLayers('OV1','','hide');
		scrollInit();
		MM_showHideLayers('OV3','','show');
		MM_showHideLayers('BG1','','show');	
		cntState=true;
	}
}

function formRedirector(object) {
      var URL = object.options[object.selectedIndex].value;
      window.location.href = URL;
}

function setFormFocus() {
	document.forms[0].T1.focus(); 
	document.forms[0].T1.select();
}

function kandidat(art,base_path,sende_art,page,id) {
	url = base_path+"content.php?PAGE="+page+"&FUNCTION=beraterkontakt&ART="+sende_art+"&id="+id;
	document.forms.contact.action = url;
	document.forms.contact.submit();
}

bw=new checkBrowser();
