Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class avia_slideshow
- {
- var $type; // 3d, 3d, fullsize, small tablet?
- var $imagesize; // image size for 2d and 2d fallback slider
- var $imagesize3D; // image size 3d slider
- var $slideshow_xml = "";// xml config file
- var $post_id; // post id of the post containing the slider
- var $slidecount = 0; //number of slides
- var $slide_duration; //how long to display a slide
- var $autoplay; //start autorotation?
- var $showcaption; //show caption?
- function avia_slideshow($post_id = false, $overwrite_small = false)
- {
- ///if no id was passed get it
- if(!$post_id) $post_id = get_the_ID();
- $this->post_id = $post_id;
- $this->slides = avia_post_meta($this->post_id, 'slideshow');
- $this->slidecount = count($this->slides);
- if(!$this->slidecount) return;
- $this->type = avia_post_meta($this->post_id, '_slideshow_type');
- if($overwrite_small && (empty($this->type) || $this->type == 'small_caption'))
- {
- $this->type = $overwrite_small;
- }
- $this->autoplay = avia_post_meta($this->post_id, '_slideshow_autoplay');
- $this->slide_duration = avia_post_meta($this->post_id, '_slideshow_duration');
- switch($this->type)
- {
- case '2D_small_caption_welcome': $this->imagesize = "portfolio2"; break;
- case '2D_caption': $this->imagesize = "featured"; break;
- }
- }
- function description()
- {
- $output = "";
- $buttonclass = 'dual_buttons';
- global $avia_config;
- $title = avia_post_meta('_slideshow_welcome_title');
- $text = avia_post_meta('_slideshow_welcome_text');
- $linktext1 = avia_post_meta('_slideshow_welcome_button_1');
- if($linktext1)
- {
- $link1 = avia_get_link($avia_config['meta'], '_slideshow_welcome_button_1_', $linktext1, $this->post_id);
- }
- $linktext2 = avia_post_meta('_slideshow_welcome_button_2');
- if($linktext2)
- {
- $link2 = avia_get_link($avia_config['meta'], '_slideshow_welcome_button_2_', $linktext2, $this->post_id);
- }
- if(!$linktext1 || $linktext1 == $link1 || !$linktext2 || $linktext2 == $link2)
- {
- $buttonclass = 'single_buttons';
- }
- $output .= "<div class='slideshow_welcome slideshow_welcome_".$this->type."'>";
- $output .= " <div class='slideshow_welcome_align'>";
- $output .= " <h1 class='slideshow_welcome_title'>".$title."</h1>";
- $output .= " <div class='slideshow_welcome_text'>". wpautop( avia_remove_autop( nl2br( $text )))."</div>";
- if($linktext1 || $linktext2) $output .= " <div class='hr'></div>";
- if($linktext1 && $linktext1 != $link1) $output .= "<span class='welcome_button welcome_button1 $buttonclass'>".$link1."</span>";
- if($linktext2 && $linktext2 != $link2) $output .= "<span class='welcome_button welcome_button2 $buttonclass'>".$link2."</span>";
- $output .= " </div>";
- $output .= "</div>";
- return $output;
- }
- function display()
- {
- $this->showcaption = true;
- if(!$this->type || $this->type == 'small_caption') return;
- $output = $shadow = '';
- //add the cu3er javascript
- if(strpos($this->type, '3D') !== false)
- {
- //set fallback imagesize based on selected 3D slider
- if(strpos($this->type, 'welcome') !== false )
- {
- $this->imagesize = 'portfolio2';
- }
- else
- {
- $this->imagesize = 'featured';
- }
- $output = $this->activate_cu3er();
- }
- else
- {
- $shadow = '<span class="slide_shadow"></span>';
- }
- //add the slide container
- $output .= "<div id='cu3er_container_".$this->type."' class='cu3er_container'>";
- //if a small slider with static text was choosen render the static text
- if(strpos($this->type, 'welcome') !== false)
- {
- $output .= $this->description();
- }
- //add javascript slider eiter because the user chose it and also as fallback if the user doesnt have flash
- $output .= "<div class='cu3er_".$this->type."'><div id='CU3ER'>";
- $output .= $this->slideshow();
- $output .= $shadow;
- $output .= "</div></div></div>";
- return $output;
- }
- function display_small($size = 'page', $force_display = false, $showcaption = true)
- {
- if(($force_display || $this->type == 'small_caption'|| $this->type == '' ) && is_array($this->slides) && !empty($this->slides[0]['slideshow_image']))
- {
- $this->type = 'small_caption';
- $this->imagesize = $size;
- $this->showcaption = $showcaption;
- return $this->slideshow();
- }
- }
- function slideshow()
- {
- $counter = 1;
- $js_controller = 'autoslide_'.$this->autoplay;
- $js_controller .= ' autoslidedelay__'.$this->slide_duration;
- $output = "<div class='preloading slideshow_container $js_controller slideshow_".$this->imagesize."'>";
- $output .= "<ul class='slideshow'>";
- if(is_array($this->slides) && !empty($this->slides[0]['slideshow_image']))
- {
- foreach($this->slides as $slide)
- {
- if($slide['slideshow_image'] != "")
- {
- //check if we got an image or a video
- if(!is_numeric($slide['slideshow_image']))
- {
- ### render a video ###
- $output .= "<li class='featured featured_container".$counter++."' >";
- if(avia_backend_is_file($slide['slideshow_image'], 'html5video'))
- {
- $output .= avia_html5_video_embed($slide['slideshow_image']);
- }
- else
- {
- global $avia_config, $wp_embed;
- $width = "";
- if(isset($avia_config['imgSize'][$this->imagesize]['width']))
- {
- $width = "width='".$avia_config['imgSize'][$this->imagesize]['width']."'";
- }
- $output .= $wp_embed->run_shortcode("[embed $width ]".$slide['slideshow_image']."[/embed]");
- }
- $output .= "</li>";
- }
- else
- {
- ### render an image ###
- //get the image by passing the attachment id.
- $image_string = avia_image_by_id($slide['slideshow_image'], $this->imagesize);
- //if we didnt get a valid image from the above function set it directly
- if(!$image_string) $image_string = $slide['slideshow_image'];
- //apply links to the image if thats what the user wanted
- $image = avia_get_link($slide, 'slideshow_', $image_string, $this->post_id);
- $output .= "<li class='featured featured_container".$counter++."' >";
- $output .= "<span class='fancyborder fancyborder_top'></span>
- <span class='fancyborder fancyborder_left'></span>
- <span class='fancyborder fancyborder_right'></span>
- <span class='fancyborder fancyborder_bottom'></span>";
- $output .= $image;
- //check if the user has set either a title or a caption that we can display
- if($this->showcaption)
- {
- if((!empty($slide['slideshow_caption_title']) || !empty($slide['slideshow_caption']) || (!empty($slideshow_options_show_controlls) && !empty($slides[1]['slideshow_image']))))
- {
- $output .= '<div class="feature_excerpt">';
- if(!empty($slide['slideshow_caption_title'])) $output .= '<h1>'.$slide['slideshow_caption_title'].'</h1>';
- if(!empty($slide['slideshow_caption'])) $output .= '<div class="featured_caption">'.$slide['slideshow_caption'].'</div>';
- $output .= '</div>';
- }
- }
- $output .= "</li>";
- }
- }
- }
- }
- $output .= "</ul>";
- $output .= '</div>';
- return $output;
- }
- ######################################################################
- # XML & cu3er related functions
- ######################################################################
- function generate_xml()
- {
- if(strpos($this->type, '3D') !== false)
- {
- $this->_build_xml_header();
- foreach($this->slides as $slide_element)
- {
- $this->_build_xml_slides($slide_element);
- }
- $this->slideshow_xml .='</slides></data>';
- }
- }
- function activate_cu3er()
- {
- $output = "";
- $output .= '<script type="text/javascript" src="'.AVIA_BASE_URL.'slideshow/js/swfobject.js"></script>'."\n";
- $output .= '<script type="text/javascript" src="'.AVIA_BASE_URL.'slideshow/js/CU3ER.js"></script>'."\n";
- $output .= '
- <script type="text/javascript">
- //add your flashvars
- var vars = { xml_location : "'.AVIA_BASE_URL.'slideshow/config.xml.php?post_id='.$this->post_id.'" };
- // add Flash embedding parameters, etc. wmode, bgcolor...
- var params = { wmode : "transparent"};
- // Flash object attributes id and name
- var attributes = { id:"CU3ER", name:"CU3ER" };
- // dynamic embed of Flash, set the location of expressInstall if needed
- swfobject.embedSWF("'.AVIA_BASE_URL.'slideshow/CU3ER.swf", "CU3ER", 540, 480, "10.0.0", "'.AVIA_BASE_URL.'slideshow/js/expressInstall.swf", vars, params, attributes );
- // initialize CU3ER class containing Javascript controls and events for CU3ER
- // var CU3ER_object = new CU3ER("CU3ER");
- </script>';
- return $output;
- }
- function _build_xml_slides($element)
- {
- if(is_numeric($element['slideshow_image']))
- {
- $this->slideshow_xml .= '
- <slide>
- <url><![CDATA['.avia_image_by_id($element['slideshow_image'], $this->imagesize3D, 'url').']]></url>
- <link target="_self">'.avia_get_link($element, 'slideshow_', false, $this->post_id).'</link>
- <description>
- <heading><![CDATA['.$element['slideshow_caption_title'].']]></heading>
- <paragraph><![CDATA['.$element['slideshow_caption'].']]></paragraph>
- </description>
- <image x="0" y="0" scaleX="1" scaleY="1" align_pos="TL"/>
- </slide>'
- ;
- $this->_build_xml_transition($element);
- }
- }
- function _build_xml_transition($element)
- {
- $this->slideshow_xml .= '<transition ';
- if(!empty($element['slice_vertical'])) $this->slideshow_xml .= 'columns="'.$element['slice_vertical'].'" ';
- if(!empty($element['slice_horizontal'])) $this->slideshow_xml .= 'rows="'.$element['slice_horizontal'].'" ';
- if(!empty($element['direction'])) $this->slideshow_xml .= 'flipDirection="'.$element['direction'].'" ';
- if(!empty($element['order'])) $this->slideshow_xml .= 'flipOrder="'.$element['order'].'" ';
- if(!empty($element['element_depth'])) $this->slideshow_xml .= 'flipBoxDepth="'.$element['element_depth'].'" ';
- if(!empty($element['flip_depth'])) $this->slideshow_xml .= 'flipDepth="'.$element['flip_depth'].'" ';
- if(!empty($element['slideshow_transition']))
- {
- switch($element['slideshow_transition'])
- {
- case "slide":
- $this->slideshow_xml .= 'type="2D" ';
- $this->slideshow_xml .= 'type2D="slide" ';
- $this->slideshow_xml .= 'flipEasing="Expo.easeInOut" ';
- break;
- case "90d":
- $this->slideshow_xml .= 'type="3D" ';
- $this->slideshow_xml .= 'flipAngle="90" ';
- $this->slideshow_xml .= 'flipEasing="Sine.easeOut" ';
- break;
- case "180d":
- $this->slideshow_xml .= 'type="3D" ';
- $this->slideshow_xml .= 'flipAngle="180" ';
- $this->slideshow_xml .= 'flipEasing="Sine.easeOut" ';
- break;
- case "fade":
- $this->slideshow_xml .= 'type="2D" ';
- $this->slideshow_xml .= 'type2D="fade" ';
- $this->slideshow_xml .= 'flipEasing="Expo.easeInOut" ';
- break;
- }
- }
- $this->slideshow_xml .='flipColor="0x878787" flipShader="none" flipOrderFromCenter="false" flipDuration=".6" flipDelay=".15" flipDelayRandomize=".5" />';
- }
- function _build_xml_header()
- {
- $bg_image = $shadow = $camera = $slides = $branding = $controlls = $autoplayer = $prevnext = $description ='';
- $color_1 = substr(avia_get_option('color_1','#555555'),1);
- switch ($this->type)
- {
- case 'tablet_3D_welcome': //tablet 3D slider
- $bg_image ='<image use_image="true" align_to="stage" align_pos="MC" x="0" y="0">
- <url><![CDATA['.AVIA_BASE_URL.'slideshow/images/st-touchpad-horizontal.png]]></url>
- </image>';
- $prevnext = '<prev_button align_pos="ML" width="156" height="350" x="-105.05000000000001" y="-10.099999999999994">
- <auto_hide time="3">false</auto_hide>
- <hide_on_transition>false</hide_on_transition>
- <background round_corners="0,0,0,0">
- <tweenShow tint="0x'.$color_1.'" alpha="0" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenOver tint="0x'.$color_1.'" alpha="0" x="0" y="0" scaleX="1" scaleY="1.04"/>
- <tweenHide tint="0x'.$color_1.'" alpha="0" x="0" y="0" scaleX="1" scaleY="1.04"/>
- </background>
- <symbol type="5" align_pos="MC" x="9.974999999999966" y="-10">
- <tweenShow alpha="0" scaleX="1" scaleY="1" tint="0x'.$color_1.'" x="0" y="0"/>
- <tweenOver tint="0x'.$color_1.'" scaleX="1.899993896484375" scaleY="1.899993896484375" alpha="1" x="-25.999999999999943" y="-2.8421709430404014e-14" time="0.3" tempDelay="0" ease="Expo.easeOut"/>
- <tweenHide tint="0x'.$color_1.'" scaleX="1" scaleY="1" alpha="0" x="0" y="0"/>
- </symbol>
- </prev_button>
- <next_button align_pos="MR" width="193.0202674865723" height="401.09358975856594" x="148.95000000000005" y="-2.09999999999998">
- <auto_hide time="3">false</auto_hide>
- <hide_on_transition>false</hide_on_transition>
- <background round_corners="0,0,0,0">
- <tweenShow tint="0x'.$color_1.'" alpha="0" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenOver tint="0x'.$color_1.'" alpha="0" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenHide tint="0x'.$color_1.'" alpha="0" x="0" y="0" scaleX="1" scaleY="1"/>
- </background>
- <symbol type="5" align_pos="MC" x="-10.035133743286224" y="-0.046794879282970214">
- <tweenShow alpha="0" scaleX="1" scaleY="1" tint="0x'.$color_1.'" x="0" y="0"/>
- <tweenOver tint="0x'.$color_1.'" scaleX="2.899993896484375" scaleY="2.899993896484375" alpha="1" x="40.02500000000009" y="0" time="0.3" ease="Expo.easeOut" delay="0"/>
- <tweenHide tint="0x'.$color_1.'" scaleX="1" scaleY="1" alpha="0" x="0" y="0"/>
- </symbol>
- </next_button>
- ';
- $camera = '<camera x="-4" y="8" z="-87" angleX="2.8" angleY="11.4" angleZ="-1.2"/>';
- $this->imagesize3D = $this->type;
- $slides = '<slides width="399" height="312" align_pos="MC" x="-25.450000000000045" y="-22.05000000000001">';
- $branding = '<branding align_pos="BR" x="-76" y="-53" align_to="stage">';
- $autoplayer = '<auto_play_indicator type="circular" align_pos="BC" x="200" y="67" width="125" height="3" padding="2" radius="6">';
- $controlls = ' <thumbnails align_pos="BC" x="7.5" y="80" width="'.($this->slidecount*20+25).'" height="33" scroll="horizontal" padding_x="20" padding_y="5">';
- break;
- case '3D_small_welcome': //small 3D slider
- $this->imagesize3D = 'portfolio2';
- $camera = '<camera x="0" y="0" z="-140" angleX="7" angleY="25" angleZ="0" lens="6"/>';
- $shadow = '<shadow show="true" use_image="false" color="0x333333" alpha="1" blur="80" corner_TL="-15,180" corner_TR="566,231" corner_BR="441.99999999999994,301" corner_BL="5,265"/>';
- $slides = '<slides width="460" height="258" align_pos="MC" x="0.05000000000001137" y="-37.25">';
- $branding = '<branding align_pos="BR" x="-36" y="-53" align_to="stage">';
- $autoplayer = '<auto_play_indicator type="circular" align_pos="BC" x="160" y="27" width="125" height="3" padding="2" radius="6">';
- $controlls = ' <thumbnails align_pos="BC" x="7.5" y="40" width="'.($this->slidecount*20+25).'" height="33" scroll="horizontal" padding_x="20" padding_y="5">';
- break;
- case '3D_caption': //fullsize 3D slider
- $color_1 = "000000";
- $this->imagesize3D = 'featured';
- $prevnext = '<prev_button align_pos="ML" width="30" height="30" x="0" y="0">
- <auto_hide time="1">true</auto_hide>
- <hide_on_transition>true</hide_on_transition>
- <background round_corners="0,15,15,0">
- <tweenShow tint="0x000000" alpha="0.2" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenOver tint="0xffffff" alpha="0.9" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenHide tint="0xffffff" alpha="0" x="0" y="0" scaleX="1" scaleY="1"/>
- </background>
- <symbol type="2" align_pos="MC" x="0" y="0">
- <tweenShow alpha="1" scaleX="0.3" scaleY="0.3" tint="0xffffff"/>
- <tweenOver tint="0x'.$color_1.'" scaleX="0.4" scaleY="0.4" alpha="1" x="0" y="0"/>
- <tweenHide tint="0x'.$color_1.'" scaleX="0.2" scaleY="0.2" alpha="0" x="0" y="0"/>
- </symbol>
- </prev_button>
- <next_button align_pos="MR" width="30" height="30" x="0" y="0">
- <auto_hide time="1">true</auto_hide>
- <hide_on_transition>true</hide_on_transition>
- <background round_corners="15,0,0,15">
- <tweenShow tint="0x000000" alpha="0.2" x="0" y="0"/>
- <tweenOver tint="0xffffff" alpha="0.9"/>
- <tweenHide tint="0xffffff" alpha="0"/>
- </background>
- <symbol type="2" align_pos="MC" x="0" y="0">
- <tweenShow alpha="1" scaleX="0.3" scaleY="0.3" tint="0xfffeff"/>
- <tweenOver tint="0x'.$color_1.'" scaleX="0.4" scaleY="0.4" alpha="1" x="0" y="0"/>
- <tweenHide tint="0x'.$color_1.'" scaleX="0.2" scaleY="0.2" alpha="0" x="0" y="0"/>
- </symbol>
- </next_button>';
- $camera = '<camera x="0" y="0" z="0" angleX="0" angleY="0" angleZ="0"/>';
- $shadow = '<shadow show="true" use_image="false" color="0x333333" alpha="1" blur="50" corner_TL="2,204" corner_TR="942,204" corner_BR="1090,415" corner_BL="-135,420"/>';
- $slides = '<slides width="940" height="350" align_pos="TL" x="0" y="0">';
- $branding = '<branding align_to="stage" align_pos="TR" x="-10" y="10">';
- $autoplayer = '<auto_play_indicator type="circular" align_pos="BR" x="-9" y="-9" width="125" height="3" padding="2" radius="6">';
- $controlls = ' <thumbnails align_pos="BR" x="-27" y="5" width="'.($this->slidecount*15).'" height="25" scroll="vertical" padding_x="0" padding_y="0">';
- $description = '<description align_pos="BL" x="0" y="-40" width="350" height="80" >
- <auto_hide time="300">true</auto_hide>
- <hide_on_transition>true</hide_on_transition>
- <bake_on_transition>true</bake_on_transition>
- <background round_corners="0,0,0,0">
- <tweenShow tint="0x000000" alpha="0.75" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenOver tint="0x000000" alpha="0.75" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenHide tint="0x000000" alpha="0" x="0" y="0" scaleX="1" scaleY="1"/>
- </background>
- <heading margin="15,15,0,15" text_bold="true" text_size="18" x="5" y="5" text_leading="0" text_letterSpacing="0" font="Arial" text_align="left">
- <tweenShow tint="0xFFFFFF"/>
- <tweenOver tint="0xFFFFFF"/>
- <tweenHide tint="0xFFFFFF"/>
- </heading>
- <paragraph margin="3,15,0,15" text_size="11" text_leading="0" font="Arial" text_align="left" text_letterSpacing="0">
- <tweenShow tint="0xFFFFFF"/>
- <tweenOver tint="0xFFFFFF"/>
- <tweenHide tint="0xFFFFFF"/>
- </paragraph>
- </description>';
- break;
- }
- //gerneric mask with defaults. the slider specific vars are filled in here
- $this->slideshow_xml .= '<?xml version="1.0" encoding="utf-8" ?>
- <data>
- <debug>0</debug><template><name><![CDATA[BrightBox]]></name><key><![CDATA[F2Z6BnjXKmpcLgPF]]></key></template>
- <project_settings>
- <width>502</width>
- <height>472</height>
- </project_settings>
- <settings>
- <folder_images></folder_images>
- <folder_fonts></folder_fonts>
- <background>
- <color transparent="true">0xffffff</color>
- '.$bg_image.'
- </background>
- <start_slide>1</start_slide>
- <auto_play>'.$this->autoplay.'</auto_play>
- <randomize_slides>false</randomize_slides>
- '.$branding.'
- <remove_logo_loader>true</remove_logo_loader>
- <remove_right_menu_info>true</remove_right_menu_info>
- <remove_right_menu_licence>true</remove_right_menu_licence>
- </branding>
- '.$camera.$shadow.'
- </settings>
- <fonts/>
- <preloader type="circular" align_pos="MC" width="200" height="20" x="20" y="0" radius="30">
- <background padding="5">
- <tweenShow tint="0x2185C5" alpha="0.85" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenOver alpha="1" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenHide alpha="0" x="0" y="0" scaleX="1" scaleY="1"/>
- </background>
- <loader>
- <tweenShow tint="0xFFFFFF" alpha="0.8"/>
- <tweenOver tint="0xFFFFFF" alpha="1"/>
- <tweenHide tint="0xFFFFFF" alpha="0"/>
- </loader>
- </preloader>
- <controls>
- '.$autoplayer.'
- <auto_hide time="1">true</auto_hide>
- <hide_on_transition>false</hide_on_transition>
- <background padding="0">
- <tweenShow tint="0x'.$color_1.'" alpha="1" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenOver tint="0x'.$color_1.'" alpha="0.05" x="0" y="0" scaleX="1" scaleY="1"/>
- <tweenHide tint="0x'.$color_1.'" alpha="0" x="0" y="0" scaleX="1" scaleY="1"/>
- </background>
- <loader>
- <tweenShow tint="0xcccccc" alpha="1"/>
- <tweenOver alpha="1"/>
- <tweenHide alpha="0"/>
- </loader>
- </auto_play_indicator>
- '.$prevnext.'
- </controls>
- '.$controlls.'
- <auto_hide time="3">false</auto_hide>
- <hide_on_transition>false</hide_on_transition>
- <background color="0x333333" alpha="0" round_corners="0,0,0,0"/>
- <thumb width="10" height="10" spacing_x="4" spacing_y="0">
- <background round_corners="7,7,7,7">
- <tweenShow tint="0x000000" alpha="0.2"/>
- <tweenOver tint="0x000000" alpha="0.5" time="0.3" ease="Expo.easeOut" scaleX="1" scaleY="1" x="0" y="0" delay="0"/>
- <tweenHide tint="0xFFFFFF" alpha="0"/>
- <tweenSelected tint="0x'.$color_1.'" alpha="1" scaleX="1" scaleY="1" x="0" y="0" time="0.3" tempDelay="0" ease="Sine.easeOut"/>
- </background>
- </thumb>
- </thumbnails>
- '.$description.'
- <defaults>
- <slide time="'.$this->slide_duration.'" color="0x000000">
- <image align_pos="TL" x="0" y="0" scaleX="1" scaleY="1"/>
- <link target="_blank"/>
- <description>
- <link target="_blank"/>
- </description>
- </slide>
- <transition type="2D" columns="1" rows="1" type2D="slide" flipAngle="180" flipOrder="315" flipShader="flat" flipOrderFromCenter="false" flipDirection="left" flipColor="0x878787" flipBoxDepth="10" flipDepth="50" flipEasing="Expo.easeInOut" flipDuration="1" flipDelay="0.15" flipDelayRandomize="0.5"/>
- </defaults>'.$slides;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement