////////////////////////////////////////////////////////////////
//
// wScript.js 5.0.1
// erstellt durch Scholl Communications AG, 77694 Kehl, www.scholl.de
// erstellt mit Weblication Content Management Server, www.weblication.de
//
////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////
//
// Anzupassende Variablen:
//
////////////////////////////////////////////////////////////////




////////////////////////////////////////////////////////////////
//
// Beschreibung: Generiert Spam-sichere Email an Angestellten
//
////////////////////////////////////////////////////////////////

function sendMailToEmployee(name){
 location.href = 'mailto:' + name + '@hobart-export.com';
} 
////////////////////////////////////////////////////////////////
//
// Beschreibung: Oeffnet ein Popup-Fenster
//
////////////////////////////////////////////////////////////////

function openPopup(url){

 if(debugMode == 1){
  alert(url);
 }

 window.open(url, "popup", optionsPopup);
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Oeffnet ein Popup-Fenster vom Typ 1
//
////////////////////////////////////////////////////////////////

function openPopup1(url){

 if(debugMode == 1){
  alert(url);
 }

 window.open(url, "popup1", optionsPopup1);
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Oeffnet ein Popup-Fenster vom Typ 2
//
////////////////////////////////////////////////////////////////

function openPopup2(url){

 if(debugMode == 1){
  alert(url);
 }

 window.open(url, "popup2", optionsPopup2);
}


////////////////////////////////////////////////////////////////
//
// Beschreibung: Zeigt die Druckansicht an
//
////////////////////////////////////////////////////////////////

function wShowPrintpreview(){  

  var url = location.href;

  if(url.indexOf('?') >= 0){
    url += '&viewmode=print';
  }
  else{
    url += '?viewmode=print';    
  }
  
  openWindow(url, 'wPrintpreview', 'width=768,height=520,scrollbars=yes');
}

/*********************************************************************************/
//
// Öffnet ein Fenster
//
// @param string Url
//
// @param string Name des Fensters
//
// @param string Optionen
//
// @return window			
//
/*********************************************************************************/

function openWindow(url, name, options){

  var regWidth = /width=(\d+)/;
  regWidth.exec(options);
  width = RegExp.$1; 
  if(width == ''){   
    width = 640; 
  }

  var regHeight = /height=(\d+)/;
  regHeight.exec(options);
  height = RegExp.$1;       
  if(height == ''){   
    height = 480; 
  }    


  if(!name && !width && !height && !options){
    return window.open(url, name);
    return;
  }
  //Zusaetzliche Optionen angeben
  if(!options){
    options = ',resizable=no,scrollbars=no,status=no';
  }
  //Position zentriert festlegen
  
  var posLeft = (screen.width / 2)  - (width  / 2);
  var posTop  = (screen.height / 2) - (height / 2);
  //alert('top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);<<<
  return window.open(url, name, 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);
}

////////////////////////////////////////////////////////////////
//
// Beschreibung: Druckt das aktuelle Dokument
//
////////////////////////////////////////////////////////////////

function printDocument(){  

  if(document.all && navigator.appVersion.substring(22,23)==4) {
    self.focus();
    var OLECMDID_PRINT = 6;
    var OLECMDEXECOPT_DONTPROMPTUSER = 2;
    var OLECMDEXECOPT_PROMPTUSER = 1;
    var WebBrowser = '<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
    document.body.insertAdjacentHTML('beforeEnd',WebBrowser);
    WebBrowser1.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER);
    WebBrowser1.outerHTML = '';
  }
  else{
    window.print();  
  }
}


////////////////////////////////////////////////////////////////
//
// Beschreibung: Passt die Höhe eines div (divChange) nach volgender Logok an.
//   wenn divRef >  divChange + divSubtract   dann berechne divChange neu aus  divRef - divSubtract !
//
////////////////////////////////////////////////////////////////


function divHeigthKorr(divChange, divRef, divSubtract) {

  var refHeight = document.getElementById(divRef).offsetHeight ;
  var chngHeight = document.getElementById(divChange).offsetHeight;
  var substrHeight = document.getElementById(divSubtract).offsetHeight;

 //alert ('refHeight= ' + refHeight + 'px;\n' + 'chngHeight= ' + chngHeight + 'px;\n' + 'substrHeight= ' + substrHeight + 'px');
  if (refHeight  > chngHeight + substrHeight)
	{	
         var chngHeight = refHeight - substrHeight;
		 document.getElementById(divChange).style.height= chngHeight + "px" ;
	}

}


////////////////////////////////////////////////////////////////
//
//  Redirect
//   
//
////////////////////////////////////////////////////////////////

function doRedirectUrl(url) {
	if(url != "") {
		document.location.href = url;
	}
}

////////////////////////////////////////////////////////////////
//
//  Force Download
//  Beschreibung: 	erzwingt den Download der verlinkten Datei
//  				anstatt die Datei zu öffnen.	
//
////////////////////////////////////////////////////////////////

function getDownload(url) {
	window.location.href = "/wExport_en/wGlobal/scripts/getdownload.inc.php?file="+url;
	
}

////////////////////////////////////////////////////////////////
//
//  wechselt Container-Reiter
//  Beschreibung: 	blendet aktuellen Reiter aus
//  				und den angeklickten ein
//
////////////////////////////////////////////////////////////////

function changeDiplay(id, mode) {
		if(mode == 'hide') {
			document.getElementById(id).style.display = 'none';
		} else if(mode == 'show') {
			document.getElementById(id).style.display = 'block';
		}

}