var cat_desc_inital_length=700; var text_window_close='TEXT_WINDOW_CLOSE'; var text_read_more='TEXT_READ_MORE'; var is_start_page=false; $(document).ready(function(){ var categoryDescription=$('#start_page_bottom_text'); if (categoryDescription.length) { is_start_page=true; } else { categoryDescription=$('.categoryDescription'); if (categoryDescription.length==0) { categoryDescription=$('#content_categorie_listing > div .category_description'); } } if (categoryDescription.length) { var max_length=cat_desc_inital_length; var close_link,open_link,categoryDescription,categoryDescription_short,categories_description; var categories_description_text,categories_description_text_stripped,categories_description_text_short; var categories_description_text_rest,tags_length,pos_blank,pos_dot,pos,end_id=''; var shorten_text=true; categoryDescription_short=categoryDescription.clone(); categoryDescription_short.addClass('short'); if (is_start_page || categoryDescription_short.hasClass('categories_description')) { categories_description=categoryDescription_short; } else { categories_description=categoryDescription_short.find('.categories_description'); } categories_description_text=categories_description.html(); pos=categories_description_text.toLowerCase().lastIndexOf(end_id); if (pos!=-1) { categories_description_text_short=categories_description_text.substr(0,pos); categories_description_text_rest=categories_description_text.substr(pos+end_id.length); categories_description_text.replace(end_id,''); shorten_text=categories_description_text_rest.length>0; } else { categories_description_text_short=categories_description_text.substr(0,max_length); categories_description_text_stripped=categories_description_text_short.replace(/(<([^>]+)>)/ig,''); tags_length=categories_description_text_short.length-categories_description_text_stripped.length+1; if (tags_length) { categories_description_text_short=categories_description_text.substr(0,max_length+tags_length); } } if (shorten_text && categories_description_text_short.length>max_length) { open_link='
'; close_link=$(''+text_window_close+''+open_link); open_link=$(''+text_read_more+open_link); if (pos==-1) { pos=categories_description_text_short.lastIndexOf(' '); if (pos!=-1) { pos_dot=categories_description_text_short.lastIndexOf('.'); if (pos