function print_content(div_id,title,nag)
{
noweOkno = window.open('prt/print_content.php?title=' + title + '&content=' + nag + document.getElementById(div_id).innerHTML, 'okienko', 'width=600, height=470, menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes, status=no')
}
function transfer_show_log(){
advAJAX.setDefaultParameters({
onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; },
onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
});
advAJAX.get({ url: "ajax/show_log.php", tag: "log_preview",
parameters : {
}
});
setTimeout("transfer_show_log();",500);
}
function print_div(div_id,title,css_files){
var print_window = window.open('','print_manager','width='+$("#"+div_id).outerWidth(true)+',height=600');
var css_files2 = css_files.split(','); var css_files3 = "";
$(css_files2).each(function(i, s){
css_files3 = css_files3 + '';
});
if($.browser.mozilla || $.browser.opera || $.browser.chrome){
var html = '
'+title+''+css_files3+'' + $('
').append($('#'+div_id).clone(false,false)).html() + '
';
}
else {
var html = ''+title+''+css_files3+'' + $('
').append($('#'+div_id).clone(false,false)).html() + '
';
}
print_window.document.open();
print_window.document.write(html);
print_window.document.close();
if(!$.browser.mozilla && !$.browser.opera && !$.browser.chrome){
print_window.jQuery(".no_print").remove();
print_window.window.print();
}
}
function str_replace (search, replace, subject, count) {
// http://kevin.vanzonneveld.net
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Gabriel Paderni
// + improved by: Philip Peterson
// + improved by: Simon Willison (http://simonwillison.net)
// + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// + bugfixed by: Anton Ongson
// + input by: Onno Marsman
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + tweaked by: Onno Marsman
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Oleg Eremeev
// + improved by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Oleg Eremeev
// % note 1: The count parameter must be passed as a string in order
// % note 1: to find a global variable in which the result will be given
// * example 1: str_replace(' ', '.', 'Kevin van Zonneveld');
// * returns 1: 'Kevin.van.Zonneveld'
// * example 2: str_replace(['{name}', 'l'], ['hello', 'm'], '{name}, lars');
// * returns 2: 'hemmo, mars'
var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0,
f = [].concat(search),
r = [].concat(replace),
s = subject,
ra = r instanceof Array, sa = s instanceof Array;
s = [].concat(s);
if (count) {
this.window[count] = 0;
}
for (i=0, sl=s.length; i < sl; i++) {
if (s[i] === '') {
continue;
}
for (j=0, fl=f.length; j < fl; j++) {
temp = s[i]+'';
repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
s[i] = (temp).split(f[j]).join(repl);
if (count && s[i] !== temp) {
this.window[count] += (temp.length-s[i].length)/f[j].length;}
}
}
return sa ? s : s[0];
}
function load(id,parameters){
advAJAX.setDefaultParameters({
onLoading : function(obj) { document.getElementById(obj.tag).innerHTML = '...'; },
onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; },
onError : function(obj) { document.getElementById(obj.tag).innerHTML = "loading error!"; }
});
advAJAX.get({ url: "ajax_manager.php?" + parameters, tag: id
// ,parameters : {
// cat: cat,
// lang: lang,
// page: page
// }
});
}
function load2(id,parameters){
advAJAX.setDefaultParameters({
onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; },
onError : function(obj) { document.getElementById(obj.tag).innerHTML = "loading error!"; }
});
advAJAX.get({ url: "ajax_manager.php?" + parameters, tag: id });
}
function send(form_id,id){
advAJAX.submit(document.getElementById(form_id), {
onLoading : function(obj) { document.getElementById(id).innerHTML = '...'; },
onSuccess : function(obj) { document.getElementById(id).innerHTML = obj.responseText; },
onError : function(obj) { document.getElementById(id).innerHTML = 'error: ' + obj.status; }
});
}
function send2(form_id,id){
advAJAX.submit(document.getElementById(form_id), {
onSuccess : function(obj) { document.getElementById(id).innerHTML = obj.responseText; },
onError : function(obj) { document.getElementById(id).innerHTML = 'error: ' + obj.status; }
});
}
function createjscssfile(filename, filetype){
if (filetype=="js"){ //if filename is a external JavaScript file
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
}
else if (filetype=="css"){ //if filename is an external CSS file
var fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", filename)
}
return fileref
}
function replacejscssfile(oldfilename, newfilename, filetype){
var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist using
var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
var allsuspects=document.getElementsByTagName(targetelement)
for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(oldfilename)!=-1){
var newelement=createjscssfile(newfilename, filetype)
allsuspects[i].parentNode.replaceChild(newelement, allsuspects[i])
}
}
}
function change_css_type(){
if(global_css_type==0){
var old_css_type = "";
var new_css_type = "_invert";
}
else {
var old_css_type = "_invert";
var new_css_type = "";
}
global_css_type = 1 - global_css_type;
if(global_css_level==0)old_css = "css/bip"+old_css_type+".css";
else if(global_css_level<0){ pom = global_css_level * -1; old_css = "css2/"+"m"+pom+"_"+"bip"+old_css_type+".css"; }
else old_css = "css2/"+"p"+global_css_level+"_"+"bip"+old_css_type+".css";
if(global_css_level==0)new_css = "css/bip"+new_css_type+".css";
else if(global_css_level<0){ pom = global_css_level * -1; new_css = "css2/"+"m"+pom+"_"+"bip"+new_css_type+".css"; }
else new_css = "css2/"+"p"+global_css_level+"_"+"bip"+new_css_type+".css";
replacejscssfile(old_css, new_css, "css"); //Replace all occurences "oldstyle.css" with "newstyle.css"
load2("ajax_tmp_content","new_global_css_type="+global_css_type);
// replacejscssfile("oldscript.js", "newscript.js", "js") //Replace all occurences of "oldscript.js" with "newscript.js"
}
function change_font_size(value,min,max){
if(global_css_type==0)var css_type = ""; else var css_type = "_invert";
if(global_css_level==0)old_css = "css/bip"+css_type+".css";
else if(global_css_level<0){ pom = global_css_level * -1; old_css = "css2/"+"m"+pom+"_"+"bip"+css_type+".css"; }
else old_css = "css2/"+"p"+global_css_level+"_"+"bip"+css_type+".css";
if(value==0)global_css_level = 0; else global_css_level = global_css_level + value;
if(global_css_levelmax)global_css_level = max;
if(global_css_level==0)new_css = "css/bip"+css_type+".css";
else if(global_css_level<0){ pom = global_css_level * -1; new_css = "css2/"+"m"+pom+"_"+"bip"+css_type+".css"; }
else new_css = "css2/"+"p"+global_css_level+"_"+"bip"+css_type+".css";
replacejscssfile(old_css, new_css, "css"); //Replace all occurences "oldstyle.css" with "newstyle.css"
load2("ajax_tmp_content","new_global_css_level="+global_css_level);
// replacejscssfile("oldscript.js", "newscript.js", "js") //Replace all occurences of "oldscript.js" with "newscript.js"
}