function setMediaFile(id, src, hideimage){
src = src.replace("//", "/");
document.getElementById(id).value = src;
if(hideimage == null || hideimage == 0 || hideimage == false){
document.getElementById(id + '_span').innerHTML = "
" +
"
" + src + "";
}else
document.getElementById(id + '_span').innerHTML = "
" + src.replace(/\n/g, "
");
}
function image_popup(url,breite){
if(breite != null){
var width=breite;
var height=breite;
var l = (screen.availWidth - width) / 2;
var t = (screen.availHeight - height) / 4;
newwindow = window.open("http://www.arosa.ch/modules/system/cmd_image_popup.php?src="+url+"&width="+width,"newwindow",
"width=" +breite+",height=" +height+",screenX="+l+",screenY="+t+",left=" +l+",top="+t+",scrollbars=0,resizable=0,menubar=no");
newwindow.focus();
}else{
var breite=screen.availWidth-8;
var width=breite;
var height=screen.availHeight;
var l = (screen.availWidth - width) / 2;
var t = (screen.availHeight - height) / 4;
newwindow = window.open("http://www.arosa.ch/modules/system/cmd_image_popup.php?src="+url+"&width="+width,"newwindow",
"width=" +breite+",height=" +height+",screenX="+l+",screenY="+t+",left=" +l+",top="+t+",scrollbars=0,resizable=0,menubar=no");
newwindow.focus();
}
}
function popup(url,breite,hoehe){
var url;
var width=breite;
var height=hoehe;
var l = (screen.availWidth - width) / 2;
var t = (screen.availHeight - height) / 2;
newwindow = window.open(url,"newwindow",
"width=" +breite+",height=" +hoehe+",screenX="+l+",screenY="+t+",left=" +l+",top="+t+",scrollbars=yes,resizable=0,menubar=no");
newwindow.focus();
}
function confirm_delete(url, type){
if(type == null){
if(confirm('Wirklich löschen?') == true)
window.location = url;
}else if(type == "cat"){
if(confirm('Kategorie wirklich löschen?\n\nEinträge, die nur in dieser Kategorie sind, \nwerden komplett gelöscht!') == true)
window.location = url;
}else if(type == "main_cat"){
if(confirm('Kategorie wirklich löschen?\nAlle Unterkategorien werden gelöscht und Einträge die in keinen anderen Kategorien sind werden ebenfalls gelöscht!') == true)
window.location = url;
}else if(type == "survey_question"){
if(confirm('Frage wirklich löschen?\nZugehörige Antworten ebenfalls gelöscht!') == true)
window.location = url;
}else if(type == "survey_main"){
if(confirm('Kategorie wirklich löschen?\nAlle enthaltenen Fragen sowie zugehörige Antworten werden ebenfalls gelöscht!') == true)
window.location = url;
}else if(type == "comments"){
if(confirm('Eintrag wirklich löschen?\nAlle zugehörigen Kommentare werden ebenfalls gelöscht!') == true)
window.location = url;
}
}
function show_layer(id, show){
if(show){
document.getElementById(id).style.display = "";
document.getElementById(id).style.visibility = "visible";
}
else{
document.getElementById(id).style.display = "none";
document.getElementById(id).style.visibility = "hidden";
}
}
function layer_visible(id){
var vis = document.getElementById(id).style.visibility;
return ((vis == "visible") || (vis == ""));
}
function toggle_layer(id){
show_layer(id, !layer_visible(id));
}
function goto_url(url){
window.location = url;
}
function showWMTT(id) {
wmtt = document.getElementById(id);
wmtt.style.display = "block";
}
function hideWMTT() {
wmtt.style.display = "none";
}
/* deep form js */
$(document).ready(function(){
$('[rel="deepJS"]').each(function(i) {
var el = this;
var mdata = $(el).metadata({type:'attr',name:'data'});
for (x in mdata){
var data = mdata[x];
switch (data.action) {
case "inputnotes":
$(el).inputNotes( data.options );
break;
case "mask":
$(el).mask( data.options );
break;
case "date":
if (data.options.starts == undefined){
data.options.starts = 1;
}
if (data.options.position == undefined){
data.options.position = 'r';
}
if (data.options.format == undefined){
data.options.format = 'd.m.Y';
}
data.options.onChange = function(formated, dates){
$(el).val(formated);
$(el).DatePickerHide();
};
$(el).DatePicker( data.options );
break;
case "hint":
if (data.options.hintClass == undefined){
data.options.hintClass = 'inputhint';
}
$(el).ztInputHint( data.options );
break;
case "maxlength":
if (data.options.statusText == undefined){
data.options.statusText = 'Buchstaben verfügbar';
}
$(el).maxlength( data.options );
break;
case "grow":
if (data.options.max_height == undefined){
data.options.max_height = '200px';
}
$(el).jGrow( data.options );
break;
case "optiontree":
$(el).optionTree( data.options.tree, data.options.config );
break;
case "confirm":
if (data.options.msg == undefined){
data.options.msg = 'Daten wirklich speichern? ';
}
if (data.options.buttons == undefined){
data.options.buttons = {
ok: 'Ja',
cancel: 'Nein',
separator: ' ',
wrapper: ''
};
}
$(el).confirm( data.options );
break;
case "spin":
if (data.options.imageBasePath == undefined){
data.options.imageBasePath = 'lib/deepForms/deep.forms.images/';
}
$(el).spin( data.options );
break;
case "combobox":
if (data.options.skin == undefined){
data.options.skin = 'sexy';
}
$(el).sexyCombo( data.options );
break;
case "time":
if (data.options.step == undefined){
data.options.step = 30;
}
$(el).timePicker( data.options );
break;
case "autotab":
$(el).autotab( data.options );
break;
}
}
});
});