var SCdomainDefault='http://www.endress.com';
var SCproductpath="/eh/productDBs/homeDBs/en/home.nsf/";
var popup;
var SCdomain = '';
var home_country = '';
var location_country = ''; // dach
var contactFunctionBoxText = "Endress+Hauser Consult AG
Kägenstr. 2
4153 Reinach/BL, Switzerland
Tel.: +41 61 715 77 00
Fax: +41 61 715 28 88 ";
var contactFunctionBoxText_at = "";
var contactFunctionBoxText_ch = "";
function get_SCdomain(SChome){ // start init
if(SChome && (!home_country || !location_country)){
if(SChome.indexOf('/dach/')!=-1) location_country=get_location_country(SChome);
else {
if(window.sitestatSiteCountry) home_country = sitestatSiteCountry // Canada, FIXME change index.html
}
}
if(SCdomain) return SCdomain;
var domainURL;
if(!SChome) {
domainURL = SCdomainDefault;
}
if(SChome.indexOf('/eh/')!=-1) domainURL = SChome.split('/eh/')[0];
else if(SChome.indexOf('/eh-new/')!=-1) domainURL = SChome.split('/eh-new/')[0];
else domainURL = SCdomainDefault;
if(domainURL) {
SCdomain = domainURL;
return SCdomain;
}
}
function get_location_country(SChome){ // dach
var tmp=SChome.split("endress.")[0];
if(tmp.indexOf(".")>0) tmp=tmp.split(".")[1];
if(tmp.indexOf("www")!=-1) tmp=tmp.split("www").join("");
if(!tmp) tmp="en";
if(tmp.length>3) tmp="de";
return tmp;
}
// opencontactlink
function do_opencontactlink(SChome){
if(window.location_country) home_country=location_country; // index
mnurl=SCdomain+'/eh/central/info/contact.nsf/contactdisplay/en?Open&en';
if(home_country) mnurl=SCdomain+'/eh/central/info/contact.nsf/contactdisplay/'+home_country+'?Open&en';
popup=window.open(mnurl,'v1','width=600,height=620,resizable=yes,scrollbars=yes');
popup.focus();
var contactsitestaturl='';
if(home_country) contactsitestaturl='http://de.sitestat.com/endress/corporate/s?'+home_country+'.contact-db';
else contactsitestaturl="http://de.sitestat.com/endress/corporate/s?contact-db";
if(contactsitestaturl) if(window.sitestat) sitestat(contactsitestaturl);
return false;
}
// openorderproductlink
function do_openorderproductlink(SChome, edirect, ordercode){
try{
var orderCountry='en';
if(window.location_country) orderCountry=location_country; // dach
if(edirect){
edirect=orderCountry;
if(edirect=='com' || edirect=='en') edirect='ca';
}
mnurl=SCdomain+'/eh/central/info/contact.nsf/orderdisplay/'+orderCountry+'?Open&edirect='+edirect+'&language=';
if('en'=='da'){
mnurl=mnurl+'en&country='+orderCountry+'&'+ordercode;
}
else mnurl=mnurl+'en&country='+orderCountry+'&'+ordercode;
popup=window.open(mnurl,'v1','width=600,height=520,resizable=yes,scrollbars=yes');
popup.focus();
var orderproductlink='';
var productRoot='';
if(home_country || location_country) orderproductlink='http://de.sitestat.com/endress/corporate/s?'+(home_country?home_country :location_country) +'.contact-db.orderinfo';
else orderproductlink="http://de.sitestat.com/endress/corporate/s?contact-db.orderinfo";
productRoot = ordercode.split('=');
if(productRoot[1]){
if(productRoot[1].charAt(productRoot[1].length-1)=='-') orderproductlink += '.'+productRoot[1].substring(0,productRoot[1].length-1);
else orderproductlink += '.'+productRoot[1];
}
if(orderproductlink) if(window.sitestat) sitestat(orderproductlink);
} catch(e) {
// alert("error:"+ e);
}
return false;
}
function recommendProductWin(SChome, productroot){
if(SChome && productroot){
popup=window.open(SChome+"systemcontentview/x_recommend.html?Open&ProductRoot="+productroot,"popup","width=410,height=440,resizable=no").focus();
var sitestaturl = pc_get_sitestaturl('recommend.');
if(sitestaturl) sitestat(sitestaturl);
}
}
function selectBookmark(SChome, productroot){
var EHbookmarkSelect=window.open(SChome+'systemcontentview/x_bookmark.html?Open&SChome='+SChome+'&ProductRoot='+productroot+'&anticache='+String(Math.random()).split('.')[1] , 'EHbookmark','width=570,height=300,left=250,top=160,resizable=yes, menubar=no,scrollbars=yes');
if(SChome.indexOf('.softwerk.') !=-1) return;
var bookmarksitestaturl='';
if(home_country) bookmarksitestaturl='http://de.sitestat.com/endress/corporate/s?'+home_country+'.bookmarkselect.product-container.'+productroot;
else bookmarksitestaturl="http://de.sitestat.com/endress/corporate/s?bookmarkselect.product-container."+productroot;
if(bookmarksitestaturl) if(window.sitestat) sitestat(bookmarksitestaturl);
}
function bookmarkWinContainer(SChome, productroot){
var tmphost=SChome;
if(tmphost.indexOf('.softwerk.') !=-1) tmphost='http://www.endress.com/eh/home.nsf/';
var bookURL= tmphost+'?Open&DirectProductURL='+productroot;
if(navigator.userAgent.indexOf('MSIE') != -1 && navigator.userAgent.indexOf('Win') != -1) {
window.external.AddFavorite(bookURL,'Endress+Hauser - '+productroot);
}
else {
alert('Please click Bookmarks - Add Bookmark'); //'Please click Bookmarks - Add Bookmark'
EHbookmarkOwn = window.open(bookURL,"EHbookmarkOwn","width=800,height=500,resizable=yes,menubar=yes,scrollbars=yes");
EHbookmarkOwn.focus();
}
if(SChome.indexOf('.softwerk.') !=-1) return;
var home_country="";
if(SChome){
SCdomain=get_SCdomain(SChome);
if(SChome.indexOf('/dach/')!=-1) home_country=get_location_country(SChome);
}
var bookmarksitestaturl='';
if(home_country) bookmarksitestaturl='http://de.sitestat.com/endress/corporate/s?'+home_country+'.bookmark.product-container.'+productroot;
else bookmarksitestaturl="http://de.sitestat.com/endress/corporate/s?bookmark.product-container."+productroot;
if(bookmarksitestaturl) if(window.sitestat) sitestat(bookmarksitestaturl);
}
function bookmarkProductWin(SChome, productroot) { /* kann entfallen, wird bald nicht mehr benötigt */
if(SChome&& productroot){
SCdomain=get_SCdomain(SChome);
var bookURL= SCdomain+'/eh/productDBs/homeDBs/en/home.nsf/'+'contentview/'+productroot;
if(navigator.userAgent.indexOf('MSIE') != -1 && navigator.userAgent.indexOf('Win') != -1) {
window.external.AddFavorite(bookURL,'Endress + Hauser - '+productroot)
}
else {
alert('Please click Bookmarks - Add Bookmark');
EHbookmark = window.open(bookURL,"EHbookmark","width=800,height=500,resizable=yes,menubar=yes,scrollbars=yes");
EHbookmark.focus();
}
}
}
function do_callingDB(directURL, SChome) {
if(directURL){
if(SChome){
SCdomain=get_SCdomain(SChome);
mnurl=SCdomain+'/eh/productDBs/homeDBs/en/home.nsf/contentview/'+directURL;
}
else{
mnurl=SCdomain+'/eh/home.nsf/contentview/'+directURL; // call from productDBs/homeDBs
}
if(!window.contentFrame) document.location.href=mnurl;
else contentFrame.document.location.href=mnurl;
}
}
if (!window.do_download) { // product container
window.do_download = function(prodArea,prodID,bundleID,conttype,type) {
var sitelang='en';
if(window.sitelanguage) sitelang=window.sitelanguage;
theUrl='https://wa001.endress.com/sap/bc/bsp/euh/dla/extern/call.htm?language='+sitelang+'&cont_type=&type=';
if(prodID){
if(type) theUrl=theUrl+type;
theUrl=theUrl+"&root_id="+prodID;
document.location.href=theUrl;
}
else if (bundleID){
if(type) theUrl=theUrl+type;
theUrl=theUrl+"&bundle_id="+bundleID;
document.location.href=theUrl;
}
}
}
function formSubmit() {
if(document.layers) formular = document.layers['menu'].document.forms['Search'];
else formular = document.forms['Search'];
formular.submit();
}
function do_search() {
if(document.layers) formular = document.layers['menu'].document.forms['Search'];
else formular = document.forms['Search'];
tmp="";
error_text = nosearchentry;
var SearchDB = get_SCdomain(SChome) + "/eh/home.nsf/DBSearch";
var SearchTargetFrame = window;
if(formular.Query) {
suchparameter='&SearchMax=0&Frames=0';
if(formular.Query.value) {
if(formular.Query.type=='text') { // einfache suche
tmp=document.location.href;
txt=formular.Query.value;
txt=txt.replace(/ä/g,'ä');
txt=txt.replace(/ö/g,'ö');
txt=txt.replace(/ü/g,'ü');
txt=txt.replace(/Ä/g,'Ä');
txt=txt.replace(/Ö/g,'Ö');
txt=txt.replace(/Ü/g,'Ü');
txt=txt.replace(/ß/g,'ß');
txt='(Field BestViewHTML contains "*'+txt+'*")';
txt=escape(txt);
formular.Query.value = '';
SearchTargetFrame.location.href=SearchDB+"?ReadForm&Query="+txt+suchparameter;
}
}
else alert(error_text);
}
}
function pc_solrSearch() {
if(document.layers) formular = document.layers['right'].document.forms['Search'];
else formular = document.forms['Search'];
error_text = 'Please enter a search string';
var SearchDB = get_SCdomain(SChome) + '/eh/home.nsf/solrSearch?Open';
var SearchTargetFrame = window;
if(formular && !window.solrSearchSubmitted) {
if(formular.Query.value) {
if(formular.Query.type=='text') { // einfache suche
txt=formular.Query.value;
txt=encodeURIComponent(txt);
window.solrSearchSubmitted = true;
SearchTargetFrame.location.href=SearchDB+'&q='+txt;
}
}
else alert(error_text);
}
}
if(window.jQuery) {
jQuery(function(){
var bodySearchField = jQuery('body:not(".edit") #searchfield');
if(window.SChome && bodySearchField.length && bodySearchField.e4w_autocomplete) {
bodySearchField.e4w_autocomplete((window.SChome?SChome :docPath)+'solrSearch?open&m=autocomplete', {
cacheLength: 1,
matchSubset: false,
delay: 200,
max: 10,
selectFirst: false,
scrollHeight: 200,
dataType: 'jsonp'
}).e4w_result(function(event, data, formatted) {
jQuery(this).parents('form').submit();
});
}
});
}
var bindAddthis = true;
/* ------------------ Addthis ------------------ */
function createAddthisButtons() {
if(window.addthis_config) {
if(window.pc_get_sitestaturl && window.sitestat) {
var toolbox = document.getElementById("addthis_toolbox");
var more = null;
var nodes = toolbox && toolbox.childNodes && toolbox.childNodes.length && toolbox.childNodes;
for(var i = 0; i < nodes.length; ++i) {
if (nodes[i].nodeName.toLowerCase() == 'a') more = nodes[i];
}
bindMoreAddThis("addthis_toolbox", 12);
if (more) {
addEvent(more, "mouseover", function() {
window.setTimeout(function(){
if (bindAddthis) {
bindMoreAddThis("at_hover", 5);
bindMoreAddThis("at16ps", 4);
}
bindAddthis = false;
}, 800);
});
}
}
}
}
function bindMoreAddThis(containerId, cut) {
var addThisMore = document.getElementById(containerId);
if (addThisMore && addThisMore.childNodes && addThisMore.childNodes.length) {
for (var j = 0; j < addThisMore.childNodes.length; j++) {
var child = addThisMore.childNodes[j];
if (child && (child.nodeName.toLowerCase() == 'div' || child.nodeName.toLowerCase() == 'a')) {
addEvent(child, "click", function() {
var id = this.getAttribute("id");
if (id) {
id = id.substr(cut);
var sitestatClickURL=pc_get_sitestaturl('addthis.'+encodeURIComponent(id)+'.');
if(sitestatClickURL) {
sitestat(sitestatClickURL);
}
}
});
}
}
}
}
function addEvent( obj, type, fn ) {
if (obj.addEventListener) {
obj.addEventListener( type, fn, false );
} else if (obj.attachEvent) {
obj["e"+type+fn] = fn;
obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
obj.attachEvent( "on"+type, obj[type+fn] );
}
}
function removeEvent( obj, type, fn ) {
if (obj.removeEventListener) {
obj.removeEventListener( type, fn, false );
} else if (obj.detachEvent) {
obj.detachEvent( "on"+type, obj[type+fn] );
obj[type+fn] = null;
obj["e"+type+fn] = null;
}
}
function pc_get_sitestaturl(prename) { // bookmark.
var sitestaturl='';
if(!("corporate/s?")) return sitestaturl;
if(window.location_country) home_country=location_country; // DACH - index
if(document.location.host.indexOf(".softwerk.") == -1){
if(home_country) sitestaturl='http://de.sitestat.com/endress/corporate/s?'+home_country +'.'+ prename+'product-container.'+window.productRoot;
else sitestaturl='http://de.sitestat.com/endress/corporate/s?'+prename+'product-container.' + window.productRoot;
// sitestaturl="http://de.sitestat.com/endress/corporate/s?"+prename+"product-container."+window.productRoot;
if(sitestaturl.indexOf('/s?.') != -1) { // corporate Website, AU
if("corporate/s?"!='/s?.') sitestaturl= sitestaturl.split('/s?.').join('/s?');
}
}
return sitestaturl;
}
function do_openconfigproductlink(SChome, productroot){ // configure this product
try{
var home_salesOrg="0800";
if(window.location_country) home_country=location_country; // DACH - index
mnurl='https://portal.endress.com/wa002/ConfiguratorPortal/page/PortalConf?sales_org=';
if(home_country){
if(home_country=='at'){ home_salesOrg = '3100'; }
if(home_country=='ch'){ home_salesOrg = '3000'; }
mnurl += home_salesOrg+'&MODE=EXT&shop_country='+home_country;
}
else { mnurl += home_salesOrg+'&MODE=EXT&shop_country=en'}
mnurl += '&shop_lang=en&ordercode='+productroot;
openConfigWin = window.open(mnurl,'v1');
openConfigWin.focus();
if(home_country) configproductlink='http://de.sitestat.com/endress/corporate/s?'+home_country+'.configureThisProduct.'+productroot;
else configproductlink='http://de.sitestat.com/endress/corporate/s?configureThisProduct.'+productroot;
if(configproductlink) if(window.sitestat) sitestat(configproductlink);
} catch(e) { }
return false;
}