var images;
var c = 0;
function slideshow() {
images = new Array();
var gallery_images = document.getElementsByClassName('gallery_img');
for(var i = 0; i < gallery_images.length; i++) {
images[i] = jQuery(gallery_images[i]).css('background-image').replace("\"", "").replace("url(", "").replace("\")", "").replace(")", "").replace("/thumb/", "/big/");
}
setOverlay();
slideIt();
}
function setOverlay() {
var overlay = document.createElement('div');
jQuery(overlay).attr('id', 'c_overlay');
overlay.style.background = "black";
overlay.style.width = "100%";
overlay.style.height = "100%";
overlay.style.position = "fixed";
if(navigator.appName.indexOf("MSIE")) overlay.style.position = "absolute";
overlay.style.opacity = "0.8";
overlay.style.filter = "alpha(opacity=80) ";
overlay.style.zIndex = 1001;
overlay.style.top = "0px";
overlay.style.left = "0px";
overlay.style.textAlign = "center";
document.body.appendChild(overlay);
jQuery(overlay).dblclick(function() {
jQuery(this).remove();
jQuery('#cimg').remove();
});
var img = document.createElement('img');
jQuery(img).attr('id', 'cimg');
//img.style.marginLeft = 'expression(this.offsetWidth < this.parentNode.offsetWidth ? parseInt((this.parentNode.offsetWidth - this.offsetWidth)/2)+"px":"0");
jQuery(img).attr('class', 'slide_img');
if(navigator.appName.indexOf("MSIE")) img.style.position = "absolute";
document.body.appendChild(img);
jQuery('body').bind('keypress', function(e) {
if(e.keyCode == 27) {
jQuery('#c_overlay').remove();
jQuery('#cimg').remove();
}
});
}
function slideIt() {
jQuery('#cimg').attr('src', images[c]);
c++;
if(c >= images.length) c = 0;
setTimeout("slideIt()", 5000);
}
var invalidatedElements = {};
function ErrorFill(el) {
jQuery('!').insertAfter(el);
invalidatedElements[el.attr('name')] = true;
}
function HaveErrors() {
for(var c in invalidatedElements) {
if(invalidatedElements[c]) {
return true;
}
}
return false;
}
function quickedit() {
jq('.quickedit').each(function() { var cnt = jq(this).html();
//if(jq(this).attr('id').split('_')[0] == 'name') { save = ""; } else { save = ""; }
var len = cnt.length*8;
if(len > 350) len = 350;
jq(this).html(""); });
jq('#quickedit_btn').attr('onclick', "").val("Запази");
if(!jq.browser.msie) jq('#quickedit_btn').click(function() { quicksave(); });
else document.getElementById('quickedit_btn').onclick = quicksave;
}
function quicksave() {
var data = {};
jq("input[id^=qe_]").each(function() {
var val = jq(this).val();
var parent = jq(this).parent();
var id = jq(this).attr('id');
data[id] = val;
jq(this).remove();
parent.html(val);
});
//alert(data);
jq.post("https://zavedenia.com/login/ajax_load/bXVsdGlwbGVfZWRpdF9tZW51", data,
function(a) {
//console.log("Data Loaded: " + a);
});
if(!jq.browser.msie) jq('#quickedit_btn').click(function() { quickedit(); });
else document.getElementById('quickedit_btn').onclick = quickedit;
}
function mass_delete() {
var ids = new Array();
if(!window.confirm("Are you sure?")) return;
jq('.selected_item').each(function() {
ids.push(jq(this).attr('id'));
jq(this).fadeOut();
});
jQuery.post("https://zavedenia.com/login/ajax_load/bXVsdGlwbGVfZGVsZXRlX21lbnU=", {'ids' : ids.join(",")},
function(a) {
//console.log("Data Loaded: " + a);
});
}
jQuery(document).ready(function() {
jq("#sortable3 li").each(function() {
jq(this).click(function() {
if(jq(this).hasClass('selected_item')) {
jq(this).removeClass('selected_item');
}
else {
jq(this).addClass('selected_item');
}
});
});
var lenexp = /\d+/;
jQuery(".validate").each(function() {
jQuery(this).blur(function() {
var rules = jQuery(this).attr('lang').split("|");
var e = 0;
for(var i in rules) {
if(rules[i] == "req") {
if(jQuery(this).val().length < 1) { alert('Mandatory field. Please fill in!');ErrorFill(jQuery(this));return; }
}
if(rules[i] == "mail") {
if(jQuery(this).val().indexOf('@') == -1 || jQuery(this).val().indexOf('.') == -1) { alert('Provide valid email!');ErrorFill(jQuery(this)); return; }
}
if(rules[i] == "date") {
var dt = new Date(jQuery(this).val());
if(dt.getFullYear < 2000) { alert('Please add valid date!');ErrorFill(jQuery(this)); return; }
}
if(rules[i].indexOf("minlen") != -1) {
var minlen = lenexp.exec(rules[i]);
if(jQuery(this).val().length < minlen) { alert('Write minimum ' + minlen + ' symbols!');ErrorFill(jQuery(this)); return; }
}
if(rules[i].indexOf("maxlen") != -1) {
var minlen = lenexp.exec(rules[i]);
if(jQuery(this).val().length > minlen) { alert('Max symbols to use: ' + minlen + '!');ErrorFill(jQuery(this)); return; }
}
if(rules[i] == "onlynum") {
var parsed_val = parseFloat(jQuery(this).val());
if(isNaN(parsed_val)) { alert('Write digits only!');ErrorFill(jQuery(this)); return; }
}
if(jQuery(this).next().html() != null) {
if(jQuery(this).next().html().indexOf("!") != -1) { jQuery(this).next().remove(); invalidatedElements[jQuery(this).attr('name')] = false; }
}
}
});
});
});
window.jq = window.jQuery;
window.sessionObject = eval('( null)');
function show_login() {
jq('#overlay').css("display", "block");
jq('#login_tab').css("display", "block");
jq('#register_tab').css("display", "none");
var width = jq(window).width();
jq('#login_form').css("margin-left", (width-500) / 2 + "px");
jq('#login_form').fadeIn();
}
function destroy_login_form(msg) {
if(msg == '' || msg == undefined) {
jq('#overlay').css("display", "none");
jq('#login_form').fadeOut();
}
else {
styled_alert(window.sessionObject.infoCode);
setTimeout("window.location.reload()", 5000);
setTimeout("destroy_login_form();", 1000);
}
}
function show_register() {
jq('#login_tab').css("display", "none");
jq('#register_tab').css("display", "block");
}
function show_message(msg) {
var msgDiv = document.createElement('div');
msgDiv.style.position = "absolute";
msgDiv.style.width = "160px";
msgDiv.style.height = "30px";
msgDiv.style.top = "150px";
msgDiv.style.background = "white";
msgDiv.style.left = parseInt(jq('#login_form').css("margin-left")) + 170 + "px";
msgDiv.style.padding = "5px";
jq(msgDiv).attr('id', 'msgDiv');
msgDiv.innerHTML = msg;
document.body.appendChild(msgDiv);
msgDiv.style.zIndex = 10000;
setTimeout("document.body.removeChild(document.getElementById('msgDiv'))", 1500);
}
function encodePassword(pass) {
var cc = "a";
for(var i = pass.length-1; i > 0; i--) {
cc += String.fromCharCode(String.charCodeAt(pass.charAt(i)) + 3);
}
return escape(cc);
}
function RegisterUser(form) {
type = "normal";
jq.get("https://zavedenia.com/zav/login_session/" + type + "/" + escape(document.getElementById('reg_data_form').email.value) + "/" + escape(document.getElementById('reg_data_form').password.value) + "/" + escape(document.getElementById('reg_data_form').name.value) + "/" + escape(document.getElementById('reg_data_form').lname.value), null, function(a) {
window.sessionObject = eval('(' + a + ')');
if(!window.sessionObject || window.sessionObject == undefined) {
show_message('Error!!!');
return;
}
if(window.sessionObject.state == "OK") {
destroy_login_form(window.sessionObject.infoCode);
}
else {
show_message(window.sessionObject.infoCode);
}
});
}
function styled_alert(txt) {
var div = document.createElement('div');
div.style.position = "absolute";
div.style.top = "150px";
div.style.color = "#4F8A10";
div.style.background = "#DFF2BF";
div.style.width = "200px";
jQuery(div).css("height", "auto");
jQuery(div).css("text-align", "center");
div.className = "rounded";
div.style.padding = "15px 10px 15px 15px";
div.style.fontSize = "16px";
div.style.display = "block";
div.style.left = ((jQuery(window).width() - 200) / 2) + "px";
div.innerHTML = txt;
div.style.MozBorderRadius = '1em';
div.style.border = "1px dashed gray";
jQuery(div).attr('id', 'msg_box');
document.body.appendChild(div);
setTimeout(function() {
jQuery('#msg_box').fadeOut()
}, 3000);
}
function setupSession(normal) {
var type;
if(window.fb_user && normal == undefined) {
type = "fb";
jq.get("https://zavedenia.com/zav/login_session/" + type + "/" + window.fb_user.id + "/" + window.fb_user.email, null, function(a) {
window.sessionObject = eval('(' + a + ')');
if(!window.sessionObject || window.sessionObject == undefined) {
styled_alert('Error!!!');
return;
}
if(window.sessionObject.state == "OK") {
destroy_login_form(window.sessionObject.infoCode);
}
else {
//alert(window.sessionObject.infoCode);
styled_alert(window.sessionObject.infoCode);
setTimeout("window.location.reload()", 3000);
}
});
}
else {
type = "normal";
jq.get("https://zavedenia.com/zav/login_session/" + type + "/" + escape(document.getElementById('data_form').email.value) + "/" + document.getElementById('data_form').password.value, null, function(a) {
window.sessionObject = eval('(' + a + ')');
if(!window.sessionObject || window.sessionObject == undefined) {
show_message('Error!!!');
return;
}
if(window.sessionObject.state == "OK") {
destroy_login_form(window.sessionObject.infoCode);
}
else {
styled_alert(window.sessionObject.infoCode);
setTimeout("window.location.reload()", 3000);
}
});
}
}
function ShowOff10(val) {
$('#banner_listing8').hide();
$('#banner_listing4').hide();
$('center div a').hide();
$('.vipline').hide();
if(val == 'all') {
$('.post').fadeIn();
}
else {
$('.post').hide();
$('.offday_' + val).fadeIn();
}
$('.off10days li a').removeClass('active');
$('#offday_btn_' + val).addClass('active');
}
function loadPartyPeople(hash) {
//var frame = document.createElement('iframe');
//$(frame).css({position:'absolute', left : ($(window).width()-($(window).width() * 0.7) ) / 2 + "px", top : '80px', 'width' : ($(window).width() * 0.7) + "px", 'height' : '90%', 'z-index' : 999, 'border' : '1px solid black', 'border-radius' : '5px'});
//document.body.appendChild(frame);
//$(frame).attr('src',"https://party.zavedenia.com/?sid=" + Math.random() + "&lh=" + hash);
setTimeout(function() {
//window.open('https://party.zavedenia.com','_blank');
}, 1000);
window.open("https://party.zavedenia.com/?sid=" + Math.random() + "&lh=" + hash,'_blank');
}
window.removePPFrame = function() {
$('iframe').remove();
}
window.addEventListener("message", function(ev) {
if(ev.data == "ppremove") window.removePPFrame();
}, false);