/**
 * 	This file holds the behavior rules for the DC/eMailadmin
 * 
 * 	NOTE: Any triggered Element hold two classnames - one with 
 * 	the event-trigger and one with the ID. That's why we have to use split 
 * 	to separate the classes for further actions.
 * 
 * 	@author	Mario Heiderich <mario.heiderich@doccheck.com>
 */

var objMyrules = {

		/**
		 *	Rules for the std navigation
		 * 	
		 * 	@author	Mario Heiderich <mario.heiderich@doccheck.com>
		 */
		 
		'.divDCNaviLevelOneInactiveContainer' : function(objElement){
			objElement.onmouseover 	= function(){
				objElement.style.backgroundImage = 'url(/_img/_navi/dcnavi_level1_bg_active.gif)';	
			}
			objElement.onmouseout 	= function(){
				objElement.style.backgroundImage = 'url(/_img/_navi/dcnavi_level1_bg_inactive.gif)';		
			}
		},
		'.divDCNaviLevelTwoInactiveInnerContainer' : function(objElement){
			objElement.onmouseover 	= function(){
				objElement.style.background 	= 'url(/_img/_navi/dcnavi_level2_bullet.gif) no-repeat 25px	10px';			
			}
			objElement.onmouseout 	= function(){
				objElement.style.background 	= '';				
			}
		},
		
		/**
		 * 	Rules for the error navigation
		 * 
		 * 	@author	Mario Heiderich <mario.heiderich@doccheck.com>
		 */
		'#imgErrrorNaviStartseite' : function(objElement){
			objElement.onmouseover 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviStartseiteActive.gif';			
			}
			objElement.onmouseout 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviStartseiteInactive.gif';				
			}
		},
		'#imgErrrorNaviHilfe' : function(objElement){
			objElement.onmouseover 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviHilfeActive.gif';			
			}
			objElement.onmouseout 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviHilfeInactive.gif';				
			}
		},
		'#imgErrrorNaviKontakt' : function(objElement){
			objElement.onmouseover 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviKontaktActive.gif';			
			}
			objElement.onmouseout 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviKontaktInactive.gif';				
			}
		},
		'#imgErrrorNaviMeineDaten' : function(objElement){
			objElement.onmouseover 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviMeineDatenActive.gif';			
			}
			objElement.onmouseout 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviMeineDatenInactive.gif';				
			}
		},
		'#imgErrrorNaviPaswortantrag' : function(objElement){
			objElement.onmouseover 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviPasswortantragActive.gif';			
			}
			objElement.onmouseout 	= function(){
				objElement.src = '/_img/_error/frameworkErrorNaviPasswortantragInactive.gif';				
			}
		},	
		




		/**
		 * 	this rules change the mouseoverimages of the tabs in 
		 * 	the content area
		 */
		'.divHomepageTabItemInactive IMG' : function(objElement){
			objElement.onmouseover 	= function(){
				var strTemp = objElement.src;
				strTemp = strTemp.replace(/header_inactive/,'header_hover');
				strTemp = strTemp.replace(/iconTableHeader/,'iconTableRedHeader');
				objElement.src = strTemp;
			},
			objElement.onmouseout 	= function(){
				var strTemp = objElement.src;
				strTemp = strTemp.replace(/header_hover/,'header_inactive');
				strTemp = strTemp.replace(/iconTableRedHeader/,'iconTableHeader');
				objElement.src = strTemp;
			},
			objElement.onclick 	= function(){
				switchTabItems(objElement);
				return false;
			}
		},
		'.divHomepageTabItemActive IMG' : function(objElement){
			objElement.onmouseover 	= function(){
			},
			objElement.onmouseout 	= function(){
			},
			objElement.onclick 	= function(){
				return false;
			}
		},
		
		'.monthday A' : function(objElement){
			objElement.onmouseover 	= function(){
				objElement.parentNode.style.backgroundColor = '#BBB';
			},
			objElement.onmouseout 	= function(){
				objElement.parentNode.style.backgroundColor = '';
			}
		},
			
	
		/**
		 * 	catch the mouseover to display the service info 
		 * 	and also the onmouseout
		 */
		'.aTooltipItemLink' : function(objElement){
			objElement.onmouseover = function(){
				try{
					objInfoBoxLogic.initiateInfoBoxTimer(objElement);
				}
				catch(objError){
				}
			}
			objElement.onmouseout = function(){
				try{
					objInfoBoxLogic.destroyInfoBoxTimer();
				}
				catch(objError){
				}
			}
		},
					
		'DIV.divDCVotingPointContainer DIV' : function(objElement){
			objElement.onmouseover 	= function(){
				var strId = objElement.id;
				var arrParameter = strId.replace(/p/,'').replace(/s/,'').split(/-/);
				arrParameter[0] = parseInt(arrParameter[0]);
				for(var i=1;i<=arrParameter[0];i++) {
					$('p'+i+'-'+arrParameter[1]).style.background = 'url(/_img/_specials/bgStarRed.gif)';
				}
				for(var i=(arrParameter[0]+1);i<=5;i++) {
					var objPoint = $('p'+i+'-'+arrParameter[1]);
					if(objPoint) {
						objPoint.style.background = 'url(/_img/_specials/bgStarGrey.gif)';
					}
				}
			},
			objElement.onmouseout 	= function(){
				var strId = objElement.id;
				var arrParameter = strId.replace(/p/,'').replace(/s/,'').split(/-/);
				for(var i=1;i<=5;i++) {
					$('p'+i+'-'+arrParameter[1]).style.background = 'none';
				}
			},
			objElement.onclick 	= function(){
				var strDocumentLocation 	= document.location.toString();
				var strId = objElement.id;
				var arrParameter = strId.replace(/p/,'').replace(/s/,'').split(/-/);
				var objAjax = new Ajax.Request(
   	 				'/voting.php?serendipity[karmaVote]='+arrParameter[0]+'&serendipity[karmaId]='+arrParameter[1],
   	 				{
   	 					method:			'post',
   	 					onComplete:	setVotingInfo
   	 				}
 				);

			}
		}
							
	};

/**
 * 	Behaviour and its rules are being registered
 * 
 * 	@author	Mario Heiderich <mario.heiderich@doccheck.com>
 */	
Behaviour.register(objMyrules);

/**
*	now the window observers are registered
*
* 	@author Mario Heiderich <mario.heiderich@doccheck.com>
objMyObserver = {
    onClose: function(eventName, win) {
		location.reload();		
	}
}
Windows.addObserver(objMyObserver);
*/