/*

// "Simple Image Rotator" Module for Joomla! 1.0.x - Version 1.0

// License: http://www.gnu.org/copyleft/gpl.html

// Authors: Fotis Evangelou - George Chouliaras

// Copyright (c) 2006 - 2007 JoomlaWorks.gr - http://www.joomlaworks.gr

// Project page at http://www.joomlaworks.gr - Demos at http://demo.joomlaworks.gr

// ***Last update: March 23rd, 2007***

*/


var delay = 5000;

var transition = 40;

var imageContainer = 'jw-sir';

var preLoader = 'jw-sir-loading';

var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;

var divTag = document.createElement("div");

function so_init() {

	if(!d.getElementById || !d.createElement)return;

	imgs = d.getElementById(imageContainer).getElementsByTagName("img");
      
	for(i=1;i<imgs.length;i++) 
    {
        imgs[i].xOpacity = 0;
     
        /*
        divTag.id = "test";
        
        divTag.setAttribute("align","center");
        
        divTag.style.margin = "0px auto";
        
        divTag.className ="dynamicDiv";
        
        divTag.innerHTML = "This <b>HTML Div tag</b> is created using Javascript DOM dynamically.";

        document.body.appendChild(divTag); 
        */
    }


	imgs[0].style.display = "block";

	imgs[0].xOpacity = .99;

	setTimeout(so_xfade,delay);

}

function so_xfade() {

	cOpacity = imgs[current].xOpacity;

	nIndex = imgs[current+1]?current+1:0;

	nOpacity = imgs[nIndex].xOpacity;

	cOpacity-=.05; 

	nOpacity+=.05;

	imgs[nIndex].style.display = "block";

	imgs[current].xOpacity = cOpacity;

	imgs[nIndex].xOpacity = nOpacity;

	setOpacity(imgs[current]); 

	setOpacity(imgs[nIndex]);

	if(cOpacity<=0) {

		imgs[current].style.display = "none";

		current = nIndex;

		setTimeout(so_xfade,delay);

	} else {

		setTimeout(so_xfade,transition);

	}

	function setOpacity(obj) {

		if(obj.xOpacity>.99) {

			obj.xOpacity = .99;

			return;

		}

		obj.style.opacity = obj.xOpacity;

		obj.style.MozOpacity = obj.xOpacity;

		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";

	}

}

function hideLoading() {document.getElementById(preLoader).style.display = 'none';}



// Load everything up

function init_ahr() {

    if (arguments.callee.done) return;

    arguments.callee.done = true;

		so_init();

		hideLoading();

};

// DOM2

if ( typeof window.addEventListener != "undefined" ) { window.addEventListener( "load", init_ahr, false ); }

// IE 

else if ( typeof window.attachEvent != "undefined" ) { window.attachEvent( "onload", init_ahr ); }

else {

	if ( window.onload != null ) {

		var oldOnload = window.onload;

		window.onload = function ( e ) {

			oldOnload( e );

			init_ahr();

		};

	}

	else 

		window.onload = init_ahr;

}

function moveTo(obj, x, y) {
        if (document.getElementById) {
        document.getElementById('menuDiv').style.left = x;
        document.getElementById('menuDiv').style.top = y;
        }
}

function init(){
        if(document.getElementById){
        obj = document.getElementById("menuDiv");
        obj.style.top = "-170px";
        }
}

function slideDown(){
        if(document.getElementById){
                if(parseInt(obj.style.top) < 0){
                        obj.style.top = parseInt(obj.style.top) + 10 + "px";
                        setTimeout("slideDown()",50);
                }
        }
}

function slideUp(){
        if(document.getElementById){
                if(parseInt(obj.style.top) > -170){
                        obj.style.top = parseInt(obj.style.top) - 10 + "px";
                        setTimeout("slideUp()",50);
                }
        }
}
/* ENDE Crossfade */
/*** NMDF-Klappfunktion ***/
function display(c_name){
	rubik=document.getElementById(c_name).style;
	if(rubik.display=="none"){
		rubik.display="inline";
	}else if(rubik.display=="inline" || rubik.display==""){
		rubik.display="none";
	}
}

function printOrder(URL){
 _order = window.open(URL,'_order','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=620,height=500');
 _order.focus();
}

function audiopopup(site)
{
win = open(site,"audiopopup","width=320,height=60,screenX=0,screenY=0,menubar=no,scrollbars=no,resizable=no");
win.focus()
}

function videopopup(site)
{
win = open(site,"videopopup","width=480,height=400,screenX=0,screenY=0,menubar=no,scrollbars=no,resizable=no");
win.focus()
}

function textpopup(site)
{
win = open(site,"zoom","width=500,height=500,screenX=0,screenY=0,menubar=no,scrollbars=yes,resizable=no");
win.focus()
}

function promotion(site)
{	
	win = open(site,"zoom","width=380,height=245,screenX=0,screenY=0,menubar=no,scrollbars=no,resizable=no");
	win.focus()
}

function zoom(site)
{	
	win = open(site,"zoom","width=500,height=500,screenX=0,screenY=0,menubar=no,scrollbars=no,resizable=no");
	win.focus()
}

function newsopen(site)
{	
	win = open(site,"news","width=640,height=530,screenX=0,screenY=0,menubar=no,scrollbars=yes,resizable=yes");
	win.focus()
}

function zoom_product(site)
{	
	win = open(site,"zoom_product","width=500,height=500,screenX=0,screenY=0,menubar=no,scrollbars=no,resizable=no");
	win.focus()
}

function popup(URL,breite,hoehe){
 win = window.open(URL,'win','toolbar=yes,location=yes,directories=yes,status=yea,menubar=yes,scrollbars=yes,resizable=yes,width=' + breite + ',height=' + hoehe +'');
 win.focus();
}


function winopen(site)
{	
	win = open(site,"win","width=640,height=480,screenX=0,screenY=0,menubar=no,scrollbars=yes,resizable=no");
	win.focus()
}

function mapopen(site)
{	
	win = open(site,"map","width=730,height=570,screenX=0,screenY=0,menubar=no,scrollbars=no,resizable=yes");
	win.focus()
}

function winopennew(site)
{	
	win = open(site,"confirm","width=250,height=200,screenX=0,screenY=0,menubar=no,scrollbars=no,resizable=no");
	win.moveTo((screen.width/2)-125,(screen.width/2)-200);
	win.focus()
}


function NewWindow(mypage,myname,w,h,scroll,pos)
{
var win=null;
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
}

function NewPopup(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

