// Init erst wenn das DOM fertig ist, da die Inhalte sonst
// nicht korrekt verarbeitet werden koennen
YAHOO.util.Event.onDOMReady(wiroInit);

function wiroInit() {
	// Laden der Schriftgroesse mit Hilfe des Cookie
	FontSize(0);
	wiroTextpicReplacement();
};

//	2010-11-26 Michael Reiher
//		* Plus-Bilder in Klick-Vergroesserung
function wiroTextpicReplacement() {
	el = YAHOO.util.Selector.query('a[rel*=shadowbox]');
	for (i=0;i<el.length;i++) {
	  el[i].innerHTML += '<img class="plus" src="/fileadmin/Stadtwerke-Aachen/gfx/plus.gif" />';
	}
};

// Modified from Bill Dortch's Cookie Functions (hidaho.com) 
// (found in JavaScript Bible)
function setCookie(name, value, days, path, domain, secure){
    var expires, date;
    if (typeof days == "number") {
        date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        expires = date.toGMTString();
    }
    document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
};

// Modified from Jesse Chisholm or Scott Andrew Lepera ?
// (found at both www.dansteinman.com/dynapi/ and www.scottandrew.com/junkyard/js/)
function getCookie(name){
    var nameq = name + "=";
    var c_ar = document.cookie.split(';');
    for (var i = 0; i < c_ar.length; i++) {
        var c = c_ar[i];
        while (c.charAt(0) == ' ') 
            c = c.substring(1, c.length);
        if (c.indexOf(nameq) == 0) 
            return unescape(c.substring(nameq.length, c.length));
    }
    return null;
};

// from Bill Dortch's Cookie Functions (hidaho.com) 
function deleteCookie(name, path, domain){
    if (getCookie(name)) {
        document.cookie = name + "=" +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

function FontSize(newSize){
    if (newSize == 0) {
        var cookieSize = getCookie('swafontsize');
        if (cookieSize == null) {
            newSize = 2;
        }
        else {
            newSize = cookieSize;
        }
    }
    setCookie('swafontsize', newSize, 180, "/");
    YAHOO.util.Dom.removeClass('swaDoc', 'swaDocSize1');
    YAHOO.util.Dom.removeClass('swaDoc', 'swaDocSize2');
    YAHOO.util.Dom.removeClass('swaDoc', 'swaDocSize3');
    YAHOO.util.Dom.addClass('swaDoc', 'swaDocSize' + newSize);
};

function formatDate(value){
    if (value < 10) 
        return '0' + value;
    else 
        return value;
};

function printDate(){
    var Datum = new (Date);
    var day = formatDate(Datum.getDate());
    var month = formatDate(Datum.getMonth() + 1);
    var year = formatDate(Datum.getFullYear());
    return day + '.' + month + '.' + year;
}


/* STAWAG Scripte */
function on(o){
    o.src = o.src.replace('_off.gif', '_on.gif');
};

function off(o){
    o.src = o.src.replace('_on.gif', '_off.gif');
};

function FP_preloadImgs(){//v1.0
    var d = document, a = arguments;
    if (!d.FP_imgs) 
        d.FP_imgs = new Array();
    for (var i = 0; i < a.length; i++) {
        d.FP_imgs[i] = new Image;
        d.FP_imgs[i].src = a[i];
    }
};

function on_2(o){
    o.style.backgroundImage = o.style.backgroundImage.replace('_off.gif', '_over.gif');
};

function off_2(o){
    o.style.backgroundImage = o.style.backgroundImage.replace('_over.gif', '_off.gif');
};

function on_3(o){
    o.src = o.src.replace('_off.gif', '_over.gif');
};

function off_3(o){
    o.src = o.src.replace('_over.gif', '_off.gif');
};


/* ENDE - STAWAG Scripte */

