//General global variables:
var homePath = "/";
function none(){}
function displayPage(id,caller){
page = document.getElementById(id);
book = page.parentNode;
pages = book.getElementsByTagName("div");
for(curPage = 0; curPage < pages.length; curPage++){
if(pages[curPage].className){
pages[curPage].className = pages[curPage].className.replace('cur', "");
if(pages[curPage].className == "index"){
for(link = 0; link < pages[curPage].childNodes.length;link++)
if(pages[curPage].childNodes[link].className)
pages[curPage].childNodes[link].className = pages[curPage].childNodes[link].className.replace('cur', "");
}
}
}
page.className += " cur";
caller.className += " cur";
}
function is_function(a) { return typeof a == 'function'; }
cTicker.callMove = function(obj){
obj.moveticker(obj);
}
cTicker.callStopTicker = function(obj){
obj.stopTicker();
}
cTicker.callResumeTicker = function(obj){
obj.resumeTicker();
}
function cTicker() {
var pathFinder = new Object();
var imageSelector = new Object();
function openImageSelector(objId,withHomePath,callBackFunc){
imgtool = window.open("http://justfor.de//cms/imggallery/imgselector.php",""
,"width=650,height=550,dependent=yes,location=no,menubar=no,toolbar=no, scrollbars=yes, resizable=yes");
imageSelector.callback = function (value){
if(this.withHomePath)
value = "/images/gallery/"+value;
if(!this.valid.tagName)
document.getElementById(this.valid).value = value;
else
this.valid.value = value;
}
if(callBackFunc){
imgtool.onchange = callBackFunc;
}
imageSelector.valid = objId;
imageSelector.withHomePath = withHomePath;
}
var ticker;
var ticker2;
this.tickerInit = function(obj,news,hack){
this.ticker = document.createElement("div");
this.ticker.style.position = "absolute";
this.ticker.style.top ="0px";
this.ticker.style.left ="-15px";
this.ticker.style.visibility ="hidden";
this.ticker.innerHTML = news;
Classobj = this;
this.ticker.onmouseover = function() {cTicker.callStopTicker(Classobj)};
this.ticker.onmouseout = function() {cTicker.callResumeTicker(Classobj)};
this.ticker2 = this.ticker.cloneNode(true);
this.ticker2.onmouseover = function() {cTicker.callStopTicker(Classobj)};
this.ticker2.onmouseout = function() {cTicker.callResumeTicker(Classobj)};
obj.appendChild(this.ticker);
obj.appendChild(this.ticker2);
var origiWidth = this.ticker.offsetWidth;
var height = 25;
while((this.ticker.offsetWidth <= (obj.offsetWidth-10))
&&(this.ticker.offsetHeight < height)
&&(this.ticker.offsetWidth > 10)){
this.ticker.innerHTML += hack + this.ticker.innerHTML;
this.ticker2.innerHTML += hack + this.ticker2.innerHTML;
}
if(this.ticker.innerHTML != "") {
this.ticker.innerHTML += hack;
this.ticker2.innerHTML += hack;
}
this.ticker.style.width = (this.ticker.offsetWidth) +"px";
while(this.ticker.offsetHeight > height){
this.ticker.style.width = (parseInt(this.ticker.style.width) + 1) + "px";
this.ticker2.style.width = (parseInt(this.ticker.style.width) + 1) + "px";
}
this.ticker.style.left = obj.offsetWidth +"px";
this.ticker2.style.left = obj.offsetWidth +"px";
this.ticker.style.visibility = "visible";
this.ticker2.style.visibility = "visible";
this.moveticker();
}
this.stopTicker = function(){
this.nomove = true;
}
this.resumeTicker = function(){
this.nomove = false;
}
this.moveticker = function(){
if(this.nomove)
return;
if((parseInt(this.ticker.style.left) + this.ticker.offsetWidth) > 0)
this.ticker.style.left = (parseInt(this.ticker.style.left) - 1) +"px";
if(((parseInt(this.ticker.style.left) + this.ticker.offsetWidth +0) < this.ticker.parentNode.offsetWidth )
||(parseInt(this.ticker2.style.left) < parseInt(this.ticker.style.left))){
if((parseInt(this.ticker2.style.left) + this.ticker2.offsetWidth) > 0)
this.ticker2.style.left = (parseInt(this.ticker2.style.left) - 1) +"px";
}
if((parseInt(this.ticker.style.left) + this.ticker.offsetWidth +0) < this.ticker.parentNode.offsetWidth ){
if(parseInt(this.ticker2.style.left) < parseInt(this.ticker.style.left))
this.ticker2.style.left = this.ticker.parentNode.offsetWidth +"px";
}
if((parseInt(this.ticker2.style.left) + this.ticker2.offsetWidth +0) < this.ticker.parentNode.offsetWidth ){
if(parseInt(this.ticker.style.left) <= parseInt(this.ticker2.style.left))
this.ticker.style.left = this.ticker.parentNode.offsetWidth +"px";
}
if(parseInt(this.ticker.style.left) == 0)
this.ticker2.style.left = this.ticker.parentNode.offsetWidth +"px";
var obj = this;
if(!this.interval)
this.interval = setInterval(function(){ cTicker.callMove(obj)},25);
}
return this;
}
/*
Formular-functions
*/
function formSubmitAction(obj,action){
if(!obj.id){
obj = document.getElementById(obj);
}
obj.action = action;
obj.submit();
}
function form_setOnValueLengthJump(obj,length,target,noselect){
if(!obj.id)
obj = document.getElementById(obj);
if(!obj)
obj = document.getElementsByName(obj)[0];
if(!target.id)
target = document.getElementById(target);
if(!target)
target = document.getElementsByName(target)[0];
if(!(obj&&target))
return false;
obj.onkeyup = function (){
if(obj.value.length >= length){
target.focus();
if((target.select)&&(!noselect))
target.select();
}
}
}
function expandContent(id) {
//if(!document.getElementById(id).value)
// document.getElementById(id).value="2";
//document.getElementById(id).type="exp";
//alert("blubb");
/*if(document.getElementById(id).value=="1")
document.getElementById(id).value="2";
else
document.getElementById(id).value="1";*/
if(document.getElementById(id).className.indexOf("expanded")==-1)
document.getElementById(id).className += " expanded";
else
document.getElementById(id).className= document.getElementById(id).className.replace(/ expanded/, "");
}
function isArray(a) {
return isObject(a) && a.constructor == Array;
}
function isObject(a) {
return (a && typeof a == 'object') || isFunction(a);;
}
function isFunction(a) {
return typeof a == 'function';
}
function isNumber(a) {
return typeof a == 'number' && isFinite(a);
}
function isString(a) {
return typeof a == 'string';
}
function copyArray(array){
var arr = new Array();
for(var i = 0;i < array.length;i++){
if(isArray(array[i]))
arr[i] = copyArray(array[i]);
else if(isObject(array[i]))
arr[i] = copyObject(array[i]);
else
arr[i] = array[i];
}
return arr;
}
function copyObject(obj){
var newobj = new Object();
for(var i in obj){
/*if(isArray(obj[i]))
newobj[i] = copyArray(obj[i]);
else if(isObject(obj[i]))
newobj[i] = copyObject(obj[i]);
else*/
newobj[i] = obj[i];
}
return newobj;
}
function addslashes(str) {
str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
str=str.replace(/\\/g,'\\\\');
str=str.replace(/\0/g,'\\0');
return str;
}
function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\\\/g,'\\');
str=str.replace(/\\0/g,'\0');
return str;
}
var debugbuild = true;
var debugrow = 0;
function debug(text){
if(!debugbuild)
return;
theTime = new Date().getTime();
if(document.getElementById("debug")){
document.getElementById("debug").appendChild(document.createTextNode(debugrow+" at "+theTime+": "+ text));
document.getElementById("debug").appendChild(document.createElement("br"));
}
//document.getElementById("debug").innerHTML += debugrow+" at "+theTime+": "+ text + "
";
debugrow++;
}