/* ** Blätterkatalog Integration Script ** ********************************* ** ** 1) addToCart(artno, articleUrl, shopsessionid) ** Wird bei Linktyp "Artikel in Warenkorb legen" ** aufgerufen. ** ** ** 2) blaetterkatalogflip(newPage) ** Blättert auf die gegebene Seite ** Wird bei Linktyp "Gehe zu Seite" verwendet. ** ** TODO: Kann optional verwendet werden ** um mittels ** ** Gehe zu Seite 5 ** ** den Blätterkatalog umzublättern. ** (Beispiel: Auf Kapitel-Startseite blättern) ** ** 3) gotoURL(myURL) ** Wird bei Linktyp "Externer Link" und ** von addToCart aufgerufen ** */ /** */ /** * BEGIN HELPER - FUNCTIONS */ if (typeof String.prototype.startsWith != 'function') { String.prototype.startsWith = function (str){ return this.slice(0, str.length) == str; }; } if (typeof String.prototype.endsWith != 'function') { String.prototype.endsWith = function (str){ return this.slice(-str.length) == str; }; } /** * END HELPER - FUNCTIONS */ function recommendPage(pageNo, senderMail, senderName, receiverMail, receiverName, input, lang, sendCopy) { location.href = "blaetterkatalog/php/web/recommendation.php/recommendation/recommendation/process/?page=" + pageNo + "&senderMail=" + senderMail + "&senderName=" + senderName + "&recipientMail=" + receiverMail + "&content=" + input + "&locale=" + lang + "&sendCopy=" + sendCopy; } function recommendBookmarks(pageNo, nrNameList, idNameList, senderMail, senderName, receiverMail, receiverName, input, lang, sendCopy) { location.href = "blaetterkatalog/php/web/recommendation.php/recommendation/recommendation/process/?page=" + pageNo + "&pagenos=" + idNameList + "&bookmarks=" + nrNameList + "&senderMail=" + senderMail + "&senderName=" + senderName + "&recipientMail=" + receiverMail + "&content=" + input + "&locale=" + lang + "&sendCopy=" + sendCopy; } function trackPageHit(page) { } function addToCart(articleID, articleUrl, shopSessionID) { if (articleUrl != undefined) { if (window.gotoURL) { window.gotoURL(articleUrl); } else { window.open(articleUrl,'_blank'); } }else{ var url = shopURL.replace("[session]", shopSessionID).replace("[article]", articleID); if (shopDebug) alert("ShopSessionID: " + shopSessionID + "\nArtikel " + articleID + " in Detailansicht Shop aufrufen\n\nSHOP URL: " + url); else { if (window.gotoURL) { window.gotoURL(url); } else { window.open(url,'_blank'); } } } } /** * blättert auf die entsprechende seite um * setzt voraus, dass der blätterkatalog in * dem fenster noch geladen ist */ function blaetterkatalogflip(newPage) { flashCommand('jump_to_id', newPage) } /** * sprint zu einer URL * Ziel: Shop-Fenster */ function gotoURL(myURL) { if (myURL.indexOf("mailto:") != -1) { location.href = myURL; return; } if (myURL.indexOf("http://") != 0 && myURL.indexOf("https://") != 0 && myURL.indexOf("mailto:") != 0) { myURL = "http://" + myURL; } try { if (typeof( opener ) == "undefined" || typeof( opener ) == "unknown" || typeof( opener.name ) == "undefined" || typeof( opener.name ) == "unknown") { if (shopFenster.closed) { shopFenster = window.open(myURL, "shop", ""); shopFenster.focus(); } else { shopFenster.location.href = myURL; shopFenster.focus(); } } else { opener.location.href = myURL; opener.blatterkatalogPopup = window; opener.focus(); } } catch (Exception) { if (opener && !opener.closed) { opener.location.href = myURL; opener.focus(); } else { try { if (shopFenster.closed) { shopFenster = window.open(myURL, "shop", ""); shopFenster.focus(); } else { shopFenster.location.href = myURL; shopFenster.focus(); } } catch (Exception) { shopFenster = window.open(myURL, "shop", ""); shopFenster.focus(); } } } } /** * getFlashPath() ermittelt das Flash-Objekt */ function getFlashPath() { if (document.all) { //ie return document.blaetterkatalog; } else { //safari var ffilm = document.getElementById("blaetterkatalog"); try { flashfilm.SetVariable("tst", "1"); } catch (Exception) { //firefox ffilm = document.embeds["blaetterkatalog"]; } return ffilm; } } ///////////////////////////////////// // Funktion zum externen Aufruf der Flash-Commands // id => 'jump_to_id' // par => pageid // aufruf mit z.b. flashCommand('jump_to_id', 5) ///////////////////////////////////// function flashCommand(id, par) { try { var movie = getFlashPath(); movie.SetVariable("jscommand", id + "|" + par); } catch (Exception) { document.getElementById("blaetterkatalog").SetVariable("jscommand", id + "|" + par); } } function getURLParam(strParamName, defaultBKValue) { var strReturn = ""; var strHref = window.location.href; var endIndex = strHref.indexOf("#"); if (endIndex == -1) endIndex = strHref.length; var searchString = strHref.substring(strHref.indexOf("?") + 1, endIndex); var keyValuePairs = searchString.split("&"); for(var i = 0; i < keyValuePairs.length; i++) { if(keyValuePairs[i].startsWith(strParamName)) { strReturn = keyValuePairs[i].substring(keyValuePairs[i].indexOf("=") + 1); break; } } if(strReturn == "" && defaultBKValue) strReturn = defaultBKValue; return strReturn; } window.onerror = stoperror; function stoperror(a) { return false; }