/**
 * Advisors ver.3 custome JavaScript. (outside of JSF's RichFaces)
 * Every function in this document is instantiated by the onlclick attribute inside the HTML (JSF) pages
 * This is due to the request of the advisors development team.
 * @author Wesley Duff - DEPT: WIG APPS
 * 
 * date: 2-2-2009
 * @version 1.0.0
 */
/**
 * Browser Detection
 * This returns 6 or 7 or false if not IE
 */
(function($){
	// Returns IE version or false. Use runtime re-assignment to re-write method after initial determination.
	// NOTE: In general, browser sniffing should be avoided. Use feature detection where possible. This method
	// is intended to be used for style branching or normalization. 
	$.isIE = function() {
	    // Use attachEvent to determine IE or W3C
	    var ie = window.attachEvent ? true : false;
	    // If IE, use XMLHttpRequest to determine version (IE6 uses ActiveXObject instead)
	    if (ie) { var version = window.XMLHttpRequest ? 7 : 6; }
	    // Reassign this method ($.isIE) to return the pre-computed result
	    $.isIE = ie ? function() {return version; } : function() {return false;};
	    // After rewriting, return the expected result (needed for first execution).
	    return $.isIE();
	}
})(jQuery);


/**
 * Name spacing the function to prevent overwriting and naming collisions
 */
var advisor = {
/*//------------------ METHOD - MAIN - When DOCUMENT IS READY LOAD THESE SCRIPTS :: JQUERY ON LOAD FUNCTIONS---------------------------------*/
	manage_onload_functions : {
		/**
	 	*We need to set the explisit width of the progress-icon-form so we can dynamically center the div that contains the proress-icons and plus-icons
	 	*/
		set_progress_icon_container_width : function() {
			//console.log('managing width of product-icons!!!');
			var _tempNum = 0;
			$j('.progress-icon, .plus-icon').each(function(){
				_tempNum = _tempNum + $j(this).outerWidth();
			});
			$j('.progress-icon-form').css({width: _tempNum});
		}
	},
	/* NO LONGER BEING USED center_big_preview_images : function() {
		//appending the width centering technique to the big preivew as well
		//First we find the big preiviews sub big preview's width
		var formSysImForm = jQuery('#guided-system-image #big-preview #big-preview table:first-child').width();
		//set up the DOM
		jQuery('#guided-system-image #big-preview').css({padding:'0px', textAlign:'center'});
		jQuery('#guided-system-image #big-preview #big-preview').css({margin:'0 auto 30px auto', width:formSysImForm, padding:'0px'});
	},*/
/*//------------------ METHOD - MAIN - CONFIRMATION BOX ---------------------------------*/
	/**
	 * Manage the confirmation box
	 * (positioning, background transparent element)
	 * Background transparent element is created via javascript and injected into the DOM. 
	 * -  It is also removed from the DOM when it is not needed
	 */
	manage_confirmation_box: {
	
/*//------------------ METHOD - SUB---------------------------------*/
	 /**
	 * Checkbox onclick firing method
	 * assigning paths to objects inside the DOM while assigning CSS declarations
	 * Creating the show and hide of the custom confirmation box.
	 * Assigning the width, height to the transparent overlay depending on the width and heigth of its main parent element
	 * Assigning the top and left positioning for the confirmation box according to the size of the main parent element. (right now set to display in the center unless to small then the confirmation box hangs over the bottom edge.)
	 * @param {Object} that
	 */
		checkbox_overlay: function(that){
			var _display = that.next().css("display", "block", "z-index", "1000");
			var _width = that.parents('.curvedcontent').width() + 40;//(+40)extra space needed because of padding etc..
			var _height = that.parents('.curvedcontent').height() + 22;//(+20)extra space needed because of padding etc..
			var _auto_left = _width / 4;
			var _auto_top = _height / 4;
			if (that.attr("checked","checked")) {
				that.next().show();
				that.parent().next().next().hide();
				that.parents('.curvedcontent').append('<div id="opacity-overlay"></div>');
				jQuery('#opacity-overlay').css({
					width: _width,
					height: _height
				});
				that.next().css({
					top: _auto_top,
					left: _auto_left,
					zIndex: '9000'
				});
			}
		},
/*//------------------ METHOD - SUB ---------------------------------*/
		/**
		 * If yes has been selected
		 * Hide its parent div that shows the popup confirmation box
		 * Remove the html code that was generated (opasity overlay) in the above click function
		 * @param {Object} that
		 */
		confirm_yes: function(that){
			that.parents('.pop-up-confirmation').hide();
			jQuery('#opacity-overlay').remove();
			that.parents('.pop-up-confirmation').prev().attr("checked","");
		},
/*//------------------ METHOD - SUB ---------------------------------*/	
		/**
		 * If no has been selected
		 * Hide its parent div that shows the popup confirmation box
		 * Recheck the checkbox (this makes sure we do not lose the checkmark
		 * Remove the html code that was generated (opasity overlay) in the above click function
		 * @param {Object} that
		 */
		confirm_no: function(that){
			that.parents('.pop-up-confirmation').prev();
			that.parents('.pop-up-confirmation').hide();
			jQuery('#opacity-overlay').remove();
			that.attr("checked","checked");
		}
	}, //------ END manageconfirmationbox
	/**
	 * Manages the scroll of the mini preview
	 * @param {Object} that
	 */
/*//------------------ METHOD - MAIN - SCROLLING ---------------------------------*/
	manageminiscroll : {
		_current_scroll_left : 0,
/*//------------------ SET SCROLL METHOD - SUB ---------------------------------*/	
		set_scroll_index : function(scroll_number) {
			advisor.manageminiscroll._current_scroll_left = scroll_number;
		},
		get_scroll_index : function(){
			return advisor.manageminiscroll._current_scroll_left;
		},
		set_left_scroll_icon : function(state){
			var _icon = jQuery('.scroll-left');
			switch(state)
			{
				case 'on' :
					_icon.css({opacity:'1',cursor:'pointer'}).attr('title','');
					break;
				case 'off' :
					_icon.css({opacity:'.45',cursor:'not-allowed'}).attr('title','no more selections');
					break;
			}
		},
		set_right_scroll_icon : function(state){
			var _icon = jQuery('.scroll-right');
			switch(state)
			{
				case 'on' :
					_icon.css({opacity:'1',cursor:'pointer'}).attr('title','');
					break;
				case 'off' :
					_icon.css({opacity:'.45',cursor:'not-allowed'}).attr('title','no more selections');
					break;
			}
		},
/*//------------------ INIT METHOD - SUB ---------------------------------*/
		/**
		 * get the width and height of the mini-table-content
		 * accessed by _width_height['width'] or sub width with height
		 * @return (array) _width_height
		 */
		init_scroller : function(){
			//check to see if the user is on compacDaq, if so remove the left and right arrows and return the function to stop the javascript. There is no need to process this if we are not using it.
			if (jQuery('head meta[content=CompactDAQ Advisor]').length > 0)
			{
				jQuery('.scroll-left').remove();
				jQuery('.scroll-right').remove();
				return
			}
			//console.log('not cdaq it is something else that needs the left and right scrollers');
			//set up a variable that contains the width that the container should be that contains the overflow css property
			var _get_mini_prev = advisor.manageminiscroll.get_width_of_mini_container();
			var _scrollhide_width = (_get_mini_prev['many'] * (_get_mini_prev['width'] + 50));//plus 50 for extra padding
			//get the array that contains the width height and how many containers there are 
			//Build the correct layout for the mini scroller for chassis
			jQuery('.mini-table-content').children('.mini-preview-scrollable').wrapAll('<div class="scroll-container">');
			jQuery('.mini-table-content').find('.mini-preview-scrollable').wrapAll('<div class="scroll-hide">');
			//set the width that was calculated earlier
			jQuery('.scroll-hide').css({
				width: _scrollhide_width
			});//here we set the width of the container that holds all the mini-previews and goes out into space
			
			
			//objtain the scroll position. It will be 0 is the user has not scrolled through the chassis
			//the scroll position will be something other than 0 if the user has been scrolling.
			var _prev_position = advisor.manageminiscroll.get_scroll_index();
			var _mini_container_array = advisor.manageminiscroll.get_width_of_mini_container();
			//console.log('array : width:' + _mini_container_array['width'] + ' many: ' + _mini_container_array['many']);
			var _mini_width = _mini_container_array['width'] + 50;
			//This is the max the scrolll can possibly be. If we hit this number grey out the right scroll button and dont alow any more scrolling
			var _max = (_mini_width * (_mini_container_array['many'] - 4)) - _mini_width;// -4 because we are showing 4 at a time
			//console.log('max: ' + _max);
			//if there are only 4 or less products being displayed disable the scroll left and right 
			if(_get_mini_prev['many'] <= 4){
				//console.log('there are only 4 or less. no need for scrolling')
				jQuery('.scroll-left').css({opacity:'.45',cursor:'not-allowed'}).attr('title','no more selections');
				jQuery('.scroll-right').css({opacity:'.45',cursor:'not-allowed'}).attr('title','no more selections');
			} else if(_get_mini_prev['many'] > 4 && _prev_position == 0){
				//console.log('there are more than 4 show scrolling buttons')
				advisor.manageminiscroll.set_right_scroll_icon('on');
				advisor.manageminiscroll.set_left_scroll_icon('off');
			} else if(_get_mini_prev['many'] > 4 && _prev_position == _max){
				//console.log('previouse is maxed out no right scrolling')
				advisor.manageminiscroll.set_right_scroll_icon('off');
				advisor.manageminiscroll.set_left_scroll_icon('on');
			}
			
			if(_prev_position != 0){
				//console.log('previouse scrolling has occured. The current Scroll Number is: ' + _prev_position);
				$j('.scroll-container').animate({scrollLeft: _prev_position});
				//set scrolling icons opacity depeinding on what was selected previousely
				if(_prev_position > _mini_width && _prev_position <= _max){
					advisor.manageminiscroll.set_left_scroll_icon('on');
					advisor.manageminiscroll.set_right_scroll_icon('on');
				} else if(_prev_position <= _mini_width){
					advisor.manageminiscroll.set_left_scroll_icon('off');
				} else if(_prev_position >= _max){
					advisor.manageminiscroll.set_right_scroll_icon('off');
				}
			}
			
			advisor.manageevents();//this makes the right and left arrows work for scrolling.
			
		},
/*//------------------ GET METHOD - SUB ---------------------------------*/
		/**
		 * get the width and height of the mini-table-content
		 * accessed by _width_height['width'] or sub width with height
		 * returned array contains the width, height, and how many mini-previews there are.
		 * @return (array) _width_height
		 */
		get_width_of_mini_container : function(){
			var _width_height = [];
			_width_height.length = 3;
			var _dom_object = jQuery('.mini-preview-scrollable');
			_width_height['width'] = _dom_object.width();
			_width_height['height'] = _dom_object.height();
			_width_height['many'] = _dom_object.size();
			//console.log('_width');
			return _width_height;
		},
/*//------------------ METHOD - SUB ---------------------------------*/
	/**
	 * functionality for the right scroll of the mini preview
	 * @param {Object} that
	 */	
		scrollleft : function(that){
			var tempNum;
			//console.log('scrollLeft clicked');
			//if the user has been going through chassis and left the page then has came back the the chassis poage the chassis will be scrolled to the correct position.
			var _prev_position = advisor.manageminiscroll.get_scroll_index();
			//console.log('previouse position: ' + _prev_position);
			//access the iinformation that each mini preview provides (width, height, and how many of them there are)
			var _mini_container_array = advisor.manageminiscroll.get_width_of_mini_container();
			//console.log('array : width:' + _mini_container_array['width'] + ' many: ' + _mini_container_array['many']);
			var _mini_width = _mini_container_array['width'] + 50;
			//This is the max the scrolll can possibly be. If we hit this number grey out the right scroll button and dont alow any more scrolling
			var _max = _mini_width * (_mini_container_array['many'] - 4);// -4 because we are showing 4 at a time
			//console.log('max: ' + _max);
			
			
			if(jQuery('.scroll-right').css({opacity:'.45'})){
				jQuery('.scroll-right').css({opacity:'1',cursor:'pointer'}).attr('title', '');
			}
			if(_prev_position > 0 && _prev_position != _mini_width){
				jQuery('.scroll-container').animate({scrollLeft: (_prev_position - _mini_width)}, 900);
				tempNum = _prev_position - _mini_width;
				advisor.manageminiscroll.set_scroll_index(tempNum);
				//console.log('_current_scroll_left:' + advisor.manageminiscroll._current_scroll_left);
				//if the _max variable minus the width of our mini preview has been reached scroll one last time then disable the button
			} else if (_prev_position == _mini_width) {
				jQuery('.scroll-container').animate({scrollLeft: (_prev_position - _mini_width)}, 900);
				tempNum = _prev_position - _mini_width;
				advisor.manageminiscroll.set_scroll_index(tempNum);
				//console.log('_current_scroll_left:' + advisor.manageminiscroll._current_scroll_left);
				jQuery('.scroll-left').css({opacity: '.45',cursor: 'not-allowed'}).attr('title', 'no more selections');
			}
		},
/*//------------------ METHOD - SUB ---------------------------------*/	
		scrollright: function(prev_position){
			var tempNum;
			//console.log('scrollright clicked');
			//if the user has been going through chassis and left the page then has came back the the chassis poage the chassis will be scrolled to the correct position.
			var _prev_position = advisor.manageminiscroll.get_scroll_index();
			//console.log('scroll right clicked');
			//access the iinformation that each mini preview provides (width, height, and how many of them there are)
			var _mini_container_array = advisor.manageminiscroll.get_width_of_mini_container();
			//console.log('array : width:' + _mini_container_array['width'] + ' many: ' + _mini_container_array['many']);
			var _mini_width = _mini_container_array['width'] + 50;
			//This is the max the scrolll can possibly be. If we hit this number grey out the right scroll button and dont alow any more scrolling
			var _max = (_mini_width * (_mini_container_array['many'] - 4)) - _mini_width;// -4 because we are showing 4 at a time
	
			//console.log('_max: ' + _max);
			if (_prev_position != 0 && _prev_position != _max) {
				tempNum = _prev_position + _mini_width;
				advisor.manageminiscroll.set_left_scroll_icon('on');
				jQuery('.scroll-container').animate({
					scrollLeft: tempNum
				}, 900);
				advisor.manageminiscroll.set_scroll_index(tempNum);
				//console.log('prev-positon not 0 : ' + tempNum);
			} else if(_prev_position == 0) {
				tempNum = advisor.manageminiscroll._current_scroll_left + _mini_width
				jQuery('.scroll-container').animate({
					scrollLeft: tempNum
				}, 900);
				advisor.manageminiscroll.set_scroll_index(tempNum);
				//console.log('prev-positon is 0')
			} else if(_prev_position >= _max){
				advisor.manageminiscroll.set_left_scroll_icon('on');
				//alert('max has been reached');
			}
		}
	},
/*//------------------ METHOD - MAIN - AUTOHEIGHT (NEW) ---------------------------------	*/
	manageheights : function(){
		/*if (arguments.length > 0) {
			var _height_wanted = 0; //adjusted
			//console.log('length' + arguments[0]);
			for (var i = 0; i < arguments.length; i++) {
				jQuery(''+arguments[i]+'').each(function(){
					jQuery(this).height() > _height_wanted ? _height_wanted = jQuery(this).height() : console.log('this one was smaller smaller');
				});
				
				//console.log('FB HEIGHT : => ' + _height_wanted);
				
				jQuery(''+arguments[i]+'').each(function(){
					jQuery(this).height(_height_wanted);
				});
			}
		}*/
	},	
/*//------------------ METHOD - MAIN - Message Overlay (shows on load of new section. No event required to use)---------------------------------*/
/**
 * Method takes 4 options. 
 * 
 * (CSS Declaration with name of id or class)container  => class or id container | example: <.> or <#><DOM element>  : default : '.curvedcontent'
 * (Number)index_number => (0 based) of continer on page | default :  0  (the first one on the page)
 * (String) message | example : "This is what the message should be!" // example
 * (String) btntext | example : "Push me?"
 * (Function) callback | example : function(){ alert('this is the callback executing!'); }
 * 
 * This code injects the necessary html ontop of the container DOM element you provide. It sets its own height and width
 * It also centers the message in the center and 30 pixels from the top.
 * @param {options) object literal
 */
	manage_message_overlay : function(options){
		//container, index_number, message, btntext, callback
		var defaults = {
			container : '.curvedcontent',
			index_number : 0,
			message : 'You hav not set a message. Please do so when calling this method.',
			btntext : '0000',
			callback : function(){}
		}
		var settings = jQuery.extend(defaults,options);
		var _container_before_index = jQuery(''+settings.container+'');
		var _container_after_index = jQuery(''+ settings.container +':eq('+ settings.index_number +')');
		var _container = jQuery(''+settings.container+'');
		//cant use  condition ? true : false. throw new Error or any thrown error will not work inside them. Dont know why it just wont!
		if(_container_before_index.length === 0) throw new Error('You have submitted an incorrect class or id. Please try again. METHOD: advisors.manage_message_overlay');
		var _overlay_width = _container.innerWidth();
		var _messagebox_left_position = _container.innerHeight() / 3;
		var _overlay_height = _container.innerHeight();
		var _html = '<div class="pop-up-confirmation">';
				_html += '<img alt="caution" src="/images/icons/neutral/caution.gif"/>';
				_html += '<p>'+ settings.message +'</p>';
				_html += '<div class="confirm-btn"><a class="btn-grey master-sprite-x"><span class="master-sprite-x">' + settings.btntext + '</span></a></div>';
			_html += '</div>';
		_container.append('<div id="opacity-overlay"></div>');
		_container.css({position:'relative'});//doing this to help position the messagebox
		jQuery('#opacity-overlay')
			.width(_overlay_width)
			.height(_overlay_height)
			.before(_html);
		
		jQuery('.pop-up-confirmation').css({
			display: 'block',
			position: 'absolute',
			left: _messagebox_left_position,
			top:'30px'
		});
		settings.callback.call();//this fires the callback function. You can use a click handler here for the button to make soemthing happen
	},
/*//------------------ METHOD - MAIN - Manage slide in message ---------------------------------*/
	manage_slide_message : function (){
		var arr = [];
		arr = arguments;
		//console.log('arr' + arr.length)
		if(arr.length > 0 && arr.length === 1 ) {
			if (typeof arr[0] != 'string') {
				throw new Error('You have provided an incorrect parameter. Must be of type "String" and either be the word up or down. METHOD => advisor.manage_slide_message.')
			} else {
				if (arr[0] == 'up') {
					jQuery('#slideInMsg').animate({
						bottom: '0px'
					}, 500);
				} else if (arr[0] == 'down') {
					jQuery("#slideInMsg").animate({
						bottom: '-' + (jQuery("#slideInMsg").height() + 2) + 'px'
					}, 500);
				} else {
					throw new Error('You have passed in a parameter of ' + arr[0] + ', and you must only pass in a string of "up" or "down". METHOD => advisor.manage_slide_message');
				}
			}
		} else if (arr.length == 0) {
			jQuery('#slideInMsg').animate({
				bottom: '0px'
			}, 500);
			//console.log(arr.length);
		} else {
			throw new Error('You have provided to many parameters. Please review METHOD => advisor.manage_slide_message');
		}
		
	},
/*//------------------ METHOD - MAIN - EVENTS ---------------------------------*/	
	manageevents : function(){
		jQuery('.scroll-left').click(advisor.manageminiscroll.scrollleft);//scrolling left of mini image scroller
		jQuery('.scroll-right').click(advisor.manageminiscroll.scrollright);//scrolling right of mini image scroller
		if (jQuery.isIE === 6) {
			jQuery(window).scroll(function(){
				jQuery('#slideInMsg').css({
					bottom: '0'
				});
			});
		}
	},
/*//------------------ METHOD - MAIN - HELPER ---------------------------------*/
	helper_functions : {
/*//------------------ METHOD - SUB ---------------------------------*/	
/**
 * The check or uncheck of the checkbox in question show or hides a <div> tag that contains a textfield.
 * @param {Object} _this :: jQuery this object. Refrences the current DOM object. In this case it is the checkbox
 */
		custom_installation_services : function(_this){
			if(_this.attr("checked","checked")){
				_this.parent().next().children('div:first').hide();
			} else if(_this.attr("checked","")) {
				_this.parent().next().children('div:first').show();
			}
		}
	}
} //------- END advisors namespace

/**
 * Here we are injecting a script into the head section for IE 6 only.
 * This script normalized IE 6 so it renders many things (but not all) like IE 7.
 * This comes very handy when creating the CSS for IE 6
 * 
 * Browser sniffing is not the best option but we just want IE 6 or IE 7 not other non modern browsers 
 * - because the ie normalizer will porbably not work for them. (NOT TESTED)
 * 
 * IE 6 & 7 features can be found here http://ie7-googlecode.com/svn/test/index.html
 */
jQuery(function(){
	advisor.manageminiscroll.init_scroller();//initaite special builds for scroller
	advisor.manageevents();//initiate events
	advisor.manageheights($('.product_wrapper'),$('.product_wrapper > product_header'),$('.product_content'));
});


/**
 * Here we are injecting a script into the head section for IE 6 only.
 * This script normalized IE 6 so it renders many things (but not all) like IE 7.
 * This comes very handy when creating the CSS for IE 6
 * 
 * Browser sniffing is not the best option but we just want IE 6 or IE 7 not other non modern browsers 
 * - because the ie normalizer will porbably not work for them. (NOT TESTED)
 * 
 * IE 6 & 7 features can be found here http://ie7-googlecode.com/svn/test/index.html
 */
jQuery(function(){
	advisor.manageminiscroll.init_scroller();//initaite special builds for scroller
	advisor.manageevents();//initiate events
	advisor.manageheights($('.product_wrapper'),$('.product_wrapper > product_header'),$('.product_content'));
});

		function advisorTimeline(options){
			var defaults = {
				container : '.marker-active',
				daysTotal : 100,
				daysLeft : 365,
				markerText : 'days left',
				showActive : true,
				showInactive1 : false,
				showInactive2 : false,
				inactiveDays1 : 0,
				inactiveDays1Text1: 'Inactive:',
				inactiveDays1Text2: 'days',
				inactiveDays2 : 0,
				inactiveDays2Text1: 'days inactive',
				callback : function(){
					
				}
			}
			var settings = jQuery.extend(defaults,options);
			var _markerToMove = jQuery(''+settings.container+'');
			var _daysTotal = settings.daysTotal;
			var _daysLeft = settings.daysLeft;
			if(_daysLeft > 365 && _daysLeft <= 730)
			{
				_daysTotal = 730;
			} else if(_daysLeft > 730){
				_daysTotal = 1095;
			}
			var _s1 = settings.showInactive1;
			var _s2 = settings.showInactive2;
			var _active = settings.showActive;
			var _inactiveDays1 = settings.inactiveDays1;
			var _inactiveDays1Text1 = settings.inactiveDays1Text1;
			var _inactiveDays1Text2 = settings.inactiveDays1Text2;
			var _inactiveDays2 = settings.inactiveDays2;
			var _inactiveDays2Text1 = settings.inactiveDays2Text1;
			var _l = 0;
			var _lfin = 0;
			var _markerText = settings.markerText;
			if($j.browser.msie){
				var _maxRight = 320;
			} else {
				var _maxRight = 326;
			}
			var _maxLeft = 0;
			//Custom error handling to make sure the user of this API does not put in faulty data.
			if(_active && _daysLeft > _daysTotal){
				throw new Error('Days left cannot be more than days total. Please change these items. Thank you.')
			}
			
			//variables for setting pointer
			var _containerWidth = $j('.marker-active').width();
			var _containerCenter = _containerWidth / 2;
			var _pointerWidth = $j('.active-tip').width();
			var _allowedSpace = (_containerCenter - _pointerWidth) + 9; //plus 9 to take away extra padding to get a better point to zero
			var _movePointerLeft = 0;
			var _l = (_daysLeft/_daysTotal) * _maxRight;
			_l = _maxRight - _l; //this gives us our set position from the left. 
			//console.log('Container Width : ' + _containerWidth + ' \n _containerCenter: ' + _containerCenter + ' \n _pointerWidth : ' + _pointerWidth + ' \n _allowedSpace: ' + _allowedSpace + ' \n_l: ' + _l + '\n _movePointerLeft: ' + _movePointerLeft);
			
			//adjust left side AND pointer
			if(_l > _allowedSpace + 1){ //we want everything one number above the allowed space to get more accurate positioning
				var _leftAdjust = _l; // we set this without the - _allowedSpace so we wil get the overlap and exact right positioning
			} else {
				var _leftAdjust = _l - _allowedSpace; //we need to set the left position accordingly. This helps position the pointer
			}
			if(_l < _allowedSpace){
				_leftAdjust = 0; //left css value = 0
				_movePointerLeft = _l - _allowedSpace; //here we move the pointer to the correct location
				if($j.browser.msie){
					$j('.active-tip').css({left:(_movePointerLeft - 52) + 'px'}); // stupid IE. Needs extra 35 px. Dont know why
				} else {
					$j('.active-tip').css({left:_movePointerLeft + 'px'}); // here we execute the functionality to move the pointer
				}
			} else {
				if($j.browser.msie){
					$j('.active-tip').css({left:'-85px'}); //here we do nothing and keep the pointer in the center of the div.
				} else {
					$j('.active-tip').css({left:0}); //here we do nothing and keep the pointer in the center of the div.
				}
			}
			// Debug stuff console.log('leftadjust: ' + _leftAdjust);
			
			//EXECUTE DOM MANIPULATIONS
			/* LAYOUT */
			$j(''+ settings.container + '').css({left:_leftAdjust, width:(_containerWidth + 2)});
			
			/* TEXT */
			$j(''+ settings.container + ' .marker-body .marker-text').text(_daysLeft + ' '+ _markerText );
			$j('.marker-renew .marker-body .marker-text').text(_inactiveDays1Text1 + ' ' + _inactiveDays1 + ' ' + _inactiveDays1Text2 );
			$j('.marker-redrenew .marker-body .marker-text').text(_inactiveDays2 + ' ' + _inactiveDays2Text1 );
			
			/* VISIBLITY */
			if (!_s1) {
				$j('.marker-renew').hide();
			} 
			else {
				$j('.marker-renew').show();
			}
			
			if (!_s2) {
				$j('.marker-redrenew').hide();
			} 
			else {
				$j('.marker-redrenew').show();
			}
			
			if (!_active) {
				$j('.marker-active').hide();
			} 
			else {
				$j('.marker-active').show();
			}
	
			//call the callback function -- we may not need this
			settings.callback.call();
		}