( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
var menuopen = false;
var slide_duration = 200;
var SafariWindowHeightFix = 34; // XXX:
var searchTimer;
var searchXHR;
var today = new Date();
var month = today.getMonth();
var year = today.getFullYear();
var curr_display = 'list';
$(document).bind("mobileinit", function(){
$.mobile.ajaxLinksEnabled = false;
$.mobile.ajaxFormsEnabled = true;
$.mobile.ajaxEnabled = false;
$.mobile.category = category;
$('.me-ui-icon-share').live('click', function() {
var obj = window.location.href;
$(this).simpledialog({
'mode' : 'bool',
useDialogForceFalse:true,
'prompt' : '<iframe src="//www.facebook.com/plugins/like.php?href='+obj+'&send=false&layout=standard&show_faces=false&action=like&colorscheme=light&font=arial&height=80&appId='+FACEBOOK_APP_ID+'" scrolling="no" frameborder="0" style="border:none; width:100%; height:50px;margin:5px;overflow:show" allowTransparency="true"></iframe>',
'useModal': true,
'buttons' : {
'CANCEL': {
click: function () {
$('#dialogoutput').text('CANCEL');
}
}
}
});
return false;
});
$('a.expand').live('click',function(){
$('#menu .toggle').toggle();
return false;
});
$('.slide-menu').live('click',function(){
if(menuopen){
close_menu();
}else{
open_menu();
}
return false;
});
$('#menu .ui-listview a[href="#"]').live('click',function(){
if($(this).next('.hidden').hasClass('opened')){
$(this).next('.hidden').removeClass('opened').hide();
$(this).parent().next('.ui-icon').css('top','50%').removeClass('ui-icon-arrow-u').addClass('ui-icon-arrow-d');
}else{
$('#menu .ui-listview .submenu.opened').removeClass('opened').hide();
$(this).next('.hidden').addClass('opened').show();
$(this).parent().next('.ui-icon').css('top','19px').removeClass('ui-icon-arrow-d').addClass('ui-icon-arrow-u');
}
return false;
});
});
$(document).bind( "pagebeforechange", function( e, data ) {
menuopen = false;
// We only want to handle changePage() calls where the caller is
// asking us to load a page by URL.
if ( typeof data.toPage === "string" ) {
// We are being asked to load a page by URL, but we only
// want to handle URLs that request the data for a specific
// category.
var u = $.mobile.path.parseUrl( data.toPage ),
re = /^#category-item/;
if ( u.hash.search(re) !== -1 ) {
// We're being asked to display the items for a specific category.
// Call our internal method that builds the content for the category
// on the fly based on our in-memory category data structure.
showCategory( u, data.options );
// Make sure to tell changePage() we've handled this call so it doesn't
// have to do anything.
e.preventDefault();
}
}
});
$(document).bind( "pageshow", function( e, data ) {
var page = $.mobile.activePage;
var prev = data.prevPage.attr('id');
$.mobile.category = category = page.attr('id');
if(prev == 'home'){
kill_hero();
}else if(page.attr('id') == 'home'){
init_hero();
}
if($.mobile.category == 'news' ){
init_waypoint('list',category);
}else{
$('.load-more').waypoint('remove');
}
$.mobile.activePage.find('.details-navbar .ui-btn:first').trigger('click');
});
var instance,indicators;
function init_hero(){
instance = window.Code.PhotoSwipe.attach(images,
{
target: window.document.querySelectorAll('#PhotoSwipeTarget')[0],
enableKeyboard: false,
preventHide: true,
allowUserZoom:false,
autoStartSlideshow:true,
enableUIWebViewRepositionTimeout:false,
captionAndToolbarHide:true,
preventDefaultTouchEvents:false,
getImageSource: function(obj){
return obj.image;
},
getImageCaption: function(obj){
return obj.caption;
}
},'heros'
);
indicators = window.document.querySelectorAll('#Indicators a');
// onDisplayImage - set the current indicator
instance.addEventHandler(window.Code.PhotoSwipe.EventTypes.onDisplayImage, function(e){
var i, len;
for (i=0, len=indicators.length; i<len; i++){
indicators[i].setAttribute('class', '');
}
indicators[e.index].setAttribute('class', 'current');
curr_hero = e.index;
});
// onTouch
instance.addEventHandler(window.Code.PhotoSwipe.EventTypes.onTouch, function(e){
if(e.action == 'tap') {
window.location = links[e.target.currentIndex].url;
}
});
instance.addEventHandler(window.Code.PhotoSwipe.EventTypes.onHide, function(){
window.Code.PhotoSwipe.unsetActivateInstance(this);
});
instance.show(0);
}
function kill_hero(){
var photoSwipeInstance = window.Code.PhotoSwipe.getInstance('heros');
if (typeof photoSwipeInstance != "undefined" && photoSwipeInstance != null) {
window.Code.PhotoSwipe.detatch(photoSwipeInstance);
window.Code.PhotoSwipe.activeInstances = [];
}
}
function showCategory(urlObj, options ){
var view = urlObj.hash.replace( /.*view=/, "" );
var pageSelector = urlObj.hash.replace( /\?.*$/, "" );
if ( view ) {
// kill any existing data object
$('.data').empty();
// Get the page we are going to dump our content into.
var $page = $('.ui-page-active'),
// Get the header for the page.
$header = $page.children( ":jqmData(role=header)" ),
// Get the content area element for the page.
$content = $page.children( ":jqmData(role=content)" ),
// The markup we are going to inject into the content
// area of the page.
markup = $page.children( ":jqmData(role=navbar)" ).html();
// Find the h1 element in our header and inject the name of
// the category into it.
//$header.find( "h1" ).html( 'asdfasd' );
// Inject the category items markup into the content element.
var markup = build_layout(data,view);
$content.find('.subcontent').html( markup);
$content.find('a.photosgallery:eq(0)').trigger('click');
$content.find('a.videosgallery:eq(0)').trigger('click');
// Pages are lazily enhanced. We call page() on the page
// element to make sure it is always enhanced before we
// attempt to enhance the listview markup we just injected.
// Subsequent calls to page() are ignored since a page/widget
// can only be enhanced once.
$page.page();
$content.find( ":jqmData(role=listview)" ).listview();
$content.find( "form" ).trigger( "create" )
// We don't want the data-url of the page we just modified
// to be the url that shows up in the browser's location field,
// so set the dataUrl option to the URL for the category
// we just loaded.
options.dataUrl = urlObj.href;
// Now call changePage() and tell it to switch to
// the page we just modified.
$.mobile.changePage( $page, options );
}
$("img.delay").lazyload({threshold : 130});
}
function kill_search(){
$('.search-results').slideUp('fast',function(){
open_menu();
$('.ui-menu').show();
$(this).empty();
})
}
function build_layout(data,view){
if(view == 'about' || view == 'release' || view == 'bio' || view == 'content' || view == 'form'){
var content = '';
if(data.featured_image) content += '<img src="'+data.featured_image+'" style="width:100%"/>';
if(data.bio) content += nl2br(data.bio,false);
else if(data.about) content += nl2br(data.about);
else if(data.release && !data.form) content += nl2br(data.release,false);
else if(data.content) content += nl2br(data.content,false);
if(data.form){
if(!$.isEmptyObject(data.release)){
content += nl2br(data.release,false);
}
content += '</br>';
content += build_form(data.form);
}
return content;
}else if(view == 'facts'){
if(data.facts) return '<img src="'+data.facts+'" style="width:100%"/>';
}else if(view == 'rules'){
if(data.rules) return data.rules;
}else if(view == 'ingredients'){
if(data.ingredients) return data.ingredients;
}/*else if(view == 'form'){
return build_form(data.form);
}*/else if(view == 'get_to_know'){
if(data.get_to_know.item.length > 0){
var markup = '';
for(var i in data.get_to_know.item){
markup += '<h3>'+data.get_to_know.item[i].q+'</h3>';
markup += '<h4>'+data.get_to_know.item[i].a+'</h4>';
}
return markup;
}
}else if(view == 'sports'){
if(data.sports.item.length > 0){
var markup = '<ul data-role="listview" data-theme="a">';
for(var i in data.sports.item){
markup += '<li data-icon="false" class="ul-li-no-icon "><a href="'+data.sports.item[i].mobile_details+'" ><h3>'+data.sports.item[i].name+'</h3></a></li>';
}
markup += '</ul>';
return markup;
}
}else if(view == 'winners'){
if(data.winners.item.length > 0){
var markup = '<ul data-role="listview" data-theme="a">';
for(var i in data.winners.item){
markup += '<li data-icon="false" class="ul-li-no-icon "><h3>'+data.winners.item[i].name+'</h3><p>'+data.winners.item[i].date_added+'</p><p>'+data.winners.item[i].city+'</p><p>'+data.winners.item[i].prize_details+'</p></a></li>';
}
markup += '</ul>';
return markup;
}
}else if(view == 'event_stops'){
if(data.event_stops.item.length > 0){
var markup = '<ul data-role="listview" data-theme="a">';
for(var i in data.event_stops.item){
var d1 = parseDate(data.event_stops.item[i].date);
var month = months_short[Number(d1.getMonth())];
var day = d1.getDate();
markup += '<li data-icon="false" class="ul-li-has-shadow ul-li-no-icon ui-li-has-date"><div class="me-ui-date"><span class="month">'+month+'</span><span class="day">'+day+'</span></div><a href="http://maps.google.com/maps?q='+data.event_stops.item[i].latitude+','+data.event_stops.item[i].longitude+'&z=14" ><h3>'+data.event_stops.item[i].title+'</h3><p>'+data.event_stops.item[i].location+'</p></a></li>';
}
markup += '</ul>';
return markup;
}
}
else if(view == 'photos' || view == 'videos'){
var base = {};
if(view == 'photos' && typeof data.image_albums.item.name === 'undefined' ){
base = data.image_albums;
}else if(view == 'videos' && typeof data.video_albums.item.name === 'undefined' ){
base = data.video_albums ;
}else if(view == 'videos'){
base.item = data.video_albums;
}else if(view == 'photos'){
base.item = data.image_albums;
}
var markup = '<ul data-role="listview" data-theme="a">';
for(var i in base.item){
if( typeof base.item[i].files.file !== 'undefined'){
if(base.item[i].files.file.url){
if(view == 'videos'){
markup += '<li data-icon="arrow-d"><a href="'+base.item[i].files.file.url+'" rel="external" ><img class="delay" src="'+WS_ROOT+'images/black.gif" data-original="'+base.item[i].cover+'" alt="'+base.item[i].name+'" /><h3>'+base.item[i].name+'</h3><p>'+base.item[i].name+'</p></a></li>';
}else if(view == 'photos'){
markup += '<li data-icon="arrow-d"><a href="#" class="'+view+'gallery" rel="external" ><img class="delay" src="'+WS_ROOT+'images/black.gif" data-original="'+base.item[i].cover+'" alt="'+base.item[i].name+'" /><h3>'+base.item[i].name+'</h3><p>'+base.item[i].name+'</p></a>';
markup += '<div class="submenu hidden" style="overflow:auto">';
markup += '<a href="'+base.item[i].files.file.url+'" rel="external" class="gallery_photos" style="display:inline-block;"><img src="'+base.item[i].files.file.thumb+'" alt="'+base.item[i].files.file.title+'" width="130" height="110"/></a>';
markup += '</li>';
}
}else{
markup += '<li data-icon="arrow-d"><a href="#" class="'+view+'gallery" rel="'+i+'"><img class="delay" src="'+WS_ROOT+'images/black.gif" data-original="'+base.item[i].cover+'" alt="'+base.item[i].name+'" /><h3>'+base.item[i].name+'</h3><p>'+base.item[i].files.file.length+' Files</p></a>';
markup += '<div class="submenu hidden" style="overflow:auto">';
for(var jj in base.item[i].files.file){
var row = base.item[i].files.file[jj];
if(view == 'videos'){
markup += '<a href="'+row.url+'" rel="external" class="gallery_videos"" style="display:inline-block;"><img class="delay" src="'+row.thumb+'" width="130" height="110"/></a>';
}else if(view == 'photos'){
markup += '<a href="'+row.url+'" rel="external" id="'+i+'-'+jj+'" class="gallery_photos" style="display:inline-block;"><img src="'+row.thumb+'" alt="'+row.title+'" width="130" height="110"/></a>';
}
}
markup += '</div></li>';
}
}
}
markup += '</ul>';
return markup;
}
else if(view == 'music'){
var markup = '<ul class="tracks-list" data-role="listview" data-theme="a" >';
var base = data.music.item;
if(base.filename){
markup += '<li data-icon="false" class="ul-li-has-shadow" >';
markup += music_player(base,0);
markup += '<h3>'+base.title+'</h3><p>'+base.album+'</p></li>';
}else{
for(var i in base){
markup += '<li data-icon="false" class="ul-li-has-shadow" >';
markup += music_player(base[i],i);
markup += '<a href="'+base[i].filename+'" rel="'+i+'"><h3>'+base[i].title+'</h3><p>'+base[i].album+'</p></a></li>';
}
}
markup += '</ul>';
return markup;
}
else if(view == 'news'){
var markup = '<ul data-role="listview" data-theme="a" >';
var base = data.news.item;
if(base.length > 0){
for(var i in base){
markup += list_row('news',base[i]);
}
}
markup += '</ul>';
return markup;
}
else if(view == 'events'){
var markup = '<ul data-role="listview" data-theme="a" >';
var base = data.events.item;
if(base.length > 0){
for(var i in base){
markup += list_row('events',base[i]);
}
}
markup += '</ul>';
return markup;
}else if(view == 'athletes' || view == 'personalities'){
var markup = '<ul data-role="listview" data-theme="a" data-filter="true" data-filter-theme="a" data-divider-theme="a" class="list">';
var object = $.extend({}, data.athletes, data.celebrities);
var base_athletes = {};
if(data.athletes.item){
base_athletes = (data.athletes.item.name)? Array(data.athletes.item):data.athletes.item;
}
var base_celebrities = {};
if(data.celebrities.item){
base_celebrities = (data.celebrities.item.name)? Array(data.celebrities.item):data.celebrities.item;
}
var base = $.extend({}, base_athletes, base_celebrities);
for(var i in base){
markup += list_row(view,base[i]);
}
markup += '</ul>';
return markup;
}
}
function music_player(track,i){
var markup = '<div id="jquery_jplayer_'+i+'" class="cp-jplayer"></div>'
+'<div id="cp_container_'+i+'" class="cp-container" style="margin:5px;">'
+'<ul class="jp-controls cp-controls">'
+'<li><a rel="'+track.filename+'" id="'+i+'" href="#" class="jp-play cp-play cp-play-'+i+'" tabindex="1">play</a></li>'
+'<li><a href="#" class="jp-pause cp-pause cp-pause-'+i+'" rel="'+i+'" style="display:none;" tabindex="1">pause</a></li>'
+'</ul>'
+'</div>';
return markup;
}
function build_form(form){
var action = form.action;
var markup = '<div class="'+form.name+'_results"></div><form name="'+form.name+'" action="'+action+'" method="post" data-ajax="false">';
for(var i in form.item){
var row = form.item[i];
if(row.type == 'hidden'){
markup +='<input type="hidden" name="'+row.name+'" id="field'+i+'" value="'+row.content+'"/>';
}else if(row.type == 'input'){
markup +='<label for="field'+i+'" class="ui-hidden-accessible">'+row.label+'</label>';
markup +='<input type="text" name="'+row.name+'" id="field'+i+'" placeholder="'+row.label+'" '+((row.required == 1)?' class="required"':'')+'/><br/>';
}else if(row.type == 'textarea'){
markup +='<label for="field'+i+'" class="ui-hidden-accessible">'+row.label+'</label>';
markup +='<textarea type="text" name="'+row.name+'" id="field'+i+'" placeholder="'+row.label+'" '+((row.required == 1)?' class="required"':'')+'></textarea><br/>';
}else if(row.type == 'radio'){
markup +='<fieldset data-role="controlgroup">';
markup +='<legend>'+row.label+'</legend>'
for(var j in row.content.item){
markup +='<input type="radio" name="'+row.name+'" id="field'+i+'-'+j+'" value="'+row.content.item[j].value+'" '+((row.required == 1)?' class="custom required"':'class="custom"')+'/>';
markup +='<label for="field'+i+'-'+j+'">'+row.content.item[j].label+'</label>';
}
markup +='</fieldset>';
}else if(row.type == 'checkbox'){
markup +='<fieldset data-role="controlgroup">';
markup +='<legend>'+row.label+'</legend>'
for(var j in row.content.item){
markup +='<input type="checkbox" name="'+row.name+'" id="field'+i+'-'+j+'" value="'+row.content.item[j].value+'" '+((row.required == 1)?' class="custom required"':'class="custom"')+'/>';
markup +='<label for="field'+i+'-'+j+'">'+row.content.item[j].label+'</label>';
}
markup +='</fieldset>';
}else if(row.type == 'select'){
markup +='<label for="field'+i+'" class="ui-hidden-accessible">'+row.label+'</label>';
markup +='<select id="field'+i+'" name="'+row.name+'" data-native-menu="true" '+((row.required == 1)?' class="required"':'')+'>';
markup += '<option value="">'+row.label+'</option>';
for(var j in row.content.item){
markup += '<option value="'+row.content.item[j].value+'">'+row.content.item[j].label+'</option>';
}
markup +='</select><br/>';
}
}
/*
<div data-role="fieldcontain">
<label for="textarea">Textarea:</label>
<textarea name="textarea" id="textarea"></textarea>
</div>
*/
markup += '<div data-role="fieldcontain">';
markup += '<label for="security_code"><img id="verification" class="promo_input" src="http://mobile.monsterenergy.com/services/code.php?sid='+Math.random()+'"/></label>';
markup += '<input class="promo_input promo_input_tiny glow_green" id="security_code" name="security_code" type="text" maxlength="6" placeholder="Security Code"/>';
markup += '</div>';
markup += ' <div style="clear:both"></div> ';
markup += '<button type="submit" data-theme="a" data-icon="arrow-r" style="float:right" data-iconpos="right" data-inline="true">Submit</button>';
markup+='</form>';
return markup;
}
function grid_layout(json,action){
if(action == 'html'){
$('.ui-page-active #list').html('<ul class="ui-grid" data-filter="true"></ul>');
}
var markup = '';
var target = $('.ui-grid');
var k=0;
for(var i in json.result){
for(var j in json.result[i]){
var row = json.result[i][j];
var title = '';
var desc = (row.caption)?' '+row.caption:'';
if(row.title){
title = row.title;
}else{
title = row.name;
if(row.surname && !$.isEmptyObject(row.surname)){
title += ' '+row.surname;
}
}
var cl=(k%2)?'grid-item-odd':'grid-item-even';
var markup = '<li class="grid-item '+cl+'"><a href="'+row.mobile_details+'"><img class="delay" src="'+WS_ROOT+'images/black.gif" data-original="'+row.image2+'" /><span class="grid-label"><h3>'+title+'</h3><p>'+desc+'</p></span></a></li>';
target.append(markup);
k++;
}
}
if(json.next_page[0] && json.next_page[0]!=''){
target.append('<li class="ul-li-load-more" style="clear:both;"><a href="'+json.next_page[0]+'" rel="'+i+'" class="load-more"></a></li>');
}
if(json.next_page[0] && json.next_page[0]!=''){
init_waypoint('grid',$.mobile.category);
}
$("img.delay").lazyload({threshold : 130});
}
function list_layout(json,action,lastDivider,category){
if(action == 'html'){
$('.ui-page-active .ui-grid').remove();
$('.ui-page-active #list').html('<ul data-role="listview" data-theme="a" data-filter="true" data-filter-theme="a" data-divider-theme="a" class="list"></ul>');
$('.ui-page-active #list .list').listview();
}
var markup = '';
for(var i in json.result){
if(i != lastDivider && i != 'me-flat-results'){
markup += '<li data-role="list-divider" >'+i+'</li>';
}
for(var j in json.result[i]){
markup += list_row(json.category,json.result[i][j]);
}
}
if(category!='events' && json.next_page[0] && json.next_page[0]!=''){
markup +='<li class="ul-li-load-more" data-icon="arrow-d"><a href="'+json.next_page[0]+'" rel="'+i+'" class="load-more"><h3>Load more</h3></a></li>';
}
if(action == 'append'){
$('.ui-page-active .list').append(markup).listview('refresh');
}else{
$('.ui-page-active .list').html(markup).listview('refresh');
}
if(category!='events' && json.next_page[0] && json.next_page[0]!=''){
init_waypoint('list',category);
}
$("img.delay").lazyload({threshold : 130});
}
function nl2br (str, is_xhtml){
return str;
}
function show_image_gallery(index,type){
var el= index.split('-');
var options = {
preventHide: false,
getImageSource: function(obj){
return obj.url;
},
getImageCaption: function(obj){
return obj.caption;
}
};
var files = Array();
var base = (data[type].item.length>1)?data[type].item[el[0]]:data[type].item;
for(var i in base.files.file){
files.push({ url: base.files.file[i].url, caption: base.files.file[i].title});
}
var instance = window.Code.PhotoSwipe.attach(
files,
options
);
instance.show(0);
}
function open_menu(){
var page_height = $('.ui-page-active .content-secondary').height();
$('.ui-page-active .content-primary').css({height:page_height,overflow:'hidden'});
menuopen = true;
$('.content-secondary').animate({
width:'279px',
marginLeft: '0'
}, slide_duration, function() {
// Animation complete.
});
$('.content-primary').animate({
marginRight: '-282px'
}, slide_duration, function() {
// Animation complete.
});
}
function expand_menu(){
$('.content-secondary').animate({
width:'100%',
marginLeft: '0'
}, slide_duration, function() {
// Animation complete.
});
$('.content-primary').animate({
marginRight: '-100%'
}, slide_duration, function() {
// Animation complete.
});
}
function close_menu(){
menuopen = false;
$('.ui-page-active .content-primary').css({height:'auto',overflow:'hidden'});
$('.content-secondary').animate({
width:'279px',
marginLeft: '-280px'
}, slide_duration, function() {
// Animation complete.
});
$('.content-primary').animate({
marginRight: '0'
}, slide_duration, function() {
// Animation complete.
});
}
function load_feed(url,display,action,category){
curr_display = display;
var lastDivider = $('a.load-more').attr('rel');
if(action == 'html'){
$('.ui-page-active #list').empty();
}else{
$('.ul-li-load-more').replaceWith('<li class="ul-li-load-more" style="padding:5px"><span style="display:block;width:34px;height:34px" class="ui-icon ui-icon-loading spin"></span></li>');
}
$.ajax({url:WS_ROOT+'?cmd=ajax_request',
data:{feed:url.replace(/ /gi,'%2520'), category:category},
type:'POST',
dataType:'json',
success:function(json){
$('.ul-li-load-more').remove();
if(json.result){
if(display == 'grid'){
grid_layout(json,action);
}else if(display == 'list'){
list_layout(json,action,lastDivider,category);
}
}
}
});
}
function list_row(category,row){
var markup = '';
switch(category){
case "athletes": case "personalities": case "monstergirls": case "bands":
var fullname = '';
if(row.name){
fullname += row.name+' ';
}
if(row.surname && !$.isEmptyObject(row.surname)){
fullname += row.surname.toString()+' ';
}
var desc = '',del='';
for(var i in row.categories){
desc += del + row.categories[i];
del = ', ';
}
markup = '<li class="ul-li-has-shadow ul-li-no-icon" data-icon="false"><a href="'+row.mobile_details+'"><img class="delay" src="'+WS_ROOT+'images/black.gif" data-original="'+row.image+'" width="130" height="110"/><h3>'+fullname+'</h3><p>'+desc+'</p></a></li>';
break;
case "promotions":
markup = '<li class="ul-li-has-shadow ul-li-no-icon" data-icon="false"><a href="'+row.mobile_details+'"><img class="delay" src="'+WS_ROOT+'images/black.gif" data-original="'+row.image+'" width="130" height="110"/><h3>'+row.name+'</h3><p>'+row.caption+'</p></a></li>';
break;
case "news":
markup = '<li class="ul-li-has-shadow ul-li-no-icon" data-icon="false"><a href="'+row.mobile_details+'"><img class="delay" src="'+WS_ROOT+'images/black.gif" data-original="'+row.image+'" width="130" height="110"/><h3>'+row.title+'</h3><p>'+row.caption+'</p></a></li>';
break;
case "events":
var d1 = parseDate(row.date);
var month = months_short[Number(d1.getMonth())];
var day = d1.getDate();
markup += '<li data-icon="false" class="ul-li-has-shadow ul-li-no-icon ui-li-has-date"><a href="'+row.mobile_details+'" ><div class="me-ui-date"><span class="month">'+month+'</span><span class="day">'+day+'</span></div><h3>'+row.title+'</h3><p>'+row.location+'</p></a></li>';
break;
case "brand-finder":
markup += '<li data-icon="false"><a href="http://maps.google.com/maps?q='+row.lat+','+row.long+'&z=14">';
markup += '<h3>'+row.dba+'</h3>';
markup += '<p>'+row.street+'</p>';
markup += '<p>'+row.city+' '+row.state+' '+row.zip+'</p>';
markup += '<p>';
for(var j in row['other_brands']['brand']){
markup += row['other_brands']['brand'][j];
}
markup += '</p>';
markup += '<span class="ui-li-count">'+row.distance+' Miles</span></a></li>';
break;
}
return markup;
}
function search_list_row(row){
var markup = '';
switch(row.type){
case "sports":
markup = '<li class="ul-li-has-shadow ul-li-no-icon" data-icon="false"><a href="'+row.mobile_details+'"><h3>'+row.title+'</h3><p>'+row.breadcrumb+'</p></a></li>';
break;
case "athletes":case "personalities":case "monstergirls":case "bands":
markup = '<li class="ul-li-has-shadow ul-li-no-icon" data-icon="false"><a href="'+row.mobile_details+'"><img src="'+row.image+'"/><h3>'+row.title+'</h3><p>'+row.breadcrumb+'</p></a></li>';
break;
case "news": case "home":
markup = '<li class="ul-li-has-shadow ul-li-no-icon" data-icon="false"><a href="'+row.mobile_details+'"><img src="'+row.image+'"/><h3>'+row.title+'</h3><p>'+row.caption+'</p><p>'+row.breadcrumb+'</p></a></li>';
break;
case "events":
markup = '<li class="ul-li-has-shadow ul-li-no-icon" data-icon="false"><a href="'+row.mobile_details+'"><img src="'+row.image+'"/><h3>'+row.title+'</h3><p>'+row.caption+'</p><p>'+row.breadcrumb+'</p></a></li>';
break;
case "promotions":
markup = '<li class="ul-li-has-shadow ul-li-no-icon" data-icon="false"><a href="'+row.mobile_details+'"><img src="'+row.image+'"/><h3>'+row.title+'</h3><p>'+row.caption+'</p><p>'+row.breadcrumb+'</p></a></li>';
break;
}
return markup;
}
function init_waypoint(display,category){
var $more = $('.load-more');
$more.waypoint(function(event, direction) {
$more.waypoint('remove');
load_feed( $more.attr('href'),display,'append',category);
}, {offset: '100%'});
}
function executeBrandSearch(){
$('form[name="brand_finder_form"]').slideUp('fast');
$('.brand_finder_form_results').html('<div class="ui-bar ui-bar-a"><h3>Searching...please wait</h3></div>').slideDown('fast');
var url = $('#search-brands-gateway').val();
var zip = $('form[name="brand_finder_form"] input[name="zip"]').val();
var distance = $('form[name="brand_finder_form"] select[name="distance"]').val();
var product = $('form[name="brand_finder_form"] select[name="product"]').val().replace(/ /gi,'%2520');
var feed = url + zip+'/'+distance+'/'+product+'/';
$.ajax({ url: WS_ROOT+'?cmd=ajax_request',
data:{feed:feed,category:'brand-finder'},
type:'POST',
dataType:'json',
success:function(json){
if(json.result['me-flat-results']){
brand_finder_results(json);
}else{
alert('Nothing Found')
}
}
});
}
function brand_finder_results(json){
var markup = '<ul data-role="listview" class="list">';
for(var i in json.result['me-flat-results']){
var row = json.result['me-flat-results'][i]
markup += list_row(json.category,row);
}
if(json.next_page[0] && json.next_page[0]!=''){
markup += '<li class="ul-li-load-more" data-icon="arrow-d"><a href="'+json.next_page[0].replace(/ /gi,'%2520')+'" rel="me-flat-results" class="load-more" style="clear:both"><h3>Load more</h3></a></li>';
}
markup += '</ul>';
$('.brand_finder_form_results').html(markup).find('ul').listview();
init_waypoint('list','brand-finder');
}
function executeSearch(param,url){
clearTimeout(searchTimer);
if(searchXHR){
searchXHR.abort();
}
if(param.length >3 ){
$('.ui-menu').hide();
$('.search-results').html('<div class="ui-bar ui-bar-a"><span style="display:block;width:34px;height:34px" class="ui-icon ui-icon-loading spin"></span></div>').show();
searchXHR = $.ajax({ url: WS_ROOT+'?cmd=ajax_request',
data:{feed:encodeURI(url+param+'/'),category:'search'},
type:'POST',
dataType:'json',
success:function(json){
var markup = '';
$('.ul-li-load-more').remove();
if(json.result){
searchResults(json);
}
}
});
}
}
function searchResults(json){
var markup = '<div class="ui-bar ui-bar-a"><h3>Search Results</h3><a href="#" class="ui-link-inherit"><a href="#" class="hide-search-results" data-role="button" data-icon="delete" data-iconpos="notext" data-theme="a" data-inline="true"></a></div>';
markup += '<ul data-role="listview" data-theme="a">';
for(var i in json.result){
if( i != 'me-flat-results'){
markup += '<li data-role="list-divider" >'+i+'</li>';
}
for(var j in json.result[i]){
markup += search_list_row(json.result[i][j]);
}
}
markup +='</ul>';
$('.search-results').html(markup).find('ul').listview().slideDown('fast');
$('.hide-search-results').button();
}
function previous_month(m,y){
if(m == 0){
m = 11;
y = y-1;
}else{
m--;
}
return [m,y];
}
function next_month(m,y){
if(m == 11){
m = 0;
y = y+1;
}else{
m++;
}
return [m,y];
}
function update_event_dates(){
var date = new Date(year, month);
var curr_date = '<h2>'+months_short[date.getMonth()] + '</h2>'+ date.getFullYear();
var p = previous_month(date.getMonth(),date.getFullYear());
var prev_date = '<h2>'+months_short[p[0]] + '</h2>'+ p[1];
var n = next_month(date.getMonth(),date.getFullYear());
var nxt_date = '<h2>'+months_short[n[0]] + '</h2>'+ n[1];
$('.ui-prev-month-label .ui-btn-text').html(prev_date);
$('.ui-curr-month-label .ui-btn-text').html(curr_date);
$('.ui-next-month-label .ui-btn-text').html(nxt_date);
}
function update_events(url){
update_event_dates();
$('.ui-page-active .list').html('<li data-icon="false" ><a href="#"><h3>Loading Events...</h3></a></li>').listview('refresh');
$.ajax({url:WS_ROOT+'?cmd=ajax_request',
data:{feed:url,category:'events'},
type:'POST',
dataType:'json',
success:function(json){
if(json.prev_page[0] && json.prev_page[0]!=''){
$('.ui-prev-month').attr('rel',json.prev_page[0]);
}
if(json.next_page[0] && json.next_page[0]!=''){
$('.ui-next-month').attr('rel',json.next_page[0]);
}
if(json.result['me-flat-results']){
list_layout(json,'html','me-flat-results','events');
}else{
$('.ui-page-active .list').html('<li data-icon="false" ><h3>No Events found. Check back soon.</h3></li>').listview('refresh');
$('.ui-page-active .ui-listview-filter').hide();
}
$('.ui-next-month').removeClass('ui-btn-active');
$('.ui-prev-month').removeClass('ui-btn-active');
$('.ui-curr-month-label').addClass('ui-btn-active');
}
});
}
function parseDate(input, format) {
format = format || 'yyyy-mm-dd'; // default format
var parts = input.match(/(\d+)/g),
i = 0, fmt = {};
// extract date-part indexes from the format
format.replace(/(yyyy|dd|mm)/g, function(part) { fmt[part] = i++; });
return new Date(parts[fmt['yyyy']], parts[fmt['mm']]-1, parts[fmt['dd']]);
};
(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&¶ms.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery);/*! jQuery Mobile v1.0 jquerymobile.com | jquery.org/license */
(function(a,e){if(a.cleanData){var b=a.cleanData;a.cleanData=function(f){for(var c=0,h;(h=f[c])!=null;c++)a(h).triggerHandler("remove");b(f)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){a(this).triggerHandler("remove")});return d.call(a(this),b,c)})}}a.widget=function(b,c,h){var d=b.split(".")[0],e,b=b.split(".")[1];e=d+"-"+b;if(!h)h=c,c=a.Widget;a.expr[":"][e]=function(c){return!!a.data(c,
b)};a[d]=a[d]||{};a[d][b]=function(a,b){arguments.length&&this._createWidget(a,b)};c=new c;c.options=a.extend(true,{},c.options);a[d][b].prototype=a.extend(true,c,{namespace:d,widgetName:b,widgetEventPrefix:a[d][b].prototype.widgetEventPrefix||b,widgetBaseClass:e},h);a.widget.bridge(b,a[d][b])};a.widget.bridge=function(b,c){a.fn[b]=function(d){var g=typeof d==="string",i=Array.prototype.slice.call(arguments,1),k=this,d=!g&&i.length?a.extend.apply(null,[true,d].concat(i)):d;if(g&&d.charAt(0)==="_")return k;
g?this.each(function(){var c=a.data(this,b);if(!c)throw"cannot call methods on "+b+" prior to initialization; attempted to call method '"+d+"'";if(!a.isFunction(c[d]))throw"no such method '"+d+"' for "+b+" widget instance";var g=c[d].apply(c,i);if(g!==c&&g!==e)return k=g,false}):this.each(function(){var e=a.data(this,b);e?e.option(d||{})._init():a.data(this,b,new c(d,this))});return k}};a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",
options:{disabled:false},_createWidget:function(b,c){a.data(c,this.widgetName,this);this.element=a(c);this.options=a.extend(true,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){var b={};a.metadata&&(b=a.metadata.get(element)[this.widgetName]);return b},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);
this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(b,c){var d=b;if(arguments.length===0)return a.extend({},this.options);if(typeof b==="string"){if(c===e)return this.options[b];d={};d[b]=c}this._setOptions(d);return this},_setOptions:function(b){var c=this;a.each(b,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,b){this.options[a]=b;a==="disabled"&&
this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",b);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(b,c,d){var e=this.options[b],c=a.Event(c);c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase();d=d||{};if(c.originalEvent)for(var b=a.event.props.length,i;b;)i=a.event.props[--b],c[i]=c.originalEvent[i];this.element.trigger(c,
d);return!(a.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
(function(a,e){a.widget("mobile.widget",{_createWidget:function(){a.Widget.prototype._createWidget.apply(this,arguments);this._trigger("init")},_getCreateOptions:function(){var b=this.element,d={};a.each(this.options,function(a){var c=b.jqmData(a.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()}));c!==e&&(d[a]=c)});return d},enhanceWithin:function(b){var d=a(b).closest(":jqmData(role='page')").data("page"),d=d&&d.keepNativeSelector()||"";a(this.options.initSelector,b).not(d)[this.widgetName]()}})})(jQuery);
(function(a){a(window);var e=a("html");a.mobile.media=function(){var b={},d=a("<div id='jquery-mediatest'>"),f=a("<body>").append(d);return function(a){if(!(a in b)){var h=document.createElement("style"),g="@media "+a+" { #jquery-mediatest { position:absolute; } }";h.type="text/css";h.styleSheet?h.styleSheet.cssText=g:h.appendChild(document.createTextNode(g));e.prepend(f).prepend(h);b[a]=d.css("position")==="absolute";f.add(h).remove()}return b[a]}}()})(jQuery);
(function(a,e){function b(a){var b=a.charAt(0).toUpperCase()+a.substr(1),a=(a+" "+c.join(b+" ")+b).split(" "),d;for(d in a)if(f[a[d]]!==e)return true}var d=a("<body>").prependTo("html"),f=d[0].style,c=["Webkit","Moz","O"],h="palmGetResource"in window,g=window.operamini&&{}.toString.call(window.operamini)==="[object OperaMini]",i=window.blackberry;a.mobile.browser={};a.mobile.browser.ie=function(){for(var a=3,b=document.createElement("div"),c=b.all||[];b.innerHTML="<\!--[if gt IE "+ ++a+"]><br><![endif]--\>",
c[0];);return a>4?a:!a}();a.extend(a.support,{orientation:"orientation"in window&&"onorientationchange"in window,touch:"ontouchend"in document,cssTransitions:"WebKitTransitionEvent"in window,pushState:"pushState"in history&&"replaceState"in history,mediaquery:a.mobile.media("only all"),cssPseudoElement:!!b("content"),touchOverflow:!!b("overflowScrolling"),boxShadow:!!b("boxShadow")&&!i,scrollTop:("pageXOffset"in window||"scrollTop"in document.documentElement||"scrollTop"in d[0])&&!h&&!g,dynamicBaseTag:function(){var b=
location.protocol+"//"+location.host+location.pathname+"ui-dir/",c=a("head base"),f=null,e="",h;c.length?e=c.attr("href"):c=f=a("<base>",{href:b}).appendTo("head");h=a("<a href='testurl' />").prependTo(d)[0].href;c[0].href=e||location.pathname;f&&f.remove();return h.indexOf(b)===0}()});d.remove();h=function(){var a=window.navigator.userAgent;return a.indexOf("Nokia")>-1&&(a.indexOf("Symbian/3")>-1||a.indexOf("Series60/5")>-1)&&a.indexOf("AppleWebKit")>-1&&a.match(/(BrowserNG|NokiaBrowser)\/7\.[0-3]/)}();
a.mobile.ajaxBlacklist=window.blackberry&&!window.WebKitPoint||g||h;h&&a(function(){a("head link[rel='stylesheet']").attr("rel","alternate stylesheet").attr("rel","stylesheet")});a.support.boxShadow||a("html").addClass("ui-mobile-nosupport-boxshadow")})(jQuery);
(function(a,e,b,d){function f(a){for(;a&&typeof a.originalEvent!=="undefined";)a=a.originalEvent;return a}function c(b){for(var c={},f,d;b;){f=a.data(b,n);for(d in f)if(f[d])c[d]=c.hasVirtualBinding=true;b=b.parentNode}return c}function h(){v&&(clearTimeout(v),v=0);v=setTimeout(function(){E=v=0;u.length=0;D=false;y=true},a.vmouse.resetTimerDuration)}function g(b,c,r){var e,h;if(!(h=r&&r[b])){if(r=!r)a:{for(r=c.target;r;){if((h=a.data(r,n))&&(!b||h[b]))break a;r=r.parentNode}r=null}h=r}if(h){e=c;var r=
e.type,j,g;e=a.Event(e);e.type=b;h=e.originalEvent;j=a.event.props;if(h)for(g=j.length;g;)b=j[--g],e[b]=h[b];if(r.search(/mouse(down|up)|click/)>-1&&!e.which)e.which=1;if(r.search(/^touch/)!==-1&&(b=f(h),r=b.touches,b=b.changedTouches,r=r&&r.length?r[0]:b&&b.length?b[0]:d))for(h=0,len=z.length;h<len;h++)b=z[h],e[b]=r[b];a(c.target).trigger(e)}return e}function i(b){var c=a.data(b.target,A);if(!D&&(!E||E!==c))if(c=g("v"+b.type,b))c.isDefaultPrevented()&&b.preventDefault(),c.isPropagationStopped()&&
b.stopPropagation(),c.isImmediatePropagationStopped()&&b.stopImmediatePropagation()}function k(b){var d=f(b).touches,e;if(d&&d.length===1&&(e=b.target,d=c(e),d.hasVirtualBinding))E=r++,a.data(e,A,E),v&&(clearTimeout(v),v=0),w=y=false,e=f(b).touches[0],x=e.pageX,t=e.pageY,g("vmouseover",b,d),g("vmousedown",b,d)}function l(a){y||(w||g("vmousecancel",a,c(a.target)),w=true,h())}function o(b){if(!y){var d=f(b).touches[0],r=w,e=a.vmouse.moveDistanceThreshold;w=w||Math.abs(d.pageX-x)>e||Math.abs(d.pageY-
t)>e;flags=c(b.target);w&&!r&&g("vmousecancel",b,flags);g("vmousemove",b,flags);h()}}function m(a){if(!y){y=true;var b=c(a.target),d;g("vmouseup",a,b);if(!w&&(d=g("vclick",a,b))&&d.isDefaultPrevented())d=f(a).changedTouches[0],u.push({touchID:E,x:d.clientX,y:d.clientY}),D=true;g("vmouseout",a,b);w=false;h()}}function p(b){var b=a.data(b,n),c;if(b)for(c in b)if(b[c])return true;return false}function j(){}function q(b){var c=b.substr(1);return{setup:function(){p(this)||a.data(this,n,{});a.data(this,
n)[b]=true;s[b]=(s[b]||0)+1;s[b]===1&&B.bind(c,i);a(this).bind(c,j);if(C)s.touchstart=(s.touchstart||0)+1,s.touchstart===1&&B.bind("touchstart",k).bind("touchend",m).bind("touchmove",o).bind("scroll",l)},teardown:function(){--s[b];s[b]||B.unbind(c,i);C&&(--s.touchstart,s.touchstart||B.unbind("touchstart",k).unbind("touchmove",o).unbind("touchend",m).unbind("scroll",l));var d=a(this),f=a.data(this,n);f&&(f[b]=false);d.unbind(c,j);p(this)||d.removeData(n)}}}var n="virtualMouseBindings",A="virtualTouchID",
e="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),z="clientX clientY pageX pageY screenX screenY".split(" "),s={},v=0,x=0,t=0,w=false,u=[],D=false,y=false,C="addEventListener"in b,B=a(b),r=1,E=0;a.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(var F=0;F<e.length;F++)a.event.special[e[F]]=q(e[F]);C&&b.addEventListener("click",function(b){var c=u.length,d=b.target,f,r,e,h,j;if(c){f=b.clientX;r=b.clientY;threshold=a.vmouse.clickDistanceThreshold;
for(e=d;e;){for(h=0;h<c;h++)if(j=u[h],e===d&&Math.abs(j.x-f)<threshold&&Math.abs(j.y-r)<threshold||a.data(e,A)===j.touchID){b.preventDefault();b.stopPropagation();return}e=e.parentNode}}},true)})(jQuery,window,document);
(function(a,e,b){function d(b,c,d){var f=d.type;d.type=c;a.event.handle.call(b,d);d.type=f}a.each("touchstart touchmove touchend orientationchange throttledresize tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(b,c){a.fn[c]=function(a){return a?this.bind(c,a):this.trigger(c)};a.attrFn[c]=true});var f=a.support.touch,c=f?"touchstart":"mousedown",h=f?"touchend":"mouseup",g=f?"touchmove":"mousemove";a.event.special.scrollstart={enabled:true,setup:function(){function b(a,
e){f=e;d(c,f?"scrollstart":"scrollstop",a)}var c=this,f,e;a(c).bind("touchmove scroll",function(c){a.event.special.scrollstart.enabled&&(f||b(c,true),clearTimeout(e),e=setTimeout(function(){b(c,false)},50))})}};a.event.special.tap={setup:function(){var b=this,c=a(b);c.bind("vmousedown",function(f){function e(){clearTimeout(q)}function h(){e();c.unbind("vclick",g).unbind("vmouseup",e).unbind("vmousecancel",h)}function g(a){h();j==a.target&&d(b,"tap",a)}if(f.which&&f.which!==1)return false;var j=f.target,
q;c.bind("vmousecancel",h).bind("vmouseup",e).bind("vclick",g);q=setTimeout(function(){d(b,"taphold",a.Event("taphold"))},750)})}};a.event.special.swipe={scrollSupressionThreshold:10,durationThreshold:1E3,horizontalDistanceThreshold:30,verticalDistanceThreshold:75,setup:function(){var d=a(this);d.bind(c,function(c){function f(b){if(m){var c=b.originalEvent.touches?b.originalEvent.touches[0]:b;p={time:(new Date).getTime(),coords:[c.pageX,c.pageY]};Math.abs(m.coords[0]-p.coords[0])>a.event.special.swipe.scrollSupressionThreshold&&
b.preventDefault()}}var e=c.originalEvent.touches?c.originalEvent.touches[0]:c,m={time:(new Date).getTime(),coords:[e.pageX,e.pageY],origin:a(c.target)},p;d.bind(g,f).one(h,function(){d.unbind(g,f);m&&p&&p.time-m.time<a.event.special.swipe.durationThreshold&&Math.abs(m.coords[0]-p.coords[0])>a.event.special.swipe.horizontalDistanceThreshold&&Math.abs(m.coords[1]-p.coords[1])<a.event.special.swipe.verticalDistanceThreshold&&m.origin.trigger("swipe").trigger(m.coords[0]>p.coords[0]?"swipeleft":"swiperight");
m=p=b})})}};(function(a,b){function c(){var a=f();a!==e&&(e=a,d.trigger("orientationchange"))}var d=a(b),f,e;a.event.special.orientationchange={setup:function(){if(a.support.orientation&&a.mobile.orientationChangeEnabled)return false;e=f();d.bind("throttledresize",c)},teardown:function(){if(a.support.orientation&&a.mobile.orientationChangeEnabled)return false;d.unbind("throttledresize",c)},add:function(a){var b=a.handler;a.handler=function(a){a.orientation=f();return b.apply(this,arguments)}}};a.event.special.orientationchange.orientation=
f=function(){var c=true,c=document.documentElement;return(c=a.support.orientation?b.orientation%180==0:c&&c.clientWidth/c.clientHeight<1.1)?"portrait":"landscape"}})(jQuery,e);(function(){a.event.special.throttledresize={setup:function(){a(this).bind("resize",b)},teardown:function(){a(this).unbind("resize",b)}};var b=function(){f=(new Date).getTime();e=f-c;e>=250?(c=f,a(this).trigger("throttledresize")):(d&&clearTimeout(d),d=setTimeout(b,250-e))},c=0,d,f,e})();a.each({scrollstop:"scrollstart",taphold:"tap",
swipeleft:"swipe",swiperight:"swipe"},function(b,c){a.event.special[b]={setup:function(){a(this).bind(c,a.noop)}}})})(jQuery,this);
(function(a,e,b){function d(a){a=a||location.href;return"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var f="hashchange",c=document,h,g=a.event.special,i=c.documentMode,k="on"+f in e&&(i===b||i>7);a.fn[f]=function(a){return a?this.bind(f,a):this.trigger(f)};a.fn[f].delay=50;g[f]=a.extend(g[f],{setup:function(){if(k)return false;a(h.start)},teardown:function(){if(k)return false;a(h.stop)}});h=function(){function h(){var b=d(),c=n(p);if(b!==p)q(p=b,c),a(e).trigger(f);else if(c!==p)location.href=location.href.replace(/#.*/,
"")+c;i=setTimeout(h,a.fn[f].delay)}var g={},i,p=d(),j=function(a){return a},q=j,n=j;g.start=function(){i||h()};g.stop=function(){i&&clearTimeout(i);i=b};a.browser.msie&&!k&&function(){var b,e;g.start=function(){if(!b)e=(e=a.fn[f].src)&&e+d(),b=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){e||q(d());h()}).attr("src",e||"javascript:0").insertAfter("body")[0].contentWindow,c.onpropertychange=function(){try{if(event.propertyName==="title")b.document.title=c.title}catch(a){}}};
g.stop=j;n=function(){return d(b.location.href)};q=function(d,e){var h=b.document,g=a.fn[f].domain;if(d!==e)h.title=c.title,h.open(),g&&h.write('<script>document.domain="'+g+'"<\/script>'),h.close(),b.location.hash=d}}();return g}()})(jQuery,this);
(function(a){a.widget("mobile.page",a.mobile.widget,{options:{theme:"c",domCache:false,keepNativeDefault:":jqmData(role='none'), :jqmData(role='nojs')"},_create:function(){this._trigger("beforecreate");this.element.attr("tabindex","0").addClass("ui-page ui-body-"+this.options.theme)},keepNativeSelector:function(){var e=this.options;return e.keepNative&&a.trim(e.keepNative)&&e.keepNative!==e.keepNativeDefault?[e.keepNative,e.keepNativeDefault].join(", "):e.keepNativeDefault}})})(jQuery);
(function(a,e){var b={};a.extend(a.mobile,{ns:"",subPageUrlKey:"ui-page",activePageClass:"ui-page-active",activeBtnClass:"ui-btn-active",ajaxEnabled:true,hashListeningEnabled:true,linkBindingEnabled:true,defaultPageTransition:"slide",minScrollBack:250,defaultDialogTransition:"pop",loadingMessage:"loading",pageLoadErrorMessage:"Error Loading Page",autoInitializePage:true,pushStateEnabled:true,orientationChangeEnabled:true,gradeA:function(){return a.support.mediaquery||a.mobile.browser.ie&&a.mobile.browser.ie>=
7},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},silentScroll:function(b){if(a.type(b)!=="number")b=a.mobile.defaultHomeScroll;a.event.special.scrollstart.enabled=false;
setTimeout(function(){e.scrollTo(0,b);a(document).trigger("silentscroll",{x:0,y:b})},20);setTimeout(function(){a.event.special.scrollstart.enabled=true},150)},nsNormalizeDict:b,nsNormalize:function(c){return!c?void 0:b[c]||(b[c]=a.camelCase(a.mobile.ns+c))},getInheritedTheme:function(a,b){for(var d=a[0],f="",e=/ui-(bar|body)-([a-z])\b/,l,o;d;){l=d.className||"";if((o=e.exec(l))&&(f=o[2]))break;d=d.parentNode}return f||b||"a"}});a.fn.jqmData=function(b,d){var f;typeof b!="undefined"&&(f=this.data(b?
a.mobile.nsNormalize(b):b,d));return f};a.jqmData=function(b,d,f){var e;typeof d!="undefined"&&(e=a.data(b,d?a.mobile.nsNormalize(d):d,f));return e};a.fn.jqmRemoveData=function(b){return this.removeData(a.mobile.nsNormalize(b))};a.jqmRemoveData=function(b,d){return a.removeData(b,a.mobile.nsNormalize(d))};a.fn.removeWithDependents=function(){a.removeWithDependents(this)};a.removeWithDependents=function(b){b=a(b);(b.jqmData("dependents")||a()).remove();b.remove()};a.fn.addDependents=function(b){a.addDependents(a(this),
b)};a.addDependents=function(b,d){var f=a(b).jqmData("dependents")||a();a(b).jqmData("dependents",a.merge(f,d))};a.fn.getEncodedText=function(){return a("<div/>").text(a(this).text()).html()};var d=a.find,f=/:jqmData\(([^)]*)\)/g;a.find=function(b,e,g,i){b=b.replace(f,"[data-"+(a.mobile.ns||"")+"$1]");return d.call(this,b,e,g,i)};a.extend(a.find,d);a.find.matches=function(b,d){return a.find(b,null,null,d)};a.find.matchesSelector=function(b,d){return a.find(d,null,null,[b]).length>0}})(jQuery,this);
(function(a,e){function b(a){var b=a.find(".ui-title:eq(0)");b.length?b.focus():a.focus()}function d(b){q&&(!q.closest(".ui-page-active").length||b)&&q.removeClass(a.mobile.activeBtnClass);q=null}function f(){z=false;A.length>0&&a.mobile.changePage.apply(null,A.pop())}function c(c,d,f,e){var g=a.mobile.urlHistory.getActive(),j=a.support.touchOverflow&&a.mobile.touchOverflowEnabled,i=g.lastScroll||(j?0:a.mobile.defaultHomeScroll),g=h();window.scrollTo(0,a.mobile.defaultHomeScroll);d&&d.data("page")._trigger("beforehide",
null,{nextPage:c});j||c.height(g+i);c.data("page")._trigger("beforeshow",null,{prevPage:d||a("")});a.mobile.hidePageLoadingMsg();j&&i&&(c.addClass("ui-mobile-pre-transition"),b(c),c.is(".ui-native-fixed")?c.find(".ui-content").scrollTop(i):c.scrollTop(i));f=(a.mobile.transitionHandlers[f||"none"]||a.mobile.defaultTransitionHandler)(f,e,c,d);f.done(function(){j||(c.height(""),b(c));j||a.mobile.silentScroll(i);d&&(j||d.height(""),d.data("page")._trigger("hide",null,{nextPage:c}));c.data("page")._trigger("show",
null,{prevPage:d||a("")})});return f}function h(){var b=a.event.special.orientationchange.orientation()==="portrait",c=b?screen.availHeight:screen.availWidth,b=Math.max(b?480:320,a(window).height());return Math.min(c,b)}function g(){(!a.support.touchOverflow||!a.mobile.touchOverflowEnabled)&&a("."+a.mobile.activePageClass).css("min-height",h())}function i(b,c){c&&b.attr("data-"+a.mobile.ns+"role",c);b.page()}function k(a){for(;a;){if(typeof a.nodeName==="string"&&a.nodeName.toLowerCase()=="a")break;
a=a.parentNode}return a}function l(b){var b=a(b).closest(".ui-page").jqmData("url"),c=t.hrefNoHash;if(!b||!j.isPath(b))b=c;return j.makeUrlAbsolute(b,c)}var o=a(window),m=a("html"),p=a("head"),j={urlParseRE:/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,parseUrl:function(b){if(a.type(b)==="object")return b;b=j.urlParseRE.exec(b||"")||[];return{href:b[0]||"",hrefNoHash:b[1]||
"",hrefNoSearch:b[2]||"",domain:b[3]||"",protocol:b[4]||"",doubleSlash:b[5]||"",authority:b[6]||"",username:b[8]||"",password:b[9]||"",host:b[10]||"",hostname:b[11]||"",port:b[12]||"",pathname:b[13]||"",directory:b[14]||"",filename:b[15]||"",search:b[16]||"",hash:b[17]||""}},makePathAbsolute:function(a,b){if(a&&a.charAt(0)==="/")return a;for(var a=a||"",c=(b=b?b.replace(/^\/|(\/[^\/]*|[^\/]+)$/g,""):"")?b.split("/"):[],d=a.split("/"),f=0;f<d.length;f++){var e=d[f];switch(e){case ".":break;case "..":c.length&&
c.pop();break;default:c.push(e)}}return"/"+c.join("/")},isSameDomain:function(a,b){return j.parseUrl(a).domain===j.parseUrl(b).domain},isRelativeUrl:function(a){return j.parseUrl(a).protocol===""},isAbsoluteUrl:function(a){return j.parseUrl(a).protocol!==""},makeUrlAbsolute:function(a,b){if(!j.isRelativeUrl(a))return a;var c=j.parseUrl(a),d=j.parseUrl(b),f=c.protocol||d.protocol,e=c.protocol?c.doubleSlash:c.doubleSlash||d.doubleSlash,h=c.authority||d.authority,g=c.pathname!=="",i=j.makePathAbsolute(c.pathname||
d.filename,d.pathname);return f+e+h+i+(c.search||!g&&d.search||"")+c.hash},addSearchParams:function(b,c){var d=j.parseUrl(b),f=typeof c==="object"?a.param(c):c,e=d.search||"?";return d.hrefNoSearch+e+(e.charAt(e.length-1)!=="?"?"&":"")+f+(d.hash||"")},convertUrlToDataUrl:function(a){var b=j.parseUrl(a);if(j.isEmbeddedPage(b))return b.hash.split(s)[0].replace(/^#/,"");else if(j.isSameDomain(b,t))return b.hrefNoHash.replace(t.domain,"");return a},get:function(a){if(a===e)a=location.hash;return j.stripHash(a).replace(/[^\/]*\.[^\/*]+$/,
"")},getFilePath:function(b){var c="&"+a.mobile.subPageUrlKey;return b&&b.split(c)[0].split(s)[0]},set:function(a){location.hash=a},isPath:function(a){return/\//.test(a)},clean:function(a){return a.replace(t.domain,"")},stripHash:function(a){return a.replace(/^#/,"")},cleanHash:function(a){return j.stripHash(a.replace(/\?.*$/,"").replace(s,""))},isExternal:function(a){a=j.parseUrl(a);return a.protocol&&a.domain!==x.domain?true:false},hasProtocol:function(a){return/^(:?\w+:)/.test(a)},isFirstPageUrl:function(b){var b=
j.parseUrl(j.makeUrlAbsolute(b,t)),c=a.mobile.firstPage,c=c&&c[0]?c[0].id:e;return(b.hrefNoHash===x.hrefNoHash||w&&b.hrefNoHash===t.hrefNoHash)&&(!b.hash||b.hash==="#"||c&&b.hash.replace(/^#/,"")===c)},isEmbeddedPage:function(a){a=j.parseUrl(a);return a.protocol!==""?a.hash&&(a.hrefNoHash===x.hrefNoHash||w&&a.hrefNoHash===t.hrefNoHash):/^#/.test(a.href)}},q=null,n={stack:[],activeIndex:0,getActive:function(){return n.stack[n.activeIndex]},getPrev:function(){return n.stack[n.activeIndex-1]},getNext:function(){return n.stack[n.activeIndex+
1]},addNew:function(a,b,c,d,f){n.getNext()&&n.clearForward();n.stack.push({url:a,transition:b,title:c,pageUrl:d,role:f});n.activeIndex=n.stack.length-1},clearForward:function(){n.stack=n.stack.slice(0,n.activeIndex+1)},directHashChange:function(b){var c,d,f;this.getActive();a.each(n.stack,function(a,e){b.currentUrl===e.url&&(c=a<n.activeIndex,d=!c,f=a)});this.activeIndex=f!==e?f:this.activeIndex;c?(b.either||b.isBack)(true):d&&(b.either||b.isForward)(false)},ignoreNextHashChange:false},A=[],z=false,
s="&ui-state=dialog",v=p.children("base"),x=j.parseUrl(location.href),t=v.length?j.parseUrl(j.makeUrlAbsolute(v.attr("href"),x.href)):x,w=x.hrefNoHash!==t.hrefNoHash,u=a.support.dynamicBaseTag?{element:v.length?v:a("<base>",{href:t.hrefNoHash}).prependTo(p),set:function(a){u.element.attr("href",j.makeUrlAbsolute(a,t))},reset:function(){u.element.attr("href",t.hrefNoHash)}}:e,D=true,y,C,B;y=function(){var b=o;a.support.touchOverflow&&a.mobile.touchOverflowEnabled&&(b=a(".ui-page-active"),b=b.is(".ui-native-fixed")?
b.find(".ui-content"):b);return b};C=function(b){if(D){var c=a.mobile.urlHistory.getActive();if(c)b=b&&b.scrollTop(),c.lastScroll=b<a.mobile.minScrollBack?a.mobile.defaultHomeScroll:b}};B=function(){setTimeout(C,100,a(this))};o.bind(a.support.pushState?"popstate":"hashchange",function(){D=false});o.one(a.support.pushState?"popstate":"hashchange",function(){D=true});o.one("pagecontainercreate",function(){a.mobile.pageContainer.bind("pagechange",function(){var a=y();D=true;a.unbind("scrollstop",B);
a.bind("scrollstop",B)})});y().bind("scrollstop",B);a.mobile.getScreenHeight=h;a.fn.animationComplete=function(b){return a.support.cssTransitions?a(this).one("webkitAnimationEnd",b):(setTimeout(b,0),a(this))};a.mobile.path=j;a.mobile.base=u;a.mobile.urlHistory=n;a.mobile.dialogHashKey=s;a.mobile.noneTransitionHandler=function(b,c,d,f){f&&f.removeClass(a.mobile.activePageClass);d.addClass(a.mobile.activePageClass);return a.Deferred().resolve(b,c,d,f).promise()};a.mobile.defaultTransitionHandler=a.mobile.noneTransitionHandler;
a.mobile.transitionHandlers={none:a.mobile.defaultTransitionHandler};a.mobile.allowCrossDomainPages=false;a.mobile.getDocumentUrl=function(b){return b?a.extend({},x):x.href};a.mobile.getDocumentBase=function(b){return b?a.extend({},t):t.href};a.mobile._bindPageRemove=function(){var b=a(this);!b.data("page").options.domCache&&b.is(":jqmData(external-page='true')")&&b.bind("pagehide.remove",function(){var b=a(this),c=new a.Event("pageremove");b.trigger(c);c.isDefaultPrevented()||b.removeWithDependents()})};
a.mobile.loadPage=function(b,c){var d=a.Deferred(),f=a.extend({},a.mobile.loadPage.defaults,c),h=null,g=null,m=j.makeUrlAbsolute(b,a.mobile.activePage&&l(a.mobile.activePage)||t.hrefNoHash);if(f.data&&f.type==="get")m=j.addSearchParams(m,f.data),f.data=e;if(f.data&&f.type==="post")f.reloadPage=true;var s=j.getFilePath(m),p=j.convertUrlToDataUrl(m);f.pageContainer=f.pageContainer||a.mobile.pageContainer;h=f.pageContainer.children(":jqmData(url='"+p+"')");h.length===0&&p&&!j.isPath(p)&&(h=f.pageContainer.children("#"+
p).attr("data-"+a.mobile.ns+"url",p));if(h.length===0)if(a.mobile.firstPage&&j.isFirstPageUrl(s))a.mobile.firstPage.parent().length&&(h=a(a.mobile.firstPage));else if(j.isEmbeddedPage(s))return d.reject(m,c),d.promise();u&&u.reset();if(h.length){if(!f.reloadPage)return i(h,f.role),d.resolve(m,c,h),d.promise();g=h}var n=f.pageContainer,k=new a.Event("pagebeforeload"),q={url:b,absUrl:m,dataUrl:p,deferred:d,options:f};n.trigger(k,q);if(k.isDefaultPrevented())return d.promise();if(f.showLoadMsg)var v=
setTimeout(function(){a.mobile.showPageLoadingMsg()},f.loadMsgDelay);!a.mobile.allowCrossDomainPages&&!j.isSameDomain(x,m)?d.reject(m,c):a.ajax({url:s,type:f.type,data:f.data,dataType:"html",success:function(e,n,k){var o=a("<div></div>"),l=e.match(/<title[^>]*>([^<]*)/)&&RegExp.$1,t=RegExp("\\bdata-"+a.mobile.ns+"url=[\"']?([^\"'>]*)[\"']?");RegExp("(<[^>]+\\bdata-"+a.mobile.ns+"role=[\"']?page[\"']?[^>]*>)").test(e)&&RegExp.$1&&t.test(RegExp.$1)&&RegExp.$1&&(b=s=j.getFilePath(RegExp.$1));u&&u.set(s);
o.get(0).innerHTML=e;h=o.find(":jqmData(role='page'), :jqmData(role='dialog')").first();h.length||(h=a("<div data-"+a.mobile.ns+"role='page'>"+e.split(/<\/?body[^>]*>/gmi)[1]+"</div>"));l&&!h.jqmData("title")&&(~l.indexOf("&")&&(l=a("<div>"+l+"</div>").text()),h.jqmData("title",l));if(!a.support.dynamicBaseTag){var x=j.get(s);h.find("[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]").each(function(){var b=a(this).is("[href]")?"href":a(this).is("[src]")?"src":"action",c=a(this).attr(b),
c=c.replace(location.protocol+"//"+location.host+location.pathname,"");/^(\w+:|#|\/)/.test(c)||a(this).attr(b,x+c)})}h.attr("data-"+a.mobile.ns+"url",j.convertUrlToDataUrl(s)).attr("data-"+a.mobile.ns+"external-page",true).appendTo(f.pageContainer);h.one("pagecreate",a.mobile._bindPageRemove);i(h,f.role);m.indexOf("&"+a.mobile.subPageUrlKey)>-1&&(h=f.pageContainer.children(":jqmData(url='"+p+"')"));f.showLoadMsg&&(clearTimeout(v),a.mobile.hidePageLoadingMsg());q.xhr=k;q.textStatus=n;q.page=h;f.pageContainer.trigger("pageload",
q);d.resolve(m,c,h,g)},error:function(b,e,h){u&&u.set(j.get());q.xhr=b;q.textStatus=e;q.errorThrown=h;b=new a.Event("pageloadfailed");f.pageContainer.trigger(b,q);b.isDefaultPrevented()||(f.showLoadMsg&&(clearTimeout(v),a.mobile.hidePageLoadingMsg(),a("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h1>"+a.mobile.pageLoadErrorMessage+"</h1></div>").css({display:"block",opacity:0.96,top:o.scrollTop()+100}).appendTo(f.pageContainer).delay(800).fadeOut(400,function(){a(this).remove()})),
d.reject(m,c))}});return d.promise()};a.mobile.loadPage.defaults={type:"get",data:e,reloadPage:false,role:e,showLoadMsg:false,pageContainer:e,loadMsgDelay:50};a.mobile.changePage=function(b,h){if(z)A.unshift(arguments);else{var g=a.extend({},a.mobile.changePage.defaults,h);g.pageContainer=g.pageContainer||a.mobile.pageContainer;g.fromPage=g.fromPage||a.mobile.activePage;var p=g.pageContainer,k=new a.Event("pagebeforechange"),q={toPage:b,options:g};p.trigger(k,q);if(!k.isDefaultPrevented())if(b=q.toPage,
z=true,typeof b=="string")a.mobile.loadPage(b,g).done(function(b,c,d,f){z=false;c.duplicateCachedPage=f;a.mobile.changePage(d,c)}).fail(function(){z=false;d(true);f();g.pageContainer.trigger("pagechangefailed",q)});else{if(b[0]===a.mobile.firstPage[0]&&!g.dataUrl)g.dataUrl=x.hrefNoHash;var k=g.fromPage,l=g.dataUrl&&j.convertUrlToDataUrl(g.dataUrl)||b.jqmData("url"),v=l;j.getFilePath(l);var o=n.getActive(),t=n.activeIndex===0,w=0,u=document.title,y=g.role==="dialog"||b.jqmData("role")==="dialog";if(k&&
k[0]===b[0]&&!g.allowSamePageTransition)z=false,p.trigger("pagechange",q);else{i(b,g.role);g.fromHashChange&&n.directHashChange({currentUrl:l,isBack:function(){w=-1},isForward:function(){w=1}});try{document.activeElement&&document.activeElement.nodeName.toLowerCase()!="body"?a(document.activeElement).blur():a("input:focus, textarea:focus, select:focus").blur()}catch(B){}y&&o&&(l=(o.url||"")+s);if(g.changeHash!==false&&l)n.ignoreNextHashChange=true,j.set(l);var C=!o?u:b.jqmData("title")||b.children(":jqmData(role='header')").find(".ui-title").getEncodedText();
C&&u==document.title&&(u=C);b.jqmData("title")||b.jqmData("title",u);g.transition=g.transition||(w&&!t?o.transition:e)||(y?a.mobile.defaultDialogTransition:a.mobile.defaultPageTransition);w||n.addNew(l,g.transition,u,v,g.role);document.title=n.getActive().title;a.mobile.activePage=b;g.reverse=g.reverse||w<0;c(b,k,g.transition,g.reverse).done(function(){d();g.duplicateCachedPage&&g.duplicateCachedPage.remove();m.removeClass("ui-mobile-rendering");f();p.trigger("pagechange",q)})}}}};a.mobile.changePage.defaults=
{transition:e,reverse:false,changeHash:true,fromHashChange:false,role:e,duplicateCachedPage:e,pageContainer:e,showLoadMsg:true,dataUrl:e,fromPage:e,allowSamePageTransition:false};a.mobile._registerInternalEvents=function(){a("form").live("submit",function(b){var c=a(this);if(a.mobile.ajaxEnabled&&!c.is(":jqmData(ajax='false')")){var d=c.attr("method"),f=c.attr("target"),e=c.attr("action");if(!e&&(e=l(c),e===t.hrefNoHash))e=x.hrefNoSearch;e=j.makeUrlAbsolute(e,l(c));!j.isExternal(e)&&!f&&(a.mobile.changePage(e,
{type:d&&d.length&&d.toLowerCase()||"get",data:c.serialize(),transition:c.jqmData("transition"),direction:c.jqmData("direction"),reloadPage:true}),b.preventDefault())}});a(document).bind("vclick",function(b){if(!(b.which>1)&&a.mobile.linkBindingEnabled&&(b=k(b.target))&&j.parseUrl(b.getAttribute("href")||"#").hash!=="#")d(true),q=a(b).closest(".ui-btn").not(".ui-disabled"),q.addClass(a.mobile.activeBtnClass),a("."+a.mobile.activePageClass+" .ui-btn").not(b).blur()});a(document).bind("click",function(b){if(a.mobile.linkBindingEnabled){var c=
k(b.target);if(c&&!(b.which>1)){var f=a(c),h=function(){window.setTimeout(function(){d(true)},200)};if(f.is(":jqmData(rel='back')"))return window.history.back(),false;var g=l(f),c=j.makeUrlAbsolute(f.attr("href")||"#",g);if(!a.mobile.ajaxEnabled&&!j.isEmbeddedPage(c))h();else{if(c.search("#")!=-1)if(c=c.replace(/[^#]*#/,""))c=j.isPath(c)?j.makeUrlAbsolute(c,g):j.makeUrlAbsolute("#"+c,x.hrefNoHash);else{b.preventDefault();return}var g=f.is("[rel='external']")||f.is(":jqmData(ajax='false')")||f.is("[target]"),
i=a.mobile.allowCrossDomainPages&&x.protocol==="file:"&&c.search(/^https?:/)!=-1;g||j.isExternal(c)&&!i?h():(h=f.jqmData("transition"),g=(g=f.jqmData("direction"))&&g==="reverse"||f.jqmData("back"),f=f.attr("data-"+a.mobile.ns+"rel")||e,a.mobile.changePage(c,{transition:h,reverse:g,role:f}),b.preventDefault())}}}});a(".ui-page").live("pageshow.prefetch",function(){var b=[];a(this).find("a:jqmData(prefetch)").each(function(){var c=a(this),f=c.attr("href");f&&a.inArray(f,b)===-1&&(b.push(f),a.mobile.loadPage(f,
{role:c.attr("data-"+a.mobile.ns+"rel")}))})});a.mobile._handleHashChange=function(b){var c=j.stripHash(b),f={transition:a.mobile.urlHistory.stack.length===0?"none":e,changeHash:false,fromHashChange:true};if(!a.mobile.hashListeningEnabled||n.ignoreNextHashChange)n.ignoreNextHashChange=false;else{if(n.stack.length>1&&c.indexOf(s)>-1)if(a.mobile.activePage.is(".ui-dialog"))n.directHashChange({currentUrl:c,either:function(b){var d=a.mobile.urlHistory.getActive();c=d.pageUrl;a.extend(f,{role:d.role,transition:d.transition,
reverse:b})}});else{n.directHashChange({currentUrl:c,isBack:function(){window.history.back()},isForward:function(){window.history.forward()}});return}c?(c=typeof c==="string"&&!j.isPath(c)?j.makeUrlAbsolute("#"+c,t):c,a.mobile.changePage(c,f)):a.mobile.changePage(a.mobile.firstPage,f)}};o.bind("hashchange",function(){a.mobile._handleHashChange(location.hash)});a(document).bind("pageshow",g);a(window).bind("throttledresize",g)}})(jQuery);
(function(a,e){var b={},d=a(e),f=a.mobile.path.parseUrl(location.href);a.extend(b,{initialFilePath:f.pathname+f.search,initialHref:f.hrefNoHash,hashchangeFired:false,state:function(){return{hash:location.hash||"#"+b.initialFilePath,title:document.title,initialHref:b.initialHref}},resetUIKeys:function(b){var f="&"+a.mobile.subPageUrlKey,d=b.indexOf(a.mobile.dialogHashKey);d>-1?b=b.slice(0,d)+"#"+b.slice(d):b.indexOf(f)>-1&&(b=b.split(f).join("#"+f));return b},nextHashChangePrevented:function(c){a.mobile.urlHistory.ignoreNextHashChange=
c;b.onHashChangeDisabled=c},onHashChange:function(){if(!b.onHashChangeDisabled){var c,f;c=location.hash;var d=a.mobile.path.isPath(c),e=d?location.href:a.mobile.getDocumentUrl();c=d?c.replace("#",""):c;f=b.state();c=a.mobile.path.makeUrlAbsolute(c,e);d&&(c=b.resetUIKeys(c));history.replaceState(f,document.title,c)}},onPopState:function(c){var f=c.originalEvent.state;f&&(b.nextHashChangePrevented(true),setTimeout(function(){b.nextHashChangePrevented(false);a.mobile._handleHashChange(f.hash)},100))},
init:function(){d.bind("hashchange",b.onHashChange);d.bind("popstate",b.onPopState);location.hash===""&&history.replaceState(b.state(),document.title,location.href)}});a(function(){a.mobile.pushStateEnabled&&a.support.pushState&&b.init()})})(jQuery,this);
(function(a){function e(b,d,f,c){var e=new a.Deferred,g=d?" reverse":"",i="ui-mobile-viewport-transitioning viewport-"+b;f.animationComplete(function(){f.add(c).removeClass("out in reverse "+b);c&&c[0]!==f[0]&&c.removeClass(a.mobile.activePageClass);f.parent().removeClass(i);e.resolve(b,d,f,c)});f.parent().addClass(i);c&&c.addClass(b+" out"+g);f.addClass(a.mobile.activePageClass+" "+b+" in"+g);return e.promise()}a.mobile.css3TransitionHandler=e;if(a.mobile.defaultTransitionHandler===a.mobile.noneTransitionHandler)a.mobile.defaultTransitionHandler=
e})(jQuery,this);
(function(a){a.mobile.page.prototype.options.degradeInputs={color:false,date:false,datetime:false,"datetime-local":false,email:false,month:false,number:false,range:"number",search:"text",tel:false,time:false,url:false,week:false};a(document).bind("pagecreate create",function(e){var b=a(e.target).closest(':jqmData(role="page")').data("page"),d;if(b)d=b.options,a(e.target).find("input").not(b.keepNativeSelector()).each(function(){var b=a(this),c=this.getAttribute("type"),e=d.degradeInputs[c]||"text";
if(d.degradeInputs[c]){var g=a("<div>").html(b.clone()).html(),i=g.indexOf(" type=")>-1;b.replaceWith(g.replace(i?/\s+type=["']?\w+['"]?/:/\/?>/,' type="'+e+'" data-'+a.mobile.ns+'type="'+c+'"'+(i?"":">")))}})})})(jQuery);
(function(a,e){a.widget("mobile.dialog",a.mobile.widget,{options:{closeBtnText:"Close",overlayTheme:"a",initSelector:":jqmData(role='dialog')"},_create:function(){var b=this,d=this.element,f=a("<a href='#' data-"+a.mobile.ns+"icon='delete' data-"+a.mobile.ns+"iconpos='notext'>"+this.options.closeBtnText+"</a>");d.addClass("ui-overlay-"+this.options.overlayTheme);d.attr("role","dialog").addClass("ui-dialog").find(":jqmData(role='header')").addClass("ui-corner-top ui-overlay-shadow").prepend(f).end().find(":jqmData(role='content'),:jqmData(role='footer')").addClass("ui-overlay-shadow").last().addClass("ui-corner-bottom");
f.bind("vclick",function(){b.close()});d.bind("vclick submit",function(b){var b=a(b.target).closest(b.type==="vclick"?"a":"form"),f;b.length&&!b.jqmData("transition")&&(f=a.mobile.urlHistory.getActive()||{},b.attr("data-"+a.mobile.ns+"transition",f.transition||a.mobile.defaultDialogTransition).attr("data-"+a.mobile.ns+"direction","reverse"))}).bind("pagehide",function(){a(this).find("."+a.mobile.activeBtnClass).removeClass(a.mobile.activeBtnClass)})},close:function(){e.history.back()}});a(a.mobile.dialog.prototype.options.initSelector).live("pagecreate",
function(){a(this).dialog()})})(jQuery,this);
(function(a){a.mobile.page.prototype.options.backBtnText="Back";a.mobile.page.prototype.options.addBackBtn=false;a.mobile.page.prototype.options.backBtnTheme=null;a.mobile.page.prototype.options.headerTheme="a";a.mobile.page.prototype.options.footerTheme="a";a.mobile.page.prototype.options.contentTheme=null;a(":jqmData(role='page'), :jqmData(role='dialog')").live("pagecreate",function(){var e=a(this),b=e.data("page").options,d=e.jqmData("role"),f=b.theme;a(":jqmData(role='header'), :jqmData(role='footer'), :jqmData(role='content')",
this).each(function(){var c=a(this),e=c.jqmData("role"),g=c.jqmData("theme"),i=g||b.contentTheme||d==="dialog"&&f,k;c.addClass("ui-"+e);if(e==="header"||e==="footer"){var l=g||(e==="header"?b.headerTheme:b.footerTheme)||f;c.addClass("ui-bar-"+l).attr("role",e==="header"?"banner":"contentinfo");g=c.children("a");i=g.hasClass("ui-btn-left");k=g.hasClass("ui-btn-right");i=i||g.eq(0).not(".ui-btn-right").addClass("ui-btn-left").length;k||g.eq(1).addClass("ui-btn-right");b.addBackBtn&&e==="header"&&a(".ui-page").length>
1&&c.jqmData("url")!==a.mobile.path.stripHash(location.hash)&&!i&&a("<a href='#' class='ui-btn-left' data-"+a.mobile.ns+"rel='back' data-"+a.mobile.ns+"icon='arrow-l'>"+b.backBtnText+"</a>").attr("data-"+a.mobile.ns+"theme",b.backBtnTheme||l).prependTo(c);c.children("h1, h2, h3, h4, h5, h6").addClass("ui-title").attr({tabindex:"0",role:"heading","aria-level":"1"})}else e==="content"&&(i&&c.addClass("ui-body-"+i),c.attr("role","main"))})})})(jQuery);
(function(a){a.widget("mobile.collapsible",a.mobile.widget,{options:{expandCueText:" click to expand contents",collapseCueText:" click to collapse contents",collapsed:true,heading:"h1,h2,h3,h4,h5,h6,legend",theme:null,contentTheme:null,iconTheme:"d",initSelector:":jqmData(role='collapsible')"},_create:function(){var e=this.element,b=this.options,d=e.addClass("ui-collapsible"),f=e.children(b.heading).first(),c=d.wrapInner("<div class='ui-collapsible-content'></div>").find(".ui-collapsible-content"),
h=e.closest(":jqmData(role='collapsible-set')").addClass("ui-collapsible-set"),e=h.children(":jqmData(role='collapsible')");f.is("legend")&&(f=a("<div role='heading'>"+f.html()+"</div>").insertBefore(f),f.next().remove());if(h.length){if(!b.theme)b.theme=h.jqmData("theme");if(!b.contentTheme)b.contentTheme=h.jqmData("content-theme")}c.addClass(b.contentTheme?"ui-body-"+b.contentTheme:"");f.insertBefore(c).addClass("ui-collapsible-heading").append("<span class='ui-collapsible-heading-status'></span>").wrapInner("<a href='#' class='ui-collapsible-heading-toggle'></a>").find("a").first().buttonMarkup({shadow:false,
corners:false,iconPos:"left",icon:"plus",theme:b.theme});h.length?(h.jqmData("collapsiblebound")||h.jqmData("collapsiblebound",true).bind("expand",function(b){a(b.target).closest(".ui-collapsible").siblings(".ui-collapsible").trigger("collapse")}),e.first().find("a").first().addClass("ui-corner-top").find(".ui-btn-inner").addClass("ui-corner-top"),e.last().jqmData("collapsible-last",true).find("a").first().addClass("ui-corner-bottom").find(".ui-btn-inner").addClass("ui-corner-bottom"),d.jqmData("collapsible-last")&&
f.find("a").first().add(f.find(".ui-btn-inner")).addClass("ui-corner-bottom")):f.find("a").first().add(f.find(".ui-btn-inner")).addClass("ui-corner-top ui-corner-bottom");d.bind("expand collapse",function(e){if(!e.isDefaultPrevented()){e.preventDefault();var i=a(this),e=e.type==="collapse",k=b.contentTheme;f.toggleClass("ui-collapsible-heading-collapsed",e).find(".ui-collapsible-heading-status").text(e?b.expandCueText:b.collapseCueText).end().find(".ui-icon").toggleClass("ui-icon-minus",!e).toggleClass("ui-icon-plus",
e);i.toggleClass("ui-collapsible-collapsed",e);c.toggleClass("ui-collapsible-content-collapsed",e).attr("aria-hidden",e);if(k&&(!h.length||d.jqmData("collapsible-last")))f.find("a").first().add(f.find(".ui-btn-inner")).toggleClass("ui-corner-bottom",e),c.toggleClass("ui-corner-bottom",!e);c.trigger("updatelayout")}}).trigger(b.collapsed?"collapse":"expand");f.bind("click",function(a){var b=f.is(".ui-collapsible-heading-collapsed")?"expand":"collapse";d.trigger(b);a.preventDefault()})}});a(document).bind("pagecreate create",
function(e){a(a.mobile.collapsible.prototype.options.initSelector,e.target).collapsible()})})(jQuery);(function(a){a.fn.fieldcontain=function(){return this.addClass("ui-field-contain ui-body ui-br")};a(document).bind("pagecreate create",function(e){a(":jqmData(role='fieldcontain')",e.target).fieldcontain()})})(jQuery);
(function(a){a.fn.grid=function(e){return this.each(function(){var b=a(this),d=a.extend({grid:null},e),f=b.children(),c={solo:1,a:2,b:3,c:4,d:5},d=d.grid;if(!d)if(f.length<=5)for(var h in c)c[h]===f.length&&(d=h);else d="a";c=c[d];b.addClass("ui-grid-"+d);f.filter(":nth-child("+c+"n+1)").addClass("ui-block-a");c>1&&f.filter(":nth-child("+c+"n+2)").addClass("ui-block-b");c>2&&f.filter(":nth-child(3n+3)").addClass("ui-block-c");c>3&&f.filter(":nth-child(4n+4)").addClass("ui-block-d");c>4&&f.filter(":nth-child(5n+5)").addClass("ui-block-e")})}})(jQuery);
(function(a,e){a.widget("mobile.navbar",a.mobile.widget,{options:{iconpos:"top",grid:null,initSelector:":jqmData(role='navbar')"},_create:function(){var b=this.element,d=b.find("a"),f=d.filter(":jqmData(icon)").length?this.options.iconpos:e;b.addClass("ui-navbar").attr("role","navigation").find("ul").grid({grid:this.options.grid});f||b.addClass("ui-navbar-noicons");d.buttonMarkup({corners:false,shadow:false,iconpos:f});b.delegate("a","vclick",function(){d.not(".ui-state-persist").removeClass(a.mobile.activeBtnClass);
a(this).addClass(a.mobile.activeBtnClass)})}});a(document).bind("pagecreate create",function(b){a(a.mobile.navbar.prototype.options.initSelector,b.target).navbar()})})(jQuery);
(function(a){var e={};a.widget("mobile.listview",a.mobile.widget,{options:{theme:null,countTheme:"c",headerTheme:"b",dividerTheme:"b",splitIcon:"arrow-r",splitTheme:"b",inset:false,initSelector:":jqmData(role='listview')"},_create:function(){var a=this;a.element.addClass(function(d,f){return f+" ui-listview "+(a.options.inset?" ui-listview-inset ui-corner-all ui-shadow ":"")});a.refresh(true)},_removeCorners:function(a,d){a=a.add(a.find(".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb"));d==="top"?a.removeClass("ui-corner-top ui-corner-tr ui-corner-tl"):
d==="bottom"?a.removeClass("ui-corner-bottom ui-corner-br ui-corner-bl"):a.removeClass("ui-corner-top ui-corner-tr ui-corner-tl ui-corner-bottom ui-corner-br ui-corner-bl")},_refreshCorners:function(a){var d,f;this.options.inset&&(d=this.element.children("li"),f=a?d.not(".ui-screen-hidden"):d.filter(":visible"),this._removeCorners(d),d=f.first().addClass("ui-corner-top"),d.add(d.find(".ui-btn-inner").not(".ui-li-link-alt span:first-child")).addClass("ui-corner-top").end().find(".ui-li-link-alt, .ui-li-link-alt span:first-child").addClass("ui-corner-tr").end().find(".ui-li-thumb").not(".ui-li-icon").addClass("ui-corner-tl"),
f=f.last().addClass("ui-corner-bottom"),f.add(f.find(".ui-btn-inner")).find(".ui-li-link-alt").addClass("ui-corner-br").end().find(".ui-li-thumb").not(".ui-li-icon").addClass("ui-corner-bl"));a||this.element.trigger("updatelayout")},_findFirstElementByTagName:function(a,d,f,c){var e={};for(e[f]=e[c]=true;a;){if(e[a.nodeName])return a;a=a[d]}return null},_getChildrenByTagName:function(b,d,f){var c=[],e={};e[d]=e[f]=true;for(b=b.firstChild;b;)e[b.nodeName]&&c.push(b),b=b.nextSibling;return a(c)},_addThumbClasses:function(b){var d,
f,c=b.length;for(d=0;d<c;d++)f=a(this._findFirstElementByTagName(b[d].firstChild,"nextSibling","img","IMG")),f.length&&(f.addClass("ui-li-thumb"),a(this._findFirstElementByTagName(f[0].parentNode,"parentNode","li","LI")).addClass(f.is(".ui-li-icon")?"ui-li-has-icon":"ui-li-has-thumb"))},refresh:function(b){this.parentPage=this.element.closest(".ui-page");this._createSubPages();var d=this.options,f=this.element,c=f.jqmData("dividertheme")||d.dividerTheme,e=f.jqmData("splittheme"),g=f.jqmData("spliticon"),
i=this._getChildrenByTagName(f[0],"li","LI"),k=a.support.cssPseudoElement||!a.nodeName(f[0],"ol")?0:1,l={},o,m,p,j,q;k&&f.find(".ui-li-dec").remove();if(!d.theme)d.theme=a.mobile.getInheritedTheme(this.element,"c");for(var n=0,A=i.length;n<A;n++){o=i.eq(n);m="ui-li";if(b||!o.hasClass("ui-li"))p=o.jqmData("theme")||d.theme,j=this._getChildrenByTagName(o[0],"a","A"),j.length?(q=o.jqmData("icon"),o.buttonMarkup({wrapperEls:"div",shadow:false,corners:false,iconpos:"right",icon:j.length>1||q===false?false:
q||"arrow-r",theme:p}),q!=false&&j.length==1&&o.addClass("ui-li-has-arrow"),j.first().addClass("ui-link-inherit"),j.length>1&&(m+=" ui-li-has-alt",j=j.last(),q=e||j.jqmData("theme")||d.splitTheme,j.appendTo(o).attr("title",j.getEncodedText()).addClass("ui-li-link-alt").empty().buttonMarkup({shadow:false,corners:false,theme:p,icon:false,iconpos:false}).find(".ui-btn-inner").append(a(document.createElement("span")).buttonMarkup({shadow:true,corners:true,theme:q,iconpos:"notext",icon:g||j.jqmData("icon")||
d.splitIcon})))):o.jqmData("role")==="list-divider"?(m+=" ui-li-divider ui-btn ui-bar-"+c,o.attr("role","heading"),k&&(k=1)):m+=" ui-li-static ui-body-"+p;k&&m.indexOf("ui-li-divider")<0&&(p=o.is(".ui-li-static:first")?o:o.find(".ui-link-inherit"),p.addClass("ui-li-jsnumbering").prepend("<span class='ui-li-dec'>"+k++ +". </span>"));l[m]||(l[m]=[]);l[m].push(o[0])}for(m in l)a(l[m]).addClass(m).children(".ui-btn-inner").addClass(m);f.find("h1, h2, h3, h4, h5, h6").addClass("ui-li-heading").end().find("p, dl").addClass("ui-li-desc").end().find(".ui-li-aside").each(function(){var b=
a(this);b.prependTo(b.parent())}).end().find(".ui-li-count").each(function(){a(this).closest("li").addClass("ui-li-has-count")}).addClass("ui-btn-up-"+(f.jqmData("counttheme")||this.options.countTheme)+" ui-btn-corner-all");this._addThumbClasses(i);this._addThumbClasses(f.find(".ui-link-inherit"));this._refreshCorners(b)},_idStringEscape:function(a){return a.replace(/[^a-zA-Z0-9]/g,"-")},_createSubPages:function(){var b=this.element,d=b.closest(".ui-page"),f=d.jqmData("url"),c=f||d[0][a.expando],
h=b.attr("id"),g=this.options,i="data-"+a.mobile.ns,k=this,l=d.find(":jqmData(role='footer')").jqmData("id"),o;typeof e[c]==="undefined"&&(e[c]=-1);h=h||++e[c];a(b.find("li>ul, li>ol").toArray().reverse()).each(function(c){var d=a(this),e=d.attr("id")||h+"-"+c,c=d.parent(),k=a(d.prevAll().toArray().reverse()),k=k.length?k:a("<span>"+a.trim(c.contents()[0].nodeValue)+"</span>"),n=k.first().getEncodedText(),e=(f||"")+"&"+a.mobile.subPageUrlKey+"="+e,A=d.jqmData("theme")||g.theme,z=d.jqmData("counttheme")||
b.jqmData("counttheme")||g.countTheme;o=true;d.detach().wrap("<div "+i+"role='page' "+i+"url='"+e+"' "+i+"theme='"+A+"' "+i+"count-theme='"+z+"'><div "+i+"role='content'></div></div>").parent().before("<div "+i+"role='header' "+i+"theme='"+g.headerTheme+"'><div class='ui-title'>"+n+"</div></div>").after(l?a("<div "+i+"role='footer' "+i+"id='"+l+"'>"):"").parent().appendTo(a.mobile.pageContainer).page();d=c.find("a:first");d.length||(d=a("<a/>").html(k||n).prependTo(c.empty()));d.attr("href","#"+e)}).listview();
o&&d.is(":jqmData(external-page='true')")&&d.data("page").options.domCache===false&&d.unbind("pagehide.remove").bind("pagehide.remove",function(b,c){var e=c.nextPage;c.nextPage&&(e=e.jqmData("url"),e.indexOf(f+"&"+a.mobile.subPageUrlKey)!==0&&(k.childPages().remove(),d.remove()))})},childPages:function(){var b=this.parentPage.jqmData("url");return a(":jqmData(url^='"+b+"&"+a.mobile.subPageUrlKey+"')")}});a(document).bind("pagecreate create",function(b){a(a.mobile.listview.prototype.options.initSelector,
b.target).listview()})})(jQuery);
(function(a){a.mobile.listview.prototype.options.filter=false;a.mobile.listview.prototype.options.filterPlaceholder="Filter items...";a.mobile.listview.prototype.options.filterTheme="c";a.mobile.listview.prototype.options.filterCallback=function(a,b){return a.toLowerCase().indexOf(b)===-1};a(":jqmData(role='listview')").live("listviewcreate",function(){var e=a(this),b=e.data("listview");if(b.options.filter){var d=a("<form>",{"class":"ui-listview-filter ui-bar-"+b.options.filterTheme,role:"search"});
a("<input>",{placeholder:b.options.filterPlaceholder}).attr("data-"+a.mobile.ns+"type","search").jqmData("lastval","").bind("keyup change",function(){var d=a(this),c=this.value.toLowerCase(),h=null,h=d.jqmData("lastval")+"",g=false,i="";d.jqmData("lastval",c);i=c.substr(0,h.length-1).replace(h,"");h=c.length<h.length||i.length!=c.length-h.length?e.children():e.children(":not(.ui-screen-hidden)");if(c){for(var k=h.length-1;k>=0;k--)d=a(h[k]),i=d.jqmData("filtertext")||d.text(),d.is("li:jqmData(role=list-divider)")?
(d.toggleClass("ui-filter-hidequeue",!g),g=false):b.options.filterCallback(i,c)?d.toggleClass("ui-filter-hidequeue",true):g=true;h.filter(":not(.ui-filter-hidequeue)").toggleClass("ui-screen-hidden",false);h.filter(".ui-filter-hidequeue").toggleClass("ui-screen-hidden",true).toggleClass("ui-filter-hidequeue",false)}else h.toggleClass("ui-screen-hidden",false);b._refreshCorners()}).appendTo(d).textinput();a(this).jqmData("inset")&&d.addClass("ui-listview-filter-inset");d.bind("submit",function(){return false}).insertBefore(e)}})})(jQuery);
(function(a){a(document).bind("pagecreate create",function(e){a(":jqmData(role='nojs')",e.target).addClass("ui-nojs")})})(jQuery);
(function(a,e){a.widget("mobile.checkboxradio",a.mobile.widget,{options:{theme:null,initSelector:"input[type='checkbox'],input[type='radio']"},_create:function(){var b=this,d=this.element,f=d.closest("form,fieldset,:jqmData(role='page')").find("label[for='"+d[0].id+"']"),c=d.attr("type"),h=c+"-on",g=c+"-off",i=d.parents(":jqmData(type='horizontal')").length?e:g;if(!(c!=="checkbox"&&c!=="radio")){a.extend(this,{label:f,inputtype:c,checkedClass:"ui-"+h+(i?"":" "+a.mobile.activeBtnClass),uncheckedClass:"ui-"+
g,checkedicon:"ui-icon-"+h,uncheckedicon:"ui-icon-"+g});if(!this.options.theme)this.options.theme=this.element.jqmData("theme");f.buttonMarkup({theme:this.options.theme,icon:i,shadow:false});d.add(f).wrapAll("<div class='ui-"+c+"'></div>");f.bind({vmouseover:function(b){a(this).parent().is(".ui-disabled")&&b.stopPropagation()},vclick:function(a){if(d.is(":disabled"))a.preventDefault();else return b._cacheVals(),d.prop("checked",c==="radio"&&true||!d.prop("checked")),d.triggerHandler("click"),b._getInputSet().not(d).prop("checked",
false),b._updateAll(),false}});d.bind({vmousedown:function(){b._cacheVals()},vclick:function(){var c=a(this);c.is(":checked")?(c.prop("checked",true),b._getInputSet().not(c).prop("checked",false)):c.prop("checked",false);b._updateAll()},focus:function(){f.addClass("ui-focus")},blur:function(){f.removeClass("ui-focus")}});this.refresh()}},_cacheVals:function(){this._getInputSet().each(function(){var b=a(this);b.jqmData("cacheVal",b.is(":checked"))})},_getInputSet:function(){return this.inputtype==
"checkbox"?this.element:this.element.closest("form,fieldset,:jqmData(role='page')").find("input[name='"+this.element.attr("name")+"'][type='"+this.inputtype+"']")},_updateAll:function(){var b=this;this._getInputSet().each(function(){var d=a(this);(d.is(":checked")||b.inputtype==="checkbox")&&d.trigger("change")}).checkboxradio("refresh")},refresh:function(){var b=this.element,d=this.label,f=d.find(".ui-icon");a(b[0]).prop("checked")?(d.addClass(this.checkedClass).removeClass(this.uncheckedClass),
f.addClass(this.checkedicon).removeClass(this.uncheckedicon)):(d.removeClass(this.checkedClass).addClass(this.uncheckedClass),f.removeClass(this.checkedicon).addClass(this.uncheckedicon));b.is(":disabled")?this.disable():this.enable()},disable:function(){this.element.prop("disabled",true).parent().addClass("ui-disabled")},enable:function(){this.element.prop("disabled",false).parent().removeClass("ui-disabled")}});a(document).bind("pagecreate create",function(b){a.mobile.checkboxradio.prototype.enhanceWithin(b.target)})})(jQuery);
(function(a,e){a.widget("mobile.button",a.mobile.widget,{options:{theme:null,icon:null,iconpos:null,inline:null,corners:true,shadow:true,iconshadow:true,initSelector:"button, [type='button'], [type='submit'], [type='reset'], [type='image']"},_create:function(){var b=this.element,d=this.options,f,c;this.button=a("<div></div>").text(b.text()||b.val()).insertBefore(b).buttonMarkup({theme:d.theme,icon:d.icon,iconpos:d.iconpos,inline:d.inline,corners:d.corners,shadow:d.shadow,iconshadow:d.iconshadow}).append(b.addClass("ui-btn-hidden"));
d=b.attr("type");f=b.attr("name");d!=="button"&&d!=="reset"&&f&&b.bind("vclick",function(){c===e&&(c=a("<input>",{type:"hidden",name:b.attr("name"),value:b.attr("value")}).insertBefore(b),a(document).one("submit",function(){c.remove();c=e}))});this.refresh()},enable:function(){this.element.attr("disabled",false);this.button.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.button.addClass("ui-disabled").attr("aria-disabled",
true);return this._setOption("disabled",true)},refresh:function(){var a=this.element;a.prop("disabled")?this.disable():this.enable();this.button.data("textWrapper").text(a.text()||a.val())}});a(document).bind("pagecreate create",function(b){a.mobile.button.prototype.enhanceWithin(b.target)})})(jQuery);
(function(a,e){a.widget("mobile.slider",a.mobile.widget,{options:{theme:null,trackTheme:null,disabled:false,initSelector:"input[type='range'], :jqmData(type='range'), :jqmData(role='slider')"},_create:function(){var b=this,d=this.element,f=a.mobile.getInheritedTheme(d,"c"),c=this.options.theme||f,h=this.options.trackTheme||f,g=d[0].nodeName.toLowerCase(),f=g=="select"?"ui-slider-switch":"",i=d.attr("id"),k=i+"-label",i=a("[for='"+i+"']").attr("id",k),l=function(){return g=="input"?parseFloat(d.val()):
d[0].selectedIndex},o=g=="input"?parseFloat(d.attr("min")):0,m=g=="input"?parseFloat(d.attr("max")):d.find("option").length-1,p=window.parseFloat(d.attr("step")||1),j=a("<div class='ui-slider "+f+" ui-btn-down-"+h+" ui-btn-corner-all' role='application'></div>"),q=a("<a href='#' class='ui-slider-handle'></a>").appendTo(j).buttonMarkup({corners:true,theme:c,shadow:true}).attr({role:"slider","aria-valuemin":o,"aria-valuemax":m,"aria-valuenow":l(),"aria-valuetext":l(),title:l(),"aria-labelledby":k});
a.extend(this,{slider:j,handle:q,dragging:false,beforeStart:null,userModified:false,mouseMoved:false});g=="select"&&(j.wrapInner("<div class='ui-slider-inneroffset'></div>"),q.addClass("ui-slider-handle-snapping"),d.find("option"),d.find("option").each(function(b){var c=!b?"b":"a",d=!b?"right":"left",b=!b?" ui-btn-down-"+h:" "+a.mobile.activeBtnClass;a("<div class='ui-slider-labelbg ui-slider-labelbg-"+c+b+" ui-btn-corner-"+d+"'></div>").prependTo(j);a("<span class='ui-slider-label ui-slider-label-"+
c+b+" ui-btn-corner-"+d+"' role='img'>"+a(this).getEncodedText()+"</span>").prependTo(q)}));i.addClass("ui-slider");d.addClass(g==="input"?"ui-slider-input":"ui-slider-switch").change(function(){b.mouseMoved||b.refresh(l(),true)}).keyup(function(){b.refresh(l(),true,true)}).blur(function(){b.refresh(l(),true)});a(document).bind("vmousemove",function(a){if(b.dragging)return b.mouseMoved=true,g==="select"&&q.removeClass("ui-slider-handle-snapping"),b.refresh(a),b.userModified=b.beforeStart!==d[0].selectedIndex,
false});j.bind("vmousedown",function(a){b.dragging=true;b.userModified=false;b.mouseMoved=false;if(g==="select")b.beforeStart=d[0].selectedIndex;b.refresh(a);return false});j.add(document).bind("vmouseup",function(){if(b.dragging)return b.dragging=false,g==="select"&&(q.addClass("ui-slider-handle-snapping"),b.mouseMoved?b.userModified?b.refresh(b.beforeStart==0?1:0):b.refresh(b.beforeStart):b.refresh(b.beforeStart==0?1:0)),b.mouseMoved=false});j.insertAfter(d);this.handle.bind("vmousedown",function(){a(this).focus()}).bind("vclick",
false);this.handle.bind("keydown",function(c){var d=l();if(!b.options.disabled){switch(c.keyCode){case a.mobile.keyCode.HOME:case a.mobile.keyCode.END:case a.mobile.keyCode.PAGE_UP:case a.mobile.keyCode.PAGE_DOWN:case a.mobile.keyCode.UP:case a.mobile.keyCode.RIGHT:case a.mobile.keyCode.DOWN:case a.mobile.keyCode.LEFT:if(c.preventDefault(),!b._keySliding)b._keySliding=true,a(this).addClass("ui-state-active")}switch(c.keyCode){case a.mobile.keyCode.HOME:b.refresh(o);break;case a.mobile.keyCode.END:b.refresh(m);
break;case a.mobile.keyCode.PAGE_UP:case a.mobile.keyCode.UP:case a.mobile.keyCode.RIGHT:b.refresh(d+p);break;case a.mobile.keyCode.PAGE_DOWN:case a.mobile.keyCode.DOWN:case a.mobile.keyCode.LEFT:b.refresh(d-p)}}}).keyup(function(){if(b._keySliding)b._keySliding=false,a(this).removeClass("ui-state-active")});this.refresh(e,e,true)},refresh:function(a,d,f){(this.options.disabled||this.element.attr("disabled"))&&this.disable();var c=this.element,e,g=c[0].nodeName.toLowerCase(),i=g==="input"?parseFloat(c.attr("min")):
0,k=g==="input"?parseFloat(c.attr("max")):c.find("option").length-1;if(typeof a==="object"){if(!this.dragging||a.pageX<this.slider.offset().left-8||a.pageX>this.slider.offset().left+this.slider.width()+8)return;e=Math.round((a.pageX-this.slider.offset().left)/this.slider.width()*100)}else a==null&&(a=g==="input"?parseFloat(c.val()):c[0].selectedIndex),e=(parseFloat(a)-i)/(k-i)*100;if(!isNaN(e)&&(e<0&&(e=0),e>100&&(e=100),a=Math.round(e/100*(k-i))+i,a<i&&(a=i),a>k&&(a=k),this.handle.css("left",e+"%"),
this.handle.attr({"aria-valuenow":g==="input"?a:c.find("option").eq(a).attr("value"),"aria-valuetext":g==="input"?a:c.find("option").eq(a).getEncodedText(),title:a}),g==="select"&&(a===0?this.slider.addClass("ui-slider-switch-a").removeClass("ui-slider-switch-b"):this.slider.addClass("ui-slider-switch-b").removeClass("ui-slider-switch-a")),!f))f=false,g==="input"?(f=c.val()!==a,c.val(a)):(f=c[0].selectedIndex!==a,c[0].selectedIndex=a),!d&&f&&c.trigger("change")},enable:function(){this.element.attr("disabled",
false);this.slider.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.slider.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)}});a(document).bind("pagecreate create",function(b){a.mobile.slider.prototype.enhanceWithin(b.target)})})(jQuery);
(function(a){a.widget("mobile.textinput",a.mobile.widget,{options:{theme:null,initSelector:"input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea, input[type='time'], input[type='date'], input[type='month'], input[type='week'], input[type='datetime'], input[type='datetime-local'], input[type='color'], input:not([type])"},_create:function(){var e=this.element,
b=this.options.theme||a.mobile.getInheritedTheme(this.element,"c"),d=" ui-body-"+b,f,c;a("label[for='"+e.attr("id")+"']").addClass("ui-input-text");f=e.addClass("ui-input-text ui-body-"+b);typeof e[0].autocorrect!=="undefined"&&!a.support.touchOverflow&&(e[0].setAttribute("autocorrect","off"),e[0].setAttribute("autocomplete","off"));e.is("[type='search'],:jqmData(type='search')")?(f=e.wrap("<div class='ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-searchfield"+d+"'></div>").parent(),
c=a("<a href='#' class='ui-input-clear' title='clear text'>clear text</a>").tap(function(a){e.val("").focus();e.trigger("change");c.addClass("ui-input-clear-hidden");a.preventDefault()}).appendTo(f).buttonMarkup({icon:"delete",iconpos:"notext",corners:true,shadow:true}),b=function(){setTimeout(function(){c.toggleClass("ui-input-clear-hidden",!e.val())},0)},b(),e.bind("paste cut keyup focus change blur",b)):e.addClass("ui-corner-all ui-shadow-inset"+d);e.focus(function(){f.addClass("ui-focus")}).blur(function(){f.removeClass("ui-focus")});
if(e.is("textarea")){var h=function(){var a=e[0].scrollHeight;e[0].clientHeight<a&&e.height(a+15)},g;e.keyup(function(){clearTimeout(g);g=setTimeout(h,100)});a.trim(e.val())&&(a(window).load(h),a(document).one("pagechange",h))}},disable:function(){(this.element.attr("disabled",true).is("[type='search'],:jqmData(type='search')")?this.element.parent():this.element).addClass("ui-disabled")},enable:function(){(this.element.attr("disabled",false).is("[type='search'],:jqmData(type='search')")?this.element.parent():
this.element).removeClass("ui-disabled")}});a(document).bind("pagecreate create",function(e){a.mobile.textinput.prototype.enhanceWithin(e.target)})})(jQuery);
(function(a){var e=function(b){var d=b.selectID,f=b.label,c=b.select.closest(".ui-page"),e=a("<div>",{"class":"ui-selectmenu-screen ui-screen-hidden"}).appendTo(c),g=b._selectOptions(),i=b.isMultiple=b.select[0].multiple,k=d+"-button",l=d+"-menu",o=a("<div data-"+a.mobile.ns+"role='dialog' data-"+a.mobile.ns+"theme='"+b.options.theme+"' data-"+a.mobile.ns+"overlay-theme='"+b.options.overlayTheme+"'><div data-"+a.mobile.ns+"role='header'><div class='ui-title'>"+f.getEncodedText()+"</div></div><div data-"+
a.mobile.ns+"role='content'></div></div>").appendTo(a.mobile.pageContainer).page(),m=a("<div>",{"class":"ui-selectmenu ui-selectmenu-hidden ui-overlay-shadow ui-corner-all ui-body-"+b.options.overlayTheme+" "+a.mobile.defaultDialogTransition}).insertAfter(e),p=a("<ul>",{"class":"ui-selectmenu-list",id:l,role:"listbox","aria-labelledby":k}).attr("data-"+a.mobile.ns+"theme",b.options.theme).appendTo(m),j=a("<div>",{"class":"ui-header ui-bar-"+b.options.theme}).prependTo(m),q=a("<h1>",{"class":"ui-title"}).appendTo(j),
n=a("<a>",{text:b.options.closeText,href:"#","class":"ui-btn-left"}).attr("data-"+a.mobile.ns+"iconpos","notext").attr("data-"+a.mobile.ns+"icon","delete").appendTo(j).buttonMarkup(),A=o.find(".ui-content"),z=o.find(".ui-header a");a.extend(b,{select:b.select,selectID:d,buttonId:k,menuId:l,thisPage:c,menuPage:o,label:f,screen:e,selectOptions:g,isMultiple:i,theme:b.options.theme,listbox:m,list:p,header:j,headerTitle:q,headerClose:n,menuPageContent:A,menuPageClose:z,placeholder:"",build:function(){var b=
this;b.refresh();b.select.attr("tabindex","-1").focus(function(){a(this).blur();b.button.focus()});b.button.bind("vclick keydown",function(c){if(c.type=="vclick"||c.keyCode&&(c.keyCode===a.mobile.keyCode.ENTER||c.keyCode===a.mobile.keyCode.SPACE))b.open(),c.preventDefault()});b.list.attr("role","listbox").delegate(".ui-li>a","focusin",function(){a(this).attr("tabindex","0")}).delegate(".ui-li>a","focusout",function(){a(this).attr("tabindex","-1")}).delegate("li:not(.ui-disabled, .ui-li-divider)",
"click",function(c){var d=b.select[0].selectedIndex,f=b.list.find("li:not(.ui-li-divider)").index(this),e=b._selectOptions().eq(f)[0];e.selected=b.isMultiple?!e.selected:true;b.isMultiple&&a(this).find(".ui-icon").toggleClass("ui-icon-checkbox-on",e.selected).toggleClass("ui-icon-checkbox-off",!e.selected);(b.isMultiple||d!==f)&&b.select.trigger("change");b.isMultiple||b.close();c.preventDefault()}).keydown(function(b){var c=a(b.target),d=c.closest("li");switch(b.keyCode){case 38:return b=d.prev(),
b.length&&(c.blur().attr("tabindex","-1"),b.find("a").first().focus()),false;case 40:return b=d.next(),b.length&&(c.blur().attr("tabindex","-1"),b.find("a").first().focus()),false;case 13:case 32:return c.trigger("click"),false}});b.menuPage.bind("pagehide",function(){b.list.appendTo(b.listbox);b._focusButton();a.mobile._bindPageRemove.call(b.thisPage)});b.screen.bind("vclick",function(){b.close()});b.headerClose.click(function(){if(b.menuType=="overlay")return b.close(),false});b.thisPage.addDependents(this.menuPage)},
_isRebuildRequired:function(){var a=this.list.find("li");return this._selectOptions().text()!==a.text()},refresh:function(b){var c=this;this._selectOptions();this.selected();var d=this.selectedIndices();(b||this._isRebuildRequired())&&c._buildList();c.setButtonText();c.setButtonCount();c.list.find("li:not(.ui-li-divider)").removeClass(a.mobile.activeBtnClass).attr("aria-selected",false).each(function(b){a.inArray(b,d)>-1&&(b=a(this),b.attr("aria-selected",true),c.isMultiple?b.find(".ui-icon").removeClass("ui-icon-checkbox-off").addClass("ui-icon-checkbox-on"):
b.addClass(a.mobile.activeBtnClass))})},close:function(){if(!this.options.disabled&&this.isOpen)this.menuType=="page"?window.history.back():(this.screen.addClass("ui-screen-hidden"),this.listbox.addClass("ui-selectmenu-hidden").removeAttr("style").removeClass("in"),this.list.appendTo(this.listbox),this._focusButton()),this.isOpen=false},open:function(){if(!this.options.disabled){var b=this,c=b.list.parent().outerHeight(),d=b.list.parent().outerWidth(),f=a(".ui-page-active"),e=a.support.touchOverflow&&
a.mobile.touchOverflowEnabled,f=f.is(".ui-native-fixed")?f.find(".ui-content"):f;scrollTop=e?f.scrollTop():a(window).scrollTop();btnOffset=b.button.offset().top;screenHeight=window.innerHeight;screenWidth=window.innerWidth;b.button.addClass(a.mobile.activeBtnClass);setTimeout(function(){b.button.removeClass(a.mobile.activeBtnClass)},300);if(c>screenHeight-80||!a.support.scrollTop){b.thisPage.unbind("pagehide.remove");if(scrollTop==0&&btnOffset>screenHeight)b.thisPage.one("pagehide",function(){a(this).jqmData("lastScroll",
btnOffset)});b.menuPage.one("pageshow",function(){a(window).one("silentscroll",function(){b.list.find(a.mobile.activeBtnClass).focus()});b.isOpen=true});b.menuType="page";b.menuPageContent.append(b.list);b.menuPage.find("div .ui-title").text(b.label.text());a.mobile.changePage(b.menuPage,{transition:a.mobile.defaultDialogTransition})}else{b.menuType="overlay";b.screen.height(a(document).height()).removeClass("ui-screen-hidden");var f=btnOffset-scrollTop,h=scrollTop+screenHeight-btnOffset,g=c/2,e=
parseFloat(b.list.parent().css("max-width")),c=f>c/2&&h>c/2?btnOffset+b.button.outerHeight()/2-g:f>h?scrollTop+screenHeight-c-30:scrollTop+30;d<e?e=(screenWidth-d)/2:(e=b.button.offset().left+b.button.outerWidth()/2-d/2,e<30?e=30:e+d>screenWidth&&(e=screenWidth-d-30));b.listbox.append(b.list).removeClass("ui-selectmenu-hidden").css({top:c,left:e}).addClass("in");b.list.find(a.mobile.activeBtnClass).focus();b.isOpen=true}}},_buildList:function(){var b=this,c=this.options,d=this.placeholder,f=[],e=
[],h=b.isMultiple?"checkbox-off":"false";b.list.empty().filter(".ui-listview").listview("destroy");b.select.find("option").each(function(g){var j=a(this),i=j.parent(),m=j.getEncodedText(),p="<a href='#'>"+m+"</a>",k=[],n=[];i.is("optgroup")&&(i=i.attr("label"),a.inArray(i,f)===-1&&(e.push("<li data-"+a.mobile.ns+"role='list-divider'>"+i+"</li>"),f.push(i)));if(!this.getAttribute("value")||m.length==0||j.jqmData("placeholder"))c.hidePlaceholderMenuItems&&k.push("ui-selectmenu-placeholder"),d=b.placeholder=
m;this.disabled&&(k.push("ui-disabled"),n.push("aria-disabled='true'"));e.push("<li data-"+a.mobile.ns+"option-index='"+g+"' data-"+a.mobile.ns+"icon='"+h+"' class='"+k.join(" ")+"' "+n.join(" ")+">"+p+"</li>")});b.list.html(e.join(" "));b.list.find("li").attr({role:"option",tabindex:"-1"}).first().attr("tabindex","0");this.isMultiple||this.headerClose.hide();!this.isMultiple&&!d.length?this.header.hide():this.headerTitle.text(this.placeholder);b.list.listview()},_button:function(){return a("<a>",
{href:"#",role:"button",id:this.buttonId,"aria-haspopup":"true","aria-owns":this.menuId})}})};a("select").live("selectmenubeforecreate",function(){var b=a(this).data("selectmenu");b.options.nativeMenu||e(b)})})(jQuery);
(function(a){a.widget("mobile.selectmenu",a.mobile.widget,{options:{theme:null,disabled:false,icon:"arrow-d",iconpos:"right",inline:null,corners:true,shadow:true,iconshadow:true,menuPageTheme:"b",overlayTheme:"a",hidePlaceholderMenuItems:true,closeText:"Close",nativeMenu:true,initSelector:"select:not(:jqmData(role='slider'))"},_button:function(){return a("<div/>")},_setDisabled:function(a){this.element.attr("disabled",a);this.button.attr("aria-disabled",a);return this._setOption("disabled",a)},_focusButton:function(){var a=
this;setTimeout(function(){a.button.focus()},40)},_selectOptions:function(){return this.select.find("option")},_preExtension:function(){this.select=this.element.wrap("<div class='ui-select'>");this.selectID=this.select.attr("id");this.label=a("label[for='"+this.selectID+"']").addClass("ui-select");this.isMultiple=this.select[0].multiple;if(!this.options.theme)this.options.theme=a.mobile.getInheritedTheme(this.select,"c")},_create:function(){this._preExtension();this._trigger("beforeCreate");this.button=
this._button();var e=this,b=this.options,d=this.button.text(a(this.select[0].options.item(this.select[0].selectedIndex==-1?0:this.select[0].selectedIndex)).text()).insertBefore(this.select).buttonMarkup({theme:b.theme,icon:b.icon,iconpos:b.iconpos,inline:b.inline,corners:b.corners,shadow:b.shadow,iconshadow:b.iconshadow});b.nativeMenu&&window.opera&&window.opera.version&&this.select.addClass("ui-select-nativeonly");if(this.isMultiple)this.buttonCount=a("<span>").addClass("ui-li-count ui-btn-up-c ui-btn-corner-all").hide().appendTo(d.addClass("ui-li-has-count"));
(b.disabled||this.element.attr("disabled"))&&this.disable();this.select.change(function(){e.refresh()});this.build()},build:function(){var e=this;this.select.appendTo(e.button).bind("vmousedown",function(){e.button.addClass(a.mobile.activeBtnClass)}).bind("focus vmouseover",function(){e.button.trigger("vmouseover")}).bind("vmousemove",function(){e.button.removeClass(a.mobile.activeBtnClass)}).bind("change blur vmouseout",function(){e.button.trigger("vmouseout").removeClass(a.mobile.activeBtnClass)}).bind("change blur",
function(){e.button.removeClass("ui-btn-down-"+e.options.theme)})},selected:function(){return this._selectOptions().filter(":selected")},selectedIndices:function(){var a=this;return this.selected().map(function(){return a._selectOptions().index(this)}).get()},setButtonText:function(){var e=this,b=this.selected();this.button.find(".ui-btn-text").text(function(){return!e.isMultiple?b.text():b.length?b.map(function(){return a(this).text()}).get().join(", "):e.placeholder})},setButtonCount:function(){var a=
this.selected();this.isMultiple&&this.buttonCount[a.length>1?"show":"hide"]().text(a.length)},refresh:function(){this.setButtonText();this.setButtonCount()},open:a.noop,close:a.noop,disable:function(){this._setDisabled(true);this.button.addClass("ui-disabled")},enable:function(){this._setDisabled(false);this.button.removeClass("ui-disabled")}});a(document).bind("pagecreate create",function(e){a.mobile.selectmenu.prototype.enhanceWithin(e.target)})})(jQuery);
(function(a,e){function b(b){for(var c;b;){if((c=typeof b.className==="string"&&b.className.split(" "))&&a.inArray("ui-btn",c)>-1&&a.inArray("ui-disabled",c)<0)break;b=b.parentNode}return b}a.fn.buttonMarkup=function(b){for(var b=b||{},c=0;c<this.length;c++){var h=this.eq(c),g=h[0],i=a.extend({},a.fn.buttonMarkup.defaults,{icon:b.icon!==e?b.icon:h.jqmData("icon"),iconpos:b.iconpos!==e?b.iconpos:h.jqmData("iconpos"),theme:b.theme!==e?b.theme:h.jqmData("theme"),inline:b.inline!==e?b.inline:h.jqmData("inline"),
shadow:b.shadow!==e?b.shadow:h.jqmData("shadow"),corners:b.corners!==e?b.corners:h.jqmData("corners"),iconshadow:b.iconshadow!==e?b.iconshadow:h.jqmData("iconshadow")},b),k="ui-btn-inner",l,o,m=document.createElement(i.wrapperEls),p=document.createElement(i.wrapperEls),j=i.icon?document.createElement("span"):null;d&&d();if(!i.theme)i.theme=a.mobile.getInheritedTheme(h,"c");l="ui-btn ui-btn-up-"+i.theme;i.inline&&(l+=" ui-btn-inline");if(i.icon)i.icon="ui-icon-"+i.icon,i.iconpos=i.iconpos||"left",
o="ui-icon "+i.icon,i.iconshadow&&(o+=" ui-icon-shadow");i.iconpos&&(l+=" ui-btn-icon-"+i.iconpos,i.iconpos=="notext"&&!h.attr("title")&&h.attr("title",h.getEncodedText()));i.corners&&(l+=" ui-btn-corner-all",k+=" ui-btn-corner-all");i.shadow&&(l+=" ui-shadow");g.setAttribute("data-"+a.mobile.ns+"theme",i.theme);h.addClass(l);m.className=k;m.setAttribute("aria-hidden","true");p.className="ui-btn-text";m.appendChild(p);if(j)j.className=o,m.appendChild(j);for(;g.firstChild;)p.appendChild(g.firstChild);
g.appendChild(m);a.data(g,"textWrapper",a(p))}return this};a.fn.buttonMarkup.defaults={corners:true,shadow:true,iconshadow:true,inline:false,wrapperEls:"span"};var d=function(){a(document).bind({vmousedown:function(d){var d=b(d.target),c;d&&(d=a(d),c=d.attr("data-"+a.mobile.ns+"theme"),d.removeClass("ui-btn-up-"+c).addClass("ui-btn-down-"+c))},"vmousecancel vmouseup":function(d){var d=b(d.target),c;d&&(d=a(d),c=d.attr("data-"+a.mobile.ns+"theme"),d.removeClass("ui-btn-down-"+c).addClass("ui-btn-up-"+
c))},"vmouseover focus":function(d){var d=b(d.target),c;d&&(d=a(d),c=d.attr("data-"+a.mobile.ns+"theme"),d.removeClass("ui-btn-up-"+c).addClass("ui-btn-hover-"+c))},"vmouseout blur":function(d){var d=b(d.target),c;d&&(d=a(d),c=d.attr("data-"+a.mobile.ns+"theme"),d.removeClass("ui-btn-hover-"+c+" ui-btn-down-"+c).addClass("ui-btn-up-"+c))}});d=null};a(document).bind("pagecreate create",function(b){a(":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a, .ui-bar > :jqmData(role='controlgroup') > a",
b.target).not(".ui-btn, :jqmData(role='none'), :jqmData(role='nojs')").buttonMarkup()})})(jQuery);
(function(a){a.fn.controlgroup=function(e){return this.each(function(){function b(a){a.removeClass("ui-btn-corner-all ui-shadow").eq(0).addClass(h[0]).end().last().addClass(h[1]).addClass("ui-controlgroup-last")}var d=a(this),f=a.extend({direction:d.jqmData("type")||"vertical",shadow:false,excludeInvisible:true},e),c=d.children("legend"),h=f.direction=="horizontal"?["ui-corner-left","ui-corner-right"]:["ui-corner-top","ui-corner-bottom"];d.find("input").first().attr("type");c.length&&(d.wrapInner("<div class='ui-controlgroup-controls'></div>"),
a("<div role='heading' class='ui-controlgroup-label'>"+c.html()+"</div>").insertBefore(d.children(0)),c.remove());d.addClass("ui-corner-all ui-controlgroup ui-controlgroup-"+f.direction);b(d.find(".ui-btn"+(f.excludeInvisible?":visible":"")));b(d.find(".ui-btn-inner"));f.shadow&&d.addClass("ui-shadow")})};a(document).bind("pagecreate create",function(e){a(":jqmData(role='controlgroup')",e.target).controlgroup({excludeInvisible:false})})})(jQuery);
(function(a){a(document).bind("pagecreate create",function(e){a(e.target).find("a").not(".ui-btn, .ui-link-inherit, :jqmData(role='none'), :jqmData(role='nojs')").addClass("ui-link")})})(jQuery);
(function(a,e){a.fn.fixHeaderFooter=function(){return!a.support.scrollTop||a.support.touchOverflow&&a.mobile.touchOverflowEnabled?this:this.each(function(){var b=a(this);b.jqmData("fullscreen")&&b.addClass("ui-page-fullscreen");b.find(".ui-header:jqmData(position='fixed')").addClass("ui-header-fixed ui-fixed-inline fade");b.find(".ui-footer:jqmData(position='fixed')").addClass("ui-footer-fixed ui-fixed-inline fade")})};a.mobile.fixedToolbars=function(){function b(){!i&&g==="overlay"&&(h||a.mobile.fixedToolbars.hide(true),
a.mobile.fixedToolbars.startShowTimer())}function d(a){var b=0,c,d;if(a){d=document.body;c=a.offsetParent;for(b=a.offsetTop;a&&a!=d;){b+=a.scrollTop||0;if(a==c)b+=c.offsetTop,c=a.offsetParent;a=a.parentNode}}return b}function f(b){var c=a(window).scrollTop(),e=d(b[0]),f=b.css("top")=="auto"?0:parseFloat(b.css("top")),h=window.innerHeight,g=b.outerHeight(),i=b.parents(".ui-page:not(.ui-page-fullscreen)").length;return b.is(".ui-header-fixed")?(f=c-e+f,f<e&&(f=0),b.css("top",i?f:c)):b.css("top",i?c+
h-g-(e-f):c+h-g)}if(a.support.scrollTop&&(!a.support.touchOverflow||!a.mobile.touchOverflowEnabled)){var c,h,g="inline",i=false,k=null,l=false,o=true;a(function(){var c=a(document),d=a(window);c.bind("vmousedown",function(){o&&(k=g)}).bind("vclick",function(b){o&&!a(b.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length&&!l&&(a.mobile.fixedToolbars.toggle(k),k=null)}).bind("silentscroll",b);(c.scrollTop()===0?d:c).bind("scrollstart",function(){l=true;k===
null&&(k=g);var b=k=="overlay";if(i=b||!!h)a.mobile.fixedToolbars.clearShowTimer(),b&&a.mobile.fixedToolbars.hide(true)}).bind("scrollstop",function(b){a(b.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length||(l=false,i&&(a.mobile.fixedToolbars.startShowTimer(),i=false),k=null)});d.bind("resize updatelayout",b)});a(".ui-page").live("pagebeforeshow",function(b,d){var e=a(b.target).find(":jqmData(role='footer')"),h=e.data("id"),g=d.prevPage,g=g&&g.find(":jqmData(role='footer')"),
g=g.length&&g.jqmData("id")===h;h&&g&&(c=e,f(c.removeClass("fade in out").appendTo(a.mobile.pageContainer)))}).live("pageshow",function(){var b=a(this);c&&c.length&&setTimeout(function(){f(c.appendTo(b).addClass("fade"));c=null},500);a.mobile.fixedToolbars.show(true,this)});a(".ui-collapsible-contain").live("collapse expand",b);return{show:function(b,c){a.mobile.fixedToolbars.clearShowTimer();g="overlay";return(c?a(c):a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var c=
a(this),e=a(window).scrollTop(),h=d(c[0]),g=window.innerHeight,i=c.outerHeight(),e=c.is(".ui-header-fixed")&&e<=h+i||c.is(".ui-footer-fixed")&&h<=e+g;c.addClass("ui-fixed-overlay").removeClass("ui-fixed-inline");!e&&!b&&c.animationComplete(function(){c.removeClass("in")}).addClass("in");f(c)})},hide:function(b){g="inline";return(a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var c=a(this),
d=c.css("top"),d=d=="auto"?0:parseFloat(d);c.addClass("ui-fixed-inline").removeClass("ui-fixed-overlay");if(d<0||c.is(".ui-header-fixed")&&d!==0)b?c.css("top",0):c.css("top")!=="auto"&&parseFloat(c.css("top"))!==0&&c.animationComplete(function(){c.removeClass("out reverse").css("top",0)}).addClass("out reverse")})},startShowTimer:function(){a.mobile.fixedToolbars.clearShowTimer();var b=[].slice.call(arguments);h=setTimeout(function(){h=e;a.mobile.fixedToolbars.show.apply(null,b)},100)},clearShowTimer:function(){h&&
clearTimeout(h);h=e},toggle:function(b){b&&(g=b);return g==="overlay"?a.mobile.fixedToolbars.hide():a.mobile.fixedToolbars.show()},setTouchToggleEnabled:function(a){o=a}}}}();a(document).bind("pagecreate create",function(b){a(":jqmData(position='fixed')",b.target).length&&a(b.target).each(function(){if(!a.support.scrollTop||a.support.touchOverflow&&a.mobile.touchOverflowEnabled)return this;var b=a(this);b.jqmData("fullscreen")&&b.addClass("ui-page-fullscreen");b.find(".ui-header:jqmData(position='fixed')").addClass("ui-header-fixed ui-fixed-inline fade");
b.find(".ui-footer:jqmData(position='fixed')").addClass("ui-footer-fixed ui-fixed-inline fade")})})})(jQuery);
(function(a){a.mobile.touchOverflowEnabled=false;a.mobile.touchOverflowZoomEnabled=false;a(document).bind("pagecreate",function(e){a.support.touchOverflow&&a.mobile.touchOverflowEnabled&&(e=a(e.target),e.is(":jqmData(role='page')")&&e.each(function(){var b=a(this),d=b.find(":jqmData(role='header'), :jqmData(role='footer')").filter(":jqmData(position='fixed')"),e=b.jqmData("fullscreen"),c=d.length?b.find(".ui-content"):b;b.addClass("ui-mobile-touch-overflow");c.bind("scrollstop",function(){c.scrollTop()>
0&&window.scrollTo(0,a.mobile.defaultHomeScroll)});d.length&&(b.addClass("ui-native-fixed"),e&&(b.addClass("ui-native-fullscreen"),d.addClass("fade in"),a(document).bind("vclick",function(){d.removeClass("ui-native-bars-hidden").toggleClass("in out").animationComplete(function(){a(this).not(".in").addClass("ui-native-bars-hidden")})})))}))})})(jQuery);
(function(a,e){function b(){var b=a("meta[name='viewport']");b.length?b.attr("content",b.attr("content")+", user-scalable=no"):a("head").prepend("<meta>",{name:"viewport",content:"user-scalable=no"})}var d=a("html");a("head");var f=a(e);a(e.document).trigger("mobileinit");if(a.mobile.gradeA()){if(a.mobile.ajaxBlacklist)a.mobile.ajaxEnabled=false;d.addClass("ui-mobile ui-mobile-rendering");var c=a("<div class='ui-loader ui-body-a ui-corner-all'><span class='ui-icon ui-icon-loading spin'></span><h1></h1></div>");
a.extend(a.mobile,{showPageLoadingMsg:function(){if(a.mobile.loadingMessage){var b=a("."+a.mobile.activeBtnClass).first();c.find("h1").text(a.mobile.loadingMessage).end().appendTo(a.mobile.pageContainer).css({top:a.support.scrollTop&&f.scrollTop()+f.height()/2||b.length&&b.offset().top||100})}d.addClass("ui-loading")},hidePageLoadingMsg:function(){d.removeClass("ui-loading")},initializePage:function(){var b=a(":jqmData(role='page')");b.length||(b=a("body").wrapInner("<div data-"+a.mobile.ns+"role='page'></div>").children(0));
b.add(":jqmData(role='dialog')").each(function(){var b=a(this);b.jqmData("url")||b.attr("data-"+a.mobile.ns+"url",b.attr("id")||location.pathname+location.search)});a.mobile.firstPage=b.first();a.mobile.pageContainer=b.first().parent().addClass("ui-mobile-viewport");f.trigger("pagecontainercreate");a.mobile.showPageLoadingMsg();!a.mobile.hashListeningEnabled||!a.mobile.path.stripHash(location.hash)?a.mobile.changePage(a.mobile.firstPage,{transition:"none",reverse:true,changeHash:false,fromHashChange:true}):
f.trigger("hashchange",[true])}});a.support.touchOverflow&&a.mobile.touchOverflowEnabled&&!a.mobile.touchOverflowZoomEnabled&&b();a.mobile._registerInternalEvents();a(function(){e.scrollTo(0,1);a.mobile.defaultHomeScroll=!a.support.scrollTop||a(e).scrollTop()===1?0:1;a.mobile.autoInitializePage&&a.mobile.initializePage();f.load(a.mobile.silentScroll)})}})(jQuery,this);
// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(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 window.Code === "undefined") {
window.Code = {};
}
window.Code.Util = {
/*
* Function: registerNamespace
*/
registerNamespace: function () {
var
args = arguments, obj = null, i, j, ns, nsParts, root, argsLen, nsPartsLens;
for (i=0, argsLen=args.length; i<argsLen; i++) {
ns = args[i];
nsParts = ns.split(".");
root = nsParts[0];
if (typeof window[root] === "undefined"){
window[root] = {};
}
obj = window[root];
//eval('if (typeof ' + root + ' == "undefined"){' + root + ' = {};} obj = ' + root + ';');
for (j=1, nsPartsLens=nsParts.length; j<nsPartsLens; ++j) {
obj[nsParts[j]] = obj[nsParts[j]] || {};
obj = obj[nsParts[j]];
}
}
},
/*
* Function: coalesce
* Takes any number of arguments and returns the first non Null / Undefined argument.
*/
coalesce: function () {
var i, j;
for (i=0, j=arguments.length; i<j; i++) {
if (!this.isNothing(arguments[i])) {
return arguments[i];
}
}
return null;
},
/*
* Function: extend
*/
extend: function(destination, source, overwriteProperties){
var prop;
if (this.isNothing(overwriteProperties)){
overwriteProperties = true;
}
if (destination && source && this.isObject(source)){
for(prop in source){
if (this.objectHasProperty(source, prop)) {
if (overwriteProperties){
destination[prop] = source[prop];
}
else{
if(typeof destination[prop] === "undefined"){
destination[prop] = source[prop];
}
}
}
}
}
},
/*
* Function: clone
*/
clone: function(obj) {
var retval = {};
this.extend(retval, obj);
return retval;
},
/*
* Function: isObject
*/
isObject: function(obj){
return obj instanceof Object;
},
/*
* Function: isFunction
*/
isFunction: function(obj){
return ({}).toString.call(obj) === "[object Function]";
},
/*
* Function: isArray
*/
isArray: function(obj){
return obj instanceof Array;
},
/*
* Function: isLikeArray
*/
isLikeArray: function(obj) {
return typeof obj.length === 'number';
},
/*
* Function: isNumber
*/
isNumber: function(obj){
return typeof obj === "number";
},
/*
* Function: isString
*/
isString: function(obj){
return typeof obj === "string";
},
/*
* Function: isNothing
*/
isNothing: function (obj) {
if (typeof obj === "undefined" || obj === null) {
return true;
}
return false;
},
/*
* Function: swapArrayElements
*/
swapArrayElements: function(arr, i, j){
var temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
},
/*
* Function: trim
*/
trim: function(val) {
return val.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
},
/*
* Function: toCamelCase
*/
toCamelCase: function(val){
return val.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');});
},
/*
* Function: toDashedCase
*/
toDashedCase: function(val){
return val.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();});
},
/*
* Function: indexOf
*/
arrayIndexOf: function(obj, array, prop){
var i, j, retval, arrayItem;
retval = -1;
for (i=0, j=array.length; i<j; i++){
arrayItem = array[i];
if (!this.isNothing(prop)){
if (this.objectHasProperty(arrayItem, prop)) {
if (arrayItem[prop] === obj){
retval = i;
break;
}
}
}
else{
if (arrayItem === obj){
retval = i;
break;
}
}
}
return retval;
},
/*
* Function: objectHasProperty
*/
objectHasProperty: function(obj, propName){
if (obj.hasOwnProperty){
return obj.hasOwnProperty(propName);
}
else{
return ('undefined' !== typeof obj[propName]);
}
}
};
}(window));
// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, Util) {
Util.Browser = {
ua: null,
version: null,
safari: null,
webkit: null,
opera: null,
msie: null,
chrome: null,
mozilla: null,
android: null,
blackberry: null,
iPad: null,
iPhone: null,
iPod: null,
iOS: null,
is3dSupported: null,
isCSSTransformSupported: null,
isTouchSupported: null,
isGestureSupported: null,
_detect: function(){
this.ua = window.navigator.userAgent;
this.version = (this.ua.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || []);
this.safari = (/Safari/gi).test(window.navigator.appVersion);
this.webkit = /webkit/i.test(this.ua);
this.opera = /opera/i.test(this.ua);
this.msie = /msie/i.test(this.ua) && !this.opera;
this.chrome = /Chrome/i.test(this.ua);
this.firefox = /Firefox/i.test(this.ua);
this.fennec = /Fennec/i.test(this.ua);
this.mozilla = /mozilla/i.test(this.ua) && !/(compatible|webkit)/.test(this.ua);
this.android = /android/i.test(this.ua);
this.blackberry = /blackberry/i.test(this.ua);
this.iOS = (/iphone|ipod|ipad/gi).test(window.navigator.platform);
this.iPad = (/ipad/gi).test(window.navigator.platform);
this.iPhone = (/iphone/gi).test(window.navigator.platform);
this.iPod = (/ipod/gi).test(window.navigator.platform);
var testEl = document.createElement('div');
this.is3dSupported = !Util.isNothing(testEl.style.WebkitPerspective);
this.isCSSTransformSupported = ( !Util.isNothing(testEl.style.WebkitTransform) || !Util.isNothing(testEl.style.MozTransform) || !Util.isNothing(testEl.style.transformProperty) );
this.isTouchSupported = this.isEventSupported('touchstart');
this.isGestureSupported = this.isEventSupported('gesturestart');
},
_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'),
isSupported;
eventName = 'on' + eventName;
isSupported = Util.objectHasProperty(el, eventName);
if (!isSupported) {
el.setAttribute(eventName, 'return;');
isSupported = typeof el[eventName] === 'function';
}
el = null;
return isSupported;
},
isLandscape: function(){
return (Util.DOM.windowWidth() > Util.DOM.windowHeight());
}
};
Util.Browser._detect();
}
(
window,
window.Code.Util
))
;
// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function (window, $, Util) {
Util.extend(Util, {
Events: {
/*
* Function: add
* Add an event handler
*/
add: function(obj, type, handler){
$(obj).bind(type, handler);
},
/*
* Function: remove
* Removes a handler or all handlers associated with a type
*/
remove: function(obj, type, handler){
$(obj).unbind(type, handler);
},
/*
* Function: fire
* Fire an event
*/
fire: function(obj, type){
var
event,
args = Array.prototype.slice.call(arguments).splice(2);
if (typeof type === "string"){
event = { type: type };
}
else{
event = type;
}
$(obj).trigger( $.Event(event.type, event), args);
},
/*
* Function: getMousePosition
*/
getMousePosition: function(event){
var retval = {
x: event.pageX,
y: event.pageY
};
return retval;
},
/*
* Function: getTouchEvent
*/
getTouchEvent: function(event){
return event.originalEvent;
},
/*
* Function: getWheelDelta
*/
getWheelDelta: function(event){
var delta = 0;
if (!Util.isNothing(event.wheelDelta)){
delta = event.wheelDelta / 120;
}
else if (!Util.isNothing(event.detail)){
delta = -event.detail / 3;
}
return delta;
},
/*
* Function: domReady
*/
domReady: function(handler){
$(document).ready(handler);
}
}
});
}
(
window,
window.jQuery,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function (window, $, Util) {
Util.extend(Util, {
DOM: {
/*
* Function: setData
*/
setData: function(el, key, value){
if (Util.isLikeArray(el)){
var i, len;
for (i=0, len=el.length; i<len; i++){
Util.DOM._setData(el[i], key, value);
}
}
else{
Util.DOM._setData(el, key, value);
}
},
_setData: function(el, key, value){
Util.DOM.setAttribute(el, 'data-' + key, value);
},
/*
* Function: getData
*/
getData: function(el, key, defaultValue){
return Util.DOM.getAttribute(el, 'data-' + key, defaultValue);
},
/*
* Function: removeData
*/
removeData: function(el, key){
if (Util.isLikeArray(el)){
var i, len;
for (i=0, len=el.length; i<len; i++){
Util.DOM._removeData(el[i], key);
}
}
else{
Util.DOM._removeData(el, key);
}
},
_removeData: function(el, key){
Util.DOM.removeAttribute(el, 'data-' + key);
},
/*
* Function: isChildOf
*/
isChildOf: function(childEl, parentEl)
{
if (parentEl === childEl){
return false;
}
while (childEl && childEl !== parentEl)
{
childEl = childEl.parentNode;
}
return childEl === parentEl;
},
/*
* Function: find
*/
find: function(selectors, contextEl){
if (Util.isNothing(contextEl)){
contextEl = window.document;
}
var
els = $(selectors, contextEl),
retval = [],
i, j;
for (i=0, j=els.length; i<j; i++){
retval.push(els[i]);
}
return retval;
},
/*
* Function: createElement
*/
createElement: function(type, attributes, content){
var retval = $('<' + type +'></' + type + '>');
retval.attr(attributes);
retval.append(content);
return retval[0];
},
/*
* Function: appendChild
*/
appendChild: function(childEl, parentEl){
$(parentEl).append(childEl);
},
/*
* Function: insertBefore
*/
insertBefore: function(newEl, refEl, parentEl){
$(newEl).insertBefore(refEl);
},
/*
* 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, defaultValue){
var retval = $(el).attr(attributeName);
if (Util.isNothing(retval) && !Util.isNothing(defaultValue)){
retval = defaultValue;
}
return retval;
},
/*
* Function: el, attributeName
*/
setAttribute: function(el, attributeName, value){
if (Util.isLikeArray(el)){
var i, len;
for (i=0, len=el.length; i<len; i++){
Util.DOM._setAttribute(el[i], attributeName, value);
}
}
else{
Util.DOM._setAttribute(el, attributeName, value);
}
},
_setAttribute: function(el, attributeName, value){
$(el).attr(attributeName, value);
},
/*
* Function: removeAttribute
*/
removeAttribute: function(el, attributeName){
if (Util.isLikeArray(el)){
var i, len;
for (i=0, len=el.length; i<len; i++){
Util.DOM._removeAttribute(el[i], attributeName);
}
}
else{
Util.DOM._removeAttribute(el, attributeName);
}
},
_removeAttribute: function(el, attributeName){
$(el).removeAttr(attributeName);
},
/*
* Function: addClass
*/
addClass: function(el, className){
if (Util.isLikeArray(el)){
var i, len;
for (i=0, len=el.length; i<len; i++){
Util.DOM._addClass(el[i], className);
}
}
else{
Util.DOM._addClass(el, className);
}
},
_addClass: function(el, className){
$(el).addClass(className);
},
/*
* Function: removeClass
*/
removeClass: function(el, className){
if (Util.isLikeArray(el)){
var i, len;
for (i=0, len=el.length; i<len; i++){
Util.DOM._removeClass(el[i], className);
}
}
else{
Util.DOM._removeClass(el, className);
}
},
_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.isLikeArray(el)){
var i, len;
for (i=0, len=el.length; i<len; i++){
Util.DOM._setStyle(el[i], style, value);
}
}
else{
Util.DOM._setStyle(el, style, value);
}
},
_setStyle: function(el, style, value){
var prop;
if (Util.isObject(style)) {
for(prop in style) {
if(Util.objectHasProperty(style, prop)){
if (prop === 'width'){
Util.DOM.width(el, style[prop]);
}
else if (prop === 'height'){
Util.DOM.height(el, style[prop]);
}
else{
$(el).css(prop, style[prop]);
}
}
}
}
else {
$(el).css(style, value);
}
},
/*
* Function: getStyle
*/
getStyle: function(el, styleName){
return $(el).css(styleName);
},
/*
* Function: hide
*/
hide: function(el){
if (Util.isLikeArray(el)){
var i, len;
for (i=0, len=el.length; i<len; i++){
Util.DOM._hide(el[i]);
}
}
else{
Util.DOM._hide(el);
}
},
_hide: function(el){
$(el).hide();
},
/*
* Function: show
*/
show: function(el){
if (Util.isLikeArray(el)){
var i, len;
for (i=0, len=el.length; i<len; i++){
Util.DOM._show(el[i]);
}
}
else{
Util.DOM._show(el);
}
},
_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: documentOuterWidth
*/
documentOuterWidth: function(){
return Util.DOM.width(document.documentElement);
},
/*
* Function: documentOuterHeight
*/
documentOuterHeight: function(){
return Util.DOM.outerHeight(document.documentElement);
},
/*
* Function: bodyWidth
*/
bodyWidth: function(){
return $(document.body).width();
},
/*
* Function: bodyHeight
*/
bodyHeight: function(){
return $(document.body).height();
},
/*
* Function: bodyOuterWidth
*/
bodyOuterWidth: function(){
return Util.DOM.outerWidth(document.body);
},
/*
* Function: bodyOuterHeight
*/
bodyOuterHeight: function(){
return Util.DOM.outerHeight(document.body);
},
/*
* 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;
}
}
});
}
(
window,
window.jQuery,
window.Code.Util
));
// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function (window, Util) {
Util.extend(Util, {
Animation: {
_applyTransitionDelay: 50,
_transitionEndLabel: (window.document.documentElement.style.webkitTransition !== undefined) ? "webkitTransitionEnd" : "transitionend",
_transitionEndHandler: null,
_transitionPrefix: (window.document.documentElement.style.webkitTransition !== undefined) ? "webkitTransition" : (window.document.documentElement.style.MozTransition !== undefined) ? "MozTransition" : "transition",
_transformLabel: (window.document.documentElement.style.webkitTransform !== undefined) ? "webkitTransform" : (window.document.documentElement.style.MozTransition !== undefined) ? "MozTransform" : "transform",
/*
* Function: _getTransitionEndHandler
*/
_getTransitionEndHandler: function(){
if (Util.isNothing(this._transitionEndHandler)){
this._transitionEndHandler = this._onTransitionEnd.bind(this);
}
return this._transitionEndHandler;
},
/*
* Function: stop
*/
stop: function(el){
if (Util.Browser.isCSSTransformSupported){
var
property = el.style[this._transitionPrefix + 'Property'],
callbackLabel = (property !== '') ? 'ccl' + property + 'callback' : 'cclallcallback',
style = {};
Util.Events.remove(el, this._transitionEndLabel, this._getTransitionEndHandler());
if (Util.isNothing(el.callbackLabel)){
delete el.callbackLabel;
}
style[this._transitionPrefix + 'Property'] = '';
style[this._transitionPrefix + 'Duration'] = '';
style[this._transitionPrefix + 'TimingFunction'] = '';
style[this._transitionPrefix + 'Delay'] = '';
style[this._transformLabel] = '';
Util.DOM.setStyle(el, style);
}
else if (!Util.isNothing(window.jQuery)){
window.jQuery(el).stop(true, true);
}
},
/*
* Function: fadeIn
*/
fadeIn: function(el, speed, callback, timingFunction, opacity){
opacity = Util.coalesce(opacity, 1);
if (opacity <= 0){
opacity = 1;
}
if (speed <= 0){
Util.DOM.setStyle(el, 'opacity', opacity);
if (!Util.isNothing(callback)){
callback(el);
return;
}
}
var currentOpacity = Util.DOM.getStyle(el, 'opacity');
if (currentOpacity >= 1){
Util.DOM.setStyle(el, 'opacity', 0);
}
if (Util.Browser.isCSSTransformSupported){
this._applyTransition(el, 'opacity', opacity, speed, callback, timingFunction);
}
else if (!Util.isNothing(window.jQuery)){
window.jQuery(el).fadeTo(speed, opacity, callback);
}
},
/*
* Function: fadeTo
*/
fadeTo: function(el, opacity, speed, callback, timingFunction){
this.fadeIn(el, speed, callback, timingFunction, opacity);
},
/*
* Function: fadeOut
*/
fadeOut: function(el, speed, callback, timingFunction){
if (speed <= 0){
Util.DOM.setStyle(el, 'opacity', 0);
if (!Util.isNothing(callback)){
callback(el);
return;
}
}
if (Util.Browser.isCSSTransformSupported){
this._applyTransition(el, 'opacity', 0, speed, callback, timingFunction);
}
else{
window.jQuery(el).fadeTo(speed, 0, callback);
}
},
/*
* Function: slideBy
*/
slideBy: function(el, x, y, speed, callback, timingFunction){
var style = {};
x = Util.coalesce(x, 0);
y = Util.coalesce(y, 0);
timingFunction = Util.coalesce(timingFunction, 'ease-out');
style[this._transitionPrefix + 'Property'] = 'all';
style[this._transitionPrefix + 'Delay'] = '0';
if (speed === 0){
style[this._transitionPrefix + 'Duration'] = '';
style[this._transitionPrefix + 'TimingFunction'] = '';
}
else{
style[this._transitionPrefix + 'Duration'] = speed + 'ms';
style[this._transitionPrefix + 'TimingFunction'] = Util.coalesce(timingFunction, 'ease-out');
Util.Events.add(el, this._transitionEndLabel, this._getTransitionEndHandler());
}
style[this._transformLabel] = (Util.Browser.is3dSupported) ? 'translate3d(' + x + 'px, ' + y + 'px, 0px)' : 'translate(' + x + 'px, ' + y + 'px)';
if (!Util.isNothing(callback)){
el.cclallcallback = callback;
}
Util.DOM.setStyle(el, style);
if (speed === 0){
window.setTimeout(function(){
this._leaveTransforms(el);
}.bind(this), this._applyTransitionDelay);
}
},
/*
* Function:
*/
resetTranslate: function(el){
var style = {};
style[this._transformLabel] = style[this._transformLabel] = (Util.Browser.is3dSupported) ? 'translate3d(0px, 0px, 0px)' : 'translate(0px, 0px)';
Util.DOM.setStyle(el, style);
},
/*
* Function: _applyTransition
*/
_applyTransition: function(el, property, val, speed, callback, timingFunction){
var style = {};
timingFunction = Util.coalesce(timingFunction, 'ease-in');
style[this._transitionPrefix + 'Property'] = property;
style[this._transitionPrefix + 'Duration'] = speed + 'ms';
style[this._transitionPrefix + 'TimingFunction'] = timingFunction;
style[this._transitionPrefix + 'Delay'] = '0';
Util.Events.add(el, this._transitionEndLabel, this._getTransitionEndHandler());
Util.DOM.setStyle(el, style);
if (!Util.isNothing(callback)){
el['ccl' + property + 'callback'] = callback;
}
window.setTimeout(function(){
Util.DOM.setStyle(el, property, val);
}, this._applyTransitionDelay);
},
/*
* Function: _onTransitionEnd
*/
_onTransitionEnd: function(e){
Util.Events.remove(e.currentTarget, this._transitionEndLabel, this._getTransitionEndHandler());
this._leaveTransforms(e.currentTarget);
},
/*
* Function: _leaveTransforms
*/
_leaveTransforms: function(el){
var
property = el.style[this._transitionPrefix + 'Property'],
callbackLabel = (property !== '') ? 'ccl' + property + 'callback' : 'cclallcallback',
callback,
transform = Util.coalesce(el.style.webkitTransform, el.style.MozTransform, el.style.transform),
transformMatch,
transformExploded,
domX = window.parseInt(Util.DOM.getStyle(el, 'left'), 0),
domY = window.parseInt(Util.DOM.getStyle(el, 'top'), 0),
transformedX,
transformedY,
style = {};
if (transform !== ''){
if (Util.Browser.is3dSupported){
transformMatch = transform.match( /translate3d\((.*?)\)/ );
}
else{
transformMatch = transform.match( /translate\((.*?)\)/ );
}
if (!Util.isNothing(transformMatch)){
transformExploded = transformMatch[1].split(', ');
transformedX = window.parseInt(transformExploded[0], 0);
transformedY = window.parseInt(transformExploded[1], 0);
}
}
style[this._transitionPrefix + 'Property'] = '';
style[this._transitionPrefix + 'Duration'] = '';
style[this._transitionPrefix + 'TimingFunction'] = '';
style[this._transitionPrefix + 'Delay'] = '';
Util.DOM.setStyle(el, style);
window.setTimeout(function(){
if(!Util.isNothing(transformExploded)){
style = {};
style[this._transformLabel] = '';
style.left = (domX + transformedX) + 'px';
style.top = (domY + transformedY) + 'px';
Util.DOM.setStyle(el, style);
}
if (!Util.isNothing(el[callbackLabel])){
callback = el[callbackLabel];
delete el[callbackLabel];
callback(el);
}
}.bind(this), this._applyTransitionDelay);
}
}
});
}
(
window,
window.Code.Util
));
// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.Util.TouchElement');
Util.TouchElement.EventTypes = {
onTouch: 'CodeUtilTouchElementOnTouch'
};
Util.TouchElement.ActionTypes = {
touchStart: 'touchStart',
touchMove: 'touchMove',
touchEnd: 'touchEnd',
touchMoveEnd: 'touchMoveEnd',
tap: 'tap',
doubleTap: 'doubleTap',
swipeLeft: 'swipeLeft',
swipeRight: 'swipeRight',
swipeUp: 'swipeUp',
swipeDown: 'swipeDown',
gestureStart: 'gestureStart',
gestureChange: 'gestureChange',
gestureEnd: 'gestureEnd'
};
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.Util.TouchElement');
Util.TouchElement.TouchElementClass = klass({
el: null,
captureSettings: null,
touchStartPoint: null,
touchEndPoint: null,
touchStartTime: null,
doubleTapTimeout: null,
touchStartHandler: null,
touchMoveHandler: null,
touchEndHandler: null,
mouseDownHandler: null,
mouseMoveHandler: null,
mouseUpHandler: null,
mouseOutHandler: null,
gestureStartHandler: null,
gestureChangeHandler: null,
gestureEndHandler: null,
swipeThreshold: null,
swipeTimeThreshold: null,
doubleTapSpeed: null,
/*
* Function: dispose
*/
dispose: function(){
var prop;
this.removeEventHandlers();
for (prop in this) {
if (Util.objectHasProperty(this, prop)) {
this[prop] = null;
}
}
},
/*
* Function: initialize
*/
initialize: function(el, captureSettings){
this.el = el;
this.captureSettings = {
swipe: false,
move: false,
gesture: false,
doubleTap: false,
preventDefaultTouchEvents: true
};
Util.extend(this.captureSettings, captureSettings);
this.swipeThreshold = 50;
this.swipeTimeThreshold = 250;
this.doubleTapSpeed = 250;
this.touchStartPoint = { x: 0, y: 0 };
this.touchEndPoint = { x: 0, y: 0 };
},
/*
* Function: addEventHandlers
*/
addEventHandlers: function(){
if (Util.isNothing(this.touchStartHandler)){
this.touchStartHandler = this.onTouchStart.bind(this);
this.touchMoveHandler = this.onTouchMove.bind(this);
this.touchEndHandler = this.onTouchEnd.bind(this);
this.mouseDownHandler = this.onMouseDown.bind(this);
this.mouseMoveHandler = this.onMouseMove.bind(this);
this.mouseUpHandler = this.onMouseUp.bind(this);
this.mouseOutHandler = this.onMouseOut.bind(this);
this.gestureStartHandler = this.onGestureStart.bind(this);
this.gestureChangeHandler = this.onGestureChange.bind(this);
this.gestureEndHandler = this.onGestureEnd.bind(this);
}
Util.Events.add(this.el, 'touchstart', this.touchStartHandler);
if (this.captureSettings.move){
Util.Events.add(this.el, 'touchmove', this.touchMoveHandler);
}
Util.Events.add(this.el, 'touchend', this.touchEndHandler);
Util.Events.add(this.el, 'mousedown', this.mouseDownHandler);
if (Util.Browser.isGestureSupported && this.captureSettings.gesture){
Util.Events.add(this.el, 'gesturestart', this.gestureStartHandler);
Util.Events.add(this.el, 'gesturechange', this.gestureChangeHandler);
Util.Events.add(this.el, 'gestureend', this.gestureEndHandler);
}
},
/*
* Function: removeEventHandlers
*/
removeEventHandlers: function(){
Util.Events.remove(this.el, 'touchstart', this.touchStartHandler);
if (this.captureSettings.move){
Util.Events.remove(this.el, 'touchmove', this.touchMoveHandler);
}
Util.Events.remove(this.el, 'touchend', this.touchEndHandler);
Util.Events.remove(this.el, 'mousedown', this.mouseDownHandler);
if (Util.Browser.isGestureSupported && this.captureSettings.gesture){
Util.Events.remove(this.el, 'gesturestart', this.gestureStartHandler);
Util.Events.remove(this.el, 'gesturechange', this.gestureChangeHandler);
Util.Events.remove(this.el, 'gestureend', this.gestureEndHandler);
}
},
/*
* Function: getTouchPoint
*/
getTouchPoint: function(touches){
return {
x: touches[0].pageX,
y: touches[0].pageY
};
},
/*
* Function: fireTouchEvent
*/
fireTouchEvent: function(e){
var
action,
distX = 0,
distY = 0,
dist = 0,
self,
endTime,
diffTime;
distX = this.touchEndPoint.x - this.touchStartPoint.x;
distY = this.touchEndPoint.y - this.touchStartPoint.y;
dist = Math.sqrt( (distX * distX) + (distY * distY) );
if (this.captureSettings.swipe){
endTime = new Date();
diffTime = endTime - this.touchStartTime;
// See if there was a swipe gesture
if (diffTime <= this.swipeTimeThreshold){
if (window.Math.abs(distX) >= this.swipeThreshold){
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
point: this.touchEndPoint,
action: (distX < 0) ? Util.TouchElement.ActionTypes.swipeLeft : Util.TouchElement.ActionTypes.swipeRight,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
return;
}
if (window.Math.abs(distY) >= this.swipeThreshold){
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
point: this.touchEndPoint,
action: (distY < 0) ? Util.TouchElement.ActionTypes.swipeUp : Util.TouchElement.ActionTypes.swipeDown,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
return;
}
}
}
if (dist > 1){
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.touchMoveEnd,
point: this.touchEndPoint,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
return;
}
if (!this.captureSettings.doubleTap){
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
point: this.touchEndPoint,
action: Util.TouchElement.ActionTypes.tap,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
return;
}
if (Util.isNothing(this.doubleTapTimeout)){
this.doubleTapTimeout = window.setTimeout(function(){
this.doubleTapTimeout = null;
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
point: this.touchEndPoint,
action: Util.TouchElement.ActionTypes.tap,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
}.bind(this), this.doubleTapSpeed);
return;
}
else{
window.clearTimeout(this.doubleTapTimeout);
this.doubleTapTimeout = null;
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
point: this.touchEndPoint,
action: Util.TouchElement.ActionTypes.doubleTap,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
}
},
/*
* Function: onTouchStart
*/
onTouchStart: function(e){
if (this.captureSettings.preventDefaultTouchEvents){
e.preventDefault();
}
// No longer need mouse events
Util.Events.remove(this.el, 'mousedown', this.mouseDownHandler);
var
touchEvent = Util.Events.getTouchEvent(e),
touches = touchEvent.touches;
if (touches.length > 1 && this.captureSettings.gesture){
this.isGesture = true;
return;
}
this.touchStartTime = new Date();
this.isGesture = false;
this.touchStartPoint = this.getTouchPoint(touches);
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.touchStart,
point: this.touchStartPoint,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
},
/*
* Function: onTouchMove
*/
onTouchMove: function(e){
if (this.captureSettings.preventDefaultTouchEvents){
e.preventDefault();
}
if (this.isGesture && this.captureSettings.gesture){
return;
}
var
touchEvent = Util.Events.getTouchEvent(e),
touches = touchEvent.touches;
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.touchMove,
point: this.getTouchPoint(touches),
targetEl: e.target,
currentTargetEl: e.currentTarget
});
},
/*
* Function: onTouchEnd
*/
onTouchEnd: function(e){
if (this.isGesture && this.captureSettings.gesture){
return;
}
if (this.captureSettings.preventDefaultTouchEvents){
e.preventDefault();
}
// 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.Events.getTouchEvent(e),
touches = (!Util.isNothing(touchEvent.changedTouches)) ? touchEvent.changedTouches : touchEvent.touches;
this.touchEndPoint = this.getTouchPoint(touches);
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.touchEnd,
point: this.touchEndPoint,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
this.fireTouchEvent(e);
},
/*
* Function: onMouseDown
*/
onMouseDown: function(e){
e.preventDefault();
// No longer need touch events
Util.Events.remove(this.el, 'touchstart', this.mouseDownHandler);
Util.Events.remove(this.el, 'touchmove', this.touchMoveHandler);
Util.Events.remove(this.el, 'touchend', this.touchEndHandler);
// Add move/up/out
if (this.captureSettings.move){
Util.Events.add(this.el, 'mousemove', this.mouseMoveHandler);
}
Util.Events.add(this.el, 'mouseup', this.mouseUpHandler);
Util.Events.add(this.el, 'mouseout', this.mouseOutHandler);
this.touchStartTime = new Date();
this.isGesture = false;
this.touchStartPoint = Util.Events.getMousePosition(e);
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.touchStart,
point: this.touchStartPoint,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
},
/*
* Function: onMouseMove
*/
onMouseMove: function(e){
e.preventDefault();
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.touchMove,
point: Util.Events.getMousePosition(e),
targetEl: e.target,
currentTargetEl: e.currentTarget
});
},
/*
* Function: onMouseUp
*/
onMouseUp: function(e){
e.preventDefault();
if (this.captureSettings.move){
Util.Events.remove(this.el, 'mousemove', this.mouseMoveHandler);
}
Util.Events.remove(this.el, 'mouseup', this.mouseUpHandler);
Util.Events.remove(this.el, 'mouseout', this.mouseOutHandler);
this.touchEndPoint = Util.Events.getMousePosition(e);
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.touchEnd,
point: this.touchEndPoint,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
this.fireTouchEvent(e);
},
/*
* Function: onMouseOut
*/
onMouseOut: function(e){
/*
* http://blog.stchur.com/2007/03/15/mouseenter-and-mouseleave-events-for-firefox-and-other-non-ie-browsers/
*/
var relTarget = e.relatedTarget;
if (this.el === relTarget || Util.DOM.isChildOf(relTarget, this.el)){
return;
}
e.preventDefault();
if (this.captureSettings.move){
Util.Events.remove(this.el, 'mousemove', this.mouseMoveHandler);
}
Util.Events.remove(this.el, 'mouseup', this.mouseUpHandler);
Util.Events.remove(this.el, 'mouseout', this.mouseOutHandler);
this.touchEndPoint = Util.Events.getMousePosition(e);
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.touchEnd,
point: this.touchEndPoint,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
this.fireTouchEvent(e);
},
/*
* Function: onGestureStart
*/
onGestureStart: function(e){
e.preventDefault();
var touchEvent = Util.Events.getTouchEvent(e);
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.gestureStart,
scale: touchEvent.scale,
rotation: touchEvent.rotation,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
},
/*
* Function: onGestureChange
*/
onGestureChange: function(e){
e.preventDefault();
var touchEvent = Util.Events.getTouchEvent(e);
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.gestureChange,
scale: touchEvent.scale,
rotation: touchEvent.rotation,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
},
/*
* Function: onGestureEnd
*/
onGestureEnd: function(e){
e.preventDefault();
var touchEvent = Util.Events.getTouchEvent(e);
Util.Events.fire(this, {
type: Util.TouchElement.EventTypes.onTouch,
target: this,
action: Util.TouchElement.ActionTypes.gestureEnd,
scale: touchEvent.scale,
rotation: touchEvent.rotation,
targetEl: e.target,
currentTargetEl: e.currentTarget
});
}
});
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.Image');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.Image.EventTypes = {
onLoad: 'onLoad',
onError: 'onError'
};
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.Image');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.Image.ImageClass = klass({
refObj: null,
imageEl: null,
src: null,
caption: null,
metaData: null,
imageLoadHandler: null,
imageErrorHandler: null,
/*
* Function: dispose
*/
dispose: function(){
var prop, i;
this.shrinkImage();
for (prop in this) {
if (Util.objectHasProperty(this, prop)) {
this[prop] = null;
}
}
},
/*
* Function: initialize
*/
initialize: function(refObj, src, caption, metaData){
this.refObj = refObj;
// This is needed. Webkit resolves the src
// value which means we can't compare against it in the load function
this.originalSrc = src;
this.src = src;
this.caption = caption;
this.metaData = metaData;
this.imageEl = new window.Image();
this.imageLoadHandler = this.onImageLoad.bind(this);
this.imageErrorHandler = this.onImageError.bind(this);
},
/*
* Function: load
*/
load: function(){
this.imageEl.originalSrc = Util.coalesce(this.imageEl.originalSrc, '');
if (this.imageEl.originalSrc === this.src){
if (this.imageEl.isError){
Util.Events.fire(this, {
type: PhotoSwipe.Image.EventTypes.onError,
target: this
});
}
else{
Util.Events.fire(this, {
type: PhotoSwipe.Image.EventTypes.onLoad,
target: this
});
}
return;
}
this.imageEl.isError = false;
this.imageEl.isLoading = true;
this.imageEl.naturalWidth = null;
this.imageEl.naturalHeight = null;
this.imageEl.isLandscape = false;
this.imageEl.onload = this.imageLoadHandler;
this.imageEl.onerror = this.imageErrorHandler;
this.imageEl.onabort = this.imageErrorHandler;
this.imageEl.originalSrc = this.src;
this.imageEl.src = this.src;
},
/*
* Function: shrinkImage
*/
shrinkImage: function(){
if (Util.isNothing(this.imageEl)){
return;
}
if (this.imageEl.src.indexOf(this.src) > -1){
this.imageEl.src = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
if (!Util.isNothing(this.imageEl.parentNode)){
Util.DOM.removeChild(this.imageEl, this.imageEl.parentNode);
}
}
},
/*
* Function: onImageLoad
*/
onImageLoad: function(e){
this.imageEl.onload = null;
this.imageEl.naturalWidth = Util.coalesce(this.imageEl.naturalWidth, this.imageEl.width);
this.imageEl.naturalHeight = Util.coalesce(this.imageEl.naturalHeight, this.imageEl.height);
this.imageEl.isLandscape = (this.imageEl.naturalWidth > this.imageEl.naturalHeight);
this.imageEl.isLoading = false;
Util.Events.fire(this, {
type: PhotoSwipe.Image.EventTypes.onLoad,
target: this
});
},
/*
* Function: onImageError
*/
onImageError: function(e){
this.imageEl.onload = null;
this.imageEl.onerror = null;
this.imageEl.onabort = null;
this.imageEl.isLoading = false;
this.imageEl.isError = true;
Util.Events.fire(this, {
type: PhotoSwipe.Image.EventTypes.onError,
target: this
});
}
});
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.Cache');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.Cache.Mode = {
normal: 'normal',
aggressive: 'aggressive'
};
PhotoSwipe.Cache.Functions = {
/*
* Function: getImageSource
* Default method for returning an image's source
*/
getImageSource: function(el){
return el.href;
},
/*
* Function: 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.
*/
getImageCaption: function(el){
if (el.nodeName === "IMG"){
return Util.DOM.getAttribute(el, 'alt');
}
var i, j, childEl;
for (i=0, j=el.childNodes.length; i<j; i++){
childEl = el.childNodes[i];
if (el.childNodes[i].nodeName === 'IMG'){
return Util.DOM.getAttribute(childEl, 'alt');
}
}
},
/*
* Function: getImageMetaData
* Can be used if you wish to store additional meta
* data against the full size image
*/
getImageMetaData: function(el){
return {};
}
};
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.Cache');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.Cache.CacheClass = klass({
images: null,
settings: null,
/*
* Function: dispose
*/
dispose: function(){
var prop, i, j;
if (!Util.isNothing(this.images)){
for (i=0, j=this.images.length; i<j; i++){
this.images[i].dispose();
}
this.images.length = 0;
}
for (prop in this) {
if (Util.objectHasProperty(this, prop)) {
this[prop] = null;
}
}
},
/*
* Function: initialize
*/
initialize: function(images, options){
var i, j, cacheImage, image, src, caption, metaData;
this.settings = options;
this.images = [];
for (i=0, j=images.length; i<j; i++){
image = images[i];
src = this.settings.getImageSource(image);
caption = this.settings.getImageCaption(image);
metaData = this.settings.getImageMetaData(image);
this.images.push(new PhotoSwipe.Image.ImageClass(image, src, caption, metaData));
}
},
/*
* Function: getImages
*/
getImages: function(indexes){
var i, j, retval = [], cacheImage;
for (i=0, j=indexes.length; i<j; i++){
cacheImage = this.images[indexes[i]];
if (this.settings.cacheMode === PhotoSwipe.Cache.Mode.aggressive){
cacheImage.cacheDoNotShrink = true;
}
retval.push(cacheImage);
}
if (this.settings.cacheMode === PhotoSwipe.Cache.Mode.aggressive){
for (i=0, j=this.images.length; i<j; i++){
cacheImage = this.images[i];
if (!Util.objectHasProperty(cacheImage, 'cacheDoNotShrink')){
cacheImage.shrinkImage();
}
else{
delete cacheImage.cacheDoNotShrink;
}
}
}
return retval;
}
});
}
(
window,
window.klass,
window.Code.Util,
window.Code.PhotoSwipe.Image
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.DocumentOverlay');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.DocumentOverlay.CssClasses = {
documentOverlay: 'ps-document-overlay'
};
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.DocumentOverlay');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.DocumentOverlay.DocumentOverlayClass = klass({
el: null,
settings: null,
initialBodyHeight: null,
/*
* Function: dispose
*/
dispose: function(){
var prop;
Util.Animation.stop(this.el);
Util.DOM.removeChild(this.el, this.el.parentNode);
for (prop in this) {
if (Util.objectHasProperty(this, prop)) {
this[prop] = null;
}
}
},
/*
* Function: initialize
*/
initialize: function(options){
this.settings = options;
this.el = Util.DOM.createElement(
'div',
{
'class': PhotoSwipe.DocumentOverlay.CssClasses.documentOverlay
},
''
);
Util.DOM.setStyle(this.el, {
display: 'block',
position: 'absolute',
left: 0,
top: 0,
zIndex: this.settings.zIndex
});
Util.DOM.hide(this.el);
if (this.settings.target === window){
Util.DOM.appendToBody(this.el);
}
else{
Util.DOM.appendChild(this.el, this.settings.target);
}
Util.Animation.resetTranslate(this.el);
// Store this value incase the body dimensions change to zero!
// I've seen it happen! :D
this.initialBodyHeight = Util.DOM.bodyOuterHeight();
},
/*
* Function: resetPosition
*/
resetPosition: function(){
var width, height, top;
if (this.settings.target === window){
width = Util.DOM.windowWidth();
height = Util.DOM.bodyOuterHeight() * 2; // This covers extra height added by photoswipe
top = (this.settings.jQueryMobile) ? Util.DOM.windowScrollTop() + 'px' : '0px';
if (height < 1){
height = this.initialBodyHeight;
}
if (Util.DOM.windowHeight() > height){
height = Util.DOM.windowHeight();
}
}
else{
width = Util.DOM.width(this.settings.target);
height = Util.DOM.height(this.settings.target);
top = '0px';
}
Util.DOM.setStyle(this.el, {
width: width,
height: height,
top: top
});
},
/*
* Function: fadeIn
*/
fadeIn: function(speed, callback){
this.resetPosition();
Util.DOM.setStyle(this.el, 'opacity', 0);
Util.DOM.show(this.el);
Util.Animation.fadeIn(this.el, speed, callback);
}
});
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.Carousel');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.Carousel.EventTypes = {
onSlideByEnd: 'PhotoSwipeCarouselOnSlideByEnd',
onSlideshowStart: 'PhotoSwipeCarouselOnSlideshowStart',
onSlideshowStop: 'PhotoSwipeCarouselOnSlideshowStop'
};
PhotoSwipe.Carousel.CssClasses = {
carousel: 'ps-carousel',
content: 'ps-carousel-content',
item: 'ps-carousel-item',
itemLoading: 'ps-carousel-item-loading',
itemError: 'ps-carousel-item-error'
};
PhotoSwipe.Carousel.SlideByAction = {
previous: 'previous',
current: 'current',
next: 'next'
};
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.Carousel');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.Carousel.CarouselClass = klass({
el: null,
contentEl: null,
settings: null,
cache: null,
slideByEndHandler: null,
currentCacheIndex: null,
isSliding: null,
isSlideshowActive: null,
lastSlideByAction: null,
touchStartPoint: null,
touchStartPosition: null,
imageLoadHandler: null,
imageErrorHandler: null,
slideshowTimeout: null,
/*
* Function: dispose
*/
dispose: function(){
var prop, i, j;
for (i=0, j=this.cache.images.length; i<j; i++){
Util.Events.remove(this.cache.images[i], PhotoSwipe.Image.EventTypes.onLoad, this.imageLoadHandler);
Util.Events.remove(this.cache.images[i], PhotoSwipe.Image.EventTypes.onError, this.imageErrorHandler);
}
this.stopSlideshow();
Util.Animation.stop(this.el);
Util.DOM.removeChild(this.el, this.el.parentNode);
for (prop in this) {
if (Util.objectHasProperty(this, prop)) {
this[prop] = null;
}
}
},
/*
* Function: initialize
*/
initialize: function(cache, options){
//this.supr(true);
var i, totalItems, itemEl;
this.cache = cache;
this.settings = options;
this.slideByEndHandler = this.onSlideByEnd.bind(this);
this.imageLoadHandler = this.onImageLoad.bind(this);
this.imageErrorHandler = this.onImageError.bind(this);
this.currentCacheIndex = 0;
this.isSliding = false;
this.isSlideshowActive = false;
// No looping if < 3 images
if (this.cache.images.length < 3){
this.settings.loop = false;
}
// Main container
this.el = Util.DOM.createElement(
'div',
{
'class': PhotoSwipe.Carousel.CssClasses.carousel
},
''
);
Util.DOM.setStyle(this.el, {
display: 'block',
position: 'absolute',
left: 0,
top: 0,
overflow: 'hidden',
zIndex: this.settings.zIndex
});
Util.DOM.hide(this.el);
// Content
this.contentEl = Util.DOM.createElement(
'div',
{
'class': PhotoSwipe.Carousel.CssClasses.content
},
''
);
Util.DOM.setStyle(this.contentEl, {
display: 'block',
position: 'absolute',
left: 0,
top: 0
});
Util.DOM.appendChild(this.contentEl, this.el);
// Items
totalItems = (cache.images.length < 3) ? cache.images.length : 3;
for (i=0; i<totalItems; i++){
itemEl = Util.DOM.createElement(
'div',
{
'class': PhotoSwipe.Carousel.CssClasses.item +
' ' + PhotoSwipe.Carousel.CssClasses.item + '-'+ i
},
''
);
Util.DOM.setAttribute(itemEl, 'style', 'float: left;');
Util.DOM.setStyle(itemEl, {
display: 'block',
position: 'relative',
left: 0,
top: 0,
overflow: 'hidden'
});
if (this.settings.margin > 0){
Util.DOM.setStyle(itemEl, {
marginRight: this.settings.margin + 'px'
});
}
Util.DOM.appendChild(itemEl, this.contentEl);
}
if (this.settings.target === window){
Util.DOM.appendToBody(this.el);
}
else{
Util.DOM.appendChild(this.el, this.settings.target);
}
},
/*
* Function: resetPosition
*/
resetPosition: function(){
var width, height, top, itemWidth, itemEls, contentWidth, i, j, itemEl, imageEl;
if (this.settings.target === window){
width = Util.DOM.windowWidth();
height = Util.DOM.windowHeight();
top = Util.DOM.windowScrollTop() + 'px';
}
else{
width = Util.DOM.width(this.settings.target);
height = Util.DOM.height(this.settings.target);
top = '0px';
}
itemWidth = (this.settings.margin > 0) ? width + this.settings.margin : width;
itemEls = Util.DOM.find('.' + PhotoSwipe.Carousel.CssClasses.item, this.contentEl);
contentWidth = itemWidth * itemEls.length;
// Set the height and width to fill the document
Util.DOM.setStyle(this.el, {
top: top,
width: width,
height: height
});
// Set the height and width of the content el
Util.DOM.setStyle(this.contentEl, {
width: contentWidth,
height: height
});
// Set the height and width of item elements
for (i=0, j=itemEls.length; i<j; i++){
itemEl = itemEls[i];
Util.DOM.setStyle(itemEl, {
width: width,
height: height
});
// If an item has an image then resize that
imageEl = Util.DOM.find('img', itemEl)[0];
if (!Util.isNothing(imageEl)){
this.resetImagePosition(imageEl);
}
}
this.setContentLeftPosition();
},
/*
* Function: resetImagePosition
*/
resetImagePosition: function(imageEl){
if (Util.isNothing(imageEl)){
return;
}
var
src = Util.DOM.getAttribute(imageEl, 'src'),
scale,
newWidth,
newHeight,
newTop,
newLeft,
maxWidth = Util.DOM.width(this.el),
maxHeight = Util.DOM.height(this.el);
if (this.settings.imageScaleMethod === 'fitNoUpscale'){
newWidth = imageEl.naturalWidth;
newHeight =imageEl.naturalHeight;
if (newWidth > maxWidth){
scale = maxWidth / newWidth;
newWidth = Math.round(newWidth * scale);
newHeight = Math.round(newHeight * scale);
}
if (newHeight > maxHeight){
scale = maxHeight / newHeight;
newHeight = Math.round(newHeight * scale);
newWidth = Math.round(newWidth * scale);
}
}
else{
if (imageEl.isLandscape) {
// Ensure the width fits the screen
scale = maxWidth / imageEl.naturalWidth;
}
else {
// Ensure the height fits the screen
scale = maxHeight / imageEl.naturalHeight;
}
newWidth = Math.round(imageEl.naturalWidth * scale);
newHeight = Math.round(imageEl.naturalHeight * scale);
if (this.settings.imageScaleMethod === '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.settings.imageScaleMethod === '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 = Math.round( ((maxHeight - newHeight) / 2) ) + 'px';
newLeft = Math.round( ((maxWidth - newWidth) / 2) ) + 'px';
Util.DOM.setStyle(imageEl, {
position: 'absolute',
width: newWidth,
height: newHeight,
top: newTop,
left: newLeft,
display: 'block'
});
},
/*
* Function: setContentLeftPosition
*/
setContentLeftPosition: function(){
var width, itemEls, left;
if (this.settings.target === window){
width = Util.DOM.windowWidth();
}
else{
width = Util.DOM.width(this.settings.target);
}
itemEls = this.getItemEls();
left = 0;
if (this.settings.loop){
left = (width + this.settings.margin) * -1;
}
else{
if (this.currentCacheIndex === this.cache.images.length-1){
left = ((itemEls.length-1) * (width + this.settings.margin)) * -1;
}
else if (this.currentCacheIndex > 0){
left = (width + this.settings.margin) * -1;
}
}
Util.DOM.setStyle(this.contentEl, {
left: left + 'px'
});
},
/*
* Function:
*/
show: function(index){
this.currentCacheIndex = index;
this.resetPosition();
this.setImages(false);
Util.DOM.show(this.el);
Util.Animation.resetTranslate(this.contentEl);
var
itemEls = this.getItemEls(),
i, j;
for (i=0, j=itemEls.length; i<j; i++){
Util.Animation.resetTranslate(itemEls[i]);
}
Util.Events.fire(this, {
type: PhotoSwipe.Carousel.EventTypes.onSlideByEnd,
target: this,
action: PhotoSwipe.Carousel.SlideByAction.current,
cacheIndex: this.currentCacheIndex
});
},
/*
* Function: setImages
*/
setImages: function(ignoreCurrent){
var
cacheImages,
itemEls = this.getItemEls(),
nextCacheIndex = this.currentCacheIndex + 1,
previousCacheIndex = this.currentCacheIndex - 1;
if (this.settings.loop){
if (nextCacheIndex > this.cache.images.length-1){
nextCacheIndex = 0;
}
if (previousCacheIndex < 0){
previousCacheIndex = this.cache.images.length-1;
}
cacheImages = this.cache.getImages([
previousCacheIndex,
this.currentCacheIndex,
nextCacheIndex
]);
if (!ignoreCurrent){
// Current
this.addCacheImageToItemEl(cacheImages[1], itemEls[1]);
}
// Next
this.addCacheImageToItemEl(cacheImages[2], itemEls[2]);
// Previous
this.addCacheImageToItemEl(cacheImages[0], itemEls[0]);
}
else{
if (itemEls.length === 1){
if (!ignoreCurrent){
// Current
cacheImages = this.cache.getImages([
this.currentCacheIndex
]);
this.addCacheImageToItemEl(cacheImages[0], itemEls[0]);
}
}
else if (itemEls.length === 2){
if (this.currentCacheIndex === 0){
cacheImages = this.cache.getImages([
this.currentCacheIndex,
this.currentCacheIndex + 1
]);
if (!ignoreCurrent){
this.addCacheImageToItemEl(cacheImages[0], itemEls[0]);
}
this.addCacheImageToItemEl(cacheImages[1], itemEls[1]);
}
else{
cacheImages = this.cache.getImages([
this.currentCacheIndex - 1,
this.currentCacheIndex
]);
if (!ignoreCurrent){
this.addCacheImageToItemEl(cacheImages[1], itemEls[1]);
}
this.addCacheImageToItemEl(cacheImages[0], itemEls[0]);
}
}
else{
if (this.currentCacheIndex === 0){
cacheImages = this.cache.getImages([
this.currentCacheIndex,
this.currentCacheIndex + 1,
this.currentCacheIndex + 2
]);
if (!ignoreCurrent){
this.addCacheImageToItemEl(cacheImages[0], itemEls[0]);
}
this.addCacheImageToItemEl(cacheImages[1], itemEls[1]);
this.addCacheImageToItemEl(cacheImages[2], itemEls[2]);
}
else if (this.currentCacheIndex === this.cache.images.length-1){
cacheImages = this.cache.getImages([
this.currentCacheIndex - 2,
this.currentCacheIndex - 1,
this.currentCacheIndex
]);
if (!ignoreCurrent){
// Current
this.addCacheImageToItemEl(cacheImages[2], itemEls[2]);
}
this.addCacheImageToItemEl(cacheImages[1], itemEls[1]);
this.addCacheImageToItemEl(cacheImages[0], itemEls[0]);
}
else{
cacheImages = this.cache.getImages([
this.currentCacheIndex - 1,
this.currentCacheIndex,
this.currentCacheIndex + 1
]);
if (!ignoreCurrent){
// Current
this.addCacheImageToItemEl(cacheImages[1], itemEls[1]);
}
// Next
this.addCacheImageToItemEl(cacheImages[2], itemEls[2]);
// Previous
this.addCacheImageToItemEl(cacheImages[0], itemEls[0]);
}
}
}
},
/*
* Function: addCacheImageToItemEl
*/
addCacheImageToItemEl: function(cacheImage, itemEl){
Util.DOM.removeClass(itemEl, PhotoSwipe.Carousel.CssClasses.itemError);
Util.DOM.addClass(itemEl, PhotoSwipe.Carousel.CssClasses.itemLoading);
Util.DOM.removeChildren(itemEl);
Util.DOM.setStyle(cacheImage.imageEl, {
display: 'none'
});
Util.DOM.appendChild(cacheImage.imageEl, itemEl);
Util.Animation.resetTranslate(cacheImage.imageEl);
Util.Events.add(cacheImage, PhotoSwipe.Image.EventTypes.onLoad, this.imageLoadHandler);
Util.Events.add(cacheImage, PhotoSwipe.Image.EventTypes.onError, this.imageErrorHandler);
cacheImage.load();
},
/*
* Function: slideCarousel
*/
slideCarousel: function(point, action, speed){
if (this.isSliding){
return;
}
var width, diffX, slideBy;
if (this.settings.target === window){
width = Util.DOM.windowWidth() + this.settings.margin;
}
else{
width = Util.DOM.width(this.settings.target) + this.settings.margin;
}
speed = Util.coalesce(speed, this.settings.slideSpeed);
if (window.Math.abs(diffX) < 1){
return;
}
switch (action){
case Util.TouchElement.ActionTypes.swipeLeft:
slideBy = width * -1;
break;
case Util.TouchElement.ActionTypes.swipeRight:
slideBy = width;
break;
default:
diffX = point.x - this.touchStartPoint.x;
if (window.Math.abs(diffX) > width / 2){
slideBy = (diffX > 0) ? width : width * -1;
}
else{
slideBy = 0;
}
break;
}
if (slideBy < 0){
this.lastSlideByAction = PhotoSwipe.Carousel.SlideByAction.next;
}
else if (slideBy > 0){
this.lastSlideByAction = PhotoSwipe.Carousel.SlideByAction.previous;
}
else{
this.lastSlideByAction = PhotoSwipe.Carousel.SlideByAction.current;
}
// Check for non-looping carousels
// If we are at the start or end, spring back to the current item element
if (!this.settings.loop){
if ( (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.previous && this.currentCacheIndex === 0 ) || (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.next && this.currentCacheIndex === this.cache.images.length-1) ){
slideBy = 0;
this.lastSlideByAction = PhotoSwipe.Carousel.SlideByAction.current;
}
}
this.isSliding = true;
this.doSlideCarousel(slideBy, speed);
},
/*
* Function:
*/
moveCarousel: function(point){
if (this.isSliding){
return;
}
if (!this.settings.enableDrag){
return;
}
this.doMoveCarousel(point.x - this.touchStartPoint.x);
},
/*
* Function: getItemEls
*/
getItemEls: function(){
return Util.DOM.find('.' + PhotoSwipe.Carousel.CssClasses.item, this.contentEl);
},
/*
* Function: previous
*/
previous: function(){
this.stopSlideshow();
this.slideCarousel({x:0, y:0}, Util.TouchElement.ActionTypes.swipeRight, this.settings.nextPreviousSlideSpeed);
},
/*
* Function: next
*/
next: function(){
this.stopSlideshow();
this.slideCarousel({x:0, y:0}, Util.TouchElement.ActionTypes.swipeLeft, this.settings.nextPreviousSlideSpeed);
},
/*
* Function: slideshowNext
*/
slideshowNext: function(){
this.slideCarousel({x:0, y:0}, Util.TouchElement.ActionTypes.swipeLeft);
},
/*
* Function: startSlideshow
*/
startSlideshow: function(){
this.stopSlideshow();
this.isSlideshowActive = true;
this.slideshowTimeout = window.setTimeout(this.slideshowNext.bind(this), this.settings.slideshowDelay);
Util.Events.fire(this, {
type: PhotoSwipe.Carousel.EventTypes.onSlideshowStart,
target: this
});
},
/*
* Function: stopSlideshow
*/
stopSlideshow: function(){
if (!Util.isNothing(this.slideshowTimeout)){
window.clearTimeout(this.slideshowTimeout);
this.slideshowTimeout = null;
this.isSlideshowActive = false;
Util.Events.fire(this, {
type: PhotoSwipe.Carousel.EventTypes.onSlideshowStop,
target: this
});
}
},
/*
* Function: onSlideByEnd
*/
onSlideByEnd: function(e){
if (Util.isNothing(this.isSliding)){
return;
}
var itemEls = this.getItemEls();
this.isSliding = false;
if (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.next){
this.currentCacheIndex = this.currentCacheIndex + 1;
}
else if (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.previous){
this.currentCacheIndex = this.currentCacheIndex - 1;
}
if (this.settings.loop){
if (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.next){
// Move first to the last
Util.DOM.appendChild(itemEls[0], this.contentEl);
}
else if (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.previous){
// Move the last to the first
Util.DOM.insertBefore(itemEls[itemEls.length-1], itemEls[0], this.contentEl);
}
if (this.currentCacheIndex < 0){
this.currentCacheIndex = this.cache.images.length - 1;
}
else if (this.currentCacheIndex === this.cache.images.length){
this.currentCacheIndex = 0;
}
}
else{
if (this.cache.images.length > 3){
if (this.currentCacheIndex > 1 && this.currentCacheIndex < this.cache.images.length-2){
if (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.next){
// Move first to the last
Util.DOM.appendChild(itemEls[0], this.contentEl);
}
else if (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.previous){
// Move the last to the first
Util.DOM.insertBefore(itemEls[itemEls.length-1], itemEls[0], this.contentEl);
}
}
else if (this.currentCacheIndex === 1){
if (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.previous){
// Move the last to the first
Util.DOM.insertBefore(itemEls[itemEls.length-1], itemEls[0], this.contentEl);
}
}
else if (this.currentCacheIndex === this.cache.images.length-2){
if (this.lastSlideByAction === PhotoSwipe.Carousel.SlideByAction.next){
// Move first to the last
Util.DOM.appendChild(itemEls[0], this.contentEl);
}
}
}
}
if (this.lastSlideByAction !== PhotoSwipe.Carousel.SlideByAction.current){
this.setContentLeftPosition();
this.setImages(true);
}
Util.Events.fire(this, {
type: PhotoSwipe.Carousel.EventTypes.onSlideByEnd,
target: this,
action: this.lastSlideByAction,
cacheIndex: this.currentCacheIndex
});
if (this.isSlideshowActive){
if (this.lastSlideByAction !== PhotoSwipe.Carousel.SlideByAction.current){
this.startSlideshow();
}
else{
this.stopSlideshow();
}
}
},
/*
* Function: onTouch
*/
onTouch: function(action, point){
this.stopSlideshow();
switch(action){
case Util.TouchElement.ActionTypes.touchStart:
this.touchStartPoint = point;
this.touchStartPosition = {
x: window.parseInt(Util.DOM.getStyle(this.contentEl, 'left'), 0),
y: window.parseInt(Util.DOM.getStyle(this.contentEl, 'top'), 0)
};
break;
case Util.TouchElement.ActionTypes.touchMove:
this.moveCarousel(point);
break;
case Util.TouchElement.ActionTypes.touchMoveEnd:
case Util.TouchElement.ActionTypes.swipeLeft:
case Util.TouchElement.ActionTypes.swipeRight:
this.slideCarousel(point, action);
break;
case Util.TouchElement.ActionTypes.tap:
break;
case Util.TouchElement.ActionTypes.doubleTap:
break;
}
},
/*
* Function: onImageLoad
*/
onImageLoad: function(e){
var cacheImage = e.target;
if (!Util.isNothing(cacheImage.imageEl.parentNode)){
Util.DOM.removeClass(cacheImage.imageEl.parentNode, PhotoSwipe.Carousel.CssClasses.itemLoading);
this.resetImagePosition(cacheImage.imageEl);
}
Util.Events.remove(cacheImage, PhotoSwipe.Image.EventTypes.onLoad, this.imageLoadHandler);
Util.Events.remove(cacheImage, PhotoSwipe.Image.EventTypes.onError, this.imageErrorHandler);
},
/*
* Function: onImageError
*/
onImageError: function(e){
var cacheImage = e.target;
if (!Util.isNothing(cacheImage.imageEl.parentNode)){
Util.DOM.removeClass(cacheImage.imageEl.parentNode, PhotoSwipe.Carousel.CssClasses.itemLoading);
Util.DOM.addClass(cacheImage.imageEl.parentNode, PhotoSwipe.Carousel.CssClasses.itemError);
}
Util.Events.remove(cacheImage, PhotoSwipe.Image.EventTypes.onLoad, this.imageLoadHandler);
Util.Events.remove(cacheImage, PhotoSwipe.Image.EventTypes.onError, this.imageErrorHandler);
}
});
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util, TouchElement){
Util.registerNamespace('Code.PhotoSwipe.Carousel');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.Carousel.CarouselClass = PhotoSwipe.Carousel.CarouselClass.extend({
/*
* Function: getStartingPos
*/
getStartingPos: function(){
var startingPos = this.touchStartPosition;
if (Util.isNothing(startingPos)){
startingPos = {
x: window.parseInt(Util.DOM.getStyle(this.contentEl, 'left'), 0),
y: window.parseInt(Util.DOM.getStyle(this.contentEl, 'top'), 0)
};
}
return startingPos;
},
/*
* Function: doMoveCarousel
*/
doMoveCarousel: function(xVal){
var style;
if (Util.Browser.isCSSTransformSupported){
style = {};
style[Util.Animation._transitionPrefix + 'Property'] = 'all';
style[Util.Animation._transitionPrefix + 'Duration'] = '';
style[Util.Animation._transitionPrefix + 'TimingFunction'] = '';
style[Util.Animation._transitionPrefix + 'Delay'] = '0';
style[Util.Animation._transformLabel] = (Util.Browser.is3dSupported) ? 'translate3d(' + xVal + 'px, 0px, 0px)' : 'translate(' + xVal + 'px, 0px)';
Util.DOM.setStyle(this.contentEl, style);
}
else if (!Util.isNothing(window.jQuery)){
window.jQuery(this.contentEl).stop().css('left', this.getStartingPos().x + xVal + 'px');
}
},
/*
* Function: doSlideCarousel
*/
doSlideCarousel: function(xVal, speed){
var animateProps, transform;
if (speed <= 0){
this.slideByEndHandler();
return;
}
if (Util.Browser.isCSSTransformSupported){
transform = Util.coalesce(this.contentEl.style.webkitTransform, this.contentEl.style.MozTransform, this.contentEl.style.transform, '');
if (transform.indexOf('translate3d(' + xVal) === 0){
this.slideByEndHandler();
return;
}
else if (transform.indexOf('translate(' + xVal) === 0){
this.slideByEndHandler();
return;
}
Util.Animation.slideBy(this.contentEl, xVal, 0, speed, this.slideByEndHandler, this.settings.slideTimingFunction);
}
else if (!Util.isNothing(window.jQuery)){
animateProps = {
left: this.getStartingPos().x + xVal + 'px'
};
if (this.settings.animationTimingFunction === 'ease-out'){
this.settings.animationTimingFunction = 'easeOutQuad';
}
if ( Util.isNothing(window.jQuery.easing[this.settings.animationTimingFunction]) ){
this.settings.animationTimingFunction = 'linear';
}
window.jQuery(this.contentEl).animate(
animateProps,
this.settings.slideSpeed,
this.settings.animationTimingFunction,
this.slideByEndHandler
);
}
}
});
}
(
window,
window.klass,
window.Code.Util,
window.Code.PhotoSwipe.TouchElement
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.Toolbar');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.Toolbar.CssClasses = {
toolbar: 'ps-toolbar',
toolbarContent: 'ps-toolbar-content',
toolbarTop: 'ps-toolbar-top',
caption: 'ps-caption',
captionBottom: 'ps-caption-bottom',
captionContent: 'ps-caption-content',
close: 'ps-toolbar-close',
play: 'ps-toolbar-play',
previous: 'ps-toolbar-previous',
previousDisabled: 'ps-toolbar-previous-disabled',
next: 'ps-toolbar-next',
nextDisabled: 'ps-toolbar-next-disabled'
};
PhotoSwipe.Toolbar.ToolbarAction = {
close: 'close',
play: 'play',
next: 'next',
previous: 'previous',
none: 'none'
};
PhotoSwipe.Toolbar.EventTypes = {
onTap: 'PhotoSwipeToolbarOnClick',
onBeforeShow: 'PhotoSwipeToolbarOnBeforeShow',
onShow: 'PhotoSwipeToolbarOnShow',
onBeforeHide: 'PhotoSwipeToolbarOnBeforeHide',
onHide: 'PhotoSwipeToolbarOnHide'
};
PhotoSwipe.Toolbar.getToolbar = function(){
return '<div class="' + PhotoSwipe.Toolbar.CssClasses.close + '"><div class="' + PhotoSwipe.Toolbar.CssClasses.toolbarContent + '"></div></div><div class="' + PhotoSwipe.Toolbar.CssClasses.play + '"><div class="' + PhotoSwipe.Toolbar.CssClasses.toolbarContent + '"></div></div><div class="' + PhotoSwipe.Toolbar.CssClasses.previous + '"><div class="' + PhotoSwipe.Toolbar.CssClasses.toolbarContent + '"></div></div><div class="' + PhotoSwipe.Toolbar.CssClasses.next + '"><div class="' + PhotoSwipe.Toolbar.CssClasses.toolbarContent + '"></div></div>';
};
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.Toolbar');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.Toolbar.ToolbarClass = klass({
toolbarEl: null,
closeEl: null,
playEl: null,
previousEl: null,
nextEl: null,
captionEl: null,
captionContentEl: null,
currentCaption: null,
settings: null,
cache: null,
timeout: null,
isVisible: null,
fadeOutHandler: null,
touchStartHandler: null,
touchMoveHandler: null,
clickHandler: null,
/*
* Function: dispose
*/
dispose: function(){
var prop;
this.clearTimeout();
this.removeEventHandlers();
Util.Animation.stop(this.toolbarEl);
Util.Animation.stop(this.captionEl);
Util.DOM.removeChild(this.toolbarEl, this.toolbarEl.parentNode);
Util.DOM.removeChild(this.captionEl, this.captionEl.parentNode);
for (prop in this) {
if (Util.objectHasProperty(this, prop)) {
this[prop] = null;
}
}
},
/*
* Function: initialize
*/
initialize: function(cache, options){
var cssClass;
this.settings = options;
this.cache = cache;
this.isVisible = false;
this.fadeOutHandler = this.onFadeOut.bind(this);
this.touchStartHandler = this.onTouchStart.bind(this);
this.touchMoveHandler = this.onTouchMove.bind(this);
this.clickHandler = this.onClick.bind(this);
cssClass = PhotoSwipe.Toolbar.CssClasses.toolbar;
if (this.settings.captionAndToolbarFlipPosition){
cssClass = cssClass + ' ' + PhotoSwipe.Toolbar.CssClasses.toolbarTop;
}
// Toolbar
this.toolbarEl = Util.DOM.createElement(
'div',
{
'class': cssClass
},
this.settings.getToolbar()
);
Util.DOM.setStyle(this.toolbarEl, {
left: 0,
position: 'absolute',
overflow: 'hidden',
zIndex: this.settings.zIndex
});
if (this.settings.target === window){
Util.DOM.appendToBody(this.toolbarEl);
}
else{
Util.DOM.appendChild(this.toolbarEl, this.settings.target);
}
Util.DOM.hide(this.toolbarEl);
this.closeEl = Util.DOM.find('.' + PhotoSwipe.Toolbar.CssClasses.close, this.toolbarEl)[0];
if (this.settings.preventHide && !Util.isNothing(this.closeEl)){
Util.DOM.hide(this.closeEl);
}
this.playEl = Util.DOM.find('.' + PhotoSwipe.Toolbar.CssClasses.play, this.toolbarEl)[0];
if (this.settings.preventSlideshow && !Util.isNothing(this.playEl)){
Util.DOM.hide(this.playEl);
}
this.nextEl = Util.DOM.find('.' + PhotoSwipe.Toolbar.CssClasses.next, this.toolbarEl)[0];
this.previousEl = Util.DOM.find('.' + PhotoSwipe.Toolbar.CssClasses.previous, this.toolbarEl)[0];
// Caption
cssClass = PhotoSwipe.Toolbar.CssClasses.caption;
if (this.settings.captionAndToolbarFlipPosition){
cssClass = cssClass + ' ' + PhotoSwipe.Toolbar.CssClasses.captionBottom;
}
this.captionEl = Util.DOM.createElement(
'div',
{
'class': cssClass
},
''
);
Util.DOM.setStyle(this.captionEl, {
left: 0,
position: 'absolute',
overflow: 'hidden',
zIndex: this.settings.zIndex
});
if (this.settings.target === window){
Util.DOM.appendToBody(this.captionEl);
}
else{
Util.DOM.appendChild(this.captionEl, this.settings.target);
}
Util.DOM.hide(this.captionEl);
this.captionContentEl = Util.DOM.createElement(
'div',
{
'class': PhotoSwipe.Toolbar.CssClasses.captionContent
},
''
);
Util.DOM.appendChild(this.captionContentEl, this.captionEl);
this.addEventHandlers();
},
/*
* Function: resetPosition
*/
resetPosition: function(){
var width, toolbarTop, captionTop;
if (this.settings.target === window){
if (this.settings.captionAndToolbarFlipPosition){
toolbarTop = Util.DOM.windowScrollTop();
captionTop = (Util.DOM.windowScrollTop() + Util.DOM.windowHeight()) - Util.DOM.height(this.captionEl);
}
else {
toolbarTop = (Util.DOM.windowScrollTop() + Util.DOM.windowHeight()) - Util.DOM.height(this.toolbarEl);
captionTop = Util.DOM.windowScrollTop();
}
width = Util.DOM.windowWidth();
}
else{
if (this.settings.captionAndToolbarFlipPosition){
toolbarTop = '0';
captionTop = Util.DOM.height(this.settings.target) - Util.DOM.height(this.captionEl);
}
else{
toolbarTop = Util.DOM.height(this.settings.target) - Util.DOM.height(this.toolbarEl);
captionTop = 0;
}
width = Util.DOM.width(this.settings.target);
}
Util.DOM.setStyle(this.toolbarEl, {
top: toolbarTop + 'px',
width: width
});
Util.DOM.setStyle(this.captionEl, {
top: captionTop + 'px',
width: width
});
},
/*
* Function: toggleVisibility
*/
toggleVisibility: function(index){
if (this.isVisible){
this.fadeOut();
}
else{
this.show(index);
}
},
/*
* Function: show
*/
show: function(index){
Util.Animation.stop(this.toolbarEl);
Util.Animation.stop(this.captionEl);
this.resetPosition();
this.setToolbarStatus(index);
Util.Events.fire(this, {
type: PhotoSwipe.Toolbar.EventTypes.onBeforeShow,
target: this
});
this.showToolbar();
this.setCaption(index);
this.showCaption();
this.isVisible = true;
this.setTimeout();
Util.Events.fire(this, {
type: PhotoSwipe.Toolbar.EventTypes.onShow,
target: this
});
},
/*
* Function: setTimeout
*/
setTimeout: function(){
if (this.settings.captionAndToolbarAutoHideDelay > 0){
// Set a timeout to hide the toolbar
this.clearTimeout();
this.timeout = window.setTimeout(this.fadeOut.bind(this), this.settings.captionAndToolbarAutoHideDelay);
}
},
/*
* Function: clearTimeout
*/
clearTimeout: function(){
if (!Util.isNothing(this.timeout)){
window.clearTimeout(this.timeout);
this.timeout = null;
}
},
/*
* Function: fadeOut
*/
fadeOut: function(){
this.clearTimeout();
Util.Events.fire(this, {
type: PhotoSwipe.Toolbar.EventTypes.onBeforeHide,
target: this
});
Util.Animation.fadeOut(this.toolbarEl, this.settings.fadeOutSpeed);
Util.Animation.fadeOut(this.captionEl, this.settings.fadeOutSpeed, this.fadeOutHandler);
this.isVisible = false;
},
/*
* Function: addEventHandlers
*/
addEventHandlers: function(){
if (Util.Browser.isTouchSupported){
if (!Util.Browser.blackberry){
// Had an issue with touchstart, animation and Blackberry. BB will default to click
Util.Events.add(this.toolbarEl, 'touchstart', this.touchStartHandler);
}
Util.Events.add(this.toolbarEl, 'touchmove', this.touchMoveHandler);
Util.Events.add(this.captionEl, 'touchmove', this.touchMoveHandler);
}
Util.Events.add(this.toolbarEl, 'click', this.clickHandler);
},
/*
* Function: removeEventHandlers
*/
removeEventHandlers: function(){
if (Util.Browser.isTouchSupported){
if (!Util.Browser.blackberry){
// Had an issue with touchstart, animation and Blackberry. BB will default to click
Util.Events.remove(this.toolbarEl, 'touchstart', this.touchStartHandler);
}
Util.Events.remove(this.toolbarEl, 'touchmove', this.touchMoveHandler);
Util.Events.remove(this.captionEl, 'touchmove', this.touchMoveHandler);
}
Util.Events.remove(this.toolbarEl, 'click', this.clickHandler);
},
/*
* Function: handleTap
*/
handleTap: function(e){
this.clearTimeout();
var action;
if (e.target === this.nextEl || Util.DOM.isChildOf(e.target, this.nextEl)){
action = PhotoSwipe.Toolbar.ToolbarAction.next;
}
else if (e.target === this.previousEl || Util.DOM.isChildOf(e.target, this.previousEl)){
action = PhotoSwipe.Toolbar.ToolbarAction.previous;
}
else if (e.target === this.closeEl || Util.DOM.isChildOf(e.target, this.closeEl)){
action = PhotoSwipe.Toolbar.ToolbarAction.close;
}
else if (e.target === this.playEl || Util.DOM.isChildOf(e.target, this.playEl)){
action = PhotoSwipe.Toolbar.ToolbarAction.play;
}
this.setTimeout();
if (Util.isNothing(action)){
action = PhotoSwipe.Toolbar.ToolbarAction.none;
}
Util.Events.fire(this, {
type: PhotoSwipe.Toolbar.EventTypes.onTap,
target: this,
action: action,
tapTarget: e.target
});
},
/*
* Function: setCaption
*/
setCaption: function(index){
Util.DOM.removeChildren(this.captionContentEl);
this.currentCaption = Util.coalesce(this.cache.images[index].caption, '\u00A0');
if (Util.isObject(this.currentCaption)){
Util.DOM.appendChild(this.currentCaption, this.captionContentEl);
}
else{
if (this.currentCaption === ''){
this.currentCaption = '\u00A0';
}
Util.DOM.appendText(this.currentCaption, this.captionContentEl);
}
this.currentCaption = (this.currentCaption === '\u00A0') ? '' : this.currentCaption;
this.resetPosition();
},
/*
* Function: showToolbar
*/
showToolbar: function(){
Util.DOM.setStyle(this.toolbarEl, {
opacity: this.settings.captionAndToolbarOpacity
});
Util.DOM.show(this.toolbarEl);
},
/*
* Function: showCaption
*/
showCaption: function(){
if (this.currentCaption === '' || this.captionContentEl.childNodes.length < 1){
// Empty caption
if (!this.settings.captionAndToolbarShowEmptyCaptions){
Util.DOM.hide(this.captionEl);
return;
}
}
Util.DOM.setStyle(this.captionEl, {
opacity: this.settings.captionAndToolbarOpacity
});
Util.DOM.show(this.captionEl);
},
/*
* Function: setToolbarStatus
*/
setToolbarStatus: function(index){
if (this.settings.loop){
return;
}
Util.DOM.removeClass(this.previousEl, PhotoSwipe.Toolbar.CssClasses.previousDisabled);
Util.DOM.removeClass(this.nextEl, PhotoSwipe.Toolbar.CssClasses.nextDisabled);
if (index > 0 && index < this.cache.images.length-1){
return;
}
if (index === 0){
if (!Util.isNothing(this.previousEl)){
Util.DOM.addClass(this.previousEl, PhotoSwipe.Toolbar.CssClasses.previousDisabled);
}
}
if (index === this.cache.images.length-1){
if (!Util.isNothing(this.nextEl)){
Util.DOM.addClass(this.nextEl, PhotoSwipe.Toolbar.CssClasses.nextDisabled);
}
}
},
/*
* Function: onFadeOut
*/
onFadeOut: function(){
Util.DOM.hide(this.toolbarEl);
Util.DOM.hide(this.captionEl);
Util.Events.fire(this, {
type: PhotoSwipe.Toolbar.EventTypes.onHide,
target: this
});
},
/*
* Function: onTouchStart
*/
onTouchStart: function(e){
e.preventDefault();
Util.Events.remove(this.toolbarEl, 'click', this.clickHandler);
this.handleTap(e);
},
/*
* Function: onTouchMove
*/
onTouchMove: function(e){
e.preventDefault();
},
/*
* Function: onClick
*/
onClick: function(e){
e.preventDefault();
this.handleTap(e);
}
});
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.UILayer');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.UILayer.CssClasses = {
uiLayer: 'ps-uilayer'
};
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.UILayer');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.UILayer.UILayerClass = Util.TouchElement.TouchElementClass.extend({
el: null,
settings: null,
/*
* Function: dispose
*/
dispose: function(){
var prop;
this.removeEventHandlers();
Util.DOM.removeChild(this.el, this.el.parentNode);
for (prop in this) {
if (Util.objectHasProperty(this, prop)) {
this[prop] = null;
}
}
},
/*
* Function: initialize
*/
initialize: function(options){
this.settings = options;
// Main container
this.el = Util.DOM.createElement(
'div',
{
'class': PhotoSwipe.UILayer.CssClasses.uiLayer
},
''
);
Util.DOM.setStyle(this.el, {
display: 'block',
position: 'absolute',
left: 0,
top: 0,
overflow: 'hidden',
zIndex: this.settings.zIndex,
opacity: 0
});
Util.DOM.hide(this.el);
if (this.settings.target === window){
Util.DOM.appendToBody(this.el);
}
else{
Util.DOM.appendChild(this.el, this.settings.target);
}
this.supr(this.el, {
swipe: true,
move: true,
gesture: Util.Browser.iOS,
doubleTap: true,
preventDefaultTouchEvents: this.settings.preventDefaultTouchEvents
});
},
/*
* Function: resetPosition
*/
resetPosition: function(){
// Set the height and width to fill the document
if (this.settings.target === window){
Util.DOM.setStyle(this.el, {
top: Util.DOM.windowScrollTop() + 'px',
width: Util.DOM.windowWidth(),
height: Util.DOM.windowHeight()
});
}
else{
Util.DOM.setStyle(this.el, {
top: '0px',
width: Util.DOM.width(this.settings.target),
height: Util.DOM.height(this.settings.target)
});
}
},
/*
* Function: show
*/
show: function(){
this.resetPosition();
Util.DOM.show(this.el);
this.addEventHandlers();
},
/*
* Function: addEventHandlers
*/
addEventHandlers: function(){
this.supr();
},
/*
* Function: removeEventHandlers
*/
removeEventHandlers: function(){
this.supr();
}
});
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.ZoomPanRotate');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.ZoomPanRotate.CssClasses = {
zoomPanRotate: 'ps-zoom-pan-rotate'
};
PhotoSwipe.ZoomPanRotate.EventTypes = {
onTransform: 'PhotoSwipeZoomPanRotateOnTransform'
};
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util){
Util.registerNamespace('Code.PhotoSwipe.ZoomPanRotate');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.ZoomPanRotate.ZoomPanRotateClass = klass({
el: null,
settings: null,
containerEl: null,
imageEl: null,
transformSettings: null,
panStartingPoint: null,
transformEl: null,
/*
* Function: dispose
*/
dispose: function(){
var prop;
Util.DOM.removeChild(this.el, this.el.parentNode);
for (prop in this) {
if (Util.objectHasProperty(this, prop)) {
this[prop] = null;
}
}
},
/*
* Function: initialize
*/
initialize: function(options, cacheImage, uiLayer){
var parentEl, width, height, top;
this.settings = options;
if (this.settings.target === window){
parentEl = document.body;
width = Util.DOM.windowWidth();
height = Util.DOM.windowHeight();
top = Util.DOM.windowScrollTop() + 'px';
}
else{
parentEl = this.settings.target;
width = Util.DOM.width(parentEl);
height = Util.DOM.height(parentEl);
top = '0px';
}
this.imageEl = cacheImage.imageEl.cloneNode(false);
Util.DOM.setStyle(this.imageEl, {
zIndex: 1
});
this.transformSettings = {
startingScale: 1.0,
scale: 1.0,
startingRotation: 0,
rotation: 0,
startingTranslateX: 0,
startingTranslateY: 0,
translateX: 0,
translateY: 0
};
this.el = Util.DOM.createElement(
'div',
{
'class': PhotoSwipe.ZoomPanRotate.CssClasses.zoomPanRotate
},
''
);
Util.DOM.setStyle(this.el, {
left: 0,
top: top,
position: 'absolute',
width: width,
height: height,
zIndex: this.settings.zIndex,
display: 'block'
});
Util.DOM.insertBefore(this.el, uiLayer.el, parentEl);
if (Util.Browser.iOS){
this.containerEl = Util.DOM.createElement('div');
Util.DOM.setStyle(this.containerEl, {
left: 0,
top: 0,
width: width,
height: height,
position: 'absolute',
zIndex: 1
});
Util.DOM.appendChild(this.imageEl, this.containerEl);
Util.DOM.appendChild(this.containerEl, this.el);
Util.Animation.resetTranslate(this.containerEl);
Util.Animation.resetTranslate(this.imageEl);
this.transformEl = this.containerEl;
}
else{
Util.DOM.appendChild(this.imageEl, this.el);
this.transformEl = this.imageEl;
}
},
/*
* Function: setStartingTranslateFromCurrentTransform
*/
setStartingTranslateFromCurrentTransform: function(){
var
transformValue = Util.coalesce(this.transformEl.style.webkitTransform, this.transformEl.style.MozTransform, this.transformEl.style.transform),
transformExploded;
if (!Util.isNothing(transformValue)){
transformExploded = transformValue.match( /translate\((.*?)\)/ );
if (!Util.isNothing(transformExploded)){
transformExploded = transformExploded[1].split(', ');
this.transformSettings.startingTranslateX = window.parseInt(transformExploded[0], 10);
this.transformSettings.startingTranslateY = window.parseInt(transformExploded[1], 10);
}
}
},
/*
* Function: getScale
*/
getScale: function(scaleValue){
var scale = this.transformSettings.startingScale * scaleValue;
if (this.settings.minUserZoom !== 0 && scale < this.settings.minUserZoom){
scale = this.settings.minUserZoom;
}
else if (this.settings.maxUserZoom !== 0 && scale > this.settings.maxUserZoom){
scale = this.settings.maxUserZoom;
}
return scale;
},
/*
* Function: setStartingScaleAndRotation
*/
setStartingScaleAndRotation: function(scaleValue, rotationValue){
this.transformSettings.startingScale = this.getScale(scaleValue);
this.transformSettings.startingRotation =
(this.transformSettings.startingRotation + rotationValue) % 360;
},
/*
* Function: zoomRotate
*/
zoomRotate: function(scaleValue, rotationValue){
this.transformSettings.scale = this.getScale(scaleValue);
this.transformSettings.rotation =
this.transformSettings.startingRotation + rotationValue;
this.applyTransform();
},
/*
* Function: panStart
*/
panStart: function(point){
this.setStartingTranslateFromCurrentTransform();
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 = dx / this.transformSettings.scale ,
dyScaleAdjust = dy / this.transformSettings.scale;
this.transformSettings.translateX =
this.transformSettings.startingTranslateX + dxScaleAdjust;
this.transformSettings.translateY =
this.transformSettings.startingTranslateY + dyScaleAdjust;
this.applyTransform();
},
/*
* Function: zoomAndPanToPoint
*/
zoomAndPanToPoint: function(scaleValue, point){
if (this.settings.target === window){
this.panStart({
x: Util.DOM.windowWidth() / 2,
y: Util.DOM.windowHeight() / 2
});
var
dx = point.x - this.panStartingPoint.x,
dy = point.y - this.panStartingPoint.y,
dxScaleAdjust = dx / this.transformSettings.scale,
dyScaleAdjust = dy / this.transformSettings.scale;
this.transformSettings.translateX =
(this.transformSettings.startingTranslateX + dxScaleAdjust) * -1;
this.transformSettings.translateY =
(this.transformSettings.startingTranslateY + dyScaleAdjust) * -1;
}
this.setStartingScaleAndRotation(scaleValue, 0);
this.transformSettings.scale = this.transformSettings.startingScale;
this.transformSettings.rotation = 0;
this.applyTransform();
},
/*
* Function: applyTransform
*/
applyTransform: function(){
var
rotationDegs = this.transformSettings.rotation % 360,
translateX = window.parseInt(this.transformSettings.translateX, 10),
translateY = window.parseInt(this.transformSettings.translateY, 10),
transform = 'scale(' + this.transformSettings.scale + ') rotate(' + rotationDegs + 'deg) translate(' + translateX + 'px, ' + translateY + 'px)';
Util.DOM.setStyle(this.transformEl, {
webkitTransform: transform,
MozTransform: transform,
msTransform: transform,
transform: transform
});
Util.Events.fire(this, {
target: this,
type: PhotoSwipe.ZoomPanRotate.EventTypes.onTransform,
scale: this.transformSettings.scale,
rotation: this.transformSettings.rotation,
rotationDegs: rotationDegs,
translateX: translateX,
translateY: translateY
});
}
});
}
(
window,
window.klass,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, Util){
Util.registerNamespace('Code.PhotoSwipe');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.CssClasses = {
buildingBody: 'ps-building',
activeBody: 'ps-active'
};
PhotoSwipe.EventTypes = {
onBeforeShow: 'PhotoSwipeOnBeforeShow',
onShow: 'PhotoSwipeOnShow',
onBeforeHide: 'PhotoSwipeOnBeforeHide',
onHide: 'PhotoSwipeOnHide',
onDisplayImage: 'PhotoSwipeOnDisplayImage',
onResetPosition: 'PhotoSwipeOnResetPosition',
onSlideshowStart: 'PhotoSwipeOnSlideshowStart',
onSlideshowStop: 'PhotoSwipeOnSlideshowStop',
onTouch: 'PhotoSwipeOnTouch',
onBeforeCaptionAndToolbarShow: 'PhotoSwipeOnBeforeCaptionAndToolbarShow',
onCaptionAndToolbarShow: 'PhotoSwipeOnCaptionAndToolbarShow',
onBeforeCaptionAndToolbarHide: 'PhotoSwipeOnBeforeCaptionAndToolbarHide',
onCaptionAndToolbarHide: 'PhotoSwipeOnCaptionAndToolbarHide',
onToolbarTap: 'PhotoSwipeOnToolbarTap',
onBeforeZoomPanRotateShow: 'PhotoSwipeOnBeforeZoomPanRotateShow',
onZoomPanRotateShow: 'PhotoSwipeOnZoomPanRotateShow',
onBeforeZoomPanRotateHide: 'PhotoSwipeOnBeforeZoomPanRotateHide',
onZoomPanRotateHide: 'PhotoSwipeOnZoomPanRotateHide',
onZoomPanRotateTransform: 'PhotoSwipeOnZoomPanRotateTransform'
};
PhotoSwipe.instances = [];
PhotoSwipe.activeInstances = [];
/*
* Function: Code.PhotoSwipe.setActivateInstance
*/
PhotoSwipe.setActivateInstance = function(instance){
// Can only have one instance per target (i.e. window or div)
var index = Util.arrayIndexOf(instance.settings.target, PhotoSwipe.activeInstances, 'target');
if (index > -1){
throw 'Code.PhotoSwipe.activateInstance: Unable to active instance as another instance is already active for this target';
}
PhotoSwipe.activeInstances.push({
target: instance.settings.target,
instance: instance
});
};
/*
* Function: Code.PhotoSwipe.unsetActivateInstance
*/
PhotoSwipe.unsetActivateInstance = function(instance){
var index = Util.arrayIndexOf(instance, PhotoSwipe.activeInstances, 'instance');
PhotoSwipe.activeInstances.splice(index, 1);
};
/*
* Function: Code.PhotoSwipe.attach
*/
PhotoSwipe.attach = function(images, options, id){
var i, j, instance, image;
instance = PhotoSwipe.createInstance(images, options, id);
// Add click event handlers if applicable
for (i=0, j=images.length; i<j; i++){
image = images[i];
if (!Util.isNothing(image.nodeType)){
if (image.nodeType === 1){
// DOM element
image.__photoSwipeClickHandler = PhotoSwipe.onTriggerElementClick.bind(instance);
Util.Events.remove(image, 'click', image.__photoSwipeClickHandler);
Util.Events.add(image, 'click', image.__photoSwipeClickHandler);
}
}
}
return instance;
};
/*
* jQuery plugin
*/
if (window.jQuery){
window.jQuery.fn.photoSwipe = function(options, id){
return PhotoSwipe.attach(this, options, id);
};
}
/*
* Function: Code.PhotoSwipe.detatch
*/
PhotoSwipe.detatch = function(instance){
var i, j, image;
// Remove click event handlers if applicable
for (i=0, j=instance.originalImages.length; i<j; i++){
image = instance.originalImages[i];
if (!Util.isNothing(image.nodeType)){
if (image.nodeType === 1){
// DOM element
Util.Events.remove(image, 'click', image.__photoSwipeClickHandler);
delete image.__photoSwipeClickHandler;
}
}
}
PhotoSwipe.disposeInstance(instance);
};
/*
* Function: Code.PhotoSwipe.createInstance
*/
PhotoSwipe.createInstance = function(images, options, id){
var i, instance, image;
if (Util.isNothing(images)){
throw 'Code.PhotoSwipe.attach: No images passed.';
}
if (!Util.isLikeArray(images)){
throw 'Code.PhotoSwipe.createInstance: Images must be an array of elements or image urls.';
}
if (images.length < 1){
throw 'Code.PhotoSwipe.createInstance: No images to passed.';
}
options = Util.coalesce(options, { });
instance = PhotoSwipe.getInstance(id);
if (Util.isNothing(instance)){
instance = new PhotoSwipe.PhotoSwipeClass(images, options, id);
PhotoSwipe.instances.push(instance);
}
else{
throw 'Code.PhotoSwipe.createInstance: Instance with id "' + id +' already exists."';
}
return instance;
};
/*
* Function: Code.PhotoSwipe.disposeInstance
*/
PhotoSwipe.disposeInstance = function(instance){
var instanceIndex = PhotoSwipe.getInstanceIndex(instance);
if (instanceIndex < 0){
throw 'Code.PhotoSwipe.disposeInstance: Unable to find instance to dispose.';
}
instance.dispose();
PhotoSwipe.instances.splice(instanceIndex, 1);
instance = null;
console.log(PhotoSwipe.activeInstances);
};
/*
* Function: onTriggerElementClick
*/
PhotoSwipe.onTriggerElementClick = function(e){
e.preventDefault();
var instance = this;
instance.show(e.currentTarget);
};
/*
* Function: Code.PhotoSwipe.getInstance
*/
PhotoSwipe.getInstance = function(id){
var i, j, instance;
for (i=0, j=PhotoSwipe.instances.length; i<j; i++){
instance = PhotoSwipe.instances[i];
if (instance.id === id){
return instance;
}
}
return null;
};
/*
* Function: Code.PhotoSwipe.getInstanceIndex
*/
PhotoSwipe.getInstanceIndex = function(instance){
var i, j, instanceIndex = -1;
for (i=0, j=PhotoSwipe.instances.length; i<j; i++){
if (PhotoSwipe.instances[i] === instance){
instanceIndex = i;
break;
}
}
return instanceIndex;
};
}
(
window,
window.Code.Util
));// Copyright (c) 2011 by Code Computerlove (http://www.codecomputerlove.com)
// Licensed under the MIT license
// version: 3.0.4
(function(window, klass, Util, Cache, DocumentOverlay, Carousel, Toolbar, UILayer, ZoomPanRotate){
Util.registerNamespace('Code.PhotoSwipe');
var PhotoSwipe = window.Code.PhotoSwipe;
PhotoSwipe.PhotoSwipeClass = klass({
id: null,
settings: null,
isBackEventSupported: null,
backButtonClicked: null,
currentIndex: null,
originalImages: null,
mouseWheelStartTime: null,
windowDimensions: null,
// Components
cache: null,
documentOverlay: null,
carousel: null,
uiLayer: null,
toolbar: null,
zoomPanRotate: null,
// Handlers
windowOrientationChangeHandler: null,
windowScrollHandler: null,
windowHashChangeHandler: null,
keyDownHandler: null,
windowOrientationEventName: null,
uiLayerTouchHandler: null,
carouselSlideByEndHandler: null,
carouselSlideshowStartHandler: null,
carouselSlideshowStopHandler: null,
toolbarTapHandler: null,
toolbarBeforeShowHandler: null,
toolbarShowHandler: null,
toolbarBeforeHideHandler: null,
toolbarHideHandler: null,
mouseWheelHandler: null,
zoomPanRotateTransformHandler: null,
_isResettingPosition: null,
_uiWebViewResetPositionTimeout: null,
/*
* Function: dispose
*/
dispose: function(){
var prop;
Util.Events.remove(this, PhotoSwipe.EventTypes.onBeforeShow);
Util.Events.remove(this, PhotoSwipe.EventTypes.onShow);
Util.Events.remove(this, PhotoSwipe.EventTypes.onBeforeHide);
Util.Events.remove(this, PhotoSwipe.EventTypes.onHide);
Util.Events.remove(this, PhotoSwipe.EventTypes.onDisplayImage);
Util.Events.remove(this, PhotoSwipe.EventTypes.onResetPosition);
Util.Events.remove(this, PhotoSwipe.EventTypes.onSlideshowStart);
Util.Events.remove(this, PhotoSwipe.EventTypes.onSlideshowStop);
Util.Events.remove(this, PhotoSwipe.EventTypes.onTouch);
Util.Events.remove(this, PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow);
Util.Events.remove(this, PhotoSwipe.EventTypes.onCaptionAndToolbarShow);
Util.Events.remove(this, PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide);
Util.Events.remove(this, PhotoSwipe.EventTypes.onCaptionAndToolbarHide);
Util.Events.remove(this, PhotoSwipe.EventTypes.onZoomPanRotateTransform);
this.removeEventHandlers();
if (!Util.isNothing(this.documentOverlay)){
this.documentOverlay.dispose();
}
if (!Util.isNothing(this.carousel)){
this.carousel.dispose();
}
if (!Util.isNothing(this.uiLayer)){
this.uiLayer.dispose();
}
if (!Util.isNothing(this.toolbar)){
this.toolbar.dispose();
}
this.destroyZoomPanRotate();
if (!Util.isNothing(this.cache)){
this.cache.dispose();
}
for (prop in this) {
if (Util.objectHasProperty(this, prop)) {
this[prop] = null;
}
}
},
/*
* Function: initialize
*/
initialize: function(images, options, id){
var targetPosition;
if (Util.isNothing(id)){
this.id = 'PhotoSwipe' + new Date().getTime().toString();
}
else{
this.id = id;
}
this.originalImages = images;
if (Util.Browser.android){
if (window.navigator.userAgent.match(/Android (\d+.\d+)/).toString().replace(/^.*\,/, '') >= 2.1){
this.isBackEventSupported = true;
}
}
if (!this.isBackEventSupported){
this.isBackEventSupported = Util.objectHasProperty(window, 'onhashchange');
}
this.settings = {
// General
fadeInSpeed: 250,
fadeOutSpeed: 250,
preventHide: false,
preventSlideshow: false,
zIndex: 1000,
backButtonHideEnabled: true,
enableKeyboard: true,
enableMouseWheel: true,
mouseWheelSpeed: 350,
autoStartSlideshow: false,
jQueryMobile: ( !Util.isNothing(window.jQuery) && !Util.isNothing(window.jQuery.mobile) ),
jQueryMobileDialogHash: '&ui-state=dialog',
enableUIWebViewRepositionTimeout: false,
uiWebViewResetPositionDelay: 500,
target: window,
preventDefaultTouchEvents: true,
// Carousel
loop: true,
slideSpeed: 250,
nextPreviousSlideSpeed: 0,
enableDrag: true,
swipeThreshold: 50,
swipeTimeThreshold: 250,
slideTimingFunction: 'ease-out',
slideshowDelay: 3000,
doubleTapSpeed: 250,
margin: 20,
imageScaleMethod: 'fit', // Either "fit", "fitNoUpscale" or "zoom",
// Toolbar
captionAndToolbarHide: false,
captionAndToolbarFlipPosition: false,
captionAndToolbarAutoHideDelay: 5000,
captionAndToolbarOpacity: 0.8,
captionAndToolbarShowEmptyCaptions: true,
getToolbar: PhotoSwipe.Toolbar.getToolbar,
// ZoomPanRotate
allowUserZoom: true,
allowRotationOnUserZoom: false,
maxUserZoom: 5.0,
minUserZoom: 0.5,
doubleTapZoomLevel: 2.5,
// Cache
getImageSource: PhotoSwipe.Cache.Functions.getImageSource,
getImageCaption: PhotoSwipe.Cache.Functions.getImageCaption,
getImageMetaData: PhotoSwipe.Cache.Functions.getImageMetaData,
cacheMode: PhotoSwipe.Cache.Mode.normal
};
Util.extend(this.settings, options);
if (this.settings.target !== window){
targetPosition = Util.DOM.getStyle(this.settings.target, 'position');
if (targetPosition !== 'relative' || targetPosition !== 'absolute'){
Util.DOM.setStyle(this.settings.target, 'position', 'relative');
}
}
if (this.settings.target !== window){
this.isBackEventSupported = false;
this.settings.backButtonHideEnabled = false;
}
else{
if (this.settings.preventHide){
this.settings.backButtonHideEnabled = false;
}
}
this.cache = new Cache.CacheClass(images, this.settings);
},
/*
* Function: show
*/
show: function(obj){
var i, j;
this._isResettingPosition = false;
this.backButtonClicked = false;
// Work out what the starting index is
if (Util.isNumber(obj)){
this.currentIndex = obj;
}
else{
this.currentIndex = -1;
for (i=0, j=this.originalImages.length; i<j; i++){
if (this.originalImages[i] === obj){
this.currentIndex = i;
break;
}
}
}
if (this.currentIndex < 0 || this.currentIndex > this.originalImages.length-1){
throw "Code.PhotoSwipe.PhotoSwipeClass.show: Starting index out of range";
}
// Store a reference to the current window dimensions
// Use this later to double check that a window has actually
// been resized.
this.isAlreadyGettingPage = this.getWindowDimensions();
// Set this instance to be the active instance
PhotoSwipe.setActivateInstance(this);
this.windowDimensions = this.getWindowDimensions();
// Create components
if (this.settings.target === window){
Util.DOM.addClass(window.document.body, PhotoSwipe.CssClasses.buildingBody);
}
else{
Util.DOM.addClass(this.settings.target, PhotoSwipe.CssClasses.buildingBody);
}
this.createComponents();
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onBeforeShow,
target: this
});
// Fade in the document overlay
this.documentOverlay.fadeIn(this.settings.fadeInSpeed, this.onDocumentOverlayFadeIn.bind(this));
},
/*
* Function: getWindowDimensions
*/
getWindowDimensions: function(){
return {
width: Util.DOM.windowWidth(),
height: Util.DOM.windowHeight()
};
},
/*
* Function: createComponents
*/
createComponents: function(){
this.documentOverlay = new DocumentOverlay.DocumentOverlayClass(this.settings);
this.carousel = new Carousel.CarouselClass(this.cache, this.settings);
this.uiLayer = new UILayer.UILayerClass(this.settings);
if (!this.settings.captionAndToolbarHide){
this.toolbar = new Toolbar.ToolbarClass(this.cache, this.settings);
}
},
/*
* Function: resetPosition
*/
resetPosition: function(){
if (this._isResettingPosition){
return;
}
var newWindowDimensions = this.getWindowDimensions();
if (!Util.isNothing(this.windowDimensions)){
if (newWindowDimensions.width === this.windowDimensions.width && newWindowDimensions.height === this.windowDimensions.height){
// This was added as a fudge for iOS
return;
}
}
this._isResettingPosition = true;
this.windowDimensions = newWindowDimensions;
this.destroyZoomPanRotate();
this.documentOverlay.resetPosition();
this.carousel.resetPosition();
if (!Util.isNothing(this.toolbar)){
this.toolbar.resetPosition();
}
this.uiLayer.resetPosition();
this._isResettingPosition = false;
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onResetPosition,
target: this
});
},
/*
* Function: addEventHandler
*/
addEventHandler: function(type, handler){
Util.Events.add(this, type, handler);
},
/*
* Function: addEventHandlers
*/
addEventHandlers: function(){
if (Util.isNothing(this.windowOrientationChangeHandler)){
this.windowOrientationChangeHandler = this.onWindowOrientationChange.bind(this);
this.windowScrollHandler = this.onWindowScroll.bind(this);
this.keyDownHandler = this.onKeyDown.bind(this);
this.windowHashChangeHandler = this.onWindowHashChange.bind(this);
this.uiLayerTouchHandler = this.onUILayerTouch.bind(this);
this.carouselSlideByEndHandler = this.onCarouselSlideByEnd.bind(this);
this.carouselSlideshowStartHandler = this.onCarouselSlideshowStart.bind(this);
this.carouselSlideshowStopHandler = this.onCarouselSlideshowStop.bind(this);
this.toolbarTapHandler = this.onToolbarTap.bind(this);
this.toolbarBeforeShowHandler = this.onToolbarBeforeShow.bind(this);
this.toolbarShowHandler = this.onToolbarShow.bind(this);
this.toolbarBeforeHideHandler = this.onToolbarBeforeHide.bind(this);
this.toolbarHideHandler = this.onToolbarHide.bind(this);
this.mouseWheelHandler = this.onMouseWheel.bind(this);
this.zoomPanRotateTransformHandler = this.onZoomPanRotateTransform.bind(this);
}
// Set window handlers
if (Util.Browser.android){
// For some reason, resize was more stable than orientationchange in Android
this.orientationEventName = 'resize';
}
else if (Util.Browser.iOS && (!Util.Browser.safari)){
Util.Events.add(window.document.body, 'orientationchange', this.windowOrientationChangeHandler);
}
else{
var supportsOrientationChange = !Util.isNothing(window.onorientationchange);
this.orientationEventName = supportsOrientationChange ? 'orientationchange' : 'resize';
}
if (!Util.isNothing(this.orientationEventName)){
Util.Events.add(window, this.orientationEventName, this.windowOrientationChangeHandler);
}
if (this.settings.target === window){
Util.Events.add(window, 'scroll', this.windowScrollHandler);
}
if (this.settings.enableKeyboard){
Util.Events.add(window.document, 'keydown', this.keyDownHandler);
}
if (this.isBackEventSupported && this.settings.backButtonHideEnabled){
this.windowHashChangeHandler = this.onWindowHashChange.bind(this);
if (this.settings.jQueryMobile){
window.location.hash = this.settings.jQueryMobileDialogHash;
}
else{
this.currentHistoryHashValue = 'PhotoSwipe' + new Date().getTime().toString();
window.location.hash = this.currentHistoryHashValue;
}
Util.Events.add(window, 'hashchange', this.windowHashChangeHandler);
}
if (this.settings.enableMouseWheel){
Util.Events.add(window, 'mousewheel', this.mouseWheelHandler);
}
Util.Events.add(this.uiLayer, Util.TouchElement.EventTypes.onTouch, this.uiLayerTouchHandler);
Util.Events.add(this.carousel, Carousel.EventTypes.onSlideByEnd, this.carouselSlideByEndHandler);
Util.Events.add(this.carousel, Carousel.EventTypes.onSlideshowStart, this.carouselSlideshowStartHandler);
Util.Events.add(this.carousel, Carousel.EventTypes.onSlideshowStop, this.carouselSlideshowStopHandler);
if (!Util.isNothing(this.toolbar)){
Util.Events.add(this.toolbar, Toolbar.EventTypes.onTap, this.toolbarTapHandler);
Util.Events.add(this.toolbar, Toolbar.EventTypes.onBeforeShow, this.toolbarBeforeShowHandler);
Util.Events.add(this.toolbar, Toolbar.EventTypes.onShow, this.toolbarShowHandler);
Util.Events.add(this.toolbar, Toolbar.EventTypes.onBeforeHide, this.toolbarBeforeHideHandler);
Util.Events.add(this.toolbar, Toolbar.EventTypes.onHide, this.toolbarHideHandler);
}
},
/*
* Function: removeEventHandlers
*/
removeEventHandlers: function(){
if (Util.Browser.iOS && (!Util.Browser.safari)){
Util.Events.remove(window.document.body, 'orientationchange', this.windowOrientationChangeHandler);
}
if (!Util.isNothing(this.orientationEventName)){
Util.Events.remove(window, this.orientationEventName, this.windowOrientationChangeHandler);
}
Util.Events.remove(window, 'scroll', this.windowScrollHandler);
if (this.settings.enableKeyboard){
Util.Events.remove(window.document, 'keydown', this.keyDownHandler);
}
if (this.isBackEventSupported && this.settings.backButtonHideEnabled){
Util.Events.remove(window, 'hashchange', this.windowHashChangeHandler);
}
if (this.settings.enableMouseWheel){
Util.Events.remove(window, 'mousewheel', this.mouseWheelHandler);
}
if (!Util.isNothing(this.uiLayer)){
Util.Events.remove(this.uiLayer, Util.TouchElement.EventTypes.onTouch, this.uiLayerTouchHandler);
}
if (!Util.isNothing(this.toolbar)){
Util.Events.remove(this.carousel, Carousel.EventTypes.onSlideByEnd, this.carouselSlideByEndHandler);
Util.Events.remove(this.carousel, Carousel.EventTypes.onSlideshowStart, this.carouselSlideshowStartHandler);
Util.Events.remove(this.carousel, Carousel.EventTypes.onSlideshowStop, this.carouselSlideshowStopHandler);
}
if (!Util.isNothing(this.toolbar)){
Util.Events.remove(this.toolbar, Toolbar.EventTypes.onTap, this.toolbarTapHandler);
Util.Events.remove(this.toolbar, Toolbar.EventTypes.onBeforeShow, this.toolbarBeforeShowHandler);
Util.Events.remove(this.toolbar, Toolbar.EventTypes.onShow, this.toolbarShowHandler);
Util.Events.remove(this.toolbar, Toolbar.EventTypes.onBeforeHide, this.toolbarBeforeHideHandler);
Util.Events.remove(this.toolbar, Toolbar.EventTypes.onHide, this.toolbarHideHandler);
}
},
/*
* Function: hide
*/
hide: function(){
if (this.settings.preventHide){
return;
}
if (Util.isNothing(this.documentOverlay)){
throw "Code.PhotoSwipe.PhotoSwipeClass.hide: PhotoSwipe instance is already hidden";
}
if (!Util.isNothing(this.hiding)){
return;
}
this.clearUIWebViewResetPositionTimeout();
this.destroyZoomPanRotate();
this.removeEventHandlers();
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onBeforeHide,
target: this
});
this.uiLayer.dispose();
this.uiLayer = null;
if (!Util.isNothing(this.toolbar)){
this.toolbar.dispose();
this.toolbar = null;
}
this.carousel.dispose();
this.carousel = null;
Util.DOM.removeClass(window.document.body, PhotoSwipe.CssClasses.activeBody);
this.documentOverlay.dispose();
this.documentOverlay = null;
this._isResettingPosition = false;
// Deactive this instance
PhotoSwipe.unsetActivateInstance(this);
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onHide,
target: this
});
this.goBackInHistory();
},
/*
* Function: goBackInHistory
*/
goBackInHistory: function(){
if (this.isBackEventSupported && this.settings.backButtonHideEnabled){
if ( !this.backButtonClicked ){
window.history.back();
}
}
},
/*
* Function: play
*/
play: function(){
if (this.isZoomActive()){
return;
}
if (!this.settings.preventSlideshow){
if (!Util.isNothing(this.carousel)){
if (!Util.isNothing(this.toolbar) && this.toolbar.isVisible){
this.toolbar.fadeOut();
}
this.carousel.startSlideshow();
}
}
},
/*
* Function: stop
*/
stop: function(){
if (this.isZoomActive()){
return;
}
if (!Util.isNothing(this.carousel)){
this.carousel.stopSlideshow();
}
},
/*
* Function: previous
*/
previous: function(){
if (this.isZoomActive()){
return;
}
if (!Util.isNothing(this.carousel)){
this.carousel.previous();
}
},
/*
* Function: next
*/
next: function(){
if (this.isZoomActive()){
return;
}
if (!Util.isNothing(this.carousel)){
this.carousel.next();
}
},
/*
* Function: toggleToolbar
*/
toggleToolbar: function(){
if (this.isZoomActive()){
return;
}
if (!Util.isNothing(this.toolbar)){
this.toolbar.toggleVisibility(this.currentIndex);
}
},
/*
* Function: fadeOutToolbarIfVisible
*/
fadeOutToolbarIfVisible: function(){
if (!Util.isNothing(this.toolbar) && this.toolbar.isVisible && this.settings.captionAndToolbarAutoHideDelay > 0){
this.toolbar.fadeOut();
}
},
/*
* Function: createZoomPanRotate
*/
createZoomPanRotate: function(){
this.stop();
if (this.canUserZoom() && !this.isZoomActive()){
Util.Events.fire(this, PhotoSwipe.EventTypes.onBeforeZoomPanRotateShow);
this.zoomPanRotate = new ZoomPanRotate.ZoomPanRotateClass(
this.settings,
this.cache.images[this.currentIndex],
this.uiLayer
);
// If we don't override this in the event of false
// you will be unable to pan around a zoomed image effectively
this.uiLayer.captureSettings.preventDefaultTouchEvents = true;
Util.Events.add(this.zoomPanRotate, PhotoSwipe.ZoomPanRotate.EventTypes.onTransform, this.zoomPanRotateTransformHandler);
Util.Events.fire(this, PhotoSwipe.EventTypes.onZoomPanRotateShow);
if (!Util.isNothing(this.toolbar) && this.toolbar.isVisible){
this.toolbar.fadeOut();
}
}
},
/*
* Function: destroyZoomPanRotate
*/
destroyZoomPanRotate: function(){
if (!Util.isNothing(this.zoomPanRotate)){
Util.Events.fire(this, PhotoSwipe.EventTypes.onBeforeZoomPanRotateHide);
Util.Events.remove(this.zoomPanRotate, PhotoSwipe.ZoomPanRotate.EventTypes.onTransform, this.zoomPanRotateTransformHandler);
this.zoomPanRotate.dispose();
this.zoomPanRotate = null;
// Set the preventDefaultTouchEvents back to it was
this.uiLayer.captureSettings.preventDefaultTouchEvents = this.settings.preventDefaultTouchEvents;
Util.Events.fire(this, PhotoSwipe.EventTypes.onZoomPanRotateHide);
}
},
/*
* Function: canUserZoom
*/
canUserZoom: function(){
var testEl, cacheImage;
if (Util.Browser.msie){
testEl = document.createElement('div');
if (Util.isNothing(testEl.style.msTransform)){
return false;
}
}
else if (!Util.Browser.isCSSTransformSupported){
return false;
}
if (!this.settings.allowUserZoom){
return false;
}
if (this.carousel.isSliding){
return false;
}
cacheImage = this.cache.images[this.currentIndex];
if (Util.isNothing(cacheImage)){
return false;
}
if (cacheImage.isLoading){
return false;
}
return true;
},
/*
* Function: isZoomActive
*/
isZoomActive: function(){
return (!Util.isNothing(this.zoomPanRotate));
},
/*
* Function: getCurrentImage
*/
getCurrentImage: function(){
return this.cache.images[this.currentIndex];
},
/*
* Function: onDocumentOverlayFadeIn
*/
onDocumentOverlayFadeIn: function(e){
window.setTimeout(function(){
var el = (this.settings.target === window) ? window.document.body : this.settings.target;
Util.DOM.removeClass(el, PhotoSwipe.CssClasses.buildingBody);
Util.DOM.addClass(el, PhotoSwipe.CssClasses.activeBody);
this.addEventHandlers();
this.carousel.show(this.currentIndex);
this.uiLayer.show();
if (this.settings.autoStartSlideshow){
this.play();
}
else if (!Util.isNothing(this.toolbar)){
this.toolbar.show(this.currentIndex);
}
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onShow,
target: this
});
this.setUIWebViewResetPositionTimeout();
}.bind(this), 250);
},
/*
* Function: setUIWebViewResetPositionTimeout
*/
setUIWebViewResetPositionTimeout: function(){
if (!this.settings.enableUIWebViewRepositionTimeout){
return;
}
if (!(Util.Browser.iOS && (!Util.Browser.safari))){
return;
}
if (!Util.isNothing(this._uiWebViewResetPositionTimeout)){
window.clearTimeout(this._uiWebViewResetPositionTimeout);
}
this._uiWebViewResetPositionTimeout = window.setTimeout(function(){
this.resetPosition();
this.setUIWebViewResetPositionTimeout();
}.bind(this), this.settings.uiWebViewResetPositionDelay);
},
/*
* Function: clearUIWebViewResetPositionTimeout
*/
clearUIWebViewResetPositionTimeout: function(){
if (!Util.isNothing(this._uiWebViewResetPositionTimeout)){
window.clearTimeout(this._uiWebViewResetPositionTimeout);
}
},
/*
* Function: onWindowScroll
*/
onWindowScroll: function(e){
this.resetPosition();
},
/*
* Function: onWindowOrientationChange
*/
onWindowOrientationChange: 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: onKeyDown
*/
onKeyDown: function(e){
if (e.keyCode === 37) { // Left
e.preventDefault();
this.previous();
}
else if (e.keyCode === 39) { // Right
e.preventDefault();
this.next();
}
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.toggleToolbar();
}
else{
this.hide();
}
e.preventDefault();
}
else if (e.keyCode === 13) { // Enter
e.preventDefault();
this.play();
}
},
/*
* Function: onUILayerTouch
*/
onUILayerTouch: function(e){
if (this.isZoomActive()){
switch (e.action){
case Util.TouchElement.ActionTypes.gestureChange:
this.zoomPanRotate.zoomRotate(e.scale, (this.settings.allowRotationOnUserZoom) ? e.rotation : 0);
break;
case Util.TouchElement.ActionTypes.gestureEnd:
this.zoomPanRotate.setStartingScaleAndRotation(e.scale, (this.settings.allowRotationOnUserZoom) ? e.rotation : 0);
break;
case Util.TouchElement.ActionTypes.touchStart:
this.zoomPanRotate.panStart(e.point);
break;
case Util.TouchElement.ActionTypes.touchMove:
this.zoomPanRotate.pan(e.point);
break;
case Util.TouchElement.ActionTypes.doubleTap:
this.destroyZoomPanRotate();
this.toggleToolbar();
break;
case Util.TouchElement.ActionTypes.swipeLeft:
this.destroyZoomPanRotate();
this.next();
this.toggleToolbar();
break;
case Util.TouchElement.ActionTypes.swipeRight:
this.destroyZoomPanRotate();
this.previous();
this.toggleToolbar();
break;
}
}
else{
switch (e.action){
case Util.TouchElement.ActionTypes.touchMove:
case Util.TouchElement.ActionTypes.swipeLeft:
case Util.TouchElement.ActionTypes.swipeRight:
// Hide the toolbar if need be
this.fadeOutToolbarIfVisible();
// Pass the touch onto the carousel
this.carousel.onTouch(e.action, e.point);
break;
case Util.TouchElement.ActionTypes.touchStart:
case Util.TouchElement.ActionTypes.touchMoveEnd:
// Pass the touch onto the carousel
this.carousel.onTouch(e.action, e.point);
break;
case Util.TouchElement.ActionTypes.tap:
this.toggleToolbar();
break;
case Util.TouchElement.ActionTypes.doubleTap:
// Take into consideration the window scroll
if (this.settings.target === window){
e.point.x -= Util.DOM.windowScrollLeft();
e.point.y -= Util.DOM.windowScrollTop();
}
// Just make sure that if the user clicks out of the image
// that the image does not pan out of view!
var
cacheImageEl = this.cache.images[this.currentIndex].imageEl,
imageTop = window.parseInt(Util.DOM.getStyle(cacheImageEl, 'top'), 10),
imageLeft = window.parseInt(Util.DOM.getStyle(cacheImageEl, 'left'), 10),
imageRight = imageLeft + Util.DOM.width(cacheImageEl),
imageBottom = imageTop + Util.DOM.height(cacheImageEl);
if (e.point.x < imageLeft){
e.point.x = imageLeft;
}
else if (e.point.x > imageRight){
e.point.x = imageRight;
}
if (e.point.y < imageTop){
e.point.y = imageTop;
}
else if (e.point.y > imageBottom){
e.point.y = imageBottom;
}
this.createZoomPanRotate();
if (this.isZoomActive()){
this.zoomPanRotate.zoomAndPanToPoint(this.settings.doubleTapZoomLevel, e.point);
}
break;
case Util.TouchElement.ActionTypes.gestureStart:
this.createZoomPanRotate();
break;
}
}
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onTouch,
target: this,
point: e.point,
action: e.action
});
},
/*
* Function: onCarouselSlideByEnd
*/
onCarouselSlideByEnd: function(e){
this.currentIndex = e.cacheIndex;
if (!Util.isNothing(this.toolbar)){
this.toolbar.setCaption(this.currentIndex);
this.toolbar.setToolbarStatus(this.currentIndex);
}
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onDisplayImage,
target: this,
action: e.action,
index: e.cacheIndex
});
},
/*
* Function: onToolbarTap
*/
onToolbarTap: function(e){
switch(e.action){
case Toolbar.ToolbarAction.next:
this.next();
break;
case Toolbar.ToolbarAction.previous:
this.previous();
break;
case Toolbar.ToolbarAction.close:
this.hide();
break;
case Toolbar.ToolbarAction.play:
this.play();
break;
}
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onToolbarTap,
target: this,
toolbarAction: e.action,
tapTarget: e.tapTarget
});
},
/*
* Function: onMouseWheel
*/
onMouseWheel: function(e){
var
delta = Util.Events.getWheelDelta(e),
dt = e.timeStamp - (this.mouseWheelStartTime || 0);
if (dt < this.settings.mouseWheelSpeed) {
return;
}
this.mouseWheelStartTime = e.timeStamp;
if (this.settings.invertMouseWheel){
delta = delta * -1;
}
if (delta < 0){
this.next();
}
else if (delta > 0){
this.previous();
}
},
/*
* Function: onCarouselSlideshowStart
*/
onCarouselSlideshowStart: function(e){
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onSlideshowStart,
target: this
});
},
/*
* Function: onCarouselSlideshowStop
*/
onCarouselSlideshowStop: function(e){
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onSlideshowStop,
target: this
});
},
/*
* Function: onToolbarBeforeShow
*/
onToolbarBeforeShow: function(e){
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarShow,
target: this
});
},
/*
* Function: onToolbarShow
*/
onToolbarShow: function(e){
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onCaptionAndToolbarShow,
target: this
});
},
/*
* Function: onToolbarBeforeHide
*/
onToolbarBeforeHide: function(e){
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onBeforeCaptionAndToolbarHide,
target: this
});
},
/*
* Function: onToolbarHide
*/
onToolbarHide: function(e){
Util.Events.fire(this, {
type: PhotoSwipe.EventTypes.onCaptionAndToolbarHide,
target: this
});
},
/*
* Function: onZoomPanRotateTransform
*/
onZoomPanRotateTransform: function(e){
Util.Events.fire(this, {
target: this,
type: PhotoSwipe.EventTypes.onZoomPanRotateTransform,
scale: e.scale,
rotation: e.rotation,
rotationDegs: e.rotationDegs,
translateX: e.translateX,
translateY: e.translateY
});
}
});
}
(
window,
window.klass,
window.Code.Util,
window.Code.PhotoSwipe.Cache,
window.Code.PhotoSwipe.DocumentOverlay,
window.Code.PhotoSwipe.Carousel,
window.Code.PhotoSwipe.Toolbar,
window.Code.PhotoSwipe.UILayer,
window.Code.PhotoSwipe.ZoomPanRotate
));
/*
* jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2011 Happyworm Ltd
* Dual licensed under the MIT and GPL licenses.
* - http://www.opensource.org/licenses/mit-license.php
* - http://www.gnu.org/copyleft/gpl.html
*
* Author: Mark J Panaghiston
* Version: 2.1.0
* Date: 1st September 2011
*/
(function(b,f){b.fn.jPlayer=function(a){var c=typeof a==="string",d=Array.prototype.slice.call(arguments,1),e=this,a=!c&&d.length?b.extend.apply(null,[!0,a].concat(d)):a;if(c&&a.charAt(0)==="_")return e;c?this.each(function(){var c=b.data(this,"jPlayer"),h=c&&b.isFunction(c[a])?c[a].apply(c,d):c;if(h!==c&&h!==f)return e=h,!1}):this.each(function(){var c=b.data(this,"jPlayer");c?c.option(a||{}):b.data(this,"jPlayer",new b.jPlayer(a,this))});return e};b.jPlayer=function(a,c){if(arguments.length){this.element=
b(c);this.options=b.extend(!0,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};b.jPlayer.emulateMethods="load play pause";b.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";b.jPlayer.emulateOptions="muted volume";b.jPlayer.reservedEvent="ready flashreset resize repeat error warning";b.jPlayer.event={ready:"jPlayer_ready",flashreset:"jPlayer_flashreset",resize:"jPlayer_resize",repeat:"jPlayer_repeat",
click:"jPlayer_click",error:"jPlayer_error",warning:"jPlayer_warning",loadstart:"jPlayer_loadstart",progress:"jPlayer_progress",suspend:"jPlayer_suspend",abort:"jPlayer_abort",emptied:"jPlayer_emptied",stalled:"jPlayer_stalled",play:"jPlayer_play",pause:"jPlayer_pause",loadedmetadata:"jPlayer_loadedmetadata",loadeddata:"jPlayer_loadeddata",waiting:"jPlayer_waiting",playing:"jPlayer_playing",canplay:"jPlayer_canplay",canplaythrough:"jPlayer_canplaythrough",seeking:"jPlayer_seeking",seeked:"jPlayer_seeked",
timeupdate:"jPlayer_timeupdate",ended:"jPlayer_ended",ratechange:"jPlayer_ratechange",durationchange:"jPlayer_durationchange",volumechange:"jPlayer_volumechange"};b.jPlayer.htmlEvent="loadstart,abort,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,ratechange".split(",");b.jPlayer.pause=function(){b.each(b.jPlayer.prototype.instances,function(a,b){b.data("jPlayer").status.srcSet&&b.jPlayer("pause")})};b.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,
sepHour:":",sepMin:":",sepSec:""};b.jPlayer.convertTime=function(a){var c=new Date(a*1E3),d=c.getUTCHours(),a=c.getUTCMinutes(),c=c.getUTCSeconds(),d=b.jPlayer.timeFormat.padHour&&d<10?"0"+d:d,a=b.jPlayer.timeFormat.padMin&&a<10?"0"+a:a,c=b.jPlayer.timeFormat.padSec&&c<10?"0"+c:c;return(b.jPlayer.timeFormat.showHour?d+b.jPlayer.timeFormat.sepHour:"")+(b.jPlayer.timeFormat.showMin?a+b.jPlayer.timeFormat.sepMin:"")+(b.jPlayer.timeFormat.showSec?c+b.jPlayer.timeFormat.sepSec:"")};b.jPlayer.uaBrowser=
function(a){var a=a.toLowerCase(),b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,e=/(mozilla)(?:.*? rv:([\w.]+))?/,a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||a.indexOf("compatible")<0&&e.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};b.jPlayer.uaPlatform=function(a){var b=a.toLowerCase(),d=/(android)/,e=/(mobile)/,a=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(b)||[],b=/(ipad|playbook)/.exec(b)||!e.exec(b)&&d.exec(b)||[];a[1]&&(a[1]=a[1].replace(/\s/g,
"_"));return{platform:a[1]||"",tablet:b[1]||""}};b.jPlayer.browser={};b.jPlayer.platform={};var i=b.jPlayer.uaBrowser(navigator.userAgent);if(i.browser)b.jPlayer.browser[i.browser]=!0,b.jPlayer.browser.version=i.version;i=b.jPlayer.uaPlatform(navigator.userAgent);if(i.platform)b.jPlayer.platform[i.platform]=!0,b.jPlayer.platform.mobile=!i.tablet,b.jPlayer.platform.tablet=!!i.tablet;b.jPlayer.prototype={count:0,version:{script:"2.1.0",needFlash:"2.1.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",
supplied:"mp3",preload:"metadata",volume:0.8,muted:!1,wmode:"opaque",backgroundColor:"#ebeef5000",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen",
repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",noSolution:".jp-no-solution"},fullScreen:!1,autohide:{restored:!1,full:!0,fadeIn:200,fadeOut:600,hold:1E3},loop:!1,repeat:function(a){a.jPlayer.options.loop?b(this).unbind(".jPlayerRepeat").bind(b.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){b(this).jPlayer("play")}):b(this).unbind(".jPlayerRepeat")},nativeVideoControls:{},noFullScreen:{msie:/msie [0-6]/,ipad:/ipad.*?os [0-4]/,iphone:/iphone/,ipod:/ipod/,android_pad:/android [0-3](?!.*?mobile)/,
android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,webos:/webos/,playbook:/playbook/},verticalVolume:!1,idPrefix:"jp",noConflict:"jQuery",emulateHtml:!1,errorAlerts:!1,warningAlerts:!1},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}},
optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:!0,format:{},formatType:"",waitForPlay:!0,waitForLoad:!0,srcSet:!1,video:!1,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,readyState:0,networkState:0,playbackRate:1,ended:0},internal:{ready:!1},solution:{html:!0,flash:!0},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:!0,
media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:!0,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:!1,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:!1,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:!1,media:"audio"},fla:{codec:"audio/x-flv",flashCanPlay:!0,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:!0,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:!1,
media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:!1,media:"video"},flv:{codec:"video/x-flv",flashCanPlay:!0,media:"video"}},_init:function(){var a=this;this.element.empty();this.status=b.extend({},this.status);this.internal=b.extend({},this.internal);this.internal.domNode=this.element.get(0);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css={};this.css.cs={};this.css.jq={};this.ancestorJq=
[];this.options.volume=this._limitValue(this.options.volume,0,1);b.each(this.options.supplied.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.format[e]){var f=!1;b.each(a.formats,function(a,b){if(e===b)return f=!0,!1});f||a.formats.push(e)}});b.each(this.options.solution.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.solution[e]){var f=!1;b.each(a.solutions,function(a,b){if(e===b)return f=!0,!1});f||a.solutions.push(e)}});this.internal.instance=
"jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")||this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=b.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=b.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:f});this.internal.video=b.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:f});this.internal.flash=b.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:f,swf:this.options.swfPath+
(this.options.swfPath.toLowerCase().slice(-4)!==".swf"?(this.options.swfPath&&this.options.swfPath.slice(-1)!=="/"?"/":"")+"Jplayer.swf":"")});this.internal.poster=b.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:f});b.each(b.jPlayer.event,function(b,c){a.options[b]!==f&&(a.element.bind(c+".jPlayer",a.options[b]),a.options[b]=f)});this.require.audio=!1;this.require.video=!1;b.each(this.formats,function(b,c){a.require[a.format[c].media]=!0});this.options=this.require.video?b.extend(!0,
{},this.optionsVideo,this.options):b.extend(!0,{},this.optionsAudio,this.options);this._setSize();this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullScreen=this._uaBlocklist(this.options.noFullScreen);this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._restrictNativeVideoControls();this.htmlElement.poster=document.createElement("img");this.htmlElement.poster.id=this.internal.poster.id;this.htmlElement.poster.onload=function(){(!a.status.video||
a.status.waitForPlay)&&a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=b("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.internal.poster.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)});this.html.audio.available=!1;if(this.require.audio)this.htmlElement.audio=document.createElement("audio"),this.htmlElement.audio.id=this.internal.audio.id,
this.html.audio.available=!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio);this.html.video.available=!1;if(this.require.video)this.htmlElement.video=document.createElement("video"),this.htmlElement.video.id=this.internal.video.id,this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video);this.flash.available=this._checkForFlash(10);this.html.canPlay={};this.flash.canPlay={};b.each(this.formats,function(b,c){a.html.canPlay[c]=
a.html[a.format[c].media].available&&""!==a.htmlElement[a.format[c].media].canPlayType(a.format[c].codec);a.flash.canPlay[c]=a.format[c].flashCanPlay&&a.flash.available});this.html.desired=!1;this.flash.desired=!1;b.each(this.solutions,function(c,d){if(c===0)a[d].desired=!0;else{var e=!1,f=!1;b.each(a.formats,function(b,c){a[a.solutions[0]].canPlay[c]&&(a.format[c].media==="video"?f=!0:e=!0)});a[d].desired=a.require.audio&&!e||a.require.video&&!f}});this.html.support={};this.flash.support={};b.each(this.formats,
function(b,c){a.html.support[c]=a.html.canPlay[c]&&a.html.desired;a.flash.support[c]=a.flash.canPlay[c]&&a.flash.desired});this.html.used=!1;this.flash.used=!1;b.each(this.solutions,function(c,d){b.each(a.formats,function(b,c){if(a[d].support[c])return a[d].used=!0,!1})});this._resetActive();this._resetGate();this._cssSelectorAncestor(this.options.cssSelectorAncestor);!this.html.used&&!this.flash.used?(this._error({type:b.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+
this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SOLUTION,hint:b.jPlayer.errorHint.NO_SOLUTION}),this.css.jq.noSolution.length&&this.css.jq.noSolution.show()):this.css.jq.noSolution.length&&this.css.jq.noSolution.hide();if(this.flash.used){var c,d="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+"&muted="+this.options.muted;if(b.browser.msie&&Number(b.browser.version)<=8){d=['<param name="movie" value="'+this.internal.flash.swf+
'" />','<param name="FlashVars" value="'+d+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'];c=document.createElement('<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0"></object>');for(var e=0;e<d.length;e++)c.appendChild(document.createElement(d[e]))}else e=function(a,b,c){var d=document.createElement("param");
d.setAttribute("name",b);d.setAttribute("value",c);a.appendChild(d)},c=document.createElement("object"),c.setAttribute("id",this.internal.flash.id),c.setAttribute("data",this.internal.flash.swf),c.setAttribute("type","application/x-shockwave-flash"),c.setAttribute("width","1"),c.setAttribute("height","1"),e(c,"flashvars",d),e(c,"allowscriptaccess","always"),e(c,"bgcolor",this.options.backgroundColor),e(c,"wmode",this.options.wmode);this.element.append(c);this.internal.flash.jq=b(c)}if(this.html.used){if(this.html.audio.available)this._addHtmlEventListeners(this.htmlElement.audio,
this.html.audio),this.element.append(this.htmlElement.audio),this.internal.audio.jq=b("#"+this.internal.audio.id);if(this.html.video.available)this._addHtmlEventListeners(this.htmlElement.video,this.html.video),this.element.append(this.htmlElement.video),this.internal.video.jq=b("#"+this.internal.video.id),this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):this.internal.video.jq.css({width:"0px",height:"0px"}),this.internal.video.jq.bind("click.jPlayer",
function(){a._trigger(b.jPlayer.event.click)})}this.options.emulateHtml&&this._emulateHtmlBridge();this.html.used&&!this.flash.used&&setTimeout(function(){a.internal.ready=!0;a.version.flash="n/a";a._trigger(b.jPlayer.event.repeat);a._trigger(b.jPlayer.event.ready)},100);this._updateNativeVideoControls();this._updateInterface();this._updateButtons(!1);this._updateAutohide();this._updateVolume(this.options.volume);this._updateMute(this.options.muted);this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();
b.jPlayer.prototype.count++},destroy:function(){this.clearMedia();this._removeUiClass();this.css.jq.currentTime.length&&this.css.jq.currentTime.text("");this.css.jq.duration.length&&this.css.jq.duration.text("");b.each(this.css.jq,function(a,b){b.length&&b.unbind(".jPlayer")});this.internal.poster.jq.unbind(".jPlayer");this.internal.video.jq&&this.internal.video.jq.unbind(".jPlayer");this.options.emulateHtml&&this._destroyHtmlBridge();this.element.removeData("jPlayer");this.element.unbind(".jPlayer");
this.element.empty();delete this.instances[this.internal.instance]},enable:function(){},disable:function(){},_testCanPlayType:function(a){try{return a.canPlayType(this.format.mp3.codec),!0}catch(b){return!1}},_uaBlocklist:function(a){var c=navigator.userAgent.toLowerCase(),d=!1;b.each(a,function(a,b){if(b&&b.test(c))return d=!0,!1});return d},_restrictNativeVideoControls:function(){if(this.require.audio&&this.status.nativeVideoControls)this.status.nativeVideoControls=!1,this.status.noFullScreen=!0},
_updateNativeVideoControls:function(){if(this.html.video.available&&this.html.used)this.htmlElement.video.controls=this.status.nativeVideoControls,this._updateAutohide(),this.status.nativeVideoControls&&this.require.video?(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})):this.status.waitForPlay&&this.status.video&&(this.internal.poster.jq.show(),this.internal.video.jq.css({width:"0px",height:"0px"}))},_addHtmlEventListeners:function(a,
c){var d=this;a.preload=this.options.preload;a.muted=this.options.muted;a.volume=this.options.volume;a.addEventListener("progress",function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.progress))},!1);a.addEventListener("timeupdate",function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.timeupdate))},!1);a.addEventListener("durationchange",function(){if(c.gate)d.status.duration=this.duration,d._getHtmlStatus(a),d._updateInterface(),
d._trigger(b.jPlayer.event.durationchange)},!1);a.addEventListener("play",function(){c.gate&&(d._updateButtons(!0),d._html_checkWaitForPlay(),d._trigger(b.jPlayer.event.play))},!1);a.addEventListener("playing",function(){c.gate&&(d._updateButtons(!0),d._seeked(),d._trigger(b.jPlayer.event.playing))},!1);a.addEventListener("pause",function(){c.gate&&(d._updateButtons(!1),d._trigger(b.jPlayer.event.pause))},!1);a.addEventListener("waiting",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.waiting))},
!1);a.addEventListener("seeking",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.seeking))},!1);a.addEventListener("seeked",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.seeked))},!1);a.addEventListener("volumechange",function(){if(c.gate)d.options.volume=a.volume,d.options.muted=a.muted,d._updateMute(),d._updateVolume(),d._trigger(b.jPlayer.event.volumechange)},!1);a.addEventListener("suspend",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.suspend))},!1);a.addEventListener("ended",
function(){if(c.gate){if(!b.jPlayer.browser.webkit)d.htmlElement.media.currentTime=0;d.htmlElement.media.pause();d._updateButtons(!1);d._getHtmlStatus(a,!0);d._updateInterface();d._trigger(b.jPlayer.event.ended)}},!1);a.addEventListener("error",function(){if(c.gate&&(d._updateButtons(!1),d._seeked(),d.status.srcSet))clearTimeout(d.internal.htmlDlyCmdId),d.status.waitForLoad=!0,d.status.waitForPlay=!0,d.status.video&&!d.status.nativeVideoControls&&d.internal.video.jq.css({width:"0px",height:"0px"}),
d._validString(d.status.media.poster)&&!d.status.nativeVideoControls&&d.internal.poster.jq.show(),d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show(),d._error({type:b.jPlayer.error.URL,context:d.status.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL})},!1);b.each(b.jPlayer.htmlEvent,function(e,g){a.addEventListener(this,function(){c.gate&&d._trigger(b.jPlayer.event[g])},!1)})},_getHtmlStatus:function(a,b){var d=0,e=0,g=0,f=0;if(a.duration)this.status.duration=a.duration;d=a.currentTime;
e=this.status.duration>0?100*d/this.status.duration:0;typeof a.seekable==="object"&&a.seekable.length>0?(g=this.status.duration>0?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100,f=100*a.currentTime/a.seekable.end(a.seekable.length-1)):(g=100,f=e);b&&(e=f=d=0);this.status.seekPercent=g;this.status.currentPercentRelative=f;this.status.currentPercentAbsolute=e;this.status.currentTime=d;this.status.readyState=a.readyState;this.status.networkState=a.networkState;this.status.playbackRate=
a.playbackRate;this.status.ended=a.ended},_resetStatus:function(){this.status=b.extend({},this.status,b.jPlayer.prototype.status)},_trigger:function(a,c,d){a=b.Event(a);a.jPlayer={};a.jPlayer.version=b.extend({},this.version);a.jPlayer.options=b.extend(!0,{},this.options);a.jPlayer.status=b.extend(!0,{},this.status);a.jPlayer.html=b.extend(!0,{},this.html);a.jPlayer.flash=b.extend(!0,{},this.flash);if(c)a.jPlayer.error=b.extend({},c);if(d)a.jPlayer.warning=b.extend({},d);this.element.trigger(a)},
jPlayerFlashEvent:function(a,c){if(a===b.jPlayer.event.ready)if(this.internal.ready){if(this.flash.gate){if(this.status.srcSet){var d=this.status.currentTime,e=this.status.paused;this.setMedia(this.status.media);d>0&&(e?this.pause(d):this.play(d))}this._trigger(b.jPlayer.event.flashreset)}}else this.internal.ready=!0,this.internal.flash.jq.css({width:"0px",height:"0px"}),this.version.flash=c.version,this.version.needFlash!==this.version.flash&&this._error({type:b.jPlayer.error.VERSION,context:this.version.flash,
message:b.jPlayer.errorMsg.VERSION+this.version.flash,hint:b.jPlayer.errorHint.VERSION}),this._trigger(b.jPlayer.event.repeat),this._trigger(a);if(this.flash.gate)switch(a){case b.jPlayer.event.progress:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.timeupdate:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.play:this._seeked();this._updateButtons(!0);this._trigger(a);break;case b.jPlayer.event.pause:this._updateButtons(!1);
this._trigger(a);break;case b.jPlayer.event.ended:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.click:this._trigger(a);break;case b.jPlayer.event.error:this.status.waitForLoad=!0;this.status.waitForPlay=!0;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.status.video&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media):
this._flash_setAudio(this.status.media);this._updateButtons(!1);this._error({type:b.jPlayer.error.URL,context:c.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL});break;case b.jPlayer.event.seeking:this._seeking();this._trigger(a);break;case b.jPlayer.event.seeked:this._seeked();this._trigger(a);break;case b.jPlayer.event.ready:break;default:this._trigger(a)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;
this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration;this.status.readyState=4;this.status.networkState=0;this.status.playbackRate=1;this.status.ended=!1},_updateButtons:function(a){if(a!==f)this.status.paused=!a,this.css.jq.play.length&&this.css.jq.pause.length&&(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide()));this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&&
(this.status.noFullScreen?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullScreen?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide()));this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+
"%");this.css.jq.playBar.length&&this.css.jq.playBar.width(this.status.currentPercentRelative+"%");this.css.jq.currentTime.length&&this.css.jq.currentTime.text(b.jPlayer.convertTime(this.status.currentTime));this.css.jq.duration.length&&this.css.jq.duration.text(b.jPlayer.convertTime(this.status.duration))},_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")},
_resetGate:function(){this.html.audio.gate=!1;this.html.video.gate=!1;this.flash.gate=!1},_resetActive:function(){this.html.active=!1;this.flash.active=!1},setMedia:function(a){var c=this,d=!1,e=this.status.media.poster!==a.poster;this._resetMedia();this._resetGate();this._resetActive();b.each(this.formats,function(e,f){var i=c.format[f].media==="video";b.each(c.solutions,function(b,e){if(c[e].support[f]&&c._validString(a[f])){var g=e==="html";i?(g?(c.html.video.gate=!0,c._html_setVideo(a),c.html.active=
!0):(c.flash.gate=!0,c._flash_setVideo(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.show(),c.status.video=!0):(g?(c.html.audio.gate=!0,c._html_setAudio(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setAudio(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1);d=!0;return!1}});if(d)return!1});if(d){if((!this.status.nativeVideoControls||!this.html.video.gate)&&this._validString(a.poster))e?this.htmlElement.poster.src=a.poster:this.internal.poster.jq.show();
this.status.srcSet=!0;this.status.media=b.extend({},a);this._updateButtons(!1);this._updateInterface()}else this._error({type:b.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SUPPORT,hint:b.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus();this._updateButtons(!1);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);this.html.active?this._html_resetMedia():this.flash.active&&
this._flash_resetMedia()},clearMedia:function(){this._resetMedia();this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia();this._resetGate();this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},play:function(a){a=typeof a==="number"?a:NaN;this.status.srcSet?this.html.active?this._html_play(a):this.flash.active&&this._flash_play(a):this._urlNotSetError("play")},videoPlay:function(){this.play()},
pause:function(a){a=typeof a==="number"?a:NaN;this.status.srcSet?this.html.active?this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},pauseOthers:function(){var a=this;b.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&&this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);
this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.options.muted=a;this.html.used&&this._html_mute(a);this.flash.used&&this._flash_mute(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateMute(a),this._updateVolume(this.options.volume),this._trigger(b.jPlayer.event.volumechange))},mute:function(a){a=a===f?!0:!!a;this._muted(a)},unmute:function(a){a=a===f?!0:!!a;this._muted(!a)},_updateMute:function(a){if(a===
f)a=this.options.muted;this.css.jq.mute.length&&this.css.jq.unmute.length&&(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){a=this._limitValue(a,0,1);this.options.volume=a;this.html.used&&this._html_volume(a);this.flash.used&&this._flash_volume(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateVolume(a),this._trigger(b.jPlayer.event.volumechange))},
volumeBar:function(a){if(this.css.jq.volumeBar.length){var b=this.css.jq.volumeBar.offset(),d=a.pageX-b.left,e=this.css.jq.volumeBar.width(),a=this.css.jq.volumeBar.height()-a.pageY+b.top,b=this.css.jq.volumeBar.height();this.options.verticalVolume?this.volume(a/b):this.volume(d/e)}this.options.muted&&this._muted(!1)},volumeBarValue:function(a){this.volumeBar(a)},_updateVolume:function(a){if(a===f)a=this.options.volume;a=this.options.muted?0:a;this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),
this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](a*100+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1);this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(a){var c=
this;this.options.cssSelectorAncestor=a;this._removeUiClass();this.ancestorJq=a?b(a):[];a&&this.ancestorJq.length!==1&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT});this._addUiClass();b.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)})},_cssSelector:function(a,c){var d=this;typeof c==="string"?b.jPlayer.prototype.options.cssSelector[a]?
(this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer"),this.options.cssSelector[a]=c,this.css.cs[a]=this.options.cssSelectorAncestor+" "+c,this.css.jq[a]=c?b(this.css.cs[a]):[],this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(c){d[a](c);b(this).blur();return!1}),c&&this.css.jq[a].length!==1&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",
hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:b.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_STRING,context:c,message:b.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:b.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar){var b=this.css.jq.seekBar.offset(),a=a.pageX-b.left,b=this.css.jq.seekBar.width();
this.playHead(100*a/b)}},playBar:function(a){this.seekBar(a)},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(a){if(this.options.loop!==a)this.options.loop=a,this._updateButtons(),this._trigger(b.jPlayer.event.repeat)},currentTime:function(){},duration:function(){},gui:function(){},noSolution:function(){},option:function(a,c){var d=a;if(arguments.length===0)return b.extend(!0,{},this.options);if(typeof a==="string"){var e=a.split(".");if(c===f){for(var d=b.extend(!0,
{},this.options),g=0;g<e.length;g++)if(d[e[g]]!==f)d=d[e[g]];else return this._warning({type:b.jPlayer.warning.OPTION_KEY,context:a,message:b.jPlayer.warningMsg.OPTION_KEY,hint:b.jPlayer.warningHint.OPTION_KEY}),f;return d}for(var g=d={},h=0;h<e.length;h++)h<e.length-1?(g[e[h]]={},g=g[e[h]]):g[e[h]]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,c){var d=this;switch(a){case "volume":this.volume(c);
break;case "muted":this._muted(c);break;case "cssSelectorAncestor":this._cssSelectorAncestor(c);break;case "cssSelector":b.each(c,function(a,b){d._cssSelector(a,b)});break;case "fullScreen":this.options[a]!==c&&(this._removeUiClass(),this.options[a]=c,this._refreshSize());break;case "size":!this.options.fullScreen&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]=b.extend({},this.options[a],c);this._refreshSize();break;case "sizeFull":this.options.fullScreen&&this.options[a].cssClass!==
c.cssClass&&this._removeUiClass();this.options[a]=b.extend({},this.options[a],c);this._refreshSize();break;case "autohide":this.options[a]=b.extend({},this.options[a],c);this._updateAutohide();break;case "loop":this._loop(c);break;case "nativeVideoControls":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this._restrictNativeVideoControls();this._updateNativeVideoControls();break;case "noFullScreen":this.options[a]=
b.extend({},this.options[a],c);this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullScreen=this._uaBlocklist(this.options.noFullScreen);this._restrictNativeVideoControls();this._updateButtons();break;case "noVolume":this.options[a]=b.extend({},this.options[a],c);this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._updateVolume();this._updateMute();break;case "emulateHtml":this.options[a]!==c&&((this.options[a]=c)?this._emulateHtmlBridge():
this._destroyHtmlBridge())}return this},_refreshSize:function(){this._setSize();this._addUiClass();this._updateSize();this._updateButtons();this._updateAutohide();this._trigger(b.jPlayer.event.resize)},_setSize:function(){this.options.fullScreen?(this.status.width=this.options.sizeFull.width,this.status.height=this.options.sizeFull.height,this.status.cssClass=this.options.sizeFull.cssClass):(this.status.width=this.options.size.width,this.status.height=this.options.size.height,this.status.cssClass=
this.options.size.cssClass);this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){this.ancestorJq.length&&this.ancestorJq.addClass(this.status.cssClass)},_removeUiClass:function(){this.ancestorJq.length&&this.ancestorJq.removeClass(this.status.cssClass)},_updateSize:function(){this.internal.poster.jq.css({width:this.status.width,height:this.status.height});!this.status.waitForPlay&&this.html.active&&this.status.video||this.html.video.available&&this.html.used&&
this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):!this.status.waitForPlay&&this.flash.active&&this.status.video&&this.internal.flash.jq.css({width:this.status.width,height:this.status.height})},_updateAutohide:function(){var a=this,b=function(){a.css.jq.gui.fadeIn(a.options.autohide.fadeIn,function(){clearTimeout(a.internal.autohideId);a.internal.autohideId=setTimeout(function(){a.css.jq.gui.fadeOut(a.options.autohide.fadeOut)},a.options.autohide.hold)})};
this.css.jq.gui.length&&(this.css.jq.gui.stop(!0,!0),clearTimeout(this.internal.autohideId),this.element.unbind(".jPlayerAutohide"),this.css.jq.gui.unbind(".jPlayerAutohide"),this.status.nativeVideoControls?this.css.jq.gui.hide():this.options.fullScreen&&this.options.autohide.full||!this.options.fullScreen&&this.options.autohide.restored?(this.element.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.hide()):this.css.jq.gui.show())},
fullScreen:function(){this._setOption("fullScreen",!0)},restoreScreen:function(){this._setOption("fullScreen",!1)},_html_initMedia:function(){this.htmlElement.media.src=this.status.src;this.options.preload!=="none"&&this._html_load();this._trigger(b.jPlayer.event.timeupdate)},_html_setAudio:function(a){var c=this;b.each(this.formats,function(b,e){if(c.html.support[e]&&a[e])return c.status.src=a[e],c.status.format[e]=!0,c.status.formatType=e,!1});this.htmlElement.media=this.htmlElement.audio;this._html_initMedia()},
_html_setVideo:function(a){var c=this;b.each(this.formats,function(b,e){if(c.html.support[e]&&a[e])return c.status.src=a[e],c.status.format[e]=!0,c.status.formatType=e,!1});if(this.status.nativeVideoControls)this.htmlElement.video.poster=this._validString(a.poster)?a.poster:"";this.htmlElement.media=this.htmlElement.video;this._html_initMedia()},_html_resetMedia:function(){this.htmlElement.media&&(this.htmlElement.media.id===this.internal.video.id&&!this.status.nativeVideoControls&&this.internal.video.jq.css({width:"0px",
height:"0px"}),this.htmlElement.media.pause())},_html_clearMedia:function(){if(this.htmlElement.media)this.htmlElement.media.src="",this.htmlElement.media.load()},_html_load:function(){if(this.status.waitForLoad)this.status.waitForLoad=!1,this.htmlElement.media.load();clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this;this._html_load();this.htmlElement.media.play();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},
100);return}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this;a>0?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);this.htmlElement.media.pause();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},100);return}a>0&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this;this._html_load();try{if(typeof this.htmlElement.media.seekable==="object"&&this.htmlElement.media.seekable.length>0)this.htmlElement.media.currentTime=
a*this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1)/100;else if(this.htmlElement.media.duration>0&&!isNaN(this.htmlElement.media.duration))this.htmlElement.media.currentTime=a*this.htmlElement.media.duration/100;else throw"e";}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},100);return}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){if(this.status.waitForPlay)this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&
this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height}))},_html_volume:function(a){if(this.html.audio.available)this.htmlElement.audio.volume=a;if(this.html.video.available)this.htmlElement.video.volume=a},_html_mute:function(a){if(this.html.audio.available)this.htmlElement.audio.muted=a;if(this.html.video.available)this.htmlElement.video.muted=a},_flash_setAudio:function(a){var c=this;try{if(b.each(this.formats,
function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4a":case "fla":c._getMovie().fl_setAudio_m4a(a[d]);break;case "mp3":c._getMovie().fl_setAudio_mp3(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),this.options.preload==="auto")this._flash_load(),this.status.waitForLoad=!1}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var c=this;try{if(b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4v":case "flv":c._getMovie().fl_setVideo_m4v(a[d])}c.status.src=
a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),this.options.preload==="auto")this._flash_load(),this.status.waitForLoad=!1}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",height:"0px"});this._flash_pause(NaN)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=
!1;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}if(a>0)this.status.waitForLoad=!1,this._flash_checkWaitForPlay()},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){if(this.status.waitForPlay)this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&
(this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height}))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_checkForFlash:function(a){var b=!1,d;if(window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+a),b=!0}catch(e){}else navigator.plugins&&
navigator.mimeTypes.length>0&&(d=navigator.plugins["Shockwave Flash"])&&navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")>=a&&(b=!0);return b},_validString:function(a){return a&&typeof a==="string"},_limitValue:function(a,b,d){return a<b?b:a>d?d:a},_urlNotSetError:function(a){this._error({type:b.jPlayer.error.URL_NOT_SET,context:a,message:b.jPlayer.errorMsg.URL_NOT_SET,hint:b.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){var c;c=this.internal.ready?"FLASH_DISABLED":
"FLASH";this._error({type:b.jPlayer.error[c],context:this.internal.flash.swf,message:b.jPlayer.errorMsg[c]+a.message,hint:b.jPlayer.errorHint[c]});this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(a){this._trigger(b.jPlayer.event.error,a);this.options.errorAlerts&&this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(b.jPlayer.event.warning,f,a);this.options.warningAlerts&&this._alert("Warning!"+
(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)},_emulateHtmlBridge:function(){var a=this;b.each(b.jPlayer.emulateMethods.split(/\s+/g),function(b,d){a.internal.domNode[d]=function(b){a[d](b)}});b.each(b.jPlayer.event,function(c,d){var e=!0;b.each(b.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1});e&&a.element.bind(d+".jPlayer.jPlayerHtml",
function(){a._emulateHtmlUpdate();var b=document.createEvent("Event");b.initEvent(c,!1,!0);a.internal.domNode.dispatchEvent(b)})})},_emulateHtmlUpdate:function(){var a=this;b.each(b.jPlayer.emulateStatus.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.status[d]});b.each(b.jPlayer.emulateOptions.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.options[d]})},_destroyHtmlBridge:function(){var a=this;this.element.unbind(".jPlayerHtml");b.each((b.jPlayer.emulateMethods+" "+b.jPlayer.emulateStatus+
" "+b.jPlayer.emulateOptions).split(/\s+/g),function(b,d){delete a.internal.domNode[d]})}};b.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};b.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",
NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+b.jPlayer.prototype.version.script+" needs Jplayer.swf version "+b.jPlayer.prototype.version.needFlash+" but found "};b.jPlayer.errorHint=
{FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};b.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",
CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};b.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."};b.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",
CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}})(jQuery);(function(a,b){$window=a(b);a.fn.lazyload=function(c){var d={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:true,appear:null,load:null};if(c){if(undefined!==c.failurelimit){c.failure_limit=c.failurelimit;delete c.failurelimit}if(undefined!==c.effectspeed){c.effect_speed=c.effectspeed;delete c.effectspeed}a.extend(d,c)}var e=this;if(0==d.event.indexOf("scroll")){a(d.container).bind(d.event,function(b){var c=0;e.each(function(){$this=a(this);if(d.skip_invisible&&!$this.is(":visible"))return;if(a.abovethetop(this,d)||a.leftofbegin(this,d)){}else if(!a.belowthefold(this,d)&&!a.rightoffold(this,d)){$this.trigger("appear")}else{if(++c>d.failure_limit){return false}}})})}this.each(function(){var b=this;var c=a(b);b.loaded=false;c.one("appear",function(){if(!this.loaded&&c.attr("data-original")!=""){if(d.appear){var f=e.length;d.appear.call(b,f,d)}a("<img />").bind("load",function(){c.hide().attr("src",c.data(d.data_attribute))[d.effect](d.effect_speed);b.loaded=true;var f=a.grep(e,function(a){return!a.loaded});e=a(f);if(d.load){var g=e.length;d.load.call(b,g,d)}}).attr("src",c.data(d.data_attribute));c.attr("data-original","")}});if(0!=d.event.indexOf("scroll")){c.bind(d.event,function(a){if(!b.loaded){c.trigger("appear")}})}});$window.bind("resize",function(b){a(d.container).trigger(d.event)});a(d.container).trigger(d.event);return this};a.belowthefold=function(c,d){if(d.container===undefined||d.container===b){var e=$window.height()+$window.scrollTop()}else{var e=a(d.container).offset().top+a(d.container).height()}return e<=a(c).offset().top-d.threshold};a.rightoffold=function(c,d){if(d.container===undefined||d.container===b){var e=$window.width()+$window.scrollLeft()}else{var e=a(d.container).offset().left+a(d.container).width()}return e<=a(c).offset().left-d.threshold};a.abovethetop=function(c,d){if(d.container===undefined||d.container===b){var e=$window.scrollTop()}else{var e=a(d.container).offset().top}return e>=a(c).offset().top+d.threshold+a(c).height()};a.leftofbegin=function(c,d){if(d.container===undefined||d.container===b){var e=$window.scrollLeft()}else{var e=a(d.container).offset().left}return e>=a(c).offset().left+d.threshold+a(c).width()};a.inviewport=function(b,c){return!a.rightofscreen(b,c)&&!a.leftofscreen(b,c)&&!a.belowthefold(b,c)&&!a.abovethetop(b,c)};a.extend(a.expr[":"],{"below-the-fold":function(c){return a.belowthefold(c,{threshold:0,container:b})},"above-the-top":function(c){return!a.belowthefold(c,{threshold:0,container:b})},"right-of-screen":function(c){return a.rightoffold(c,{threshold:0,container:b})},"left-of-screen":function(c){return!a.rightoffold(c,{threshold:0,container:b})},"in-viewport":function(c){return!a.inviewport(c,{threshold:0,container:b})},"above-the-fold":function(c){return!a.belowthefold(c,{threshold:0,container:b})},"right-of-fold":function(c){return a.rightoffold(c,{threshold:0,container:b})},"left-of-fold":function(c){return!a.rightoffold(c,{threshold:0,container:b})}})})(jQuery,window);/*
* jQuery Mobile Framework : plugin to provide a simple popup (modal) or jQMdialog (page) Dialog widget.
* Copyright (c) JTSage
* CC 3.0 Attribution. May be relicensed without permission/notifcation.
* https://github.com/jtsage/jquery-mobile-simpledialog
*/
(function(a,b){a.widget("mobile.simpledialog",a.mobile.widget,{options:{version:"1.0.1-2012020100",pickPageTheme:"b",pickPageInputTheme:"e",pickPageButtonTheme:"a",fullScreen:false,fullScreenAlways:false,disabled:false,zindex:"500",width:"280px",prompt:"Are you sure?",mode:"bool",allowReopen:true,useModal:true,forceInput:true,isOpen:false,blankMode:false,fullHTML:null,subTitle:false,inputPassword:false,cleanOnClose:false,animate:true,transition:"pop",clickEvent:"click",left:b,top:b,useDialogForceTrue:false,useDialogForceFalse:false,useDialog:false,isInit:false,sawOnce:false,enterToTrigger:0,escToTrigger:1,butObj:[],debug:false,selects:false,selectparent:[],onCreated:null,onOpened:null,onClosed:null,onShown:null},_eventHandler:function(c,e){var d=a(this).data("simpledialog"),f=d.options;if(!c.isPropagationStopped()){switch(e.method){case"close":d.close(e.fromCloseButton);break;case"open":d.open();break;case"refresh":d.refresh();break;case"button":f.butObj[e.index].trigger(f.clickEvent);break}}},_orientChange:function(h){var l=a(h.currentTarget).data("simpledialog"),c=l.options,d=a.mobile.activePage.width(),f=a(window).scrollTop(),i=a(window).height(),m=l.pickerContent.outerHeight(),j=l.pickerContent.innerWidth(),g=(parseFloat(c.top)+10000)?parseFloat(c.top):(f+(i/2)-(m/2)),k=(parseFloat(c.left)+10000)?parseFloat(c.left):((d/2)-(j/2));if((m+g)>a(document).height()){g=a(document).height()-(m+2)}if(g<45){g=45}h.stopPropagation();if(!l.pickerContent.is(":visible")||c.useDialog===true){return false}else{l.pickerContent.css({top:g,left:k})}},open:function(){if(this.pickPage.is(":visible")){return false}var l=this,c=this.options,d=a.mobile.activePage.width(),f=a(window).scrollTop(),i=a(window).height(),m=l.pickerContent.outerHeight(),j=l.pickerContent.innerWidth(),e=a(window).scrollTop(),h=a(window).scrollLeft(),g=(parseFloat(c.top)+10000)?parseFloat(c.top):(f+(i/2)-(m/2)),k=(parseFloat(c.left)+10000)?parseFloat(c.left):((d/2)-(j/2));if((m+g)>a(document).height()){g=a(document).height()-(m+2)}if(g<45){g=45}if(c.prompt!==false){l.pickerHeader.html(c.prompt);l.pickPage.find(".ui-header").find(".ui-title").text(c.prompt)}l.pickerContent.find(".ui-btn-active").removeClass("ui-btn-active");if(c.mode==="blank"){l.pickerContent.delegate('[rel="close"]',c.clickEvent,function(){l.close()})}if(!c.disabled){if((d>400&&!c.useDialogForceTrue)||c.useDialogForceFalse||c.fullScreen){c.useDialog=false;if(c.fullScreen===false){if(c.useModal===true){if(c.animate===true){l.screen.fadeIn("slow")}else{l.screen.show()}}else{l.screen.removeClass("ui-simpledialog-hidden")}}if(c.mode==="blank"){c.selects=l.pickPage.find(".ui-selectmenu");c.selects.each(function(){c.selectparent.push(a(this).closest(".ui-dialog"));a(this).appendTo(l.thisPage)})}l.pickerContent.addClass("ui-overlay-shadow").css("zIndex",l.options.zindex);l.pickerHeader.show();if(c.fullScreenAlways||(c.fullScreen&&d<400)){l.pickerContent.css({border:"0px !important",position:"absolute",top:e,left:h,height:i,width:d,maxWidth:d}).addClass("ui-overlay-shadow in").removeClass("ui-simpledialog-hidden")}else{l.pickerContent.css({position:"absolute",top:g,left:k}).addClass("ui-overlay-shadow in").removeClass("ui-simpledialog-hidden")}}else{l.thisPage.unbind("pagehide.remove");c.useDialog=true;l.pickPageContent.append(l.pickerContent);l.pickerHeader.hide();l.pickerContent.removeClass("ui-overlay-shadow ui-simpledialog-hidden").css({top:"auto",left:"auto",marginLeft:"auto",marginRight:"auto"}).css("zIndex",l.options.zindex);a.mobile.changePage(l.pickPage,{transition:(c.animate===true)?c.transition:"none"})}this.options.isOpen=true}},close:function(c){var d=this;c=(typeof(c)==="undefined")?false:c;if(d.options.useDialog){if(c===false){a(d.pickPage).dialog("close")}if((typeof d.thisPage.jqmData("page"))!=="undefined"&&!d.thisPage.jqmData("page").options.domCache){d.thisPage.bind("pagehide.remove",function(){a(d).remove()})}d.pickerContent.addClass("ui-simpledialog-hidden");d.thisPage.append(d.pickerContent)}else{if(d.options.useModal){if(d.options.animate===true){d.screen.fadeOut("slow")}else{d.screen.hide()}}else{d.screen.addClass("ui-simpledialog-hidden")}d.pickerContent.addClass("ui-simpledialog-hidden").removeClass("in")}d.caller.removeClass("ui-btn-active");d.options.isOpen=false;if(d.options.cleanOnClose===true&&d.options.useDialog===false){d.clean()}if(d.options.onClosed&&typeof(d.options.onClosed)==="function"){d.options.onClosed(d)}},clean:function(){var c=this;if(c.options.selects!==false){c.options.selects.each(function(){a(this).remove()});a(c.options.selectparent).each(function(){a(this).remove()})}c.pickerContent.remove();c.pickPage.remove();c.screen.remove();c.caller.removeData("simpledialog")},_create:function(){var d=this,i=a.extend(this.options,this.element.data("options")),e=this.element;if(i.isInit&&i.allowReopen){d.open()}else{var h=e.closest(".ui-page"),c=a("<div data-role='dialog' class='ui-simpledialog-dialog' data-theme='"+i.pickPageTheme+"' ><div data-role='header' data-backbtn='false' data-theme='a'><div class='ui-title'>"+i.prompt+"</div></div><div data-role='content'></div></div>"),g=null,f=null;if(i.mode==="blank"){g=a("<div class='ui-simpledialog-container ui-overlay-shadow ui-corner-all ui-simpledialog-hidden "+((i.animate===true)?i.transition:"")+" ui-body-"+i.pickPageTheme+"'></div>");g.html(i.fullHTML);a("[data-role=content]",c).append(g)}c.appendTo(a.mobile.pageContainer).page().css("minHeight","0px").css("zIndex",i.zindex);if(i.animate===true){c.addClass("pop")}f=c.find(".ui-content");e.live("simpledialog",d._eventHandler);c.find(".ui-header a").bind(i.clickEvent,function(j){j.preventDefault();j.stopImmediatePropagation();d.close(true)});if(i.prompt===false){c.find(".ui-header").find(".ui-title").html(" ")}a.extend(d,{pickPage:c,thisPage:h,pickPageContent:f,screen:screen,caller:e});d._buildPage();d.options.isInit=true;a(document).bind("orientationchange",function(j){e.trigger("orientationchange")});e.bind("orientationchange",d._orientChange);if(d.options.onCreated&&typeof(d.options.onCreated)==="function"){d.options.onCreated(d)}}},_reposition:function(){var j=this,c=this.options,d=a.mobile.activePage.width(),e=a(window).scrollTop(),g=a(window).height(),k=j.pickerContent.outerHeight(),h=j.pickerContent.innerWidth(),f=(parseFloat(c.top)+10000)?parseFloat(c.top):(e+(g/2)-(k/2)),i=(parseFloat(c.left)+10000)?parseFloat(c.left):((d/2)-(h/2));if((k+f)>a(document).height()){f=a(document).height()-(k+2)}if(f<45){f=45}j.pickerContent.css({position:"absolute",width:h,top:f,left:i})},refresh:function(){if(this.options.mode!=="blank"){return false}else{this.pickerContent.css("width","auto");this.pickerContent.html(this.options.fullHTML);this.pickerContent.trigger("create");if(this.pickerContent.is(":visible")&&this.options.useDialog===false){this._reposition()}}},_init:function(){if(!this.options.sawOnce||this.options.allowReopen){this.options.sawOnce=true;this.open()}},_buildPage:function(){var f=this,h=f.options,c=null,g,e,d,j=a("<div>",{"class":"ui-simpledialog-container ui-overlay-shadow ui-corner-all ui-simpledialog-hidden "+((h.animate===true)?h.transition:"")+" ui-body-"+h.pickPageTheme}).css({zIndex:h.zindex,width:h.width}),i=a("<div class='ui-simpledialog-header'><h4></h4></div>").appendTo(j).find("h4");j.bind("webkitAnimationEnd",function(){if(f.options.onShown&&typeof(f.options.onShown)==="function"){f.options.onShown(f)}});if(h.mode!=="blank"){if(h.prompt!==false){i.html(h.prompt)}else{i.parent().html()}if(h.subTitle!==false){a("<p class='ui-simpledialog-subtitle'>"+h.subTitle+"<p>").appendTo(j)}if(h.mode==="string"){g=a("<div class='ui-simpledialog-controls'><input class='ui-simpledialog-input ui-input-text ui-shadow-inset ui-corner-all ui-body-"+h.pickPageInputTheme+"' type='"+((h.inputPassword===true)?"password":"text")+"' name='pickin' /></div>").bind("keyup",function(k){if(k.keyCode===13&&h.enterToTrigger!==false){h.butObj[h.enterToTrigger].trigger(h.clickEvent)}if(k.keyCode===27&&h.escToTrigger!==false){h.butObj[h.escToTrigger].trigger(h.clickEvent)}}).appendTo(j)}e=a("<div>",{"class":"ui-simpledialog-controls"}).appendTo(j);a.each(h.buttons,function(k,l){l=a.isFunction(l)?{click:l}:l;l=a.extend({text:k,theme:h.pickPageButtonTheme,icon:"check",iconpos:"left",closeOnClick:true},l);c=h.butObj.push(a("<a href='#'>"+k+"</a>").appendTo(e).buttonMarkup({theme:l.theme,icon:l.icon,iconpos:l.iconpos,corners:true,shadow:true}).unbind("vclick").unbind("click").bind(h.clickEvent,function(){if(h.mode==="string"){f.caller.attr("data-string",g.find("input").val())}var m=l.click.apply(f.element[0],arguments);if(m!==false&&l.closeOnClick===true){f.close()}}));if(typeof(l.id)!=="undefined"&&l.id.length>0){h.butObj[c-1].attr("id",l.id)}if(l.hidden){h.butObj[c-1].addClass("button-hidden")}if(l.insertSeparator){a("<div class='buttons-separator'>").appendTo(e)}})}else{j=f.pickPageContent.contents()}j.appendTo(f.thisPage);d=a("<div>",{"class":"ui-simpledialog-screen ui-simpledialog-hidden"}).css({"z-index":h.zindex-1}).appendTo(f.thisPage).bind(h.clickEvent,function(k){if(!h.forceInput){f.close()}k.preventDefault()});if(h.useModal){d.addClass("ui-simpledialog-screen-modal")}a.extend(f,{pickerContent:j,pickerHeader:i,screen:d})},disable:function(){this.options.disabled=true},enable:function(){this.options.disabled=false}})})(jQuery);