/* Shadowbox Movie */
function openShadowbox(content, title, width, height){
    Shadowbox.open({
        content:    content,
        player:     'flv',
        title:      title,
        width:      width,
        height:     height,
        options: {
          flashVars: {
            width:         width,
            height:        height+20,
            displayheight: height,
            frontcolor:    '0xFFFFFF',
            backcolor:     '0xFF0000',
            lightcolor:    '0xFFFFFF',
            screencolor:   '0x000000',
            /*overstretch:   'fit', */
            autostart:     true,
            showicons:     false,
            showdigits:    false
          }
        }
    });
}

/* TextBild Slideshow */
function switchbox(itemsId){
	this.itemsId = itemsId;
	this.count = '';
	this.actIndex = 0;

	this.show = function (newIndex){

		document.getElementById(this.itemsId + 'I' + this.actIndex).style.display = 'none';
		document.getElementById(this.itemsId + 'I' + newIndex).style.display = 'block';

    document.getElementById(this.itemsId + 'I' + this.actIndex + '_caption').style.display = 'none';
		document.getElementById(this.itemsId + 'I' + newIndex + '_caption').style.display = 'block';

		this.actIndex = newIndex;
	}

	this.main = function (direction){
		var newIndex;

		newIndex = this.actIndex;
		if(direction == 'down') newIndex++;
		else newIndex--;

		if(newIndex < 0) newIndex = this.count-1;
		if(newIndex >= this.count) newIndex = 0;

		this.show(newIndex);
	}

	this.next = function (){
		this.main('down');
	}

	this.prev = function (){
		this.main('up');
	}
}
/* Newsletter Popup */
function winFlashOpen(f, n, w, h) {
  w = window.open(f,n,'width='+w+',height='+h+',left='+(screen.width/2-w/2)+',top='+(screen.height/2-h/2)+',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
  w.focus();
}
function FormSubscribe(f_lang, catid) {
  var f_email = document.newsletterform.email.value;
  winFlashOpen('http://newsletter.caritas.ch/index.php?pid=10&email='+f_email+'&cat='+catid+'&lang='+f_lang+'&html=y','Subscribe',500,445);
}
function FormUnsubscribe(f_lang) {
  winFlashOpen('http://newsletter.caritas.ch/index.php?pid=20&lang='+f_lang,'Unsubscribe',400,200);
}
