//
$( document ).ready( function(){
if (window.addEventListener)
addEventListener("message", receiveMessage, false)
else
attachEvent("onmessage", receiveMessage)
});
function receiveMessage(e)
{
if (e.origin == "https://portal.extranet.kuhn.com" || e.origin == "https://www.portal.extranet.kuhn.com")
if (e.data.indexOf('redirect:') == 0)
window.location.assign( e.data.substr(9) );
}
var Base64 = {
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
function GetUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0].toLowerCase()] = hash[1];
}
return vars;
}
function SetCookie(sName, sValue) {
var d=new Date();
document.cookie=sName+"="+escape(sValue)
+"; expires=Fri, 31 Dec 2099 23:59:59 GMT;";
}
function SetGlobalCookie(sName, sValue) {
var d=new Date();
document.cookie=sName+"="+escape(sValue)
+"; expires=Fri, 31 Dec 2099 23:59:59 GMT;path=/;";
}
function GetCookie(sName)
{
var aCookie = document.cookie.split("; ");
for(var i=0; i');
}
});
} catch(e) {
}
}
function SetCookiesFormFields() {
var currentForm=document.forms[0];
if(currentForm.ContactGender) {
var cb1 = $("input[name='ContactGender']:checked").val();
if(cb1==undefined)
cb1 = "";
if(cb1!="")
SetCookie("ContactGender", cb1);
}
if(currentForm.ContactLastName) {
if(currentForm.ContactLastName.value!="")
SetCookie("ContactLastName",currentForm.ContactLastName.value);
}
if(currentForm.ContactFirstName) {
if(currentForm.ContactFirstName.value!="")
SetCookie("ContactFirstName",currentForm.ContactFirstName.value);
}
if(currentForm.ContactCompany) {
if(currentForm.ContactCompany.value!="")
SetCookie("ContactCompany",currentForm.ContactCompany.value);
}
if(currentForm.ContactPosition) {
if(currentForm.ContactPosition.value!="")
SetCookie("ContactPosition",currentForm.ContactPosition.value);
}
if(currentForm.ContactAddress) {
if(currentForm.ContactAddress.value!="")
SetCookie("ContactAddress",currentForm.ContactAddress.value);
}
if(currentForm.ContactPostalCode) {
if(currentForm.ContactPostalCode.value!="")
SetCookie("ContactPostalCode",currentForm.ContactPostalCode.value);
}
if(currentForm.ContactCity) {
if(currentForm.ContactCity.value!="")
SetCookie("ContactCity",currentForm.ContactCity.value);
}
if(currentForm.ContactCountry) {
if(currentForm.ContactCountry.value!="")
SetCookie("ContactCountry",currentForm.ContactCountry.value);
}
if(currentForm.ContactState) {
if(currentForm.ContactState.value!="")
SetCookie("ContactState",currentForm.ContactState.value);
}
if(currentForm.ContactCounty) {
if(currentForm.ContactCounty.value!="")
SetCookie("ContactCounty",currentForm.ContactCounty.value);
}
if(currentForm.ContactPhoneNumber) {
if(currentForm.ContactPhoneNumber.value!="")
SetCookie("ContactPhoneNumber",currentForm.ContactPhoneNumber.value);
}
if(currentForm.ContactEmail) {
if(currentForm.ContactEmail.value!="")
SetCookie("ContactEmail",currentForm.ContactEmail.value);
}
if(currentForm.ContactFirstActivity) {
if(currentForm.ContactFirstActivity.value!="")
SetCookie("ContactFirstActivity",currentForm.ContactFirstActivity.value);
}
if(currentForm.ContactOtherActivity) {
if(currentForm.ContactOtherActivity.value!="")
SetCookie("ContactOtherActivity",currentForm.ContactOtherActivity.value);
}
if(currentForm.ContactNbMilkCow) {
SetCookie("ContactNbMilkCow",currentForm.ContactNbMilkCow.value);
}
if(currentForm.ContactSurfaceAgri) {
SetCookie("ContactSurfaceAgri",currentForm.ContactSurfaceAgri.value);
}
if(currentForm.ContactNbTetes) {
SetCookie("ContactNbTetes",currentForm.ContactNbTetes.value);
}
return;
}
function InitializeTrainingFields() {
var currentForm=document.forms[0];
if(currentForm.TrainingNumber) {
$( "input[name='TrainingNumber'][value='" + GetCookie("TrainingNumber") + "']" ).attr( 'checked', 'checked' );
}
if(currentForm.TrainingContactName) {
currentForm.TrainingContactName.value=GetCookie("TrainingContactName");
}
if(currentForm.TrainingContactPhone) {
currentForm.TrainingContactPhone.value=GetCookie("TrainingContactPhone");
}
if(currentForm.TrainingContactEmail) {
currentForm.TrainingContactEmail.value=GetCookie("TrainingContactEmail");
}
if(currentForm.TrainingContactName2) {
currentForm.TrainingContactName2.value=GetCookie("TrainingContactName2");
}
if(currentForm.TrainingContactPhone2) {
currentForm.TrainingContactPhone2.value=GetCookie("TrainingContactPhone2");
}
if(currentForm.TrainingContactEmail2) {
currentForm.TrainingContactEmail2.value=GetCookie("TrainingContactEmail2");
}
return;
}
function SetCookiesTrainingFields() {
var currentForm=document.forms[0];
if(currentForm.TrainingNumber) {
if($( "input[name='TrainingNumber']:checked" ).val()!=undefined)
SetCookie("TrainingNumber",$( "input[name='TrainingNumber']:checked" ).val() );
}
if(currentForm.TrainingContactName) {
if(currentForm.TrainingContactName.value!="")
SetCookie("TrainingContactName",currentForm.TrainingContactName.value);
}
if(currentForm.TrainingContactPhone) {
if(currentForm.TrainingContactPhone.value!="")
SetCookie("TrainingContactPhone",currentForm.TrainingContactPhone.value);
}
if(currentForm.TrainingContactEmail) {
if(currentForm.TrainingContactEmail.value!="")
SetCookie("TrainingContactEmail",currentForm.TrainingContactEmail.value);
}
if(currentForm.TrainingContactName2) {
if(currentForm.TrainingContactName2.value!="")
SetCookie("TrainingContactName2",currentForm.TrainingContactName2.value);
}
if(currentForm.TrainingContactPhone2) {
if(currentForm.TrainingContactPhone2.value!="")
SetCookie("TrainingContactPhone2",currentForm.TrainingContactPhone2.value);
}
if(currentForm.TrainingContactEmail2) {
if(currentForm.TrainingContactEmail2.value!="")
SetCookie("TrainingContactEmail2",currentForm.TrainingContactEmail2.value);
}
return;
}
function strLeft(sourceStr, keyStr){
return (sourceStr.indexOf(keyStr) == -1 | keyStr=='') ? sourceStr : sourceStr.split(keyStr)[0];
}
function strRight(sourceStr, keyStr){
idx = sourceStr.indexOf(keyStr);
return (idx == -1 | keyStr=='') ? sourceStr : sourceStr.substr(idx+ keyStr.length);
}
function rightBack(sourceStr, keyStr){
arr = sourceStr.split(keyStr);
return (sourceStr.indexOf(keyStr) == -1 | keyStr=='') ? sourceStr : arr.pop();
}
function leftBack(sourceStr, keyStr){
arr = sourceStr.split(keyStr);
arr.pop();
return (keyStr==null | keyStr=='') ? sourceStr : arr.join(keyStr);
}
function Left(str,n){
if(n<=0) return "";
if(n>String(str).length) return str;
return String(str).substring(0,n);
}
function Right(str,n){
if(n<=0) return "";
var nLength = String(str).length;
if(n>nLength) return str;
return String(str).substring(nLength, nLength - n);
}
function isValidEmail(stEmail) {
var cstEmailModel = /^[\S|x20]+@[\S|x20]+\.[\S|x20]+$/;
if (stEmail.toLowerCase().match(cstEmailModel) == null) return false;
return true;
}
function PagePopupWinTips(event, stMessage) {
//var winTips=document.all("PageWinTips");
var winTips=$("div[id=PageWinTips]");
if(winTips.length == 0) return;
//elems = document.body.getElementsByTagName("select");
elems = $("select");
if(elems) {
for(var n=0;n| "+stMessage +" | ";
//winTips.innerHTML = stContent;
winTips.html( stContent );
winTips.css( "left", event.clientX + document.body.scrollLeft );
winTips.css( "top", event.clientY + document.body.scrollTop );
winTips.css( "visibility", "visible" );
/*
var skn=winTips.style;
if(document.all) {
skn.left = event.clientX + document.body.scrollLeft;
skn.top = event.clientY + document.body.scrollTop;
} else {
document.onmousemove=PageMoveWinTips;
}
skn.visibility = "visible";
*/
return;
}
function PageMoveWinTips(e) {
var winTips=document.all("PageWinTips");
//$("div[id=PageWinTips]").css( "left", e.pageX + 5 + "px" );
//$("div[id=PageWinTips]").css( "top", e.pageY + 10 + "px" );
if(!winTips) return;
var skn=winTips.style;
skn.left = e.pageX + 5 + 'px';
skn.top = e.pageY + 10 + 'px';
return;
}
function PagePopoutWinTips() {
//var winTips=document.all("PageWinTips");
var winTips=$("div[id=PageWinTips]");
if(winTips.length == 0) return;
//elems = document.body.getElementsByTagName("select");
elems = $("select");
if(elems) {
for(var n=0;n)(?![^<>]*?>)','gi');
//var reg = new RegExp('(?!<.*?)(?!)(?![^<>]*?>)','gi');
stHtml=stHtml.replace(reg,PageHotSpotLinks[n][1]);
}
tagBody.innerHTML=stHtml;
}
return;
}
function DisplayDateTime() {
if(!document.all) return;
if(!document.all.PageDateTime) return;
var d=new Date();
PageDateTime.innerHTML=d.toLocaleDateString()+" "+
Right("00"+d.getHours(),2)+":"+Right("00"+d.getMinutes(),2);
setTimeout("DisplayDateTime()",300000);
}
function PageSubmitNewsSearch() {
var currentForm=document.forms[0];
if(!currentForm.PageNewsSearch) return;
var stQuery=currentForm.PageNewsSearch.value;
if(stQuery!='') {
location.replace("?OpenDocument&qn="+Base64.encode(stQuery));
}
return;
}
function PageSubmitNewsArchive() {
var currentForm=document.forms[0];
if(!currentForm.PageNewsArchiveSearch) return;
var stQuery=currentForm.PageNewsArchiveSearch.value;
if(currentForm.PageNewsArchivePeriod) {
var stPeriod=currentForm.PageNewsArchivePeriod.value;
if(stPeriod!='') stQuery=stQuery+"#"+stPeriod;
}
if(stQuery!='') {
location.replace("?OpenDocument&qa="+Base64.encode(stQuery));
}
return;
}
function PageSubmitLogin() {
var currentForm=document.forms[0];
var loginForm=document.forms['loginForm'];
if(!loginForm) return;
if(!loginForm.username) return;
if(!currentForm.PageLoginUser) return;
if(!currentForm.PageLoginPassword) return;
if(currentForm.PageLoginUser.value=='') return;
loginForm.username.value=currentForm.PageLoginUser.value;
loginForm.password.value=currentForm.PageLoginPassword.value;
// IAM
if( IsIamUser( $.trim( $( "#loginFormUsername" ).val() ) ) )
{
$( "#loginForm" ).attr( "action", $( "#loginPageUrlIam" ).val() );
$( "#loginFormUsername" ).attr( "name", "txtUserName" );
$( "#loginFormPassword" ).attr( "name", "txtPassword" );
$( "input[name='redirectto']" ).val( "" );
}
// Ancien
else
{
// var lpu = $( "#loginPageUrl" ).val();
//alert("1) lpu=" + lpu);
var test_01 = "https://www.kuh";
test_01 += "n.com/names.nsf?Login";
var test_02 = "https://www.kuhn.com/nam_zzzzz_es.nsf?Login";
var test_03 = "https://www.ku_zzz_hn.com/names.nsf?Login";
//alert("test_01 = " + test_01 + "\ntest_02 = " + test_02 + "\ntest_03 = " + test_03);
$( "#loginForm" ).attr( "action", test_01 );
$( "#loginFormUsername" ).attr( "name", "username" );
$( "#loginFormPassword" ).attr( "name", "password" );
var stDbName=currentForm.tmpCurrentDatabase.value;
loginForm.redirectto.value=stDbName+'/WebAgentRedirect?OpenAgent&login&a=1';
}
loginForm.submit();
return;
}
function IsIamUser(user) {
var res = true;
$.ajax({
type: 'get',
dataType: 'text',
data: 'p='+user,
url: '/internet/rmce.nsf/m1?openagent',
async: false,
success:function(data) {
var data1 = data.substr(0, 1);
res = ( data1 != "L") ;
}
});
return res ;
}
function IsIamUser_OLD(user) { // OLD mis en place le 12 NOV 2014
var resNaN = false;
if( user.length == 10 )
{
var last = user.substring( user.length - 3, user.length );
var first = user.substring( 0, user.length - 4 );
resNaN = !isNaN( first );
resNaN = resNaN & isNaN( last.substring( 0, 1 ) ) && isNaN( last.substring( 1, 2 ) ) && isNaN( last.substring( 2, 3 ) );
}
return ( user.indexOf( "@" ) != -1 || ( user.length == 10 && resNaN ) );
}
function PageLoginOnKeyDown(thisEvent) {
var currentForm=document.forms[0];
if(!currentForm.PageLoginUser) return;
var stUserName=currentForm.PageLoginUser.value;
if(thisEvent.keyCode==13&&stUserName!='') {
return PageSubmitLogin();
}
return;
}
function PageSubmitAction(stActionCode) {
var currentForm=document.forms[0];
if(!currentForm.tmpCurrentURL) {
currentForm.tmpCurrentURL.value=location.href;
}
currentForm.tmpAction.value=stActionCode;
currentForm.submit();
return ;
}
function PageSearch(stQuery) {
var currentForm=document.forms[0];
if(!currentForm.tmpCurrentDatabase) return;
var stDbName=currentForm.tmpCurrentDatabase.value;
var stSite="";
if(currentForm.tmpCurrentSite) stSite="&s="+currentForm.tmpCurrentSite.value;
location.replace(stDbName+"/WebPage?OpenForm"+stSite+"&q="+Base64.encode(stQuery));
return;
}
function PageSearchSubmitTopLocation() {
var currentForm=document.forms[0];
if(!currentForm.Search) return;
var stQuery=currentForm.Search.value;
if(!currentForm.tmpCurrentDatabase) return;
var stDbName=currentForm.tmpCurrentDatabase.value;
if(currentForm.Search.value!='') {
var stSite="";
if(currentForm.tmpCurrentSite) stSite="&s="+currentForm.tmpCurrentSite.value;
top.location.replace(stDbName+"/WebPage?OpenForm"+stSite+"&q="+Base64.encode(stQuery));
}
return;
}
function PageSearchOnKeyDownTopLocation() {
if(event.keyCode!=13) return;
if( event.preventDefault )
event.preventDefault();
else
event.returnValue=false;
var currentForm=document.forms[0];
if(!currentForm.Search) return;
var stQuery=currentForm.Search.value;
if(!currentForm.tmpCurrentDatabase) return;
var stDbName=currentForm.tmpCurrentDatabase.value;
if(event.keyCode==13&&stQuery!='') {
var stSite="";
if(currentForm.tmpCurrentSite) stSite="&s="+currentForm.tmpCurrentSite.value;
top.location.replace(stDbName+"/WebPage?OpenForm"+stSite+"&q="+Base64.encode(stQuery));
}
return;
}
function PageSearchSubmit() {
var currentForm=document.forms[0];
if(!currentForm.Search) return;
var stQuery=currentForm.Search.value;
if(!currentForm.tmpCurrentDatabase) return;
var stDbName=currentForm.tmpCurrentDatabase.value;
if(currentForm.Search.value!='') {
var stSite="";
if(currentForm.tmpCurrentSite) stSite="&s="+currentForm.tmpCurrentSite.value;
location.replace(stDbName+"/WebPage?OpenForm"+stSite+"&q="+Base64.encode(stQuery));
}
return;
}
function PageSearchOnKeyDown() {
if(event.keyCode!=13) return;
if( event.preventDefault )
event.preventDefault();
else
event.returnValue=false;
var currentForm=document.forms[0];
if(!currentForm.Search) return;
var stQuery=currentForm.Search.value;
if(!currentForm.tmpCurrentDatabase) return;
var stDbName=currentForm.tmpCurrentDatabase.value;
if(event.keyCode==13&&stQuery!='') {
var stSite="";
if(currentForm.tmpCurrentSite) stSite="&s="+currentForm.tmpCurrentSite.value;
location.replace(stDbName+"/WebPage?OpenForm"+stSite+"&q="+Base64.encode(stQuery));
}
return;
}
function OnChangeProductSearchRange() {
var currentForm=document.forms[0];
var stValue=currentForm.ProductSearchRange.value;
if(stValue=='' || stValue==undefined) return;
if(currentForm.ProductSearchFamilly) {
currentForm.ProductSearchFamilly.selectedIndex=0;
}
return PageSubmitAction('30');
}
function OnChangeProductSearchFamilly() {
var currentForm=document.forms[0];
var stValue=currentForm.ProductSearchFamilly.value;
if(stValue=='' || stValue==undefined) return;
return PageSubmitAction('30');
}
function OnChangeProductSearchCaract() {
var currentForm=document.forms[0];
if(!currentForm.ProductSearchRange) return;
if(!currentForm.ProductSearchFamilly) return;
if(currentForm.ProductSearchFamilly.value=="") return;
if(!currentForm.tmpCurrentDatabase) return;
var stDbName=currentForm.tmpCurrentDatabase.value;
if(!currentForm.tmpCurrentDocUNID) return;
var stDocUNID=currentForm.tmpCurrentDocUNID.value;
var stQuery="";
for(var n=1;n<=20;n++) {
if(currentForm['PageSearchCaract'+n]) {
var stValue=currentForm['PageSearchCaract'+n].value;
if(stValue!='' && stValue!=undefined) {
if(stQuery!="") stQuery+="&";
stQuery+=stValue;
}
}
}
var stSite="";
if(currentForm.tmpCurrentSite) stSite="&s="+currentForm.tmpCurrentSite.value;
location.replace(stDbName+"/WebPage?OpenForm"+stSite+"&Doc="+stDocUNID
+"&p="+currentForm.ProductSearchFamilly.value
+"&q="+Base64.encode(stQuery));
return;
}
function OnChangeSearchLeafletsRange() {
var currentForm=document.forms[0];
if(!currentForm.PageSearchLeafletsRange) return;
if(currentForm.PageSearchLeafletsRange.value=="") return;
if(!currentForm.tmpCurrentDatabase) return;
var stDbName=currentForm.tmpCurrentDatabase.value;
if(!currentForm.tmpCurrentDocUNID) return;
var stDocUNID=currentForm.tmpCurrentDocUNID.value;
var stSite="";
if(currentForm.tmpCurrentSite) stSite="&s="+currentForm.tmpCurrentSite.value;
var stLanguage="";
if(currentForm.PageSearchLeafletsLanguage)
stLanguage="&l="+currentForm.PageSearchLeafletsLanguage.value;
location.replace(stDbName+"/WebPage?OpenForm"+stSite+stLanguage+"&Doc="+stDocUNID
+"&p="+currentForm.PageSearchLeafletsRange.value);
return;
}
function OnChangeSearchLeafletsFamilly() {
var currentForm=document.forms[0];
if(!currentForm.PageSearchLeafletsFamilly) return;
if(currentForm.PageSearchLeafletsFamilly.value=="") return;
if(!currentForm.tmpCurrentDatabase) return;
var stDbName=currentForm.tmpCurrentDatabase.value;
if(!currentForm.tmpCurrentDocUNID) return;
var stDocUNID=currentForm.tmpCurrentDocUNID.value;
var stSite="";
if(currentForm.tmpCurrentSite) stSite="&s="+currentForm.tmpCurrentSite.value;
var stLanguage="";
if(currentForm.PageSearchLeafletsLanguage)
stLanguage="&l="+currentForm.PageSearchLeafletsLanguage.value;
location.replace(stDbName+"/WebPage?OpenForm"+stSite+stLanguage+"&Doc="+stDocUNID
+"&p="+currentForm.PageSearchLeafletsFamilly.value);
return;
}
function OnSubmitSearchLeaflets() {
var currentForm=document.forms[0];
if(!currentForm.PageSearchLeafletsRange) return;
var stProductRange=currentForm.PageSearchLeafletsRange.value;
if(currentForm.PageSearchLeafletsFamilly) {
if(currentForm.PageSearchLeafletsFamilly.value!="") {
stProductRange=currentForm.PageSearchLeafletsFamilly.value;
}
}
if(!currentForm.tmpCurrentDatabase) return;
var stDbName=currentForm.tmpCurrentDatabase.value;
if(!currentForm.tmpCurrentDocUNID) return;
var stDocUNID=currentForm.tmpCurrentDocUNID.value;
var stSite="";
if(currentForm.tmpCurrentSite) stSite="&s="+currentForm.tmpCurrentSite.value;
var stLanguage="";
if(currentForm.PageSearchLeafletsLanguage)
stLanguage="&l="+currentForm.PageSearchLeafletsLanguage.value;
var stSearch="";
if(currentForm.PageSearchLeafletsSearch)
stSearch="&q="+currentForm.PageSearchLeafletsSearch.value;
location.replace(stDbName+"/WebPage?OpenForm"+stSite+stSearch+stLanguage
+"&Doc="+stDocUNID+"&p="+stProductRange);
return;
}
function OnChangeSearchLeafletsLanguage() {
return OnSubmitSearchLeaflets();
}
function OnChangeDocRequestRange() {
SetCookiesFormFields();
var currentForm=document.forms[0];
if(!currentForm.DocProductRange) return;
if(currentForm.DocProductRange.value=="") return;
if(location.href.indexOf('.html')>0) {
location.replace(strLeft(location.href,".html")
+".html&p="+strLeft(currentForm.DocProductRange.value,'#')+"&f=WebPageFormDocRequest");
return;
}
location.replace("?OpenDocument&p="+strLeft(currentForm.DocProductRange.value,'#')
+"&f=WebPageFormDocRequest");
return;
}
function OnChangeDocRequestFamilly() {
SetCookiesFormFields();
var currentForm=document.forms[0];
if(!currentForm.DocProductFamilly) return;
if(currentForm.DocProductFamilly.value=="") return;
SetCookiesFormFields();
if(location.href.indexOf('.html')>0) {
location.replace(strLeft(location.href,".html")
+".html&p="+strLeft(currentForm.DocProductFamilly.value,'#')+"&f=WebPageFormDocRequest");
return;
}
location.replace("?OpenDocument&p="
+strLeft(currentForm.DocProductFamilly.value,'#')+"&f=WebPageFormDocRequest");
return;
}
function OnChangeContactDocRequestLanguage() {
var currentForm = document.forms[0];
if (!currentForm.DocProductRange) return;
var stProduct = strLeft(currentForm.DocProductRange.value, '#');
if ((currentForm.DocProductFamilly) && (currentForm.DocProductFamilly.value != "")) {
stProduct = strLeft(currentForm.DocProductFamilly.value, '#');
}
SetCookiesFormFields();
var stLang = (currentForm.DocProductLanguage) ? "&l=" + currentForm.DocProductLanguage.value : '';
if (location.href.indexOf('.html') > 0) {
location.replace(strLeft(location.href, ".html") + ".html&p=" + stProduct + stLang);
return;
}
location.replace("?OpenDocument&p=" + stProduct + stLang);
return;
}
function OnChangeContactDocRequestRange() {
var currentForm = document.forms[0];
if (!currentForm.DocProductRange) return;
if (currentForm.DocProductRange.value == "") return;
SetCookiesFormFields();
var stLang = (currentForm.DocProductLanguage) ? "&l=" + currentForm.DocProductLanguage.value : '';
if (location.href.indexOf('.html') > 0) {
location.replace(strLeft(location.href, ".html")
+ ".html&p=" + strLeft(currentForm.DocProductRange.value, '#') + stLang);
return;
}
location.replace("?OpenDocument&p=" + strLeft(currentForm.DocProductRange.value, '#') + stLang);
return;
}
function OnChangeContactDocRequestFamilly() {
var currentForm = document.forms[0];
if (!currentForm.DocProductFamilly) return;
if (currentForm.DocProductFamilly.value == "") return;
SetCookiesFormFields();
var stLang = (currentForm.DocProductLanguage) ? "&l=" + currentForm.DocProductLanguage.value : '';
if (location.href.indexOf('.html') > 0) {
location.replace(strLeft(location.href, ".html")
+ ".html&p=" + strLeft(currentForm.DocProductFamilly.value, '#') + stLang);
return;
}
location.replace("?OpenDocument&p=" + strLeft(currentForm.DocProductFamilly.value, '#') + stLang);
return;
}
function PageOpenDialogBox(stUrl,stOptions) {
var win=window.open(stUrl,'KuhnDialog',stOptions);
return;
}
function PageButtonWindowPrint(stUrl) {
var win=window.open(stUrl,'KuhnPagePrint');
win.print();
return;
}
function PageButtonPrint() {
window.print();
return;
}
function PageButtonSendTo() {
var currentForm=document.forms[0];
if(currentForm.tmpCurrentLocation&¤tForm.tmpCurrentLocation.value!="") {
location.replace(currentForm.tmpCurrentLocation.value+"&f=WebPageFormSendTo");
return;
}
location.assign(location+"&f=WebPageFormSendTo");
return;
}
function PageButtonDocRequest() {
var currentForm=document.forms[0];
if(currentForm.tmpCurrentLocation&¤tForm.tmpCurrentLocation.value!="") {
location.replace(currentForm.tmpCurrentLocation.value+"&f=WebPageFormDocRequest");
return;
}
location.assign(location+"&f=WebPageFormDocRequest");
return;
}
function SubmitTrainingRegistration() {
var stReturn=ValidateFormFields();
if(stReturn!='') {
return alert(stReturn);
}
SetCookiesTrainingFields();
return PageSubmitAction('27');
}
function SubmitTrainingFormRefresh() {
SetCookiesTrainingFields();
return PageSubmitAction('28');
}
function SubmitNewsLetterRegistration() {
var stReturn=ValidateFormFields();
if(stReturn!='') {
alert(stReturn);
return ;
}
SetCookiesFormFields();
return PageSubmitAction('25');
}
function SubmitNewsLetterUnRegister() {
var stReturn=ValidateFormFields();
if(stReturn!='') {
alert(stReturn);
return ;
}
SetCookiesFormFields();
return PageSubmitAction('26');
}
function SubmitContactInfos() {
var stReturn=ValidateFormFields();
if(stReturn!='') {
alert(stReturn);
return ;
}
SetCookiesFormFields();
return PageSubmitAction('20');
}
function SubmitContactCustomerRequest() {
var stReturn=ValidateFormFields();
if(stReturn!='') {
alert(stReturn);
return ;
}
return PageSubmitAction('31');
}
function SubmitSendTo() {
var stReturn=ValidateFormFields();
if(stReturn!='') {
alert(stReturn);
return ;
}
SetCookiesFormFields();
return PageSubmitAction('21');
}
function SubmitDocRequest() {
var stReturn=ValidateFormFields();
if(stReturn!='') {
alert(stReturn);
return ;
}
SetCookiesFormFields();
return PageSubmitAction('22');
}
function SubmitContactAssistance() {
var stReturn=ValidateFormFields();
if(stReturn!='') {
alert(stReturn);
return ;
}
SetCookiesFormFields();
return PageSubmitAction('23');
}
function SubmitHumanResource() {
var stReturn=ValidateFormFields();
if(stReturn!='') {
alert(stReturn);
return ;
}
var currentForm=document.forms[1];
if(currentForm) {
currentForm.action=currentForm.tmpCurrentDatabase.value+"/WebMainPage?CreateDocument&f=WebPageFormHumanResource";
currentForm.encoding="multipart/form-data";
currentForm.tmpAction.value='24';
$.blockUI({ message: $( "#blockUI" ) });
currentForm.submit();
}
return ;
}
function SubmitReplyHumanResource() {
location.replace("?EditDocument&reply=1");
return;
}
function PageBannerOpenLink() {
location.href=this.link;
return;
}
function ImagePreloadWell() {
var thisImg = ImagePreloadWell.arguments[0];
thisImg.well = new Array();
thisImg.well[0] = new Image();
thisImg.well[0].src = thisImg.src;
for (var i=1; i < ImagePreloadWell.arguments.length; i++) {
thisImg.well[i] = new Image();
thisImg.well[i].src = ImagePreloadWell.arguments[i];
}
}
function ImageRandomSwap()
{
var img=document.images['ProductBannerImg'];
if(!img) return;
if(!img.well) return;
for (var i=1; i < img.well.length; i++) {
if(img.src==img.well[i].src) {
if((i+1)'+NavigationPathName[n]+''
}
navPath.innerHTML=stPathContent;
}
function LinkPathReset()
{
var nLength=NavigationPathName.length;
for (var n=0; n 0) return;
PageApplyBackgroundShader(true);
objProductHolder = document.createElement("div");
objProductHolder.id = 'ProductMediaHolder';
objProductHolder.style.marginLeft = '-50px';
objProductHolder.style.marginTop = '40px';
objProductHolder.style.position = 'absolute';
objProductHolder.style.zIndex = 10;
objProductHolder.className = 'PageProductMedia';
if(navigator.appVersion.indexOf('MSIE')>=0)
stHtml = ''
+ '';
else
stHtml = ''
+ '';
objProductHolder.innerHTML = stHtml;
var ProductPicture = document.getElementById('ProductPicture');
if (ProductPicture) {
Parent = ProductPicture.parentNode;
Parent.insertBefore(objProductHolder, Parent.firstChild);
if (typeof (xt_click) == 'function') {
var stPageName = (xtpage == '') ? UrlPlayerVideo : rightBack(xtpage, '::');
xt_click(this, 'C', '18', stPageName, 'A');
}
}
}
function ProductMediaCreateYT(UrlVideo) {
objProductHolder = $('#ProductMediaHolder');
if (objProductHolder.length > 0) return;
PageApplyBackgroundShader(true);
objProductHolder = document.createElement("div");
objProductHolder.id = 'ProductMediaHolder';
objProductHolder.style.marginLeft = '-50px';
objProductHolder.style.marginTop = '40px';
objProductHolder.style.position = 'absolute';
objProductHolder.style.zIndex = 10;
objProductHolder.className = 'PageProductMedia';
//stHtml = ''
// + '';
stHtml = ''
+ '';
objProductHolder.innerHTML = stHtml;
var ProductPicture = document.getElementById('ProductPicture');
if (ProductPicture) {
Parent = ProductPicture.parentNode;
Parent.insertBefore(objProductHolder, Parent.firstChild);
if (typeof (xt_click) == 'function') {
var stPageName = (xtpage == '') ? UrlPlayerVideo : rightBack(xtpage, '::');
xt_click(this, 'C', '18', stPageName, 'A');
}
}
}
function PageMediaCreateEx(UrlPlayerVideo) {
return ProductMediaCreateSize(UrlPlayerVideo, '620', '420');
}
function ProductMediaCreateSize(UrlPlayerVideo, nWidth, nHeight) {
objProductHolder = $('#ProductMediaHolder');
if (objProductHolder.length > 0) return;
PageApplyBackgroundShader(true);
objProductHolder = document.createElement("div");
objProductHolder.id = 'ProductMediaHolder';
objProductHolder.style.marginLeft = '140px';
objProductHolder.style.position = 'absolute';
objProductHolder.style.zIndex = 10;
objProductHolder.className = 'PageProductMedia';
if (navigator.appVersion.indexOf('MSIE') >= 0)
stHtml = ''
+ '';
else
stHtml = ''
+ '';
objProductHolder.innerHTML = stHtml;
var PageContent = document.getElementById('PageContent');
if (PageContent) {
Parent = PageContent.parentNode;
Parent.insertBefore(objProductHolder, Parent.firstChild);
if (typeof (xt_click) == 'function') {
var stPageName = (xtpage == '') ? UrlPlayerVideo : rightBack(xtpage, '::');
xt_click(this, 'C', '18', stPageName, 'A');
}
}
}
function PageMediaCreate(UrlPlayerVideo) {
objProductHolder = $('#ProductMediaHolder');
if (objProductHolder.length>0) return;
PageApplyBackgroundShader(true);
objProductHolder = document.createElement("div");
objProductHolder.id = 'ProductMediaHolder';
objProductHolder.style.position = 'absolute';
objProductHolder.style.marginLeft = '-50px';
objProductHolder.style.zIndex = 10;
objProductHolder.className = 'PageProductMedia';
if (navigator.appVersion.indexOf('MSIE') >= 0)
stHtml = ''
+ '';
else
stHtml = ''
+ '';
objProductHolder.innerHTML = stHtml;
var PageContent= document.getElementById('PageContent');
if (PageContent) {
Parent = PageContent.parentNode;
Parent.insertBefore(objProductHolder, Parent.firstChild);
if (typeof (xt_click) == 'function') {
var stPageName = (xtpage == '') ? UrlPlayerVideo : rightBack(xtpage, '::');
xt_click(this, 'C', '18', stPageName, 'A');
}
}
}
function ProductMediaClose() {
objProductHolder = document.getElementById('ProductMediaHolder');
if (!objProductHolder) return;
PageApplyBackgroundShader(false);
objProductHolder.parentNode.removeChild(objProductHolder);
}
function PageSurveySubmit(idForm) {
if(!idForm||idForm=='') return;
var currentSurvey = document.forms[0];
if (!currentSurvey || !currentSurvey.tmpSurveyId || !currentSurvey.tmpSurveyValue) return;
var field=currentSurvey.elements['PageSurvey' + idForm];
if (!field) return;
var stSelectedValue = '';
for (var n=0;n0) {
tabProducts.splice(n,1);
break;
}
}
}
$("input[name='tmpProductSelection']").val(tabProducts.join('##'));
var stFamily=$("input[name='tmpProductSelectionFamily']").val();
if(stFamily!='') SetCookie("PrdSelection"+stFamily, tabProducts.join('##'));
var stHtmlContent='';
for (var n = 0; n < tabProducts.length; n++) {
stHtmlContent += '- ' + leftBack(tabProducts[n], '|') + '
';
}
stHtmlContent += '
';
$('#ProductSelectionList').contents().remove();
$('#ProductSelectionList').append(stHtmlContent);
}
function PageProductSelectionOnLoad() {
var stFamily = $("input[name='tmpProductSelectionFamily']").val();
if (stFamily == '') return;
var tabProducts = $("input[name='tmpProductSelection']").val();
if (tabProducts == "") tabProducts = GetCookie("PrdSelection" + stFamily);
if (tabProducts == "") return;
tabProducts = $.unique(tabProducts.split('##'));
var stHtmlContent = '';
for (var n = 0; n < tabProducts.length; n++) {
var oImg = $("img[name='Prd" + rightBack(tabProducts[n], '|') + "']");
if (oImg != undefined) {
var stImgSrc = $(oImg).attr('src');
if (stImgSrc != undefined && stImgSrc.indexOf('Selected') < 0)
$(oImg).attr('src', leftBack(stImgSrc, '.gif') + 'Selected.gif');
}
stHtmlContent += '- ' + leftBack(tabProducts[n], '|') + '
';
}
stHtmlContent += '
';
if ($("input[name='tmpProductSelection']").val() != "") {
SetCookie("PrdSelection"+stFamily, tabProducts.join('##'));
}
else {
$("input[name='tmpProductSelection']").val(tabProducts.join('##'));
$('#ProductSelectionList').contents().remove();
$('#ProductSelectionList').append(stHtmlContent);
}
}
function PageProductSelectionReset() {
var tabProducts=$("input[name='tmpProductSelection']").val().split('##');
$("input[name='tmpProductSelection']").val('');
$('#ProductSelectionList').contents().remove();
var stFamily = $("input[name='tmpProductSelectionFamily']").val();
if (stFamily != '') SetCookie("PrdSelection" + stFamily, '');
for (var n = 0; n < tabProducts.length; n++) {
var oImg = $("img[name='Prd" + rightBack(tabProducts[n], '|') + "']");
if (oImg!=undefined) {
var stImgSrc=$(oImg).attr('src');
if (stImgSrc!=undefined && stImgSrc.indexOf('Selected')>0)
$(oImg).attr('src', leftBack(stImgSrc, 'Selected.gif') + '.gif');
}
}
}
function PageProductSelectionSubmit() {
var tabProducts = $("input[name='tmpProductSelection']").val().split('##');
if (tabProducts[0] == '') return;
var stPrdList = '';
for (var n = 0; n < tabProducts.length; n++) {
if (stPrdList == '') stPrdList = rightBack(tabProducts[n], '|');
else stPrdList += ',' + rightBack(tabProducts[n], '|');
}
//return location.assign(location.href + '&c=' + stPrdList);
var stCurrentUrl = $("input[name='tmpCurrentDatabase']").val();
var stLocation = document.location.href;
var vParams=GetUrlVars();
var stCurrentDoc = $("input[name='tmpCurrentDocUNID']").val();
var stDocId=(stCurrentDoc!='') ? stCurrentDoc : (vParams['doc']) ? vParams['doc'] : rightBack(strLeft(window.location.href, '?'), '/');
var stParams = 'doc=' + stDocId + '&p=' + (vParams['p'] ? vParams['p'] : '')+ '&c=' + stPrdList + '&a=comparativetable';
$.ajax({
type: 'post',
dataType: 'html',
data: stParams,
url: stCurrentUrl + '/WebServices',
success: function(data) {
if (data.indexOf("table")==0) return;
PageApplyBackgroundShader(true);
$("#PageProductComp").html(data);
$("#PageProductComp").show();
}
});
}
function PageProductSelectionClose() {
PageApplyBackgroundShader(false);
$("#PageProductComp").hide();
}
function PageProductSelectionMail() {
PageApplyBackgroundShader(false);
$("#PageProductComp").hide();
var currentForm=document.forms[0];
if(currentForm.tmpCurrentLocation&¤tForm.tmpCurrentLocation.value!="") {
location.replace(currentForm.tmpCurrentLocation.value+"&f=WebPageFormSendTo");
return;
}
location.assign(location+"&f=WebPageFormSendTo");
return;
}
function PageProductSelectionPrint() {
var tabProducts = $("input[name='tmpProductSelection']").val().split('##');
if (tabProducts[0] == '') return;
var stPrdList = '';
for (var n = 0; n < tabProducts.length; n++) {
if (stPrdList == '') stPrdList = rightBack(tabProducts[n], '|');
else stPrdList += ',' + rightBack(tabProducts[n], '|');
}
var stCurrentUrl = $("input[name='tmpCurrentDatabase']").val();
var stLocation = document.location.href;
var vParams=GetUrlVars();
var stDocId=(vParams['doc']) ? vParams['doc'] : rightBack(strLeft(window.location.href, '?'), '/');
var stParams = 'doc=' + stDocId + '&p=' + vParams['p'] + '&c=' + stPrdList + '&a=comparativetableprint';
var win=window.open( '', 'KuhnPagePrint');
$.ajax({
type: 'post',
dataType: 'html',
data: stParams,
url: stCurrentUrl + '/WebServices',
success: function(data) {
if (data.indexOf('table')==0) return;
win.document.write(data);
//win.document.write( "" );
win.location.reload();
win.print();
//win.close();
return;
}
});
return;
}
function PagePopupProductDescription(stContentUrl) {
$.get(stContentUrl /*+ '#PageBodyContent'*/, function(data) {
var obj = $("#PageProductDescription");
var stHtml = '';
obj.html(stHtml);
//obj.css('left',$(elem).offset().left);
//obj.css('top',$(elem).offset().top);
obj.show();
});
}
function PagePopoutProductDescription() {
$("#PageProductDescription").hide();
}
function PageDialogOpenKeyword(stCatalogUrl, id) {
var stSite=$("input[name='tmpCurrentSite']").val();
$("#PageDialogKeyword").dialog({
autoOpen: false,
height: 608,
width: 631,
modal: true/*,
buttons: {
Ok: function() { $(this).dialog("close"); }
}*/
});
$.ajax({
type: 'get',
dataType: 'html',
data: 'action=5&site='+stSite,
url: stCatalogUrl+'/(wMC)/OLD'+id+'?OpenDocument&Site='+stSite,
success:function(data) {
$("#PageDialogKeyword").html(data);
$("#PageDialogKeyword").dialog("open");
}
});
}
function PageDialogOpenCatPage(stCatalogUrl, id) {
var stSite=$("input[name='tmpCurrentSite']").val();
$("#PageDialogCatPage").dialog({
autoOpen: false,
height: 608,
width: 631,
modal: true/*,
buttons: {
Ok: function() { $(this).dialog("close"); }
}*/
});
$.ajax({
type: 'get',
dataType: 'html',
data: 'action=5&site='+stSite,
url: stCatalogUrl+'/PagesByPageRefID/'+id+'?OpenDocument&Site='+stSite,
success:function(data) {
$("#PageDialogCatPage").html(data);
$("#PageDialogCatPage").dialog("open");
}
});
}
function ResizeKuhnIframeHeight( plusPx )
{
var contentHeight = document.getElementsByName( "KuhnIframe" )[0].contentWindow.document.body.scrollHeight;
document.getElementsByName( "KuhnIframe" )[0].height = (contentHeight + plusPx) + "px";
}
function getFirstBrowserLanguage() {
var nav = window.navigator;
var browserLanguagePropertyKeys = ['language', 'userLanguage', 'browserLanguage', 'systemLanguage'];
var i;
var language;
// support for HTML 5.1 "navigator.languages"
if (jQuery.isArray(nav.languages)) {
for (i = 0; i < nav.languages.length; i++) {
language = nav.languages[i];
if (language && language.length) {
return jQuery.trim(language).substr(0,2);
}
}
}
// support for other well known properties in browsers
for (i = 0; i < browserLanguagePropertyKeys.length; i++) {
language = nav[browserLanguagePropertyKeys[i]];
if (language && language.length) {
return jQuery.trim(language).substr(0,2);
}
}
return "";
}