// Lightview
Lightview.options.slideshowDelay=3;


//Prototip
Prototip.Styles.contentLeft={
	className:'tip_yaacool',
	border:5,
	borderColor:'#c6c6c6',
	closeButton:true,
	delay:0,
	hideOn:{element:'closeButton',event:'click'},
	hideAfter:0.5,
	hook:{target:'topLeft',tip:'bottomLeft'},
	images:'http://www.yaacool.com/fileadmin/tpls/res/prototip',
	offset:{x:4,y:0},
	radius:5,
	stem:{position:'bottomLeft',height:12,width:20}
};
Prototip.Styles.contentRight={
	className:'tip_yaacool',
	border:5,
	borderColor:'#c6c6c6',
	closeButton:true,
	delay:0,
	hideOn:{element:'closeButton',event:'click'},
	hideAfter:0.5,
	hook:{target:'topRight',tip:'bottomRight'},
	images:'http://www.yaacool.com/fileadmin/tpls/res/prototip',
	offset:{x:-2,y:0},
	radius:5,
	stem:{position:'bottomRight',height:12,width:20}
};

// toggle helpItems on mainHelpPage [zimt_pi2]
function foldHelp(id) {
	var id_headline='helpPage_headline_'+id;
	var id_text='helpPage_text_'+id;
	if($(id_text)) {
		if($(id_text).getStyle('display')=='none') {
			new Effect.BlindDown(id_text,{duration:0.5});
			$(id_headline).title=titleHide;//global var is defined in ext:zimt_pi2
			$(id_headline).style.backgroundImage='url(fileadmin/tpls/plugin/plugin_zimt/help/minus.gif)';
		} else {
			new Effect.BlindUp(id_text,{duration:0.5});
			$(id_headline).title=titleShow;//global var is defined in ext:zimt_pi2
			$(id_headline).style.backgroundImage='url(fileadmin/tpls/plugin/plugin_zimt/help/plus.gif)';
		}
	}
}


//make hoverBoxes for glossary
document.observe('dom:loaded', function() {
	$$('a.tip').each(function(element) {
		if(element.up('#contentLeft')==undefined) {
			new Tip(element,$(element.rel),{style:'contentRight',title:element.title});
		} else {
			new Tip(element,$(element.rel),{style:'contentLeft',title:element.title});
		}
	});
});


//set Flag for articles
function setFlag(flag) {
	new Ajax.Request('index.php?eID=zimt_flags',{
		parameters:{action:'set_flag',flag:flag},
		onSuccess:function(transport) {
			if(!transport.responseJSON) {alert('ERROR1(no JSON): '+transport.responseText);return;}
			window.location.reload();
		},
		onFailure:function(transport) {
			if(!transport.responseJSON) {alert('ERROR2(no JSON): '+transport.responseText);return;}
			alert('ERROR: '+transport.responseJSON.returnMessage);
		}
	});
}






var class_koreander_teaser=Class.create({
	teaserArray:[],
	activeTeaser:0,

	initialize:function(){
		document.observe('dom:loaded', function(){
			this.teaserArray=$$('.teaser_item');
			this.teaserArray[0].show();
		}.bind(this));
		new PeriodicalExecuter(this.switchPreview.bind(this),10);
	},
	switchPreview:function(){
		wasabi.lib.JSeffect('Fade',this.teaserArray[this.activeTeaser],{afterFinish:function(){
			this.activeTeaser=(this.activeTeaser>=this.teaserArray.length-1?0:this.activeTeaser+1);
			wasabi.lib.JSeffect('Appear',this.teaserArray[this.activeTeaser],{});
		}.bind(this)});
	}
});



var class_koreander_search=Class.create({
	initialize:function(){
		document.observe('dom:loaded', function() {
		  $$('img.tooltip[alt]').each(function(element) {
		    new Tip(element,element.alt,{style:'entry_ico'});
		  });
		});
	}
});


Prototip.Styles.entry_help={
	className:'tip_entry_help',
	border:4,
	borderColor:'#999999',
	radius:4,
	delay:0,
	fixed:true,
	hideOn:'mouseout',
	hook:{target:'topLeft',tip:'bottomLeft'},
	images:'styles/default/',
	stem:{position:'bottomLeft',height:12,width:20},
	offset:{x:4,y:-2},
	width:300
};

Prototip.Styles.entry_ico={
	className:'tip_entry_ico',
	border:4,
	borderColor:'#8d0000',
	closeButton:false,
	delay:0,
	hideOn:'mouseleave',
	hideAfter:false,
	hook:{target:'topLeft',tip:'bottomLeft'},
	images:'styles/bordeaux/',
	offset:{x:4,y:2},
	radius:4,
	stem:{position:'bottomLeft',height:12,width:20}
};

