Your IP : 216.73.216.43


Current Path : /home/cbequiperp/www/plugins/system/fixedverticalmodulepos/
Upload File :
Current File : /home/cbequiperp/www/plugins/system/fixedverticalmodulepos/fixedverticalmodulepos.php

<?php
/*------------------------------------------------------------------------
# plg_fixedverticalmodulepos - System - FixedverticalModulePosition
# ------------------------------------------------------------------------
# author    Codeboxr
# copyright Copyright (C) 2010-2015 joomboxr.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://codeboxr.com
# Technical Support:  Forum - http://joomboxr.com/product/fixed-vertical-modules-placement
-------------------------------------------------------------------------*/


//error_reporting(E_ALL | E_STRICT);
//ini_set("display_errors", 1);


// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.plugin.plugin');

/**
 * Fixedverticalmodulepos system plugin
 */
class plgSystemFixedverticalmodulepos extends JPlugin
{
	/**
	 * Constructor
	 *
	 * For php4 compatability we must not use the __constructor as a constructor for plugins
	 * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
	 * This causes problems with cross-referencing necessary for the observer design pattern.
	 *
	 * @access      protected
	 *
	 * @param       object $subject The object to observe
	 * @param       array  $config  An array that holds the plugin configuration
	 *
	 * @since       1.0
	 */
	function plgSystemFixedverticalmodulepos(&$subject, $config)
	{
		parent::__construct($subject, $config);
		//global $mainframe;
		$this->_display1 = true;
		$this->_display2 = true;
		$this->_display3 = true;


		// Do some extra initialisation in this constructor if required
		// load plugin parameters
		//$this->_plugin = JPluginHelper::getPlugin( 'system', 'fixedverticalmodulepos' );
		//$this->_params = new JParameter( $this->_plugin->params );
		// return if params are empty
		if (!$this->params){

			$this->_display1 = false;
			$this->_display2 = false;
			$this->_display2 = false;


			return;
		}

		$this->_displayinadmin  = true;
		$app = JFactory::getApplication(); //global $mainframe;  in j1.5
		if ($app->isAdmin())
		{
			$this->_display1 = false;
			$this->_display2 = false;
			$this->_display2 = false;
			$this->_displayinadmin = false;

			return;
		}


		$this->renderhtml = array();

		//basic params
		//$this->_skipitemid      	= $this->params->get('skipitemid',''); //show/hide for specific itemid
		/*
		$this->_skipitemids      = $this->params->get('skipitemids', ''); //skip menu id
		$this->_itemidfiltertype = $this->params->get('itemidfiltertype', 1); // 0 exclude  1 include   (only)
		$this->_curitemid        = $app->input->getCmd('Itemid', '');
		$this->_skipfront        = $this->params->get('skipfront', 1); //show/hide in front page
		$this->_disabeonoffline  = $this->params->get('disabeonoffline', 1);
		$this->_popup            = $this->params->get('optionalpopup', 1); //remove widget while popup, default yes 1
		$this->_rss              = $this->params->get('optionalrss', 1); //remove widget from rss feed, default yes 1, for rss feed need to send format = feed
		$this->_ajax             = $this->params->get('optionalajax', 1); //remove widget from raw/ajax output, for ajax output need to send format=raw
		$this->_mview            = $this->params->get('mview', 1); // Checking for mobile device view
		*/

		//$this->_trigaction = $this->params->get('trigaction', 0); //

		$user   = JFactory::getUser();
		$groups = $user->getAuthorisedViewLevels();
		if (!is_array($groups)) $groups = (array) $groups;
		$groups = array_unique($groups);

//                echo '<pre>';
//                print_r($groups);
//                echo '</pre>';

		$this->_curitemid        = $app->input->getCmd('Itemid', '');

		//Button 1 Setting

		$this->_skipitemids1      = $this->params->get('skipitemids1', ''); //skip menu id
		$this->_itemidfiltertype1 = $this->params->get('itemidfiltertype1', 1); // 0 exclude  1 include   (only)

		$this->_skipfront1        = $this->params->get('skipfront1', 1); //show/hide in front page
		$this->_disabeonoffline1  = $this->params->get('disabeonoffline1', 1);
		$this->_popup1            = $this->params->get('optionalpopup1', 1); //remove widget while popup, default yes 1
		$this->_rss1              = $this->params->get('optionalrss1', 1); //remove widget from rss feed, default yes 1, for rss feed need to send format = feed
		$this->_ajax1             = $this->params->get('optionalajax1', 1); //remove widget from raw/ajax output, for ajax output need to send format=raw
		$this->_mview1            = $this->params->get('mview1', 1); // Checking for mobile device view


		$this->_showb1  = $this->params->get('showb1', 1); //show hide the button
		$this->_halign1 = $this->params->get('halign1', '100');
		$this->_valign1 = $this->params->get('valign1', '0');
		//$this->_calhpos1     = $this->params->get('calhpos1','1');  //1 = %
		$this->_calvpos1     = $this->params->get('calvpos1', '1'); //1 = %
		$this->_transparent1 = $this->params->get('transparent1', 0);
		$this->_bcolor1      = $this->params->get('bcolor1', '#FCB03F');
		$this->_hcolor1      = $this->params->get('hcolor1', '#646464');
		//$this->_anchor1               = $this->params->get('anchor1','#');
		$this->_anchor1       = '#';
		$this->_button1       = $this->params->get('button1', 'feedback1.png');
		$this->_cbutton1      = $this->params->get('cbutton1', '');
		$this->_cbuttonw1     = $this->params->get('cbuttonw1', '');
		$this->_cbuttonh1     = $this->params->get('cbuttonh1', '');
		$this->_buttonr1      = $this->params->get('buttonr1', 0);
		$this->_buttonr1dbv   = $this->params->get('buttonr1dbv', 1); //1 == closed 0 = opened
		$this->_bcolor1dwidth = $this->params->get('bcolor1dwidth', '300'); //1 == closed 0 = opened

		//Button 1 module1

		$this->_source1       = $this->params->get('source1', 1); //1 = module position
		$this->_comcontentid1 = $this->params->get('comcontentid1');
		$this->_comk2id1      = $this->params->get('comk2id1');

		$this->_moduleposname1 = $this->params->get('moduleposname1');
		//var_dump($this->_moduleposname1);
		//unset($this->_moduleposname1[0]);
		//var_dump($this->_moduleposname1[0]);
		//$this->_moduleposname1 = ($this->_moduleposname1 == null) ? '' : $this->_moduleposname1;
		//$this->_moduleposname1          = (array)$this->_moduleposname1;
		//var_dump($this->_moduleposname1);
		//$position                = $params->get('modposition', NULL);
		$this->_moduleids1   = $this->params->get('moduleids1', '');
		$this->_modulestyle1 = $this->params->get('modulestyle1', 'none');
		//Button 1 module contianer's setting
		$this->_mcolor1    = $this->params->get('mcolor1', '#F0F0F0'); //module holder's background color
		$this->_mbcolor1   = $this->params->get('mbcolor1', '#CCCCCC'); //module holder's border color
		$this->_mround1    = $this->params->get('mround1', 0); //show as rounder corner
		$this->_useshadow1 = $this->params->get('useshadow1', 0);
		$this->_accessbt1  = $this->params->get('accessbt1', 1); //default public
        $this->_language1  = $this->params->get('language1', '*'); //default all language
		$this->_modal1  = intval($this->params->get('modal1', 0)); //on click modal or default show

		//var_dump($this->_modal1);
		//var_dump('First button access level'.$this->_accessbt1);

		//Button 2 Setting
		$this->_skipitemids2      = $this->params->get('skipitemids2', ''); //skip menu id
		$this->_itemidfiltertype2 = $this->params->get('itemidfiltertype2', 1); // 0 exclude  1 include   (only)
		//$this->_curitemid2        = $app->input->getCmd('Itemid2', '');
		$this->_skipfront2        = $this->params->get('skipfront2', 1); //show/hide in front page
		$this->_disabeonoffline2  = $this->params->get('disabeonoffline2', 1);
		$this->_popup2            = $this->params->get('optionalpopup2', 1); //remove widget while popup, default yes 1
		$this->_rss2              = $this->params->get('optionalrss2', 1); //remove widget from rss feed, default yes 1, for rss feed need to send format = feed
		$this->_ajax2             = $this->params->get('optionalajax2', 1); //remove widget from raw/ajax output, for ajax output need to send format=raw
		$this->_mview2            = $this->params->get('mview2', 1); // Checking for mobile device view

		$this->_showb2  = $this->params->get('showb2', 0); //show hide the button
		$this->_halign2 = $this->params->get('halign2', '100');
		$this->_valign2 = $this->params->get('valign2', '0');
		//$this->_calhpos1     = $this->params->get('calhpos1','1');  //1 = %
		$this->_calvpos2     = $this->params->get('calvpos2', '1'); //1 = %
		$this->_transparent2 = $this->params->get('transparent2', 0);
		$this->_bcolor2      = $this->params->get('bcolor2', '#FCB03F');
		$this->_hcolor2      = $this->params->get('hcolor2', '#646464');
		//$this->_anchor2         = $this->params->get('anchor2','#');
		$this->_anchor2       = '#';
		$this->_button2       = $this->params->get('button2', 'feedback1.png');
		$this->_cbutton2      = $this->params->get('cbutton2', '');
		$this->_cbuttonw2     = $this->params->get('cbuttonw2', '');
		$this->_cbuttonh2     = $this->params->get('cbuttonh2', '');
		$this->_buttonr2      = $this->params->get('buttonr2', 0);
		$this->_buttonr2dbv   = $this->params->get('buttonr2dbv', 1); //1 == closed 0 = opened
		$this->_bcolor2dwidth = $this->params->get('bcolor2dwidth', '300'); //1 == closed 0 = opened
		//
		//Button 2 module1
		$this->_source2       = $this->params->get('source2', 1); //1 = module position
		$this->_comcontentid2 = $this->params->get('comcontentid2');
		$this->_comk2id2      = $this->params->get('comk2id2');

		$this->_moduleposname2 = $this->params->get('moduleposname2','');
		//var_dump($this->_moduleposname2);
		///unset($this->_moduleposname2[0]);
		//$this->_moduleposname2 = ($this->_moduleposname2 == null) ? '' : $this->_moduleposname2;
		//var_dump($this->_moduleposname2);
		$this->_moduleids2   = $this->params->get('moduleids2', '');
		$this->_modulestyle2 = $this->params->get('modulestyle2', 'none');
		//Button 2 module contianer's setting
		$this->_mcolor2    = $this->params->get('mcolor2', '#F0F0F0'); //module holder's background color
		$this->_mbcolor2   = $this->params->get('mbcolor2', '#CCCCCC'); //module holder's border color
		$this->_mround2    = $this->params->get('mround2', 0); //show as rounder corner
		$this->_useshadow2 = $this->params->get('useshadow2', 0);
		$this->_accessbt2  = $this->params->get('accessbt2', 1); //default public
        $this->_language2  = $this->params->get('language2', '*'); //default all language
		$this->_modal2  = intval($this->params->get('modal2', 0)); //on click modal or default show
        
		//var_dump('First button access level'.$this->_accessbt2);

		//Button 3 Setting
		$this->_skipitemids3      = $this->params->get('skipitemids3', ''); //skip menu id
		$this->_itemidfiltertype3 = $this->params->get('itemidfiltertype3', 1); // 0 exclude  1 include   (only)
		//$this->_curitemid3        = $app->input->getCmd('Itemid3', '');
		$this->_skipfront3        = $this->params->get('skipfront3', 1); //show/hide in front page
		$this->_disabeonoffline3  = $this->params->get('disabeonoffline3', 1);
		$this->_popup3            = $this->params->get('optionalpopup3', 1); //remove widget while popup, default yes 1
		$this->_rss3              = $this->params->get('optionalrss3', 1); //remove widget from rss feed, default yes 1, for rss feed need to send format = feed
		$this->_ajax3             = $this->params->get('optionalajax3', 1); //remove widget from raw/ajax output, for ajax output need to send format=raw
		$this->_mview3            = $this->params->get('mview3', 1); // Checking for mobile device view


		$this->_showb3  = $this->params->get('showb3', 0); //show hide the button
		$this->_halign3 = $this->params->get('halign3', '100');
		$this->_valign3 = $this->params->get('valign3', '0');
		//$this->_calhpos1     = $this->params->get('calhpos1','1');  //1 = %
		$this->_calvpos3      = $this->params->get('calvpos3', '1'); //1 = %
		$this->_transparent3  = $this->params->get('transparent3', 0);
		$this->_bcolor3       = $this->params->get('bcolor3', '#FCB03F');
		$this->_hcolor3       = $this->params->get('hcolor3', '#646464');
		$this->_anchor3       = $this->params->get('anchor3', '#');
		$this->_anchor3       = '#';
		$this->_button3       = $this->params->get('button3', 'feedback1.png');
		$this->_cbutton3      = $this->params->get('cbutton3', '');
		$this->_cbuttonw3     = $this->params->get('cbuttonw3', '');
		$this->_cbuttonh3     = $this->params->get('cbuttonh3', '');
		$this->_buttonr3      = $this->params->get('buttonr3', 0);
		$this->_buttonr3dbv   = $this->params->get('buttonr3dbv', 1); //1 == closed 0 = opened
		$this->_bcolor3dwidth = $this->params->get('bcolor3dwidth', '300'); //1 == closed 0 = opened

		//Button 3 module1
		$this->_source3        = $this->params->get('source3', 1); //1 = module position
		$this->_comcontentid3  = $this->params->get('comcontentid3');
		$this->_comk2id3       = $this->params->get('comk2id3');
		$this->_moduleposname3 = $this->params->get('moduleposname3','');
		//var_dump($this->_moduleposname3);
		//unset($this->_moduleposname3[0]);
		//$this->_moduleposname3 = ($this->_moduleposname3 == null) ? '' : $this->_moduleposname3;
		//var_dump($this->_moduleposname3);
		$this->_moduleids3   = $this->params->get('moduleids3', '');
		$this->_modulestyle3 = $this->params->get('modulestyle3', 'none');
		//Button 3 module contianer's setting
		$this->_mcolor3    = $this->params->get('mcolor3', '#F0F0F0'); //module holder's background color
		$this->_mbcolor3   = $this->params->get('mbcolor3', '#CCCCCC'); //module holder's border color
		$this->_mround3    = $this->params->get('mround3', 0); //show as rounder corner
		$this->_useshadow3 = $this->params->get('useshadow3', 0);
		$this->_accessbt3  = $this->params->get('accessbt3', 1); //default public
        $this->_language3  = $this->params->get('language3', '*'); //default all language
		$this->_modal3  = intval($this->params->get('modal3', 0)); //on click modal or default show

        $lang       = JFactory::getLanguage();
        $lang_tag   = $lang->getTag();
        
        //var_dump($lang->getName());
        //var_dump($lang->getTag());
        
        $show_lang1 = ($this->_language1 == '*') ?  true: (($this->_language1 == $lang_tag)? true: false);
        $show_lang2 = ($this->_language2 == '*') ?  true: (($this->_language2 == $lang_tag)? true: false);
        $show_lang3 = ($this->_language3 == '*') ?  true: (($this->_language3 == $lang_tag)? true: false);

		$this->_buttons = array();

		if (intval($this->_accessbt1) > 0 && in_array($this->_accessbt1, $groups)  && $show_lang1  ):
			$this->_buttons['showb1'] = array(
				'skipfront'         => $this->_skipfront1,
				'disabeonoffline'   => $this->_disabeonoffline1,
				//'curitemid'         => $this->_curitemid1,
				'skipitemids'       => $this->_skipitemids1,
				'itemidfiltertype'  => $this->_itemidfiltertype1,
				'popup'             => $this->_popup1,
				'rss'               => $this->_rss1,
				'ajax'              => $this->_ajax1,
				'mview'             => $this->_mview1,
				'show'              => $this->_showb1,
				'halign'            => $this->_halign1,
				'valign'            => $this->_valign1,
				'calvpos'           => $this->_calvpos1,
				'transparent'       => $this->_transparent1,
				'bcolor'            => $this->_bcolor1,
				'hcolor'            => $this->_hcolor1,
				'anchor'            => $this->_anchor1,
				'button'            => $this->_button1,
				'cbutton'           => $this->_cbutton1,
				'cbuttonw'          => $this->_cbuttonw1,
				'cbuttonh'          => $this->_cbuttonh1,
				'buttonr'           => $this->_buttonr1,
				'moduleposname'     => $this->_moduleposname1,
				'moduleids'         => $this->_moduleids1,
				'modulestyle'       => $this->_modulestyle1,
				'mcolor'            => $this->_mcolor1,
				'mbcolor'           => $this->_mbcolor1,
				'mround'            => $this->_mround1,
				'buttondbv'         => $this->_buttonr1dbv,
				'bcolordwidth'      => $this->_bcolor1dwidth,
				'source'            => $this->_source1,
				'comcontentid'      => $this->_comcontentid1,
				'comk2id'           => $this->_comk2id1,
                'language'          => $this->_language1,
                'modal'          => $this->_modal1,

			);
		endif;

		if (intval($this->_accessbt2) > 0 && in_array($this->_accessbt2, $groups) && $show_lang2   ):
			$this->_buttons['showb2'] = array(
				'skipfront'         => $this->_skipfront2,
				'disabeonoffline'   => $this->_disabeonoffline2,
				//'curitemid'         => $this->_curitemid2,
				'skipitemids'       => $this->_skipitemids2,
				'itemidfiltertype'  => $this->_itemidfiltertype2,
				'popup'             => $this->_popup2,
				'rss'               => $this->_rss2,
				'ajax'              => $this->_ajax2,
				'mview'             => $this->_mview2,
				'show'          => $this->_showb2,
				'halign'        => $this->_halign2,
				'valign'        => $this->_valign2,
				'calvpos'       => $this->_calvpos2,
				'transparent'   => $this->_transparent2,
				'bcolor'        => $this->_bcolor2,
				'hcolor'        => $this->_hcolor2,
				'anchor'        => $this->_anchor2,
				'button'        => $this->_button2,
				'cbutton'       => $this->_cbutton2,
				'cbuttonw'      => $this->_cbuttonw2,
				'cbuttonh'      => $this->_cbuttonh2,
				'buttonr'       => $this->_buttonr2,
				'moduleposname' => $this->_moduleposname2,
				'moduleids'     => $this->_moduleids2,
				'modulestyle'   => $this->_modulestyle2,
				'mcolor'        => $this->_mcolor2,
				'mbcolor'       => $this->_mbcolor2,
				'mround'        => $this->_mround2,
				'buttondbv'     => $this->_buttonr2dbv,
				'bcolordwidth'  => $this->_bcolor2dwidth,
				'source'        => $this->_source2,
				'comcontentid'  => $this->_comcontentid2,
				'comk2id'       => $this->_comk2id2,
                'language'      => $this->_language2,
                'modal'         => $this->_modal2
			);
		endif;

		if (intval($this->_accessbt3) > 0 && in_array($this->_accessbt3, $groups) && $show_lang3  ):
			$this->_buttons['showb3'] = array(
				'skipfront'         => $this->_skipfront3,
				'disabeonoffline'   => $this->_disabeonoffline3,
				//'curitemid'         => $this->_curitemid3,
				'skipitemids'       => $this->_skipitemids3,
				'itemidfiltertype'  => $this->_itemidfiltertype3,
				'popup'             => $this->_popup3,
				'rss'               => $this->_rss3,
				'ajax'              => $this->_ajax3,
				'mview'             => $this->_mview3,
				'show'          => $this->_showb3,
				'halign'        => $this->_halign3,
				'valign'        => $this->_valign3,
				'calvpos'       => $this->_calvpos3,
				'transparent'   => $this->_transparent3,
				'bcolor'        => $this->_bcolor3,
				'hcolor'        => $this->_hcolor3,
				'anchor'        => $this->_anchor3,
				'button'        => $this->_button3,
				'cbutton'       => $this->_cbutton3,
				'cbuttonw'      => $this->_cbuttonw3,
				'cbuttonh'      => $this->_cbuttonh3,
				'buttonr'       => $this->_buttonr3,
				'moduleposname' => $this->_moduleposname3,
				'moduleids'     => $this->_moduleids3,
				'modulestyle'   => $this->_modulestyle3,
				'mcolor'        => $this->_mcolor3,
				'mbcolor'       => $this->_mbcolor3,
				'mround'        => $this->_mround3,
				'buttondbv'     => $this->_buttonr3dbv,
				'bcolordwidth'  => $this->_bcolor3dwidth,
				'source'        => $this->_source3,
				'comcontentid'  => $this->_comcontentid3,
				'comk2id'       => $this->_comk2id3,
                'language'      => $this->_language3,
                'modal'         => $this->_modal3
			);
		endif;


		//$offline    =  $app->getCfg('offline');
		$config  = JFactory::getConfig();
		$offline = $config->get('offline');

		foreach($this->_buttons as $key => $val){
			if ($offline && $val['disabeonoffline'] && $key == 'showb1' ){
				$this->_display1 = false;  ///return;
			}

			if ($offline && $val['disabeonoffline'] && $key == 'showb2' ){
				$this->_display2 = false;  //return;
			}

			if ($offline && $val['disabeonoffline'] && $key == 'showb3' ){
				$this->_display3 = false;  //return;
			}
		}


		/*
		if ($this->_disabeonoffline && $offline)
		{
			$this->_display = false;

			return;
		}
		*/


	}


	/**
	 * Do something onAfterInitialise
	 */
	function onAfterInitialise()
	{
		if (!$this->_displayinadmin) return;

		// Checking for mobile devices
		$mdevice = plgSystemFixedverticalmodulepos::_check_mobile_device();

		/*if ($this->_mview == 1 && $mdevice == 1)
		{
			$this->_display = false;

			return;
		}*/

		foreach($this->_buttons as $key => $val){
			if ($this->_mview1 == 1 && $mdevice == 1 && $key == 'showb1' ){
				$this->_display1 = false;  ///return;
			}

			if ($this->_mview2 == 1 && $mdevice == 1 && $key == 'showb2' ){
				$this->_display2 = false;  //return;
			}

			if ($this->_mview3 == 1 && $mdevice == 1&& $key == 'showb3' ){
				$this->_display3 = false;  //return;
			}
		}

	}



	/**
	 * Do something onAfterRoute
	 */
	function onAfterRoute(){

		if (!$this->_displayinadmin) return;

		$app         = JFactory::getApplication('site');
		$menu        = $app->getMenu();
		$activemenu  = ($menu->getActive()) ? $menu->getActive() : $menu->getDefault();
		$defaultmenu = $menu->getDefault();

		//pick current item id
		//if Itemid value is not found from url then we try to get it from active menu id.
		if ($this->_curitemid == '')
		{
			if (isset ($activemenu->id))
			{
				$this->_curitemid = $activemenu->id;
			}
		}

		//filter for menu id (include or exclude for specific menu id)
		$allselected1 = false;
		$allselected2 = false;
		$allselected3 = false;

		$this->_skipitemids1 = (array) $this->_skipitemids1;
		$this->_skipitemids2 = (array) $this->_skipitemids2;
		$this->_skipitemids3 = (array) $this->_skipitemids3;

		if ($this->_skipitemids1[0] == ''){$allselected1 = true;}
		if ($this->_skipitemids2[0] == ''){$allselected2 = true;}
		if ($this->_skipitemids3[0] == ''){$allselected3 = true;}

		//include or exclude for item id
		if ($allselected1 && $this->_itemidfiltertype1){}
		else if ($allselected1 && !$this->_itemidfiltertype1){ $this->_display1 = false;}
		else if ($this->_curitemid != '' && $this->_itemidfiltertype1 && !in_array($this->_curitemid, $this->_skipitemids1)){$this->_display1 = false;}
		else if ($this->_curitemid != '' && !$this->_itemidfiltertype1 && in_array($this->_curitemid, $this->_skipitemids1)){	$this->_display1 = false;}

		if ($allselected2 && $this->_itemidfiltertype2){}
		else if ($allselected2 && !$this->_itemidfiltertype2){ $this->_display2 = false;}
		else if ($this->_curitemid != '' && $this->_itemidfiltertype2 && !in_array($this->_curitemid, $this->_skipitemids2)){$this->_display2 = false;}
		else if ($this->_curitemid != '' && !$this->_itemidfiltertype2 && in_array($this->_curitemid, $this->_skipitemids2)){$this->_display2 = false;}

		if ($allselected3 && $this->_itemidfiltertype3){}
		else if ($allselected3 && !$this->_itemidfiltertype3){ $this->_display3 = false;}
		else if ($this->_curitemid != '' && $this->_itemidfiltertype3 && !in_array($this->_curitemid, $this->_skipitemids3)){$this->_display3 = false;}
		else if ($this->_curitemid != '' && !$this->_itemidfiltertype3 && in_array($this->_curitemid, $this->_skipitemids3)){	$this->_display3 = false;}


		//disable in popup, feed or ajax request. as linkedin or some widget may not work in ajax mode where need to load external js or here need some expert excuse
		if (($this->_popup1 && ($app->input->getCmd('tmpl') == 'component')) || ($this->_rss1 && ($app->input->getCmd('format') == 'feed')) || ($this->_ajax1 && ($app->input->getCmd('format') == 'raw'))){
			$this->_display1 = false; //return;
		}

		if (($this->_popup2 && ($app->input->getCmd('tmpl') == 'component')) || ($this->_rss2 && ($app->input->getCmd('format') == 'feed')) || ($this->_ajax2 && ($app->input->getCmd('format') == 'raw'))){
			$this->_display2 = false; //return;
		}

		if (($this->_popup3 && ($app->input->getCmd('tmpl') == 'component')) || ($this->_rss3 && ($app->input->getCmd('format') == 'feed')) || ($this->_ajax3 && ($app->input->getCmd('format') == 'raw'))){
			$this->_display3 = false; //return;
		}

		if (isset ($activemenu->id) && isset ($defaultmenu->id)){
			$active_id  = $activemenu->id;
			$default_id = $defaultmenu->id;

			if (($active_id == $default_id) && !$this->_skipfront1){
				$this->_display1 = false;
			}
			if (($active_id == $default_id) && !$this->_skipfront2){
				$this->_display2 = false;
			}
			if (($active_id == $default_id) && !$this->_skipfront3){
				$this->_display3 = false;
			}
		}

	}

	/**
	 * Do something onAfterDispatch
	 */
	function onAfterDispatch(){

		if (!$this->_displayinadmin) return;
		//var_dump($this->_display);
		$doc     = JFactory::getDocument();
		$doctype = $doc->getType();
		// Only render for HTML output
		if ($doctype !== 'html')
		{
			$this->_display1 = false;
			$this->_display2 = false;
			$this->_display3 = false;


			return;
		}


		/*Run the loop*/
		foreach ($this->_buttons as $key => $value)
		{
			if ($value['show'] && $key == 'showb1' && $this->_display1)
			{
				$this->dispatch_singlebutton($key, $value['cbutton'], $value['cbuttonw'], $value['cbuttonh'], $value['calvpos'], $value['transparent'], $value['hcolor'], $value['bcolor'], $value['valign'], $value['buttonr'], $value['halign'], $value['button'], $value['mcolor'], $value['mbcolor'], $value['mround'], $value['buttondbv'], $value['bcolordwidth'], $value['source'], $value['comcontentid'], $value['comk2id']);
			}

			if ($value['show'] && $key == 'showb2' && $this->_display2)
			{
				$this->dispatch_singlebutton($key, $value['cbutton'], $value['cbuttonw'], $value['cbuttonh'], $value['calvpos'], $value['transparent'], $value['hcolor'], $value['bcolor'], $value['valign'], $value['buttonr'], $value['halign'], $value['button'], $value['mcolor'], $value['mbcolor'], $value['mround'], $value['buttondbv'], $value['bcolordwidth'], $value['source'], $value['comcontentid'], $value['comk2id']);
			}

			if ($value['show'] && $key == 'showb3' && $this->_display3)
			{
				$this->dispatch_singlebutton($key, $value['cbutton'], $value['cbuttonw'], $value['cbuttonh'], $value['calvpos'], $value['transparent'], $value['hcolor'], $value['bcolor'], $value['valign'], $value['buttonr'], $value['halign'], $value['button'], $value['mcolor'], $value['mbcolor'], $value['mround'], $value['buttondbv'], $value['bcolordwidth'], $value['source'], $value['comcontentid'], $value['comk2id']);
			}
		}
		//end foreach

		if($this->_display1 || $this->_display2 || $this->_display3){
			$doc->addStyleSheet(JURI::root(true) . '/plugins/system/fixedverticalmodulepos/fixedverticalmodulepos/fixedverticalmoduleposres.css');

			//var_dump($this->_modal1);
			if($this->_modal1 || $this->_modal2 || $this->_modal3){
				$doc->addStyleSheet(JURI::root(true) . '/plugins/system/fixedverticalmodulepos/fixedverticalmodulepos/magnific-popup.css');
				$doc->addScript(JURI::root(true) . '/plugins/system/fixedverticalmodulepos/fixedverticalmodulepos/jquery.magnific-popup.min.js');
			}

			$doc->addScript(JURI::root(true) . '/plugins/system/fixedverticalmodulepos/fixedverticalmodulepos/fixedverticalmodulepos.js');

		}

	}


	/**
	 * On Before Render
	 *
	 */
	function onBeforeRender(){

		if (!$this->_displayinadmin) return;

		foreach ($this->_buttons as $key => $value)
		{
			if ($value['show'] && $key == 'showb1' && $this->_display1 )
			{
				$this->renderhtml['showb1'] = $this->render_singlebutton($key, $value, $this->_modal1);
			}

			if ($value['show'] && $key == 'showb2' && $this->_display2 )
			{
				$this->renderhtml['showb2'] = $this->render_singlebutton($key, $value,$this->_modal2);
			}

			if ($value['show'] && $key == 'showb3' && $this->_display3 )
			{
				$this->renderhtml['showb3'] = $this->render_singlebutton($key, $value, $this->_modal3);
			}
		}
		//end foreach
	}


	/**
	 *  Render method
	 */
	function onAfterRender(){
		if (!$this->_displayinadmin) return;

		$app = JFactory::getApplication();
		//if (!$this->_display) return;
		/*
		if (sizeof($this->renderhtml > 0)):
			foreach ($this->renderhtml as $key => $value)
			{
				JResponse::appendBody($value);
			}
		endif;
		*/

		$body = $app->getBody();
		if ( sizeof( $this->renderhtml > 0 ) ):
			foreach ( $this->renderhtml as $key => $value ) {
				//$body = JResponse::getBody();

				if($key == 'showb1' && $this->_display1){

					$body = str_replace('</body>',$value.'</body>', $body);
					//JResponse::setBody($body );
					$app->setBody($body );
				}

				if($key == 'showb2' && $this->_display2){

					$body = str_replace('</body>',$value.'</body>', $body);
					//JResponse::setBody($body );
					$app->setBody($body );
				}


				if($key == 'showb3' && $this->_display3){

					$body = str_replace('</body>',$value.'</body>', $body);
					//JResponse::setBody($body );
					$app->setBody($body );
				}



			}
		endif;

	}

	/**
	 * @param $rparams
	 *
	 * @return string
	 */
	function _flexiblemodulerender($rparams){

//		echo '<pre>';
//		print_r($rparams);
//		echo '</pre>';

		$document = JFactory::getDocument();
		$renderer = $document->loadRenderer('module');
		$database = JFactory::getDBO();
		$output   = '';


		$position               = $rparams['moduleposname'];
		$modid                  = $rparams['moduleids'];
		$modstyle               = $rparams['modulestyle'];
		//new params
		$modsource              = intval($rparams['source']);
		//$modhtml                = $rparams['modhtml'];
		$comid                  = $rparams['comcontentid'];
		$k2id                   = $rparams['comk2id'];
		//$hikashopid             = $rparams['hikashopid'];


		$output = '';



		switch($modsource){
			case 1:
				//module position
				if (!is_null($position)) $position = (array)$position;
				else $position = (array)$position;
				foreach ($position as $moduleposname) {
					//var_dump($moduleposname);
					if($moduleposname == '') continue;
					$modules = JModuleHelper::getModules($moduleposname);
					$mcount  = count($modules);
					for ($i = 0; $i < $mcount; $i++) {
						$m       = $modules[$i];
						$mparams = array('style' => $modstyle);

						ob_start();
						echo $renderer->render($m, $mparams);
						$moduledata = ob_get_clean();
						$output .= $moduledata;
					}
				}
				break;
			case 2:
				//module id
				if ($modid != '') {
					$moduleid2s = explode(",", $modid);
					//var_dump($moduleid2s);
					JArrayHelper::toInteger($moduleid2s);
					$secCondition = ' id=' . implode(' OR id=', $moduleid2s);
					$sql          = 'SELECT * FROM #__modules WHERE ' . $secCondition;
					$database->setQuery($sql);
					$modules = $database->loadObjectList();
					$module  = 0;
					foreach ($modules as $m) {
						$module       = $m;
						$module->user = '';
						$mparams      = array('style' => $modstyle);

						ob_start();
						echo $renderer->render($module, $mparams);
						$moduledata = ob_get_clean();

						$output .= $moduledata;
					}
				}
				break;

			case 3:
				//com_content single article id
				require_once(JPATH_SITE . '/components/com_content/models/article.php');
				$comitem    =  new ContentModelArticle();
				$item       = $comitem->getItem($comid);
				$output     .= $item->introtext;
				//var_dump($item);
				break;
			case 4:
				//com_k2 article single id
				if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_k2/elements/base.php')):

					require_once(JPATH_ADMINISTRATOR . '/components/com_k2/elements/base.php');
					require_once(JPATH_SITE . '/components/com_k2/models/item.php');

					$comitem    =  new K2ModelItem();
					$mainframe  = JFactory::getApplication();

					$db         = JFactory::getDBO();
					$query      = "SELECT * FROM #__k2_items WHERE id={$k2id}";

					if (K2_JVERSION != '15'){
						$languageFilter = $mainframe->getLanguageFilter();
						if ($languageFilter)
						{
							$languageTag = JFactory::getLanguage()->getTag();
							$query .= " AND language IN (".$db->Quote($languageTag).",".$db->Quote('*').")";
						}
					}

					$db->setQuery($query, 0, 1);
					$item = $db->loadObject();
					$output     .= $item->introtext;

				endif;
				break;

		}

		if ($output == '')
		{
			$output = 'Please check plugin setting correctly to set the content/module source.';
		}


		return $output;
	}

	/**
	 * _check_mobile_device detect mobile device
	 */
	function _check_mobile_device()
	{
		$user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
		$accept     = strtolower($_SERVER['HTTP_ACCEPT']);

		if (
			0
			or preg_match('/ip[ao]d/', $user_agent)
			or preg_match('/iphone/', $user_agent) //iPhone or iPod
			or preg_match('/android/', $user_agent) //Android
			or preg_match('/opera mini/', $user_agent) //Opera Mini
			or preg_match('/blackberry/', $user_agent) //Blackberry
			or preg_match('/series ?60/', $user_agent) //Symbian OS
			or preg_match('/(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/', $user_agent) //Palm OS
			or preg_match('/(iris|3g_t|windows ce|opera mobi|iemobile)/', $user_agent) //Windows OS
			or preg_match('/(maemo|tablet|qt embedded|com2)/', $user_agent) //Nokia Tablet
		)
		{
			return true;
		}
		/**
		 * Now look for standard phones & mobile devices
		 */
		//Mix of standard phones
		if (preg_match('/(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320|vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo|vnd.rim|wml|nitro|nintendo|wii|xbox|archos|openweb|mini|docomo)/', $user_agent))
		{
			return true;
		}
		//Any falling through the cracks
		if (
			0
			or strpos($accept, 'text/vnd.wap.wml') > 0
			or strpos($accept, 'application/vnd.wap.xhtml+xml') > 0
			or isset($_SERVER['HTTP_X_WAP_PROFILE'])
			or isset($_SERVER['HTTP_PROFILE'])
		)
		{
			return true;
		}
		//Catch all
		if (
		in_array(
			substr($user_agent, 0, 4),
			array(
				'1207', '3gso', '4thp', '501i', '502i', '503i', '504i', '505i', '506i', '6310',
				'6590', '770s', '802s', 'a wa', 'acer', 'acs-', 'airn', 'alav', 'asus', 'attw',
				'au-m', 'aur ', 'aus ', 'abac', 'acoo', 'aiko', 'alco', 'alca', 'amoi', 'anex',
				'anny', 'anyw', 'aptu', 'arch', 'argo', 'bell', 'bird', 'bw-n', 'bw-u', 'beck',
				'benq', 'bilb', 'blac', 'c55/', 'cdm-', 'chtm', 'capi', 'cond', 'craw', 'dall',
				'dbte', 'dc-s', 'dica', 'ds-d', 'ds12', 'dait', 'devi', 'dmob', 'doco', 'dopo',
				'el49', 'erk0', 'esl8', 'ez40', 'ez60', 'ez70', 'ezos', 'ezze', 'elai', 'emul',
				'eric', 'ezwa', 'fake', 'fly-', 'fly_', 'g-mo', 'g1 u', 'g560', 'gf-5', 'grun',
				'gene', 'go.w', 'good', 'grad', 'hcit', 'hd-m', 'hd-p', 'hd-t', 'hei-', 'hp i',
				'hpip', 'hs-c', 'htc ', 'htc-', 'htca', 'htcg', 'htcp', 'htcs', 'htct', 'htc_',
				'haie', 'hita', 'huaw', 'hutc', 'i-20', 'i-go', 'i-ma', 'i230', 'iac', 'iac-',
				'iac/', 'ig01', 'im1k', 'inno', 'iris', 'jata', 'java', 'kddi', 'kgt', 'kgt/',
				'kpt ', 'kwc-', 'klon', 'lexi', 'lg g', 'lg-a', 'lg-b', 'lg-c', 'lg-d', 'lg-f',
				'lg-g', 'lg-k', 'lg-l', 'lg-m', 'lg-o', 'lg-p', 'lg-s', 'lg-t', 'lg-u', 'lg-w',
				'lg/k', 'lg/l', 'lg/u', 'lg50', 'lg54', 'lge-', 'lge/', 'lynx', 'leno', 'm1-w',
				'm3ga', 'm50/', 'maui', 'mc01', 'mc21', 'mcca', 'medi', 'meri', 'mio8', 'mioa',
				'mo01', 'mo02', 'mode', 'modo', 'mot ', 'mot-', 'mt50', 'mtp1', 'mtv ', 'mate',
				'maxo', 'merc', 'mits', 'mobi', 'motv', 'mozz', 'n100', 'n101', 'n102', 'n202',
				'n203', 'n300', 'n302', 'n500', 'n502', 'n505', 'n700', 'n701', 'n710', 'nec-',
				'nem-', 'newg', 'neon', 'netf', 'noki', 'nzph', 'o2 x', 'o2-x', 'opwv', 'owg1',
				'opti', 'oran', 'p800', 'pand', 'pg-1', 'pg-2', 'pg-3', 'pg-6', 'pg-8', 'pg-c',
				'pg13', 'phil', 'pn-2', 'pt-g', 'palm', 'pana', 'pire', 'pock', 'pose', 'psio',
				'qa-a', 'qc-2', 'qc-3', 'qc-5', 'qc-7', 'qc07', 'qc12', 'qc21', 'qc32', 'qc60',
				'qci-', 'qwap', 'qtek', 'r380', 'r600', 'raks', 'rim9', 'rove', 's55/', 'sage',
				'sams', 'sc01', 'sch-', 'scp-', 'sdk/', 'se47', 'sec-', 'sec0', 'sec1', 'semc',
				'sgh-', 'shar', 'sie-', 'sk-0', 'sl45', 'slid', 'smb3', 'smt5', 'sp01', 'sph-',
				'spv ', 'spv-', 'sy01', 'samm', 'sany', 'sava', 'scoo', 'send', 'siem', 'smar',
				'smit', 'soft', 'sony', 't-mo', 't218', 't250', 't600', 't610', 't618', 'tcl-',
				'tdg-', 'telm', 'tim-', 'ts70', 'tsm-', 'tsm3', 'tsm5', 'tx-9', 'tagt', 'talk',
				'teli', 'topl', 'hiba', 'up.b', 'upg1', 'utst', 'v400', 'v750', 'veri', 'vk-v',
				'vk40', 'vk50', 'vk52', 'vk53', 'vm40', 'vx98', 'virg', 'vite', 'voda', 'vulc',
				'w3c ', 'w3c-', 'wapj', 'wapp', 'wapu', 'wapm', 'wig ', 'wapi', 'wapr', 'wapv',
				'wapy', 'wapa', 'waps', 'wapt', 'winc', 'winw', 'wonu', 'x700', 'xda2', 'xdag',
				'yas-', 'your', 'zte-', 'zeto', 'acs-', 'alav', 'alca', 'amoi', 'aste', 'audi',
				'avan', 'benq', 'bird', 'blac', 'blaz', 'brew', 'brvw', 'bumb', 'ccwa', 'cell',
				'cldc', 'cmd-', 'dang', 'doco', 'eml2', 'eric', 'fetc', 'hipt', 'http', 'ibro',
				'idea', 'ikom', 'inno', 'ipaq', 'jbro', 'jemu', 'java', 'jigs', 'kddi', 'keji',
				'kyoc', 'kyok', 'leno', 'lg-c', 'lg-d', 'lg-g', 'lge-', 'libw', 'm-cr', 'maui',
				'maxo', 'midp', 'mits', 'mmef', 'mobi', 'mot-', 'moto', 'mwbp', 'mywa', 'nec-',
				'newt', 'nok6', 'noki', 'o2im', 'opwv', 'palm', 'pana', 'pant', 'pdxg', 'phil',
				'play', 'pluc', 'port', 'prox', 'qtek', 'qwap', 'rozo', 'sage', 'sama', 'sams',
				'sany', 'sch-', 'sec-', 'send', 'seri', 'sgh-', 'shar', 'sie-', 'siem', 'smal',
				'smar', 'sony', 'sph-', 'symb', 't-mo', 'teli', 'tim-', 'tosh', 'treo', 'tsm-',
				'upg1', 'upsi', 'vk-v', 'voda', 'vx52', 'vx53', 'vx60', 'vx61', 'vx70', 'vx80',
				'vx81', 'vx83', 'vx85', 'wap-', 'wapa', 'wapi', 'wapp', 'wapr', 'webc', 'whit',
				'winw', 'wmlb', 'xda-'
			)
		)
		)
		{
			return true;
		}

		return false;
	}// end of _check_mobile_device


	/**
	 * Renders single button, adds necessary html
	 *
	 * @param  string  $key
	 * @param  array   $moduleposname
	 * @param  array   $moduleids
	 * @param  string  $modulestyle
	 * @param  integer $buttondbv
	 *
	 * @return string
	 */
	function render_singlebutton($key, $option, $modal){

		//var_dump($option);

		$buttondbv = (int)$option['buttondbv'];

		//$buttondbv  1 = closed 0 =open
		$closebutton_style = ($buttondbv == 0) ? ' style="display: block;" ' : ' ' ;
		//$closebutton_style = '';

		$link = '<a data-fvfbmodal="'.$modal.'" data-btncon="#verticalmodulepos' . $key . '" id="codeboxrvbuttonsfvmp' . $key . '" class="fixedverticalmoduleposbtn codeboxrvbutton' . $key . '" href="#">feedback</a>';

		$link .= '<div id="verticalmodulepos' . $key . '" class="verticalmodulepos verticalmodulepos' . $key . '">' . $this->_flexiblemodulerender($option) ;

		$closebutton = '';
		if(!$modal) $closebutton = '<span '.$closebutton_style.' data-btncon="#verticalmodulepos' . $key . '" class="verticalmoduleposhide">x</span></div>';
		$buttonhtml = '<div class="codeboxrvbuttonsfvmp_wrap" id="codeboxrvbuttonsfvmpj5' . $key . '">' . $link . '</div>'.$closebutton;


		return $buttonhtml;
	}

	/**
	 * Dispatch single button, adds js and css codes
	 *
	 * @param  [type]  $key
	 * @param  string  $cbutton
	 * @param  [type]  $cbuttonw
	 * @param  [type]  $cbuttonh
	 * @param  [type]  $calvpos
	 * @param  [type]  $transparent
	 * @param  [type]  $hcolor
	 * @param  [type]  $bcolor
	 * @param  [type]  $valign
	 * @param  integer $buttonr
	 * @param  string  $halign
	 * @param  string  $button
	 * @param  [type]  $mcolor
	 * @param  [type]  $mbcolor
	 * @param  integer $mround
	 * @param  integer $buttondbv
	 * @param  string  $bcolordwidth
	 *
	 * @return [type]
	 */
	function dispatch_singlebutton($key, $cbutton = '', $cbuttonw, $cbuttonh, $calvpos, $transparent, $hcolor, $bcolor, $valign, $buttonr = 1, $halign = '0', $button = 'feedback1.png', $mcolor, $mbcolor, $mround = 0, $buttondbv = 1, $bcolordwidth = '300')
	{
		$doc = JFactory::getDocument();

		$bcolordwidth = intval($bcolordwidth);
		if ($bcolordwidth < 1) $bcolordwidth = 300;

		//$doctype	= $doc->getType();
		$height = 90;
		$width  = 22;

		switch ($button)
		{
			case 'feedback1.png':
				$height = 90;
				$width  = 22;
				break;
			case 'feedback2.png':
				$height = 97;
				$width  = 22;
				break;
			case 'feedback3.png':
				$height = 115;
				$width  = 22;
				break;
			case 'contact1.png':
				$height = 83;
				$width  = 22;
				break;
			case 'contact2.png':
				$height = 102;
				$width  = 22;
				break;
			case 'contact3.png':
				$height = 110;
				$width  = 22;
				break;
			case 'contact4.png':
				$height = 132;
				$width  = 22;
				break;
			case 'COMENTARIOS.png':
				$height = 151;
				$width  = 22;
				break;
			case 'COMENTARIOS-FEEDBACK.png':
				$height = 264;
				$width  = 22;
				break;
			case 'callback_caps.png':
				$height = 113;
				$width  = 22;
				break;
			case 'callback_small.png':
				$height = 91;
				$width  = 22;
				break;
			case 'requestacallback_caps.png':
				$height = 229;
				$width  = 22;
				break;
			case 'requestacallback_small.png':
				$height = 192;
				$width  = 22;
				break;
			default:
				$height = 90;
				$width  = 22;
				break;
		}

		if ($cbutton == '')
		{
			$button_url = JURI::root() . 'plugins/system/fixedverticalmodulepos/fixedverticalmodulepos/buttons/' . $button;
		}
		else
		{
			$button_url = JURI::root() . $cbutton; //new from ver 4.5
			$height     = $cbuttonh;
			$width      = $cbuttonw;
		}

		$round = '';
		//making the button rounded ?
		if ($buttonr == 1)
		{
			if ($halign == '100')
			{
				$round = '-webkit-border-radius: 5px 0 0 5px; -moz-border-radius: 5px 0 0 5px; border-radius: 5px 0 0 5px;';
			}
			else if ($halign == '0')
			{
				$round = '-webkit-border-radius: 0 5px 5px 0; -moz-border-radius: 0 5px 5px 0; border-radius:0 5px 5px 0;';
			}
		}

		// round module holder's div
		if ($mround)
		{
			$mround = ($halign == '0') ? '-webkit-border-radius:0 5px 5px 5px; -moz-border-radius:0 5px 5px 5px; border-radius:0 5px 5px 5px;' : '-webkit-border-radius:5px 0 5px 5px; -moz-border-radius:5px 0 5px 5px; border-radius:5px 0 5px 5px;';
		}
		else
		{
			$mround = '';
		}


		if ($calvpos)
		{ //calculation is in  %
			if ($valign == '100')
			{
				$valign = 'bottom:0%;';
			}
			else
			{
				$valign = 'top:' . $valign . '%;';
			}
		}
		else
		{
			$valign = 'top:' . $valign . 'px;';
		} //calculation is in px


		//if($calhpos){  //calculation is in  %
		$anchorfloat = 'left';
		if ($halign == '100')
		{
			$halign      = 'right:0px;';
			$anchorfloat = 'right';
		}
		else
		{
			$halign = 'left:0px;';
		}
		//}
		//else{ $halign = 'left:'.$halign.'px;';} //calculation is in px


		if ($transparent)
		{
			$bcolor = 'none;';
			$hcolor = 'none';
		}
		else
		{
			$bcolor = $bcolor;
			$hcolor = $hcolor;
		}


		$widthouter = intval($width + 10); //because we are using 5 px padding for anchor, so the total width should be 10 px more.

		$feedbackcss = 'div#codeboxrvbuttonsfvmpj5' . $key . '{ /*overflow:hidden;*/ position:fixed;' . $halign . $valign . 'z-index:300;' . $round . '}';


		$feedbackcss .= 'div#codeboxrvbuttonsfvmpj5' . $key . ' a.codeboxrvbutton' . $key . '{
	      background:url(' . $button_url . ') 50% 50% no-repeat;
	      background-image:url(' . $button_url . ');
	      background-position:50% 50%;
	      background-repeat:no-repeat;
	      float:' . $anchorfloat . '; display:inline-block;
	      height:' . $height . 'px;
	      width:' . $width . 'px;
	      line-height:0;
	      padding:5px;
	      text-indent:-99999px;
	      background-color:' . $bcolor . ';
	      ' . $round . '
	  }';

		if ($buttondbv)
		{
			$feedbackcss .= 'div#verticalmodulepos' . $key . '{ float:left; display:none; width:' . $bcolordwidth . 'px; padding:5px; border:1px solid ' . $mbcolor . '; background:' . $mcolor . ';' . $mround . ' }';
		}
		else
		{
			$feedbackcss .= 'div#verticalmodulepos' . $key . '{ float:left; display:block; width:' . $bcolordwidth . 'px; padding:5px; border:1px solid ' . $mbcolor . '; background:' . $mcolor . ';' . $mround . ' }';
		}


		$feedbackcss .= 'div#codeboxrvbuttonsfvmpj5' . $key . ' a.codeboxrvbutton' . $key . ':hover {background-color:' . $hcolor . '; margin:0;}';
		$doc->addStyleDeclaration($feedbackcss);

		//var_dump($feedbackcss);
		JHTML::_('jquery.framework');
		/*
		$jscodeonclick = ' jQuery(document).ready(function($) {
		    $(\'#codeboxrvbuttonsfvmp' . $key . '\').click(function(e){
		        e.preventDefault();
		        style = $(\'#verticalmodulepos' . $key . '\').css(\'display\');
		        if( (style == \'inline\') || (style == \'block\')){
		            //console.log("click");
		            $(\'#verticalmodulepos' . $key . '\').fadeOut(\'slow\');
		            $(\'#verticalmodulepos' . $key . '\').css({\'display\':\'none\'});
		        }
		        else{
		            //console.log("click2");
		            $(\'#verticalmodulepos' . $key . '\').css({\'display\':\'inline\'});
		            $(\'#verticalmodulepos' . $key . '\').fadeIn(\'slow\');
		        }

		        $(\'#verticalmodulepos' . $key . '\').find(\'span.verticalmoduleposhide\').on(\'click\', function(e){
					$(\'#verticalmodulepos' . $key . '\').fadeOut(\'slow\');
		            $(\'#verticalmodulepos' . $key . '\').css({\'display\':\'none\'});
				});

		    });
		}); ';

		$jscodeonmouse = ' jQuery(document).ready(function($) {
			    $(\'#codeboxrvbuttonsfvmpj5' . $key . '\').hover(
			      function () {
			        $(\'#verticalmodulepos' . $key . '\').fadeIn(\'slow\');
			         //$(\'#verticalmodulepos' . $key . '\').css({\'display\':\'inline\'});

				    },
				    function () {
				        $(\'#verticalmodulepos' . $key . '\').fadeOut(\'slow\');
				        //$(\'#verticalmodulepos' . $key . '\').css({\'display\':\'none\'});
				    }
		        );

		}); ';
		*/


//		if ($this->_trigaction == 0)
//		{
//			$doc->addScriptDeclaration($jscodeonclick);
//		}
//		else
//		{
//			$doc->addScriptDeclaration($jscodeonmouse);
//		}

	}
}

//end of class
?>