// 1. Alte Toolbar
function object(id, art){
var object = document.getElementById(id);
if (art == 'show'){
object.style.visibility = 'visible';}
else if (art == 'hide'){
object.style.visibility = 'hidden';}}
// 2. Blinken im IE
blink(0.7);
function blink(speed) {
if (speed) {
if (document.all) setInterval("blink()", speed*2000);
return; }
var blink = document.all.tags("BLINK")
for (var i=0; i<blink.length; i++)
blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""}
// 3. Aufklappmenü
function clip (id) {
if (document.getElementById("span_"+id).style.display == 'none') {
document.getElementById("span_"+id).style.display = "block";
}
else {
document.getElementById("span_"+id).style.display = "none";
}}
// Sprung zu Stelle
function marke(nr) {
document.getElementById("marke_"+nr).scrollIntoView(true);
}
// 4. Smilieauswahlmenü
function clip1 (id) {
if (document.getElementById("span_" + 100).style.display == 'none') {
document.getElementById("span_" + 100).style.display = "block"
document.getElementById("span_" + 101).style.display = "none"
document.getElementById("span_" + 102).style.display = "none"
}
else {
document.getElementById("span_" + 100).style.display = "none"
}}
function clip2 (id) {
if (document.getElementById("span_" + 101).style.display == 'none') {
document.getElementById("span_" + 101).style.display = "block"
document.getElementById("span_" + 100).style.display = "none"
document.getElementById("span_" + 102).style.display = "none"
}
else {
document.getElementById("span_" + 101).style.display = "none"
}}
function clip3 (id) {
if (document.getElementById("span_" + 102).style.display == 'none') {
document.getElementById("span_" + 102).style.display = "block"
document.getElementById("span_" + 100).style.display = "none"
document.getElementById("span_" + 101).style.display = "none"
}
else {
document.getElementById("span_" + 102).style.display = "none"
}}
// 5. Tooltips
ttip = null;
// Tooltips - document.onmousemove = ttip_position;
function ttip_position(e) {
// Tooltips - IE, Opera : Firefox
x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
y = (document.all) ? window.event.y + document.body.scrollTop : e.pageY;
// Tooltips - Überprüfung auf Opera
if (window.opera) {
if (ttip != null) {
ttip.style.left = (x + 10) + "px"; // x-Wert für Opera
ttip.style.top = (y + 45) + "px"; // y-Wert für Opera
}
} else {
if (ttip != null) {
ttip.style.left = (x + 10) + "px";
ttip.style.top = (y + 20) + "px";
if (navigator.appName == 'Microsoft Internet Explorer') {
if (ttip_breite_anfang+x+20 >= document.body.clientWidth) {
ttip.style.width = document.body.clientWidth-x-25;
}
else {
ttip.style.width = ttip_breite_anfang;
}
}
}
}
}
function tooltip_open(tip) {
document.onmousemove = ttip_position;
ttip = tip.getElementsByTagName('span')[0];
ttip.style.display = "block";
ttip.style.top = "-500";
ttip.style.left = "-500";
ttip.style.width = "";
ttip_breite_anfang = ttip.offsetWidth;
}
function tooltip_close() {
ttip.style.display = "none";
}
// 7.Spoilerbuttons
//Spoilerbuttons
function spoiler_on(me) {
if (me.parentNode.parentNode.getElementsByTagName('span')[1].getElementsByTagName('span')[0].style.display != 'block') {
me.parentNode.parentNode.getElementsByTagName('span')[1].getElementsByTagName('span')[0].style.display = 'block';
me.innerText = '';
me.value = 'Schließen';
} else {
me.parentNode.parentNode.getElementsByTagName('span')[1].getElementsByTagName('span')[0].style.display = 'none';
me.value = 'Öffnen'; }}
function spoiler_off(me) {
me.parentNode.style.display = 'none';
me.parentNode.parentNode.parentNode.getElementsByTagName('span')[0].getElementsByTagName('input')[0].value = 'Öffnen'; }
// 8.Spoilerbutton - mouseover
function spoil2(me) {
if (me.parentNode.parentNode.getElementsByTagName('span')[1].getElementsByTagName('span')[0].style.display != '') {
me.parentNode.parentNode.getElementsByTagName('span')[1].getElementsByTagName('span')[0].style.display = '';
} else {
me.parentNode.parentNode.getElementsByTagName('span')[1].getElementsByTagName('span')[0].style.display = 'none';
}}
// HPM-Scripte
/* 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 = '<img src="http://www.homepagemodules.de/img/blackline.gif" height=10 width="' + cur_percent + '" style="border:1px solid;padding-right:' + (100 - cur_percent) + 'px"><br>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 + '<br><br><br><b>Achtung:</b> Sie haben zu viele oder zu große Bilder ausgewählt.<br>Dies wird dazu führen, dass der Upload-Vorgang nicht ordnungsgemäß abgeschlossen werden kann.<br><br><a onClick="history.back()" href="javascript:void(0)">Upload neu starten</a>';}
}
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<el.length;i++){
//checkbox,radiobox
if(el[i].type=="checkbox" || el[i].type=="radio"){
if(el[i].checked) val.push(new Array(el[i].name, el[i].value));
} else if(el[i].type=="text" && el[i].value!=""){
val.push(new Array(el[i].name, el[i].value));
} else if(el[i].type=="hidden" && el[i].value!=""){
val.push(new Array(el[i].name, el[i].value));
}//Sollte es weitere input typen geben, weiter mit else if
else {
// alert(el[i].name + "-Typ:" + el[i].type + " @ " + el[i].value + "\r\n");
}
}
return val;
}
function miranus_js2post(obj) {
var post_str = [];
if (typeof(obj) == 'array' || typeof(obj) == 'object') {
for (var n in obj) {
if(typeof(n) == 'array' || typeof(obj) == 'object') {
post_str.push(obj[n][0] + '=' + encodeURI(obj[n][1]));
// alert('new ' + obj[n][0] + ' equal ' + obj[n][1]);
}
}
}
return post_str.join('&');
}
/* OLD & bad
function miranus_js2post(obj,path,new_path) {
if (typeof(path) == 'undefined') var path=[];
if (typeof(new_path) != 'undefined') path.push(new_path);
var post_str = [];
if (typeof(obj) == 'array' || typeof(obj) == 'object') {
for (var n in obj) {
post_str.push(miranus_js2post(obj[n],path,n));
}
}
else if (typeof(obj) != 'function') {
var base = path.shift();
post_str.push(base + (path.length > 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;
}
function FitToContent(id, maxHeight)
{
var text = id && id.style ? id : document.getElementById(id);
if ( !text )
return;
var adjustedHeight = text.clientHeight;
if ( !maxHeight || maxHeight > adjustedHeight )
{
adjustedHeight = Math.max(text.scrollHeight, adjustedHeight);
if ( maxHeight )
adjustedHeight = Math.min(maxHeight, adjustedHeight);
if ( adjustedHeight > text.clientHeight )
text.style.height = adjustedHeight + "px";
}
}
function xSetCookie(name,val,days){
var mydate = new Date();
d = days ? days : 3;
mydate.setTime(mydate.getTime()+(d*24*60*60*1000));
var expires = "; expires="+mydate.toGMTString();
document.cookie = name+"="+val+expires+"; path=/";
}
function xGetCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
var rating_request,activity_request;
/*Rating Functions*/
var ratingHandler = "/ajax/ratings_api.php";
var already_rated = "Sie haben diesen Inhalt bereits bewertet";
function xRatingAction(id,what){
var r_type, c_type,c_id,re,xor_id;
var action = what ? what : 'giveRating';
r_type = document.getElementById(id+'_rtype').innerHTML;
c_type = document.getElementById(id+'_ctype').innerHTML;
c_id = document.getElementById(id+'_cid').innerHTML;
i_id = document.getElementById(id+'_iid').innerHTML;
re = 1;
try{xor_id = document.getElementById(id+'_xor_id').innerHTML;}catch(e){/*no xor*/ xor_id = 0;}
var param_string = "action="+action+"&r_type="+r_type+"&c_type="+c_type+"&c_id="+c_id+"&re="+re+"&i_id="+i_id+"&xor_id="+xor_id;
rating_request = hpm_createHttpRequestObject();
rating_request.open("POST",ratingHandler,true);
rating_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
rating_request.setRequestHeader("Content-length", param_string.length);
rating_request.setRequestHeader("Connection", "close");
rating_request.onreadystatechange=ratingdone;
rating_request.send(param_string);
}
function ratingdone(){
if(rating_request.readyState == 4){
try{rdata=JSON.parse(rating_request.responseText);}
catch(e){try{console.log("Error: "+ e + " Response was:"+ rating_request.responseText)}catch(e){}}
if(rdata.success){location.reload();}
else{if(rdata.errormsg){alert(rdata.errormsg)}}
}
}
function xGetActivities(id){
try{document.getElementById('xActivityFeed').getAttribute('id');}catch(e){/*Feed not active*/ return true;}
var method = 'getActivities';
var last_id = id ? id : document.getElementById('xActivityFeed').children[0].getAttribute('id');
var param_string = "method="+method+"&last_id="+last_id;
activity_request = hpm_createHttpRequestObject();
activity_request.open("POST","ajax/handler.php",true);
activity_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
activity_request.setRequestHeader("Content-length", param_string.length);
activity_request.setRequestHeader("Connection", "close");
activity_request.onreadystatechange=activityHandler;
activity_request.send(param_string);
}
function activityHandler(){
if(activity_request.readyState == 4){
try{rdata=JSON.parse(activity_request.responseText);
new_actions = rdata.actions ? rdata.actions : "";
feed = document.getElementById('xActivityFeed');
feed.innerHTML = new_actions + feed.innerHTML;}
catch(e){try{console.log("Error: "+ e + " Response was:"+ activity_request.responseText)}catch(e){}}
}
}

