/* multiple onload events */
window.addOnloadEvent = function(addToOnload) {var oldOnload;if (window.onload) {oldOnload = window.onload;window.onload = function(){oldOnload();addToOnload();};} else {window.onload = addToOnload;}}
function hpm_toggle_ban_form(){
subject = document.getElementById('ban_subject');
mail = document.getElementById('ban_reason');
div = document.getElementById('ban_email_div');
check = document.getElementById('notifyUser');
if(mail.disabled == true){mail.disabled = false;subject.disabled = false;div.style.opacity='1';check.checked=true;}
else{mail.disabled = true;subject.disabled = true;div.style.opacity='0.5';check.checked=false;}
}
function hpm_spoiler(obj) {
var st = obj.getElementsByTagName('div')[2].style;
st.display = (st.display == 'none' || st.display == '') ? 'block' : 'none';
/*var stb = obj.getElementsByTagName('div')[0].style;
stb.borderWidth = (stb.borderWidth == '1px 1px 1px 1px' || stb.borderWidth == '') ? '1px 1px 0px 1px' : '1px 1px 1px 1px';*/
var sti = obj.getElementsByTagName('input')[0].getAttribute("class");
if(sti==null){
/*this means we are using the IE which doesn't know getAttribute("class")*/
sti = obj.getElementsByTagName('input')[0].getAttribute("className");
if(sti == 'hpm_spoiler_headinput hpm_spoiler_open') {obj.getElementsByTagName('input')[0].setAttribute("className", "hpm_spoiler_headinput hpm_spoiler_closed");};
if(sti == 'hpm_spoiler_headinput hpm_spoiler_closed') {obj.getElementsByTagName('input')[0].setAttribute("className", "hpm_spoiler_headinput hpm_spoiler_open");};
}
else{
if(sti == 'hpm_spoiler_headinput hpm_spoiler_open') {obj.getElementsByTagName('input')[0].setAttribute("class", "hpm_spoiler_headinput hpm_spoiler_closed");};
if(sti == 'hpm_spoiler_headinput hpm_spoiler_closed') {obj.getElementsByTagName('input')[0].setAttribute("class", "hpm_spoiler_headinput hpm_spoiler_open");};
}
}
var miranus_iconbar_textarea = new Array();
function miranus_add_iconbar_textarea(textid) {
miranus_iconbar_textarea.push(textid);
}
function togSub(element,link) {
try {
var timer;
var pagewidth = document.getElementById('pagewidth').offsetWidth;
var navheight = document.getElementById(element).offsetHeight;
var listleft = document.getElementById(element).offsetLeft;
var allEl = document.getElementById(element).getElementsByTagName("ul");
var el = document.getElementById(element);
if (allEl.length > 0)
{
var actEl = allEl[0];
if(actEl.className=='nav_open')
{ actEl.className='nav_close'; el.onclick = "window.location='"+link+"'; return false;"; }
else
{ actEl.className='nav_open';
el.onclick = "";
var actElWidth = actEl.offsetWidth;
var topstring = parseInt(navheight)+'px';
actEl.style.top = topstring;
actEl.style.zIndex = '99999';
if (listleft + actElWidth >= pagewidth)
{ actEl.style.right = '-1px'; }
else
{ actEl.style.left = '-1px';}
}
}
}
catch(err) {}
}
function insertVideoTag(){
vid = prompt('Geben Sie die Url für das Video an. z.B \nMyVideo:\n\"http://www.myvideo.de/watch/6446450/Ball_Platzer_lol\" \n oder Youtube\n\"http://www.youtube.com/watch?v=-3hWIplHVeE\"', "http://www.");
return returnTag('[Video]'+vid+'[/Video]');}
function miranus_current_iconbar_textarea() {
for(var i=0; i < miranus_iconbar_textarea.length; i++) {
if(document.getElementById(miranus_iconbar_textarea[i])) {
return document.getElementById(miranus_iconbar_textarea[i]);
}
}
return false;
}
function returnTag(inTag) {
insert(inTag,'');
}
function insert(aTag, eTag) {
/* Thanks to http://aktuell.de.selfhtml.org/tippstricks/javascript/bbcode/ */
var input = miranus_current_iconbar_textarea();
if(input==false) {
alert('No Textarea defined. Use this Javascript: miranus_add_iconbar_textarea(\'textarea_id\'); ');
return false;
}
var scrollTop = input.scrollTop;
var scrollLeft = input.scrollLeft;
input.focus();
if(typeof document.selection != 'undefined') {
var range = document.selection.createRange();
var insText = range.text;
range.text = aTag + insText + eTag;
range = document.selection.createRange();
if (insText.length == 0) {
range.move('character', -eTag.length);
} else {
range.moveStart('character', aTag.length + insText.length + eTag.length);
}
range.select();
} else if(typeof input.selectionStart != 'undefined') {
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
var pos;
if (insText.length == 0) {
pos = start + aTag.length;
} else {
pos = start + aTag.length + insText.length + eTag.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
} else {
input.value = input.value + aTag + eTag;
input.focus();
}
input.scrollTop = scrollTop;
input.scrollLeft = scrollLeft;
}
var hpm_loaded_js = new Array();
function miranus_load_js(jsuri, infooter) { /* Dynamisch weitere Javascript-Dateien zur Laufzeit nachladen */
if(!hpm_loaded_js[jsuri]) {
if(infooter) {
var appendto = document.getElementsByTagName("body")[0];
} else {
var appendto = document.getElementsByTagName("head")[0];
}
script = document.createElement('script');
script.type = 'text/javascript';
script.src = jsuri;
appendto.appendChild(script);
//alert(jsuri + ' wird jetzt geladen');
}
hpm_loaded_js[jsuri] = true;
return true;
}
function miranus_add_js(node,m_name) { /* Dynamisch Javascript zu einem Node hinzufügen */
var nodeid = node.getAttribute('id');
if( typeof nodeid != "string" || nodeid=="" ) {
nodeid = parseInt(Math.random()*10000);
node.setAttribute('id',nodeid);
}
//alert('node: ' + nodeid + ' mit funktion ' + m_name);
if(m_name=='search_username') {
if(miranus_load_js('/script_user.js')) {
setTimeout('miranus_add_js_search_username(\'' + nodeid + '\')', 100)
}
}
else return false;
}
function hpm_newDialog(url,width,height, formName){
if(width.indexOf('px')==-1 && width.indexOf('%')==-1){width= width+'px';}
hpm_dialogwidth = width;
return hpm_openDialog(url, formName);
}
function hpm_handleResponse() { /** Ajax Dialog anzeigen **/
if(hpm_request.readyState == 4){
/** disable page scrolling **/
if(document.documentElement && document.documentElement.scrollTop){
var oTop = document.documentElement.scrollTop;
document.documentElement.scroll = "no";
document.documentElement.style.overflow = "hidden";
document.documentElement.scrollTop = oTop;
}
else if(document.body){
var oTop = document.body.scrollTop;
document.body.scroll = "no";
document.body.style.overflow = "hidden";
document.body.scrollTop = oTop;
}
/** Get & Show Response **/
var response = hpm_request.responseText;
var hpm_dialogDiv = document.createElement("div");
hpm_dialogDiv.setAttribute('id','hpm_dialog_div');
document.body.appendChild(hpm_dialogDiv);
window.scrollTo(0, 0)
hpm_dialogDiv.innerHTML = response;
if(hpm_dialogwidth.indexOf('%') != -1){if(parseInt(hpm_dialogwidth) > 60){hpm_dialogwidth='60%';}}
document.getElementById('hpm_pagebody').style.width= hpm_dialogwidth;
if (navigator.appName != 'Microsoft Internet Explorer') {
document.getElementById('hpm_pagebody').style.maxHeight= getHeightMargin()+"px";
} else{
document.getElementById('hpm_pagebody').style.height= "auto";
}
document.getElementById('hpm_pagebody').style.overflow= "auto";
/* If Trigger some javascript - no active javascript in ajax-dialog */
if(document.getElementById('miranus_loadGMapScript')) {
setTimeout("miranus_loadGMapScript(document.getElementById('miranus_loadGMapScript').value, document.getElementById('miranus_loadGMapScript_api').value, document.getElementById('miranus_loadGMapScript_startX').value, document.getElementById('miranus_loadGMapScript_startY').value, parseInt(document.getElementById('miranus_loadGMapScript_startZoom').value) )",100);
}
}
}
function hpm_openDialog(url, formName) { /* Laden von url innerhalb eines Ajax Dialogs */
var params = '';
if(formName && document.forms[formName].elements) {
var formdata = miranus_getFormFields(formName);
params = '&' + miranus_js2post(formdata);
}
var params = 'openDialogRequest=true&last_location= ' + encodeURIComponent(location.href) + '&next_location=' + encodeURIComponent(url) + params;
hpm_closeDialog();
hpm_request.open('POST', url);
hpm_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
hpm_request.setRequestHeader("Content-length", params.length);
hpm_request.setRequestHeader("Connection", "close");
hpm_request.onreadystatechange = hpm_handleResponse;
hpm_request.send(params);
if(navigator.appName == "Microsoft Internet Explorer"){
event.returnValue = false
}
return false;
}
function hpm_closeDialog() {
if(document.getElementById('hpm_dialog_div')) {
document.body.removeChild(document.getElementById('hpm_dialog_div'));
}
/** Enable scrolling **/
if(document.documentElement) { /* && document.documentElement.scrollTop){ */
document.documentElement.scroll = "";
document.documentElement.style.overflow = "";
}
if(document.body){
document.body.scroll = "";
document.body.style.overflow = "";
}
}
var callback_flag = false;
var callback_function = '';
var hpm_upload_progress_link = '';
var hpm_upload_progress_show_elem = '';
var hpm_upload_http;
function hpm_upload_start_progress(progress_link, show_elem,callback) {
/* alert('init progress'); */
try{if(show_gallery){gallery_flag = true;}}catch(e){}
try{if(callback){callback_flag = true;callback_function=callback;}}catch(e){}
hpm_upload_progress_link = progress_link;
hpm_upload_progress_show_elem = show_elem;
hpm_upload_refresh_progress();
}
function hpm_upload_refresh_progress() {
/* gpm_request = null; */
/* hpm_request = hpm_createHttpRequestObject(); */
hpm_request.open('get', hpm_upload_progress_link);
hpm_request.onreadystatechange = hpm_upload_handle_progress_response;
hpm_request.send(null);
/* alert('request send: ' + hpm_upload_progress_link); */
}
function hpm_upload_handle_progress_response() {
if(hpm_request==null) {
alert('hpm_request = null');
return;
}
if(hpm_request.readyState == 4) {
var response = hpm_request.responseText;
/*alert('got response:' + response); */
if(response.length>0) {
var resp = eval('(' + response + ')');
var current = parseInt(resp['current']/1024) ;
var total = parseInt(resp['total']/1024);
var cur_percent = 100 * current / total;
if(total>0 && current>0) {
if(callback_flag){eval(callback_function+'('+cur_percent+');');}
else{document.getElementById(hpm_upload_progress_show_elem).innerHTML = '
Status: ' + current + ' von ' + total + ' KByte hochgeladen';}
}
if(total>20480){ document.getElementById(hpm_upload_progress_show_elem).innerHTML = document.getElementById(hpm_upload_progress_show_elem).innerHTML + '
Achtung: Sie haben zu viele oder zu große Bilder ausgewählt.
Dies wird dazu führen, dass der Upload-Vorgang nicht ordnungsgemäß abgeschlossen werden kann.
Upload neu starten';}
}
window.setTimeout("hpm_upload_refresh_progress()",600);
}
}
function getHeightMargin(){
if(window.innerHeight){
h = window.innerHeight;
b = (h - (h*0.2))
}
else if(document.body || navigator.appName == 'Microsoft Internet Explorer'){
h = document.body.clientHeight
b = (h -(h*0.3))
}
else {
h = document.documentElement.clientHeight;
b = (h - (h*0.2))
}
return parseInt(b);
}
function miranus_getFormFields(formName) {
/* Alle Formularfelder im Formular formName in ein Javascript Array holen */
var val = new Array();
var el = document.forms[formName].elements;
for(i=0;i 0 ? '[' + path.join('][') + ']' : '') + '=' + encodeURI(obj));
path.unshift(base);
}
path.pop();
return post_str.join('&');
}
*/
function hpm_createHttpRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}
var hpm_request = hpm_createHttpRequestObject();
var hpm_dialogwidth = 800;
//var hpm_dialogheight = getHeightMargin();
function miranus_delete_integration(i_id,target_id,confirmed){
miranus_load_js('/js/jquery.js');
var jq_loaded = false;
if(!confirmed){ var ich_will = window.confirm("Wollen Sie diese Verlinkung wirklich loeschen?");}
try{$('test'); jq_loaded=true;}catch(e){setTimeout("miranus_delete_integration('"+i_id+"','"+target_id+"',true)",200)}
if((ich_will || confirmed) && jq_loaded) {
if(i_id > 0){
if(typeof(target_id) == 'undefined') {
var target_id = false;
}
$.ajax({
type: "POST",
url: '../integration_select.php',
data: {del:true,target_id:target_id,i_id:i_id},
success: function(result){
window.location.reload();
}
});
}
else {
alert('Cannot delete the Element with '+i_id);
}
}
}
function miranus_confirm_tag(name,redirect){
var c = window.confirm(name+" an dieser Stelle verlinken ?");
if(c){
document.UserForm.submit();
}
else {
document.UserForm.onsubmit() = false;
}
}
function chkName(name){
if(name==""){
$("#UserError").html("Bitte Name eingeben");
return false;
}
else {
$.ajax({
type:"POST",
url: "../listUser.php",
data: {chkUser:true,uname:name},
success: function(resp){
var user = eval('(' + resp + ')');
if(user['userid']>0){
return true;
erg = true;
//window.location.reload();
}
else {
$("#UserError").html("Name "+name+" nicht gefunden");
return false;
}
}
});
}
}
function showDivById(id){
document.getElementById(id).style.display='block';
}
function hideDivById(id){
document.getElementById(id).style.display='none';
}
function ValideEmail(email){
var lookup = "^[a-zA-Z0-9_\.\-]+@([a-zA-Z0-9\.\-]+)\.[a-z]{2,4}$";
var regexp = new RegExp(lookup);
return (regexp.test(email));
}
function conf_ban(){
var ok = window.confirm("Dieses Mitglied wirklich sperren?");
return ok;
}