var quote_list = new Array(
"May All Beings be Happy", "Spread the message of world peace to all", "Embrace the path of mercy, compassion, non-violence, peace", "Although religious texts appear to be different, they embody the same ideas", "Salutations to all religious seekers, saints, religions and all organizations", "Let's make path of peace", "Today the world is frightened, terrorized and restless by the name of materialism", "I have dedicated my whole life, body and speech for suffering beings", "Human beings are unable to see beyond their religions and ideologies", "I am only showing you the way; you must seek it on your own", "Seek a righteous path and wisdom will be yours", "True love and compassion is Dharma", "Trust and have faith in everything, it will come", "What we believe is true, and what we do not – is not true", "Don’t worry, Guru is here", "Colors, religious books and things of ritual do not have even 0 percent of Dharma in them", "My tapasya (penance) of thousands of years is not only for a particular community", "Growing is not enough. You should be blossoming", "Have total faith in Guru, only then you can be helped");
var audio_list = new Array(
"o26g5p59xf", "kdamznznsm", "i29301u38a", "z9a8ac8zee", "mx8uzwr9a1", "z5t68j9nxx", "dfe4uwns7f", "xh8u8w8d8e", "18j6cy8186");
var audio_title_list = new Array(
"Anna Biela - Palden Dorje", "Anna Biela - Palden Dorje (fast version)", "Anna Biela - Om Namo Guru Buddha Gyani", "Anna Biela - Dharma Sangha", "Imee Ooi - Om Namo Guru Buddha Gyani (instrumental)", "Imee Ooi - Om Namo Guru Buddha Gyani (vocal)", "Imee Ooi - Om Namo Guru Buddha Gyani", "Palden Dorje - Om Namo Guru Buddha Gyani", "Anna Biela - Guru Is Here");
var footer_text = "Website is developed and supported on a voluntary basis. If you can help in any way – email at info@etapasvi.com Copyright © 2009-2012, www.eTapasvi.com All Rights Reserved.";
// main
var ap_stopAll = function(){};
var audioplayer = false;
// çäåñü çàïîìèíàåòñÿ ôîðìà Ïðåäëîæèòü ïåðåâîä, ÷òîáû ïîñëå ïîäãðóçêè ôîòî, å¸ âîññòàíàâëèâàòü
var page_toolbar_clone = '';
// èíòåðâàë ïîêàçà öèòàò
var rotate_quotes_interval = 15000;
// íîìåð ïîñëåäíåé ïîêàçàííîé öèòàòû
var last_quote_index = -1;
// ìèíèìàëüíûé ðàçìåð îêíà, ïðè êîòîðîì ñêðûâàþòñÿ ýëåìåíòû
var window_size_hide_el = 1000;
$(document).ready(function() {
var embedded_or_print = false;
// ñòðàíèöà âñòðîåíà
if (top !== self) {
$("body").addClass("embedded");
embedded_or_print = true;
}
// âåðñèÿ äëÿ ïå÷àòè
var hash = window.location.hash;
if (hash.substring(1) == "print_version") {
$("body").addClass("print_version");
embedded_or_print = true;
}
if (embedded_or_print) {
// ñîîáùåíèå î òîì, ÷òî ñòðàíèöà âñòðîåíà
// ïóòü áåç ïàðàìåòðîâ è õýøà
var embed_source = window.location + "";
//embed_source = embed_source.substring(0, embed_source.indexOf('#'));
//embed_source = embed_source.substring(0, embed_source.indexOf('?'));
embed_source = embed_source.replace(/([^#?]+)[#?]?.*/g, "$1");
$("#content").append('
Source: ' + embed_source + '
');
return;
}
// ñîêðûòèå ýëåìåíòîâ â çàâèñèìîñòè îò ðàçìåðà îêíà
onWindowResize();
// öèòàòû îòîáðàæàþòñÿ, åñëè åñòü ïåðåâîä è ðàçìåð îêíà áîëüøå ìèíèìàëüíîãî
if (quote_list) {
showQuotes();
}
// random audio
if (audio_list) {
var audio_index = Math.floor(Math.random( ) * (audio_list.length));
if (audio_list[ audio_index ]) {
$("#mp3").attr("title", audio_title_list[ audio_index ] );
$("#mp3 span").html( audio_list[ audio_index ] );
}
}
// custom options
$("#mp3").jmp3({
//filepath: "http://etapasvi.zxq.net/"
//filepath: "http://www.etapasvi.com/uploads/audio/",
filepath: "http://k002.kiwi6.com/uploads/hotlink/",
width: 24
});
// select language
$("span.lang_selector").colorbox({inline:true, href:"#lang_box", opacity:"0.5", transition:"none"});
// ïåðåìåùåíèå Ïðåäëîæåíèÿ ïåðåâîäà íàâåðõ
$("#page_toolbar").insertAfter( "#content h1:eq(0)" );
// òåêñò â ôóòåðå
if (footer_text) {
$("#lang_plain").after(footer_text);
}
// ñîêðûòèå ýëåìåíòîâ â çàâèñèìîñòè îò ðàçìåðà îêíà
$(window).resize(function() {
onWindowResize();
});
});
// ñîêðûòèå ýëåìåíòîâ â çàâèñèìîñòè îò ðàçìåðà îêíà
function onWindowResize()
{
if ($(window).width() < window_size_hide_el) {
$("#wrapper").css('margin', '0 auto 0 70px');
} else {
$("#wrapper").css('margin', '0 auto');
}
}
// ñêðûâàåò öèòàòó
function hideQuotes()
{
// fadeOut äëÿ ýëåìåíòà p âåøàåò IE
$("#quote_p_cont").fadeOut(600);
setTimeout( showQuotes, 700);
}
// îòîáðàæàåò ñëó÷àéíóþ öèòàòó
function showQuotes()
{
// åñëè ðàçìåð îêíà óäîâëåòâîðÿåò, ïîêàçûâàåì öèòàòó
if ($(window).width() > window_size_hide_el) {
var quote_el = $("#bubble_quote p:first");
var quote_index = Math.floor(Math.random( ) * (quote_list.length));
// åñëè âûáðàíà ïðîøëàÿ öèòàòà, áåð¸ì ïðåäûäóùóþ â ñïèñêå èëè ïîñëåäíþþ
if (quote_index == last_quote_index) {
if (quote_index > 1) {
quote_index = quote_index - 1;
} else {
quote_index = quote_list.length - 1;
}
}
last_quote_index = quote_index;
if (quote_list[ quote_index ]) {
quote_el.html( quote_list[ quote_index ]);
}
$("#quote_p_cont").fadeIn(600);
}
setTimeout( hideQuotes, rotate_quotes_interval);
}
// èñõîäíûé òåêñò ó÷åíèÿ
function showOriginal()
{
if ( $("#elOriginal").is(":hidden") ) {
$("#elOriginal").slideDown("slow");
} else {
$("#elOriginal").slideUp("slow");
}
}
// òåêñò àóäèîçàïèñè
function showAudioBody(id)
{
var element_id = "#elAudioBody" + id;
if ( $(element_id).is(":hidden") ) {
$(element_id).slideDown("slow");
} else {
$(element_id).slideUp("slow");
}
}
// ìîäèôèêàöèÿ ññûëîê äëÿ ïîäãðóçêè ñîäåðæèìîãî
function preparePhotoContent()
{
$(document).ready(function(){
var href;
$("#photo_content a.photo_content_link").each(function(index) {
href = $(this).attr('href');
href = "javascript: loadPhotoContent('" + href + "'); void(0)";
$(this).attr('href', href);
});
});
}
// ññûëêà íà òåêóùóþ ôîòîãðàôèþ
var global_photo_href;
// ïîäãðóçêà ñîäðåæèìîãî ôîòî
function loadPhotoContent(href, hide_content, domain)
{
if (!href || $("#photo_loader").is("visible")) {
return;
}
// ïîëó÷àåì äîìåí
if (!domain) {
domain = href.replace(/http:\/\/([^\/]+).*/, '$1');
}
if (!domain) {
return;
}
// äîìåí íå âêëþ÷àåòñÿ
href = href.replace(/http:\/\/[^\/]+\//, '');
if (hide_content) {
$("#photo_content .photofull").html( '
' );
$("#disqus_thread").hide();
$("#photo_content div.social").remove();
$("#photo_content .dsq-brlink").remove();
}
global_photo_href = 'http://' + domain + '/' + href;
var content_href = '/' + href.replace(/\/photo\//, '/photo/content/');
$("#photo_loader").show();
// ñîõðàíÿåì ôîðìó Ïðåäëîæèòü ïåðåâîä
$("#offer_tr").hide();
page_toolbar_clone = $("#page_toolbar").clone();
// îòïðàâêà çàïðîñà
$("#photo_content").load(content_href, function(response, status, xhr) {
if (status == "error") {
$("#photo_loader").hide();
if (global_photo_href) {
window.location = global_photo_href;
return;
}
} else {
// âîññòàíàâëèâàåì ôîðìó Ïðåäëîæèòü ïåðåâîä
page_toolbar_clone.insertAfter( "#content h1:eq(0)" );
// ìîäèôèêàöèÿ URL
setUrl(global_photo_href, href);
// title
var content_title = $("#photo_content_title").text() + ' - eTapasvi.com';
if (content_title) {
document.title = content_title;
}
// óêàçûâàåòñÿ íîâûé URL â ôîðìå Ïðåäëîæèòü ïåðåâîä
$("#offer_tr_uri").val(global_photo_href);
// âûòàñêèâàåòñÿ ID èç URL
$("#offer_tr_id").val(getElementIdFromUrl(global_photo_href));
}
});
}
function getElementIdFromUrl(url)
{
var match = url.match(/^[^\d]+(\d+).*$/);
return match[1];
}
// ïîëó÷åíèå àäðåñà èç õýøà è çàãðóçêà ôîòî
function loadPhotoContentFromHash(domain)
{
var hash_url = $.address.value();
if (hash_url && hash_url.substr(0, 2) == '/!') {
loadPhotoContent( hash_url.substr(2, hash_url.length), true, domain );
}
}
// óñòàíîâêà URL
function setUrl(full, relative)
{
try {
if (history && history.pushState) {
history.pushState({isMine:true}, 'title', full );
} else {
$.address.value('/!' + relative);
}
// ìåíÿåì ññûëêó íà ìîáèëüíóþ âåðñèþ
setUrlMobile(full);
setUrlLangList(full);
} catch (e) {
}
}
// óñòàíîâêà ññûëêè íà ìîáèëüíóþ âåðñèþ
function setUrlMobile(url)
{
var mobile_url = url.replace("www.", "m.");
$("#m_link a").each(function(n,element){
$(element).attr("href", mobile_url);
});
$("#m_link img").each(function(n,element){
var m_src = $(element).attr("src");
$(element).attr("src", m_src.replace(/(.*&d=).*/, "$1") + mobile_url);
});
}
// óñòàíîâêà ññûëîê â ïåðåêëþ÷àòåëå ÿçûêà
function setUrlLangList(href)
{
cur_href_no_culture = href.replace(/http:\/\/[^\/]+\//, '').replace(/[^\/]+\//, '');
$("#lang_list a").each(function(index) {
culture_href = $(this).attr('href').replace(/(http:\/\/[^\/]+\/[^\/]+\/).*/, '$1' + cur_href_no_culture);
$(this).attr('href', culture_href);
});
}
// îòîáðàæåíèå ôîðìû Ïðåäîëæèòü ïåðåâîä
function switchOfferTr(fields_url, error_msg)
{
// åñëè ïîëÿ óæå çàãðóæåíû
if (!$("#offer_tr_fields").is(':empty')) {
if ( $("#offer_tr").is(":hidden") ) {
pageToolsTriggerShow("offer_tr");
// åñëè ôîðìà áûëà îòïðàâëåíà
if (!$("#offer_tr_success").is(":hidden")) {
$("#offer_tr_fields textarea").val('');
}
$("#offer_tr_success").hide();
} else {
pageToolsTriggerHide("offer_tr");
}
} else {
// çàãðóçêà ïîëåé
$("#offer_tr_loader").show();
pageToolsTriggerShow("offer_tr");
$.ajax({
url: fields_url,
dataType: "html",
success: function(data) {
$("#offer_tr_fields").html(data);
$("#offer_tr_loader").hide();
$("#offer_tr").show();
},
error: function(data) {
$("#offer_tr_loader").hide();
}
});
}
}
// îòïðàâêà Ïåðåâîäà
function offerTrSubmit()
{
$("#offer_tr_success").show();
$("#offer_tr").hide();
return true;
}
// îòîáðàæåíèÿ ôîðìû îòïðàâêè ïåðåâîäà
function showOfferTrMethod(radio)
{
$(".offer_tr_method").hide();
$("#" + $(radio).val() ).show();
}
// îòîáðàæåíèå Èñòîðèè èçìåíåíèé
function switchRevhistory()
{
if ( $("#revhistory").is(":hidden") ) {
pageToolsTriggerShow("revhistory");
} else {
pageToolsTriggerHide("revhistory");
}
}
// îòîáðàæåíèå Èñòîðèè èçìåíåíèé
function switchEmbed()
{
if ( $("#embed").is(":hidden") ) {
pageToolsTriggerShow("embed");
} else {
pageToolsTriggerHide("embed");
}
}
// ïîêàçàòü êíîïêó
function pageToolsTriggerShow(mnemonic_id)
{
// ñêðûâàþòñÿ âñå îñòàëüíûå êíîïêè
$(".page_tools").each(function(index) {
pageToolsTriggerHide( $(this).attr('id') );
});
$("#"+mnemonic_id).show();
$("#"+mnemonic_id+"_trigger").addClass('pt_btn_disabled');
}
// ñêðûòü êíîïêó
function pageToolsTriggerHide(mnemonic_id)
{
if ( !$("#"+mnemonic_id).is(":hidden") ) {
$("#"+mnemonic_id).hide();
$("#"+mnemonic_id+"_trigger").removeClass('pt_btn_disabled');
}
}
// jmp3
jQuery.fn.jmp3=function(passedOptions){var playerpath="/swf/";var options={"filepath":"","backcolor":"","forecolor":"ffffff","width":"25","repeat":"no","volume":"50","autoplay":"false","showdownload":"true","showfilename":"true"};if(passedOptions){jQuery.extend(options,passedOptions)}return this.each(function(){var filename=options.filepath+jQuery(this).children().html();var mp3html='';mp3html+=' ';mp3html+=' ';mp3html+=' ';mp3html+=' ';if(options.showfilename=="false"){jQuery(this).html("")}jQuery(this).prepend(mp3html+" ");if(jQuery.browser.msie){this.outerHTML=this.outerHTML}})};
// jQuery Address Plugin v1.4
(function(c){c.address=function(){var v=function(a){c(c.address).trigger(c.extend(c.Event(a),function(){for(var b={},e=c.address.parameterNames(),f=0,p=e.length;f
"+n.title.replace("'","\\'")+"