//Onmouse over
function navButton(normal, active)
{
	this.normal=new Image();
	this.active=new Image();
	
	this.normal.src="/custom/bcd_relaunch/_gfx/"+normal;
	this.active.src="/custom/bcd_relaunch/_gfx/"+active;
	
}

function activate(imgName, onsrc)
{
	onimage = new Image();
	onimage.src = onsrc;
	
	document [imgName].src=onsrc;
}

function deactivate(imgName, offsrc)
{
	offimage = new Image();
	offimage.src = offsrc;
	
	document [imgName].src=offsrc;
}

//------------------------------------

//Add to favorites
function addfav(title,url)
{
	 if (document.all){
		window.external.AddFavorite(url,title)
	}
	else if (window.sidebar){
		window.sidebar.addPanel(title, url, "")
	}
}
//------------------------------------

//Print
function popup_print(url,pagetitle)
{
	var popup = window.open(url, pagetitle, "width=525,height=450,dependent=yes,locationbar=no,menubar=no,resizable=yes,status=no,scrollbars=yes");
}
//------------------------------------


//------------------------------------

function travel_tools_popup(e)

{

	if( !e ) e = window.event; 

	var target; 

	if( e.srcElement ) target = e.srcElement.options[e.srcElement.selectedIndex].value; 

	else if( e.target ) target = e.target.options[e.target.selectedIndex].value; 

  if (target!=''){	

	window.open(target, "Popup1", "width=400,height=560,dependent=yes,locationbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no");

         }

}

//------------------------------------

function travel_tools_popup2 (url) 
{

	var travel_tools_popup2 = window.open(url, "Popup1", "width=358,height=525,dependent=yes,locationbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no");
}

//------------------------------------

document.getElementsByClassName = function(cl) {
						var retnode = [];
						var myclass = new RegExp('\\b'+cl+'\\b');
						var elem = this.getElementsByTagName('*');
						for (var i = 0; i < elem.length; i++) {
						   var classes = elem[i].className;
						   if (myclass.test(classes)) retnode.push(elem[i]);
						   }
						return retnode;
}


function obsolete_checkTheForm(formname){
returnvalue = true;

		a1 = validatefield (formname, "name", "text");
		a2 = validatefield (formname, "surname", "text");
		a3 = validatefield (formname, "password", "password");
		a4 = validatefield (formname, "how_payed_attention", "select-one");
		a5 = validatefield (formname, "myselectbox", "select-multiple");
		a6 = validatefield (formname, "answer", "radio");
		a7 = validatefield (formname, "acceptterms", "checkbox");
		a8 = validatefield (formname, "test", "radio");
		a9 = validatefield (formname, "myselect", "select-multiple");
		a10 = validatefield (formname, "multitext", "textarea");
		a11 = validatefield (formname, "fileupload", "");

		sum = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11;
		
		
		if (sum > 0){
			returnvalue = false;
		}
	
		if (returnvalue == false){
				document.getElementById("finalerrortext" + 10000).style.display = 'block';
			}
			else{
				if (document.getElementById("finalerrortext" + 10000) != null){
						document.getElementById("finalerrortext" + 10000).style.display = 'none';
				}
			}
		
return returnvalue;
}



function validatefield(formname, fieldname, fieldtype){
			
			ret = 0;
			
					//for (n=0; n<formname.elements.length;n++){
						
										
					element = formname.elements[fieldname];
					
					//Für die Elemente Text/Password; Selectboxes 1 & Multiple; Textarea		

						if (element.type == 'text' || element.type == 'select-one' || element.type == 'password' || element.type == 'textarea'){
						
								if (element.value == ''){
												document.getElementById("errortext" + element.id).style.display = 'inline';
												ret = 1;
								}
								else{
									if (document.getElementById("errortext" + element.id) != null){
										document.getElementById("errortext" + element.id).style.display = 'none';
									}
								}
						}
						
						if (element.type == 'file'){
						
								if (element.value == ''){
												document.getElementById("errortext" + element.id).style.display = 'inline';
												ret = 1;
								}
								else{
									if (document.getElementById("errortext" + element.id) != null){
										document.getElementById("errortext" + element.id).style.display = 'none';
									}
								}
						}
						
						
						if (element.type == 'checkbox'){
								if (element.checked == false){
												document.getElementById("errortext" + element.id).style.display = 'inline';
												ret = 1;
								}
								else{
									if (document.getElementById("errortext" + element.id) != null){
										document.getElementById("errortext" + element.id).style.display = 'none';
									}
								}
						}
						
					
						if(fieldtype == "radio"){
						//bei radiobuttons muss mindestens einer gechecked sein !!!
						var oneischecked = false;
						
							for(l=0; l<formname.elements[fieldname].length; l++){
							//alert(formname.elements(fieldname)[l].type);
							//alert(formname.elements(fieldname)[l].checked);
								if (formname.elements[fieldname][l].checked == true){
									oneischecked = true;
								}
							}

								if (oneischecked == false){
												document.getElementById("errortext" + formname.elements[fieldname][0].id).style.display = 'inline';
												ret = 1;
								}
								
								else{
									if (document.getElementById("errortext" + formname.elements[fieldname][0].id) != null){
										document.getElementById("errortext" + formname.elements[fieldname][0].id).style.display = 'none';
									}
								}
								
						}
										
						if(element.type == 'select-multiple'){
						var selectcounter = 0;
						//alert(document.getElementById(element.id).innerHTML);
						//holt sich die zahl der mindestens zu selektierenden optionen im muliple select aus unsichtbarem div!
						//dieser div muss die gleiche id haben, wie das betr. selectelement!!!!
						var minselect = document.getElementById(element.id).innerHTML;
						
						for(i=0; i<element.options.length; i++){
							if (element.options[i].selected == true){
								selectcounter = selectcounter + 1;
							}
						}
						
								if (selectcounter < minselect){
												document.getElementById("errortext" + element.id).style.display = 'inline';
												ret = 1;
								}
								else{
									if (document.getElementById("errortext" + element.id) != null){
										document.getElementById("errortext" + element.id).style.display = 'none';
									}
								}
						}		
						
						
										
					//}
			return ret;			
}

//------------------------------------

function clearMe(clearstring){
				theEntry = document.getElementById('search').value;
				if (theEntry == clearstring){
						document.getElementById('search').value = "";
				}
			}
								
			function fillMe(fillstring){
			  theEntry = document.getElementById('search').value;
				if (theEntry == ""){
					document.getElementById('search').value = fillstring;
				}
			}
			
			function toolpopup(adress){
				var win;
				win=window.open(adress,'Tools','width=350,height=380,resizable=no,location=no,directories=no,scrollbars=no,menubar=no,toolbar=no');
			}
			
			function popup(adress){
				var win;
				win=window.open(adress,'Detail','width=365,height=400,resizable=no,location=no,directories=no,scrollbars=no,menubar=no,toolbar=no');
			}
			
			function map(adress){
				var win;
				win=window.open(adress,'Map','width=365,height=365,resizable=no,location=no,directories=no,scrollbars=no,menubar=no,statusbar=no,toolbar=no');
			}
			
			
function QuickJump(Formular)
{
    var Element = Formular.mytarget.selectedIndex;
 
    if (Formular.mytarget.options[Element].value != 0) 
    {
        location = Formular.mytarget.options[Element].value;
    }   
}

function createcontent (folderid,secdescid)
{
	return window.open ("/admin/worklist/ce/itemcreatein.asp?secdescid=" + secdescid + "&awfolderid=" + folderid,"CONTEXTEDIT","toolbar=no,width=780,height=650,directions=no,status=yes,scrollbars=yes,menubar=no");
	
}

//Newsticker
//----------------------------------------------------

    function startjs()
		{
		document.write('<div name="bannerDiv" id="bannerDiv" style="position:relative;height:'+lnHeight+'px;width:'+lnWidth+'px;top:0px;left:0px;overflow:hidden;"></div>');
		var loScroll = document.getElementById("bannerDiv");
		bannerInit();
         }
	function bannerInit()
	{
        var loScroll = document.getElementById("bannerDiv");

		var lnOuterWidth  = 0;
		var lnOuterHeight = 0;
		if(loScroll)
		{
			lnOuterWidth  = parseInt(loScroll.style.width);
			lnOuterHeight = parseInt(loScroll.style.height);
		}
		else
		{
			lnOuterWidth  = lnWidth;
			lnOuterHeight = lnHeight;
		}	
		var lcInnerDiv = '';
		lcInnerDiv = lcInnerDiv+ '<div class="banner" id="bannerInner" style="position:absolute;top:4px;width:100%;left:0px;font-family:Verdana,Arial,Helvetica,Geneva,non-serif;color:#646464;font-size:12;"><nobr>'+lcMsg+'</nobr></div>';
		
		//lcInnerDiv = lcInnerDiv+ '<div style="position:absolute;top:0px;left:0px;width:0px;height:25px;"></div>'
		if(loScroll)
		{
			loScroll.innerHTML=lcInnerDiv;
		}
		else
		{	
			document.write(lcInnerDiv);
		}
		loInnerDiv  = document.getElementById("bannerInner");		
		var lnInnerOff   = 0;
		var lnWidth      = 0;		
		lnWidth =400;	
		if(loScroll && lnWidth==lnOuterWidth){
			loScroll.style.width=1200;			
			lnWidth =1200;			
			loScroll.style.width=lnOuterWidth;
		}                     
		lnResetAt = 0-lnWidth;
		var lnTmpWidth = lnWidth;
		var lnDupli = 0;
		while(lnTmpWidth < lnOuterWidth*2 || lnDupli<1){	
			lnDupli = lnDupli+1;
			lcMsg = lcMsg + lcMsg;
			lnTmpWidth = lnTmpWidth+lnWidth;
			
		}

		loInnerDiv.innerHTML="<nobr>"+lcMsg+"</nobr>";

		lnCount = lnOuterWidth;
		bannerDisplay();
		return ;
	}
	function bannerDisplay() {
	
		loInnerDiv  = document.getElementById("bannerInner");
		if(loInnerDiv){
			if(llScrollOn){
				lnCount=lnCount-lnStep;
			}	
			if(lnCount <= lnResetAt-lnStep){
				lnCount = 0;
			}else{
				loInnerDiv.style.left=lnCount + "px";
			}	
			self.setTimeout("bannerDisplay()",lnTimer);
		}	
		return ;
	}
	
	function stopme(){
		llScrollOn = false;
	}
	
	function playme(){
		llScrollOn = true;
	}
	

	
	
//TOGGLE sitemap
//__________________________________________________________________________________________________________

 function toggleQuestion(tName, qName, aName){

        var title = document.getElementById(tName);
        if (title == null) return;
        var ans = document.getElementById(aName);
        if (ans == null) return;
        var que = document.getElementById(qName);
        if (ans.style.display == '')
           {
             if (que != null) que.style.display = 'none';
	              ans.style.display = 'none';
	              //var sa = document.getElementById("chkViewAll");
	              //sa.checked = false;
        }
        else
        {
             if (que != null) que.style.display = '';
	             ans.style.display = '';
        }
      }

                
			function collapseQuestion(tName, qName, aName)
        {
          var title = document.getElementById(tName);
          if (title == null) return;
          var ans = document.getElementById(aName);
      	  if (ans == null) return;
          var que = document.getElementById(qName);
          if (que != null) que.style.display = 'none';
             ans.style.display = 'none';
        }
	
	
				function swapImage(theImage){
					var imgsrc = document.getElementById(theImage).src;		
					if (imgsrc == null) return;				
						if(imgsrc.indexOf("down") != -1){
							document.getElementById(theImage).src = "/custom/_gfx/delimeter_sitemap.gif";
						}
					else{
						document.getElementById(theImage).src = "/custom/_gfx/delimeter_sitemapdown.gif";
					}
				}

//-------------------------------------------------------------
