diff --git a/.all-contributorsrc b/.all-contributorsrc
new file mode 100644
index 0000000..b04b1bc
--- /dev/null
+++ b/.all-contributorsrc
@@ -0,0 +1,47 @@
+{
+ "files": [
+ "README.md"
+ ],
+ "imageSize": 100,
+ "commit": false,
+ "contributors": [
+ {
+ "login": "Bhavya0304",
+ "name": "Bhavya0304",
+ "avatar_url": "https://avatars1.githubusercontent.com/u/72244742?v=4",
+ "profile": "https://github.com/Bhavya0304",
+ "contributions": [
+ "test",
+ "code"
+ ]
+ },
+ {
+ "login": "thedeveloperyug",
+ "name": "Yogesh Pandey",
+ "avatar_url": "https://avatars2.githubusercontent.com/u/57279795?v=4",
+ "profile": "https://github.com/thedeveloperyug",
+ "contributions": [
+ "infra",
+ "test",
+ "code"
+ ]
+ },
+ {
+ "login": "Dhvanil25",
+ "name": "Dhvanil25",
+ "avatar_url": "https://avatars2.githubusercontent.com/u/72179382?v=4",
+ "profile": "https://github.com/Dhvanil25",
+ "contributions": [
+ "infra",
+ "test",
+ "code"
+ ]
+ }
+ ],
+ "contributorsPerLine": 7,
+ "projectName": "php",
+ "projectOwner": "sam0hack",
+ "repoType": "github",
+ "repoHost": "https://github.com",
+ "skipCi": true
+}
diff --git a/AboutDeveloper.txt b/AboutDeveloper.txt
deleted file mode 100644
index 2ece357..0000000
--- a/AboutDeveloper.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Email: sam.nyx@live.com
-Facebook: facebook.com/sam0hack
\ No newline at end of file
diff --git a/README.md b/README.md
index 767dc4b..c0039d3 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,52 @@
-php
-===
+# Discountinued Not managing anymore
+
+[](#contributors-)
+
+This was good project but unfortunatily i don't have enough time to manage this anymore.
-php programs
+
+How to install
+
+1. Copy phpcode in your www dir
+2. Set your email configuration emailer.php,forgotpassword2.php,doctorhome.php
+3. config database database.php
+4. import database from sql dir to your mysql server
+5. goto your browser address and run the app
+
+About Application
+
+This application is made for doctors you can use as you want,
+Doctor can upload report image and send email to patient email contains
+link and patient username (email) and auto generated password,
+Patient can login using email and password and after login, download also
+uploaded images limit is 200.
+
+Languages
+
+Tech used in Frontend -
+HTML5, css3 with bootstrap, js and jquery
+------------
+Tech for Backend -
+php,Mysql
+------------
+
+## Contributors ✨
+
+Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
+
+
+
+
+
+
+
+
+
+
+This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
\ No newline at end of file
diff --git a/online documents/SQL/SQLDATABASE.sql b/online documents/SQL/SQLDATABASE.sql
new file mode 100644
index 0000000..d4aa1ed
--- /dev/null
+++ b/online documents/SQL/SQLDATABASE.sql
@@ -0,0 +1,656 @@
+-- phpMyAdmin SQL Dump
+-- version 4.0.10deb1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Nov 24, 2015 at 03:47 AM
+-- Server version: 5.5.46-0ubuntu0.14.04.2
+-- PHP Version: 5.5.9-1ubuntu4.14
+
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+
+--
+-- Database: `myhealthpackage`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `admin`
+--
+
+CREATE TABLE IF NOT EXISTS `admin` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(25) NOT NULL,
+ `password` varchar(40) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `admin`
+--
+
+INSERT INTO `admin` (`id`, `name`, `password`) VALUES
+(1, 'admin', 'admin');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `category`
+--
+
+CREATE TABLE IF NOT EXISTS `category` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `cat` varchar(25) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
+
+--
+-- Dumping data for table `category`
+--
+
+INSERT INTO `category` (`id`, `cat`) VALUES
+(1, 'General ward'),
+(2, 'Semi private'),
+(3, 'Private'),
+(4, 'Emergency'),
+(5, 'Deluxe'),
+(6, 'OPD'),
+(8, 'hello');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `client_login`
+--
+
+CREATE TABLE IF NOT EXISTS `client_login` (
+ `client_id` int(11) NOT NULL AUTO_INCREMENT,
+ `username` varchar(200) NOT NULL,
+ `password` varchar(255) NOT NULL,
+ `no_of_upload` int(11) NOT NULL,
+ `con_id` varchar(55) NOT NULL,
+ PRIMARY KEY (`client_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `client_login`
+--
+
+INSERT INTO `client_login` (`client_id`, `username`, `password`, `no_of_upload`, `con_id`) VALUES
+(1, 'sam.nyx@live.com', 'sam', 36, ''),
+(2, 'mohsin@ilmtechlab.com', 'TCSXISJI', 0, '5xlGpkvSMrZNyiMlijW8rDDJH2Gqsr3pKhVzslN08HmYpZdZe4xvB4'),
+(3, 'test@tst.com', 'PXOGZQOX', -1, 'I5VW9Tn02fItAXlnuE5TL3v9xHHW1yteWK2V7jvyP7npWz8l720JxU'),
+(4, 'email@gmail.com', 'SZGEMVSQ', 0, 'H6TTEPuzTE9MK12YopOSknFCmNH5H8qo3dc0uxyi2ZUftQ8eBmVM23');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `contact_toDoc`
+--
+
+CREATE TABLE IF NOT EXISTS `contact_toDoc` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(33) NOT NULL,
+ `email` varchar(55) NOT NULL,
+ `phone` varchar(22) NOT NULL,
+ `message` longtext NOT NULL,
+ `doc_id` varchar(26) NOT NULL,
+ `procedure` varchar(99) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `contact_toDoc`
+--
+
+INSERT INTO `contact_toDoc` (`id`, `name`, `email`, `phone`, `message`, `doc_id`, `procedure`) VALUES
+(1, 'sameer khan', 'sam.nyx@live.com', '888888', 'llldldldl', 'doctor@doctor.com', '9');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `doctor_detail`
+--
+
+CREATE TABLE IF NOT EXISTS `doctor_detail` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `pic` varchar(255) DEFAULT NULL,
+ `name` varchar(30) NOT NULL,
+ `email` varchar(45) NOT NULL,
+ `phone` double NOT NULL,
+ `password` varchar(255) NOT NULL,
+ `security_q` varchar(35) NOT NULL,
+ `security_a` varchar(35) NOT NULL,
+ `status` tinyint(1) NOT NULL DEFAULT '1',
+ `lastname` varchar(22) NOT NULL,
+ `address` longtext NOT NULL,
+ `gender` varchar(8) NOT NULL,
+ `speciality` varchar(55) NOT NULL,
+ `department` varchar(55) NOT NULL,
+ `facebook` varchar(222) NOT NULL,
+ `twitter` varchar(222) NOT NULL,
+ `linkedin` varchar(222) NOT NULL,
+ `googleplus` varchar(222) NOT NULL,
+ `myweb` varchar(220) NOT NULL,
+ `myclinic` varchar(220) NOT NULL,
+ `city` varchar(58) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `email` (`email`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `doctor_detail`
+--
+
+INSERT INTO `doctor_detail` (`id`, `pic`, `name`, `email`, `phone`, `password`, `security_q`, `security_a`, `status`, `lastname`, `address`, `gender`, `speciality`, `department`, `facebook`, `twitter`, `linkedin`, `googleplus`, `myweb`, `myclinic`, `city`) VALUES
+(1, 'mydocs/doctor@doctor.com/profile//logo.png', 'sameer', 'doctor@doctor.com', 8744883682, 'doctor', '', '', 1, 'khan', 'noida', 'Male', 'General surgery ', 'IT', 'http://facebook.com/', 'http://twitter.com', 'http://linkedin.com', '', 'http://.google.com/sam0hack', 'http://entnoida.com', ''),
+(2, 'NULL', 'anand', 'google@google.com', 8744883682, '7c4a8d09ca3762af61e59520943dc26494f8941b', 'What was your childhood nickname', 'oskdok', 1, 'ee', 'NULL', 'Male', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', '', '', ''),
+(3, 'mydocs/josh@gmail.com/profile//ace_one_piece-wallpaper-1366x768.jpg', 'Josheph', 'josh@gmail.com', 8744883682, '123456', 'What was your childhood nickname', 'johnny', 1, '', 'NULL', 'Male', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', '', '', ''),
+(4, 'NULL', 'jay', 'jay@sharma.com', 8744883682, '123456', 'What was your childhood nickname', 'jay', 1, 'sharma', 'NULL', 'Male', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'noida');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `doctor_login`
+--
+
+CREATE TABLE IF NOT EXISTS `doctor_login` (
+ `doc_id` int(11) NOT NULL AUTO_INCREMENT,
+ `username` varchar(200) NOT NULL,
+ `password` varchar(255) NOT NULL,
+ `no_of_upload` int(11) NOT NULL,
+ `con_id` varchar(22) NOT NULL,
+ PRIMARY KEY (`doc_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `doctor_login`
+--
+
+INSERT INTO `doctor_login` (`doc_id`, `username`, `password`, `no_of_upload`, `con_id`) VALUES
+(1, 'doctor@doctor.com', 'doctor', 21, '1'),
+(2, 'google@google.com', '7c4a8d09ca3762af61e59520943dc26494f8941b', 0, '2706Frst22G0psCp917p'),
+(3, 'josh@gmail.com', '123456', 0, 'p4nFB2nmj215r4G1BB65'),
+(4, 'jay@sharma.com', '123456', 3, '0E9onmlsC7tqE96q2E6p');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `doctor_search_count`
+--
+
+CREATE TABLE IF NOT EXISTS `doctor_search_count` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `doc` varchar(111) NOT NULL,
+ `date` date NOT NULL,
+ `count` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
+
+--
+-- Dumping data for table `doctor_search_count`
+--
+
+INSERT INTO `doctor_search_count` (`id`, `doc`, `date`, `count`) VALUES
+(1, 'doctor@doctor.com', '2014-11-10', 23),
+(2, '', '2014-11-10', 16),
+(3, 'josh@gmail.com', '2014-11-10', 1),
+(4, 'jay@sharma.com', '2015-11-24', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `keywords`
+--
+
+CREATE TABLE IF NOT EXISTS `keywords` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `main_keyid` int(11) NOT NULL,
+ `keywords` varchar(200) NOT NULL,
+ `status` tinyint(4) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=50 ;
+
+--
+-- Dumping data for table `keywords`
+--
+
+INSERT INTO `keywords` (`id`, `main_keyid`, `keywords`, `status`) VALUES
+(1, 1, 'Apple', 0),
+(2, 1, 'Orange', 0),
+(3, 1, 'Mango', 0),
+(4, 1, 'pineapple', 0),
+(5, 2, 'facebook', 0),
+(6, 2, 'Gmail', 0),
+(7, 2, 'twitter', 0),
+(8, 2, 'linked-in', 0),
+(9, 3, 'Pizza', 0),
+(10, 3, 'burger', 0),
+(11, 3, 'french fries', 0),
+(12, 4, 'The fault in our stars', 0),
+(13, 5, 'Osteoarthritis', 0),
+(14, 5, 'Knee replacement', 0),
+(15, 5, 'Hip replacement', 0),
+(16, 4, 'and the mountains echo', 0),
+(17, 4, 'die heart', 0),
+(18, 4, 'once a while', 0),
+(19, 4, 'the secret', 0),
+(20, 4, 'Another world', 0),
+(21, 4, 'The time machine', 0),
+(22, 6, 'sinus surgery', 0),
+(25, 5, 'knee fracture', 0),
+(26, 5, 'sdsd', 0),
+(27, 6, 'knee fracture', 0),
+(28, 5, 'ldldldll', 0),
+(29, 5, 'ssllsls', 0),
+(30, 5, 'hip fracture', 0),
+(31, 3, 'popcorn', 0),
+(32, 3, 'pop candy ', 0),
+(33, 3, 'pop candy2', 0),
+(34, 3, 'pop candy404', 0),
+(35, 6, 'abc', 1),
+(36, 2, 'abc', 0),
+(37, 3, 'abc', 0),
+(38, 3, '181', 0),
+(39, 3, 'xyz', 0),
+(40, 5, 'knee pain', 0),
+(41, 2, 'tablets', 0),
+(42, 2, 'smartphone', 0),
+(43, 6, 'hello', 0),
+(44, 7, 'knee fracture', 0),
+(45, 7, 'abc', 0),
+(46, 7, 'sonu', 0),
+(47, 8, 'test1', 0),
+(48, 8, 'sdsd', 0),
+(49, 6, 'word', 0);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `linked_data`
+--
+
+CREATE TABLE IF NOT EXISTS `linked_data` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `user_id` varchar(55) NOT NULL,
+ `location` varchar(255) NOT NULL,
+ `curent_folder` varchar(255) NOT NULL,
+ `cat` varchar(20) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=107 ;
+
+--
+-- Dumping data for table `linked_data`
+--
+
+INSERT INTO `linked_data` (`id`, `user_id`, `location`, `curent_folder`, `cat`) VALUES
+(12, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/5/93229.jpg', 'mydocs/doctor@doctor.com/5', 'ashe'),
+(13, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/5/ashe_the_frost_archer___league_of_legends-wallpaper-1366x768.jpg', 'mydocs/doctor@doctor.com/5', 'ashe'),
+(14, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/5/1836105.jpg', 'mydocs/doctor@doctor.com/5', 'ashe'),
+(15, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/5/10353174_10152435411006840_7463565351491682036_n.jpg', 'mydocs/doctor@doctor.com/5', 'ashe'),
+(16, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/5/10390112_10152526766708328_2070543616061243130_n.jpg', 'mydocs/doctor@doctor.com/5', 'ashe'),
+(27, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/8/15720-tron--sci-fi-futuristic.png', 'mydocs/doctor@doctor.com/8', ''),
+(28, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/8/93229.jpg', 'mydocs/doctor@doctor.com/8', ''),
+(29, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/8/1836105.jpg', 'mydocs/doctor@doctor.com/8', ''),
+(31, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/9/funny_cat_5-wallpaper-1366x768.jpg', 'mydocs/doctor@doctor.com/9', 'cats'),
+(32, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/11/312ClaireParlour.jpg', 'mydocs/doctor@doctor.com/11', 'Prescription'),
+(33, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/11/20100330-lostkim.jpg', 'mydocs/doctor@doctor.com/11', 'Prescription'),
+(34, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/11/elizabeth-mitchell.jpg', 'mydocs/doctor@doctor.com/11', 'Prescription'),
+(35, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/11/elizabeth-mitchell-02.jpg', 'mydocs/doctor@doctor.com/11', 'Prescription'),
+(36, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/11/Elizabeth Mitchell22.jpg', 'mydocs/doctor@doctor.com/11', 'Prescription'),
+(37, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/12/lost_yunjin_kim_sun_kwon_dvdbash_3861.jpg', 'mydocs/doctor@doctor.com/12', 'Prescription'),
+(38, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/13/LostPoster.jpg', 'mydocs/doctor@doctor.com/13', 'Prescription'),
+(39, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/14/Emilie_de_Ravin_in_Lost_TV_Series_Wallpaper_1148562017.jpg', 'mydocs/doctor@doctor.com/14', 'Prescription'),
+(40, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/15/Elizabeth-Mitchell-elizabeth-mitchell-19118476-1920-1200.jpg', 'mydocs/doctor@doctor.com/15', 'Prescription'),
+(41, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/17/Elizabeth-Mitchell1.jpg', 'mydocs/doctor@doctor.com/17', 'Prescription'),
+(42, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/18/LostPoster.jpg', 'mydocs/doctor@doctor.com/18', 'Prescription'),
+(43, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/19/elizabethmitchellemmyma.jpg', 'mydocs/doctor@doctor.com/19', 'mo'),
+(44, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/20/Lost-lost-747767_1280_1024.jpg', 'mydocs/doctor@doctor.com/20', 'Prescription'),
+(45, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/23/1836105.jpg', 'mydocs/doctor@doctor.com/23', 'Prescription'),
+(46, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/24/idnmC7UfcqGo.jpg', 'mydocs/doctor@doctor.com/24', 'pressc'),
+(47, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/24/images.jpeg', 'mydocs/doctor@doctor.com/24', 'pressc'),
+(48, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/24/images.jpg', 'mydocs/doctor@doctor.com/24', 'pressc'),
+(49, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/24/IT-Average-Salaries-Around-The-Globe-Web-Developer.jpg', 'mydocs/doctor@doctor.com/24', 'pressc'),
+(50, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/24/kakashi-wallpaper-1366x768.jpg', 'mydocs/doctor@doctor.com/24', 'pressc'),
+(51, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/25/1.jpg', 'mydocs/doctor@doctor.com/25', 'nio'),
+(52, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/25/01.jpg', 'mydocs/doctor@doctor.com/25', 'nio'),
+(53, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/25/2.jpg', 'mydocs/doctor@doctor.com/25', 'nio'),
+(54, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/25/02.jpg', 'mydocs/doctor@doctor.com/25', 'nio'),
+(55, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/25/03.jpg', 'mydocs/doctor@doctor.com/25', 'nio'),
+(56, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/26/anime-girl-212.jpg', 'mydocs/doctor@doctor.com/26', 'Prescription'),
+(57, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/26/anime-manga_00356396.jpg', 'mydocs/doctor@doctor.com/26', 'Prescription'),
+(58, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/26/anime-manga_00414524.jpg', 'mydocs/doctor@doctor.com/26', 'Prescription'),
+(59, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/26/anime_wallpaper_black_white_love.jpg', 'mydocs/doctor@doctor.com/26', 'Prescription'),
+(60, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/26/anime_wallpaper_reach.jpg', 'mydocs/doctor@doctor.com/26', 'Prescription'),
+(61, '', 'mydocs/clients/sam.nyx@live.com/27/06.jpg', 'mydocs/clients/sam.nyx@live.com/27', ''),
+(62, '', 'mydocs/clients/sam.nyx@live.com/27/07.jpg', 'mydocs/clients/sam.nyx@live.com/27', ''),
+(63, '', 'mydocs/clients/sam.nyx@live.com/27/1920-1200-anime-wallpaper-hd-background-manga-full-japanese-cute7.png', 'mydocs/clients/sam.nyx@live.com/27', ''),
+(64, '', 'mydocs/clients/sam.nyx@live.com/27/1920-1200-anime-wallpaper-hd-background-manga-full-japanese-cute11.jpg', 'mydocs/clients/sam.nyx@live.com/27', ''),
+(65, '', 'mydocs/clients/sam.nyx@live.com/27/1920x1080.jpg', 'mydocs/clients/sam.nyx@live.com/27', ''),
+(66, '', 'mydocs/clients/sam.nyx@live.com/28/WP0032-01-2560x1600.jpg', 'mydocs/clients/sam.nyx@live.com/28', 'Prescription'),
+(67, '', 'mydocs/clients/sam.nyx@live.com/28/WP0032-02-2096x1080.jpg', 'mydocs/clients/sam.nyx@live.com/28', 'Prescription'),
+(68, '', 'mydocs/clients/sam.nyx@live.com/28/WP0033-04-1920x1200.jpg', 'mydocs/clients/sam.nyx@live.com/28', 'Prescription'),
+(69, '', 'mydocs/clients/sam.nyx@live.com/28/WP0034-04-4961x3508.jpg', 'mydocs/clients/sam.nyx@live.com/28', 'Prescription'),
+(70, '', 'mydocs/clients/sam.nyx@live.com/28/WP0037-04-2500x1600.jpg', 'mydocs/clients/sam.nyx@live.com/28', 'Prescription'),
+(71, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/29/1.jpg', 'mydocs/doctor@doctor.com/29', 'Prescription'),
+(74, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/34/01_Android-all-versions.jpg', 'mydocs/doctor@doctor.com/34', 'Prescription'),
+(75, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/38/blog6.jpg', 'mydocs/doctor@doctor.com/38', 'Prescription'),
+(76, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/39/01.png', 'mydocs/clients/sam.nyx@live.com/39', 'Prescription'),
+(77, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/39/02.png', 'mydocs/clients/sam.nyx@live.com/39', 'Prescription'),
+(78, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/39/02A.jpg', 'mydocs/clients/sam.nyx@live.com/39', 'Prescription'),
+(79, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/40/01.png', 'mydocs/clients/sam.nyx@live.com/40', 'Prescription'),
+(80, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/40/02.png', 'mydocs/clients/sam.nyx@live.com/40', 'Prescription'),
+(81, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/40/02A.jpg', 'mydocs/clients/sam.nyx@live.com/40', 'Prescription'),
+(82, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/41/WWW.YTS.RE.jpg', 'mydocs/clients/sam.nyx@live.com/41', 'test'),
+(83, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/42/yuna-wallpaper-1366x768.jpg', 'mydocs/clients/sam.nyx@live.com/42', 'Prescription'),
+(84, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/42/world_cup_2014-wallpaper-1366x768.jpg', 'mydocs/clients/sam.nyx@live.com/42', 'Prescription'),
+(85, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/42/tumblr_n7u579r2821sfevmio1_1280.png', 'mydocs/clients/sam.nyx@live.com/42', 'Prescription'),
+(86, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/42/tumblr_n7euvnMN901s4ddyqo1_1280.jpg', 'mydocs/clients/sam.nyx@live.com/42', 'Prescription'),
+(87, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/42/top-success-quote_14044-4.png', 'mydocs/clients/sam.nyx@live.com/42', 'Prescription'),
+(88, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/43/you_are_being_monitored-wallpaper-1366x768.jpg', 'mydocs/clients/sam.nyx@live.com/43', 'Prescription'),
+(89, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/43/women_humor_funny-wallpaper-1366x768.jpg', 'mydocs/clients/sam.nyx@live.com/43', 'Prescription'),
+(90, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/43/wink-wallpaper-1366x768.jpg', 'mydocs/clients/sam.nyx@live.com/43', 'Prescription'),
+(91, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/43/upside_down_4-wallpaper-1366x768.jpg', 'mydocs/clients/sam.nyx@live.com/43', 'Prescription'),
+(92, 'sam.nyx@live.com', 'mydocs/clients/sam.nyx@live.com/43/twitter_colorful_birds-wallpaper-1366x768.jpg', 'mydocs/clients/sam.nyx@live.com/43', 'Prescription'),
+(93, 'josh@gmail.com', 'mydocs/josh@gmail.com/44/sniper_2-wallpaper-1366x768.jpg', 'mydocs/josh@gmail.com/44', 'Prescription'),
+(94, 'josh@gmail.com', 'mydocs/josh@gmail.com/44/skyrim_logo-wallpaper-1366x768.jpg', 'mydocs/josh@gmail.com/44', 'Prescription'),
+(99, 'jay@sharma.com', 'mydocs/jay@sharma.com/53/Elizabeth Mitchell22.jpg', 'mydocs/jay@sharma.com/53', 'Prescription'),
+(100, 'jay@sharma.com', 'mydocs/jay@sharma.com/54/312ClaireParlour.jpg', 'mydocs/jay@sharma.com/54', 'Prescription'),
+(101, 'jay@sharma.com', 'mydocs/jay@sharma.com/55/susan.jpg', 'mydocs/jay@sharma.com/55', 'Prescription'),
+(102, 'jay@sharma.com', 'mydocs/jay@sharma.com/56/caroline.jpg', 'mydocs/jay@sharma.com/56', 'Prescription'),
+(103, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/57/vonnie.jpg', 'mydocs/doctor@doctor.com/57', 'Prescription'),
+(104, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/57/vonda.jpg', 'mydocs/doctor@doctor.com/57', 'Prescription'),
+(105, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/57/vivienne.jpg', 'mydocs/doctor@doctor.com/57', 'Prescription'),
+(106, 'doctor@doctor.com', 'mydocs/doctor@doctor.com/57/vivien.jpg', 'mydocs/doctor@doctor.com/57', 'Prescription');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `main_keys`
+--
+
+CREATE TABLE IF NOT EXISTS `main_keys` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `mkey` varchar(40) NOT NULL,
+ `status` tinyint(4) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
+
+--
+-- Dumping data for table `main_keys`
+--
+
+INSERT INTO `main_keys` (`id`, `mkey`, `status`) VALUES
+(2, 'Internet', 0),
+(4, 'novels', 0),
+(5, 'Orthopaedics', 0),
+(6, 'ent', 0),
+(7, 'Prescription', 1),
+(8, 'test', 1),
+(9, 'gyne', 0);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `mydocs`
+--
+
+CREATE TABLE IF NOT EXISTS `mydocs` (
+ `docs_id` int(11) NOT NULL AUTO_INCREMENT,
+ `img` varchar(200) NOT NULL,
+ `current_folder` varchar(255) NOT NULL,
+ `img_name` varchar(55) NOT NULL,
+ `details` longtext NOT NULL,
+ `doc_date` date NOT NULL,
+ `doctor_name` varchar(100) NOT NULL,
+ `client_name` varchar(200) NOT NULL,
+ `client_phone` double NOT NULL,
+ `cod` varchar(55) NOT NULL,
+ `cat` varchar(200) NOT NULL,
+ PRIMARY KEY (`docs_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=80 ;
+
+--
+-- Dumping data for table `mydocs`
+--
+
+INSERT INTO `mydocs` (`docs_id`, `img`, `current_folder`, `img_name`, `details`, `doc_date`, `doctor_name`, `client_name`, `client_phone`, `cod`, `cat`) VALUES
+(5, 'mydocs/doctor@doctor.com/5/ashe_the_frost_archer___league_of_legends-wallpaper-1366x768.jpg', 'mydocs/doctor@doctor.com/5', 'sameer khan', 'sam.nyx@live.com', '2014-08-20', 'doctor@doctor.com', '', 918744883682, '1', 'ashe'),
+(10, 'mydocs/doctor@doctor.com/9/funny_cat_5-wallpaper-1366x768.jpg_thumb', 'mydocs/doctor@doctor.com/9', 'My cat', 'sam.nyx@live.com', '2014-09-03', 'doctor@doctor.com', '', 8744883682, '1', 'cats'),
+(11, 'mydocs/doctor@doctor.com/11/Elizabeth Mitchell22.jpg_thumb', 'mydocs/doctor@doctor.com/11', 'test ehr', 'ss@ss.com', '0000-00-00', 'doctor@doctor.com', '', 8744883682, '1', 'Prescription'),
+(12, 'mydocs/doctor@doctor.com/12/lost_yunjin_kim_sun_kwon_dvdbash_3861.jpg_thumb', 'mydocs/doctor@doctor.com/12', 'test', 'test@2d.com', '0000-00-00', 'doctor@doctor.com', '', 778788, '1', 'Prescription'),
+(13, 'mydocs/doctor@doctor.com/13/LostPoster.jpg_thumb', 'mydocs/doctor@doctor.com/13', 'trd', 'ddsim@kmk.com', '1970-01-01', 'doctor@doctor.com', '', 87887, '1', 'Prescription'),
+(14, 'mydocs/doctor@doctor.com/14/Emilie_de_Ravin_in_Lost_TV_Series_Wallpaper_1148562017.jpg_thumb', 'mydocs/doctor@doctor.com/14', 'imidmis', 'md@n.com', '1970-01-01', 'doctor@doctor.com', '', 4788787, '1', 'Prescription'),
+(15, 'mydocs/doctor@doctor.com/15/Elizabeth-Mitchell-elizabeth-mitchell-19118476-1920-1200.jpg_thumb', 'mydocs/doctor@doctor.com/15', 'odjfi', '', '1970-01-01', 'doctor@doctor.com', '', 0, '1', 'Prescription'),
+(17, 'mydocs/doctor@doctor.com/17/Elizabeth-Mitchell1.jpg_thumb', 'mydocs/doctor@doctor.com/17', 'imismimi', 'mi', '1970-01-01', 'doctor@doctor.com', '', 0, '1', 'Prescription'),
+(18, 'mydocs/doctor@doctor.com/18/LostPoster.jpg_thumb', 'mydocs/doctor@doctor.com/18', 'isidn', 'i', '2014-09-06', 'doctor@doctor.com', '', 0, '1', 'Prescription'),
+(19, 'mydocs/doctor@doctor.com/19/elizabethmitchellemmyma.jpg_thumb', 'mydocs/doctor@doctor.com/19', 'osaodm', '', '2014-09-10', 'doctor@doctor.com', '', 0, '1', 'mo'),
+(20, 'mydocs/doctor@doctor.com/20/Lost-lost-747767_1280_1024.jpg_thumb', 'mydocs/doctor@doctor.com/20', 'arvind', 'ard@gmail.com', '2014-09-06', 'doctor@doctor.com', '', 8787, '1', 'Prescription'),
+(23, 'mydocs/doctor@doctor.com/23/1836105.jpg_thumb', 'mydocs/doctor@doctor.com/23', 'sam', 'sam.nyx@live.com', '2014-09-17', 'doctor@doctor.com', '', 0, '1', 'Prescription'),
+(24, 'mydocs/doctor@doctor.com/24/kakashi-wallpaper-1366x768.jpg_thumb', 'mydocs/doctor@doctor.com/24', 'test', 'test@test.com', '2014-09-19', 'doctor@doctor.com', '', 8744883682, '1', 'pressc'),
+(25, 'mydocs/doctor@doctor.com/25/03.jpg_thumb', 'mydocs/doctor@doctor.com/25', 'din', 'iwi', '2014-09-19', 'doctor@doctor.com', '', 0, '1', 'nio'),
+(26, 'mydocs/doctor@doctor.com/26/anime_wallpaper_reach.jpg_thumb', 'mydocs/doctor@doctor.com/26', 'kkk', 'kkk', '2014-09-19', 'doctor@doctor.com', '', 0, '1', 'Prescription'),
+(27, 'mydocs/clients/sam.nyx@live.com/27/1920x1080.jpg_thumb', 'mydocs/clients/sam.nyx@live.com/27', 'sameer khan', 'abc', '2014-09-19', '', 'sam.nyx@live.com', 0, '', ''),
+(28, 'mydocs/clients/sam.nyx@live.com/28/WP0037-04-2500x1600.jpg_thumb', 'mydocs/clients/sam.nyx@live.com/28', 'ss', 'sam.nyx@live.com', '2014-09-19', '', 'sam.nyx@live.com', 0, '', 'Prescription'),
+(31, 'mydocs/doctor@doctor.com/29/1.jpg_thumb', 'mydocs/doctor@doctor.com/29', 'sam', 'sam.nyx@live.com', '2014-09-19', 'doctor@doctor.com', '', 784564684, '1', 'Prescription'),
+(32, '0', 'mydocs/doctor@doctor.com/32', 'android', 'and@roid.com', '2014-10-16', 'doctor@doctor.com', '', 8744883682, '1', 'Prescription'),
+(36, 'mydocs/doctor@doctor.com/34/01_Android-all-versions.jpg_thumb', 'mydocs/doctor@doctor.com/34', 'android', 'android@google.com', '2014-10-17', 'doctor@doctor.com', '', 8744883682, '1', 'Prescription'),
+(38, 'mydocs/doctor@doctor.com/38/blog6.jpg_thumb', 'mydocs/doctor@doctor.com/38', 'test', 'test@tt.com', '2014-10-17', 'doctor@doctor.com', '', 888, '1', 'Prescription'),
+(39, 'mydocs/clients/sam.nyx@live.com/39/02A.jpg_thumb', 'mydocs/clients/sam.nyx@live.com/39', 'sam0hack', 'sam.nyx@live.com', '0000-00-00', '', 'sam.nyx@live.com', 0, '', 'Prescription'),
+(40, 'mydocs/clients/sam.nyx@live.com/40/02A.jpg_thumb', 'mydocs/clients/sam.nyx@live.com/40', 'abc', 'sam.nyx@live.com', '0000-00-00', '', 'sam.nyx@live.com', 0, '', 'Prescription'),
+(41, 'mydocs/clients/sam.nyx@live.com/41/WWW.YTS.RE.jpg_thumb', 'mydocs/clients/sam.nyx@live.com/41', 'tester', 'sam.nyx@live.com', '0000-00-00', 'testo', 'sam.nyx@live.com', 0, '', 'test'),
+(42, 'mydocs/clients/sam.nyx@live.com/42/top-success-quote_14044-4.png_thumb', 'mydocs/clients/sam.nyx@live.com/42', 'jack', 'sam.nyx@live.com', '0000-00-00', 'jack', 'sam.nyx@live.com', 0, '', 'Prescription'),
+(43, 'mydocs/clients/sam.nyx@live.com/43/twitter_colorful_birds-wallpaper-1366x768.jpg_thumb', 'mydocs/clients/sam.nyx@live.com/43', 'jack', 'sam.nyx@live.com', '0000-00-00', 'jack', 'sam.nyx@live.com', 0, '', 'Prescription'),
+(44, 'mydocs/josh@gmail.com/44/skyrim_logo-wallpaper-1366x768.jpg_thumb', 'mydocs/josh@gmail.com/44', 'hello', 'sam.nyx@live.com', '2014-10-29', 'josh@gmail.com', '', 8744883682, 'p4nFB2nmj215r4G1BB65', 'Prescription'),
+(53, 'mydocs/jay@sharma.com/53/Elizabeth Mitchell22.jpg_thumb', 'mydocs/jay@sharma.com/53', 'test2', 'email@gmail.com', '2014-11-13', 'jay@sharma.com', '', 903939283, '0E9onmlsC7tqE96q2E6p', 'Prescription'),
+(54, 'mydocs/jay@sharma.com/54/312ClaireParlour.jpg_thumb', 'mydocs/jay@sharma.com/54', 'test3', 'ret@rt.com', '2014-11-13', 'jay@sharma.com', '', 393299390, '0E9onmlsC7tqE96q2E6p', 'Prescription'),
+(55, 'mydocs/jay@sharma.com/55/susan.jpg_thumb', 'mydocs/jay@sharma.com/55', 'Susan', 'Susan987@gmail.com', '2014-11-13', 'jay@sharma.com', '', 7896541230, '0E9onmlsC7tqE96q2E6p', 'Prescription'),
+(56, 'mydocs/jay@sharma.com/56/caroline.jpg_thumb', 'mydocs/jay@sharma.com/56', 'Caroline', 'Caroline16@gmail.com', '2014-11-13', 'jay@sharma.com', '', 12365479544, '0E9onmlsC7tqE96q2E6p', 'Prescription'),
+(57, 'mydocs/doctor@doctor.com/57/vivien.jpg_thumb', 'mydocs/doctor@doctor.com/57', 'demo', 'demo@dd.com', '2014-11-17', 'doctor@doctor.com', '', 8744889328, '1', 'Prescription'),
+(79, 'PDF/9GTMDU9890MMT1MDZM557I24F.pdf', 'mydocs/doctor@doctor.com/58', 'test', 'test@ww.com', '2014-11-21', 'doctor@doctor.com', '', 87897879, '9GTMDU9890MMT1MDZM557I24F', 'Prescription');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `My_Bills`
+--
+
+CREATE TABLE IF NOT EXISTS `My_Bills` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `doc_id` varchar(55) NOT NULL,
+ `patient_name` varchar(22) NOT NULL,
+ `procedure_name` varchar(22) NOT NULL,
+ `hospital` varchar(33) NOT NULL,
+ `appx_chrg` varchar(11) NOT NULL,
+ `bill_no` varchar(11) NOT NULL,
+ `bill_date` date NOT NULL,
+ `procedure_type_id` varchar(33) NOT NULL,
+ `cat` varchar(55) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
+
+--
+-- Dumping data for table `My_Bills`
+--
+
+INSERT INTO `My_Bills` (`id`, `doc_id`, `patient_name`, `procedure_name`, `hospital`, `appx_chrg`, `bill_no`, `bill_date`, `procedure_type_id`, `cat`) VALUES
+(1, 'doctor@doctor.com', 'anand', 'eye test', 'Apollo', '500', 'billno', '2014-10-01', 'OPD Consultation ', ''),
+(3, 'doctor@doctor.com', 'mohsin', 'xyz', 'yathart', '800', 'billno', '2014-10-02', 'IP Visit', ''),
+(4, 'doctor@doctor.com', 'sonu', 'general test', 'kailash', '450', 'billno', '2014-10-08', 'Emergency Visit', ''),
+(5, 'doctor@doctor.com', 'mohsin123', 'abc', 'appolo', '500', 'billno', '2014-10-19', '', ''),
+(7, 'doctor@doctor.com', 'my cat', 'general checkup', 'apollo', '9000', 'billno', '2014-12-31', 'OPD Consultation ', 'OPD Consultation '),
+(8, 'doctor@doctor.com', 'my cat12', 'general checkup45', 'apollo89', '90000000', 'billno', '2014-12-29', 'General ward', 'General ward'),
+(9, 'jay@sharma.com', 'anand', 'x-ray', 'Apollo ', '800', 'billno', '2014-11-13', 'Semi private', 'Semi private'),
+(10, 'jay@sharma.com', 'mohsin', 'Blood test', 'apollo', '5000', 'billno', '2014-10-09', 'Emergency Visit', 'Private'),
+(11, 'doctor@doctor.com', 'test', 'test', 'test', '780', 'billno', '2015-02-05', 'General ward', 'General ward');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `packages`
+--
+
+CREATE TABLE IF NOT EXISTS `packages` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `doc_id` varchar(55) NOT NULL,
+ `package` text NOT NULL,
+ `pdetails` longtext NOT NULL,
+ `cost` varchar(55) NOT NULL,
+ `discount` varchar(55) NOT NULL,
+ `RKEY` varchar(54) NOT NULL,
+ `date` date NOT NULL,
+ `city` varchar(58) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
+
+--
+-- Dumping data for table `packages`
+--
+
+INSERT INTO `packages` (`id`, `doc_id`, `package`, `pdetails`, `cost`, `discount`, `RKEY`, `date`, `city`) VALUES
+(1, 'jay@sharma.com', 'htc', 'smartphones', '18000', '0', 'BxnOdGuYcgKKJbRUV1NGq7frl0Zu8IQ974NaA9yce9nna69wvM', '0000-00-00', 'noida'),
+(2, 'jay@sharma.com', 'htc2', 'testing', '', '0', 'AYgCk7YS9uQsCLl1hW7h5vFrfQCInOzonWrOSGhQ1x049kug7q', '0000-00-00', 'delhi');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `package_keywords`
+--
+
+CREATE TABLE IF NOT EXISTS `package_keywords` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `keyword` varchar(200) NOT NULL,
+ `RKEY` varchar(54) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
+
+--
+-- Dumping data for table `package_keywords`
+--
+
+INSERT INTO `package_keywords` (`id`, `keyword`, `RKEY`) VALUES
+(1, 'smartphone', 'BxnOdGuYcgKKJbRUV1NGq7frl0Zu8IQ974NaA9yce9nna69wvM'),
+(2, 'tablets', 'BxnOdGuYcgKKJbRUV1NGq7frl0Zu8IQ974NaA9yce9nna69wvM'),
+(3, 'linked-in', 'BxnOdGuYcgKKJbRUV1NGq7frl0Zu8IQ974NaA9yce9nna69wvM'),
+(4, 'twitter', 'BxnOdGuYcgKKJbRUV1NGq7frl0Zu8IQ974NaA9yce9nna69wvM'),
+(5, 'Gmail', 'BxnOdGuYcgKKJbRUV1NGq7frl0Zu8IQ974NaA9yce9nna69wvM'),
+(6, 'facebook', 'BxnOdGuYcgKKJbRUV1NGq7frl0Zu8IQ974NaA9yce9nna69wvM'),
+(7, 'smartphone', 'AYgCk7YS9uQsCLl1hW7h5vFrfQCInOzonWrOSGhQ1x049kug7q'),
+(8, 'tablets', 'AYgCk7YS9uQsCLl1hW7h5vFrfQCInOzonWrOSGhQ1x049kug7q'),
+(9, 'linked-in', 'AYgCk7YS9uQsCLl1hW7h5vFrfQCInOzonWrOSGhQ1x049kug7q'),
+(10, 'twitter', 'AYgCk7YS9uQsCLl1hW7h5vFrfQCInOzonWrOSGhQ1x049kug7q'),
+(11, 'Gmail', 'AYgCk7YS9uQsCLl1hW7h5vFrfQCInOzonWrOSGhQ1x049kug7q'),
+(12, 'facebook', 'AYgCk7YS9uQsCLl1hW7h5vFrfQCInOzonWrOSGhQ1x049kug7q');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `procedure_types`
+--
+
+CREATE TABLE IF NOT EXISTS `procedure_types` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `procedure_name` varchar(55) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
+
+--
+-- Dumping data for table `procedure_types`
+--
+
+INSERT INTO `procedure_types` (`id`, `procedure_name`) VALUES
+(1, 'OPD Consultation '),
+(2, 'OPD Procedure'),
+(3, 'Emergency Visit'),
+(4, 'Emergency Procedure'),
+(5, 'IP Procedure'),
+(6, 'IP Visit'),
+(7, 'Surgeon Charge '),
+(8, 'Implant Charge'),
+(9, 'word');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `searching_words`
+--
+
+CREATE TABLE IF NOT EXISTS `searching_words` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `search_word` varchar(111) NOT NULL,
+ `count` int(11) NOT NULL,
+ `date` date NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=28 ;
+
+--
+-- Dumping data for table `searching_words`
+--
+
+INSERT INTO `searching_words` (`id`, `search_word`, `count`, `date`) VALUES
+(1, 'Osteoarthritis', 53, '2015-02-05'),
+(3, 'Pizza', 4, '2014-10-13'),
+(4, 'pineapple', 1, '2014-09-23'),
+(5, 'Orange', 1, '2014-09-23'),
+(6, 'once a while', 3, '2014-09-27'),
+(7, 'and the mountains echo', 3, '2015-11-24'),
+(8, 'Another world', 1, '2014-09-23'),
+(9, 'The fault in our stars', 6, '2014-09-23'),
+(10, 'twitter', 1, '2014-09-23'),
+(11, 'die heart', 1, '2014-09-23'),
+(12, 'facebook', 6, '2015-01-05'),
+(13, 'french fries', 17, '2015-02-05'),
+(14, 'z', 1, '2014-09-23'),
+(15, 'burger', 1, '2014-09-23'),
+(16, 'Knee replacement', 56, '2015-01-05'),
+(17, 'o', 1, '2014-10-10'),
+(18, 'knee fracture', 3, '2014-11-10'),
+(20, 'abc', 1, '2014-10-30'),
+(21, 'sinus surgery', 7, '2015-11-24'),
+(23, 'knee pain', 1, '2014-11-10'),
+(24, 'tablets', 4, '2014-11-13'),
+(25, 'smartphone', 20, '2015-11-24'),
+(26, '', 12, '2015-11-24'),
+(27, 'Apple', 2, '2015-11-24');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `tmp_table`
+--
+
+CREATE TABLE IF NOT EXISTS `tmp_table` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `pic` varchar(255) DEFAULT NULL,
+ `name` varchar(30) NOT NULL,
+ `email` varchar(45) NOT NULL,
+ `phone` double NOT NULL,
+ `password` varchar(255) NOT NULL,
+ `security_q` varchar(35) NOT NULL,
+ `security_a` varchar(35) NOT NULL,
+ `status` tinyint(1) NOT NULL DEFAULT '1',
+ `lastname` varchar(22) NOT NULL,
+ `gender` varchar(8) NOT NULL,
+ `city` varchar(58) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `email` (`email`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+--
+-- Dumping data for table `tmp_table`
+--
+
+INSERT INTO `tmp_table` (`id`, `pic`, `name`, `email`, `phone`, `password`, `security_q`, `security_a`, `status`, `lastname`, `gender`, `city`) VALUES
+(1, 'NULL', 'sameer', 'sam.nyx@live.com', 8744, '123456', 'What was your childhood nickname', 'sam', 0, 'khan', 'Male', '');
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
diff --git a/online documents/phpCode/.adminverify.php.swp b/online documents/phpCode/.adminverify.php.swp
new file mode 100755
index 0000000..076707c
Binary files /dev/null and b/online documents/phpCode/.adminverify.php.swp differ
diff --git a/online documents/phpCode/.buildpath b/online documents/phpCode/.buildpath
new file mode 100755
index 0000000..606f236
--- /dev/null
+++ b/online documents/phpCode/.buildpath
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/online documents/phpCode/.project b/online documents/phpCode/.project
new file mode 100755
index 0000000..09ece14
--- /dev/null
+++ b/online documents/phpCode/.project
@@ -0,0 +1,22 @@
+
+
+ BOOTSTRAPmyheathpackege
+
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ org.eclipse.dltk.core.scriptbuilder
+
+
+
+
+
+ org.eclipse.php.core.PHPNature
+
+
diff --git a/online documents/phpCode/.settings/org.eclipse.core.resources.prefs b/online documents/phpCode/.settings/org.eclipse.core.resources.prefs
new file mode 100755
index 0000000..3ba2714
--- /dev/null
+++ b/online documents/phpCode/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/adminhome.php=UTF-8
diff --git a/online documents/phpCode/1.0.11/MIT-license.txt b/online documents/phpCode/1.0.11/MIT-license.txt
new file mode 100755
index 0000000..da1e1ec
--- /dev/null
+++ b/online documents/phpCode/1.0.11/MIT-license.txt
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (C) 2011 by Code Computerlove
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE
\ No newline at end of file
diff --git a/online documents/phpCode/1.0.11/README.md b/online documents/phpCode/1.0.11/README.md
new file mode 100755
index 0000000..2361d52
--- /dev/null
+++ b/online documents/phpCode/1.0.11/README.md
@@ -0,0 +1,203 @@
+PhotoSwipe - The web image gallery for your mobile device
+=========================================================
+
+[www.photoswipe.com](http://www.photoswipe.com)
+
+Inspired by the iOS photo viewer and Google images for mobile, PhotoSwipe is a HTML/CSS/JavaScript based image gallery specifically targeting mobile devices.
+
+The current version supports mobile handsets running WebKit based browsers, i.e. iOS, Android and Blackberry 6.
+
+PhotoSwipe also runs on the desktop and has been tested on Chrome, Firefox, Safari and Internet Explorer 8 and above.
+
+Latest Release v1.0.11
+---------------------
+[Download](http://github.com/downloads/codecomputerlove/PhotoSwipe/code-photoswipe.v1.0.11.zip)
+
+- Panning speed with zoomed images now runs at correct speed thanks to [heardfrom](https://github.com/heardfrom) and [cilogi](https://github.com/cilogi)
+
+- Added maximum and minimum user zoom settings
+
+- Should now play nicely if including MooTools thanks to [chameron](https://github.com/chameron)
+
+
+Features
+--------
+
+- Optimised for mobile devices running a WebKit browser.
+
+- Runs on modern desktop browsers, including Internet Explorer 8 and above.
+
+- Multiple input options including swipe gestures (both mouse and screen touches), keyboard control and an interactive on screen toolbar.
+
+- Responsive to device orientation changes.
+
+- Automatically scales images to maximise screen size and orientation.
+
+- Zoom / pan and rotate images (as of v1.0.4 - experimental iOS devices only)
+
+- Works with your markup and semantic structure. Does not enforce any specific markup.
+
+- Supports image captions.
+
+- Slideshow feature to automatically play through images in the gallery.
+
+- Uses hardware acceleration where possible for smoother transitions and effects.
+
+- Can be integrated into jQuery Mobile.
+
+- Comprehensive customisation options:
+
+ - Presentation controlled via CSS
+
+ - Set whether the gallery loops or not i.e. when you reach the end, is the next image the first image, or does the gallery show a bounce effect to indicate that you have reached the end.
+
+ - Hide or show captions and toolbar
+
+ - Change caption and toolbar positions
+
+ - Set the speeds of all animations used, from sliding in to fading.
+
+
+
+
+Getting Started
+---------------
+
+PhotoSwipe comes with an example site to help you get started.
+
+There are two distributions of the library:
+
+- The default distribution optimised for WebKit and Mozilla based browsers. This distribution uses standard DOM querying and manipulation. It also uses CSS3 transformations for animations.
+
+- The jQuery distribution that uses jQuery as it's engine.
+
+It is recommended for WebKit based mobile devices to use the default distribution. This distribution will run faster. It does not require jQuery (so one less library to download to your mobile device). It also uses CSS3 to achieve animation effects. This is extremely noticable when running on an iOS device as animation will use hardware acceleration and will feel more "native" to the device. The default distribution will also work on desktop WebKit browsers (such as Chrome and Safari) as well as Firefox.
+
+Use the jQuery distibution if you need to support a wider range of browsers such as Internet Explorer etc. By default, this distribution will not use hardware acceleration for animation on iOS devices so is noticably slower. You can however override the default animation functionality in jQuery by including the excellent [Animate Enhanced](https://github.com/benbarnett/jQuery-Animate-Enhanced) library (example included).
+
+Both default and jQuery distribution come with a jQuery plugin wrapper to bind elements to the gallery. So for the default distribution, if you really need to, you can still use jQuery to find your images in your HTML document, hook into the jQuery DOM ready event and use the jQuery PhotoSwipe plugin to display the library. The gallery will still be running on the default optimised engine, but you have the convience of jQuery to set things up should you need to.
+
+
+
+Getting Started - Default Distribution
+--------------------------------------
+
+See "examples/index.html".
+
+This example assumes no jQuery at all and is heavily optimised for WebKit and Mozilla browsers.
+
+ // Set up PhotoSwipe with all anchor tags in the Gallery container
+ document.addEventListener('DOMContentLoaded', function(){
+
+ Code.photoSwipe('a', '#Gallery');
+
+ }, false);
+
+
+Getting Started - Default Distribution (with jQuery plugin)
+-----------------------------------------------------------
+
+See "examples/jquery-plugin.html".
+
+This example assumes you want to use the convience of jQuery for initiating the gallery, but still the optimised engine for WebKit and Mozilla browsers.
+
+ $(document).ready(function(){
+
+ $("#Gallery a").photoSwipe();
+
+ });
+
+
+Getting Started - Default Distribution (with jQuery engine)
+-----------------------------------------------------------
+
+See "examples/jquery-engine.html".
+
+This example assumes you want to use jQuery for the gallery's engine as well as initiating the gallery. It is not advised to use this approach if you are targetting mobile WebKit based devices.
+
+
+Options
+-------
+
+- **fadeInSpeed**: The speed of any fading-in elements in milliseconds. Default "250"
+
+- **fadeOutSpeed**: The speed of any fading-out elements in milliseconds. Default "500"
+
+- **slideSpeed**: How fast images slide into view in milliseconds. Default "250"
+
+- **swipeThreshold**: How many pixels your finger has to move across the screen to register a swipe gesture. Default "50"
+
+- **swipeTimeThreshold**: A swipe must take no longer than this value in milli-seconds to be registered as a swipe gesture. Default "250"
+
+- **loop**: Whether the gallery auto-loops back to the beginning when you reach the end. Default "true"
+
+- **slideshowDelay**: The delay between showing the next image when in slideshow mode. Default "3000"
+
+- **imageScaleMethod**: How images will fit onto the screen. Either "fit" or "zoom". "fit" ensures the image always fits the screen. "zoom" the image will always fill the full screen, this may cause the image to be "zoomed" in and cropped. Default "fit"
+
+- **preventHide**: Once PhotoSwipe is active, prevents the user closing it. Useful for "exclusive mode" (see examples/exclusive-mode.html). Default "false"
+
+- **zIndex**: The intial zIndex for PhotoSwipe. Default "1000"
+
+- **backButtonHideEnabled**: This will hide the gallery when the user hits the back button. Useful for Android and Blackberry. Works in BB6, Android v2.1 and above and iOS 4 and above. Default "true"
+
+- **allowUserZoom**: iOS only - Allow the user to zoom / pan around images. Default "true"
+
+- **allowRotationOnUserZoom**: iOS only - Allow the user to rotate images whilst zooming / panning. Default "true"
+
+- **maxUserZoom**: iOS only - The maximum a user can zoom into an image. Default 5.0 (set to zero for this to be ignored)
+
+- **minUserZoom**: iOS only - The minimum a user can zoom out of an image. Default 0.5 (set to zero for this to be ignored)
+
+- **adjustUserPanToZoom**: iOS only - Adjusts the speed of panning to match the current zoom value. Default "true"
+
+- **captionAndToolbarHide**: Hide the caption and toolbar. Default "false"
+
+- **captionAndToolbarHideOnSwipe**: Hide the caption and toolbar when you swipe to the next image. Default "true"
+
+- **captionAndToolbarFlipPosition**: Place the caption at the bottom and the toolbar at the top. Default "false"
+
+- **captionAndToolbarAutoHideDelay**: How long to wait before the caption and toolbar automatically disappear. Default "5000". Set to "0" to prevent auto disappearing
+
+- **captionAndToolbarOpacity**: The opacity of the caption and toolbar. Default "0.8"
+
+- **captionAndToolbarShowEmptyCaptions**: Shows a blank caption area even if a caption cannot be found for the current image. Default "false"
+
+- **jQueryMobile**: Whether PhotoSwipe is integrated into a jQuery Mobile project or not. By default, PhotoSwipe will try and work this out for you.
+
+- **jQueryMobileDialogHash**: The window hash tag used by jQuery Mobile and dialog pages. Default "&ui-state=dialog".
+
+- **getImageSource**: Function to specify how the gallery obatins image sources. By default, the gallery assumes you send it a list of images with each image wrapped in an anchor tag. The anchor tag will contain the URL to the full size image. You can change this e.g. if you supply a list of images without an anchor tag, and supply the full size URL on the image's "rel" attribute:
+
+ Code.photoSwipe('a', '#Gallery', {
+
+ getImageSource: function(el){
+ return el.getAttribute('rel');
+ }
+
+ });
+
+- **getImageCaption**: Like "getImageSource", function to specify how the gallery obatins image captions. By default, the gallery looks for an image's "alt" tag.
+
+
+-- **getImageMetaData**: Function to associated additional meta data against an image in the gallery. This meta data can then be used in your own code if you listen to the "onDisplayImage" event.
+
+ getImageMetaData: function(el){
+
+ return {
+ longDescription: el.getAttribute(el, 'data-long-description')
+ }
+
+ }
+
+
+Keyboard controls for desktop browsers
+--------------------------------------
+
+- **Left cursor**: Previous image
+
+- **Right cursor**: Next image
+
+- **Escape**: Close gallery
+
+- **Space bar**: Show toolbar / caption if they have faded from view. If both are hidden via the configuration, space bar will close the gallery
diff --git a/online documents/phpCode/1.0.11/code-photoswipe-1.0.11.js b/online documents/phpCode/1.0.11/code-photoswipe-1.0.11.js
new file mode 100755
index 0000000..1d39f0a
--- /dev/null
+++ b/online documents/phpCode/1.0.11/code-photoswipe-1.0.11.js
@@ -0,0 +1,5097 @@
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function (window) {
+
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind
+ if (!Function.prototype.bind ) {
+
+ Function.prototype.bind = function( obj ) {
+ var slice = [].slice,
+ args = slice.call(arguments, 1),
+ self = this,
+ nop = function () {},
+ bound = function () {
+ return self.apply( this instanceof nop ? this : ( obj || {} ),
+ args.concat( slice.call(arguments) ) );
+ };
+
+ nop.prototype = self.prototype;
+
+ bound.prototype = new nop();
+
+ return bound;
+ };
+ }
+
+
+ if (typeof Code === "undefined") {
+ Code = {};
+ Code.PhotoSwipe = {};
+ }
+
+
+
+ Code.PhotoSwipe.Util = {
+
+ browser: {
+ version: (navigator.userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
+ webkit: /webkit/i.test(navigator.userAgent),
+ opera: /opera/i.test(navigator.userAgent), // untested
+ msie: /msie/i.test(navigator.userAgent) && !/opera/.test(navigator.userAgent),
+ mozilla: /mozilla/i.test(navigator.userAgent) && !/(compatible|webkit)/.test(navigator.userAgent),
+ mobileSafari: /mobile.*safari/i.test(navigator.userAgent),
+ is3dSupported: false,
+ isAndroid: /android/i.test(navigator.userAgent),
+ isBlackberry: /blackberry/i.test(navigator.userAgent),
+ isiOS: /like Mac OS/i.test(navigator.userAgent),
+ touchSupported: false,
+ gestureSupported: false,
+
+
+ _eventTagNames: {
+ 'select':'input',
+ 'change':'input',
+ 'submit':'form',
+ 'reset':'form',
+ 'error':'img',
+ 'load':'img',
+ 'abort':'img'
+ },
+
+
+ /*
+ * Function: isEventSupported
+ * http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
+ */
+ isEventSupported: function(eventName) {
+ var el = document.createElement(this._eventTagNames[eventName] || 'div');
+ eventName = 'on' + eventName;
+ var isSupported = (eventName in el);
+ if (!isSupported) {
+ el.setAttribute(eventName, 'return;');
+ isSupported = typeof el[eventName] == 'function';
+ }
+ el = null;
+ return isSupported;
+ }
+ },
+
+
+ /*
+ * Function: setElementData
+ */
+ setElementData: function(el, key, value){
+
+ if ( this.isNothing(el.UtilData) ){
+ el.UtilData = { };
+ }
+
+ el.UtilData[key] = value;
+ },
+
+
+ /*
+ * Function: getElementData
+ */
+ getElementData: function(el, key, defaultValue){
+
+ if (typeof defaultValue === "undefined"){
+ defaultValue = null;
+ }
+
+ if ( this.isNothing(el.UtilData) ){
+ return defaultValue;
+ }
+
+ if ( this.isNothing(el.UtilData[key]) ){
+ return defaultValue;
+ }
+
+ return el.UtilData[key];
+
+ },
+
+
+ /*
+ * Function: removeElementData
+ */
+ removeElementData: function(el, key){
+
+ delete el.UtilData[key];
+
+ },
+
+
+ /*
+ * Function: coalesce
+ * Takes any number of arguments and returns the first non Null / Undefined argument.
+ */
+ coalesce: function () {
+ var i;
+ for (i = 0; i < arguments.length; i++) {
+ if (!this.isNothing(arguments[i])) {
+ return arguments[i];
+ }
+ }
+ return null;
+ },
+
+
+
+ /*
+ * Function: registerNamespace
+ */
+ registerNamespace: function () {
+ var args = arguments, obj = null, i, j;
+ for (i = 0; i < args.length; ++i) {
+ var ns = args[i];
+ var nsParts = ns.split(".");
+ var root = nsParts[0];
+ eval('if (typeof ' + root + ' == "undefined"){' + root + ' = {};} obj = ' + root + ';');
+ for (j = 1; j < nsParts.length; ++j) {
+ obj[nsParts[j]] = obj[nsParts[j]] || {};
+ obj = obj[nsParts[j]];
+ }
+ }
+ },
+
+
+
+ /*
+ * Function: extend
+ */
+ extend: function(destination, source, overwriteProperties){
+ if (this.isNothing(overwriteProperties)){
+ overwriteProperties = true;
+ }
+ if (destination && source && this.isObject(source)){
+ for(var prop in source){
+ if (overwriteProperties){
+ destination[prop] = source[prop];
+ }
+ else{
+ if(typeof destination[prop] == "undefined"){
+ destination[prop] = source[prop];
+ }
+ }
+ }
+ }
+ },
+
+
+ /*
+ * Function: swapArrayElements
+ */
+ swapArrayElements: function(arr, i, j){
+
+ var temp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = temp;
+
+ },
+
+
+ /*
+ * Function: isObject
+ */
+ isObject: function(obj){
+ return typeof obj == "object";
+ },
+
+
+
+ /*
+ * Function: isNothing
+ */
+ isNothing: function (obj) {
+ if (typeof obj === "undefined" || obj === null) {
+ return true;
+ }
+ return false;
+ },
+
+
+
+ /*
+ * Function: isFunction
+ */
+ isFunction: function(obj){
+ return typeof obj == "function";
+ },
+
+
+
+ /*
+ * Function: isArray
+ */
+ isArray: function(obj){
+ return obj && Code.PhotoSwipe.Util.isFunction(obj.pop);
+ },
+
+
+
+ /*
+ * Function: isNumber
+ */
+ isNumber: function(obj){
+ return typeof obj == "number";
+ },
+
+
+ /*
+ * Function: isString
+ */
+ isString: function(obj){
+ return typeof obj == "string";
+ },
+
+
+
+ /*
+ * Function: trim
+ */
+ trim: function(val) {
+ var re = new RegExp(/\s+?/);
+ return val.replace(re, '');
+ }
+
+
+ };
+
+ if (Code.PhotoSwipe.Util.browser.webkit){
+ var test3DEl = document.createElement('div');
+ Code.PhotoSwipe.Util.browser.is3dSupported = !Code.PhotoSwipe.Util.isNothing(test3DEl.style.WebkitPerspective);
+ }
+
+ Code.PhotoSwipe.Util.browser.touchSupported = Code.PhotoSwipe.Util.browser.isEventSupported('touchstart');
+ Code.PhotoSwipe.Util.browser.gestureSupported = Code.PhotoSwipe.Util.browser.isEventSupported('gesturestart');
+
+})(window);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function (window, Util) {
+
+ Util.extend(Util, {
+
+ DOM: {
+
+
+ /*
+ * Function: resetTranslate
+ * Required for smoother transition on iOS
+ */
+ resetTranslate: function(el){
+
+ if (Util.browser.webkit){
+ if (Util.browser.is3dSupported){
+ Util.DOM.setStyle(el, { webkitTransform: 'translate3d(0px, 0px, 0px)'});
+ }
+ else{
+ Util.DOM.setStyle(el, { webkitTransform: 'translate(0px, 0px)'});
+ }
+ }
+ else{
+ Util.DOM.setStyle(el, {
+ webkitTransform: 'translate(0px, 0px)',
+ MozTransform: 'translate(0px, 0px)',
+ transform: 'translate(0px, 0px)'
+ });
+ }
+
+ },
+
+
+ /*
+ * Function: createElement
+ */
+ createElement: function(type, attributes, content){
+
+ var retval = document.createElement(type);
+
+ for(var attribute in attributes) {
+ if(attributes.hasOwnProperty(attribute)){
+ retval.setAttribute(attribute, attributes[attribute]);
+ }
+ }
+
+ retval.innerHTML = content || '';
+
+ return retval;
+
+ },
+
+
+ /*
+ * Function: appendChild
+ */
+ appendChild: function(childEl, parentEl){
+
+ parentEl.appendChild(childEl);
+
+ },
+
+
+ /*
+ * Function: appendText
+ */
+ appendText: function(text, parentEl){
+
+ var textNode = document.createTextNode(text);
+ Util.DOM.appendChild(textNode, parentEl);
+
+ },
+
+
+ /*
+ * Function: appendToBody
+ */
+ appendToBody: function(childEl){
+
+ this.appendChild(childEl, document.body);
+
+ },
+
+
+ /*
+ * Function: removeChild
+ */
+ removeChild: function(childEl, parentEl){
+
+ parentEl.removeChild(childEl);
+
+ },
+
+
+
+ /*
+ * Function: removeChildren
+ */
+ removeChildren: function(parentEl){
+
+ if (parentEl.hasChildNodes()){
+
+ while (parentEl.childNodes.length >= 1){
+ parentEl.removeChild(parentEl.childNodes[parentEl.childNodes.length -1]);
+ }
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: hasAttribute
+ */
+ hasAttribute: function(el, attributeName){
+
+ return el.getAttribute(attributeName);
+
+ },
+
+
+ /*
+ * Function: getAttribute
+ */
+ getAttribute: function(el, attributeName){
+
+ if(!this.hasAttribute(el, attributeName)){
+ return '';
+ }
+
+ return el.getAttribute(attributeName);
+
+ },
+
+
+ /*
+ * Function: el, attributeName
+ */
+ setAttribute: function(el, attributeName, value){
+
+ el.setAttribute(attributeName, value);
+
+ },
+
+
+ /*
+ * Function: removeAttribute
+ */
+ removeAttribute: function(el, attributeName){
+
+ if (this.hasAttribute(el, attributeName)){
+
+ el.removeAttribute(attributeName);
+
+ }
+
+ },
+
+
+ /*
+ * Function: addClass
+ */
+ addClass: function(el, className){
+
+ var currentClassValue = Util.DOM.getAttribute(el, 'class');
+
+ var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
+
+ if ( ! re.test(currentClassValue) ){
+ if (currentClassValue !== ''){
+ currentClassValue = currentClassValue + ' ';
+ }
+ currentClassValue = currentClassValue + className;
+ Util.DOM.setAttribute(el, 'class', currentClassValue);
+ }
+
+ },
+
+
+ /*
+ * Function: removeClass
+ */
+ removeClass: function(el, className){
+
+ var currentClassValue = Util.DOM.getAttribute(el, 'class');
+
+ var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
+
+ if (re.test(currentClassValue)){
+
+ currentClassValue = currentClassValue.replace(re, ' ');
+
+ Util.DOM.setAttribute(el, 'class', currentClassValue);
+ Util.DOM.removeClass(el, className);
+
+ }
+ else{
+ currentClassValue = Util.trim(currentClassValue);
+ if (currentClassValue === ''){
+ Util.DOM.removeAttribute(el, 'class');
+ }
+ else{
+ Util.DOM.setAttribute(el, 'class', currentClassValue);
+ }
+ }
+
+ },
+
+
+ /*
+ * Function: hasClass
+ */
+ hasClass: function(el, className){
+
+ var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
+ return re.test(Util.DOM.getAttribute(el, 'class'));
+
+ },
+
+
+ /*
+ * Function: setStyle
+ */
+ setStyle: function(el, style, value){
+
+ if (Util.isObject(style)) {
+ for(var propertyName in style) {
+ if(style.hasOwnProperty(propertyName)){
+ el.style[propertyName] = style[propertyName];
+ }
+ }
+ }
+ else {
+ el.style[style] = value;
+ }
+ },
+
+
+ /*
+ * Function: getStyle
+ */
+ getStyle: function(el, styleName){
+
+ return window.getComputedStyle(el,'').getPropertyValue(styleName);
+
+ },
+
+
+ /*
+ * Function: hide
+ */
+ hide: function(el){
+
+ // Store the current display value if we use show
+ Util.setElementData(el, 'oldDisplayValue', Util.DOM.getStyle(el, 'display'));
+ Util.DOM.setStyle(el, 'display', 'none');
+
+ },
+
+
+ /*
+ * Function: show
+ */
+ show: function(el){
+
+ if (Util.DOM.getStyle(el, 'display') == 'none'){
+ var oldDisplayValue = Util.getElementData(el, 'oldDisplayValue', 'block');
+ if (oldDisplayValue === 'none'){
+ oldDisplayValue = 'block';
+ }
+ Util.DOM.setStyle(el, 'display', oldDisplayValue);
+ }
+
+ },
+
+
+ /*
+ * Function: width
+ * Content width, excludes padding
+ */
+ width: function(el, value){
+
+ if (!Util.isNothing(value)){
+ if (Util.isNumber(value)){
+ value = value + 'px';
+ }
+ el.style.width = value;
+ }
+
+ return this._getDimension(el, 'width');
+
+ },
+
+
+ /*
+ * Function: outerWidth
+ */
+ outerWidth: function(el){
+
+ var retval = Util.DOM.width(el);
+
+ retval += parseInt(Util.DOM.getStyle(el, 'padding-left'), 10) + parseInt(Util.DOM.getStyle(el, 'padding-right'), 10);
+ retval += parseInt(Util.DOM.getStyle(el, 'margin-left'), 10) + parseInt(Util.DOM.getStyle(el, 'margin-right'), 10);
+ retval += parseInt(Util.DOM.getStyle(el, 'border-left-width'), 10) + parseInt(Util.DOM.getStyle(el, 'border-right-width'), 10);
+ return retval;
+
+ },
+
+
+ /*
+ * Function: height
+ * Content height, excludes padding
+ */
+ height: function(el, value){
+
+ if (!Util.isNothing(value)){
+ if (Util.isNumber(value)){
+ value = value + 'px';
+ }
+ el.style.height = value;
+ }
+
+ return this._getDimension(el, 'height');
+
+ },
+
+
+ /*
+ * Function: _getDimension
+ */
+ _getDimension: function(el, dimension){
+
+ var retval = window.parseInt(window.getComputedStyle(el,'').getPropertyValue(dimension));
+
+ if (isNaN(retval)){
+
+ // If this is the case, chances are the element is not displayed and we can't get
+ // the width and height. This temporarily shows and hides to get the value
+ var styleBackup = {
+ display: el.style.display,
+ left: el.style.left
+ };
+
+ el.style.display = 'block';
+ el.style.left = '-1000000px';
+
+ retval = window.parseInt(window.getComputedStyle(el,'').getPropertyValue(dimension));
+
+ el.style.display = styleBackup.display;
+ el.style.left = styleBackup.left;
+ }
+ return retval;
+
+ },
+
+
+
+ /*
+ * Function: outerHeight
+ */
+ outerHeight: function(el){
+
+ var retval = Util.DOM.height(el);
+
+ retval += parseInt(Util.DOM.getStyle(el, 'padding-top'), 10) + parseInt(Util.DOM.getStyle(el, 'padding-bottom'), 10);
+ retval += parseInt(Util.DOM.getStyle(el, 'margin-top'), 10) + parseInt(Util.DOM.getStyle(el, 'margin-bottom'), 10);
+ retval += parseInt(Util.DOM.getStyle(el, 'border-top-width'), 10) + parseInt(Util.DOM.getStyle(el, 'border-bottom-width'), 10);
+
+ return retval;
+
+ },
+
+
+ /*
+ * Function: documentWidth
+ */
+ documentWidth: function(){
+
+ return Util.DOM.width(document.documentElement);
+
+ },
+
+
+ /*
+ * Function: documentHeight
+ */
+ documentHeight: function(){
+
+ return Math.round(Util.DOM.height(document.documentElement));
+
+ },
+
+
+ /*
+ * Function: bodyWidth
+ */
+ bodyWidth: function(){
+
+ return Util.DOM.width(document.body);
+
+ },
+
+
+ /*
+ * Function: bodyHeight
+ */
+ bodyHeight: function(){
+
+ return Util.DOM.height(document.body);
+
+ },
+
+
+ /*
+ * Function: windowWidth
+ */
+ windowWidth: function(){
+
+ return window.innerWidth;
+
+ },
+
+
+ /*
+ * Function: windowHeight
+ */
+ windowHeight: function(){
+
+ return window.innerHeight;
+
+ },
+
+
+ /*
+ * Function: windowScrollLeft
+ */
+ windowScrollLeft: function(){
+
+ return window.pageXOffset;
+
+ },
+
+
+ /*
+ * Function: windowScrollTop
+ */
+ windowScrollTop: function(){
+
+ return window.pageYOffset;
+
+ },
+
+
+ /*
+ * Function: addEventListener
+ */
+ addEventListener: function(el, type, listener){
+
+ el.addEventListener(type, listener, false);
+
+ },
+
+
+ /*
+ * Function: removeEventListener
+ */
+ removeEventListener: function(el, type, listener){
+
+ el.removeEventListener(type, listener, false);
+
+ },
+
+
+ /*
+ * Function: getMousePosition
+ */
+ getMousePosition: function(event){
+
+ var retval = {
+ x: 0,
+ y: 0
+ };
+
+ if (event.pageX) {
+ retval.x = event.pageX;
+ }
+ else if (event.clientX) {
+ retval.x = event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
+ }
+
+ if (event.pageY) {
+ retval.y = event.pageY;
+ }
+ else if (event.clientY) {
+ retval.y = event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
+ }
+
+ return retval;
+ },
+
+
+ /*
+ * Function: getTouchEvent
+ */
+ getTouchEvent: function(event){
+
+ return event;
+
+ }
+
+ }
+
+
+ });
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function (window, Util) {
+
+ Util.extend(Util, {
+
+
+ Animation: {
+
+ _applyTransitionDelay: 50,
+
+ /*
+ * Function: _setTransition
+ * Sets animation transitions on the element
+ */
+ _setTransition: function(el, property, duration, timingFunction, delay, callback){
+
+ var
+ transitionPrefix = Util.Animation._getTransitionPrefix(),
+ p = Util.coalesce(property, ''),
+ d = Util.coalesce(duration, ''),
+ t, de, c;
+
+ if (Util.isFunction(timingFunction)){
+ c = timingFunction;
+ t = '';
+ de = '';
+ }
+ else{
+ c = callback;
+ t = Util.coalesce(timingFunction, '');
+ de = Util.coalesce(delay, '');
+ }
+
+ var transitionValues = {};
+ transitionValues[transitionPrefix + 'Property'] = p;
+ transitionValues[transitionPrefix + 'Duration'] = d;
+ transitionValues[transitionPrefix + 'TimingFunction'] = t;
+ transitionValues[transitionPrefix + 'Delay'] = de;
+
+ Util.DOM.setStyle(el, transitionValues);
+
+ // Wait for the above transitions to get applied
+ if (Util.isFunction(c)){
+ window.setTimeout(
+ function(){
+ c(el);
+ },
+ Util.Animation._applyTransitionDelay
+ );
+ }
+
+ },
+
+
+ /*
+ * Function: _setTransitionEndEventListener
+ * Sets an event listener on transition end. This will:
+ * - Remove the transitionEnd event hander
+ * - Fire any animation end callback you specified
+ *
+ * The function stores a pointer to the event handler functions
+ * on the element object itself (using Util.setElementData)
+ *
+ * This gives us a reference when removing the event listener
+ */
+ _setTransitionEndEventListener: function(el){
+
+ Util.setElementData(el, 'transitionEndEvent', function(e){
+
+ var el = e.target;
+
+ Util.DOM.removeEventListener(el, Util.Animation._getTransitionEndEventLabel(), Util.getElementData(el, 'transitionEndEvent'));
+ Util.removeElementData(el, 'transitionEndEvent');
+
+ var callback = Util.getElementData(el, 'transitionEndCallback');
+ Util.removeElementData(el, 'transitionEndCallback');
+
+ // Remove the tranistion
+ Util.Animation._removeTransitions(el);
+
+ if (Util.isFunction(callback)){
+
+ window.setTimeout(
+ function(){
+ callback(e);
+ },
+ Util.Animation._applyTransitionDelay
+ );
+
+ }
+
+ });
+
+
+ Util.DOM.addEventListener(el, Util.Animation._getTransitionEndEventLabel(), Util.getElementData(el, 'transitionEndEvent'));
+
+ },
+
+
+ /*
+ * Function: _removeTransitions
+ */
+ _removeTransitions: function(el){
+
+ var transitionPrefix = Util.Animation._getTransitionPrefix();
+
+ var transitionValues = {};
+ transitionValues[transitionPrefix + 'Property'] = '';
+ transitionValues[transitionPrefix + 'Duration'] = '';
+ transitionValues[transitionPrefix + 'TimingFunction'] = '';
+ transitionValues[transitionPrefix + 'Delay'] = '';
+
+ Util.DOM.setStyle(el, transitionValues);
+
+ },
+
+
+ /*
+ * Function: _getTransitionEndEventLabel
+ */
+ _getTransitionEndEventLabel: function(){
+
+ return (document.documentElement.style.WebkitTransition !== undefined) ? "webkitTransitionEnd" : "transitionend";
+
+ },
+
+
+ _getTransitionPrefix: function(){
+
+ return (document.documentElement.style.WebkitTransition !== undefined) ? "webkitTransition" : (document.documentElement.style.MozTransition !== undefined) ? "MozTransition" : "transition";
+
+ },
+
+
+ /*
+ * Function: stopFade
+ */
+ stopFade: function(el){
+
+ var fadeCallback = Util.getElementData(el, 'transitionEndEvent');
+ if (Util.isNothing(fadeCallback)){
+ return;
+ }
+
+ Util.DOM.removeEventListener(
+ el,
+ Util.Animation._getTransitionEndEventLabel(),
+ Util.getElementData(el, 'transitionEndEvent')
+ );
+
+ var currentOpacity = window.getComputedStyle(el,'').getPropertyValue('opacity');
+
+ Util.Animation._removeTransitions(el);
+
+ Util.DOM.setStyle(el, 'opacity', currentOpacity);
+
+ },
+
+
+ /*
+ * Function: fadeIn
+ * Fades an element in.
+ * Make sure the element is displayed before calling
+ */
+ fadeIn: function(el, opacity, duration, callback){
+
+ opacity = Util.coalesce(opacity, 1);
+ duration = Util.coalesce(duration, 500);
+
+ Util.setElementData(el, 'transitionEndCallback', callback);
+
+ Util.Animation._setTransition(el, 'opacity', duration + 'ms', function(el){
+
+ Util.Animation._setTransitionEndEventListener(el);
+ Util.DOM.setStyle(el, 'opacity', opacity);
+
+ });
+
+ },
+
+
+ /*
+ * Function: fadeOut
+ * Fades an element out
+ * Make sure the element is displayed before calling
+ * Does not "hide" the element when animation is over
+ */
+ fadeOut: function(el, duration, callback){
+
+ if (Util.isNothing(duration)){
+ duration = 500;
+ }
+
+ Util.setElementData(el, 'transitionEndCallback', callback);
+
+ Util.Animation._setTransition(el, 'opacity', duration + 'ms', function(el){
+
+ Util.Animation._setTransitionEndEventListener(el);
+ Util.DOM.setStyle(el, 'opacity', 0);
+
+ });
+
+ },
+
+
+
+ /*
+ * Function: slideTo
+ * Slides an element by an x,y position
+ */
+ slideBy: function(el, xPos, yPos, duration, callback){
+
+ if (Util.isNothing(duration)){
+ duration = 500;
+ }
+
+ /* Store some values against the element for later use */
+ Util.setElementData(el, 'transitionEndCallback', Util.Animation._onSlideByEnd);
+ Util.setElementData(el, 'slideByCallback', callback);
+ Util.setElementData(el, 'slideByXPos', xPos);
+ Util.setElementData(el, 'slideByYPos', yPos);
+
+ //ease-in-out
+ Util.Animation._setTransition(el, 'all', duration + 'ms', 'ease-in', 0, function(el){
+
+ Util.Animation._setTransitionEndEventListener(el);
+
+ var
+ xPos = Util.getElementData(el, 'slideByXPos'),
+ yPos = Util.getElementData(el, 'slideByYPos');
+
+ Util.removeElementData(el, 'slideByXPos');
+ Util.removeElementData(el, 'slideByYPos');
+
+
+ if (Util.browser.webkit){
+ if (Util.browser.is3dSupported){
+ Util.DOM.setStyle(el, { webkitTransform: 'translate3d(' + xPos + 'px, ' + yPos + 'px, 0)'});
+ }
+ else{
+ Util.DOM.setStyle(el, { webkitTransform: 'translate(' + xPos + 'px, ' + yPos + 'px)'});
+ }
+ }
+ else {
+ Util.DOM.setStyle(el, {
+ webkitTransform: 'translate(' + xPos + 'px, ' + yPos + 'px)',
+ MozTransform: 'translate(' + xPos + 'px, ' + yPos + 'px)',
+ transform: 'translate(' + xPos + 'px, ' + yPos + 'px)'
+ });
+ }
+
+ });
+
+ },
+
+
+
+ _onSlideByEnd: function(e){
+
+ // Reset the real css top and left after the transformation
+ var
+ el = e.target,
+
+ callback = Util.getElementData(el, 'slideByCallback'),
+
+ transform = Util.coalesce(el.style.webkitTransform, el.style.MozTransform, el.style.transform),
+
+ transformExploded = transform.match( /\((.*?)\)/ )[1].split(', '),
+
+ transformedX = window.parseInt(transformExploded[0]),
+
+ transformedY = window.parseInt(transformExploded[1]),
+
+ domX = window.parseInt(Util.DOM.getStyle(el, 'left')),
+
+ domY = window.parseInt(Util.DOM.getStyle(el, 'top'));
+
+ Util.DOM.setStyle(el, {
+ webkitTransform: '',
+ MozTransform: '',
+ transform: '',
+ left: (domX + transformedX) + 'px',
+ top: (domY + transformedY) + 'px'
+ });
+
+
+ Util.removeElementData(el, 'slideByCallback');
+ Util.removeElementData(el, 'slideByXPos');
+ Util.removeElementData(el, 'slideByYPos');
+
+ if (Util.isFunction(callback)){
+ window.setTimeout(
+ function(){
+ callback(e);
+ },
+ Util.Animation._applyTransitionDelay
+ );
+ //window.setTimeout(callback, Util.Animation._applyTransitionDelay, e);
+ }
+
+ }
+
+
+ }
+
+
+ });
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function () {
+
+ // Based on http://www.javascriptbank.com/how-build-custom-events-javascript.html
+ Code.PhotoSwipe.EventClass = SimpleClass.extend({
+
+ _listeners: null,
+
+ init: function(){
+
+ this._listeners = {};
+
+ },
+
+
+ addEventListener: function(type, listener){
+
+ if (typeof this._listeners[type] === 'undefined'){
+ this._listeners[type] = [];
+ }
+ this._listeners[type].push(listener);
+
+ },
+
+
+ dispatchEvent: function(event){
+ if (typeof event == "string"){
+ event = { type: event };
+ }
+ if (!event.target){
+ event.target = this;
+ }
+
+ if (!event.type){
+ throw new Error("Event object missing 'type' property.");
+ }
+
+ if (this._listeners[event.type] instanceof Array){
+ var listeners = this._listeners[event.type];
+ for (var i=0, len=listeners.length; i < len; i++){
+ listeners[i].call(this, event);
+ }
+ }
+ },
+
+
+ removeEventListener: function(type, listener){
+ if (this._listeners[type] instanceof Array){
+ var listeners = this._listeners[type];
+ for (var i=0, len=listeners.length; i < len; i++){
+ if (listeners[i] === listener){
+ listeners.splice(i, 1);
+ break;
+ }
+ }
+ }
+ }
+
+ });
+
+
+})();
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function (window, Util) {
+
+ /*
+ * Class: Code.PhotoSwipe.ElementClass
+ * Most PhotoSwipe classes inherit from this class
+ * Provides hooks for fading in and out
+ */
+ Code.PhotoSwipe.ElementClass = Code.PhotoSwipe.EventClass.extend({
+
+ el: null,
+ settings: null,
+ isHidden: null,
+
+ fadeInHandler: null,
+ fadeOutHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options){
+
+ this._super();
+
+ this.settings = {
+ opacity: 1,
+ fadeInSpeed: 250,
+ fadeOutSpeed: 500
+ };
+
+ Util.extend(this.settings, options);
+
+ this.fadeInHandler = this.postFadeIn.bind(this);
+ this.fadeOutHandler = this.postFadeOut.bind(this);
+ this.isHidden = true;
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+ },
+
+
+
+ /*
+ * Function: show
+ */
+ show: function(){
+
+ this.stopFade();
+
+ // Show
+ Util.DOM.setStyle(this.el, 'opacity', this.settings.opacity);
+ Util.DOM.show(this.el);
+
+ this.postShow();
+
+ },
+
+
+
+ /*
+ * Function: postShow
+ * Overide this
+ */
+ postShow: function(){
+
+ this.isHidden = false;
+ this.addEventListeners();
+ this.dispatchEvent(Code.PhotoSwipe.ElementClass.EventTypes.onShow);
+
+ },
+
+
+
+ /*
+ * Function: fadeIn
+ */
+ fadeIn: function(){
+
+ Util.DOM.setStyle(this.el, 'opacity', 0);
+
+ this.fadeInFromCurrentOpacity();
+
+ },
+
+
+
+ /*
+ * Function: fadeInFromCurrentOpacity
+ */
+ fadeInFromCurrentOpacity: function(){
+
+ this.stopFade();
+
+ this.isHidden = false;
+
+ // Fade in
+ Util.DOM.show(this.el);
+ Util.Animation.fadeIn(
+ this.el,
+ this.settings.opacity,
+ this.settings.fadeInSpeed,
+ this.fadeInHandler
+ );
+
+ },
+
+
+
+ /*
+ * Function: postFadeIn
+ */
+ postFadeIn: function(e){
+
+ if (this.isHidden){
+ return;
+ }
+
+ this.addEventListeners();
+ this.dispatchEvent(Code.PhotoSwipe.ElementClass.EventTypes.onFadeIn);
+
+ },
+
+
+
+ /*
+ * Function: hide
+ */
+ hide: function(){
+
+ this.stopFade();
+
+ Util.DOM.hide(this.el);
+
+ this.postHide();
+
+ },
+
+
+ /*
+ * Function: postHide
+ * Overide this
+ */
+ postHide: function(){
+
+ this.isHidden = true;
+ this.removeEventListeners();
+ this.dispatchEvent(Code.PhotoSwipe.ElementClass.EventTypes.onHide);
+
+ },
+
+
+ /*
+ * Fuction: fadeOut
+ */
+ fadeOut: function(){
+
+ this.stopFade();
+
+ this.isHidden = true;
+
+ Util.Animation.fadeOut(this.el, this.settings.fadeOutSpeed, this.fadeOutHandler);
+
+ },
+
+
+
+
+ /*
+ * Function: preFadeOut
+ */
+ postFadeOut: function(e){
+
+ if (!this.isHidden){
+ return;
+ }
+
+ Util.DOM.hide(this.el);
+ this.removeEventListeners();
+
+ this.dispatchEvent(Code.PhotoSwipe.ElementClass.EventTypes.onFadeOut);
+
+ },
+
+
+
+ /*
+ * Function: stopFade
+ */
+ stopFade: function(){
+
+ Util.Animation.stopFade(this.el);
+
+ },
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ },
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ }
+
+
+ });
+
+
+
+ Code.PhotoSwipe.ElementClass.EventTypes = {
+ onShow: 'onShow',
+ onHide: 'onHide',
+ onClick: 'onClick',
+ onFadeIn: 'onFadeIn',
+ onFadeOut: 'onFadeOut'
+ };
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util){
+
+
+ /*
+ * Class: Code.PhotoSwipe.FullSizeImageClass
+ */
+ Code.PhotoSwipe.FullSizeImageClass = Code.PhotoSwipe.EventClass.extend({
+
+ el: null,
+ index: null,
+
+ // The naturalWidth and naturalHeight of the image as loaded from the server
+ // This maybe different from the width and height set on the img element
+ // We need this to scale the image correctly
+ naturalWidth: null,
+ naturalHeight: null,
+ src: null,
+ caption: null,
+ metaData: null,
+ scaleMethod: null,
+ isLandscape: null,
+ isLoading: null,
+ hasLoaded: null,
+
+ loadEventHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(index, scaleMethod, src, caption, metaData){
+
+ this._super();
+
+ this.index = index;
+ this.naturalWidth = 0;
+ this.naturalHeight = 0;
+ this.src = src;
+ this.caption = caption;
+ this.metaData = Util.coalesce(metaData, {});
+ this.isLandscape = false;
+ this.isLoading = false;
+ this.hasLoaded = false;
+ this.scaleMethod = scaleMethod;
+
+ this.loadEventHandler = this.onLoad.bind(this);
+
+ },
+
+
+ /*
+ * Function: load
+ */
+ load: function(){
+
+ // Load in the image
+ this.isLoading = true;
+
+ this.el = new Image();
+ Util.DOM.addClass(this.el, 'ps-full-size-image');
+ this.el.onload = this.loadEventHandler;
+ this.el.src = this.src;
+
+ },
+
+
+ /*
+ * Function: onLoad
+ */
+ onLoad: function(){
+
+ this.naturalWidth = Util.coalesce(this.el.naturalWidth, this.el.width);
+ this.naturalHeight = Util.coalesce(this.el.naturalHeight, this.el.height);
+ this.isLandscape = (this.naturalWidth > this.naturalHeight);
+ this.isLoading = false;
+ this.hasLoaded = true;
+
+ this.dispatchEvent(Code.PhotoSwipe.FullSizeImageClass.EventTypes.onLoad);
+
+ }
+
+
+ });
+
+
+ Code.PhotoSwipe.FullSizeImageClass.EventTypes = {
+ onLoad: 'onLoad'
+ };
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util){
+
+ /*
+ * Class: Code.PhotoSwipe.DocumentOverlayClass
+ */
+ Code.PhotoSwipe.DocumentOverlayClass = Code.PhotoSwipe.ElementClass.extend({
+
+ /*
+ * Function: init
+ */
+ init: function(options){
+
+ this.settings = {
+ zIndex: 1000
+ };
+
+ Util.extend(this.settings, options);
+
+ this._super(options);
+
+ // Create element and append to body
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.DocumentOverlayClass.CssClasses.documentOverlay }, '');
+ Util.DOM.setStyle(this.el, {
+ left: 0,
+ position: 'absolute',
+ zIndex: this.settings.zIndex,
+ top: 0
+ });
+ Util.DOM.hide(this.el);
+ Util.DOM.appendToBody(this.el);
+
+ },
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ // Set the height and width to fill the document
+ Util.DOM.width(this.el, Util.DOM.bodyWidth());
+ Util.DOM.height(this.el, Util.DOM.bodyHeight());
+
+ }
+
+ });
+
+
+ Code.PhotoSwipe.DocumentOverlayClass.CssClasses = {
+ documentOverlay: 'ps-document-overlay'
+ };
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util){
+
+ /*
+ * Class: Code.PhotoSwipe.ViewportClass
+ */
+ Code.PhotoSwipe.ViewportClass = Code.PhotoSwipe.ElementClass.extend({
+
+ touchStartPoint: null,
+
+ touchStartTime: null,
+ touchStartHandler: null,
+ touchMoveHandler: null,
+ touchEndHandler: null,
+
+ gestureStartHandler: null,
+ gestureChangeHandler: null,
+ gestureEndHandler: null,
+
+ isGesture: null,
+
+ mouseDownHandler: null,
+ mouseUpHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options){
+
+ this.settings = {
+ swipeThreshold: 500,
+ swipeTimeThreshold: 250,
+ zIndex: 1000
+ };
+
+ Util.extend(this.settings, options);
+
+ this._super(this.settings);
+
+ this.touchStartPoint = { x: 0, y: 0 };
+
+ if (Util.browser.touchSupported){
+ this.touchStartHandler = this.onTouchStart.bind(this);
+ this.touchMoveHandler = this.onTouchMove.bind(this);
+ this.touchEndHandler = this.onTouchEnd.bind(this);
+ }
+
+ if (Util.browser.gestureSupported){
+ this.gestureStartHandler = this.onGestureStart.bind(this);
+ this.gestureChangeHandler = this.onGestureChange.bind(this);
+ this.gestureEndHandler = this.onGestureEnd.bind(this);
+ }
+
+ this.mouseDownHandler = this.onMouseDown.bind(this);
+ this.mouseUpHandler = this.onMouseUp.bind(this);
+
+ // Create element and append to body
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ViewportClass.CssClasses.viewport, 'data-role': 'dialog' }, '');
+ Util.DOM.setStyle(this.el, {
+ position: 'absolute',
+ left: 0,
+ zIndex: this.settings.zIndex,
+ overflow: 'hidden'
+ });
+ Util.DOM.hide(this.el);
+ Util.DOM.appendToBody(this.el);
+
+ },
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ // Set the height and width to fill the document
+ Util.DOM.setStyle(this.el, {
+ top: Util.DOM.windowScrollTop() + 'px'
+ });
+
+ Util.DOM.width(this.el, Util.DOM.bodyWidth());
+ Util.DOM.height(this.el, Util.DOM.windowHeight());
+
+ },
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ if (Util.browser.touchSupported){
+ Util.DOM.addEventListener(this.el, 'touchstart', this.touchStartHandler);
+ Util.DOM.addEventListener(this.el, 'touchmove', this.touchMoveHandler);
+ Util.DOM.addEventListener(this.el, 'touchend', this.touchEndHandler);
+ }
+
+ if (Util.browser.gestureSupported){
+ Util.DOM.addEventListener(this.el, 'gesturestart', this.gestureStartHandler);
+ Util.DOM.addEventListener(this.el, 'gesturechange', this.gestureChangeHandler);
+ Util.DOM.addEventListener(this.el, 'gestureend', this.gestureEndHandler);
+ }
+
+ Util.DOM.addEventListener(this.el, 'mousedown', this.mouseDownHandler);
+ Util.DOM.addEventListener(this.el, 'mouseup', this.mouseUpHandler);
+
+ },
+
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ if (Util.browser.touchSupported){
+ Util.DOM.removeEventListener(this.el, 'touchstart', this.touchStartHandler);
+ Util.DOM.removeEventListener(this.el, 'touchmove', this.touchMoveHandler);
+ Util.DOM.removeEventListener(this.el, 'touchend', this.touchEndHandler);
+ }
+
+ if (Util.browser.gestureSupported){
+ Util.DOM.removeEventListener(this.el, 'gesturestart', this.gestureStartHandler);
+ Util.DOM.removeEventListener(this.el, 'gesturechange', this.gestureChangeHandler);
+ Util.DOM.removeEventListener(this.el, 'gestureend', this.gestureEndHandler);
+ }
+
+ Util.DOM.removeEventListener(this.el, 'mousedown', this.mouseDownHandler);
+ Util.DOM.removeEventListener(this.el, 'mouseup', this.mouseUpHandler);
+
+ },
+
+
+
+ /*
+ * Function: getTouchPoint
+ */
+ getTouchPoint: function(touches){
+
+ return {
+ x: touches[0].pageX,
+ y: touches[0].pageY
+ };
+
+ },
+
+
+ /*
+ * Function: onGestureStart
+ */
+ onGestureStart: function(e){
+
+ e.preventDefault();
+
+ var touchEvent = Util.DOM.getTouchEvent(e);
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.gestureStart,
+ scale: touchEvent.scale,
+ rotation: touchEvent.rotation
+ });
+
+ },
+
+
+ /*
+ * Function: onGestureChange
+ */
+ onGestureChange: function(e){
+
+ e.preventDefault();
+
+ var touchEvent = Util.DOM.getTouchEvent(e);
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.gestureChange,
+ scale: touchEvent.scale,
+ rotation: touchEvent.rotation
+ });
+
+ },
+
+
+ /*
+ * Function: onGestureEnd
+ */
+ onGestureEnd: function(e){
+
+ e.preventDefault();
+
+ var touchEvent = Util.DOM.getTouchEvent(e);
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.gestureEnd,
+ scale: touchEvent.scale,
+ rotation: touchEvent.rotation
+ });
+
+ },
+
+
+ /*
+ * Function: onTouch
+ */
+ onTouchStart: function(e){
+
+ e.preventDefault();
+
+ var
+ touchEvent = Util.DOM.getTouchEvent(e),
+ touches = touchEvent.touches;
+
+ if (touches.length > 1){
+ this.isGesture = true;
+ return;
+ }
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.touchStart,
+ point: this.getTouchPoint(touches)
+ });
+
+
+ this.touchStartTime = new Date();
+ this.isGesture = false;
+ this.touchStartPoint = this.getTouchPoint(touches);
+
+ },
+
+
+
+ /*
+ * Function: onTouchMove
+ * For some reason, even though it's not a requirement,
+ * if we don't listen out for the touchmove event,
+ * we are unable to detect the swipe on Blackberry6
+ */
+ onTouchMove: function(e){
+
+ e.preventDefault();
+
+ if (this.isGesture){
+ return;
+ }
+
+ var
+ touchEvent = Util.DOM.getTouchEvent(e),
+ touches = touchEvent.touches;
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.touchMove,
+ point: this.getTouchPoint(touches)
+ });
+
+ },
+
+
+
+ /*
+ * Function: onTouchEnd
+ */
+ onTouchEnd: function(e){
+
+ e.preventDefault();
+
+ if (this.isGesture){
+ return;
+ }
+
+ // http://backtothecode.blogspot.com/2009/10/javascript-touch-and-gesture-events.html
+ // iOS removed the current touch from e.touches on "touchend"
+ // Need to look into e.changedTouches
+
+ var
+ touchEvent = Util.DOM.getTouchEvent(e),
+ touches = (!Util.isNothing(touchEvent.changedTouches)) ? touchEvent.changedTouches : touchEvent.touches,
+ touchEndPoint = this.getTouchPoint(touches);
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.touchEnd,
+ point: touchEndPoint
+ });
+
+ this.fireTouchEvent(this.touchStartPoint, touchEndPoint);
+
+ },
+
+
+
+ /*
+ * Function: onMouseDown
+ */
+ onMouseDown: function(e){
+
+ e.preventDefault();
+
+ this.touchStartTime = new Date();
+ this.isGesture = false;
+ this.touchStartPoint = Util.DOM.getMousePosition(e);
+
+ },
+
+
+
+ /*
+ * Function: onMouseUp
+ */
+ onMouseUp: function(e){
+
+ e.preventDefault();
+ this.fireTouchEvent(this.touchStartPoint, Util.DOM.getMousePosition(e));
+
+ },
+
+
+
+ /*
+ * Function: fireTouchEvent
+ */
+ fireTouchEvent: function(touchStartPoint, touchEndPoint){
+
+ var action;
+
+ var
+ endTime = new Date(),
+ diffTime = endTime - this.touchStartTime;
+
+ if (diffTime > this.settings.swipeTimeThreshold){
+ return;
+ }
+
+ var distance = touchEndPoint.x - touchStartPoint.x;
+
+ if (Math.abs(distance) >= this.settings.swipeThreshold){
+
+ if (distance < 0){
+
+ // Swipe left
+ action = Code.PhotoSwipe.ViewportClass.Actions.swipeLeft;
+
+ }
+ else{
+
+ // Swipe right
+ action = Code.PhotoSwipe.ViewportClass.Actions.swipeRight;
+
+ }
+
+ }
+ else{
+
+ // Click
+ action = Code.PhotoSwipe.ViewportClass.Actions.click;
+
+ }
+
+ if (Util.isNothing(action)){
+ return;
+ }
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: action
+ });
+
+ }
+
+ });
+
+
+ Code.PhotoSwipe.ViewportClass.CssClasses = {
+ viewport: 'ps-viewport'
+ };
+
+
+ Code.PhotoSwipe.ViewportClass.Actions = {
+ click: 'click',
+ swipeLeft: 'swipeLeft',
+ swipeRight: 'swipeRight',
+ touchStart: 'touchStart',
+ touchMove: 'touchMove',
+ touchEnd: 'touchEnd',
+ gestureStart: 'gestureStart',
+ gestureChange: 'gestureChange',
+ gestureEnd: 'gestureEnd'
+ };
+
+
+ Code.PhotoSwipe.ViewportClass.EventTypes = {
+ onTouch: 'onTouch'
+ };
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util, FullSizeImageClass){
+
+ /*
+ * Class: Code.PhotoSwipe.SliderItemClass
+ */
+ Code.PhotoSwipe.SliderItemClass = Code.PhotoSwipe.EventClass.extend({
+
+ el: null,
+ imageContainerEl: null,
+ imageEl: null,
+ parentEl: null,
+ fullSizeImage: null,
+
+ fullSizeImageLoadEventHandler: null,
+
+ savedImageWidth: null,
+ savedImageHeight: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(parentEl){
+
+ this._super();
+
+ this.parentEl = parentEl;
+
+ this.fullSizeImageLoadEventHandler = this.onFullSizeImageLoad.bind(this);
+
+ // Create element and append to parentEl
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.SliderItemClass.CssClasses.item + ' ' + Code.PhotoSwipe.SliderItemClass.CssClasses.loading }, '');
+ Util.DOM.setStyle(this.el, {
+ position: 'absolute',
+ overflow: 'hidden',
+ top: 0
+ });
+ Util.DOM.resetTranslate(this.el);
+ Util.DOM.appendChild(this.el, this.parentEl);
+
+ this.imageContainerEl = Util.DOM.createElement('div');
+ Util.DOM.setStyle(this.imageContainerEl, {
+ position: 'absolute',
+ overflow: 'hidden',
+ top: 0,
+ left: 0
+ });
+ Util.DOM.appendChild(this.imageContainerEl, this.el);
+
+ // Create image element and append to slider item
+ this.imageEl = new Image();
+ Util.DOM.setStyle(this.imageEl, {
+ display: 'block',
+ position: 'absolute',
+ margin: 0,
+ padding: 0
+ });
+ Util.DOM.hide(this.imageEl);
+ Util.DOM.appendChild(this.imageEl, this.imageContainerEl);
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(width, height, xPos){
+
+ Util.DOM.width(this.el, width);
+ Util.DOM.height(this.el, height);
+ Util.DOM.setStyle(this.el, 'left', xPos + 'px');
+
+ Util.DOM.width(this.imageContainerEl, width);
+ Util.DOM.height(this.imageContainerEl, height);
+
+ this.resetImagePosition();
+
+ },
+
+
+
+ /*
+ * Function: resetImagePosition
+ */
+ resetImagePosition: function(){
+
+ if (Util.isNothing(this.fullSizeImage)){
+ return;
+ }
+
+ var src = Util.DOM.getAttribute(this.imageEl, 'src');
+
+ var
+ scale,
+ newWidth,
+ newHeight,
+ newTop,
+ newLeft,
+ maxWidth = Util.DOM.width(this.el),
+ maxHeight = Util.DOM.height(this.el);
+
+ if (this.fullSizeImage.isLandscape) {
+ // Ensure the width fits the screen
+ scale = maxWidth / this.fullSizeImage.naturalWidth;
+ }
+ else {
+ // Ensure the height fits the screen
+ scale = maxHeight / this.fullSizeImage.naturalHeight;
+ }
+
+ newWidth = Math.round(this.fullSizeImage.naturalWidth * scale);
+ newHeight = Math.round(this.fullSizeImage.naturalHeight * scale);
+
+ if (this.fullSizeImage.scaleMethod === 'zoom'){
+
+ scale = 1;
+ if (newHeight < maxHeight){
+ scale = maxHeight /newHeight;
+ }
+ else if (newWidth < maxWidth){
+ scale = maxWidth /newWidth;
+ }
+
+ if (scale !== 1) {
+ newWidth = Math.round(newWidth * scale);
+ newHeight = Math.round(newHeight * scale);
+ }
+
+ }
+ else if (this.fullSizeImage.scaleMethod === 'fit') {
+ // Rescale again to ensure full image fits into the viewport
+ scale = 1;
+ if (newWidth > maxWidth) {
+ scale = maxWidth / newWidth;
+ }
+ else if (newHeight > maxHeight) {
+ scale = maxHeight / newHeight;
+ }
+ if (scale !== 1) {
+ newWidth = Math.round(newWidth * scale);
+ newHeight = Math.round(newHeight * scale);
+ }
+ }
+
+ newTop = ((maxHeight - newHeight) / 2) + 'px';
+ newLeft = ((maxWidth - newWidth) / 2) + 'px';
+
+ Util.DOM.width(this.imageEl, newWidth);
+ Util.DOM.height(this.imageEl, newHeight);
+ Util.DOM.setStyle(this.imageEl, {
+ top: newTop,
+ left: newLeft
+ });
+
+ Util.DOM.show(this.imageEl);
+
+ this.savedImageWidth = newWidth;
+ this.savedImageHeight = newHeight;
+ },
+
+
+
+ /*
+ * Function: setFullSizeImage
+ */
+ setFullSizeImage: function(fullSizeImage){
+
+ this.fullSizeImage = fullSizeImage;
+
+ Util.DOM.removeClass(this.el, Code.PhotoSwipe.SliderItemClass.CssClasses.loading);
+ Util.DOM.removeClass(this.el, Code.PhotoSwipe.SliderItemClass.CssClasses.imageError);
+
+ // Something is wrong!
+ if (Util.isNothing(this.fullSizeImage)) {
+ this.fullSizeImage = null;
+ Util.DOM.addClass(this.el, Code.PhotoSwipe.SliderItemClass.CssClasses.imageError);
+ this.hideImage();
+ return;
+ }
+
+ // Still loading
+ if (!this.fullSizeImage.hasLoaded) {
+
+ Util.DOM.addClass(this.el, Code.PhotoSwipe.SliderItemClass.CssClasses.loading);
+ this.hideImage();
+
+ if (!this.fullSizeImage.isLoading){
+
+ // Trigger off the load
+ this.fullSizeImage.addEventListener(
+ FullSizeImageClass.EventTypes.onLoad,
+ this.fullSizeImageLoadEventHandler
+ );
+
+
+ this.fullSizeImage.load();
+
+ }
+
+ return;
+
+ }
+
+ // Loaded so show the image
+ Util.DOM.setAttribute(this.imageEl, 'src', this.fullSizeImage.src);
+
+ this.resetImagePosition();
+
+ this.dispatchEvent(Code.PhotoSwipe.SliderItemClass.EventTypes.onFullSizeImageDisplay);
+
+ },
+
+
+ /*
+ * Function: onFullSizeImageLoad
+ */
+ onFullSizeImageLoad: function(e){
+
+ e.target.removeEventListener(FullSizeImageClass.EventTypes.onLoad, this.fullSizeImageLoadEventHandler);
+
+ if (Util.isNothing(this.fullSizeImage) || e.target.index !== this.fullSizeImage.index){
+ // Chances are the user has moved the slider
+ // and the image to display in the item has now changed
+ // from when the item originally called the fullSizeImage
+ // to load. If that's the case, rethrow the event, the
+ // slider will be listening for this and can find a
+ // relevant slideitem for the loaded image
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.SliderItemClass.EventTypes.onFullSizeImageLoadAnomaly,
+ target: this,
+ fullSizeImage: e.target
+ });
+ }
+ else{
+ this.setFullSizeImage(e.target);
+ }
+
+ },
+
+
+ /*
+ * Function: hideImage
+ */
+ hideImage: function(){
+
+ Util.DOM.removeAttribute(this.imageEl, 'src');
+ Util.DOM.hide(this.imageEl);
+
+ }
+
+
+ });
+
+
+ Code.PhotoSwipe.SliderItemClass.CssClasses = {
+ item: 'ps-slider-item',
+ loading: 'ps-slider-item-loading',
+ imageError: 'ps-slider-item-image-error'
+ };
+
+
+ Code.PhotoSwipe.SliderItemClass.EventTypes = {
+ onFullSizeImageDisplay: 'onFullSizeImageDisplay',
+ onFullSizeImageLoadAnomaly: 'onFullSizeImageLoadAnomaly'
+ };
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util,
+ Code.PhotoSwipe.FullSizeImageClass
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util, SliderItemClass){
+
+ /*
+ * Class: Code.PhotoSwipe.SliderClass
+ */
+ Code.PhotoSwipe.SliderClass = Code.PhotoSwipe.ElementClass.extend({
+
+ parentEl: null,
+ parentElWidth: null,
+ parentElHeight: null,
+ items: null,
+ scaleEl: null,
+
+ lastScaleValue: null,
+
+ previousItem: null,
+ currentItem: null,
+ nextItem: null,
+
+ hasBounced: null,
+ lastShowAction: null,
+ bounceSlideBy: null,
+
+ showNextEndEventHandler: null,
+ showPreviousEndEventHandler: null,
+ bounceStepOneEventHandler: null,
+ bounceStepTwoEventHandler: null,
+
+ sliderFullSizeImageLoadAnomalyEventHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options, parentEl){
+
+ this.settings = {
+ slideSpeed: 250
+ };
+
+ Util.extend(this.settings, options);
+
+ this._super(this.settings);
+
+ this.parentEl = parentEl;
+
+ this.hasBounced = false;
+
+ this.showNextEndEventHandler = this.onShowNextEnd.bind(this);
+ this.showPreviousEndEventHandler = this.onShowPreviousEnd.bind(this);
+ this.bounceStepOneEventHandler = this.onBounceStepOne.bind(this);
+ this.bounceStepTwoEventHandler = this.onBounceStepTwo.bind(this);
+
+ this.sliderFullSizeImageLoadAnomalyEventHandler = this.onSliderFullSizeImageLoadAnomaly.bind(this);
+
+ // Create element and append to body
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.SliderClass.CssClasses.slider }, '');
+ Util.DOM.setStyle(this.el, {
+ position: 'absolute',
+ top: 0
+ });
+ Util.DOM.hide(this.el);
+ Util.DOM.appendChild(this.el, parentEl);
+
+ // Create previousItem, currentItem, nextItem
+ this.items = [];
+ this.items.push(new SliderItemClass(this.el));
+ this.items.push(new SliderItemClass(this.el));
+ this.items.push(new SliderItemClass(this.el));
+
+ this.previousItem = this.items[0];
+ this.currentItem = this.items[1];
+ this.nextItem = this.items[2];
+
+ },
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ for (var i = 0; i');
+
+ if (this.settings.hideClose){
+ Util.DOM.hide(this.closeEl);
+ }
+ Util.DOM.appendChild(this.closeEl, this.el);
+
+ // Play
+ this.playEl = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ToolbarClass.CssClasses.play }, '
');
+ Util.DOM.appendChild(this.playEl, this.el);
+
+ // Previous
+ this.previousEl = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ToolbarClass.CssClasses.previous }, '
');
+ Util.DOM.appendChild(this.previousEl, this.el);
+
+ // Next
+ this.nextEl = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ToolbarClass.CssClasses.next }, '
');
+ Util.DOM.appendChild(this.nextEl, this.el);
+
+ },
+
+
+ /*
+ * Function: postFadeIn
+ */
+ postFadeIn: function(e){
+
+ if (this.isHidden){
+ return;
+ }
+
+ Util.DOM.setStyle(this.el, { display: 'table' });
+
+ this._super(this.settings);
+
+ },
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ if (Util.browser.touchSupported){
+ // Had an issue with touchstart, animation and Blackberry. BB will default to click
+ if (!Util.browser.isBlackberry){
+ Util.DOM.addEventListener(this.el, 'touchstart', this.touchStartHandler);
+ }
+ Util.DOM.addEventListener(this.el, 'touchmove', this.touchMoveHandler);
+ }
+
+ Util.DOM.addEventListener(this.el, 'click', this.clickHandler);
+
+ },
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ if (Util.browser.touchSupported){
+ if (!Util.browser.isBlackberry){
+ Util.DOM.removeEventListener(this.el, 'touchstart', this.touchStartHandler);
+ }
+ Util.DOM.removeEventListener(this.el, 'touchmove', this.touchMoveHandler);
+ }
+ Util.DOM.removeEventListener(this.el, 'click', this.clickHandler);
+
+ },
+
+
+ /*
+ * Function: onTouchStart
+ */
+ onTouchStart: function(e){
+
+ e.preventDefault();
+
+ this.touched = true;
+ this.handleClick(e);
+
+ },
+
+
+ /*
+ * Function: onTouchMove
+ */
+ onTouchMove: function(e){
+
+ e.preventDefault();
+
+ },
+
+
+ /*
+ * Function: onClick
+ */
+ onClick: function(e){
+
+ if (this.touched){
+ return;
+ }
+
+ this.handleClick(e);
+
+ },
+
+
+
+ /*
+ * Function: handleClick
+ */
+ handleClick: function(e){
+
+ var action;
+
+ switch(e.target.parentNode){
+
+ case this.previousEl:
+ if (this.isPreviousActive){
+ action = Code.PhotoSwipe.ToolbarClass.Actions.previous;
+ }
+ break;
+
+ case this.nextEl:
+ if (this.isNextActive){
+ action = Code.PhotoSwipe.ToolbarClass.Actions.next;
+ }
+ break;
+
+ case this.playEl:
+ action = Code.PhotoSwipe.ToolbarClass.Actions.play;
+ break;
+
+ case this.closeEl:
+ action = Code.PhotoSwipe.ToolbarClass.Actions.close;
+ break;
+ }
+
+ if (Util.isNothing(action)){
+ return;
+ }
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ToolbarClass.EventTypes.onClick,
+ target: this,
+ action: action
+ });
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ var top;
+
+ if (this.settings.position === 'bottom') {
+ top = Util.DOM.windowHeight() - Util.DOM.outerHeight(this.el) + Util.DOM.windowScrollTop();
+ }
+ else {
+ top = Util.DOM.windowScrollTop();
+ }
+
+ Util.DOM.setStyle(this.el, 'top', top + 'px');
+ Util.DOM.width(this.el, Util.DOM.bodyWidth());
+
+ },
+
+
+
+ /*
+ * Function: setNextState
+ */
+ setNextState: function (disable) {
+
+ if (disable) {
+ Util.DOM.addClass(this.nextEl, Code.PhotoSwipe.ToolbarClass.CssClasses.nextDisabled);
+ this.isNextActive = false;
+ }
+ else {
+ Util.DOM.removeClass(this.nextEl, Code.PhotoSwipe.ToolbarClass.CssClasses.nextDisabled);
+ this.isNextActive = true;
+ }
+
+ },
+
+
+ /*
+ * Function: setPreviousState
+ */
+ setPreviousState: function (disable) {
+
+ if (disable) {
+ Util.DOM.addClass(this.previousEl, Code.PhotoSwipe.ToolbarClass.CssClasses.previousDisabled);
+ this.isPreviousActive = false;
+ }
+ else {
+ Util.DOM.removeClass(this.previousEl, Code.PhotoSwipe.ToolbarClass.CssClasses.previousDisabled);
+ this.isPreviousActive = true;
+ }
+
+ }
+
+ });
+
+
+
+ Code.PhotoSwipe.ToolbarClass.CssClasses = {
+ caption: 'ps-toolbar',
+ top: 'ps-toolbar-top',
+ close: 'ps-toolbar-close',
+ previous: 'ps-toolbar-previous',
+ previousDisabled: 'ps-toolbar-previous-disabled',
+ next: 'ps-toolbar-next',
+ nextDisabled: 'ps-toolbar-next-disabled',
+ play: 'ps-toolbar-play',
+ content: 'ps-toolbar-content'
+ };
+
+
+
+ Code.PhotoSwipe.ToolbarClass.Actions = {
+ close: 'close',
+ previous: 'previous',
+ next: 'next',
+ play: 'play'
+ };
+
+
+ Code.PhotoSwipe.ToolbarClass.EventTypes = {
+ onClick: 'onClick'
+ };
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+ // PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util, CaptionClass, ToolbarClass){
+
+ /*
+ * Class: Code.PhotoSwipe.CaptionToolbarClass
+ */
+ Code.PhotoSwipe.CaptionToolbarClass = Code.PhotoSwipe.EventClass.extend({
+
+ toolbar: null,
+ caption: null,
+
+ isHidden: null,
+
+ hasAddedEventListeners: null,
+
+ toolbarClickEventHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options){
+
+ this._super();
+
+ this.settings = {
+ opacity: 0.8,
+ fadeInSpeed: 250,
+ fadeOutSpeed: 500,
+ autoHideDelay: 5000,
+ flipPosition: false,
+ showEmptyCaptions: true,
+ hideClose: false,
+ zIndex: 1000
+ };
+
+ Util.extend(this.settings, options);
+
+ this.isHidden = true;
+ this.hasAddedEventListeners = false;
+
+ this.toolbarClickEventHandler = this.onToolbarClick.bind(this);
+
+ this.caption = new CaptionClass({
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ opacity: this.settings.opacity,
+ position: (this.settings.flipPosition) ? 'bottom' : 'top',
+ zIndex: this.settings.zIndex
+ });
+
+
+ this.toolbar = new ToolbarClass({
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ opacity: this.settings.opacity,
+ position: (this.settings.flipPosition) ? 'top' : 'bottom',
+ hideClose: this.settings.hideClose,
+ zIndex: this.settings.zIndex+1
+ });
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ this.caption.resetPosition();
+ this.toolbar.resetPosition();
+
+ },
+
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ if (this.hasAddedEventListeners){
+ return;
+ }
+
+ this.toolbar.addEventListener(ToolbarClass.EventTypes.onClick, this.toolbarClickEventHandler);
+
+ this.hasAddedEventListeners = true;
+
+ },
+
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ this.toolbar.removeEventListener(ToolbarClass.EventTypes.onClick, this.toolbarClickEventHandler);
+ this.hasAddedEventListeners = false;
+
+ },
+
+
+
+ /*
+ * Function: fadeIn
+ */
+ fadeIn: function(){
+
+ this.stopAutoHideTimeout();
+ this.stopFade();
+
+ if (this.isHidden){
+
+ this.isHidden = false;
+
+ // Already hidden so fade in
+ this.fadeInCaption();
+
+ this.toolbar.fadeIn();
+
+ window.setTimeout(
+ this.onFadeIn.bind(this),
+ this.settings.fadeInSpeed
+ );
+
+ }
+ else{
+
+ // Not hidden, just check caption is visible
+ if (this.caption.isHidden){
+ this.fadeInCaption();
+ }
+
+ // Reset the autoHideTimeout
+ this.resetAutoHideTimeout();
+
+ }
+
+ },
+
+
+
+ showCaption: function(){
+
+ if (this.caption.captionValue === ''){
+
+ // Caption is empty
+ if (this.settings.showEmptyCaptions){
+ this.caption.show();
+ }
+
+ }
+ else{
+ this.caption.show();
+ }
+
+ },
+
+
+
+ /*
+ * Function: fadeInCaption
+ */
+ fadeInCaption: function(){
+
+ if (this.caption.captionValue === ''){
+ // Caption is empty
+ if (this.settings.showEmptyCaptions){
+ this.caption.fadeIn();
+ }
+ }
+ else{
+ this.caption.fadeIn();
+ }
+
+ },
+
+
+
+ /*
+ * Function: onFadeIn
+ */
+ onFadeIn: function(){
+
+ this.addEventListeners();
+ this.resetAutoHideTimeout();
+
+ },
+
+
+
+ /*
+ * Function: fadeOut
+ */
+ fadeOut: function(){
+
+ this.stopAutoHideTimeout();
+ this.stopFade();
+
+ this.isHidden = true;
+
+ this.caption.fadeOut();
+ this.toolbar.fadeOut();
+
+ window.setTimeout(
+ this.onFadeOut.bind(this),
+ this.settings.fadeOutSpeed
+ );
+
+ },
+
+
+ /*
+ * Function: onFadeOut
+ */
+ onFadeOut: function(){
+ },
+
+
+
+ /*
+ * Function: stopFade
+ */
+ stopFade: function(){
+
+ this.caption.stopFade();
+ this.toolbar.stopFade();
+
+ },
+
+
+ /*
+ * Function: hide
+ */
+ hide: function(){
+
+ this.stopAutoHideTimeout();
+ this.stopFade();
+
+ this.isHidden = true;
+ this.removeEventListeners();
+
+ this.caption.hide();
+ this.toolbar.hide();
+
+ },
+
+
+
+ /*
+ * Function: setCaptionValue
+ */
+ setCaptionValue: function(captionValue){
+
+ this.caption.setCaptionValue(captionValue);
+
+ if (this.caption.captionValue === '' && !this.settings.showEmptyCaptions){
+ // The caption is empty and we don't want to show empty caption
+ this.caption.fadeOut();
+ }
+
+
+ },
+
+
+
+ /*
+ * Function: resetAutoHideTimeout
+ */
+ resetAutoHideTimeout: function(){
+
+ if (this.isHidden){
+ return;
+ }
+
+ this.stopAutoHideTimeout();
+
+ if (this.settings.autoHideDelay > 0){
+
+ this.autoHideTimeout = window.setTimeout(
+ this.fadeOut.bind(this),
+ this.settings.autoHideDelay
+ );
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: stopAutoHideTimeout
+ */
+ stopAutoHideTimeout: function(){
+
+ if (!Util.isNothing(this.autoHideTimeout)){
+ window.clearTimeout(this.autoHideTimeout);
+ }
+
+ },
+
+
+
+ /*
+ * Function: onToolbarClick
+ */
+ onToolbarClick: function(e){
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ToolbarClass.EventTypes.onClick,
+ target: this,
+ action: e.action
+ });
+
+ },
+
+
+
+ /*
+ * Function: setNextState
+ */
+ setNextState: function (disable) {
+
+ this.toolbar.setNextState(disable);
+
+ },
+
+
+
+ /*
+ * Function: setPreviousState
+ */
+ setPreviousState: function (disable) {
+
+ this.toolbar.setPreviousState(disable);
+
+ }
+
+
+ });
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util,
+ Code.PhotoSwipe.CaptionClass,
+ Code.PhotoSwipe.ToolbarClass
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util){
+
+ /*
+ * Class: Code.PhotoSwipe.ZoomPanRotateClass
+ */
+ Code.PhotoSwipe.ZoomPanRotateClass = Code.PhotoSwipe.ElementClass.extend({
+
+ containerEl: null,
+ imageEl: null,
+ parentEl: null,
+ transformSettings: null,
+ panStartingPoint: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options, parentEl, imageEl){
+
+ this.settings = {
+ maxZoom: 5.0,
+ minZoom: 0.5,
+ adjustPanToZoom: true
+ };
+
+ Util.extend(this.settings, options);
+
+ this._super(options);
+
+ this.parentEl = parentEl;
+ this.imageEl = imageEl.cloneNode(false);
+
+ this.transformSettings = {
+
+ startingScale: 1.0,
+ scale: 1.0,
+ startingRotation: 0,
+ rotation: 0,
+ startingTranslateX: 0,
+ startingTranslateY: 0,
+ translateX: 0,
+ translateY: 0
+
+ };
+
+ // Create element and append to body
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ZoomPanRotateClass.CssClasses.documentOverlay }, '');
+ Util.DOM.setStyle(this.el, {
+ left: 0,
+ top: 0,
+ position: 'absolute'
+ });
+ Util.DOM.width(this.el, Util.DOM.bodyWidth());
+ Util.DOM.height(this.el, Util.DOM.windowHeight());
+
+ this.containerEl = Util.DOM.createElement('div');
+ Util.DOM.setStyle(this.containerEl, {
+ left: 0,
+ top: 0,
+ position: 'absolute'
+ });
+ Util.DOM.width(this.containerEl, Util.DOM.bodyWidth());
+ Util.DOM.height(this.containerEl, Util.DOM.windowHeight());
+
+ Util.DOM.appendChild(this.imageEl, this.containerEl);
+ Util.DOM.appendChild(this.containerEl, this.el);
+ Util.DOM.appendChild(this.el, this.parentEl);
+
+ },
+
+
+ /*
+ * Function: setStartingTranslateFromCurrentTranform
+ */
+ setStartingTranslateFromCurrentTranform: function(){
+
+ var transformExploded = this.containerEl.style.webkitTransform.match( /translate\((.*?)\)/ );
+
+ if (!Util.isNothing(transformExploded)){
+
+ transformExploded = transformExploded[1].split(', ');
+ this.transformSettings.startingTranslateX = window.parseInt(transformExploded[0]);
+ this.transformSettings.startingTranslateY = window.parseInt(transformExploded[1]);
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: setStartingScaleAndRotation
+ */
+ setStartingScaleAndRotation: function(scaleValue, rotationValue){
+
+ var scale = this.transformSettings.startingScale * scaleValue;
+
+ if (this.settings.minZoom !== 0 && scale < this.settings.minZoom){
+ scale = this.settings.minZoom;
+ }
+ else if (this.settings.maxZoom !== 0 && scale > this.settings.maxZoom){
+ scale = this.settings.maxZoom;
+ }
+
+ this.transformSettings.startingScale = scale;
+
+ this.transformSettings.startingRotation =
+ (this.transformSettings.startingRotation + rotationValue) % 360;
+
+ },
+
+
+
+ /*
+ * Function: zoomRotate
+ */
+ zoomRotate: function(scaleValue, rotationValue){
+
+ var scale = this.transformSettings.startingScale * scaleValue;
+
+ if (this.settings.minZoom !== 0 && scale < this.settings.minZoom){
+ scale = this.settings.minZoom;
+ }
+ else if (this.settings.maxZoom !== 0 && scale > this.settings.maxZoom){
+ scale = this.settings.maxZoom;
+ }
+
+ this.transformSettings.scale = scale;
+
+ this.transformSettings.rotation =
+ this.transformSettings.startingRotation + rotationValue;
+
+ this.applyTransform();
+
+ },
+
+
+
+ /*
+ * Function: panStart
+ */
+ panStart: function(point){
+
+ this.setStartingTranslateFromCurrentTranform();
+
+ this.panStartingPoint = {
+ x: point.x,
+ y: point.y
+ };
+
+ },
+
+
+
+ /*
+ * Function: pan
+ */
+ pan: function(point){
+
+ var
+ dx = point.x - this.panStartingPoint.x,
+ dy = point.y - this.panStartingPoint.y,
+ dxScaleAdjust = (this.settings.adjustPanToZoom) ? dx / this.transformSettings.scale : dx,
+ dyScaleAdjust = dy / this.transformSettings.scale ? dy / this.transformSettings.scale : dy ;
+
+
+ this.transformSettings.translateX =
+ this.transformSettings.startingTranslateX + dxScaleAdjust;
+
+ this.transformSettings.translateY =
+ this.transformSettings.startingTranslateY + dyScaleAdjust;
+
+ this.applyTransform();
+
+ },
+
+
+
+ /*
+ * Function: applyTransform
+ */
+ applyTransform: function(){
+
+ this.containerEl.style.webkitTransform = 'scale(' + this.transformSettings.scale + ') rotate(' + (this.transformSettings.rotation % 360) + 'deg) translate(' + this.transformSettings.translateX + 'px, ' + this.transformSettings.translateY + 'px)';
+
+ },
+
+
+
+ /*
+ * Function: removeFromDOM
+ */
+ removeFromDOM: function(){
+
+ Util.DOM.removeChild(this.el, this.parentEl);
+
+ }
+
+ });
+
+
+ Code.PhotoSwipe.ZoomPanRotateClass.CssClasses = {
+ documentOverlay: 'ps-zoom-pan-rotate'
+ };
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util, ElementClass, DocumentOverlayClass, FullSizeImageClass, ViewportClass, SliderClass, CaptionClass, ToolbarClass, CaptionToolbarClass, ZoomPanRotateClass){
+
+ var photoSwipe = Code.PhotoSwipe.EventClass.extend({
+
+ fullSizeImages: null,
+
+ documentOverlay: null,
+ viewport: null,
+ slider: null,
+ captionAndToolbar: null,
+ zoomPanRotate: null,
+
+ settings: null,
+ currentIndex: null,
+ isBusy: null,
+ isActive: null,
+ currentHistoryHashValue: null,
+ isBackEventSupported: null,
+
+ slideshowTimeout: null,
+ isSlideshowActive: null,
+
+ lastShowPrevTrigger: null,
+
+ backButtonClicked: null,
+
+ viewportFadeInEventHandler: null,
+ windowOrientationChangeEventHandler: null,
+ windowScrollEventHandler: null,
+ windowHashChangeHandler: null,
+ keyDownEventHandler: null,
+ viewportTouchEventHandler: null,
+ viewportFadeOutEventHandler: null,
+ sliderDisplayCurrentFullSizeImageEventHandler: null,
+ toolbarClickEventHandler: null,
+ orientationEventName: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(){
+
+ this._super();
+
+ this.currentIndex = 0;
+ this.isBusy = false;
+ this.isActive = false;
+ this.isSlideshowActive = false;
+ this.backButtonClicked = false;
+
+ this.settings = {
+ getImageSource: Code.PhotoSwipe.GetImageSource,
+ getImageCaption: Code.PhotoSwipe.GetImageCaption,
+ getImageMetaData: Code.PhotoSwipe.GetImageMetaData,
+ fadeInSpeed: 250,
+ fadeOutSpeed: 500,
+ slideSpeed: 250,
+ swipeThreshold: 50,
+ swipeTimeThreshold: 250,
+ loop: true,
+ slideshowDelay: 3000,
+ imageScaleMethod: 'fit', // Either "fit" or "zoom"
+ preventHide: false,
+ zIndex: 1000,
+ backButtonHideEnabled: true,
+ jQueryMobile: ( !Util.isNothing(window.jQuery) && !Util.isNothing(window.jQuery.mobile) ),
+ jQueryMobileDialogHash: '&ui-state=dialog',
+
+ /* Experimental - iOS only at the moment */
+ allowUserZoom: true,
+ allowRotationOnUserZoom: true,
+ maxUserZoom: 5.0,
+ minUserZoom: 0.5,
+ adjustUserPanToZoom: true,
+
+ captionAndToolbarHide: false,
+ captionAndToolbarHideOnSwipe: true,
+ captionAndToolbarFlipPosition: false,
+ captionAndToolbarAutoHideDelay: 5000,
+ captionAndToolbarOpacity: 0.8,
+ captionAndToolbarShowEmptyCaptions: true
+ };
+
+ if (Util.browser.isAndroid){
+ if (navigator.userAgent.indexOf('2.1')){
+ this.isBackEventSupported = true;
+ }
+ }
+ if (!this.isBackEventSupported){
+ this.isBackEventSupported = 'onhashchange' in window;
+ }
+
+ if (this.settings.preventHide){
+ this.settings.backButtonHideEnabled = false;
+ }
+
+
+ // Set pointers to event handlers
+ this.viewportFadeInEventHandler = this.onViewportFadeIn.bind(this);
+ this.windowOrientationChangeEventHandler = this.onWindowOrientationChange.bind(this);
+ this.windowScrollEventHandler = this.onWindowScroll.bind(this);
+ this.windowHashChangeHandler = this.onWindowHashChange.bind(this);
+ this.keyDownEventHandler = this.onKeyDown.bind(this);
+ this.viewportTouchEventHandler = this.onViewportTouch.bind(this);
+ this.viewportFadeOutEventHandler = this.onViewportFadeOut.bind(this);
+ this.sliderDisplayCurrentFullSizeImageEventHandler = this.onSliderDisplayCurrentFullSizeImage.bind(this);
+ this.toolbarClickEventHandler = this.onToolbarClick.bind(this);
+
+ },
+
+
+
+ /*
+ * Function: setOptions
+ */
+ setOptions: function(options){
+
+ Util.extend(this.settings, options);
+
+ if (this.settings.preventHide){
+ this.settings.backButtonHideEnabled = false;
+ }
+
+ },
+
+
+
+ /*
+ * Function: setImages
+ * Set images from DOM elements. Could be a list of image
+ * elments or anchors containing image elements etc.
+ * By default the gallery assumes the latter. If you change
+ * this, remember to set your own getImageSource and getImageCaption
+ * methods so the gallery knows what to look for.
+ */
+ setImages: function(thumbEls){
+
+ if (!Util.isArray){
+ throw "thumbEls is not an array";
+ }
+
+ this.currentIndex = 0;
+
+ this.fullSizeImages = [];
+
+ for (var i=0; i= this.fullSizeImages.length){
+ startingIndex = 0;
+ }
+
+ this.currentIndex = startingIndex;
+
+ if (Util.isNothing(this.documentOverlay)){
+ this.build();
+ }
+ else{
+ this.resetPosition();
+ }
+
+ // Fade in the viewport overlay,
+ // then show the viewport, slider and toolbar etc
+ this.viewport.addEventListener(
+ ElementClass.EventTypes.onFadeIn,
+ this.viewportFadeInEventHandler
+ );
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeShow);
+
+ this.viewport.fadeIn();
+
+ },
+
+
+
+ /*
+ * Function: build
+ */
+ build: function(){
+
+ // Create the document overlay
+ this.documentOverlay = new DocumentOverlayClass({
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ zIndex: this.settings.zIndex
+ });
+
+ // Create the viewport
+ this.viewport = new ViewportClass({
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ swipeThreshold: this.settings.swipeThreshold,
+ swipeTimeThreshold: this.settings.swipeTimeThreshold,
+ zIndex: this.settings.zIndex+1
+ });
+
+ // Create the slider
+ this.slider = new SliderClass(
+ {
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ slideSpeed: this.settings.slideSpeed
+ },
+ this.viewport.el
+ );
+
+ this.captionAndToolbar = new CaptionToolbarClass({
+
+ opacity: this.settings.captionAndToolbarOpacity,
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ autoHideDelay: this.settings.captionAndToolbarAutoHideDelay,
+ flipPosition: this.settings.captionAndToolbarFlipPosition,
+ showEmptyCaptions: this.settings.captionAndToolbarShowEmptyCaptions,
+ hideClose: this.settings.preventHide,
+ zIndex: this.settings.zIndex+3
+
+ });
+
+ this.resetPosition();
+
+ },
+
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ // Set window handlers
+ if (Util.browser.isAndroid){
+ // For some reason, resize was more stable than orientationchange in Android
+ // This fix was added in v1.0.5 - needs reviewing
+ this.orientationEventName = 'resize';
+ }
+ else{
+ var supportsOrientationChange = 'onorientationchange' in window;
+ this.orientationEventName = supportsOrientationChange ? 'orientationchange' : 'resize';
+ }
+
+ Util.DOM.addEventListener(window, this.orientationEventName, this.windowOrientationChangeEventHandler);
+
+ Util.DOM.addEventListener(window, 'scroll', this.windowScrollEventHandler);
+
+ if (this.isBackEventSupported && this.settings.backButtonHideEnabled){
+
+ if (this.settings.jQueryMobile){
+ window.location.hash = this.settings.jQueryMobileDialogHash;
+ }
+ else{
+ this.currentHistoryHashValue = 'PhotoSwipe' + new Date().getTime().toString();
+ window.location.hash = this.currentHistoryHashValue;
+ }
+
+ Util.DOM.addEventListener(window, 'hashchange', this.windowHashChangeHandler);
+
+ }
+
+ // Set keydown event handlers for desktop browsers
+ Util.DOM.addEventListener(document, 'keydown', this.keyDownEventHandler);
+
+ // Set viewport handlers
+ this.viewport.addEventListener(ViewportClass.EventTypes.onTouch, this.viewportTouchEventHandler);
+
+ // Set slider handlers
+ this.slider.addEventListener(SliderClass.EventTypes.onDisplayCurrentFullSizeImage, this.sliderDisplayCurrentFullSizeImageEventHandler);
+
+ // Set captionAndToolbar handlers
+ this.captionAndToolbar.addEventListener(ToolbarClass.EventTypes.onClick, this.toolbarClickEventHandler);
+
+ },
+
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ // Remove window handlers
+ Util.DOM.removeEventListener(window, this.orientationEventName, this.windowOrientationChangeEventHandler);
+
+ Util.DOM.removeEventListener(window, 'scroll', this.windowScrollEventHandler);
+
+ if (this.isBackEventSupported && this.settings.backButtonHideEnabled){
+ Util.DOM.removeEventListener(window, 'hashchange', this.windowHashChangeHandler);
+ }
+
+ // Remove keydown event handlers for desktop browsers
+ Util.DOM.removeEventListener(document, 'keydown', this.keyDownEventHandler);
+
+ // Remove viewport handlers
+ this.viewport.removeEventListener(ViewportClass.EventTypes.onTouch, this.viewportTouchEventHandler);
+
+ // Remove slider handlers
+ this.slider.removeEventListener(SliderClass.EventTypes.onDisplayCurrentFullSizeImage, this.sliderDisplayCurrentFullSizeImageEventHandler);
+
+ // Remove captionAndToolbar handlers
+ this.captionAndToolbar.removeEventListener(ToolbarClass.EventTypes.onClick, this.toolbarClickEventHandler);
+
+ },
+
+
+
+ /*
+ * Function: onViewportFadeIn
+ */
+ onViewportFadeIn: function(e){
+
+ // Remove the ElementClass.EventTypes.onFadeIn
+ // event handler
+ this.viewport.removeEventListener(
+ ElementClass.EventTypes.onFadeIn,
+ this.viewportFadeInEventHandler
+ );
+
+ this.documentOverlay.show();
+
+ this.slider.fadeIn();
+
+ this.addEventListeners();
+
+ this.slider.setCurrentFullSizeImage(this.fullSizeImages[this.currentIndex]);
+
+ this.isBusy = false;
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShow);
+
+ },
+
+
+
+ /*
+ * Function: setSliderPreviousAndNextFullSizeImages
+ */
+ setSliderPreviousAndNextFullSizeImages: function(){
+
+ var
+ lastIndex,
+ previousFullSizeImage = null,
+ nextFullSizeImage = null;
+
+ if (this.fullSizeImages.length > 1) {
+
+ lastIndex = this.fullSizeImages.length - 1;
+
+ // Current image is the last
+ if (this.currentIndex === lastIndex) {
+
+ if (this.settings.loop) {
+ nextFullSizeImage = this.fullSizeImages[0];
+ }
+ previousFullSizeImage = this.fullSizeImages[this.currentIndex - 1];
+
+ }
+
+ // Current image is the first
+ else if (this.currentIndex === 0) {
+
+ nextFullSizeImage = this.fullSizeImages[this.currentIndex + 1];
+ if (this.settings.loop) {
+ previousFullSizeImage = this.fullSizeImages[lastIndex];
+ }
+
+ }
+
+ // Current image is in the middle of the thumbs
+ else {
+
+ nextFullSizeImage = this.fullSizeImages[this.currentIndex + 1];
+ previousFullSizeImage = this.fullSizeImages[this.currentIndex - 1];
+
+ }
+
+ }
+
+ this.slider.setPreviousAndNextFullSizeImages(previousFullSizeImage, nextFullSizeImage);
+
+ },
+
+
+
+ /*
+ * Function: onKeyDown
+ */
+ onKeyDown: function(e){
+
+ this.stopSlideshow();
+
+ if (e.keyCode === 37) { // Left
+ e.preventDefault();
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.keyboard;
+ this.showPrevious();
+ }
+ else if (e.keyCode === 39) { // Right
+ e.preventDefault();
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.keyboard;
+ this.showNext();
+ }
+ else if (e.keyCode === 38 || e.keyCode === 40) { // Up and down
+ e.preventDefault();
+ }
+ else if (e.keyCode === 27) { // Escape
+ e.preventDefault();
+ this.hide();
+ }
+ else if (e.keyCode === 32) { // Spacebar
+ if (!this.settings.hideToolbar){
+ this.toggleCaptionAndToolbar();
+ }
+ else{
+ this.hide();
+ }
+ e.preventDefault();
+ }
+
+ },
+
+
+
+ /*
+ * Function: onWindowOrientationChange
+ */
+ onWindowOrientationChange: function(e){
+
+ this.resetPosition();
+
+ },
+
+
+
+ /*
+ * Function: onWindowScroll
+ */
+ onWindowScroll: function(e){
+
+ this.resetPosition();
+
+ },
+
+
+ /*
+ * Function: onWindowHashChange
+ */
+ onWindowHashChange: function(e){
+
+ var compareHash = '#' +
+ ((this.settings.jQueryMobile) ? this.settings.jQueryMobileDialogHash : this.currentHistoryHashValue);
+
+ if (window.location.hash !== compareHash){
+ this.backButtonClicked = true;
+ this.hide();
+ }
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ this.removeZoomPanRotate();
+
+ this.viewport.resetPosition();
+ this.slider.resetPosition();
+ this.documentOverlay.resetPosition();
+ this.captionAndToolbar.resetPosition();
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onResetPosition);
+
+ },
+
+
+
+ /*
+ * Function: canUserZoom
+ */
+ canUserZoom: function(){
+
+ if (!this.settings.allowUserZoom){
+ return false;
+ }
+
+ if (this.isBusy){
+ return false;
+ }
+
+ if (Util.isNothing(this.slider.currentItem.fullSizeImage)){
+ return false;
+ }
+
+ if (!this.slider.currentItem.fullSizeImage.hasLoaded){
+ return false;
+ }
+
+ return true;
+
+ },
+
+
+
+ /*
+ * Function: isZoomActive
+ */
+ isZoomActive: function(){
+
+ return (!Util.isNothing(this.zoomPanRotate));
+
+ },
+
+
+
+ /*
+ * Function: onViewportTouch
+ */
+ onViewportTouch: function(e){
+
+ switch(e.action){
+
+ case ViewportClass.Actions.gestureStart:
+
+ if (this.canUserZoom()){
+ this.stopSlideshow();
+ if (!this.isZoomActive()){
+ this.zoomPanRotate = new ZoomPanRotateClass(
+ {
+ maxZoom: this.settings.maxUserZoom,
+ minZoom: this.settings.minUserZoom,
+ adjustPanToZoom: this.settings.adjustUserPanToZoom
+ },
+ this.viewport.el,
+ this.slider.currentItem.imageEl
+ );
+ Util.DOM.resetTranslate(this.zoomPanRotate.containerEl);
+ Util.DOM.resetTranslate(this.zoomPanRotate.imageEl);
+ }
+ this.fadeOutCaptionAndToolbar();
+ }
+ break;
+
+ case ViewportClass.Actions.gestureChange:
+
+ if (this.isZoomActive()){
+ this.zoomPanRotate.zoomRotate(e.scale, (this.settings.allowRotationOnUserZoom) ? e.rotation : 0);
+ }
+ break;
+
+ case ViewportClass.Actions.gestureEnd:
+
+ if (this.isZoomActive()){
+ this.zoomPanRotate.setStartingScaleAndRotation(e.scale, (this.settings.allowRotationOnUserZoom) ? e.rotation : 0);
+ }
+ break;
+
+ case ViewportClass.Actions.touchStart:
+
+ this.stopSlideshow();
+ if (this.isZoomActive()){
+ this.zoomPanRotate.panStart(e.point);
+ }
+ break;
+
+ case ViewportClass.Actions.touchMove:
+
+ if (this.isZoomActive()){
+ this.zoomPanRotate.pan(e.point);
+ }
+ break;
+
+ case ViewportClass.Actions.click:
+
+ this.stopSlideshow();
+ if (!this.settings.hideToolbar){
+ this.toggleCaptionAndToolbar();
+ }
+ else{
+ this.hide();
+ }
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onViewportClick);
+ break;
+
+ case ViewportClass.Actions.swipeLeft:
+
+ this.stopSlideshow();
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.swipe;
+ this.showNext();
+ break;
+
+ case ViewportClass.Actions.swipeRight:
+
+ this.stopSlideshow();
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.swipe;
+ this.showPrevious();
+ break;
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: onViewportFadeOut
+ */
+ onViewportFadeOut: function(e){
+
+ this.viewport.removeEventListener(ElementClass.EventTypes.onFadeOut, this.viewportFadeOutEventHandler);
+
+ this.isBusy = false;
+ this.isActive = false;
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onHide);
+
+ this.goBackInHistory();
+
+ },
+
+
+
+ /*
+ * Function: hide
+ */
+ hide: function(){
+
+ if (this.isBusy || this.settings.preventHide){
+ return;
+ }
+
+ if (!this.isActive){
+ return;
+ }
+
+ this.isBusy = true;
+
+ this.removeZoomPanRotate();
+
+ this.removeEventListeners();
+
+ this.documentOverlay.hide();
+ this.captionAndToolbar.hide();
+ this.slider.hide();
+
+ Util.DOM.removeClass(document.body, Code.PhotoSwipe.CssClasses.activeBody);
+
+ this.viewport.addEventListener(ElementClass.EventTypes.onFadeOut, this.viewportFadeOutEventHandler);
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeHide);
+
+ this.viewport.fadeOut();
+
+ },
+
+
+ /*
+ * Function: hideImmediately
+ */
+ hideImmediately: function(){
+
+ if (!this.isActive){
+ return;
+ }
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeHide);
+
+ this.removeZoomPanRotate();
+ this.removeEventListeners();
+ this.documentOverlay.hide();
+ this.captionAndToolbar.hide();
+ this.slider.hide();
+ this.viewport.hide();
+
+ Util.DOM.removeClass(document.body, Code.PhotoSwipe.CssClasses.activeBody);
+
+ this.isBusy = false;
+ this.isActive = false;
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onHide);
+
+ this.goBackInHistory();
+ },
+
+
+ /*
+ * Function: goBackInHistory
+ */
+ goBackInHistory: function(){
+
+ if (this.isBackEventSupported && this.settings.backButtonHideEnabled){
+ if ( !this.backButtonClicked ){
+ window.history.back();
+ }
+ }
+
+ },
+
+
+ /*
+ * Function: showNext
+ */
+ showNext: function(){
+
+ if (this.isBusy){
+ return;
+ }
+
+ this.isBusy = true;
+
+ this.cleanUpZoomPanRotateForNextPrevious();
+
+ this.setCaptionAndToolbarOnShowPreviousNext();
+
+ this.slider.showNext();
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShowNext);
+
+ },
+
+
+
+ /*
+ * Function: showPrevious
+ */
+ showPrevious: function(){
+
+ if (this.isBusy){
+ return;
+ }
+
+ this.isBusy = true;
+
+ this.cleanUpZoomPanRotateForNextPrevious();
+
+ this.setCaptionAndToolbarOnShowPreviousNext();
+
+ if (this.wasUserZoomActive){
+ Util.DOM.hide(this.slider.currentItem.imageEl);
+ }
+
+ this.slider.showPrevious();
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShowPrevious);
+
+ },
+
+
+
+ /*
+ * Function: cleanUpZoomPanRotateForNextPrevious
+ */
+ cleanUpZoomPanRotateForNextPrevious: function(){
+
+ if (!Util.isNothing(this.zoomPanRotate)){
+ if (this.settings.loop){
+ Util.DOM.hide(this.slider.currentItem.imageEl);
+ }
+ else{
+ if (this.currentIndex > 0 && this.currentIndex < this.fullSizeImages.length - 2){
+ Util.DOM.hide(this.slider.currentItem.imageEl);
+ }
+ }
+ }
+
+ this.removeZoomPanRotate();
+
+ },
+
+
+
+ /*
+ * Function: setCaptionAndToolbarOnShowPreviousNext
+ */
+ setCaptionAndToolbarOnShowPreviousNext: function(){
+
+ if (this.settings.captionAndToolbarHide){
+ return;
+ }
+
+ var resetAutoTimeout = false;
+
+ switch (this.lastShowPrevTrigger){
+
+ case Code.PhotoSwipe.ShowPrevTriggers.toolbar:
+ resetAutoTimeout = true;
+ break;
+
+ case Code.PhotoSwipe.ShowPrevTriggers.slideshow:
+ resetAutoTimeout = false;
+ break;
+
+ default:
+ resetAutoTimeout = !this.settings.captionAndToolbarHideOnSwipe;
+ break;
+ }
+
+
+ if (resetAutoTimeout) {
+
+ // Reset the caption and toolbar's fadeOut timeout
+ this.captionAndToolbar.resetAutoHideTimeout();
+
+ }
+ else{
+
+ this.fadeOutCaptionAndToolbar();
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: onSliderDisplayCurrentFullSizeImage
+ */
+ onSliderDisplayCurrentFullSizeImage: function(e){
+
+ this.currentIndex = e.fullSizeImage.index;
+
+
+ // Set caption and toolbar
+ if (!this.settings.captionAndToolbarHide){
+
+ if (this.settings.loop) {
+ this.captionAndToolbar.setNextState(false);
+ this.captionAndToolbar.setPreviousState(false);
+ }
+ else{
+ if (this.currentIndex >= this.fullSizeImages.length - 1) {
+ this.captionAndToolbar.setNextState(true);
+ }
+ else {
+ this.captionAndToolbar.setNextState(false);
+ }
+
+ if (this.currentIndex < 1) {
+ this.captionAndToolbar.setPreviousState(true);
+ }
+ else {
+ this.captionAndToolbar.setPreviousState(false);
+ }
+ }
+
+ this.captionAndToolbar.setCaptionValue(this.fullSizeImages[this.currentIndex].caption);
+
+ var fadeIn = false;
+
+ switch (this.lastShowPrevTrigger){
+
+ case Code.PhotoSwipe.ShowPrevTriggers.toolbar:
+ fadeIn = true;
+ break;
+
+ case Code.PhotoSwipe.ShowPrevTriggers.show:
+ fadeIn = true;
+ break;
+
+ case Code.PhotoSwipe.ShowPrevTriggers.slideshow:
+ fadeIn = false;
+ break;
+
+ default:
+ fadeIn = !this.settings.captionAndToolbarHideOnSwipe;
+ break;
+
+ }
+
+
+ if (fadeIn){
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow);
+ this.captionAndToolbar.fadeIn();
+
+ }
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onDisplayImage);
+
+ }
+
+ this.lastShowPrevTrigger = '';
+
+ // Set the previous and next images for the slider
+ this.setSliderPreviousAndNextFullSizeImages();
+
+ if (this.isSlideshowActive){
+
+ this.fireSlideshowTimeout();
+
+ }
+
+ this.isBusy = false;
+
+ },
+
+
+
+ /*
+ * Function: toggleCaptionAndToolbar
+ */
+ toggleCaptionAndToolbar: function(){
+
+ if (this.settings.captionAndToolbarHide){
+
+ this.captionAndToolbar.hide();
+ return;
+
+ }
+
+ if (this.captionAndToolbar.isHidden){
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow);
+ this.captionAndToolbar.fadeIn();
+
+ }
+ else{
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide);
+ this.captionAndToolbar.fadeOut();
+
+ }
+
+
+ },
+
+
+
+ /*
+ * Function: fadeOutCaptionAndToolbar
+ */
+ fadeOutCaptionAndToolbar: function(){
+
+ if (!this.settings.captionAndToolbarHide && !this.captionAndToolbar.isHidden){
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide);
+ this.captionAndToolbar.fadeOut();
+ }
+
+ },
+
+
+
+ /*
+ * Function: onToolbarClick
+ */
+ onToolbarClick: function(e){
+
+ this.stopSlideshow();
+
+ switch (e.action){
+
+ case ToolbarClass.Actions.previous:
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.toolbar;
+ this.showPrevious();
+ break;
+
+ case ToolbarClass.Actions.next:
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.toolbar;
+ this.showNext();
+ break;
+
+ case ToolbarClass.Actions.play:
+ this.startSlideshow();
+ break;
+
+ default:
+ this.hide();
+ break;
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: startSlideshow
+ */
+ startSlideshow: function(){
+
+ if (this.isBusy){
+ return;
+ }
+
+ if (!Util.isNothing(this.slideshowTimeout)){
+ window.clearTimeout(this.slideshowTimeout);
+ }
+
+ this.removeZoomPanRotate();
+
+ this.isSlideshowActive = true;
+
+ this.fadeOutCaptionAndToolbar();
+
+ this.fireSlideshowTimeout();
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onSlideshowStart);
+
+ },
+
+
+
+ /*
+ * Function: stopSlideshow
+ */
+ stopSlideshow: function(){
+
+ if (!Util.isNothing(this.slideshowTimeout)){
+ window.clearTimeout(this.slideshowTimeout);
+ }
+
+ this.isSlideshowActive = false;
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onSlideshowStop);
+
+ },
+
+
+
+
+ /*
+ * Function: fireSlideshowTimeout
+ */
+ fireSlideshowTimeout: function(){
+
+ var fire = false;
+
+ if (this.settings.loop){
+ if (this.fullSizeImages.length > 1){
+ fire = true;
+ }
+ }
+ else{
+ if (this.currentIndex < this.fullSizeImages.length-1){
+ fire = true;
+ }
+ }
+
+ if (fire){
+
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.slideshow;
+ this.slideshowTimeout = window.setTimeout(
+ this.showNext.bind(this),
+ this.settings.slideshowDelay
+ );
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: removeZoomPanRotate
+ */
+ removeZoomPanRotate: function(){
+
+ if (Util.isNothing(this.zoomPanRotate)){
+ return;
+ }
+
+ this.zoomPanRotate.removeFromDOM();
+
+ this.zoomPanRotate = null;
+
+ }
+
+
+ });
+
+
+ Code.PhotoSwipe.CssClasses = {
+ activeBody: 'ps-active'
+ };
+
+
+ Code.PhotoSwipe.ShowPrevTriggers = {
+
+ show: 'show',
+ toolbar: 'toobar',
+ swipe: 'swipe',
+ keyboard: 'keyboard',
+ slideshow: 'slideshow'
+
+ };
+
+
+ Code.PhotoSwipe.EventTypes = {
+
+ onBeforeShow: 'onBeforeShow',
+ onShow: 'onShow',
+ onBeforeHide: 'onBeforeHide',
+ onHide: 'onHide',
+ onShowNext: 'onShowNext',
+ onShowPrevious: 'onShowPrevious',
+ onDisplayImage: 'onDisplayImage',
+ onResetPosition: 'onResetPosition',
+ onSlideshowStart: 'onSlideshowStart',
+ onSlideshowStop: 'onSlideshowStop',
+ onBeforeCaptionAndToolbarShow: 'onBeforeCaptionAndToolbarShow',
+ onBeforeCaptionAndToolbarHide: 'onBeforeCaptionAndToolbarHide',
+ onViewportClick: 'onViewportClick'
+
+ };
+
+
+ /*
+ * Function: Code.PhotoSwipe.GetImageSource
+ * Default method for returning an image's source
+ */
+ Code.PhotoSwipe.GetImageSource = function(el){
+ return el.href;
+ };
+
+
+
+ /*
+ * Function: Code.PhotoSwipe.GetImageCaption
+ * Default method for returning an image's caption
+ * Assumes the el is an anchor and the first child is the
+ * image. The returned value is the "alt" attribute of the
+ * image.
+ */
+ Code.PhotoSwipe.GetImageCaption = function(el){
+ if (el.nodeName === "IMG"){
+ return Util.DOM.getAttribute(el, 'alt');
+ }
+ var i, childEl;
+ for (i=0; i=1;)a.removeChild(a.childNodes[a.childNodes.length-1])},hasAttribute:function(a,c){return a.getAttribute(c)},getAttribute:function(a,c){if(!this.hasAttribute(a,c))return"";return a.getAttribute(c)},setAttribute:function(a,
+c,d){a.setAttribute(c,d)},removeAttribute:function(a,c){this.hasAttribute(a,c)&&a.removeAttribute(c)},addClass:function(b,c){var d=a.DOM.getAttribute(b,"class");RegExp("(?:^|\\s+)"+c+"(?:\\s+|$)").test(d)||(d!==""&&(d+=" "),d+=c,a.DOM.setAttribute(b,"class",d))},removeClass:function(b,c){var d=a.DOM.getAttribute(b,"class"),e=RegExp("(?:^|\\s+)"+c+"(?:\\s+|$)");e.test(d)?(d=d.replace(e," "),a.DOM.setAttribute(b,"class",d),a.DOM.removeClass(b,c)):(d=a.trim(d),d===""?a.DOM.removeAttribute(b,"class"):
+a.DOM.setAttribute(b,"class",d))},hasClass:function(b,c){return RegExp("(?:^|\\s+)"+c+"(?:\\s+|$)").test(a.DOM.getAttribute(b,"class"))},setStyle:function(b,c,d){if(a.isObject(c))for(var e in c)c.hasOwnProperty(e)&&(b.style[e]=c[e]);else b.style[c]=d},getStyle:function(a,c){return e.getComputedStyle(a,"").getPropertyValue(c)},hide:function(b){a.setElementData(b,"oldDisplayValue",a.DOM.getStyle(b,"display"));a.DOM.setStyle(b,"display","none")},show:function(b){if(a.DOM.getStyle(b,"display")=="none"){var c=
+a.getElementData(b,"oldDisplayValue","block");c==="none"&&(c="block");a.DOM.setStyle(b,"display",c)}},width:function(b,c){if(!a.isNothing(c))a.isNumber(c)&&(c+="px"),b.style.width=c;return this._getDimension(b,"width")},outerWidth:function(b){var c=a.DOM.width(b);c+=parseInt(a.DOM.getStyle(b,"padding-left"),10)+parseInt(a.DOM.getStyle(b,"padding-right"),10);c+=parseInt(a.DOM.getStyle(b,"margin-left"),10)+parseInt(a.DOM.getStyle(b,"margin-right"),10);c+=parseInt(a.DOM.getStyle(b,"border-left-width"),
+10)+parseInt(a.DOM.getStyle(b,"border-right-width"),10);return c},height:function(b,c){if(!a.isNothing(c))a.isNumber(c)&&(c+="px"),b.style.height=c;return this._getDimension(b,"height")},_getDimension:function(a,c){var d=e.parseInt(e.getComputedStyle(a,"").getPropertyValue(c));if(isNaN(d)){var f={display:a.style.display,left:a.style.left};a.style.display="block";a.style.left="-1000000px";d=e.parseInt(e.getComputedStyle(a,"").getPropertyValue(c));a.style.display=f.display;a.style.left=f.left}return d},
+outerHeight:function(b){var c=a.DOM.height(b);c+=parseInt(a.DOM.getStyle(b,"padding-top"),10)+parseInt(a.DOM.getStyle(b,"padding-bottom"),10);c+=parseInt(a.DOM.getStyle(b,"margin-top"),10)+parseInt(a.DOM.getStyle(b,"margin-bottom"),10);c+=parseInt(a.DOM.getStyle(b,"border-top-width"),10)+parseInt(a.DOM.getStyle(b,"border-bottom-width"),10);return c},documentWidth:function(){return a.DOM.width(document.documentElement)},documentHeight:function(){return Math.round(a.DOM.height(document.documentElement))},
+bodyWidth:function(){return a.DOM.width(document.body)},bodyHeight:function(){return a.DOM.height(document.body)},windowWidth:function(){return e.innerWidth},windowHeight:function(){return e.innerHeight},windowScrollLeft:function(){return e.pageXOffset},windowScrollTop:function(){return e.pageYOffset},addEventListener:function(a,c,d){a.addEventListener(c,d,!1)},removeEventListener:function(a,c,d){a.removeEventListener(c,d,!1)},getMousePosition:function(a){var c={x:0,y:0};if(a.pageX)c.x=a.pageX;else if(a.clientX)c.x=
+a.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);if(a.pageY)c.y=a.pageY;else if(a.clientY)c.y=a.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);return c},getTouchEvent:function(a){return a}}})})(window,Code.PhotoSwipe.Util);
+(function(e,a){a.extend(a,{Animation:{_applyTransitionDelay:50,_setTransition:function(b,c,d,f,g,h){var i=a.Animation._getTransitionPrefix(),c=a.coalesce(c,""),d=a.coalesce(d,""),j;a.isFunction(f)?(j=f,g=f=""):(j=h,f=a.coalesce(f,""),g=a.coalesce(g,""));h={};h[i+"Property"]=c;h[i+"Duration"]=d;h[i+"TimingFunction"]=f;h[i+"Delay"]=g;a.DOM.setStyle(b,h);a.isFunction(j)&&e.setTimeout(function(){j(b)},a.Animation._applyTransitionDelay)},_setTransitionEndEventListener:function(b){a.setElementData(b,"transitionEndEvent",
+function(b){var d=b.target;a.DOM.removeEventListener(d,a.Animation._getTransitionEndEventLabel(),a.getElementData(d,"transitionEndEvent"));a.removeElementData(d,"transitionEndEvent");var f=a.getElementData(d,"transitionEndCallback");a.removeElementData(d,"transitionEndCallback");a.Animation._removeTransitions(d);a.isFunction(f)&&e.setTimeout(function(){f(b)},a.Animation._applyTransitionDelay)});a.DOM.addEventListener(b,a.Animation._getTransitionEndEventLabel(),a.getElementData(b,"transitionEndEvent"))},
+_removeTransitions:function(b){var c=a.Animation._getTransitionPrefix(),d={};d[c+"Property"]="";d[c+"Duration"]="";d[c+"TimingFunction"]="";d[c+"Delay"]="";a.DOM.setStyle(b,d)},_getTransitionEndEventLabel:function(){return document.documentElement.style.WebkitTransition!==void 0?"webkitTransitionEnd":"transitionend"},_getTransitionPrefix:function(){return document.documentElement.style.WebkitTransition!==void 0?"webkitTransition":document.documentElement.style.MozTransition!==void 0?"MozTransition":
+"transition"},stopFade:function(b){var c=a.getElementData(b,"transitionEndEvent");a.isNothing(c)||(a.DOM.removeEventListener(b,a.Animation._getTransitionEndEventLabel(),a.getElementData(b,"transitionEndEvent")),c=e.getComputedStyle(b,"").getPropertyValue("opacity"),a.Animation._removeTransitions(b),a.DOM.setStyle(b,"opacity",c))},fadeIn:function(b,c,d,e){c=a.coalesce(c,1);d=a.coalesce(d,500);a.setElementData(b,"transitionEndCallback",e);a.Animation._setTransition(b,"opacity",d+"ms",function(b){a.Animation._setTransitionEndEventListener(b);
+a.DOM.setStyle(b,"opacity",c)})},fadeOut:function(b,c,d){a.isNothing(c)&&(c=500);a.setElementData(b,"transitionEndCallback",d);a.Animation._setTransition(b,"opacity",c+"ms",function(b){a.Animation._setTransitionEndEventListener(b);a.DOM.setStyle(b,"opacity",0)})},slideBy:function(b,c,d,e,g){a.isNothing(e)&&(e=500);a.setElementData(b,"transitionEndCallback",a.Animation._onSlideByEnd);a.setElementData(b,"slideByCallback",g);a.setElementData(b,"slideByXPos",c);a.setElementData(b,"slideByYPos",d);a.Animation._setTransition(b,
+"all",e+"ms","ease-in",0,function(b){a.Animation._setTransitionEndEventListener(b);var c=a.getElementData(b,"slideByXPos"),d=a.getElementData(b,"slideByYPos");a.removeElementData(b,"slideByXPos");a.removeElementData(b,"slideByYPos");a.browser.webkit?a.browser.is3dSupported?a.DOM.setStyle(b,{webkitTransform:"translate3d("+c+"px, "+d+"px, 0)"}):a.DOM.setStyle(b,{webkitTransform:"translate("+c+"px, "+d+"px)"}):a.DOM.setStyle(b,{webkitTransform:"translate("+c+"px, "+d+"px)",MozTransform:"translate("+
+c+"px, "+d+"px)",transform:"translate("+c+"px, "+d+"px)"})})},_onSlideByEnd:function(b){var c=b.target,d=a.getElementData(c,"slideByCallback"),f=a.coalesce(c.style.webkitTransform,c.style.MozTransform,c.style.transform).match(/\((.*?)\)/)[1].split(", "),g=e.parseInt(f[0]),f=e.parseInt(f[1]),h=e.parseInt(a.DOM.getStyle(c,"left")),i=e.parseInt(a.DOM.getStyle(c,"top"));a.DOM.setStyle(c,{webkitTransform:"",MozTransform:"",transform:"",left:h+g+"px",top:i+f+"px"});a.removeElementData(c,"slideByCallback");
+a.removeElementData(c,"slideByXPos");a.removeElementData(c,"slideByYPos");a.isFunction(d)&&e.setTimeout(function(){d(b)},a.Animation._applyTransitionDelay)}}})})(window,Code.PhotoSwipe.Util);
+(function(){Code.PhotoSwipe.EventClass=SimpleClass.extend({_listeners:null,init:function(){this._listeners={}},addEventListener:function(e,a){typeof this._listeners[e]==="undefined"&&(this._listeners[e]=[]);this._listeners[e].push(a)},dispatchEvent:function(e){typeof e=="string"&&(e={type:e});if(!e.target)e.target=this;if(!e.type)throw Error("Event object missing 'type' property.");if(this._listeners[e.type]instanceof Array)for(var a=this._listeners[e.type],b=0,c=a.length;bthis.naturalHeight;this.isLoading=!1;this.hasLoaded=!0;this.dispatchEvent(Code.PhotoSwipe.FullSizeImageClass.EventTypes.onLoad)}});Code.PhotoSwipe.FullSizeImageClass.EventTypes=
+{onLoad:"onLoad"}})(window,Code.PhotoSwipe.Util);
+(function(e,a){Code.PhotoSwipe.DocumentOverlayClass=Code.PhotoSwipe.ElementClass.extend({init:function(b){this.settings={zIndex:1E3};a.extend(this.settings,b);this._super(b);this.el=a.DOM.createElement("div",{"class":Code.PhotoSwipe.DocumentOverlayClass.CssClasses.documentOverlay},"");a.DOM.setStyle(this.el,{left:0,position:"absolute",zIndex:this.settings.zIndex,top:0});a.DOM.hide(this.el);a.DOM.appendToBody(this.el)},resetPosition:function(){a.DOM.width(this.el,a.DOM.bodyWidth());a.DOM.height(this.el,
+a.DOM.bodyHeight())}});Code.PhotoSwipe.DocumentOverlayClass.CssClasses={documentOverlay:"ps-document-overlay"}})(window,Code.PhotoSwipe.Util);
+(function(e,a){Code.PhotoSwipe.ViewportClass=Code.PhotoSwipe.ElementClass.extend({touchStartPoint:null,touchStartTime:null,touchStartHandler:null,touchMoveHandler:null,touchEndHandler:null,gestureStartHandler:null,gestureChangeHandler:null,gestureEndHandler:null,isGesture:null,mouseDownHandler:null,mouseUpHandler:null,init:function(b){this.settings={swipeThreshold:500,swipeTimeThreshold:250,zIndex:1E3};a.extend(this.settings,b);this._super(this.settings);this.touchStartPoint={x:0,y:0};if(a.browser.touchSupported)this.touchStartHandler=
+this.onTouchStart.bind(this),this.touchMoveHandler=this.onTouchMove.bind(this),this.touchEndHandler=this.onTouchEnd.bind(this);if(a.browser.gestureSupported)this.gestureStartHandler=this.onGestureStart.bind(this),this.gestureChangeHandler=this.onGestureChange.bind(this),this.gestureEndHandler=this.onGestureEnd.bind(this);this.mouseDownHandler=this.onMouseDown.bind(this);this.mouseUpHandler=this.onMouseUp.bind(this);this.el=a.DOM.createElement("div",{"class":Code.PhotoSwipe.ViewportClass.CssClasses.viewport,
+"data-role":"dialog"},"");a.DOM.setStyle(this.el,{position:"absolute",left:0,zIndex:this.settings.zIndex,overflow:"hidden"});a.DOM.hide(this.el);a.DOM.appendToBody(this.el)},resetPosition:function(){a.DOM.setStyle(this.el,{top:a.DOM.windowScrollTop()+"px"});a.DOM.width(this.el,a.DOM.bodyWidth());a.DOM.height(this.el,a.DOM.windowHeight())},addEventListeners:function(){a.browser.touchSupported&&(a.DOM.addEventListener(this.el,"touchstart",this.touchStartHandler),a.DOM.addEventListener(this.el,"touchmove",
+this.touchMoveHandler),a.DOM.addEventListener(this.el,"touchend",this.touchEndHandler));a.browser.gestureSupported&&(a.DOM.addEventListener(this.el,"gesturestart",this.gestureStartHandler),a.DOM.addEventListener(this.el,"gesturechange",this.gestureChangeHandler),a.DOM.addEventListener(this.el,"gestureend",this.gestureEndHandler));a.DOM.addEventListener(this.el,"mousedown",this.mouseDownHandler);a.DOM.addEventListener(this.el,"mouseup",this.mouseUpHandler)},removeEventListeners:function(){a.browser.touchSupported&&
+(a.DOM.removeEventListener(this.el,"touchstart",this.touchStartHandler),a.DOM.removeEventListener(this.el,"touchmove",this.touchMoveHandler),a.DOM.removeEventListener(this.el,"touchend",this.touchEndHandler));a.browser.gestureSupported&&(a.DOM.removeEventListener(this.el,"gesturestart",this.gestureStartHandler),a.DOM.removeEventListener(this.el,"gesturechange",this.gestureChangeHandler),a.DOM.removeEventListener(this.el,"gestureend",this.gestureEndHandler));a.DOM.removeEventListener(this.el,"mousedown",
+this.mouseDownHandler);a.DOM.removeEventListener(this.el,"mouseup",this.mouseUpHandler)},getTouchPoint:function(a){return{x:a[0].pageX,y:a[0].pageY}},onGestureStart:function(b){b.preventDefault();b=a.DOM.getTouchEvent(b);this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:Code.PhotoSwipe.ViewportClass.Actions.gestureStart,scale:b.scale,rotation:b.rotation})},onGestureChange:function(b){b.preventDefault();b=a.DOM.getTouchEvent(b);this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+target:this,action:Code.PhotoSwipe.ViewportClass.Actions.gestureChange,scale:b.scale,rotation:b.rotation})},onGestureEnd:function(b){b.preventDefault();b=a.DOM.getTouchEvent(b);this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:Code.PhotoSwipe.ViewportClass.Actions.gestureEnd,scale:b.scale,rotation:b.rotation})},onTouchStart:function(b){b.preventDefault();b=a.DOM.getTouchEvent(b).touches;b.length>1?this.isGesture=!0:(this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+target:this,action:Code.PhotoSwipe.ViewportClass.Actions.touchStart,point:this.getTouchPoint(b)}),this.touchStartTime=new Date,this.isGesture=!1,this.touchStartPoint=this.getTouchPoint(b))},onTouchMove:function(b){b.preventDefault();if(!this.isGesture)b=a.DOM.getTouchEvent(b).touches,this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:Code.PhotoSwipe.ViewportClass.Actions.touchMove,point:this.getTouchPoint(b)})},onTouchEnd:function(b){b.preventDefault();this.isGesture||
+(b=a.DOM.getTouchEvent(b),b=this.getTouchPoint(!a.isNothing(b.changedTouches)?b.changedTouches:b.touches),this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:Code.PhotoSwipe.ViewportClass.Actions.touchEnd,point:b}),this.fireTouchEvent(this.touchStartPoint,b))},onMouseDown:function(b){b.preventDefault();this.touchStartTime=new Date;this.isGesture=!1;this.touchStartPoint=a.DOM.getMousePosition(b)},onMouseUp:function(b){b.preventDefault();this.fireTouchEvent(this.touchStartPoint,
+a.DOM.getMousePosition(b))},fireTouchEvent:function(b,c){var d;new Date-this.touchStartTime>this.settings.swipeTimeThreshold||(d=c.x-b.x,d=Math.abs(d)>=this.settings.swipeThreshold?d<0?Code.PhotoSwipe.ViewportClass.Actions.swipeLeft:Code.PhotoSwipe.ViewportClass.Actions.swipeRight:Code.PhotoSwipe.ViewportClass.Actions.click,a.isNothing(d)||this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:d}))}});Code.PhotoSwipe.ViewportClass.CssClasses={viewport:"ps-viewport"};
+Code.PhotoSwipe.ViewportClass.Actions={click:"click",swipeLeft:"swipeLeft",swipeRight:"swipeRight",touchStart:"touchStart",touchMove:"touchMove",touchEnd:"touchEnd",gestureStart:"gestureStart",gestureChange:"gestureChange",gestureEnd:"gestureEnd"};Code.PhotoSwipe.ViewportClass.EventTypes={onTouch:"onTouch"}})(window,Code.PhotoSwipe.Util);
+(function(e,a,b){Code.PhotoSwipe.SliderItemClass=Code.PhotoSwipe.EventClass.extend({el:null,imageContainerEl:null,imageEl:null,parentEl:null,fullSizeImage:null,fullSizeImageLoadEventHandler:null,savedImageWidth:null,savedImageHeight:null,init:function(b){this._super();this.parentEl=b;this.fullSizeImageLoadEventHandler=this.onFullSizeImageLoad.bind(this);this.el=a.DOM.createElement("div",{"class":Code.PhotoSwipe.SliderItemClass.CssClasses.item+" "+Code.PhotoSwipe.SliderItemClass.CssClasses.loading},
+"");a.DOM.setStyle(this.el,{position:"absolute",overflow:"hidden",top:0});a.DOM.resetTranslate(this.el);a.DOM.appendChild(this.el,this.parentEl);this.imageContainerEl=a.DOM.createElement("div");a.DOM.setStyle(this.imageContainerEl,{position:"absolute",overflow:"hidden",top:0,left:0});a.DOM.appendChild(this.imageContainerEl,this.el);this.imageEl=new Image;a.DOM.setStyle(this.imageEl,{display:"block",position:"absolute",margin:0,padding:0});a.DOM.hide(this.imageEl);a.DOM.appendChild(this.imageEl,this.imageContainerEl)},
+resetPosition:function(b,d,e){a.DOM.width(this.el,b);a.DOM.height(this.el,d);a.DOM.setStyle(this.el,"left",e+"px");a.DOM.width(this.imageContainerEl,b);a.DOM.height(this.imageContainerEl,d);this.resetImagePosition()},resetImagePosition:function(){if(!a.isNothing(this.fullSizeImage)){a.DOM.getAttribute(this.imageEl,"src");var b,d,e,g;g=a.DOM.width(this.el);var h=a.DOM.height(this.el);b=this.fullSizeImage.isLandscape?g/this.fullSizeImage.naturalWidth:h/this.fullSizeImage.naturalHeight;d=Math.round(this.fullSizeImage.naturalWidth*
+b);e=Math.round(this.fullSizeImage.naturalHeight*b);this.fullSizeImage.scaleMethod==="zoom"?(b=1,eg?b=g/d:e>h&&(b=h/e),b!==1&&(d=Math.round(d*b),e=Math.round(e*b)));b=(h-e)/2+"px";g=(g-d)/2+"px";a.DOM.width(this.imageEl,d);a.DOM.height(this.imageEl,e);a.DOM.setStyle(this.imageEl,{top:b,left:g});a.DOM.show(this.imageEl);this.savedImageWidth=d;this.savedImageHeight=e}},setFullSizeImage:function(c){this.fullSizeImage=
+c;a.DOM.removeClass(this.el,Code.PhotoSwipe.SliderItemClass.CssClasses.loading);a.DOM.removeClass(this.el,Code.PhotoSwipe.SliderItemClass.CssClasses.imageError);a.isNothing(this.fullSizeImage)?(this.fullSizeImage=null,a.DOM.addClass(this.el,Code.PhotoSwipe.SliderItemClass.CssClasses.imageError),this.hideImage()):this.fullSizeImage.hasLoaded?(a.DOM.setAttribute(this.imageEl,"src",this.fullSizeImage.src),this.resetImagePosition(),this.dispatchEvent(Code.PhotoSwipe.SliderItemClass.EventTypes.onFullSizeImageDisplay)):
+(a.DOM.addClass(this.el,Code.PhotoSwipe.SliderItemClass.CssClasses.loading),this.hideImage(),this.fullSizeImage.isLoading||(this.fullSizeImage.addEventListener(b.EventTypes.onLoad,this.fullSizeImageLoadEventHandler),this.fullSizeImage.load()))},onFullSizeImageLoad:function(c){c.target.removeEventListener(b.EventTypes.onLoad,this.fullSizeImageLoadEventHandler);a.isNothing(this.fullSizeImage)||c.target.index!==this.fullSizeImage.index?this.dispatchEvent({type:Code.PhotoSwipe.SliderItemClass.EventTypes.onFullSizeImageLoadAnomaly,
+target:this,fullSizeImage:c.target}):this.setFullSizeImage(c.target)},hideImage:function(){a.DOM.removeAttribute(this.imageEl,"src");a.DOM.hide(this.imageEl)}});Code.PhotoSwipe.SliderItemClass.CssClasses={item:"ps-slider-item",loading:"ps-slider-item-loading",imageError:"ps-slider-item-image-error"};Code.PhotoSwipe.SliderItemClass.EventTypes={onFullSizeImageDisplay:"onFullSizeImageDisplay",onFullSizeImageLoadAnomaly:"onFullSizeImageLoadAnomaly"}})(window,Code.PhotoSwipe.Util,Code.PhotoSwipe.FullSizeImageClass);
+(function(e,a,b){Code.PhotoSwipe.SliderClass=Code.PhotoSwipe.ElementClass.extend({parentEl:null,parentElWidth:null,parentElHeight:null,items:null,scaleEl:null,lastScaleValue:null,previousItem:null,currentItem:null,nextItem:null,hasBounced:null,lastShowAction:null,bounceSlideBy:null,showNextEndEventHandler:null,showPreviousEndEventHandler:null,bounceStepOneEventHandler:null,bounceStepTwoEventHandler:null,sliderFullSizeImageLoadAnomalyEventHandler:null,init:function(c,d){this.settings={slideSpeed:250};
+a.extend(this.settings,c);this._super(this.settings);this.parentEl=d;this.hasBounced=!1;this.showNextEndEventHandler=this.onShowNextEnd.bind(this);this.showPreviousEndEventHandler=this.onShowPreviousEnd.bind(this);this.bounceStepOneEventHandler=this.onBounceStepOne.bind(this);this.bounceStepTwoEventHandler=this.onBounceStepTwo.bind(this);this.sliderFullSizeImageLoadAnomalyEventHandler=this.onSliderFullSizeImageLoadAnomaly.bind(this);this.el=a.DOM.createElement("div",{"class":Code.PhotoSwipe.SliderClass.CssClasses.slider},
+"");a.DOM.setStyle(this.el,{position:"absolute",top:0});a.DOM.hide(this.el);a.DOM.appendChild(this.el,d);this.items=[];this.items.push(new b(this.el));this.items.push(new b(this.el));this.items.push(new b(this.el));this.previousItem=this.items[0];this.currentItem=this.items[1];this.nextItem=this.items[2]},addEventListeners:function(){for(var a=0;a');this.settings.hideClose&&a.DOM.hide(this.closeEl);a.DOM.appendChild(this.closeEl,this.el);this.playEl=a.DOM.createElement("div",{"class":Code.PhotoSwipe.ToolbarClass.CssClasses.play},'
');a.DOM.appendChild(this.playEl,this.el);this.previousEl=a.DOM.createElement("div",{"class":Code.PhotoSwipe.ToolbarClass.CssClasses.previous},'
');a.DOM.appendChild(this.previousEl,this.el);this.nextEl=a.DOM.createElement("div",{"class":Code.PhotoSwipe.ToolbarClass.CssClasses.next},'
');a.DOM.appendChild(this.nextEl,this.el)},postFadeIn:function(){this.isHidden||(a.DOM.setStyle(this.el,{display:"table"}),this._super(this.settings))},addEventListeners:function(){a.browser.touchSupported&&(a.browser.isBlackberry||a.DOM.addEventListener(this.el,"touchstart",this.touchStartHandler),
+a.DOM.addEventListener(this.el,"touchmove",this.touchMoveHandler));a.DOM.addEventListener(this.el,"click",this.clickHandler)},removeEventListeners:function(){a.browser.touchSupported&&(a.browser.isBlackberry||a.DOM.removeEventListener(this.el,"touchstart",this.touchStartHandler),a.DOM.removeEventListener(this.el,"touchmove",this.touchMoveHandler));a.DOM.removeEventListener(this.el,"click",this.clickHandler)},onTouchStart:function(a){a.preventDefault();this.touched=!0;this.handleClick(a)},onTouchMove:function(a){a.preventDefault()},
+onClick:function(a){this.touched||this.handleClick(a)},handleClick:function(b){var c;switch(b.target.parentNode){case this.previousEl:if(this.isPreviousActive)c=Code.PhotoSwipe.ToolbarClass.Actions.previous;break;case this.nextEl:if(this.isNextActive)c=Code.PhotoSwipe.ToolbarClass.Actions.next;break;case this.playEl:c=Code.PhotoSwipe.ToolbarClass.Actions.play;break;case this.closeEl:c=Code.PhotoSwipe.ToolbarClass.Actions.close}a.isNothing(c)||this.dispatchEvent({type:Code.PhotoSwipe.ToolbarClass.EventTypes.onClick,
+target:this,action:c})},resetPosition:function(){var b;b=this.settings.position==="bottom"?a.DOM.windowHeight()-a.DOM.outerHeight(this.el)+a.DOM.windowScrollTop():a.DOM.windowScrollTop();a.DOM.setStyle(this.el,"top",b+"px");a.DOM.width(this.el,a.DOM.bodyWidth())},setNextState:function(b){b?(a.DOM.addClass(this.nextEl,Code.PhotoSwipe.ToolbarClass.CssClasses.nextDisabled),this.isNextActive=!1):(a.DOM.removeClass(this.nextEl,Code.PhotoSwipe.ToolbarClass.CssClasses.nextDisabled),this.isNextActive=!0)},
+setPreviousState:function(b){b?(a.DOM.addClass(this.previousEl,Code.PhotoSwipe.ToolbarClass.CssClasses.previousDisabled),this.isPreviousActive=!1):(a.DOM.removeClass(this.previousEl,Code.PhotoSwipe.ToolbarClass.CssClasses.previousDisabled),this.isPreviousActive=!0)}});Code.PhotoSwipe.ToolbarClass.CssClasses={caption:"ps-toolbar",top:"ps-toolbar-top",close:"ps-toolbar-close",previous:"ps-toolbar-previous",previousDisabled:"ps-toolbar-previous-disabled",next:"ps-toolbar-next",nextDisabled:"ps-toolbar-next-disabled",
+play:"ps-toolbar-play",content:"ps-toolbar-content"};Code.PhotoSwipe.ToolbarClass.Actions={close:"close",previous:"previous",next:"next",play:"play"};Code.PhotoSwipe.ToolbarClass.EventTypes={onClick:"onClick"}})(window,Code.PhotoSwipe.Util);
+(function(e,a,b,c){Code.PhotoSwipe.CaptionToolbarClass=Code.PhotoSwipe.EventClass.extend({toolbar:null,caption:null,isHidden:null,hasAddedEventListeners:null,toolbarClickEventHandler:null,init:function(d){this._super();this.settings={opacity:0.8,fadeInSpeed:250,fadeOutSpeed:500,autoHideDelay:5E3,flipPosition:!1,showEmptyCaptions:!0,hideClose:!1,zIndex:1E3};a.extend(this.settings,d);this.isHidden=!0;this.hasAddedEventListeners=!1;this.toolbarClickEventHandler=this.onToolbarClick.bind(this);this.caption=
+new b({fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,opacity:this.settings.opacity,position:this.settings.flipPosition?"bottom":"top",zIndex:this.settings.zIndex});this.toolbar=new c({fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,opacity:this.settings.opacity,position:this.settings.flipPosition?"top":"bottom",hideClose:this.settings.hideClose,zIndex:this.settings.zIndex+1})},resetPosition:function(){this.caption.resetPosition();this.toolbar.resetPosition()},
+addEventListeners:function(){if(!this.hasAddedEventListeners)this.toolbar.addEventListener(c.EventTypes.onClick,this.toolbarClickEventHandler),this.hasAddedEventListeners=!0},removeEventListeners:function(){this.toolbar.removeEventListener(c.EventTypes.onClick,this.toolbarClickEventHandler);this.hasAddedEventListeners=!1},fadeIn:function(){this.stopAutoHideTimeout();this.stopFade();this.isHidden?(this.isHidden=!1,this.fadeInCaption(),this.toolbar.fadeIn(),e.setTimeout(this.onFadeIn.bind(this),this.settings.fadeInSpeed)):
+(this.caption.isHidden&&this.fadeInCaption(),this.resetAutoHideTimeout())},showCaption:function(){this.caption.captionValue===""?this.settings.showEmptyCaptions&&this.caption.show():this.caption.show()},fadeInCaption:function(){this.caption.captionValue===""?this.settings.showEmptyCaptions&&this.caption.fadeIn():this.caption.fadeIn()},onFadeIn:function(){this.addEventListeners();this.resetAutoHideTimeout()},fadeOut:function(){this.stopAutoHideTimeout();this.stopFade();this.isHidden=!0;this.caption.fadeOut();
+this.toolbar.fadeOut();e.setTimeout(this.onFadeOut.bind(this),this.settings.fadeOutSpeed)},onFadeOut:function(){},stopFade:function(){this.caption.stopFade();this.toolbar.stopFade()},hide:function(){this.stopAutoHideTimeout();this.stopFade();this.isHidden=!0;this.removeEventListeners();this.caption.hide();this.toolbar.hide()},setCaptionValue:function(a){this.caption.setCaptionValue(a);this.caption.captionValue===""&&!this.settings.showEmptyCaptions&&this.caption.fadeOut()},resetAutoHideTimeout:function(){if(!this.isHidden&&
+(this.stopAutoHideTimeout(),this.settings.autoHideDelay>0))this.autoHideTimeout=e.setTimeout(this.fadeOut.bind(this),this.settings.autoHideDelay)},stopAutoHideTimeout:function(){a.isNothing(this.autoHideTimeout)||e.clearTimeout(this.autoHideTimeout)},onToolbarClick:function(a){this.dispatchEvent({type:Code.PhotoSwipe.ToolbarClass.EventTypes.onClick,target:this,action:a.action})},setNextState:function(a){this.toolbar.setNextState(a)},setPreviousState:function(a){this.toolbar.setPreviousState(a)}})})(window,
+Code.PhotoSwipe.Util,Code.PhotoSwipe.CaptionClass,Code.PhotoSwipe.ToolbarClass);
+(function(e,a){Code.PhotoSwipe.ZoomPanRotateClass=Code.PhotoSwipe.ElementClass.extend({containerEl:null,imageEl:null,parentEl:null,transformSettings:null,panStartingPoint:null,init:function(b,c,d){this.settings={maxZoom:5,minZoom:0.5,adjustPanToZoom:!0};a.extend(this.settings,b);this._super(b);this.parentEl=c;this.imageEl=d.cloneNode(!1);this.transformSettings={startingScale:1,scale:1,startingRotation:0,rotation:0,startingTranslateX:0,startingTranslateY:0,translateX:0,translateY:0};this.el=a.DOM.createElement("div",
+{"class":Code.PhotoSwipe.ZoomPanRotateClass.CssClasses.documentOverlay},"");a.DOM.setStyle(this.el,{left:0,top:0,position:"absolute"});a.DOM.width(this.el,a.DOM.bodyWidth());a.DOM.height(this.el,a.DOM.windowHeight());this.containerEl=a.DOM.createElement("div");a.DOM.setStyle(this.containerEl,{left:0,top:0,position:"absolute"});a.DOM.width(this.containerEl,a.DOM.bodyWidth());a.DOM.height(this.containerEl,a.DOM.windowHeight());a.DOM.appendChild(this.imageEl,this.containerEl);a.DOM.appendChild(this.containerEl,
+this.el);a.DOM.appendChild(this.el,this.parentEl)},setStartingTranslateFromCurrentTranform:function(){var b=this.containerEl.style.webkitTransform.match(/translate\((.*?)\)/);if(!a.isNothing(b))b=b[1].split(", "),this.transformSettings.startingTranslateX=e.parseInt(b[0]),this.transformSettings.startingTranslateY=e.parseInt(b[1])},setStartingScaleAndRotation:function(a,c){var d=this.transformSettings.startingScale*a;if(this.settings.minZoom!==0&&dthis.settings.maxZoom)d=this.settings.maxZoom;this.transformSettings.startingScale=d;this.transformSettings.startingRotation=(this.transformSettings.startingRotation+c)%360},zoomRotate:function(a,c){var d=this.transformSettings.startingScale*a;if(this.settings.minZoom!==0&&dthis.settings.maxZoom)d=this.settings.maxZoom;this.transformSettings.scale=d;this.transformSettings.rotation=this.transformSettings.startingRotation+
+c;this.applyTransform()},panStart:function(a){this.setStartingTranslateFromCurrentTranform();this.panStartingPoint={x:a.x,y:a.y}},pan:function(a){var c=a.x-this.panStartingPoint.x,a=a.y-this.panStartingPoint.y,a=a/this.transformSettings.scale?a/this.transformSettings.scale:a;this.transformSettings.translateX=this.transformSettings.startingTranslateX+(this.settings.adjustPanToZoom?c/this.transformSettings.scale:c);this.transformSettings.translateY=this.transformSettings.startingTranslateY+a;this.applyTransform()},
+applyTransform:function(){this.containerEl.style.webkitTransform="scale("+this.transformSettings.scale+") rotate("+this.transformSettings.rotation%360+"deg) translate("+this.transformSettings.translateX+"px, "+this.transformSettings.translateY+"px)"},removeFromDOM:function(){a.DOM.removeChild(this.el,this.parentEl)}});Code.PhotoSwipe.ZoomPanRotateClass.CssClasses={documentOverlay:"ps-zoom-pan-rotate"}})(window,Code.PhotoSwipe.Util);
+(function(e,a,b,c,d,f,g,h,i,j,k){h=Code.PhotoSwipe.EventClass.extend({fullSizeImages:null,documentOverlay:null,viewport:null,slider:null,captionAndToolbar:null,zoomPanRotate:null,settings:null,currentIndex:null,isBusy:null,isActive:null,currentHistoryHashValue:null,isBackEventSupported:null,slideshowTimeout:null,isSlideshowActive:null,lastShowPrevTrigger:null,backButtonClicked:null,viewportFadeInEventHandler:null,windowOrientationChangeEventHandler:null,windowScrollEventHandler:null,windowHashChangeHandler:null,
+keyDownEventHandler:null,viewportTouchEventHandler:null,viewportFadeOutEventHandler:null,sliderDisplayCurrentFullSizeImageEventHandler:null,toolbarClickEventHandler:null,orientationEventName:null,init:function(){this._super();this.currentIndex=0;this.backButtonClicked=this.isSlideshowActive=this.isActive=this.isBusy=!1;this.settings={getImageSource:Code.PhotoSwipe.GetImageSource,getImageCaption:Code.PhotoSwipe.GetImageCaption,getImageMetaData:Code.PhotoSwipe.GetImageMetaData,fadeInSpeed:250,fadeOutSpeed:500,
+slideSpeed:250,swipeThreshold:50,swipeTimeThreshold:250,loop:!0,slideshowDelay:3E3,imageScaleMethod:"fit",preventHide:!1,zIndex:1E3,backButtonHideEnabled:!0,jQueryMobile:!a.isNothing(e.jQuery)&&!a.isNothing(e.jQuery.mobile),jQueryMobileDialogHash:"&ui-state=dialog",allowUserZoom:!0,allowRotationOnUserZoom:!0,maxUserZoom:5,minUserZoom:0.5,adjustUserPanToZoom:!0,captionAndToolbarHide:!1,captionAndToolbarHideOnSwipe:!0,captionAndToolbarFlipPosition:!1,captionAndToolbarAutoHideDelay:5E3,captionAndToolbarOpacity:0.8,
+captionAndToolbarShowEmptyCaptions:!0};if(a.browser.isAndroid&&navigator.userAgent.indexOf("2.1"))this.isBackEventSupported=!0;if(!this.isBackEventSupported)this.isBackEventSupported="onhashchange"in e;if(this.settings.preventHide)this.settings.backButtonHideEnabled=!1;this.viewportFadeInEventHandler=this.onViewportFadeIn.bind(this);this.windowOrientationChangeEventHandler=this.onWindowOrientationChange.bind(this);this.windowScrollEventHandler=this.onWindowScroll.bind(this);this.windowHashChangeHandler=
+this.onWindowHashChange.bind(this);this.keyDownEventHandler=this.onKeyDown.bind(this);this.viewportTouchEventHandler=this.onViewportTouch.bind(this);this.viewportFadeOutEventHandler=this.onViewportFadeOut.bind(this);this.sliderDisplayCurrentFullSizeImageEventHandler=this.onSliderDisplayCurrentFullSizeImage.bind(this);this.toolbarClickEventHandler=this.onToolbarClick.bind(this)},setOptions:function(b){a.extend(this.settings,b);if(this.settings.preventHide)this.settings.backButtonHideEnabled=!1},setImages:function(b){if(!a.isArray)throw"thumbEls is not an array";
+this.currentIndex=0;this.fullSizeImages=[];for(var c=0;c=this.fullSizeImages.length)c=0;this.currentIndex=c;a.isNothing(this.documentOverlay)?this.build():this.resetPosition();this.viewport.addEventListener(b.EventTypes.onFadeIn,this.viewportFadeInEventHandler);this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeShow);this.viewport.fadeIn()}},build:function(){this.documentOverlay=new c({fadeInSpeed:this.settings.fadeInSpeed,
+fadeOutSpeed:this.settings.fadeOutSpeed,zIndex:this.settings.zIndex});this.viewport=new f({fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,swipeThreshold:this.settings.swipeThreshold,swipeTimeThreshold:this.settings.swipeTimeThreshold,zIndex:this.settings.zIndex+1});this.slider=new g({fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,slideSpeed:this.settings.slideSpeed},this.viewport.el);this.captionAndToolbar=new j({opacity:this.settings.captionAndToolbarOpacity,
+fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,autoHideDelay:this.settings.captionAndToolbarAutoHideDelay,flipPosition:this.settings.captionAndToolbarFlipPosition,showEmptyCaptions:this.settings.captionAndToolbarShowEmptyCaptions,hideClose:this.settings.preventHide,zIndex:this.settings.zIndex+3});this.resetPosition()},addEventListeners:function(){this.orientationEventName=a.browser.isAndroid?"resize":"onorientationchange"in e?"orientationchange":"resize";a.DOM.addEventListener(e,
+this.orientationEventName,this.windowOrientationChangeEventHandler);a.DOM.addEventListener(e,"scroll",this.windowScrollEventHandler);if(this.isBackEventSupported&&this.settings.backButtonHideEnabled)this.settings.jQueryMobile?e.location.hash=this.settings.jQueryMobileDialogHash:(this.currentHistoryHashValue="PhotoSwipe"+(new Date).getTime().toString(),e.location.hash=this.currentHistoryHashValue),a.DOM.addEventListener(e,"hashchange",this.windowHashChangeHandler);a.DOM.addEventListener(document,"keydown",
+this.keyDownEventHandler);this.viewport.addEventListener(f.EventTypes.onTouch,this.viewportTouchEventHandler);this.slider.addEventListener(g.EventTypes.onDisplayCurrentFullSizeImage,this.sliderDisplayCurrentFullSizeImageEventHandler);this.captionAndToolbar.addEventListener(i.EventTypes.onClick,this.toolbarClickEventHandler)},removeEventListeners:function(){a.DOM.removeEventListener(e,this.orientationEventName,this.windowOrientationChangeEventHandler);a.DOM.removeEventListener(e,"scroll",this.windowScrollEventHandler);
+this.isBackEventSupported&&this.settings.backButtonHideEnabled&&a.DOM.removeEventListener(e,"hashchange",this.windowHashChangeHandler);a.DOM.removeEventListener(document,"keydown",this.keyDownEventHandler);this.viewport.removeEventListener(f.EventTypes.onTouch,this.viewportTouchEventHandler);this.slider.removeEventListener(g.EventTypes.onDisplayCurrentFullSizeImage,this.sliderDisplayCurrentFullSizeImageEventHandler);this.captionAndToolbar.removeEventListener(i.EventTypes.onClick,this.toolbarClickEventHandler)},
+onViewportFadeIn:function(){this.viewport.removeEventListener(b.EventTypes.onFadeIn,this.viewportFadeInEventHandler);this.documentOverlay.show();this.slider.fadeIn();this.addEventListeners();this.slider.setCurrentFullSizeImage(this.fullSizeImages[this.currentIndex]);this.isBusy=!1;this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShow)},setSliderPreviousAndNextFullSizeImages:function(){var a,b=null,c=null;this.fullSizeImages.length>1&&(a=this.fullSizeImages.length-1,this.currentIndex===a?(this.settings.loop&&
+(c=this.fullSizeImages[0]),b=this.fullSizeImages[this.currentIndex-1]):this.currentIndex===0?(c=this.fullSizeImages[this.currentIndex+1],this.settings.loop&&(b=this.fullSizeImages[a])):(c=this.fullSizeImages[this.currentIndex+1],b=this.fullSizeImages[this.currentIndex-1]));this.slider.setPreviousAndNextFullSizeImages(b,c)},onKeyDown:function(a){this.stopSlideshow();a.keyCode===37?(a.preventDefault(),this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.keyboard,this.showPrevious()):a.keyCode===
+39?(a.preventDefault(),this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.keyboard,this.showNext()):a.keyCode===38||a.keyCode===40?a.preventDefault():a.keyCode===27?(a.preventDefault(),this.hide()):a.keyCode===32&&(this.settings.hideToolbar?this.hide():this.toggleCaptionAndToolbar(),a.preventDefault())},onWindowOrientationChange:function(){this.resetPosition()},onWindowScroll:function(){this.resetPosition()},onWindowHashChange:function(){if(e.location.hash!=="#"+(this.settings.jQueryMobile?
+this.settings.jQueryMobileDialogHash:this.currentHistoryHashValue))this.backButtonClicked=!0,this.hide()},resetPosition:function(){this.removeZoomPanRotate();this.viewport.resetPosition();this.slider.resetPosition();this.documentOverlay.resetPosition();this.captionAndToolbar.resetPosition();this.dispatchEvent(Code.PhotoSwipe.EventTypes.onResetPosition)},canUserZoom:function(){if(!this.settings.allowUserZoom)return!1;if(this.isBusy)return!1;if(a.isNothing(this.slider.currentItem.fullSizeImage))return!1;
+if(!this.slider.currentItem.fullSizeImage.hasLoaded)return!1;return!0},isZoomActive:function(){return!a.isNothing(this.zoomPanRotate)},onViewportTouch:function(b){switch(b.action){case f.Actions.gestureStart:if(this.canUserZoom()){this.stopSlideshow();if(!this.isZoomActive())this.zoomPanRotate=new k({maxZoom:this.settings.maxUserZoom,minZoom:this.settings.minUserZoom,adjustPanToZoom:this.settings.adjustUserPanToZoom},this.viewport.el,this.slider.currentItem.imageEl),a.DOM.resetTranslate(this.zoomPanRotate.containerEl),
+a.DOM.resetTranslate(this.zoomPanRotate.imageEl);this.fadeOutCaptionAndToolbar()}break;case f.Actions.gestureChange:this.isZoomActive()&&this.zoomPanRotate.zoomRotate(b.scale,this.settings.allowRotationOnUserZoom?b.rotation:0);break;case f.Actions.gestureEnd:this.isZoomActive()&&this.zoomPanRotate.setStartingScaleAndRotation(b.scale,this.settings.allowRotationOnUserZoom?b.rotation:0);break;case f.Actions.touchStart:this.stopSlideshow();this.isZoomActive()&&this.zoomPanRotate.panStart(b.point);break;
+case f.Actions.touchMove:this.isZoomActive()&&this.zoomPanRotate.pan(b.point);break;case f.Actions.click:this.stopSlideshow();this.settings.hideToolbar?this.hide():this.toggleCaptionAndToolbar();this.dispatchEvent(Code.PhotoSwipe.EventTypes.onViewportClick);break;case f.Actions.swipeLeft:this.stopSlideshow();this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.swipe;this.showNext();break;case f.Actions.swipeRight:this.stopSlideshow(),this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.swipe,
+this.showPrevious()}},onViewportFadeOut:function(){this.viewport.removeEventListener(b.EventTypes.onFadeOut,this.viewportFadeOutEventHandler);this.isActive=this.isBusy=!1;this.dispatchEvent(Code.PhotoSwipe.EventTypes.onHide);this.goBackInHistory()},hide:function(){if(!this.isBusy&&!this.settings.preventHide&&this.isActive)this.isBusy=!0,this.removeZoomPanRotate(),this.removeEventListeners(),this.documentOverlay.hide(),this.captionAndToolbar.hide(),this.slider.hide(),a.DOM.removeClass(document.body,
+Code.PhotoSwipe.CssClasses.activeBody),this.viewport.addEventListener(b.EventTypes.onFadeOut,this.viewportFadeOutEventHandler),this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeHide),this.viewport.fadeOut()},hideImmediately:function(){if(this.isActive)this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeHide),this.removeZoomPanRotate(),this.removeEventListeners(),this.documentOverlay.hide(),this.captionAndToolbar.hide(),this.slider.hide(),this.viewport.hide(),a.DOM.removeClass(document.body,
+Code.PhotoSwipe.CssClasses.activeBody),this.isActive=this.isBusy=!1,this.dispatchEvent(Code.PhotoSwipe.EventTypes.onHide),this.goBackInHistory()},goBackInHistory:function(){this.isBackEventSupported&&this.settings.backButtonHideEnabled&&(this.backButtonClicked||e.history.back())},showNext:function(){if(!this.isBusy)this.isBusy=!0,this.cleanUpZoomPanRotateForNextPrevious(),this.setCaptionAndToolbarOnShowPreviousNext(),this.slider.showNext(),this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShowNext)},
+showPrevious:function(){if(!this.isBusy)this.isBusy=!0,this.cleanUpZoomPanRotateForNextPrevious(),this.setCaptionAndToolbarOnShowPreviousNext(),this.wasUserZoomActive&&a.DOM.hide(this.slider.currentItem.imageEl),this.slider.showPrevious(),this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShowPrevious)},cleanUpZoomPanRotateForNextPrevious:function(){a.isNothing(this.zoomPanRotate)||(this.settings.loop?a.DOM.hide(this.slider.currentItem.imageEl):this.currentIndex>0&&this.currentIndex=this.fullSizeImages.length-1?this.captionAndToolbar.setNextState(!0):this.captionAndToolbar.setNextState(!1),this.currentIndex<1?this.captionAndToolbar.setPreviousState(!0):this.captionAndToolbar.setPreviousState(!1));this.captionAndToolbar.setCaptionValue(this.fullSizeImages[this.currentIndex].caption);a=!1;switch(this.lastShowPrevTrigger){case Code.PhotoSwipe.ShowPrevTriggers.toolbar:a=
+!0;break;case Code.PhotoSwipe.ShowPrevTriggers.show:a=!0;break;case Code.PhotoSwipe.ShowPrevTriggers.slideshow:a=!1;break;default:a=!this.settings.captionAndToolbarHideOnSwipe}a&&(this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow),this.captionAndToolbar.fadeIn());this.dispatchEvent(Code.PhotoSwipe.EventTypes.onDisplayImage)}this.lastShowPrevTrigger="";this.setSliderPreviousAndNextFullSizeImages();this.isSlideshowActive&&this.fireSlideshowTimeout();this.isBusy=!1},toggleCaptionAndToolbar:function(){this.settings.captionAndToolbarHide?
+this.captionAndToolbar.hide():this.captionAndToolbar.isHidden?(this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow),this.captionAndToolbar.fadeIn()):(this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide),this.captionAndToolbar.fadeOut())},fadeOutCaptionAndToolbar:function(){!this.settings.captionAndToolbarHide&&!this.captionAndToolbar.isHidden&&(this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide),this.captionAndToolbar.fadeOut())},
+onToolbarClick:function(a){this.stopSlideshow();switch(a.action){case i.Actions.previous:this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.toolbar;this.showPrevious();break;case i.Actions.next:this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.toolbar;this.showNext();break;case i.Actions.play:this.startSlideshow();break;default:this.hide()}},startSlideshow:function(){if(!this.isBusy)a.isNothing(this.slideshowTimeout)||e.clearTimeout(this.slideshowTimeout),this.removeZoomPanRotate(),
+this.isSlideshowActive=!0,this.fadeOutCaptionAndToolbar(),this.fireSlideshowTimeout(),this.dispatchEvent(Code.PhotoSwipe.EventTypes.onSlideshowStart)},stopSlideshow:function(){a.isNothing(this.slideshowTimeout)||e.clearTimeout(this.slideshowTimeout);this.isSlideshowActive=!1;this.dispatchEvent(Code.PhotoSwipe.EventTypes.onSlideshowStop)},fireSlideshowTimeout:function(){var a=!1;this.settings.loop?this.fullSizeImages.length>1&&(a=!0):this.currentIndex' + type + '>');
+ retval.attr(attributes);
+ retval.append(content);
+
+ return retval[0];
+
+ },
+
+
+ /*
+ * Function: appendChild
+ */
+ appendChild: function(childEl, parentEl){
+
+ $(parentEl).append(childEl);
+
+ },
+
+
+ /*
+ * Function: appendText
+ */
+ appendText: function(text, parentEl){
+
+ $(parentEl).text(text);
+
+ },
+
+
+ /*
+ * Function: appendToBody
+ */
+ appendToBody: function(childEl){
+
+ $('body').append(childEl);
+
+ },
+
+
+ /*
+ * Function: removeChild
+ */
+ removeChild: function(childEl, parentEl){
+
+ $(childEl).empty().remove();
+
+ },
+
+
+
+ /*
+ * Function: removeChildren
+ */
+ removeChildren: function(parentEl){
+
+ $(parentEl).empty();
+
+ },
+
+
+
+ /*
+ * Function: hasAttribute
+ */
+ hasAttribute: function(el, attributeName){
+
+ return Util.isNothing( $(el).attr(attributeName) );
+
+ },
+
+
+ /*
+ * Function: getAttribute
+ */
+ getAttribute: function(el, attributeName){
+
+ return $(el).attr(attributeName);
+
+ },
+
+
+ /*
+ * Function: el, attributeName
+ */
+ setAttribute: function(el, attributeName, value){
+
+ $(el).attr(attributeName, value);
+
+ },
+
+
+ /*
+ * Function: removeAttribute
+ */
+ removeAttribute: function(el, attributeName){
+
+ $(el).removeAttr(attributeName);
+
+ },
+
+
+ /*
+ * Function: addClass
+ */
+ addClass: function(el, className){
+
+ $(el).addClass(className);
+
+ },
+
+
+ /*
+ * Function: removeClass
+ */
+ removeClass: function(el, className){
+
+ $(el).removeClass(className);
+
+ },
+
+
+ /*
+ * Function: hasClass
+ */
+ hasClass: function(el, className){
+
+ $(el).hasClass(className);
+
+ },
+
+
+ /*
+ * Function: setStyle
+ */
+ setStyle: function(el, style, value){
+
+ if (Util.isObject(style)) {
+ $(el).css(style);
+ }
+ else {
+ $(el).css(style, value);
+ }
+
+ },
+
+
+ /*
+ * Function: getStyle
+ */
+ getStyle: function(el, styleName){
+
+ return $(el).css(styleName);
+
+ },
+
+
+ /*
+ * Function: hide
+ */
+ hide: function(el){
+
+ $(el).hide();
+
+ },
+
+
+ /*
+ * Function: show
+ */
+ show: function(el){
+
+ $(el).show();
+
+ },
+
+
+ /*
+ * Function: width
+ * Content width, exludes padding
+ */
+ width: function(el, value){
+
+ if (!Util.isNothing(value)){
+ $(el).width(value);
+ }
+
+ return $(el).width();
+
+ },
+
+
+ /*
+ * Function: outerWidth
+ */
+ outerWidth: function(el){
+
+ return $(el).outerWidth();
+
+ },
+
+
+ /*
+ * Function: height
+ * Content height, excludes padding
+ */
+ height: function(el, value){
+
+ if (!Util.isNothing(value)){
+ $(el).height(value);
+ }
+
+ return $(el).height();
+
+ },
+
+
+ /*
+ * Function: outerHeight
+ */
+ outerHeight: function(el){
+
+ return $(el).outerHeight();
+
+ },
+
+
+ /*
+ * Function: documentWidth
+ */
+ documentWidth: function(){
+
+ return $(document.documentElement).width();
+
+ },
+
+
+ /*
+ * Function: documentHeight
+ */
+ documentHeight: function(){
+
+ return $(document.documentElement).height();
+
+ },
+
+
+ /*
+ * Function: bodyWidth
+ */
+ bodyWidth: function(){
+
+ return $(document.body).width();
+
+ },
+
+
+ /*
+ * Function: bodyHeight
+ */
+ bodyHeight: function(){
+
+ return $(document.body).height();
+
+ },
+
+
+ /*
+ * Function: windowWidth
+ */
+ windowWidth: function(){
+ //IE
+ if(!window.innerWidth) {
+ return $(window).width();
+ }
+ //w3c
+ return window.innerWidth;
+ },
+
+
+ /*
+ * Function: windowHeight
+ */
+ windowHeight: function(){
+ //IE
+ if(!window.innerHeight) {
+ return $(window).height();
+ }
+ //w3c
+ return window.innerHeight;
+ },
+
+
+ /*
+ * Function: windowScrollLeft
+ */
+ windowScrollLeft: function(){
+ //IE
+ if(!window.pageXOffset) {
+ return $(window).scrollLeft();
+ }
+ //w3c
+ return window.pageXOffset;
+ },
+
+
+ /*
+ * Function: windowScrollTop
+ */
+ windowScrollTop: function(){
+ //IE
+ if(!window.pageYOffset) {
+ return $(window).scrollTop();
+ }
+ //w3c
+ return window.pageYOffset;
+ },
+
+
+
+ /*
+ * Function: addEventListener
+ */
+ addEventListener: function(el, type, listener){
+
+ $(el).bind( type, listener );
+
+ },
+
+
+ /*
+ * Function: removeEventListener
+ */
+ removeEventListener: function(el, type, listener){
+
+ $(el).unbind( type, listener );
+
+ },
+
+
+ /*
+ * Function: getMousePosition
+ */
+ getMousePosition: function(event){
+
+ var retval = {
+ x: event.pageX,
+ y: event.pageY
+ };
+
+ return retval;
+ },
+
+
+ /*
+ * Function: getTouchEvent
+ */
+ getTouchEvent: function(event){
+
+ return event.originalEvent;
+
+ }
+
+ }
+
+
+ });
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function (window, Util) {
+
+ Util.extend(Util, {
+
+
+ Animation: {
+
+
+ /*
+ * Function: stopFade
+ */
+ stopFade: function(el){
+
+ $(el).stop(true, true);
+
+ },
+
+
+ /*
+ * Function: fadeIn
+ * Fades an element in.
+ * Make sure the element is displayed before calling
+ */
+ fadeIn: function(el, opacity, duration, callback){
+
+ opacity = Util.coalesce(opacity, 1);
+ duration = Util.coalesce(duration, 500);
+
+ $(el).fadeTo(duration, opacity, callback);
+
+ },
+
+
+ /*
+ * Function: fadeOut
+ * Fades an element out
+ * Make sure the element is displayed before calling
+ * Does not "hide" the element when animation is over
+ */
+ fadeOut: function(el, duration, callback){
+
+ if (Util.isNothing(duration)){
+ duration = 500;
+ }
+
+ $(el).fadeTo(duration, 0, callback);
+
+ },
+
+
+
+ /*
+ * Function: slideTo
+ * Slides an element by an x,y position
+ */
+ slideBy: function(el, xPos, yPos, duration, callback){
+
+ if (Util.isNothing(duration)){
+ duration = 500;
+ }
+
+ var animateProps;
+ if (jQuery.fn.translation){
+ animateProps = {
+ left: '+=' + xPos + 'px',
+ top: '+=' + yPos + 'px',
+ // Added for animate enhanced plugin
+ useTranslate3d: Util.browser.is3dSupported
+ };
+ }
+ else{
+ animateProps = {
+ left: '+=' + xPos + 'px',
+ top: '+=' + yPos + 'px'
+ };
+ }
+
+ $(el).animate(
+ animateProps,
+ duration,
+ callback
+ );
+
+ }
+
+ }
+
+ });
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function () {
+
+ // Based on http://www.javascriptbank.com/how-build-custom-events-javascript.html
+ Code.PhotoSwipe.EventClass = SimpleClass.extend({
+
+ _listeners: null,
+
+ init: function(){
+
+ this._listeners = {};
+
+ },
+
+
+ addEventListener: function(type, listener){
+
+ if (typeof this._listeners[type] === 'undefined'){
+ this._listeners[type] = [];
+ }
+ this._listeners[type].push(listener);
+
+ },
+
+
+ dispatchEvent: function(event){
+ if (typeof event == "string"){
+ event = { type: event };
+ }
+ if (!event.target){
+ event.target = this;
+ }
+
+ if (!event.type){
+ throw new Error("Event object missing 'type' property.");
+ }
+
+ if (this._listeners[event.type] instanceof Array){
+ var listeners = this._listeners[event.type];
+ for (var i=0, len=listeners.length; i < len; i++){
+ listeners[i].call(this, event);
+ }
+ }
+ },
+
+
+ removeEventListener: function(type, listener){
+ if (this._listeners[type] instanceof Array){
+ var listeners = this._listeners[type];
+ for (var i=0, len=listeners.length; i < len; i++){
+ if (listeners[i] === listener){
+ listeners.splice(i, 1);
+ break;
+ }
+ }
+ }
+ }
+
+ });
+
+
+})();
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function (window, Util) {
+
+ /*
+ * Class: Code.PhotoSwipe.ElementClass
+ * Most PhotoSwipe classes inherit from this class
+ * Provides hooks for fading in and out
+ */
+ Code.PhotoSwipe.ElementClass = Code.PhotoSwipe.EventClass.extend({
+
+ el: null,
+ settings: null,
+ isHidden: null,
+
+ fadeInHandler: null,
+ fadeOutHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options){
+
+ this._super();
+
+ this.settings = {
+ opacity: 1,
+ fadeInSpeed: 250,
+ fadeOutSpeed: 500
+ };
+
+ Util.extend(this.settings, options);
+
+ this.fadeInHandler = this.postFadeIn.bind(this);
+ this.fadeOutHandler = this.postFadeOut.bind(this);
+ this.isHidden = true;
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+ },
+
+
+
+ /*
+ * Function: show
+ */
+ show: function(){
+
+ this.stopFade();
+
+ // Show
+ Util.DOM.setStyle(this.el, 'opacity', this.settings.opacity);
+ Util.DOM.show(this.el);
+
+ this.postShow();
+
+ },
+
+
+
+ /*
+ * Function: postShow
+ * Overide this
+ */
+ postShow: function(){
+
+ this.isHidden = false;
+ this.addEventListeners();
+ this.dispatchEvent(Code.PhotoSwipe.ElementClass.EventTypes.onShow);
+
+ },
+
+
+
+ /*
+ * Function: fadeIn
+ */
+ fadeIn: function(){
+
+ Util.DOM.setStyle(this.el, 'opacity', 0);
+
+ this.fadeInFromCurrentOpacity();
+
+ },
+
+
+
+ /*
+ * Function: fadeInFromCurrentOpacity
+ */
+ fadeInFromCurrentOpacity: function(){
+
+ this.stopFade();
+
+ this.isHidden = false;
+
+ // Fade in
+ Util.DOM.show(this.el);
+ Util.Animation.fadeIn(
+ this.el,
+ this.settings.opacity,
+ this.settings.fadeInSpeed,
+ this.fadeInHandler
+ );
+
+ },
+
+
+
+ /*
+ * Function: postFadeIn
+ */
+ postFadeIn: function(e){
+
+ if (this.isHidden){
+ return;
+ }
+
+ this.addEventListeners();
+ this.dispatchEvent(Code.PhotoSwipe.ElementClass.EventTypes.onFadeIn);
+
+ },
+
+
+
+ /*
+ * Function: hide
+ */
+ hide: function(){
+
+ this.stopFade();
+
+ Util.DOM.hide(this.el);
+
+ this.postHide();
+
+ },
+
+
+ /*
+ * Function: postHide
+ * Overide this
+ */
+ postHide: function(){
+
+ this.isHidden = true;
+ this.removeEventListeners();
+ this.dispatchEvent(Code.PhotoSwipe.ElementClass.EventTypes.onHide);
+
+ },
+
+
+ /*
+ * Fuction: fadeOut
+ */
+ fadeOut: function(){
+
+ this.stopFade();
+
+ this.isHidden = true;
+
+ Util.Animation.fadeOut(this.el, this.settings.fadeOutSpeed, this.fadeOutHandler);
+
+ },
+
+
+
+
+ /*
+ * Function: preFadeOut
+ */
+ postFadeOut: function(e){
+
+ if (!this.isHidden){
+ return;
+ }
+
+ Util.DOM.hide(this.el);
+ this.removeEventListeners();
+
+ this.dispatchEvent(Code.PhotoSwipe.ElementClass.EventTypes.onFadeOut);
+
+ },
+
+
+
+ /*
+ * Function: stopFade
+ */
+ stopFade: function(){
+
+ Util.Animation.stopFade(this.el);
+
+ },
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ },
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ }
+
+
+ });
+
+
+
+ Code.PhotoSwipe.ElementClass.EventTypes = {
+ onShow: 'onShow',
+ onHide: 'onHide',
+ onClick: 'onClick',
+ onFadeIn: 'onFadeIn',
+ onFadeOut: 'onFadeOut'
+ };
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util){
+
+
+ /*
+ * Class: Code.PhotoSwipe.FullSizeImageClass
+ */
+ Code.PhotoSwipe.FullSizeImageClass = Code.PhotoSwipe.EventClass.extend({
+
+ el: null,
+ index: null,
+
+ // The naturalWidth and naturalHeight of the image as loaded from the server
+ // This maybe different from the width and height set on the img element
+ // We need this to scale the image correctly
+ naturalWidth: null,
+ naturalHeight: null,
+ src: null,
+ caption: null,
+ metaData: null,
+ scaleMethod: null,
+ isLandscape: null,
+ isLoading: null,
+ hasLoaded: null,
+
+ loadEventHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(index, scaleMethod, src, caption, metaData){
+
+ this._super();
+
+ this.index = index;
+ this.naturalWidth = 0;
+ this.naturalHeight = 0;
+ this.src = src;
+ this.caption = caption;
+ this.metaData = Util.coalesce(metaData, {});
+ this.isLandscape = false;
+ this.isLoading = false;
+ this.hasLoaded = false;
+ this.scaleMethod = scaleMethod;
+
+ this.loadEventHandler = this.onLoad.bind(this);
+
+ },
+
+
+ /*
+ * Function: load
+ */
+ load: function(){
+
+ // Load in the image
+ this.isLoading = true;
+
+ this.el = new Image();
+ Util.DOM.addClass(this.el, 'ps-full-size-image');
+ this.el.onload = this.loadEventHandler;
+ this.el.src = this.src;
+
+ },
+
+
+ /*
+ * Function: onLoad
+ */
+ onLoad: function(){
+
+ this.naturalWidth = Util.coalesce(this.el.naturalWidth, this.el.width);
+ this.naturalHeight = Util.coalesce(this.el.naturalHeight, this.el.height);
+ this.isLandscape = (this.naturalWidth > this.naturalHeight);
+ this.isLoading = false;
+ this.hasLoaded = true;
+
+ this.dispatchEvent(Code.PhotoSwipe.FullSizeImageClass.EventTypes.onLoad);
+
+ }
+
+
+ });
+
+
+ Code.PhotoSwipe.FullSizeImageClass.EventTypes = {
+ onLoad: 'onLoad'
+ };
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util){
+
+ /*
+ * Class: Code.PhotoSwipe.DocumentOverlayClass
+ */
+ Code.PhotoSwipe.DocumentOverlayClass = Code.PhotoSwipe.ElementClass.extend({
+
+ /*
+ * Function: init
+ */
+ init: function(options){
+
+ this.settings = {
+ zIndex: 1000
+ };
+
+ Util.extend(this.settings, options);
+
+ this._super(options);
+
+ // Create element and append to body
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.DocumentOverlayClass.CssClasses.documentOverlay }, '');
+ Util.DOM.setStyle(this.el, {
+ left: 0,
+ position: 'absolute',
+ zIndex: this.settings.zIndex,
+ top: 0
+ });
+ Util.DOM.hide(this.el);
+ Util.DOM.appendToBody(this.el);
+
+ },
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ // Set the height and width to fill the document
+ Util.DOM.width(this.el, Util.DOM.bodyWidth());
+ Util.DOM.height(this.el, Util.DOM.bodyHeight());
+
+ }
+
+ });
+
+
+ Code.PhotoSwipe.DocumentOverlayClass.CssClasses = {
+ documentOverlay: 'ps-document-overlay'
+ };
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util){
+
+ /*
+ * Class: Code.PhotoSwipe.ViewportClass
+ */
+ Code.PhotoSwipe.ViewportClass = Code.PhotoSwipe.ElementClass.extend({
+
+ touchStartPoint: null,
+
+ touchStartTime: null,
+ touchStartHandler: null,
+ touchMoveHandler: null,
+ touchEndHandler: null,
+
+ gestureStartHandler: null,
+ gestureChangeHandler: null,
+ gestureEndHandler: null,
+
+ isGesture: null,
+
+ mouseDownHandler: null,
+ mouseUpHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options){
+
+ this.settings = {
+ swipeThreshold: 500,
+ swipeTimeThreshold: 250,
+ zIndex: 1000
+ };
+
+ Util.extend(this.settings, options);
+
+ this._super(this.settings);
+
+ this.touchStartPoint = { x: 0, y: 0 };
+
+ if (Util.browser.touchSupported){
+ this.touchStartHandler = this.onTouchStart.bind(this);
+ this.touchMoveHandler = this.onTouchMove.bind(this);
+ this.touchEndHandler = this.onTouchEnd.bind(this);
+ }
+
+ if (Util.browser.gestureSupported){
+ this.gestureStartHandler = this.onGestureStart.bind(this);
+ this.gestureChangeHandler = this.onGestureChange.bind(this);
+ this.gestureEndHandler = this.onGestureEnd.bind(this);
+ }
+
+ this.mouseDownHandler = this.onMouseDown.bind(this);
+ this.mouseUpHandler = this.onMouseUp.bind(this);
+
+ // Create element and append to body
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ViewportClass.CssClasses.viewport, 'data-role': 'dialog' }, '');
+ Util.DOM.setStyle(this.el, {
+ position: 'absolute',
+ left: 0,
+ zIndex: this.settings.zIndex,
+ overflow: 'hidden'
+ });
+ Util.DOM.hide(this.el);
+ Util.DOM.appendToBody(this.el);
+
+ },
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ // Set the height and width to fill the document
+ Util.DOM.setStyle(this.el, {
+ top: Util.DOM.windowScrollTop() + 'px'
+ });
+
+ Util.DOM.width(this.el, Util.DOM.bodyWidth());
+ Util.DOM.height(this.el, Util.DOM.windowHeight());
+
+ },
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ if (Util.browser.touchSupported){
+ Util.DOM.addEventListener(this.el, 'touchstart', this.touchStartHandler);
+ Util.DOM.addEventListener(this.el, 'touchmove', this.touchMoveHandler);
+ Util.DOM.addEventListener(this.el, 'touchend', this.touchEndHandler);
+ }
+
+ if (Util.browser.gestureSupported){
+ Util.DOM.addEventListener(this.el, 'gesturestart', this.gestureStartHandler);
+ Util.DOM.addEventListener(this.el, 'gesturechange', this.gestureChangeHandler);
+ Util.DOM.addEventListener(this.el, 'gestureend', this.gestureEndHandler);
+ }
+
+ Util.DOM.addEventListener(this.el, 'mousedown', this.mouseDownHandler);
+ Util.DOM.addEventListener(this.el, 'mouseup', this.mouseUpHandler);
+
+ },
+
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ if (Util.browser.touchSupported){
+ Util.DOM.removeEventListener(this.el, 'touchstart', this.touchStartHandler);
+ Util.DOM.removeEventListener(this.el, 'touchmove', this.touchMoveHandler);
+ Util.DOM.removeEventListener(this.el, 'touchend', this.touchEndHandler);
+ }
+
+ if (Util.browser.gestureSupported){
+ Util.DOM.removeEventListener(this.el, 'gesturestart', this.gestureStartHandler);
+ Util.DOM.removeEventListener(this.el, 'gesturechange', this.gestureChangeHandler);
+ Util.DOM.removeEventListener(this.el, 'gestureend', this.gestureEndHandler);
+ }
+
+ Util.DOM.removeEventListener(this.el, 'mousedown', this.mouseDownHandler);
+ Util.DOM.removeEventListener(this.el, 'mouseup', this.mouseUpHandler);
+
+ },
+
+
+
+ /*
+ * Function: getTouchPoint
+ */
+ getTouchPoint: function(touches){
+
+ return {
+ x: touches[0].pageX,
+ y: touches[0].pageY
+ };
+
+ },
+
+
+ /*
+ * Function: onGestureStart
+ */
+ onGestureStart: function(e){
+
+ e.preventDefault();
+
+ var touchEvent = Util.DOM.getTouchEvent(e);
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.gestureStart,
+ scale: touchEvent.scale,
+ rotation: touchEvent.rotation
+ });
+
+ },
+
+
+ /*
+ * Function: onGestureChange
+ */
+ onGestureChange: function(e){
+
+ e.preventDefault();
+
+ var touchEvent = Util.DOM.getTouchEvent(e);
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.gestureChange,
+ scale: touchEvent.scale,
+ rotation: touchEvent.rotation
+ });
+
+ },
+
+
+ /*
+ * Function: onGestureEnd
+ */
+ onGestureEnd: function(e){
+
+ e.preventDefault();
+
+ var touchEvent = Util.DOM.getTouchEvent(e);
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.gestureEnd,
+ scale: touchEvent.scale,
+ rotation: touchEvent.rotation
+ });
+
+ },
+
+
+ /*
+ * Function: onTouch
+ */
+ onTouchStart: function(e){
+
+ e.preventDefault();
+
+ var
+ touchEvent = Util.DOM.getTouchEvent(e),
+ touches = touchEvent.touches;
+
+ if (touches.length > 1){
+ this.isGesture = true;
+ return;
+ }
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.touchStart,
+ point: this.getTouchPoint(touches)
+ });
+
+
+ this.touchStartTime = new Date();
+ this.isGesture = false;
+ this.touchStartPoint = this.getTouchPoint(touches);
+
+ },
+
+
+
+ /*
+ * Function: onTouchMove
+ * For some reason, even though it's not a requirement,
+ * if we don't listen out for the touchmove event,
+ * we are unable to detect the swipe on Blackberry6
+ */
+ onTouchMove: function(e){
+
+ e.preventDefault();
+
+ if (this.isGesture){
+ return;
+ }
+
+ var
+ touchEvent = Util.DOM.getTouchEvent(e),
+ touches = touchEvent.touches;
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.touchMove,
+ point: this.getTouchPoint(touches)
+ });
+
+ },
+
+
+
+ /*
+ * Function: onTouchEnd
+ */
+ onTouchEnd: function(e){
+
+ e.preventDefault();
+
+ if (this.isGesture){
+ return;
+ }
+
+ // http://backtothecode.blogspot.com/2009/10/javascript-touch-and-gesture-events.html
+ // iOS removed the current touch from e.touches on "touchend"
+ // Need to look into e.changedTouches
+
+ var
+ touchEvent = Util.DOM.getTouchEvent(e),
+ touches = (!Util.isNothing(touchEvent.changedTouches)) ? touchEvent.changedTouches : touchEvent.touches,
+ touchEndPoint = this.getTouchPoint(touches);
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: Code.PhotoSwipe.ViewportClass.Actions.touchEnd,
+ point: touchEndPoint
+ });
+
+ this.fireTouchEvent(this.touchStartPoint, touchEndPoint);
+
+ },
+
+
+
+ /*
+ * Function: onMouseDown
+ */
+ onMouseDown: function(e){
+
+ e.preventDefault();
+
+ this.touchStartTime = new Date();
+ this.isGesture = false;
+ this.touchStartPoint = Util.DOM.getMousePosition(e);
+
+ },
+
+
+
+ /*
+ * Function: onMouseUp
+ */
+ onMouseUp: function(e){
+
+ e.preventDefault();
+ this.fireTouchEvent(this.touchStartPoint, Util.DOM.getMousePosition(e));
+
+ },
+
+
+
+ /*
+ * Function: fireTouchEvent
+ */
+ fireTouchEvent: function(touchStartPoint, touchEndPoint){
+
+ var action;
+
+ var
+ endTime = new Date(),
+ diffTime = endTime - this.touchStartTime;
+
+ if (diffTime > this.settings.swipeTimeThreshold){
+ return;
+ }
+
+ var distance = touchEndPoint.x - touchStartPoint.x;
+
+ if (Math.abs(distance) >= this.settings.swipeThreshold){
+
+ if (distance < 0){
+
+ // Swipe left
+ action = Code.PhotoSwipe.ViewportClass.Actions.swipeLeft;
+
+ }
+ else{
+
+ // Swipe right
+ action = Code.PhotoSwipe.ViewportClass.Actions.swipeRight;
+
+ }
+
+ }
+ else{
+
+ // Click
+ action = Code.PhotoSwipe.ViewportClass.Actions.click;
+
+ }
+
+ if (Util.isNothing(action)){
+ return;
+ }
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+ target: this,
+ action: action
+ });
+
+ }
+
+ });
+
+
+ Code.PhotoSwipe.ViewportClass.CssClasses = {
+ viewport: 'ps-viewport'
+ };
+
+
+ Code.PhotoSwipe.ViewportClass.Actions = {
+ click: 'click',
+ swipeLeft: 'swipeLeft',
+ swipeRight: 'swipeRight',
+ touchStart: 'touchStart',
+ touchMove: 'touchMove',
+ touchEnd: 'touchEnd',
+ gestureStart: 'gestureStart',
+ gestureChange: 'gestureChange',
+ gestureEnd: 'gestureEnd'
+ };
+
+
+ Code.PhotoSwipe.ViewportClass.EventTypes = {
+ onTouch: 'onTouch'
+ };
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util, FullSizeImageClass){
+
+ /*
+ * Class: Code.PhotoSwipe.SliderItemClass
+ */
+ Code.PhotoSwipe.SliderItemClass = Code.PhotoSwipe.EventClass.extend({
+
+ el: null,
+ imageContainerEl: null,
+ imageEl: null,
+ parentEl: null,
+ fullSizeImage: null,
+
+ fullSizeImageLoadEventHandler: null,
+
+ savedImageWidth: null,
+ savedImageHeight: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(parentEl){
+
+ this._super();
+
+ this.parentEl = parentEl;
+
+ this.fullSizeImageLoadEventHandler = this.onFullSizeImageLoad.bind(this);
+
+ // Create element and append to parentEl
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.SliderItemClass.CssClasses.item + ' ' + Code.PhotoSwipe.SliderItemClass.CssClasses.loading }, '');
+ Util.DOM.setStyle(this.el, {
+ position: 'absolute',
+ overflow: 'hidden',
+ top: 0
+ });
+ Util.DOM.resetTranslate(this.el);
+ Util.DOM.appendChild(this.el, this.parentEl);
+
+ this.imageContainerEl = Util.DOM.createElement('div');
+ Util.DOM.setStyle(this.imageContainerEl, {
+ position: 'absolute',
+ overflow: 'hidden',
+ top: 0,
+ left: 0
+ });
+ Util.DOM.appendChild(this.imageContainerEl, this.el);
+
+ // Create image element and append to slider item
+ this.imageEl = new Image();
+ Util.DOM.setStyle(this.imageEl, {
+ display: 'block',
+ position: 'absolute',
+ margin: 0,
+ padding: 0
+ });
+ Util.DOM.hide(this.imageEl);
+ Util.DOM.appendChild(this.imageEl, this.imageContainerEl);
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(width, height, xPos){
+
+ Util.DOM.width(this.el, width);
+ Util.DOM.height(this.el, height);
+ Util.DOM.setStyle(this.el, 'left', xPos + 'px');
+
+ Util.DOM.width(this.imageContainerEl, width);
+ Util.DOM.height(this.imageContainerEl, height);
+
+ this.resetImagePosition();
+
+ },
+
+
+
+ /*
+ * Function: resetImagePosition
+ */
+ resetImagePosition: function(){
+
+ if (Util.isNothing(this.fullSizeImage)){
+ return;
+ }
+
+ var src = Util.DOM.getAttribute(this.imageEl, 'src');
+
+ var
+ scale,
+ newWidth,
+ newHeight,
+ newTop,
+ newLeft,
+ maxWidth = Util.DOM.width(this.el),
+ maxHeight = Util.DOM.height(this.el);
+
+ if (this.fullSizeImage.isLandscape) {
+ // Ensure the width fits the screen
+ scale = maxWidth / this.fullSizeImage.naturalWidth;
+ }
+ else {
+ // Ensure the height fits the screen
+ scale = maxHeight / this.fullSizeImage.naturalHeight;
+ }
+
+ newWidth = Math.round(this.fullSizeImage.naturalWidth * scale);
+ newHeight = Math.round(this.fullSizeImage.naturalHeight * scale);
+
+ if (this.fullSizeImage.scaleMethod === 'zoom'){
+
+ scale = 1;
+ if (newHeight < maxHeight){
+ scale = maxHeight /newHeight;
+ }
+ else if (newWidth < maxWidth){
+ scale = maxWidth /newWidth;
+ }
+
+ if (scale !== 1) {
+ newWidth = Math.round(newWidth * scale);
+ newHeight = Math.round(newHeight * scale);
+ }
+
+ }
+ else if (this.fullSizeImage.scaleMethod === 'fit') {
+ // Rescale again to ensure full image fits into the viewport
+ scale = 1;
+ if (newWidth > maxWidth) {
+ scale = maxWidth / newWidth;
+ }
+ else if (newHeight > maxHeight) {
+ scale = maxHeight / newHeight;
+ }
+ if (scale !== 1) {
+ newWidth = Math.round(newWidth * scale);
+ newHeight = Math.round(newHeight * scale);
+ }
+ }
+
+ newTop = ((maxHeight - newHeight) / 2) + 'px';
+ newLeft = ((maxWidth - newWidth) / 2) + 'px';
+
+ Util.DOM.width(this.imageEl, newWidth);
+ Util.DOM.height(this.imageEl, newHeight);
+ Util.DOM.setStyle(this.imageEl, {
+ top: newTop,
+ left: newLeft
+ });
+
+ Util.DOM.show(this.imageEl);
+
+ this.savedImageWidth = newWidth;
+ this.savedImageHeight = newHeight;
+ },
+
+
+
+ /*
+ * Function: setFullSizeImage
+ */
+ setFullSizeImage: function(fullSizeImage){
+
+ this.fullSizeImage = fullSizeImage;
+
+ Util.DOM.removeClass(this.el, Code.PhotoSwipe.SliderItemClass.CssClasses.loading);
+ Util.DOM.removeClass(this.el, Code.PhotoSwipe.SliderItemClass.CssClasses.imageError);
+
+ // Something is wrong!
+ if (Util.isNothing(this.fullSizeImage)) {
+ this.fullSizeImage = null;
+ Util.DOM.addClass(this.el, Code.PhotoSwipe.SliderItemClass.CssClasses.imageError);
+ this.hideImage();
+ return;
+ }
+
+ // Still loading
+ if (!this.fullSizeImage.hasLoaded) {
+
+ Util.DOM.addClass(this.el, Code.PhotoSwipe.SliderItemClass.CssClasses.loading);
+ this.hideImage();
+
+ if (!this.fullSizeImage.isLoading){
+
+ // Trigger off the load
+ this.fullSizeImage.addEventListener(
+ FullSizeImageClass.EventTypes.onLoad,
+ this.fullSizeImageLoadEventHandler
+ );
+
+
+ this.fullSizeImage.load();
+
+ }
+
+ return;
+
+ }
+
+ // Loaded so show the image
+ Util.DOM.setAttribute(this.imageEl, 'src', this.fullSizeImage.src);
+
+ this.resetImagePosition();
+
+ this.dispatchEvent(Code.PhotoSwipe.SliderItemClass.EventTypes.onFullSizeImageDisplay);
+
+ },
+
+
+ /*
+ * Function: onFullSizeImageLoad
+ */
+ onFullSizeImageLoad: function(e){
+
+ e.target.removeEventListener(FullSizeImageClass.EventTypes.onLoad, this.fullSizeImageLoadEventHandler);
+
+ if (Util.isNothing(this.fullSizeImage) || e.target.index !== this.fullSizeImage.index){
+ // Chances are the user has moved the slider
+ // and the image to display in the item has now changed
+ // from when the item originally called the fullSizeImage
+ // to load. If that's the case, rethrow the event, the
+ // slider will be listening for this and can find a
+ // relevant slideitem for the loaded image
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.SliderItemClass.EventTypes.onFullSizeImageLoadAnomaly,
+ target: this,
+ fullSizeImage: e.target
+ });
+ }
+ else{
+ this.setFullSizeImage(e.target);
+ }
+
+ },
+
+
+ /*
+ * Function: hideImage
+ */
+ hideImage: function(){
+
+ Util.DOM.removeAttribute(this.imageEl, 'src');
+ Util.DOM.hide(this.imageEl);
+
+ }
+
+
+ });
+
+
+ Code.PhotoSwipe.SliderItemClass.CssClasses = {
+ item: 'ps-slider-item',
+ loading: 'ps-slider-item-loading',
+ imageError: 'ps-slider-item-image-error'
+ };
+
+
+ Code.PhotoSwipe.SliderItemClass.EventTypes = {
+ onFullSizeImageDisplay: 'onFullSizeImageDisplay',
+ onFullSizeImageLoadAnomaly: 'onFullSizeImageLoadAnomaly'
+ };
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util,
+ Code.PhotoSwipe.FullSizeImageClass
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util, SliderItemClass){
+
+ /*
+ * Class: Code.PhotoSwipe.SliderClass
+ */
+ Code.PhotoSwipe.SliderClass = Code.PhotoSwipe.ElementClass.extend({
+
+ parentEl: null,
+ parentElWidth: null,
+ parentElHeight: null,
+ items: null,
+ scaleEl: null,
+
+ lastScaleValue: null,
+
+ previousItem: null,
+ currentItem: null,
+ nextItem: null,
+
+ hasBounced: null,
+ lastShowAction: null,
+ bounceSlideBy: null,
+
+ showNextEndEventHandler: null,
+ showPreviousEndEventHandler: null,
+ bounceStepOneEventHandler: null,
+ bounceStepTwoEventHandler: null,
+
+ sliderFullSizeImageLoadAnomalyEventHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options, parentEl){
+
+ this.settings = {
+ slideSpeed: 250
+ };
+
+ Util.extend(this.settings, options);
+
+ this._super(this.settings);
+
+ this.parentEl = parentEl;
+
+ this.hasBounced = false;
+
+ this.showNextEndEventHandler = this.onShowNextEnd.bind(this);
+ this.showPreviousEndEventHandler = this.onShowPreviousEnd.bind(this);
+ this.bounceStepOneEventHandler = this.onBounceStepOne.bind(this);
+ this.bounceStepTwoEventHandler = this.onBounceStepTwo.bind(this);
+
+ this.sliderFullSizeImageLoadAnomalyEventHandler = this.onSliderFullSizeImageLoadAnomaly.bind(this);
+
+ // Create element and append to body
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.SliderClass.CssClasses.slider }, '');
+ Util.DOM.setStyle(this.el, {
+ position: 'absolute',
+ top: 0
+ });
+ Util.DOM.hide(this.el);
+ Util.DOM.appendChild(this.el, parentEl);
+
+ // Create previousItem, currentItem, nextItem
+ this.items = [];
+ this.items.push(new SliderItemClass(this.el));
+ this.items.push(new SliderItemClass(this.el));
+ this.items.push(new SliderItemClass(this.el));
+
+ this.previousItem = this.items[0];
+ this.currentItem = this.items[1];
+ this.nextItem = this.items[2];
+
+ },
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ for (var i = 0; i');
+
+ if (this.settings.hideClose){
+ Util.DOM.hide(this.closeEl);
+ }
+ Util.DOM.appendChild(this.closeEl, this.el);
+
+ // Play
+ this.playEl = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ToolbarClass.CssClasses.play }, '
');
+ Util.DOM.appendChild(this.playEl, this.el);
+
+ // Previous
+ this.previousEl = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ToolbarClass.CssClasses.previous }, '
');
+ Util.DOM.appendChild(this.previousEl, this.el);
+
+ // Next
+ this.nextEl = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ToolbarClass.CssClasses.next }, '
');
+ Util.DOM.appendChild(this.nextEl, this.el);
+
+ },
+
+
+ /*
+ * Function: postFadeIn
+ */
+ postFadeIn: function(e){
+
+ if (this.isHidden){
+ return;
+ }
+
+ Util.DOM.setStyle(this.el, { display: 'table' });
+
+ this._super(this.settings);
+
+ },
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ if (Util.browser.touchSupported){
+ // Had an issue with touchstart, animation and Blackberry. BB will default to click
+ if (!Util.browser.isBlackberry){
+ Util.DOM.addEventListener(this.el, 'touchstart', this.touchStartHandler);
+ }
+ Util.DOM.addEventListener(this.el, 'touchmove', this.touchMoveHandler);
+ }
+
+ Util.DOM.addEventListener(this.el, 'click', this.clickHandler);
+
+ },
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ if (Util.browser.touchSupported){
+ if (!Util.browser.isBlackberry){
+ Util.DOM.removeEventListener(this.el, 'touchstart', this.touchStartHandler);
+ }
+ Util.DOM.removeEventListener(this.el, 'touchmove', this.touchMoveHandler);
+ }
+ Util.DOM.removeEventListener(this.el, 'click', this.clickHandler);
+
+ },
+
+
+ /*
+ * Function: onTouchStart
+ */
+ onTouchStart: function(e){
+
+ e.preventDefault();
+
+ this.touched = true;
+ this.handleClick(e);
+
+ },
+
+
+ /*
+ * Function: onTouchMove
+ */
+ onTouchMove: function(e){
+
+ e.preventDefault();
+
+ },
+
+
+ /*
+ * Function: onClick
+ */
+ onClick: function(e){
+
+ if (this.touched){
+ return;
+ }
+
+ this.handleClick(e);
+
+ },
+
+
+
+ /*
+ * Function: handleClick
+ */
+ handleClick: function(e){
+
+ var action;
+
+ switch(e.target.parentNode){
+
+ case this.previousEl:
+ if (this.isPreviousActive){
+ action = Code.PhotoSwipe.ToolbarClass.Actions.previous;
+ }
+ break;
+
+ case this.nextEl:
+ if (this.isNextActive){
+ action = Code.PhotoSwipe.ToolbarClass.Actions.next;
+ }
+ break;
+
+ case this.playEl:
+ action = Code.PhotoSwipe.ToolbarClass.Actions.play;
+ break;
+
+ case this.closeEl:
+ action = Code.PhotoSwipe.ToolbarClass.Actions.close;
+ break;
+ }
+
+ if (Util.isNothing(action)){
+ return;
+ }
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ToolbarClass.EventTypes.onClick,
+ target: this,
+ action: action
+ });
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ var top;
+
+ if (this.settings.position === 'bottom') {
+ top = Util.DOM.windowHeight() - Util.DOM.outerHeight(this.el) + Util.DOM.windowScrollTop();
+ }
+ else {
+ top = Util.DOM.windowScrollTop();
+ }
+
+ Util.DOM.setStyle(this.el, 'top', top + 'px');
+ Util.DOM.width(this.el, Util.DOM.bodyWidth());
+
+ },
+
+
+
+ /*
+ * Function: setNextState
+ */
+ setNextState: function (disable) {
+
+ if (disable) {
+ Util.DOM.addClass(this.nextEl, Code.PhotoSwipe.ToolbarClass.CssClasses.nextDisabled);
+ this.isNextActive = false;
+ }
+ else {
+ Util.DOM.removeClass(this.nextEl, Code.PhotoSwipe.ToolbarClass.CssClasses.nextDisabled);
+ this.isNextActive = true;
+ }
+
+ },
+
+
+ /*
+ * Function: setPreviousState
+ */
+ setPreviousState: function (disable) {
+
+ if (disable) {
+ Util.DOM.addClass(this.previousEl, Code.PhotoSwipe.ToolbarClass.CssClasses.previousDisabled);
+ this.isPreviousActive = false;
+ }
+ else {
+ Util.DOM.removeClass(this.previousEl, Code.PhotoSwipe.ToolbarClass.CssClasses.previousDisabled);
+ this.isPreviousActive = true;
+ }
+
+ }
+
+ });
+
+
+
+ Code.PhotoSwipe.ToolbarClass.CssClasses = {
+ caption: 'ps-toolbar',
+ top: 'ps-toolbar-top',
+ close: 'ps-toolbar-close',
+ previous: 'ps-toolbar-previous',
+ previousDisabled: 'ps-toolbar-previous-disabled',
+ next: 'ps-toolbar-next',
+ nextDisabled: 'ps-toolbar-next-disabled',
+ play: 'ps-toolbar-play',
+ content: 'ps-toolbar-content'
+ };
+
+
+
+ Code.PhotoSwipe.ToolbarClass.Actions = {
+ close: 'close',
+ previous: 'previous',
+ next: 'next',
+ play: 'play'
+ };
+
+
+ Code.PhotoSwipe.ToolbarClass.EventTypes = {
+ onClick: 'onClick'
+ };
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+ // PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util, CaptionClass, ToolbarClass){
+
+ /*
+ * Class: Code.PhotoSwipe.CaptionToolbarClass
+ */
+ Code.PhotoSwipe.CaptionToolbarClass = Code.PhotoSwipe.EventClass.extend({
+
+ toolbar: null,
+ caption: null,
+
+ isHidden: null,
+
+ hasAddedEventListeners: null,
+
+ toolbarClickEventHandler: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options){
+
+ this._super();
+
+ this.settings = {
+ opacity: 0.8,
+ fadeInSpeed: 250,
+ fadeOutSpeed: 500,
+ autoHideDelay: 5000,
+ flipPosition: false,
+ showEmptyCaptions: true,
+ hideClose: false,
+ zIndex: 1000
+ };
+
+ Util.extend(this.settings, options);
+
+ this.isHidden = true;
+ this.hasAddedEventListeners = false;
+
+ this.toolbarClickEventHandler = this.onToolbarClick.bind(this);
+
+ this.caption = new CaptionClass({
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ opacity: this.settings.opacity,
+ position: (this.settings.flipPosition) ? 'bottom' : 'top',
+ zIndex: this.settings.zIndex
+ });
+
+
+ this.toolbar = new ToolbarClass({
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ opacity: this.settings.opacity,
+ position: (this.settings.flipPosition) ? 'top' : 'bottom',
+ hideClose: this.settings.hideClose,
+ zIndex: this.settings.zIndex+1
+ });
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ this.caption.resetPosition();
+ this.toolbar.resetPosition();
+
+ },
+
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ if (this.hasAddedEventListeners){
+ return;
+ }
+
+ this.toolbar.addEventListener(ToolbarClass.EventTypes.onClick, this.toolbarClickEventHandler);
+
+ this.hasAddedEventListeners = true;
+
+ },
+
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ this.toolbar.removeEventListener(ToolbarClass.EventTypes.onClick, this.toolbarClickEventHandler);
+ this.hasAddedEventListeners = false;
+
+ },
+
+
+
+ /*
+ * Function: fadeIn
+ */
+ fadeIn: function(){
+
+ this.stopAutoHideTimeout();
+ this.stopFade();
+
+ if (this.isHidden){
+
+ this.isHidden = false;
+
+ // Already hidden so fade in
+ this.fadeInCaption();
+
+ this.toolbar.fadeIn();
+
+ window.setTimeout(
+ this.onFadeIn.bind(this),
+ this.settings.fadeInSpeed
+ );
+
+ }
+ else{
+
+ // Not hidden, just check caption is visible
+ if (this.caption.isHidden){
+ this.fadeInCaption();
+ }
+
+ // Reset the autoHideTimeout
+ this.resetAutoHideTimeout();
+
+ }
+
+ },
+
+
+
+ showCaption: function(){
+
+ if (this.caption.captionValue === ''){
+
+ // Caption is empty
+ if (this.settings.showEmptyCaptions){
+ this.caption.show();
+ }
+
+ }
+ else{
+ this.caption.show();
+ }
+
+ },
+
+
+
+ /*
+ * Function: fadeInCaption
+ */
+ fadeInCaption: function(){
+
+ if (this.caption.captionValue === ''){
+ // Caption is empty
+ if (this.settings.showEmptyCaptions){
+ this.caption.fadeIn();
+ }
+ }
+ else{
+ this.caption.fadeIn();
+ }
+
+ },
+
+
+
+ /*
+ * Function: onFadeIn
+ */
+ onFadeIn: function(){
+
+ this.addEventListeners();
+ this.resetAutoHideTimeout();
+
+ },
+
+
+
+ /*
+ * Function: fadeOut
+ */
+ fadeOut: function(){
+
+ this.stopAutoHideTimeout();
+ this.stopFade();
+
+ this.isHidden = true;
+
+ this.caption.fadeOut();
+ this.toolbar.fadeOut();
+
+ window.setTimeout(
+ this.onFadeOut.bind(this),
+ this.settings.fadeOutSpeed
+ );
+
+ },
+
+
+ /*
+ * Function: onFadeOut
+ */
+ onFadeOut: function(){
+ },
+
+
+
+ /*
+ * Function: stopFade
+ */
+ stopFade: function(){
+
+ this.caption.stopFade();
+ this.toolbar.stopFade();
+
+ },
+
+
+ /*
+ * Function: hide
+ */
+ hide: function(){
+
+ this.stopAutoHideTimeout();
+ this.stopFade();
+
+ this.isHidden = true;
+ this.removeEventListeners();
+
+ this.caption.hide();
+ this.toolbar.hide();
+
+ },
+
+
+
+ /*
+ * Function: setCaptionValue
+ */
+ setCaptionValue: function(captionValue){
+
+ this.caption.setCaptionValue(captionValue);
+
+ if (this.caption.captionValue === '' && !this.settings.showEmptyCaptions){
+ // The caption is empty and we don't want to show empty caption
+ this.caption.fadeOut();
+ }
+
+
+ },
+
+
+
+ /*
+ * Function: resetAutoHideTimeout
+ */
+ resetAutoHideTimeout: function(){
+
+ if (this.isHidden){
+ return;
+ }
+
+ this.stopAutoHideTimeout();
+
+ if (this.settings.autoHideDelay > 0){
+
+ this.autoHideTimeout = window.setTimeout(
+ this.fadeOut.bind(this),
+ this.settings.autoHideDelay
+ );
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: stopAutoHideTimeout
+ */
+ stopAutoHideTimeout: function(){
+
+ if (!Util.isNothing(this.autoHideTimeout)){
+ window.clearTimeout(this.autoHideTimeout);
+ }
+
+ },
+
+
+
+ /*
+ * Function: onToolbarClick
+ */
+ onToolbarClick: function(e){
+
+ this.dispatchEvent({
+ type: Code.PhotoSwipe.ToolbarClass.EventTypes.onClick,
+ target: this,
+ action: e.action
+ });
+
+ },
+
+
+
+ /*
+ * Function: setNextState
+ */
+ setNextState: function (disable) {
+
+ this.toolbar.setNextState(disable);
+
+ },
+
+
+
+ /*
+ * Function: setPreviousState
+ */
+ setPreviousState: function (disable) {
+
+ this.toolbar.setPreviousState(disable);
+
+ }
+
+
+ });
+
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util,
+ Code.PhotoSwipe.CaptionClass,
+ Code.PhotoSwipe.ToolbarClass
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util){
+
+ /*
+ * Class: Code.PhotoSwipe.ZoomPanRotateClass
+ */
+ Code.PhotoSwipe.ZoomPanRotateClass = Code.PhotoSwipe.ElementClass.extend({
+
+ containerEl: null,
+ imageEl: null,
+ parentEl: null,
+ transformSettings: null,
+ panStartingPoint: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(options, parentEl, imageEl){
+
+ this.settings = {
+ maxZoom: 5.0,
+ minZoom: 0.5,
+ adjustPanToZoom: true
+ };
+
+ Util.extend(this.settings, options);
+
+ this._super(options);
+
+ this.parentEl = parentEl;
+ this.imageEl = imageEl.cloneNode(false);
+
+ this.transformSettings = {
+
+ startingScale: 1.0,
+ scale: 1.0,
+ startingRotation: 0,
+ rotation: 0,
+ startingTranslateX: 0,
+ startingTranslateY: 0,
+ translateX: 0,
+ translateY: 0
+
+ };
+
+ // Create element and append to body
+ this.el = Util.DOM.createElement('div', { 'class': Code.PhotoSwipe.ZoomPanRotateClass.CssClasses.documentOverlay }, '');
+ Util.DOM.setStyle(this.el, {
+ left: 0,
+ top: 0,
+ position: 'absolute'
+ });
+ Util.DOM.width(this.el, Util.DOM.bodyWidth());
+ Util.DOM.height(this.el, Util.DOM.windowHeight());
+
+ this.containerEl = Util.DOM.createElement('div');
+ Util.DOM.setStyle(this.containerEl, {
+ left: 0,
+ top: 0,
+ position: 'absolute'
+ });
+ Util.DOM.width(this.containerEl, Util.DOM.bodyWidth());
+ Util.DOM.height(this.containerEl, Util.DOM.windowHeight());
+
+ Util.DOM.appendChild(this.imageEl, this.containerEl);
+ Util.DOM.appendChild(this.containerEl, this.el);
+ Util.DOM.appendChild(this.el, this.parentEl);
+
+ },
+
+
+ /*
+ * Function: setStartingTranslateFromCurrentTranform
+ */
+ setStartingTranslateFromCurrentTranform: function(){
+
+ var transformExploded = this.containerEl.style.webkitTransform.match( /translate\((.*?)\)/ );
+
+ if (!Util.isNothing(transformExploded)){
+
+ transformExploded = transformExploded[1].split(', ');
+ this.transformSettings.startingTranslateX = window.parseInt(transformExploded[0]);
+ this.transformSettings.startingTranslateY = window.parseInt(transformExploded[1]);
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: setStartingScaleAndRotation
+ */
+ setStartingScaleAndRotation: function(scaleValue, rotationValue){
+
+ var scale = this.transformSettings.startingScale * scaleValue;
+
+ if (this.settings.minZoom !== 0 && scale < this.settings.minZoom){
+ scale = this.settings.minZoom;
+ }
+ else if (this.settings.maxZoom !== 0 && scale > this.settings.maxZoom){
+ scale = this.settings.maxZoom;
+ }
+
+ this.transformSettings.startingScale = scale;
+
+ this.transformSettings.startingRotation =
+ (this.transformSettings.startingRotation + rotationValue) % 360;
+
+ },
+
+
+
+ /*
+ * Function: zoomRotate
+ */
+ zoomRotate: function(scaleValue, rotationValue){
+
+ var scale = this.transformSettings.startingScale * scaleValue;
+
+ if (this.settings.minZoom !== 0 && scale < this.settings.minZoom){
+ scale = this.settings.minZoom;
+ }
+ else if (this.settings.maxZoom !== 0 && scale > this.settings.maxZoom){
+ scale = this.settings.maxZoom;
+ }
+
+ this.transformSettings.scale = scale;
+
+ this.transformSettings.rotation =
+ this.transformSettings.startingRotation + rotationValue;
+
+ this.applyTransform();
+
+ },
+
+
+
+ /*
+ * Function: panStart
+ */
+ panStart: function(point){
+
+ this.setStartingTranslateFromCurrentTranform();
+
+ this.panStartingPoint = {
+ x: point.x,
+ y: point.y
+ };
+
+ },
+
+
+
+ /*
+ * Function: pan
+ */
+ pan: function(point){
+
+ var
+ dx = point.x - this.panStartingPoint.x,
+ dy = point.y - this.panStartingPoint.y,
+ dxScaleAdjust = (this.settings.adjustPanToZoom) ? dx / this.transformSettings.scale : dx,
+ dyScaleAdjust = dy / this.transformSettings.scale ? dy / this.transformSettings.scale : dy ;
+
+
+ this.transformSettings.translateX =
+ this.transformSettings.startingTranslateX + dxScaleAdjust;
+
+ this.transformSettings.translateY =
+ this.transformSettings.startingTranslateY + dyScaleAdjust;
+
+ this.applyTransform();
+
+ },
+
+
+
+ /*
+ * Function: applyTransform
+ */
+ applyTransform: function(){
+
+ this.containerEl.style.webkitTransform = 'scale(' + this.transformSettings.scale + ') rotate(' + (this.transformSettings.rotation % 360) + 'deg) translate(' + this.transformSettings.translateX + 'px, ' + this.transformSettings.translateY + 'px)';
+
+ },
+
+
+
+ /*
+ * Function: removeFromDOM
+ */
+ removeFromDOM: function(){
+
+ Util.DOM.removeChild(this.el, this.parentEl);
+
+ }
+
+ });
+
+
+ Code.PhotoSwipe.ZoomPanRotateClass.CssClasses = {
+ documentOverlay: 'ps-zoom-pan-rotate'
+ };
+
+})
+(
+ window,
+ Code.PhotoSwipe.Util
+);
+// PhotoSwipe - http://www.photoswipe.com/
+// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
+// Licensed under the MIT license
+// version: 1.0.11
+
+(function(window, Util, ElementClass, DocumentOverlayClass, FullSizeImageClass, ViewportClass, SliderClass, CaptionClass, ToolbarClass, CaptionToolbarClass, ZoomPanRotateClass){
+
+ var photoSwipe = Code.PhotoSwipe.EventClass.extend({
+
+ fullSizeImages: null,
+
+ documentOverlay: null,
+ viewport: null,
+ slider: null,
+ captionAndToolbar: null,
+ zoomPanRotate: null,
+
+ settings: null,
+ currentIndex: null,
+ isBusy: null,
+ isActive: null,
+ currentHistoryHashValue: null,
+ isBackEventSupported: null,
+
+ slideshowTimeout: null,
+ isSlideshowActive: null,
+
+ lastShowPrevTrigger: null,
+
+ backButtonClicked: null,
+
+ viewportFadeInEventHandler: null,
+ windowOrientationChangeEventHandler: null,
+ windowScrollEventHandler: null,
+ windowHashChangeHandler: null,
+ keyDownEventHandler: null,
+ viewportTouchEventHandler: null,
+ viewportFadeOutEventHandler: null,
+ sliderDisplayCurrentFullSizeImageEventHandler: null,
+ toolbarClickEventHandler: null,
+ orientationEventName: null,
+
+
+ /*
+ * Function: init
+ */
+ init: function(){
+
+ this._super();
+
+ this.currentIndex = 0;
+ this.isBusy = false;
+ this.isActive = false;
+ this.isSlideshowActive = false;
+ this.backButtonClicked = false;
+
+ this.settings = {
+ getImageSource: Code.PhotoSwipe.GetImageSource,
+ getImageCaption: Code.PhotoSwipe.GetImageCaption,
+ getImageMetaData: Code.PhotoSwipe.GetImageMetaData,
+ fadeInSpeed: 250,
+ fadeOutSpeed: 500,
+ slideSpeed: 250,
+ swipeThreshold: 50,
+ swipeTimeThreshold: 250,
+ loop: true,
+ slideshowDelay: 3000,
+ imageScaleMethod: 'fit', // Either "fit" or "zoom"
+ preventHide: false,
+ zIndex: 1000,
+ backButtonHideEnabled: true,
+ jQueryMobile: ( !Util.isNothing(window.jQuery) && !Util.isNothing(window.jQuery.mobile) ),
+ jQueryMobileDialogHash: '&ui-state=dialog',
+
+ /* Experimental - iOS only at the moment */
+ allowUserZoom: true,
+ allowRotationOnUserZoom: true,
+ maxUserZoom: 5.0,
+ minUserZoom: 0.5,
+ adjustUserPanToZoom: true,
+
+ captionAndToolbarHide: false,
+ captionAndToolbarHideOnSwipe: true,
+ captionAndToolbarFlipPosition: false,
+ captionAndToolbarAutoHideDelay: 5000,
+ captionAndToolbarOpacity: 0.8,
+ captionAndToolbarShowEmptyCaptions: true
+ };
+
+ if (Util.browser.isAndroid){
+ if (navigator.userAgent.indexOf('2.1')){
+ this.isBackEventSupported = true;
+ }
+ }
+ if (!this.isBackEventSupported){
+ this.isBackEventSupported = 'onhashchange' in window;
+ }
+
+ if (this.settings.preventHide){
+ this.settings.backButtonHideEnabled = false;
+ }
+
+
+ // Set pointers to event handlers
+ this.viewportFadeInEventHandler = this.onViewportFadeIn.bind(this);
+ this.windowOrientationChangeEventHandler = this.onWindowOrientationChange.bind(this);
+ this.windowScrollEventHandler = this.onWindowScroll.bind(this);
+ this.windowHashChangeHandler = this.onWindowHashChange.bind(this);
+ this.keyDownEventHandler = this.onKeyDown.bind(this);
+ this.viewportTouchEventHandler = this.onViewportTouch.bind(this);
+ this.viewportFadeOutEventHandler = this.onViewportFadeOut.bind(this);
+ this.sliderDisplayCurrentFullSizeImageEventHandler = this.onSliderDisplayCurrentFullSizeImage.bind(this);
+ this.toolbarClickEventHandler = this.onToolbarClick.bind(this);
+
+ },
+
+
+
+ /*
+ * Function: setOptions
+ */
+ setOptions: function(options){
+
+ Util.extend(this.settings, options);
+
+ if (this.settings.preventHide){
+ this.settings.backButtonHideEnabled = false;
+ }
+
+ },
+
+
+
+ /*
+ * Function: setImages
+ * Set images from DOM elements. Could be a list of image
+ * elments or anchors containing image elements etc.
+ * By default the gallery assumes the latter. If you change
+ * this, remember to set your own getImageSource and getImageCaption
+ * methods so the gallery knows what to look for.
+ */
+ setImages: function(thumbEls){
+
+ if (!Util.isArray){
+ throw "thumbEls is not an array";
+ }
+
+ this.currentIndex = 0;
+
+ this.fullSizeImages = [];
+
+ for (var i=0; i= this.fullSizeImages.length){
+ startingIndex = 0;
+ }
+
+ this.currentIndex = startingIndex;
+
+ if (Util.isNothing(this.documentOverlay)){
+ this.build();
+ }
+ else{
+ this.resetPosition();
+ }
+
+ // Fade in the viewport overlay,
+ // then show the viewport, slider and toolbar etc
+ this.viewport.addEventListener(
+ ElementClass.EventTypes.onFadeIn,
+ this.viewportFadeInEventHandler
+ );
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeShow);
+
+ this.viewport.fadeIn();
+
+ },
+
+
+
+ /*
+ * Function: build
+ */
+ build: function(){
+
+ // Create the document overlay
+ this.documentOverlay = new DocumentOverlayClass({
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ zIndex: this.settings.zIndex
+ });
+
+ // Create the viewport
+ this.viewport = new ViewportClass({
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ swipeThreshold: this.settings.swipeThreshold,
+ swipeTimeThreshold: this.settings.swipeTimeThreshold,
+ zIndex: this.settings.zIndex+1
+ });
+
+ // Create the slider
+ this.slider = new SliderClass(
+ {
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ slideSpeed: this.settings.slideSpeed
+ },
+ this.viewport.el
+ );
+
+ this.captionAndToolbar = new CaptionToolbarClass({
+
+ opacity: this.settings.captionAndToolbarOpacity,
+ fadeInSpeed: this.settings.fadeInSpeed,
+ fadeOutSpeed: this.settings.fadeOutSpeed,
+ autoHideDelay: this.settings.captionAndToolbarAutoHideDelay,
+ flipPosition: this.settings.captionAndToolbarFlipPosition,
+ showEmptyCaptions: this.settings.captionAndToolbarShowEmptyCaptions,
+ hideClose: this.settings.preventHide,
+ zIndex: this.settings.zIndex+3
+
+ });
+
+ this.resetPosition();
+
+ },
+
+
+
+ /*
+ * Function: addEventListeners
+ */
+ addEventListeners: function(){
+
+ // Set window handlers
+ if (Util.browser.isAndroid){
+ // For some reason, resize was more stable than orientationchange in Android
+ // This fix was added in v1.0.5 - needs reviewing
+ this.orientationEventName = 'resize';
+ }
+ else{
+ var supportsOrientationChange = 'onorientationchange' in window;
+ this.orientationEventName = supportsOrientationChange ? 'orientationchange' : 'resize';
+ }
+
+ Util.DOM.addEventListener(window, this.orientationEventName, this.windowOrientationChangeEventHandler);
+
+ Util.DOM.addEventListener(window, 'scroll', this.windowScrollEventHandler);
+
+ if (this.isBackEventSupported && this.settings.backButtonHideEnabled){
+
+ if (this.settings.jQueryMobile){
+ window.location.hash = this.settings.jQueryMobileDialogHash;
+ }
+ else{
+ this.currentHistoryHashValue = 'PhotoSwipe' + new Date().getTime().toString();
+ window.location.hash = this.currentHistoryHashValue;
+ }
+
+ Util.DOM.addEventListener(window, 'hashchange', this.windowHashChangeHandler);
+
+ }
+
+ // Set keydown event handlers for desktop browsers
+ Util.DOM.addEventListener(document, 'keydown', this.keyDownEventHandler);
+
+ // Set viewport handlers
+ this.viewport.addEventListener(ViewportClass.EventTypes.onTouch, this.viewportTouchEventHandler);
+
+ // Set slider handlers
+ this.slider.addEventListener(SliderClass.EventTypes.onDisplayCurrentFullSizeImage, this.sliderDisplayCurrentFullSizeImageEventHandler);
+
+ // Set captionAndToolbar handlers
+ this.captionAndToolbar.addEventListener(ToolbarClass.EventTypes.onClick, this.toolbarClickEventHandler);
+
+ },
+
+
+
+ /*
+ * Function: removeEventListeners
+ */
+ removeEventListeners: function(){
+
+ // Remove window handlers
+ Util.DOM.removeEventListener(window, this.orientationEventName, this.windowOrientationChangeEventHandler);
+
+ Util.DOM.removeEventListener(window, 'scroll', this.windowScrollEventHandler);
+
+ if (this.isBackEventSupported && this.settings.backButtonHideEnabled){
+ Util.DOM.removeEventListener(window, 'hashchange', this.windowHashChangeHandler);
+ }
+
+ // Remove keydown event handlers for desktop browsers
+ Util.DOM.removeEventListener(document, 'keydown', this.keyDownEventHandler);
+
+ // Remove viewport handlers
+ this.viewport.removeEventListener(ViewportClass.EventTypes.onTouch, this.viewportTouchEventHandler);
+
+ // Remove slider handlers
+ this.slider.removeEventListener(SliderClass.EventTypes.onDisplayCurrentFullSizeImage, this.sliderDisplayCurrentFullSizeImageEventHandler);
+
+ // Remove captionAndToolbar handlers
+ this.captionAndToolbar.removeEventListener(ToolbarClass.EventTypes.onClick, this.toolbarClickEventHandler);
+
+ },
+
+
+
+ /*
+ * Function: onViewportFadeIn
+ */
+ onViewportFadeIn: function(e){
+
+ // Remove the ElementClass.EventTypes.onFadeIn
+ // event handler
+ this.viewport.removeEventListener(
+ ElementClass.EventTypes.onFadeIn,
+ this.viewportFadeInEventHandler
+ );
+
+ this.documentOverlay.show();
+
+ this.slider.fadeIn();
+
+ this.addEventListeners();
+
+ this.slider.setCurrentFullSizeImage(this.fullSizeImages[this.currentIndex]);
+
+ this.isBusy = false;
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShow);
+
+ },
+
+
+
+ /*
+ * Function: setSliderPreviousAndNextFullSizeImages
+ */
+ setSliderPreviousAndNextFullSizeImages: function(){
+
+ var
+ lastIndex,
+ previousFullSizeImage = null,
+ nextFullSizeImage = null;
+
+ if (this.fullSizeImages.length > 1) {
+
+ lastIndex = this.fullSizeImages.length - 1;
+
+ // Current image is the last
+ if (this.currentIndex === lastIndex) {
+
+ if (this.settings.loop) {
+ nextFullSizeImage = this.fullSizeImages[0];
+ }
+ previousFullSizeImage = this.fullSizeImages[this.currentIndex - 1];
+
+ }
+
+ // Current image is the first
+ else if (this.currentIndex === 0) {
+
+ nextFullSizeImage = this.fullSizeImages[this.currentIndex + 1];
+ if (this.settings.loop) {
+ previousFullSizeImage = this.fullSizeImages[lastIndex];
+ }
+
+ }
+
+ // Current image is in the middle of the thumbs
+ else {
+
+ nextFullSizeImage = this.fullSizeImages[this.currentIndex + 1];
+ previousFullSizeImage = this.fullSizeImages[this.currentIndex - 1];
+
+ }
+
+ }
+
+ this.slider.setPreviousAndNextFullSizeImages(previousFullSizeImage, nextFullSizeImage);
+
+ },
+
+
+
+ /*
+ * Function: onKeyDown
+ */
+ onKeyDown: function(e){
+
+ this.stopSlideshow();
+
+ if (e.keyCode === 37) { // Left
+ e.preventDefault();
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.keyboard;
+ this.showPrevious();
+ }
+ else if (e.keyCode === 39) { // Right
+ e.preventDefault();
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.keyboard;
+ this.showNext();
+ }
+ else if (e.keyCode === 38 || e.keyCode === 40) { // Up and down
+ e.preventDefault();
+ }
+ else if (e.keyCode === 27) { // Escape
+ e.preventDefault();
+ this.hide();
+ }
+ else if (e.keyCode === 32) { // Spacebar
+ if (!this.settings.hideToolbar){
+ this.toggleCaptionAndToolbar();
+ }
+ else{
+ this.hide();
+ }
+ e.preventDefault();
+ }
+
+ },
+
+
+
+ /*
+ * Function: onWindowOrientationChange
+ */
+ onWindowOrientationChange: function(e){
+
+ this.resetPosition();
+
+ },
+
+
+
+ /*
+ * Function: onWindowScroll
+ */
+ onWindowScroll: function(e){
+
+ this.resetPosition();
+
+ },
+
+
+ /*
+ * Function: onWindowHashChange
+ */
+ onWindowHashChange: function(e){
+
+ var compareHash = '#' +
+ ((this.settings.jQueryMobile) ? this.settings.jQueryMobileDialogHash : this.currentHistoryHashValue);
+
+ if (window.location.hash !== compareHash){
+ this.backButtonClicked = true;
+ this.hide();
+ }
+
+ },
+
+
+
+ /*
+ * Function: resetPosition
+ */
+ resetPosition: function(){
+
+ this.removeZoomPanRotate();
+
+ this.viewport.resetPosition();
+ this.slider.resetPosition();
+ this.documentOverlay.resetPosition();
+ this.captionAndToolbar.resetPosition();
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onResetPosition);
+
+ },
+
+
+
+ /*
+ * Function: canUserZoom
+ */
+ canUserZoom: function(){
+
+ if (!this.settings.allowUserZoom){
+ return false;
+ }
+
+ if (this.isBusy){
+ return false;
+ }
+
+ if (Util.isNothing(this.slider.currentItem.fullSizeImage)){
+ return false;
+ }
+
+ if (!this.slider.currentItem.fullSizeImage.hasLoaded){
+ return false;
+ }
+
+ return true;
+
+ },
+
+
+
+ /*
+ * Function: isZoomActive
+ */
+ isZoomActive: function(){
+
+ return (!Util.isNothing(this.zoomPanRotate));
+
+ },
+
+
+
+ /*
+ * Function: onViewportTouch
+ */
+ onViewportTouch: function(e){
+
+ switch(e.action){
+
+ case ViewportClass.Actions.gestureStart:
+
+ if (this.canUserZoom()){
+ this.stopSlideshow();
+ if (!this.isZoomActive()){
+ this.zoomPanRotate = new ZoomPanRotateClass(
+ {
+ maxZoom: this.settings.maxUserZoom,
+ minZoom: this.settings.minUserZoom,
+ adjustPanToZoom: this.settings.adjustUserPanToZoom
+ },
+ this.viewport.el,
+ this.slider.currentItem.imageEl
+ );
+ Util.DOM.resetTranslate(this.zoomPanRotate.containerEl);
+ Util.DOM.resetTranslate(this.zoomPanRotate.imageEl);
+ }
+ this.fadeOutCaptionAndToolbar();
+ }
+ break;
+
+ case ViewportClass.Actions.gestureChange:
+
+ if (this.isZoomActive()){
+ this.zoomPanRotate.zoomRotate(e.scale, (this.settings.allowRotationOnUserZoom) ? e.rotation : 0);
+ }
+ break;
+
+ case ViewportClass.Actions.gestureEnd:
+
+ if (this.isZoomActive()){
+ this.zoomPanRotate.setStartingScaleAndRotation(e.scale, (this.settings.allowRotationOnUserZoom) ? e.rotation : 0);
+ }
+ break;
+
+ case ViewportClass.Actions.touchStart:
+
+ this.stopSlideshow();
+ if (this.isZoomActive()){
+ this.zoomPanRotate.panStart(e.point);
+ }
+ break;
+
+ case ViewportClass.Actions.touchMove:
+
+ if (this.isZoomActive()){
+ this.zoomPanRotate.pan(e.point);
+ }
+ break;
+
+ case ViewportClass.Actions.click:
+
+ this.stopSlideshow();
+ if (!this.settings.hideToolbar){
+ this.toggleCaptionAndToolbar();
+ }
+ else{
+ this.hide();
+ }
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onViewportClick);
+ break;
+
+ case ViewportClass.Actions.swipeLeft:
+
+ this.stopSlideshow();
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.swipe;
+ this.showNext();
+ break;
+
+ case ViewportClass.Actions.swipeRight:
+
+ this.stopSlideshow();
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.swipe;
+ this.showPrevious();
+ break;
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: onViewportFadeOut
+ */
+ onViewportFadeOut: function(e){
+
+ this.viewport.removeEventListener(ElementClass.EventTypes.onFadeOut, this.viewportFadeOutEventHandler);
+
+ this.isBusy = false;
+ this.isActive = false;
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onHide);
+
+ this.goBackInHistory();
+
+ },
+
+
+
+ /*
+ * Function: hide
+ */
+ hide: function(){
+
+ if (this.isBusy || this.settings.preventHide){
+ return;
+ }
+
+ if (!this.isActive){
+ return;
+ }
+
+ this.isBusy = true;
+
+ this.removeZoomPanRotate();
+
+ this.removeEventListeners();
+
+ this.documentOverlay.hide();
+ this.captionAndToolbar.hide();
+ this.slider.hide();
+
+ Util.DOM.removeClass(document.body, Code.PhotoSwipe.CssClasses.activeBody);
+
+ this.viewport.addEventListener(ElementClass.EventTypes.onFadeOut, this.viewportFadeOutEventHandler);
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeHide);
+
+ this.viewport.fadeOut();
+
+ },
+
+
+ /*
+ * Function: hideImmediately
+ */
+ hideImmediately: function(){
+
+ if (!this.isActive){
+ return;
+ }
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeHide);
+
+ this.removeZoomPanRotate();
+ this.removeEventListeners();
+ this.documentOverlay.hide();
+ this.captionAndToolbar.hide();
+ this.slider.hide();
+ this.viewport.hide();
+
+ Util.DOM.removeClass(document.body, Code.PhotoSwipe.CssClasses.activeBody);
+
+ this.isBusy = false;
+ this.isActive = false;
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onHide);
+
+ this.goBackInHistory();
+ },
+
+
+ /*
+ * Function: goBackInHistory
+ */
+ goBackInHistory: function(){
+
+ if (this.isBackEventSupported && this.settings.backButtonHideEnabled){
+ if ( !this.backButtonClicked ){
+ window.history.back();
+ }
+ }
+
+ },
+
+
+ /*
+ * Function: showNext
+ */
+ showNext: function(){
+
+ if (this.isBusy){
+ return;
+ }
+
+ this.isBusy = true;
+
+ this.cleanUpZoomPanRotateForNextPrevious();
+
+ this.setCaptionAndToolbarOnShowPreviousNext();
+
+ this.slider.showNext();
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShowNext);
+
+ },
+
+
+
+ /*
+ * Function: showPrevious
+ */
+ showPrevious: function(){
+
+ if (this.isBusy){
+ return;
+ }
+
+ this.isBusy = true;
+
+ this.cleanUpZoomPanRotateForNextPrevious();
+
+ this.setCaptionAndToolbarOnShowPreviousNext();
+
+ if (this.wasUserZoomActive){
+ Util.DOM.hide(this.slider.currentItem.imageEl);
+ }
+
+ this.slider.showPrevious();
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShowPrevious);
+
+ },
+
+
+
+ /*
+ * Function: cleanUpZoomPanRotateForNextPrevious
+ */
+ cleanUpZoomPanRotateForNextPrevious: function(){
+
+ if (!Util.isNothing(this.zoomPanRotate)){
+ if (this.settings.loop){
+ Util.DOM.hide(this.slider.currentItem.imageEl);
+ }
+ else{
+ if (this.currentIndex > 0 && this.currentIndex < this.fullSizeImages.length - 2){
+ Util.DOM.hide(this.slider.currentItem.imageEl);
+ }
+ }
+ }
+
+ this.removeZoomPanRotate();
+
+ },
+
+
+
+ /*
+ * Function: setCaptionAndToolbarOnShowPreviousNext
+ */
+ setCaptionAndToolbarOnShowPreviousNext: function(){
+
+ if (this.settings.captionAndToolbarHide){
+ return;
+ }
+
+ var resetAutoTimeout = false;
+
+ switch (this.lastShowPrevTrigger){
+
+ case Code.PhotoSwipe.ShowPrevTriggers.toolbar:
+ resetAutoTimeout = true;
+ break;
+
+ case Code.PhotoSwipe.ShowPrevTriggers.slideshow:
+ resetAutoTimeout = false;
+ break;
+
+ default:
+ resetAutoTimeout = !this.settings.captionAndToolbarHideOnSwipe;
+ break;
+ }
+
+
+ if (resetAutoTimeout) {
+
+ // Reset the caption and toolbar's fadeOut timeout
+ this.captionAndToolbar.resetAutoHideTimeout();
+
+ }
+ else{
+
+ this.fadeOutCaptionAndToolbar();
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: onSliderDisplayCurrentFullSizeImage
+ */
+ onSliderDisplayCurrentFullSizeImage: function(e){
+
+ this.currentIndex = e.fullSizeImage.index;
+
+
+ // Set caption and toolbar
+ if (!this.settings.captionAndToolbarHide){
+
+ if (this.settings.loop) {
+ this.captionAndToolbar.setNextState(false);
+ this.captionAndToolbar.setPreviousState(false);
+ }
+ else{
+ if (this.currentIndex >= this.fullSizeImages.length - 1) {
+ this.captionAndToolbar.setNextState(true);
+ }
+ else {
+ this.captionAndToolbar.setNextState(false);
+ }
+
+ if (this.currentIndex < 1) {
+ this.captionAndToolbar.setPreviousState(true);
+ }
+ else {
+ this.captionAndToolbar.setPreviousState(false);
+ }
+ }
+
+ this.captionAndToolbar.setCaptionValue(this.fullSizeImages[this.currentIndex].caption);
+
+ var fadeIn = false;
+
+ switch (this.lastShowPrevTrigger){
+
+ case Code.PhotoSwipe.ShowPrevTriggers.toolbar:
+ fadeIn = true;
+ break;
+
+ case Code.PhotoSwipe.ShowPrevTriggers.show:
+ fadeIn = true;
+ break;
+
+ case Code.PhotoSwipe.ShowPrevTriggers.slideshow:
+ fadeIn = false;
+ break;
+
+ default:
+ fadeIn = !this.settings.captionAndToolbarHideOnSwipe;
+ break;
+
+ }
+
+
+ if (fadeIn){
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow);
+ this.captionAndToolbar.fadeIn();
+
+ }
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onDisplayImage);
+
+ }
+
+ this.lastShowPrevTrigger = '';
+
+ // Set the previous and next images for the slider
+ this.setSliderPreviousAndNextFullSizeImages();
+
+ if (this.isSlideshowActive){
+
+ this.fireSlideshowTimeout();
+
+ }
+
+ this.isBusy = false;
+
+ },
+
+
+
+ /*
+ * Function: toggleCaptionAndToolbar
+ */
+ toggleCaptionAndToolbar: function(){
+
+ if (this.settings.captionAndToolbarHide){
+
+ this.captionAndToolbar.hide();
+ return;
+
+ }
+
+ if (this.captionAndToolbar.isHidden){
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow);
+ this.captionAndToolbar.fadeIn();
+
+ }
+ else{
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide);
+ this.captionAndToolbar.fadeOut();
+
+ }
+
+
+ },
+
+
+
+ /*
+ * Function: fadeOutCaptionAndToolbar
+ */
+ fadeOutCaptionAndToolbar: function(){
+
+ if (!this.settings.captionAndToolbarHide && !this.captionAndToolbar.isHidden){
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide);
+ this.captionAndToolbar.fadeOut();
+ }
+
+ },
+
+
+
+ /*
+ * Function: onToolbarClick
+ */
+ onToolbarClick: function(e){
+
+ this.stopSlideshow();
+
+ switch (e.action){
+
+ case ToolbarClass.Actions.previous:
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.toolbar;
+ this.showPrevious();
+ break;
+
+ case ToolbarClass.Actions.next:
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.toolbar;
+ this.showNext();
+ break;
+
+ case ToolbarClass.Actions.play:
+ this.startSlideshow();
+ break;
+
+ default:
+ this.hide();
+ break;
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: startSlideshow
+ */
+ startSlideshow: function(){
+
+ if (this.isBusy){
+ return;
+ }
+
+ if (!Util.isNothing(this.slideshowTimeout)){
+ window.clearTimeout(this.slideshowTimeout);
+ }
+
+ this.removeZoomPanRotate();
+
+ this.isSlideshowActive = true;
+
+ this.fadeOutCaptionAndToolbar();
+
+ this.fireSlideshowTimeout();
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onSlideshowStart);
+
+ },
+
+
+
+ /*
+ * Function: stopSlideshow
+ */
+ stopSlideshow: function(){
+
+ if (!Util.isNothing(this.slideshowTimeout)){
+ window.clearTimeout(this.slideshowTimeout);
+ }
+
+ this.isSlideshowActive = false;
+
+ this.dispatchEvent(Code.PhotoSwipe.EventTypes.onSlideshowStop);
+
+ },
+
+
+
+
+ /*
+ * Function: fireSlideshowTimeout
+ */
+ fireSlideshowTimeout: function(){
+
+ var fire = false;
+
+ if (this.settings.loop){
+ if (this.fullSizeImages.length > 1){
+ fire = true;
+ }
+ }
+ else{
+ if (this.currentIndex < this.fullSizeImages.length-1){
+ fire = true;
+ }
+ }
+
+ if (fire){
+
+ this.lastShowPrevTrigger = Code.PhotoSwipe.ShowPrevTriggers.slideshow;
+ this.slideshowTimeout = window.setTimeout(
+ this.showNext.bind(this),
+ this.settings.slideshowDelay
+ );
+
+ }
+
+ },
+
+
+
+ /*
+ * Function: removeZoomPanRotate
+ */
+ removeZoomPanRotate: function(){
+
+ if (Util.isNothing(this.zoomPanRotate)){
+ return;
+ }
+
+ this.zoomPanRotate.removeFromDOM();
+
+ this.zoomPanRotate = null;
+
+ }
+
+
+ });
+
+
+ Code.PhotoSwipe.CssClasses = {
+ activeBody: 'ps-active'
+ };
+
+
+ Code.PhotoSwipe.ShowPrevTriggers = {
+
+ show: 'show',
+ toolbar: 'toobar',
+ swipe: 'swipe',
+ keyboard: 'keyboard',
+ slideshow: 'slideshow'
+
+ };
+
+
+ Code.PhotoSwipe.EventTypes = {
+
+ onBeforeShow: 'onBeforeShow',
+ onShow: 'onShow',
+ onBeforeHide: 'onBeforeHide',
+ onHide: 'onHide',
+ onShowNext: 'onShowNext',
+ onShowPrevious: 'onShowPrevious',
+ onDisplayImage: 'onDisplayImage',
+ onResetPosition: 'onResetPosition',
+ onSlideshowStart: 'onSlideshowStart',
+ onSlideshowStop: 'onSlideshowStop',
+ onBeforeCaptionAndToolbarShow: 'onBeforeCaptionAndToolbarShow',
+ onBeforeCaptionAndToolbarHide: 'onBeforeCaptionAndToolbarHide',
+ onViewportClick: 'onViewportClick'
+
+ };
+
+
+ /*
+ * Function: Code.PhotoSwipe.GetImageSource
+ * Default method for returning an image's source
+ */
+ Code.PhotoSwipe.GetImageSource = function(el){
+ return el.href;
+ };
+
+
+
+ /*
+ * Function: Code.PhotoSwipe.GetImageCaption
+ * Default method for returning an image's caption
+ * Assumes the el is an anchor and the first child is the
+ * image. The returned value is the "alt" attribute of the
+ * image.
+ */
+ Code.PhotoSwipe.GetImageCaption = function(el){
+ if (el.nodeName === "IMG"){
+ return Util.DOM.getAttribute(el, 'alt');
+ }
+ var i, childEl;
+ for (i=0; i"+a+">");a.attr(d);a.append(e);return a[0]},appendChild:function(a,d){$(d).append(a)},appendText:function(a,d){$(d).text(a)},appendToBody:function(a){$("body").append(a)},
+removeChild:function(a){$(a).empty().remove()},removeChildren:function(a){$(a).empty()},hasAttribute:function(b,d){return a.isNothing($(b).attr(d))},getAttribute:function(a,d){return $(a).attr(d)},setAttribute:function(a,d,e){$(a).attr(d,e)},removeAttribute:function(a,d){$(a).removeAttr(d)},addClass:function(a,d){$(a).addClass(d)},removeClass:function(a,d){$(a).removeClass(d)},hasClass:function(a,d){$(a).hasClass(d)},setStyle:function(b,d,e){a.isObject(d)?$(b).css(d):$(b).css(d,e)},getStyle:function(a,
+d){return $(a).css(d)},hide:function(a){$(a).hide()},show:function(a){$(a).show()},width:function(b,d){a.isNothing(d)||$(b).width(d);return $(b).width()},outerWidth:function(a){return $(a).outerWidth()},height:function(b,d){a.isNothing(d)||$(b).height(d);return $(b).height()},outerHeight:function(a){return $(a).outerHeight()},documentWidth:function(){return $(document.documentElement).width()},documentHeight:function(){return $(document.documentElement).height()},bodyWidth:function(){return $(document.body).width()},
+bodyHeight:function(){return $(document.body).height()},windowWidth:function(){if(!c.innerWidth)return $(c).width();return c.innerWidth},windowHeight:function(){if(!c.innerHeight)return $(c).height();return c.innerHeight},windowScrollLeft:function(){if(!c.pageXOffset)return $(c).scrollLeft();return c.pageXOffset},windowScrollTop:function(){if(!c.pageYOffset)return $(c).scrollTop();return c.pageYOffset},addEventListener:function(a,d,e){$(a).bind(d,e)},removeEventListener:function(a,d,e){$(a).unbind(d,
+e)},getMousePosition:function(a){return{x:a.pageX,y:a.pageY}},getTouchEvent:function(a){return a.originalEvent}}})})(window,Code.PhotoSwipe.Util);
+(function(c,a){a.extend(a,{Animation:{stopFade:function(a){$(a).stop(!0,!0)},fadeIn:function(b,d,e,c){d=a.coalesce(d,1);e=a.coalesce(e,500);$(b).fadeTo(e,d,c)},fadeOut:function(b,d,e){a.isNothing(d)&&(d=500);$(b).fadeTo(d,0,e)},slideBy:function(b,d,e,c,f){a.isNothing(c)&&(c=500);d=jQuery.fn.translation?{left:"+="+d+"px",top:"+="+e+"px",useTranslate3d:a.browser.is3dSupported}:{left:"+="+d+"px",top:"+="+e+"px"};$(b).animate(d,c,f)}}})})(window,Code.PhotoSwipe.Util);
+(function(){Code.PhotoSwipe.EventClass=SimpleClass.extend({_listeners:null,init:function(){this._listeners={}},addEventListener:function(c,a){typeof this._listeners[c]==="undefined"&&(this._listeners[c]=[]);this._listeners[c].push(a)},dispatchEvent:function(c){typeof c=="string"&&(c={type:c});if(!c.target)c.target=this;if(!c.type)throw Error("Event object missing 'type' property.");if(this._listeners[c.type]instanceof Array)for(var a=this._listeners[c.type],b=0,d=a.length;bthis.naturalHeight;this.isLoading=!1;this.hasLoaded=!0;this.dispatchEvent(Code.PhotoSwipe.FullSizeImageClass.EventTypes.onLoad)}});Code.PhotoSwipe.FullSizeImageClass.EventTypes=
+{onLoad:"onLoad"}})(window,Code.PhotoSwipe.Util);
+(function(c,a){Code.PhotoSwipe.DocumentOverlayClass=Code.PhotoSwipe.ElementClass.extend({init:function(b){this.settings={zIndex:1E3};a.extend(this.settings,b);this._super(b);this.el=a.DOM.createElement("div",{"class":Code.PhotoSwipe.DocumentOverlayClass.CssClasses.documentOverlay},"");a.DOM.setStyle(this.el,{left:0,position:"absolute",zIndex:this.settings.zIndex,top:0});a.DOM.hide(this.el);a.DOM.appendToBody(this.el)},resetPosition:function(){a.DOM.width(this.el,a.DOM.bodyWidth());a.DOM.height(this.el,
+a.DOM.bodyHeight())}});Code.PhotoSwipe.DocumentOverlayClass.CssClasses={documentOverlay:"ps-document-overlay"}})(window,Code.PhotoSwipe.Util);
+(function(c,a){Code.PhotoSwipe.ViewportClass=Code.PhotoSwipe.ElementClass.extend({touchStartPoint:null,touchStartTime:null,touchStartHandler:null,touchMoveHandler:null,touchEndHandler:null,gestureStartHandler:null,gestureChangeHandler:null,gestureEndHandler:null,isGesture:null,mouseDownHandler:null,mouseUpHandler:null,init:function(b){this.settings={swipeThreshold:500,swipeTimeThreshold:250,zIndex:1E3};a.extend(this.settings,b);this._super(this.settings);this.touchStartPoint={x:0,y:0};if(a.browser.touchSupported)this.touchStartHandler=
+this.onTouchStart.bind(this),this.touchMoveHandler=this.onTouchMove.bind(this),this.touchEndHandler=this.onTouchEnd.bind(this);if(a.browser.gestureSupported)this.gestureStartHandler=this.onGestureStart.bind(this),this.gestureChangeHandler=this.onGestureChange.bind(this),this.gestureEndHandler=this.onGestureEnd.bind(this);this.mouseDownHandler=this.onMouseDown.bind(this);this.mouseUpHandler=this.onMouseUp.bind(this);this.el=a.DOM.createElement("div",{"class":Code.PhotoSwipe.ViewportClass.CssClasses.viewport,
+"data-role":"dialog"},"");a.DOM.setStyle(this.el,{position:"absolute",left:0,zIndex:this.settings.zIndex,overflow:"hidden"});a.DOM.hide(this.el);a.DOM.appendToBody(this.el)},resetPosition:function(){a.DOM.setStyle(this.el,{top:a.DOM.windowScrollTop()+"px"});a.DOM.width(this.el,a.DOM.bodyWidth());a.DOM.height(this.el,a.DOM.windowHeight())},addEventListeners:function(){a.browser.touchSupported&&(a.DOM.addEventListener(this.el,"touchstart",this.touchStartHandler),a.DOM.addEventListener(this.el,"touchmove",
+this.touchMoveHandler),a.DOM.addEventListener(this.el,"touchend",this.touchEndHandler));a.browser.gestureSupported&&(a.DOM.addEventListener(this.el,"gesturestart",this.gestureStartHandler),a.DOM.addEventListener(this.el,"gesturechange",this.gestureChangeHandler),a.DOM.addEventListener(this.el,"gestureend",this.gestureEndHandler));a.DOM.addEventListener(this.el,"mousedown",this.mouseDownHandler);a.DOM.addEventListener(this.el,"mouseup",this.mouseUpHandler)},removeEventListeners:function(){a.browser.touchSupported&&
+(a.DOM.removeEventListener(this.el,"touchstart",this.touchStartHandler),a.DOM.removeEventListener(this.el,"touchmove",this.touchMoveHandler),a.DOM.removeEventListener(this.el,"touchend",this.touchEndHandler));a.browser.gestureSupported&&(a.DOM.removeEventListener(this.el,"gesturestart",this.gestureStartHandler),a.DOM.removeEventListener(this.el,"gesturechange",this.gestureChangeHandler),a.DOM.removeEventListener(this.el,"gestureend",this.gestureEndHandler));a.DOM.removeEventListener(this.el,"mousedown",
+this.mouseDownHandler);a.DOM.removeEventListener(this.el,"mouseup",this.mouseUpHandler)},getTouchPoint:function(a){return{x:a[0].pageX,y:a[0].pageY}},onGestureStart:function(b){b.preventDefault();b=a.DOM.getTouchEvent(b);this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:Code.PhotoSwipe.ViewportClass.Actions.gestureStart,scale:b.scale,rotation:b.rotation})},onGestureChange:function(b){b.preventDefault();b=a.DOM.getTouchEvent(b);this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+target:this,action:Code.PhotoSwipe.ViewportClass.Actions.gestureChange,scale:b.scale,rotation:b.rotation})},onGestureEnd:function(b){b.preventDefault();b=a.DOM.getTouchEvent(b);this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:Code.PhotoSwipe.ViewportClass.Actions.gestureEnd,scale:b.scale,rotation:b.rotation})},onTouchStart:function(b){b.preventDefault();b=a.DOM.getTouchEvent(b).touches;b.length>1?this.isGesture=!0:(this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,
+target:this,action:Code.PhotoSwipe.ViewportClass.Actions.touchStart,point:this.getTouchPoint(b)}),this.touchStartTime=new Date,this.isGesture=!1,this.touchStartPoint=this.getTouchPoint(b))},onTouchMove:function(b){b.preventDefault();if(!this.isGesture)b=a.DOM.getTouchEvent(b).touches,this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:Code.PhotoSwipe.ViewportClass.Actions.touchMove,point:this.getTouchPoint(b)})},onTouchEnd:function(b){b.preventDefault();this.isGesture||
+(b=a.DOM.getTouchEvent(b),b=this.getTouchPoint(!a.isNothing(b.changedTouches)?b.changedTouches:b.touches),this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:Code.PhotoSwipe.ViewportClass.Actions.touchEnd,point:b}),this.fireTouchEvent(this.touchStartPoint,b))},onMouseDown:function(b){b.preventDefault();this.touchStartTime=new Date;this.isGesture=!1;this.touchStartPoint=a.DOM.getMousePosition(b)},onMouseUp:function(b){b.preventDefault();this.fireTouchEvent(this.touchStartPoint,
+a.DOM.getMousePosition(b))},fireTouchEvent:function(b,d){var e;new Date-this.touchStartTime>this.settings.swipeTimeThreshold||(e=d.x-b.x,e=Math.abs(e)>=this.settings.swipeThreshold?e<0?Code.PhotoSwipe.ViewportClass.Actions.swipeLeft:Code.PhotoSwipe.ViewportClass.Actions.swipeRight:Code.PhotoSwipe.ViewportClass.Actions.click,a.isNothing(e)||this.dispatchEvent({type:Code.PhotoSwipe.ViewportClass.EventTypes.onTouch,target:this,action:e}))}});Code.PhotoSwipe.ViewportClass.CssClasses={viewport:"ps-viewport"};
+Code.PhotoSwipe.ViewportClass.Actions={click:"click",swipeLeft:"swipeLeft",swipeRight:"swipeRight",touchStart:"touchStart",touchMove:"touchMove",touchEnd:"touchEnd",gestureStart:"gestureStart",gestureChange:"gestureChange",gestureEnd:"gestureEnd"};Code.PhotoSwipe.ViewportClass.EventTypes={onTouch:"onTouch"}})(window,Code.PhotoSwipe.Util);
+(function(c,a,b){Code.PhotoSwipe.SliderItemClass=Code.PhotoSwipe.EventClass.extend({el:null,imageContainerEl:null,imageEl:null,parentEl:null,fullSizeImage:null,fullSizeImageLoadEventHandler:null,savedImageWidth:null,savedImageHeight:null,init:function(b){this._super();this.parentEl=b;this.fullSizeImageLoadEventHandler=this.onFullSizeImageLoad.bind(this);this.el=a.DOM.createElement("div",{"class":Code.PhotoSwipe.SliderItemClass.CssClasses.item+" "+Code.PhotoSwipe.SliderItemClass.CssClasses.loading},
+"");a.DOM.setStyle(this.el,{position:"absolute",overflow:"hidden",top:0});a.DOM.resetTranslate(this.el);a.DOM.appendChild(this.el,this.parentEl);this.imageContainerEl=a.DOM.createElement("div");a.DOM.setStyle(this.imageContainerEl,{position:"absolute",overflow:"hidden",top:0,left:0});a.DOM.appendChild(this.imageContainerEl,this.el);this.imageEl=new Image;a.DOM.setStyle(this.imageEl,{display:"block",position:"absolute",margin:0,padding:0});a.DOM.hide(this.imageEl);a.DOM.appendChild(this.imageEl,this.imageContainerEl)},
+resetPosition:function(b,e,c){a.DOM.width(this.el,b);a.DOM.height(this.el,e);a.DOM.setStyle(this.el,"left",c+"px");a.DOM.width(this.imageContainerEl,b);a.DOM.height(this.imageContainerEl,e);this.resetImagePosition()},resetImagePosition:function(){if(!a.isNothing(this.fullSizeImage)){a.DOM.getAttribute(this.imageEl,"src");var b,e,c,f;f=a.DOM.width(this.el);var h=a.DOM.height(this.el);b=this.fullSizeImage.isLandscape?f/this.fullSizeImage.naturalWidth:h/this.fullSizeImage.naturalHeight;e=Math.round(this.fullSizeImage.naturalWidth*
+b);c=Math.round(this.fullSizeImage.naturalHeight*b);this.fullSizeImage.scaleMethod==="zoom"?(b=1,cf?b=f/e:c>h&&(b=h/c),b!==1&&(e=Math.round(e*b),c=Math.round(c*b)));b=(h-c)/2+"px";f=(f-e)/2+"px";a.DOM.width(this.imageEl,e);a.DOM.height(this.imageEl,c);a.DOM.setStyle(this.imageEl,{top:b,left:f});a.DOM.show(this.imageEl);this.savedImageWidth=e;this.savedImageHeight=c}},setFullSizeImage:function(d){this.fullSizeImage=
+d;a.DOM.removeClass(this.el,Code.PhotoSwipe.SliderItemClass.CssClasses.loading);a.DOM.removeClass(this.el,Code.PhotoSwipe.SliderItemClass.CssClasses.imageError);a.isNothing(this.fullSizeImage)?(this.fullSizeImage=null,a.DOM.addClass(this.el,Code.PhotoSwipe.SliderItemClass.CssClasses.imageError),this.hideImage()):this.fullSizeImage.hasLoaded?(a.DOM.setAttribute(this.imageEl,"src",this.fullSizeImage.src),this.resetImagePosition(),this.dispatchEvent(Code.PhotoSwipe.SliderItemClass.EventTypes.onFullSizeImageDisplay)):
+(a.DOM.addClass(this.el,Code.PhotoSwipe.SliderItemClass.CssClasses.loading),this.hideImage(),this.fullSizeImage.isLoading||(this.fullSizeImage.addEventListener(b.EventTypes.onLoad,this.fullSizeImageLoadEventHandler),this.fullSizeImage.load()))},onFullSizeImageLoad:function(d){d.target.removeEventListener(b.EventTypes.onLoad,this.fullSizeImageLoadEventHandler);a.isNothing(this.fullSizeImage)||d.target.index!==this.fullSizeImage.index?this.dispatchEvent({type:Code.PhotoSwipe.SliderItemClass.EventTypes.onFullSizeImageLoadAnomaly,
+target:this,fullSizeImage:d.target}):this.setFullSizeImage(d.target)},hideImage:function(){a.DOM.removeAttribute(this.imageEl,"src");a.DOM.hide(this.imageEl)}});Code.PhotoSwipe.SliderItemClass.CssClasses={item:"ps-slider-item",loading:"ps-slider-item-loading",imageError:"ps-slider-item-image-error"};Code.PhotoSwipe.SliderItemClass.EventTypes={onFullSizeImageDisplay:"onFullSizeImageDisplay",onFullSizeImageLoadAnomaly:"onFullSizeImageLoadAnomaly"}})(window,Code.PhotoSwipe.Util,Code.PhotoSwipe.FullSizeImageClass);
+(function(c,a,b){Code.PhotoSwipe.SliderClass=Code.PhotoSwipe.ElementClass.extend({parentEl:null,parentElWidth:null,parentElHeight:null,items:null,scaleEl:null,lastScaleValue:null,previousItem:null,currentItem:null,nextItem:null,hasBounced:null,lastShowAction:null,bounceSlideBy:null,showNextEndEventHandler:null,showPreviousEndEventHandler:null,bounceStepOneEventHandler:null,bounceStepTwoEventHandler:null,sliderFullSizeImageLoadAnomalyEventHandler:null,init:function(d,c){this.settings={slideSpeed:250};
+a.extend(this.settings,d);this._super(this.settings);this.parentEl=c;this.hasBounced=!1;this.showNextEndEventHandler=this.onShowNextEnd.bind(this);this.showPreviousEndEventHandler=this.onShowPreviousEnd.bind(this);this.bounceStepOneEventHandler=this.onBounceStepOne.bind(this);this.bounceStepTwoEventHandler=this.onBounceStepTwo.bind(this);this.sliderFullSizeImageLoadAnomalyEventHandler=this.onSliderFullSizeImageLoadAnomaly.bind(this);this.el=a.DOM.createElement("div",{"class":Code.PhotoSwipe.SliderClass.CssClasses.slider},
+"");a.DOM.setStyle(this.el,{position:"absolute",top:0});a.DOM.hide(this.el);a.DOM.appendChild(this.el,c);this.items=[];this.items.push(new b(this.el));this.items.push(new b(this.el));this.items.push(new b(this.el));this.previousItem=this.items[0];this.currentItem=this.items[1];this.nextItem=this.items[2]},addEventListeners:function(){for(var a=0;a');this.settings.hideClose&&a.DOM.hide(this.closeEl);a.DOM.appendChild(this.closeEl,this.el);this.playEl=a.DOM.createElement("div",{"class":Code.PhotoSwipe.ToolbarClass.CssClasses.play},'
');a.DOM.appendChild(this.playEl,this.el);this.previousEl=a.DOM.createElement("div",{"class":Code.PhotoSwipe.ToolbarClass.CssClasses.previous},'
');a.DOM.appendChild(this.previousEl,this.el);this.nextEl=a.DOM.createElement("div",{"class":Code.PhotoSwipe.ToolbarClass.CssClasses.next},'
');a.DOM.appendChild(this.nextEl,this.el)},postFadeIn:function(){this.isHidden||(a.DOM.setStyle(this.el,{display:"table"}),this._super(this.settings))},addEventListeners:function(){a.browser.touchSupported&&(a.browser.isBlackberry||a.DOM.addEventListener(this.el,"touchstart",this.touchStartHandler),
+a.DOM.addEventListener(this.el,"touchmove",this.touchMoveHandler));a.DOM.addEventListener(this.el,"click",this.clickHandler)},removeEventListeners:function(){a.browser.touchSupported&&(a.browser.isBlackberry||a.DOM.removeEventListener(this.el,"touchstart",this.touchStartHandler),a.DOM.removeEventListener(this.el,"touchmove",this.touchMoveHandler));a.DOM.removeEventListener(this.el,"click",this.clickHandler)},onTouchStart:function(a){a.preventDefault();this.touched=!0;this.handleClick(a)},onTouchMove:function(a){a.preventDefault()},
+onClick:function(a){this.touched||this.handleClick(a)},handleClick:function(b){var d;switch(b.target.parentNode){case this.previousEl:if(this.isPreviousActive)d=Code.PhotoSwipe.ToolbarClass.Actions.previous;break;case this.nextEl:if(this.isNextActive)d=Code.PhotoSwipe.ToolbarClass.Actions.next;break;case this.playEl:d=Code.PhotoSwipe.ToolbarClass.Actions.play;break;case this.closeEl:d=Code.PhotoSwipe.ToolbarClass.Actions.close}a.isNothing(d)||this.dispatchEvent({type:Code.PhotoSwipe.ToolbarClass.EventTypes.onClick,
+target:this,action:d})},resetPosition:function(){var b;b=this.settings.position==="bottom"?a.DOM.windowHeight()-a.DOM.outerHeight(this.el)+a.DOM.windowScrollTop():a.DOM.windowScrollTop();a.DOM.setStyle(this.el,"top",b+"px");a.DOM.width(this.el,a.DOM.bodyWidth())},setNextState:function(b){b?(a.DOM.addClass(this.nextEl,Code.PhotoSwipe.ToolbarClass.CssClasses.nextDisabled),this.isNextActive=!1):(a.DOM.removeClass(this.nextEl,Code.PhotoSwipe.ToolbarClass.CssClasses.nextDisabled),this.isNextActive=!0)},
+setPreviousState:function(b){b?(a.DOM.addClass(this.previousEl,Code.PhotoSwipe.ToolbarClass.CssClasses.previousDisabled),this.isPreviousActive=!1):(a.DOM.removeClass(this.previousEl,Code.PhotoSwipe.ToolbarClass.CssClasses.previousDisabled),this.isPreviousActive=!0)}});Code.PhotoSwipe.ToolbarClass.CssClasses={caption:"ps-toolbar",top:"ps-toolbar-top",close:"ps-toolbar-close",previous:"ps-toolbar-previous",previousDisabled:"ps-toolbar-previous-disabled",next:"ps-toolbar-next",nextDisabled:"ps-toolbar-next-disabled",
+play:"ps-toolbar-play",content:"ps-toolbar-content"};Code.PhotoSwipe.ToolbarClass.Actions={close:"close",previous:"previous",next:"next",play:"play"};Code.PhotoSwipe.ToolbarClass.EventTypes={onClick:"onClick"}})(window,Code.PhotoSwipe.Util);
+(function(c,a,b,d){Code.PhotoSwipe.CaptionToolbarClass=Code.PhotoSwipe.EventClass.extend({toolbar:null,caption:null,isHidden:null,hasAddedEventListeners:null,toolbarClickEventHandler:null,init:function(c){this._super();this.settings={opacity:0.8,fadeInSpeed:250,fadeOutSpeed:500,autoHideDelay:5E3,flipPosition:!1,showEmptyCaptions:!0,hideClose:!1,zIndex:1E3};a.extend(this.settings,c);this.isHidden=!0;this.hasAddedEventListeners=!1;this.toolbarClickEventHandler=this.onToolbarClick.bind(this);this.caption=
+new b({fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,opacity:this.settings.opacity,position:this.settings.flipPosition?"bottom":"top",zIndex:this.settings.zIndex});this.toolbar=new d({fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,opacity:this.settings.opacity,position:this.settings.flipPosition?"top":"bottom",hideClose:this.settings.hideClose,zIndex:this.settings.zIndex+1})},resetPosition:function(){this.caption.resetPosition();this.toolbar.resetPosition()},
+addEventListeners:function(){if(!this.hasAddedEventListeners)this.toolbar.addEventListener(d.EventTypes.onClick,this.toolbarClickEventHandler),this.hasAddedEventListeners=!0},removeEventListeners:function(){this.toolbar.removeEventListener(d.EventTypes.onClick,this.toolbarClickEventHandler);this.hasAddedEventListeners=!1},fadeIn:function(){this.stopAutoHideTimeout();this.stopFade();this.isHidden?(this.isHidden=!1,this.fadeInCaption(),this.toolbar.fadeIn(),c.setTimeout(this.onFadeIn.bind(this),this.settings.fadeInSpeed)):
+(this.caption.isHidden&&this.fadeInCaption(),this.resetAutoHideTimeout())},showCaption:function(){this.caption.captionValue===""?this.settings.showEmptyCaptions&&this.caption.show():this.caption.show()},fadeInCaption:function(){this.caption.captionValue===""?this.settings.showEmptyCaptions&&this.caption.fadeIn():this.caption.fadeIn()},onFadeIn:function(){this.addEventListeners();this.resetAutoHideTimeout()},fadeOut:function(){this.stopAutoHideTimeout();this.stopFade();this.isHidden=!0;this.caption.fadeOut();
+this.toolbar.fadeOut();c.setTimeout(this.onFadeOut.bind(this),this.settings.fadeOutSpeed)},onFadeOut:function(){},stopFade:function(){this.caption.stopFade();this.toolbar.stopFade()},hide:function(){this.stopAutoHideTimeout();this.stopFade();this.isHidden=!0;this.removeEventListeners();this.caption.hide();this.toolbar.hide()},setCaptionValue:function(a){this.caption.setCaptionValue(a);this.caption.captionValue===""&&!this.settings.showEmptyCaptions&&this.caption.fadeOut()},resetAutoHideTimeout:function(){if(!this.isHidden&&
+(this.stopAutoHideTimeout(),this.settings.autoHideDelay>0))this.autoHideTimeout=c.setTimeout(this.fadeOut.bind(this),this.settings.autoHideDelay)},stopAutoHideTimeout:function(){a.isNothing(this.autoHideTimeout)||c.clearTimeout(this.autoHideTimeout)},onToolbarClick:function(a){this.dispatchEvent({type:Code.PhotoSwipe.ToolbarClass.EventTypes.onClick,target:this,action:a.action})},setNextState:function(a){this.toolbar.setNextState(a)},setPreviousState:function(a){this.toolbar.setPreviousState(a)}})})(window,
+Code.PhotoSwipe.Util,Code.PhotoSwipe.CaptionClass,Code.PhotoSwipe.ToolbarClass);
+(function(c,a){Code.PhotoSwipe.ZoomPanRotateClass=Code.PhotoSwipe.ElementClass.extend({containerEl:null,imageEl:null,parentEl:null,transformSettings:null,panStartingPoint:null,init:function(b,d,c){this.settings={maxZoom:5,minZoom:0.5,adjustPanToZoom:!0};a.extend(this.settings,b);this._super(b);this.parentEl=d;this.imageEl=c.cloneNode(!1);this.transformSettings={startingScale:1,scale:1,startingRotation:0,rotation:0,startingTranslateX:0,startingTranslateY:0,translateX:0,translateY:0};this.el=a.DOM.createElement("div",
+{"class":Code.PhotoSwipe.ZoomPanRotateClass.CssClasses.documentOverlay},"");a.DOM.setStyle(this.el,{left:0,top:0,position:"absolute"});a.DOM.width(this.el,a.DOM.bodyWidth());a.DOM.height(this.el,a.DOM.windowHeight());this.containerEl=a.DOM.createElement("div");a.DOM.setStyle(this.containerEl,{left:0,top:0,position:"absolute"});a.DOM.width(this.containerEl,a.DOM.bodyWidth());a.DOM.height(this.containerEl,a.DOM.windowHeight());a.DOM.appendChild(this.imageEl,this.containerEl);a.DOM.appendChild(this.containerEl,
+this.el);a.DOM.appendChild(this.el,this.parentEl)},setStartingTranslateFromCurrentTranform:function(){var b=this.containerEl.style.webkitTransform.match(/translate\((.*?)\)/);if(!a.isNothing(b))b=b[1].split(", "),this.transformSettings.startingTranslateX=c.parseInt(b[0]),this.transformSettings.startingTranslateY=c.parseInt(b[1])},setStartingScaleAndRotation:function(a,d){var c=this.transformSettings.startingScale*a;if(this.settings.minZoom!==0&&cthis.settings.maxZoom)c=this.settings.maxZoom;this.transformSettings.startingScale=c;this.transformSettings.startingRotation=(this.transformSettings.startingRotation+d)%360},zoomRotate:function(a,c){var e=this.transformSettings.startingScale*a;if(this.settings.minZoom!==0&ðis.settings.maxZoom)e=this.settings.maxZoom;this.transformSettings.scale=e;this.transformSettings.rotation=this.transformSettings.startingRotation+
+c;this.applyTransform()},panStart:function(a){this.setStartingTranslateFromCurrentTranform();this.panStartingPoint={x:a.x,y:a.y}},pan:function(a){var c=a.x-this.panStartingPoint.x,a=a.y-this.panStartingPoint.y,a=a/this.transformSettings.scale?a/this.transformSettings.scale:a;this.transformSettings.translateX=this.transformSettings.startingTranslateX+(this.settings.adjustPanToZoom?c/this.transformSettings.scale:c);this.transformSettings.translateY=this.transformSettings.startingTranslateY+a;this.applyTransform()},
+applyTransform:function(){this.containerEl.style.webkitTransform="scale("+this.transformSettings.scale+") rotate("+this.transformSettings.rotation%360+"deg) translate("+this.transformSettings.translateX+"px, "+this.transformSettings.translateY+"px)"},removeFromDOM:function(){a.DOM.removeChild(this.el,this.parentEl)}});Code.PhotoSwipe.ZoomPanRotateClass.CssClasses={documentOverlay:"ps-zoom-pan-rotate"}})(window,Code.PhotoSwipe.Util);
+(function(c,a,b,d,e,g,f,h,i,j,k){h=Code.PhotoSwipe.EventClass.extend({fullSizeImages:null,documentOverlay:null,viewport:null,slider:null,captionAndToolbar:null,zoomPanRotate:null,settings:null,currentIndex:null,isBusy:null,isActive:null,currentHistoryHashValue:null,isBackEventSupported:null,slideshowTimeout:null,isSlideshowActive:null,lastShowPrevTrigger:null,backButtonClicked:null,viewportFadeInEventHandler:null,windowOrientationChangeEventHandler:null,windowScrollEventHandler:null,windowHashChangeHandler:null,
+keyDownEventHandler:null,viewportTouchEventHandler:null,viewportFadeOutEventHandler:null,sliderDisplayCurrentFullSizeImageEventHandler:null,toolbarClickEventHandler:null,orientationEventName:null,init:function(){this._super();this.currentIndex=0;this.backButtonClicked=this.isSlideshowActive=this.isActive=this.isBusy=!1;this.settings={getImageSource:Code.PhotoSwipe.GetImageSource,getImageCaption:Code.PhotoSwipe.GetImageCaption,getImageMetaData:Code.PhotoSwipe.GetImageMetaData,fadeInSpeed:250,fadeOutSpeed:500,
+slideSpeed:250,swipeThreshold:50,swipeTimeThreshold:250,loop:!0,slideshowDelay:3E3,imageScaleMethod:"fit",preventHide:!1,zIndex:1E3,backButtonHideEnabled:!0,jQueryMobile:!a.isNothing(c.jQuery)&&!a.isNothing(c.jQuery.mobile),jQueryMobileDialogHash:"&ui-state=dialog",allowUserZoom:!0,allowRotationOnUserZoom:!0,maxUserZoom:5,minUserZoom:0.5,adjustUserPanToZoom:!0,captionAndToolbarHide:!1,captionAndToolbarHideOnSwipe:!0,captionAndToolbarFlipPosition:!1,captionAndToolbarAutoHideDelay:5E3,captionAndToolbarOpacity:0.8,
+captionAndToolbarShowEmptyCaptions:!0};if(a.browser.isAndroid&&navigator.userAgent.indexOf("2.1"))this.isBackEventSupported=!0;if(!this.isBackEventSupported)this.isBackEventSupported="onhashchange"in c;if(this.settings.preventHide)this.settings.backButtonHideEnabled=!1;this.viewportFadeInEventHandler=this.onViewportFadeIn.bind(this);this.windowOrientationChangeEventHandler=this.onWindowOrientationChange.bind(this);this.windowScrollEventHandler=this.onWindowScroll.bind(this);this.windowHashChangeHandler=
+this.onWindowHashChange.bind(this);this.keyDownEventHandler=this.onKeyDown.bind(this);this.viewportTouchEventHandler=this.onViewportTouch.bind(this);this.viewportFadeOutEventHandler=this.onViewportFadeOut.bind(this);this.sliderDisplayCurrentFullSizeImageEventHandler=this.onSliderDisplayCurrentFullSizeImage.bind(this);this.toolbarClickEventHandler=this.onToolbarClick.bind(this)},setOptions:function(b){a.extend(this.settings,b);if(this.settings.preventHide)this.settings.backButtonHideEnabled=!1},setImages:function(b){if(!a.isArray)throw"thumbEls is not an array";
+this.currentIndex=0;this.fullSizeImages=[];for(var c=0;c=this.fullSizeImages.length)d=0;this.currentIndex=d;a.isNothing(this.documentOverlay)?this.build():this.resetPosition();this.viewport.addEventListener(b.EventTypes.onFadeIn,this.viewportFadeInEventHandler);this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeShow);this.viewport.fadeIn()}},build:function(){this.documentOverlay=new d({fadeInSpeed:this.settings.fadeInSpeed,
+fadeOutSpeed:this.settings.fadeOutSpeed,zIndex:this.settings.zIndex});this.viewport=new g({fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,swipeThreshold:this.settings.swipeThreshold,swipeTimeThreshold:this.settings.swipeTimeThreshold,zIndex:this.settings.zIndex+1});this.slider=new f({fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,slideSpeed:this.settings.slideSpeed},this.viewport.el);this.captionAndToolbar=new j({opacity:this.settings.captionAndToolbarOpacity,
+fadeInSpeed:this.settings.fadeInSpeed,fadeOutSpeed:this.settings.fadeOutSpeed,autoHideDelay:this.settings.captionAndToolbarAutoHideDelay,flipPosition:this.settings.captionAndToolbarFlipPosition,showEmptyCaptions:this.settings.captionAndToolbarShowEmptyCaptions,hideClose:this.settings.preventHide,zIndex:this.settings.zIndex+3});this.resetPosition()},addEventListeners:function(){this.orientationEventName=a.browser.isAndroid?"resize":"onorientationchange"in c?"orientationchange":"resize";a.DOM.addEventListener(c,
+this.orientationEventName,this.windowOrientationChangeEventHandler);a.DOM.addEventListener(c,"scroll",this.windowScrollEventHandler);if(this.isBackEventSupported&&this.settings.backButtonHideEnabled)this.settings.jQueryMobile?c.location.hash=this.settings.jQueryMobileDialogHash:(this.currentHistoryHashValue="PhotoSwipe"+(new Date).getTime().toString(),c.location.hash=this.currentHistoryHashValue),a.DOM.addEventListener(c,"hashchange",this.windowHashChangeHandler);a.DOM.addEventListener(document,"keydown",
+this.keyDownEventHandler);this.viewport.addEventListener(g.EventTypes.onTouch,this.viewportTouchEventHandler);this.slider.addEventListener(f.EventTypes.onDisplayCurrentFullSizeImage,this.sliderDisplayCurrentFullSizeImageEventHandler);this.captionAndToolbar.addEventListener(i.EventTypes.onClick,this.toolbarClickEventHandler)},removeEventListeners:function(){a.DOM.removeEventListener(c,this.orientationEventName,this.windowOrientationChangeEventHandler);a.DOM.removeEventListener(c,"scroll",this.windowScrollEventHandler);
+this.isBackEventSupported&&this.settings.backButtonHideEnabled&&a.DOM.removeEventListener(c,"hashchange",this.windowHashChangeHandler);a.DOM.removeEventListener(document,"keydown",this.keyDownEventHandler);this.viewport.removeEventListener(g.EventTypes.onTouch,this.viewportTouchEventHandler);this.slider.removeEventListener(f.EventTypes.onDisplayCurrentFullSizeImage,this.sliderDisplayCurrentFullSizeImageEventHandler);this.captionAndToolbar.removeEventListener(i.EventTypes.onClick,this.toolbarClickEventHandler)},
+onViewportFadeIn:function(){this.viewport.removeEventListener(b.EventTypes.onFadeIn,this.viewportFadeInEventHandler);this.documentOverlay.show();this.slider.fadeIn();this.addEventListeners();this.slider.setCurrentFullSizeImage(this.fullSizeImages[this.currentIndex]);this.isBusy=!1;this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShow)},setSliderPreviousAndNextFullSizeImages:function(){var a,b=null,c=null;this.fullSizeImages.length>1&&(a=this.fullSizeImages.length-1,this.currentIndex===a?(this.settings.loop&&
+(c=this.fullSizeImages[0]),b=this.fullSizeImages[this.currentIndex-1]):this.currentIndex===0?(c=this.fullSizeImages[this.currentIndex+1],this.settings.loop&&(b=this.fullSizeImages[a])):(c=this.fullSizeImages[this.currentIndex+1],b=this.fullSizeImages[this.currentIndex-1]));this.slider.setPreviousAndNextFullSizeImages(b,c)},onKeyDown:function(a){this.stopSlideshow();a.keyCode===37?(a.preventDefault(),this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.keyboard,this.showPrevious()):a.keyCode===
+39?(a.preventDefault(),this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.keyboard,this.showNext()):a.keyCode===38||a.keyCode===40?a.preventDefault():a.keyCode===27?(a.preventDefault(),this.hide()):a.keyCode===32&&(this.settings.hideToolbar?this.hide():this.toggleCaptionAndToolbar(),a.preventDefault())},onWindowOrientationChange:function(){this.resetPosition()},onWindowScroll:function(){this.resetPosition()},onWindowHashChange:function(){if(c.location.hash!=="#"+(this.settings.jQueryMobile?
+this.settings.jQueryMobileDialogHash:this.currentHistoryHashValue))this.backButtonClicked=!0,this.hide()},resetPosition:function(){this.removeZoomPanRotate();this.viewport.resetPosition();this.slider.resetPosition();this.documentOverlay.resetPosition();this.captionAndToolbar.resetPosition();this.dispatchEvent(Code.PhotoSwipe.EventTypes.onResetPosition)},canUserZoom:function(){if(!this.settings.allowUserZoom)return!1;if(this.isBusy)return!1;if(a.isNothing(this.slider.currentItem.fullSizeImage))return!1;
+if(!this.slider.currentItem.fullSizeImage.hasLoaded)return!1;return!0},isZoomActive:function(){return!a.isNothing(this.zoomPanRotate)},onViewportTouch:function(b){switch(b.action){case g.Actions.gestureStart:if(this.canUserZoom()){this.stopSlideshow();if(!this.isZoomActive())this.zoomPanRotate=new k({maxZoom:this.settings.maxUserZoom,minZoom:this.settings.minUserZoom,adjustPanToZoom:this.settings.adjustUserPanToZoom},this.viewport.el,this.slider.currentItem.imageEl),a.DOM.resetTranslate(this.zoomPanRotate.containerEl),
+a.DOM.resetTranslate(this.zoomPanRotate.imageEl);this.fadeOutCaptionAndToolbar()}break;case g.Actions.gestureChange:this.isZoomActive()&&this.zoomPanRotate.zoomRotate(b.scale,this.settings.allowRotationOnUserZoom?b.rotation:0);break;case g.Actions.gestureEnd:this.isZoomActive()&&this.zoomPanRotate.setStartingScaleAndRotation(b.scale,this.settings.allowRotationOnUserZoom?b.rotation:0);break;case g.Actions.touchStart:this.stopSlideshow();this.isZoomActive()&&this.zoomPanRotate.panStart(b.point);break;
+case g.Actions.touchMove:this.isZoomActive()&&this.zoomPanRotate.pan(b.point);break;case g.Actions.click:this.stopSlideshow();this.settings.hideToolbar?this.hide():this.toggleCaptionAndToolbar();this.dispatchEvent(Code.PhotoSwipe.EventTypes.onViewportClick);break;case g.Actions.swipeLeft:this.stopSlideshow();this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.swipe;this.showNext();break;case g.Actions.swipeRight:this.stopSlideshow(),this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.swipe,
+this.showPrevious()}},onViewportFadeOut:function(){this.viewport.removeEventListener(b.EventTypes.onFadeOut,this.viewportFadeOutEventHandler);this.isActive=this.isBusy=!1;this.dispatchEvent(Code.PhotoSwipe.EventTypes.onHide);this.goBackInHistory()},hide:function(){if(!this.isBusy&&!this.settings.preventHide&&this.isActive)this.isBusy=!0,this.removeZoomPanRotate(),this.removeEventListeners(),this.documentOverlay.hide(),this.captionAndToolbar.hide(),this.slider.hide(),a.DOM.removeClass(document.body,
+Code.PhotoSwipe.CssClasses.activeBody),this.viewport.addEventListener(b.EventTypes.onFadeOut,this.viewportFadeOutEventHandler),this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeHide),this.viewport.fadeOut()},hideImmediately:function(){if(this.isActive)this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeHide),this.removeZoomPanRotate(),this.removeEventListeners(),this.documentOverlay.hide(),this.captionAndToolbar.hide(),this.slider.hide(),this.viewport.hide(),a.DOM.removeClass(document.body,
+Code.PhotoSwipe.CssClasses.activeBody),this.isActive=this.isBusy=!1,this.dispatchEvent(Code.PhotoSwipe.EventTypes.onHide),this.goBackInHistory()},goBackInHistory:function(){this.isBackEventSupported&&this.settings.backButtonHideEnabled&&(this.backButtonClicked||c.history.back())},showNext:function(){if(!this.isBusy)this.isBusy=!0,this.cleanUpZoomPanRotateForNextPrevious(),this.setCaptionAndToolbarOnShowPreviousNext(),this.slider.showNext(),this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShowNext)},
+showPrevious:function(){if(!this.isBusy)this.isBusy=!0,this.cleanUpZoomPanRotateForNextPrevious(),this.setCaptionAndToolbarOnShowPreviousNext(),this.wasUserZoomActive&&a.DOM.hide(this.slider.currentItem.imageEl),this.slider.showPrevious(),this.dispatchEvent(Code.PhotoSwipe.EventTypes.onShowPrevious)},cleanUpZoomPanRotateForNextPrevious:function(){a.isNothing(this.zoomPanRotate)||(this.settings.loop?a.DOM.hide(this.slider.currentItem.imageEl):this.currentIndex>0&&this.currentIndex=this.fullSizeImages.length-1?this.captionAndToolbar.setNextState(!0):this.captionAndToolbar.setNextState(!1),this.currentIndex<1?this.captionAndToolbar.setPreviousState(!0):this.captionAndToolbar.setPreviousState(!1));this.captionAndToolbar.setCaptionValue(this.fullSizeImages[this.currentIndex].caption);a=!1;switch(this.lastShowPrevTrigger){case Code.PhotoSwipe.ShowPrevTriggers.toolbar:a=
+!0;break;case Code.PhotoSwipe.ShowPrevTriggers.show:a=!0;break;case Code.PhotoSwipe.ShowPrevTriggers.slideshow:a=!1;break;default:a=!this.settings.captionAndToolbarHideOnSwipe}a&&(this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow),this.captionAndToolbar.fadeIn());this.dispatchEvent(Code.PhotoSwipe.EventTypes.onDisplayImage)}this.lastShowPrevTrigger="";this.setSliderPreviousAndNextFullSizeImages();this.isSlideshowActive&&this.fireSlideshowTimeout();this.isBusy=!1},toggleCaptionAndToolbar:function(){this.settings.captionAndToolbarHide?
+this.captionAndToolbar.hide():this.captionAndToolbar.isHidden?(this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow),this.captionAndToolbar.fadeIn()):(this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide),this.captionAndToolbar.fadeOut())},fadeOutCaptionAndToolbar:function(){!this.settings.captionAndToolbarHide&&!this.captionAndToolbar.isHidden&&(this.dispatchEvent(Code.PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide),this.captionAndToolbar.fadeOut())},
+onToolbarClick:function(a){this.stopSlideshow();switch(a.action){case i.Actions.previous:this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.toolbar;this.showPrevious();break;case i.Actions.next:this.lastShowPrevTrigger=Code.PhotoSwipe.ShowPrevTriggers.toolbar;this.showNext();break;case i.Actions.play:this.startSlideshow();break;default:this.hide()}},startSlideshow:function(){if(!this.isBusy)a.isNothing(this.slideshowTimeout)||c.clearTimeout(this.slideshowTimeout),this.removeZoomPanRotate(),
+this.isSlideshowActive=!0,this.fadeOutCaptionAndToolbar(),this.fireSlideshowTimeout(),this.dispatchEvent(Code.PhotoSwipe.EventTypes.onSlideshowStart)},stopSlideshow:function(){a.isNothing(this.slideshowTimeout)||c.clearTimeout(this.slideshowTimeout);this.isSlideshowActive=!1;this.dispatchEvent(Code.PhotoSwipe.EventTypes.onSlideshowStop)},fireSlideshowTimeout:function(){var a=!1;this.settings.loop?this.fullSizeImages.length>1&&(a=!0):this.currentIndex
+
+ PhotoSwipe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
PhotoSwipe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+