/*===================================* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE* DISCLAIMED.  IN NO EVENT SHALL THE PRODUCER OR* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF* SUCH DAMAGE.++++++++++++++++++++++++++++++++++++++++++++++++++++++++  KEEP TRACK OF ALL MODIFICATIONS!                   ++  IF A NEW VERSION IS INSTALLED, MODIFICATIONS MUST  ++  MANUALLY BE TRANSFERRED INTO THE NEW VERSION.      ++  BEST, SAFE A COPY TO A SECURE PLACE!               ++++++++++++++++++++++++++++++++++++++++++++++++++++++++THE PRODUCER:Andreas ImhofEDV-DienstleistungenCH-Guemligen, Switzerlandwww.aiedv.chVersion: 7.11Version date: 20111216===================================*//***************** * customizable functions for article text display * The functions below are called immediately before a clicked article is shown in the right float window. */// ******* clean out some unwanted text or turn what ever is neededfunction clean_content(thestr) {	var re = / \r\n/gi;	var content = thestr.replace(re," ");	re = / \r/gi;	content = content.replace(re," ");	re = / \n/gi;	content = content.replace(re," ");	//re = / \<br\>/gi;	//content = content.replace(re," ");	re = /-\<br\>/gi;	content = content.replace(re,"");	// remove leading 'empty' divs created by 	// like <div class="P_NormalParagraphStyle" data-fontsize="12">&nbsp;</div>	re = /[\n|\r]+\<div .*?\>&nbsp;\<\/div\>/;	do {		var pos = content.search(re);		if (pos != 0) break;	// ON POS 0 ONLY		content = content.replace(re,"");	} while(true);	// kick out manually set font sizes	// uncomment to kick//	re = /font-size:(.)*?pt;/g;//	content = content.replace(re,"");	return(content);}function replaceURLWithHTMLLinks(inputText) {	var replaceText, replacePattern1, replacePattern2, replacePattern3;	//URLs starting with http://, https://, or ftp:// but don't replace existing full link tags	replacePattern1 = /((^|[^"])(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;	replacedText = inputText.replace(replacePattern1, '<a class="wwwLink" href="$1" target="_blank">$1</a>');	//URLs starting with www. (without // before it, or it'd re-link the ones done above)	replacePattern2 = /(^|[^\/])(www\.[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;	replacedText = replacedText.replace(replacePattern2, '$1<a class="wwwLink" href="http://$2" target="_blank">$2</a>');	//Change email addresses to mailto: links	// official email match:  [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?	// ALSO replaces email addresses already linked !!	// --------- currently email not handled	/*  replacePattern3 = /\b([-A-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[-A-Z0-9!#$%&\'*+/=?^_`{|}~-]+)*@(?:[-A-Z0-9](?:[-A-Z0-9-]*[-A-Z0-9])?\.)+[-A-Z0-9](?:[-A-Z0-9-]*[-A-Z0-9])?)/gim;		replacedText = replacedText.replace(replacePattern3, '<a class="mailtoLink" href="mailto:$1">$1</a>');	*/	return replacedText;}// ******* suppress unwanted character attributes set manually from <spanfunction suppress_character_attribs(thestr) {	var suppress = "";	try { suppress = get_moreDocumentInfo("characterAttribsSuppress"); } catch(e){ return(""); }	if ((suppress == "0") || (suppress == "")) return(thestr);				// 0 = leave attribs as is				// 1 = remove font-family				// 2 = remove font-size	var supp = 0;	try { supp = parseInt(suppress); } catch(e) { return(thestr); }	if (supp == 0) return(thestr);	var str = thestr;	// nothing removed so far. add code here	return(str);}// ******* redirect certain oscommerce linksfunction redirect_oscommerce_links(thestr) {	if ((thestr == null) || (thestr == "")) return(thestr);	if (thestr.toLowerCase().indexOf("<a ") < 0) return(thestr);	// MUST BE LOWER CASE! because IE translates all tag names tu UPPER CASE!	str = thestr;	var re_lnk = null;	try {	// old IE 6 cant understand this		re_lnk = new RegExp("<a (.)*?\>","gi");		// get html <a href.....> construct		//re_lnk = /<a (.)*?\>/gi;		// get html <a href.....> construct	}	catch (e) { return (str); }	var a_link_re = re_lnk.exec(str);	var i = 0;		// just a security counter if the regexp can not replace some signatures	var last_found_pos = -1;	while ((a_link_re != null) && (a_link_re[0] != "")) {		var a_link = "" + a_link_re[0];	// the whole <a...> begin link string		var source_string = "advanced_search_result.php.keywords=";		var replace_string = "index\.php\?action=buy_now\&products_id=";		var re = new RegExp(source_string,"gi");		var pos = a_link.search(re);		//alert(a_link + "\n\n" + source_string + "\n\n" + pos);		if (pos >= 0) {			re = /href="(.)*"/;	// get the href attribute			var href_re = re.exec(a_link);			var href = "" + href_re[0];		// the whole href attribute			re = /"(.)*"/;					// get the url in the href attribute			var url_re = re.exec(href);		// the url only			var url = "" + url_re[0];		// ... as string			re = /"/g;						// remove double quotes			url = url.replace(re,"");			// change the progam call 'advanced_search_result.php?keywords=123456' to 'index.php?action=buy_now&products_id=123456'			re = new RegExp(source_string,"gi");			var new_url = url.replace(re,replace_string);						var new_link = "\<a href=\"javascript\:callURL('" + new_url + "',true,'ebshopwin')\" onClick=\"alert(lg[21][cur_lang_ID])\" title=\"" + lg[20][cur_lang_ID] + "\"\>";				re = /\?/g;						// escape ?			var esc_a_link = a_link.replace(re,"\\?");			var rex = new RegExp(esc_a_link);	// the whole original link must be replaced with the new link			str = str.replace(rex, new_link);				/*			re = /</g;			var lnk= a_link.replace(re,"W");			re = />/g;			lnk= lnk.replace(re,"W");			Response.Write(lnk + "<br>");			Response.Write(href + "<br>");			Response.Write(new_url + "<br>");			Response.Write(new_link + "<br>");			return;			*/		}		// find next html link construct		if (i > 1000) break;		a_link_re = re_lnk.exec(str);		i++;	}	return (str);}// ******* re-target links//         check, if links not pointing to this host address should be openened in new window (_target="_blank")var open_url_in_new_window = "";	// set to someting like ".mydomain.com"function retarget_links(thestr,internalURL) {	if ((internalURL == null) || (internalURL =="")) return(thestr);	if ((thestr == null) || (thestr == "")) return(thestr);	if (thestr.toLowerCase().indexOf("<a ") < 0) return(thestr);	// MUST BE LOWER CASE! because IE translates all tag names to UPPER CASE!	str = thestr;	var re_lnk = null;	try {	// old IE 6 can't understand this		re_lnk = new RegExp("<a (.)*?\>","gi");		// get html <a .....> link construct	}	catch (e) { return (str); }	var a_link_re = str.match(re_lnk);	// get all <a links	var i = 0;		// just a security counter if the regexp can not replace some signatures	var last_found_pos = -1;	while ((a_link_re != null) && (i < a_link_re.length) && (a_link_re[i] != "")) {		var a_link = "" + a_link_re[i];	// the whole <a ...> begin link string		//alert("link #"+i + " of " + a_link_re.length + "\n\n" + a_link);		if (a_link_re[i].indexOf("target=") > 0) {			i++;		// do nothing if already contains a target			continue;		}		if (a_link_re[i].indexOf("mailto:") > 0) {			i++;		// do nothing if email link			continue;		}		var source_string = "<a ";		var replace_string = "<a target=\"_blank\" ";	// set to '_top' or '_blank' or any window name		if (a_link_re[i].toLowerCase().indexOf(internalURL) > 0) {	// we want internal inks to show in same window _top			replace_string = "<a target=\"_top\" ";	// set to '_top' or '_blank' or any window name		}		var rel = new RegExp(source_string,"gi");		a_link_re[i] = a_link_re[i].replace(rel,replace_string);		a_link = a_link.replace("\?","\\?");	// escape question mark in source link		//alert("new link #"+i + " of " + a_link_re.length + "\nlink:\n" + a_link + "\nnew link:\n" + a_link_re[i]);		rel = new RegExp(a_link,"gi");		str = str.replace(rel,a_link_re[i]);		// process next html link construct		if (i > 1000) break;		i++;	}	return (str);}/***************** * customizable function for feature pop up. see arrow in top-right corner  * The function below are called after the flip book is loaded. */var features_container = null;var overClearTimeout = null;	// for IE hack - what else?!!!!var keep_open = false;// ******* set up the features popup contentfunction init_features_popup() {	// check if we actually want the features popup	var features_pop = get_site_param("nofeatures");	if (features_pop != null) {		document.getElementById('features_container').style.display = "none";		return;	}	var features_pop = get_site_param("features");	if (features_pop == null) {		features_pop = get_css_value("show_features_pop","zIndex");		if ((typeof features_pop != "undefined") && (features_pop != "")) {	// found in css			if (parseInt(features_pop) != 1) {				document.getElementById('features_container').style.display = "none";				return;			}		}	}	// now the popup content	do {		features_container = null;		try {			features_container = document.getElementById('features_container');		} catch (e) {}		if (features_container == null) break;		// IE6 hack		keep_open = false;	// for IE hack - what else?!!!!		if (document.all && (IEVersion<7)) {			features_container.onmouseover = function() {				keep_open = true;				featuresPop_clearTimeout();				//document.getElementById('info1').innerHTML = "on td";				features_container.className="features_container_IE6hover";				};			features_container.onmouseout = function() { close_features_pop(); };		}		else {			YUI().use("node",				function(Y) {					var featcont = Y.one('#features_container');					featcont.setStyle('display','block');					var onevent = "click";					if (isTouchDevice) onevent = "click";					featcont.on(onevent, function(e) {						//alert(e.currentTarget.get("id"));							e.stopPropagation();							if (e.currentTarget.get("id") != "features_container") return;							if (!featcont.hasClass('features_container_hover')) {	// open features pop								featcont.addClass('features_container_hover');							}							else {	// close features pop								featcont.removeClass('features_container_hover');								//featcont.addClass('features_container');							}						});				});		}		var fc = "";		fc += "<div class=\"features_hint\">Quick Links</div>";		fc += "<div class=\"features_content\">";			if (!isTouchDevice && !is_Opera && !(is_IE && is_IElt9)) {	// suppress scale buttons for certain devices and browsers				fc += "<div>";					fc += "<div id=\"bookscale_state\" style=\"text-align:center;\">&nbsp;</div>";					fc += "<div class=\"features_button_div\" onclick=\"disable_autoPageZoom(false);featuresPop_setHooks();\">Disable Book Scale - leave current scale</div>";					fc += "<div class=\"features_button_div\" onclick=\"disable_autoPageZoom(true);featuresPop_setHooks();\" >Disable Book Scale - reset to original size</div>";					fc += "<div class=\"features_button_div\" onclick=\"enable_autoPageZoom(0.0);featuresPop_setHooks();\" >Enable Book Scale</div>";				fc += "</div>";			}			fc += "<div><br>Producer:<br>Andreas Imhof<br>EDV-Dienstleistungen<br>Switzerland</div>";			fc += "<div class=\"features_link_l\" style=\"margin-top:3px;\"><a href=\"http://www.aiedv.ch\" target=\"_blank\">www.aiedv.ch</a></div>";			fc += "<div><br>This popup window can be customized in the <br>Javascript 'custom.js' to match your needs.</div><br>";		fc += "</div>";		features_container.innerHTML = fc;		// add some IE hacks		setTimeout("featuresPop_setHooks()",50);	} while(false);	return;}function close_features_pop() {	keep_open = false;	//document.getElementById('info1').innerHTML = "off td";	overClearTimeout = setTimeout("do_close_features_pop()",1000);}function do_close_features_pop() {	//document.getElementById('info1').innerHTML = "keep_open: " + keep_open;	if (!keep_open) { features_container.className="features_container"; }}function featuresPop_clearTimeout() {	keep_open = true;	if (overClearTimeout != null) { window.clearTimeout(overClearTimeout); overClearTimeout = null; }	//document.getElementById('info1').innerHTML = "featuresPop_clearTimeout - keep_open: " + keep_open + "\nobj: " + this;}function featuresPop_overContainer (elem) {	// show rows	var tds = elem.getElementsByTagName("td");	for (var i = 1; i < tds.length; i++) {		tds[i].style.display = "";	}	//document.getElementById('info1').innerHTML = "featuresPop_overItem\nevent.srcElement: " + elem + "\nevent.srcElement.id: " + elem.id;}function featuresPop_outContainer (elem) {	// hide rows	var tds = elem.getElementsByTagName("td");	for (var i = 1; i < tds.length; i++) {		tds[i].style.display = "none";	}	//document.getElementById('info1').innerHTML = "featuresPop_outItem\nsrcElement: " + elem + "\nsrcElement.id: " + elem.id;}function featuresPop_overItem (elem) {	featuresPop_clearTimeout();	elem.className = "features_select_hover";	//document.getElementById('info1').innerHTML = "featuresPop_overItem\nsrcElement: " + elem + "\nsrcElement.id: " + elem.id;}function featuresPop_outItem (elem) {	featuresPop_clearTimeout();	elem.className = "features_select";	//document.getElementById('info1').innerHTML = "featuresPop_outItem\nsrcElement: " + elem + "\nsrcElement.id: " + elem.id;}function featuresPop_setHooks() {	try {		var scaleinfodiv = document.getElementById('bookscale_state');		if (_sb_settings.viewMaxScale != 0.0) {			scaleinfodiv.innerHTML = "Book Scale is Enabled";		}		else scaleinfodiv.innerHTML = "Book Scale is Disabled";	} catch(e) {}}/* override variables defined in slidebook.js these settings are set at the start of the page: CSS settings and parameter overrides will WIN! */function sb_settings_Override() {	return;}
