th5 = {} ; /* Konstruktordings */ th5.init = function() { this.session = this.getSession() ; this.head = document.getElementsByTagName("HEAD")[0] ; this.src = this.getElm("th5_core").src ; this.host = window.location.hostname ; this.params = this.getGetVars() ; this.setCSS(this.src + "style.css", true); this.cursor_count = 0 ; this.stat = 0; this.request_id = 0 ; this.queryQueue = []; this.createTH5Credits() // powered by Travelhit } /* setzt das Stylesheet, kann manuell �berschrieben werden */ th5.setCSS = function(src, firstplace) { var css = document.createElement("link"); css.rel = "stylesheet" ; css.type = "text/css" ; css.href = src ; if( firstplace!= undefined && this.head.hasChildNodes()) this.head.insertBefore(css, this.head.firstChild) ; else this.head.appendChild(css) ; } /* powered by Travelhit */ th5.createTH5Credits = function() { document.title += " - powered by Urlaubsmacher" ; var link = document.createElement("a"); link.style.width="100%"; link.style.textAlign="center"; link.style.fontFamily="arial"; link.style.fontSize="10px"; link.style.color="#999999"; link.style.marginTop="9px"; link.style.marginBottom="9px"; link.style.display="inline"; link.style.visibility="visible"; link.setAttribute("href","http://www.solution-x.com"); link.setAttribute("target","_blank"); link.innerHTML = "powered by Urlaubsmacher.at | © solution-x & TraviAustria 2005"; if(this.getElm("th5_d_poweredby")) { this.getElm("th5_d_poweredby").innerHTML = ""; this.getElm("th5_d_poweredby").style.display = ""; this.getElm("th5_d_poweredby").style.visibility = ""; this.getElm("th5_d_poweredby").style.zIndex = "9999999"; this.getElm("th5_d_poweredby").appendChild(link); } else document.body.appendChild(link); } /* �bernimmt eine vorhandene Session aus einem Cookie oder erzeugt eine neue auf Basis der php-eingeparsten $sid */ th5.getSession = function() { var cookies = th5.getCookies() ; if(cookies["th5_sid"]) return cookies["th5_sid"] ; var sid = "c78f0246ecbb2d2b8e85375ecbd99ff3" ; th5.setCookie("th5_sid", sid) ; return sid ; } /* holt ein Cookie */ th5.getCookies = function() { var cookie_list ; var cookies ; var i ; if (!document.cookie) return {} ; cookie_list = document.cookie.split(";") ; cookies = {} ; for (i=0; i < cookie_list.length; i++) { cookie = cookie_list[i].split("=") ; if (cookie.length < 2) continue ; cookies[th5.removeAllWS(cookie[0])] = th5.removeAllWS(cookie.slice(1,cookie.length).join("=")) ; } return cookies ; } /* setz ein Cookie */ th5.setCookie = function(name,value) { document.cookie = (name + "=" + value) ; } /* liest alle GET-Variablen und gibt diese als Hash zur�ck wird automatisch in th5.init aufgerufen und bef�llt th5.params */ th5.getGetVars = function(){ var vars = {} ; var pairs = [] ; var pair = [] ; if(window.location.search == "") return vars ; var query_str = window.location.search.substr(1,window.location.search.length-1); pairs = query_str.split('&') ; for(var i = 0 ; i < pairs.length; i++){ pair = pairs[i].split('=') ; if(pair.length == 2) { vars[pair[0]] = pair[1] ; } } return vars ; } /* Zugriffsfunktion auf th5.params */ th5.getParam = function(name){ return th5.params[name] ; } /* Wrapper f�r document.getElementById() */ th5.getElm = function(id){ return document.getElementById(id) ; } /* Workaroundwrapper f�r document.getElementsByName() -> getElementsByName funktioniert in IE falsch! */ th5.getElms = function(tag,name){ var a = [] ; var elms = document.getElementsByTagName(tag) ; for(var i = 0; i < elms.length; i++) if(elms[i].getAttribute("name") == name) a[a.length] = elms[i] ; return a ; } /* removes all Whitespaces (Flo-Magic) */ th5.removeAllWS = function(str) { return str.replace(/(\n)|(\r)|(\t)|( )/, "") ; } /* entfernt ein Element aus dem DOM */ th5.remove = function(id){ /* ie crashes if this is done... if(!this.getElm(id)) { alert('Couldnt remove '+id); return; } this.head.removeChild(this.getElm(id)); */ this.setStatus(false); } /* erzeugt einen Script-Tag f�r den Scriptinghost */ th5.require = function(url) { th5.requireWithStatus(url, true); } th5.requireWithStatus = function(url, status){ var scriptTag = document.createElement("SCRIPT"); scriptTag.charset = "utf-8" ; scriptTag.id = "th5_request_" + this.request_id++ ; var src = this.src + url + "&host=" + this.host + "&PHPSESSID=" + this.session + "&loaderid=" + scriptTag.id; scriptTag.src = src ; scriptTag.type = "text/javascript" ; this.setStatus(status); this.head.appendChild(scriptTag) ; } /* setzt den TravelHit Status */ th5.setStatus = function(onoff) { if(onoff) { document.body.style.cursor = "wait"; window.status ="Loading TravelHit http://" + this.host ; if(this.getElm('th5_d_loading')) this.getElm('th5_d_loading').style.display = '' ; this.cursor_count++; this.stat++; } else { this.cursor_count--; if(this.cursor_count < 0) this.cursor_count = 0; if(this.cursor_count == 0) document.body.style.cursor = "default" ; this.stat--; if(this.stat < 0) this.stat = 0; if(this.stat == 0){ window.status = "" ; if(this.getElm('th5_d_loading')) this.getElm('th5_d_loading').style.display = 'none' ; } } } /* #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### */ th5.action = function(obj){ query = "load.js.php?" ; for(var key in obj) { query += key + "=" + obj[key] + "&" ; } if(obj.withoutStatusChange != undefined) { th5.requireWithStatus(query, false); } else { th5.require(query); } } th5.actionQueue = function(obj){ query = "load.js.php?" ; for(var key in obj) query += key + "=" + obj[key] + "&" ; th5.add2RequireQueue(query); } th5.versionConvert = function(settings){ // convertiert inkompatible settings if(settings) settings = settings.replace(/action=/,"v50_action=") ; return settings ; } th5.switchDiv = function(obj){ if(!obj){ return; } if(th5.activeDiv) th5.activeDiv.style.display = 'none'; if(th5.activeIndex){ th5.activeIndex.className = 'article_index_visited'; } obj.className = 'article_index_active' ; th5.activeIndex = obj ; th5.activeDiv = document.getElementById(obj.id) ; th5.activeDiv.style.display = ''; } th5.getKeyCode = function(ev) { if(!ev) { ev = window.event; } return ev.keyCode; } th5.add2RequireQueue = function(query) { this.queryQueue.push(query); } th5.requireQueue = function(){ var scriptTag = document.createElement("SCRIPT"); scriptTag.charset = "utf-8" ; scriptTag.id = "th5_request_" + this.request_id++ ; var src = this.src + "load.js.php?host=" + this.host + "&PHPSESSID=" + this.session + "&loaderid=" + scriptTag.id + "&xtPage="; for(var i = 0; i< th5.queryQueue.length; i++) { // replace ? and & th5.queryQueue[i] = th5.queryQueue[i].replace(/\?/g,"-QM-"); th5.queryQueue[i] = th5.queryQueue[i].replace(/&/g,";"); // compress query th5.queryQueue[i] = th5.queryQueue[i].replace(/module/g,":M"); th5.queryQueue[i] = th5.queryQueue[i].replace(/action=load/g,":L"); th5.queryQueue[i] = th5.queryQueue[i].replace(/action/g,":A"); th5.queryQueue[i] = th5.queryQueue[i].replace(/dataset/g,":DS"); th5.queryQueue[i] = th5.queryQueue[i].replace(/cartadd3step/g,":CA3"); th5.queryQueue[i] = th5.queryQueue[i].replace(/cartadd/g,":CA"); th5.queryQueue[i] = th5.queryQueue[i].replace(/cartview/g,":CV"); th5.queryQueue[i] = th5.queryQueue[i].replace(/customer/g,":CU"); th5.queryQueue[i] = th5.queryQueue[i].replace(/ticker/g,":TI"); th5.queryQueue[i] = th5.queryQueue[i].replace(/detail/g,":DE"); th5.queryQueue[i] = th5.queryQueue[i].replace(/teaser/g,":TS"); th5.queryQueue[i] = th5.queryQueue[i].replace(/quicksearch/g,":QS"); th5.queryQueue[i] = th5.queryQueue[i].replace(/fastsearch/g,":FS"); th5.queryQueue[i] = th5.queryQueue[i].replace(/urlaubsbox/g,":UB"); th5.queryQueue[i] = th5.queryQueue[i].replace(/bestpreis/g,":BP"); th5.queryQueue[i] = th5.queryQueue[i].replace(/templatedirectory/g,":TD"); th5.queryQueue[i] = th5.queryQueue[i].replace(/language/g,":SP"); th5.queryQueue[i] = th5.queryQueue[i].replace(/newsletter/g,":NL"); th5.queryQueue[i] = th5.queryQueue[i].replace(/th5_/g,":5"); src +="&req["+i+"]="+th5.queryQueue[i]; } scriptTag.src = src ; scriptTag.type = "text/javascript" ; this.setStatus(true); this.head.appendChild(scriptTag) ; } /* #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### */ th5.onload = function() { // initiate this script th5.init() ; var th5Tags = document.getElementsByTagName("TravelHit"); var o, th_itemname, th_items, query, basequery; for(var i=0; i < th5Tags.length; i++) { o = th5Tags[i]; basequery = "module=" + o.id + "&action=load&"; th_itemname = o.id.replace(/th5_/,"th5_d_"); th_items = th5.getElms("div",th_itemname); if(th_items.length == 0) { query = basequery + "th5_id=" + th_itemname + "&" + th5.versionConvert(o.getAttribute("settings")); if(o.id == "th5_stylesheet") { query += "&href="+o.getAttribute("path"); } th5.add2RequireQueue(query); } else { for(var j = 0; j < th_items.length; j++) { th_items[j].setAttribute("id",th_itemname + "_" + j); query = basequery + "th5_id=" + th_items[j].getAttribute("id") + "&"; query += th5.versionConvert(o.getAttribute("settings")) + "&"; query += th5.versionConvert(th_items[j].getAttribute("settings")); th5.add2RequireQueue(query); } } } th5.requireQueue(); } onload = function() { th5.onload(); }