﻿
/**
 * Otwiera okienko o okreslonych wymiarach.
 */
function window_open(url, w, h) {
	szerokosc = w
	wysokosc  = h
	window.open(url, '_blank', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,width=' + szerokosc + ',height=' + wysokosc + ',scrollbars=yes,resizable=no');
}

/**
 * Otwiera okienko bez rozmiaru.
 */
function window_open2(url) {
    window.open(url, '_blank', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes');
}

/**
 * Zmienia klase obiektu
 */
function changeClass(menu, newClass) { 
	if (document.getElementById) { 
		document.getElementById(menu).className = newClass;
	} 
} 

/**
 * Wysyla mail. Adres jest zakodowany.
 */
function email(addr) {
	window.open('mailto:' + addr);
}

/**
 * Odwraca kolejnosc znakow
 */
function reverse(addr) {
	r = ''
	l = addr.length
	for (i = 0; i < l; i++) {
		r += addr.charAt(l - i - 1);
	}
	return r;
}

// Show/hide element by id
// @ids Id or ids separated by ;
function sh(ids) {
    t = ids.split(';')
    for (i = 0; i < t.length; i++)
        if (document.getElementById)
            with (document.getElementById(t[i]).style) {
                if (display == 'none')
                    display = 'block'
                else
                    display = 'none'
            }
}

/**
 * Zmienia jezyk
 */
function change_lang(lang) {
    url = "http://" + lang + ".flybook.pl"
    if (document.location.pathname)
        url += document.location.pathname 
    if (document.location.search)
        url += document.location.search
    if (document.location.hash)
        url += document.location.hash
    document.location.href = url
}
