//////////////////////////////////////////////// default AJAX loading content replacer ///////////////////////////////////////////////////////////////////
function fillSameField(cell_1, cell_2){
/**
* Dublicate content on the other field
*/
var cella_1 = document.getElementById(cell_1);
var cella_2 = document.getElementById(cell_2);
cella_2.value = cella_1.value;
}
function checkOnline(){
/**
* Hold session online
*/
$.post("/online.php",{
'online': 'true'
}, function(xml){
setTimeout("checkOnline()",180000); //180000
});
}
function get(aId){
/**
* Get object on the document element
*/
return document.getElementById(aId);
}
function getCheckedValue(radioObj){
/**
* Get all checked value on radio checkbox
*/
if(!radioObj)
return "";
var radioLength = radioObj.length;
if(radioLength == undefined)
if(radioObj.checked)
return radioObj.value;
else
return "";
for(var i = 0; i < radioLength; i++) {
if(radioObj[i].checked) {
return radioObj[i].value;
}
}
return "";
}
/**
* Hide visualised error fields
*/
function fadeSuccessDiv(){ $('.okTitleBody').fadeOut('slow'); }
function fadeErrorDiv(){ $('.errorTitleBody').fadeOut('slow'); }
function getPagingData(toPut, param){
$("#AjaxLoading").toggle();
$("#"+toPut).load(param, function(){
$("#AjaxLoading").toggle();
});
return false;
}
function error_alert(text){
var winH = $(window).height();
var winW = $(window).width();
var error_div = $('
');
error_div.css({'top' : winH / 2, 'left' : (winW / 2) - 150}).appendTo('body');
setTimeout("$('#errorDiv').fadeOut('slow', function(){$('#errorDiv').remove();})", 2000);
}
function operaDisplayFix(){ //pokazva korektno v opera stranicata pri izpolzvane na jquery
$('body').prepend('');
$('#operaDiv').remove();
}
function expand(id) {
document.getElementById('expand_box_' + id).style.display = '';
document.getElementById('exp_btn_start_' +id).className = 'expand_start_open';
document.getElementById('exp_btn_end_' +id).className = 'expand_end_open';
$('#close_x_' + id).show();
}
function collapse(id) {
document.getElementById('expand_box_' + id).style.display = 'none';
document.getElementById('exp_btn_start_' +id).className = 'expand_start';
document.getElementById('exp_btn_end_' +id).className = 'expand_end';
$('#close_x_' + id).hide();
}
function close_red_msg(){
$('.ea_msg_red_hide').fadeOut('slow', function(){
$('.ea_msg_red_hide').remove();
});
}
function under_construction(){
$('.content').empty();
$('.content').html('
');
}
function alert_adv(msg){
var html_form = $('');
$(html_form).dialog({
minHeight: 90,
width: 400,
modal: true,
closeOnEscape: true,
draggable: false,
resizable: false,
title: 'Внимание!',
buttons: {
'Затвори': function() {
$('#dialog_box').remove();
$(this).dialog('close');
}
},
close: function() {
$('#dialog_box').remove();
$(this).dialog('close');
}
});
}
// javascript base64_encode and base64_decode
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
// Hover Plugin JQuery - Start
jQuery.fn.hoverbox=function(a){var b=jQuery.extend({id:"tooltipHover",top:0,left:15},a);var d;function c(e){if(!d){d=$('').appendTo(document.body).hide()}if(e){d.css({top:(e.pageY-b.top)+"px",left:(e.pageX+b.left)+"px"})}return d}this.each(function(){$(this).hover(function(f){if(this.title){this.t=this.title;this.title="";this.alt="";c(f).html(this.t).fadeIn("fast")}},function(){if(this.t){this.title=this.t;c().hide()}});$(this).mousemove(c)})};
// Hover Plugin JQuery - END
//за random между две числа START
jQuery.extend({
random: function(X) {
return Math.floor(X * (Math.random() % 1));
},
randomBetween: function(MinV, MaxV) {
return MinV + jQuery.random(MaxV - MinV + 1);
}
});
//за random между две числа END
$(function(){
setTimeout("$('.ea_msg_hide').fadeOut('slow', function(){$('.ea_msg_hide').remove();})", 5000);
$(document).pngFix();
/* login form */
var loginButton = $('#loginButton'),
loginForm = $('#login_div');
if (loginForm) {
loginForm = $(loginForm);
var clickOutside,
hideMenu = function() {
loginButton.unbind('click').click(showMenu);
loginForm.hide();
$('#ea_top_btn_start_js').removeClass('ea_top_btn_start_up').addClass('ea_top_btn_start_down');
$(document).unbind('click', clickOutside);
return false;
},
showMenu = function() {
loginButton.unbind('click').click(hideMenu);
loginForm.show();
loginForm.find('input[name="uu"]').focus();
$('#ea_top_btn_start_js').removeClass('ea_top_btn_start_down').addClass('ea_top_btn_start_up');
$(document).click(clickOutside);
return false;
};
clickOutside = function(e) {
var elems = $(e.target).parents().andSelf();
if ($.inArray(loginForm[0], elems) == -1)
hideMenu();
};
hideMenu();
}
$('.ea_login_form input.textfield').focus(function(){
$(this).css('background-position', '-144px 0');
}).blur(function(){
$(this).css('background-position', '0 0');
});
$("#login").submit( function(){
$.post("/login.php",{
"sign": $("#sign").val(),
"email": $("#uu").val(),
"password": $("#pp").val()
}, function(xml){
var mode = $("mode",xml).text();
var msg = $("msg",xml).text();
var loginFolder = $("loginFolder",xml).text();
if(mode == "msg"){
$("#errSpanLogin").html(msg);
}
else if(mode == "successful"){
window.location.href= "/" + loginFolder + "/";
}
else if(mode == "adminAccessIP"){
window.location.href= "/adminAccessIP.php";
}
});
return false;
});
/* login form END */
});