var bs_contact_js;
var bs_more_info;
var bs_teaser_box;
var visible;
var is;
var winH; 
var winW; 
var sepStr='.';
var menStr='1.2';
var bStaging = true;
var err_contact= false;

// start resizing
function evalWinWidth()
{
 if (window.innerWidth) return window.innerWidth;
 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
 else return 0;
}

function evalwinHeight()
{
 if (window.innerHeight) return window.innerHeight;
 else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
 else return 0;
}


function reconstructWin()
{
 if (winWidth != evalWinWidth() || winHeight != evalwinHeight())
 makeLiquid(); 
 window.history.go(0);
}

/*initNS*/
if(!window.winWidth && window.innerWidth)
  {
   window.onresize = reconstructWin;
   winWidth = evalWinWidth();
   winHeight = evalwinHeight();
  }
// stop resizing 


    function sendForm(){
    	if (document.form.name.value=="") {
    		alert("Please enter your name");
    		document.form.name.focus();
    		return;
    	};
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    	if (!filter.test(document.form.email.value)) {
    		alert("Please enter a valid email address");
    		document.form.email.focus();
    		return;
    	};
//    	if (document.form.message.value=="") {
//    		alert("Please enter a message");
//    		document.form.message.focus();
//    		return;
//    	};
	document.form.submit();
    }
    
    function sendFormsurvey(){
	document.form_survey.submit();
    }

    function clearForm(){
	document.form.reset();
    }

    function setvisibility(){
	  if (bs_contact_js.visibility.toLowerCase() == visible){
	    bs_contact_js.visibility = "hidden";
 	    bs_more_info.visibility = visible;
 	    bs_teaser_box.visibility = visible;
 	  }else{
	    bs_contact_js.visibility = visible;
	    bs_more_info.visibility = "hidden";
 	    bs_teaser_box.visibility = "hidden";
	  }
     }

     function init(){
       if (document.layers){
		 //alert('case_1');
		 if(document.contact_js){
		   	bs_contact_js=document.contact_js;
	   		bs_more_info=document.more_info;
	   		bs_teaser_box=document.teaser_box;
		   	visible="show";
			bs_contact_js.visibility = "hidden";
		 }
       }else if (document.all){
		 //alert('case_2');
		 if(document.all.contact_js){ 
			bs_contact_js=document.all.contact_js.style;
			bs_more_info=document.all.more_info.style;
	   		bs_teaser_box=document.all.teaser_box.style;
			visible="visible";
			bs_contact_js.visibility = "hidden";
		 }
       }else if (document.getElementById){
		 //alert('case_3');
		 if(document.getElementById('contact_js')){
			bs_contact_js=document.getElementById('contact_js').style;
			bs_more_info=document.getElementById('more_info').style;
	   		bs_teaser_box=document.getElementById('teaser_box').style;
		   	visible="visible";
			bs_contact_js.visibility = "hidden";
		    }
		 }
	if(err_contact) setvisibility();
       }

    is = new clientDetection()
    function clientDetection() {
	var b = navigator.appName
  	this.agent = navigator.userAgent
	if (b=="Netscape" && !(this.agent.indexOf("Opera")>-1)) 
		this.b = "ns"
	else if (b=="Microsoft Internet Explorer" && !(this.agent.indexOf("Opera")>-1)) 
		this.b = "ie"
  	else if (this.agent.indexOf("Opera")>-1) 
  		this.b = "op"
	else 
		this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns6 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)  
  	this.op = (this.b=="op")
  	this.op6 = (this.b=="op" && this.agent.indexOf("Opera 6")>-1)
  	this.win = (this.agent.indexOf("Win")>-1)
  	this.mac = (this.agent.indexOf("Mac")>-1)
	this.min = (this.ns||this.ie||this.op6)
    }

//this finds the width/height of the browser and reloads the page when resized to create a liquid layout
function findWH() {
				  		//window.innerWidth =>op6,ns4,ns6;   document.body.offsetWidth=>ie,op6
  winW = (is.ns || is.op6)? window.innerWidth : document.body.offsetWidth;
  if(is.ie && is.win) 
  	winW -=4;
  else if(is.op6 && is.win) 
  	winW+=18;
					//window.innerHeight=>op6,ns4,ns6;  document.body.offsetHeight=>ie
	winH = (is.ns || is.op6)? window.innerHeight : document.body.offsetHeight;
  if(is.ie && is.win) 
  	winH -=4;
  winH -=146
/*
  if (winH<452){
  	winH = 452;
  }
*/

}

function makeLiquid() {
	//alert("resize");
	if ((is.ns && (winW!=window.innerWidth || winH!=window.innerHeight)) || is.ie || is.op6)
	history.go(0)
}

function changeImage(imageName,fileName) {
  var temp = fileName;
  if (document.images) {
//    if(bStaging && temp.substr(0,1)=='/'){
//      document[imageName].src = "/NPSSTAGE" + fileName;
//    }else{
	document[imageName].src = fileName;
//    }
  }
}


var tender;
tender = '';

function changeItem(name,newImage,el,on) {
  eval('window.document.' + name + '.src = ' + newImage + '.src;');
  if((is.ie || is.ns6) && el != ''){
    if(on){
      document.getElementById(el).style.color='#000000';
    }else{
      document.getElementById(el).style.color='#666666';
    }
  }
}


//Open-Window-Function
function openWindow (winAdress,winName,winWidth,winHeight){//Standard: width=400,height=200"
  winSettings = "toolbar=no,location=no,menubar=yes,personalbar=no,status=no,scrollbars=yes,resizable=yes,left=250,top=350,screenX=250,screenY=350,width="+winWidth+",height="+winHeight;
	newWindow = open(winAdress,winName,winSettings);
  newWindow.focus();
}

//Open-Flash-Window-Function
function openFlashWindow (winAdress){
  winSettings = "toolbar=no,location=no,menubar=no,personalbar=no,status=no,scrollbars=no,resizable=no,left=10,top=10,screenX=10,screenY=10,width=792,height=542";
	newWindow = open(winAdress,'flashwindow',winSettings);
  newWindow.focus();
}

//Close-Window-Function
function closeWindow (){	
	window.close();
}

//function changeItem_1(el, evt, imageName, fileName){
   //ele=document.getElementById(el);
//   el.style.background = eval(evt + "Color");     
//   changeImage(imageName,fileName);
//}


//Navigation für Conferences Anfang

urlsearch1=document.URL;
urlsearch2=urlsearch1.indexOf("/conferences");
urlsearch=urlsearch1.substr(0,urlsearch2);

function changeItemconf(pfeil,el,on) {
if(on){
      	eval('window.document.' + pfeil + '.src = pfeil_conf.src;');
    }
else{
    	eval('window.document.' + pfeil + '.src = space_conf.src;');
    }

if((is.ie || is.ns6) && el != ''){
    if(on){
      document.getElementById(el).style.color='#000000';
    }else{
      document.getElementById(el).style.color='#666666';
    }
  }
}
//Navigation für Conferences Anfang

function personopen(datei) {
	Fenster = window.open(datei,"Zweitfenster","width=417,height=400",scrollbars="yes");
}
