;
// JavaScript Document
function basename(path) {
return path.replace(/\\/g,'/').replace( /.*\//, '' );
}
function dirname(path) {
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');;
}
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function str_replace(searchString, replaceString, subject) {
return subject.split(searchString).join(replaceString);
}
function extround(zahl,n_stelle) {
zahl = (Math.round(zahl * n_stelle) / n_stelle);
return zahl;
}
function ucfirst(text) {
text += '';
var f = text.charAt(0).toUpperCase();
return f + text.substr(1);
}
function toPreis(e){
var v = $(e).val();
$(e).val( v.replace(/[^0-9.,]/g, "") );
}
function toInt(e){
var v = $(e).val();
$(e).val( v.replace(/[^0-9]/g, "") );
}
function strip_tags(input, allowed) {
// discuss at: http://phpjs.org/functions/strip_tags/
// original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// improved by: Luke Godfrey
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// input by: Pul
// input by: Alex
// input by: Marc Palau
// input by: Brett Zamir (http://brett-zamir.me)
// input by: Bobby Drake
// input by: Evertjan Garretsen
// bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// bugfixed by: Onno Marsman
// bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// bugfixed by: Eric Nagel
// bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// bugfixed by: Tomasz Wesolowski
// revised by: Rafał Kukawski (http://blog.kukawski.pl/)
// example 1: strip_tags('
').css('width',inputWidth+'px');
searchField.find('.inputSearchResult .inputSearchContent').html(output);
}
if (typeof(hideIconSelector) != 'undefined') $(hideIconSelector).show('fast');
searchField.find('.inputSearchLoading').hide('fast');
},
error: function(){
searchField.find('.inputSearchLoading').hide('fast');
}
});
}
function setSearchValues(searchResultLink,label,value,hiddenFormField) {
var searchFormular = $(searchResultLink).parents('form');
var searchInputHolder = $(searchResultLink).parents('.inputSearchField');
searchInputHolder.find('input').val(label);
if (typeof(hiddenFormField) != 'undefined') {
searchFormular.find('input[name="'+hiddenFormField+'"]').val(value);
}
searchInputHolder.find('.inputSearchResult').remove();
}
var searchTimer;
var searchTimerStatus;
$(document).ready(function(){
createFormFunctions();
});
function createFormFunctions(cssPrefix) {
cssPrefix = (typeof(cssPrefix) != 'undefined') ? cssPrefix+" " : "";
$(cssPrefix+'.contentSucheTrigger, .contentSucheMain span').click(function(){
$(this).parents('.contentSuche').find('.contentSucheMain').slideToggle();
});
$(cssPrefix+'input[data-inputSearch="true"]').each(function(){
var inputField = $(this);
if(inputField.hasClass('inputSearchInit')) return false;
inputField.addClass('inputSearchInit');
$(this).wrap('');
$(this).parent().append('')
$(this).bind('focus keyup', function(event){
if (inputField.val().length >= 2 && (inputField.val() != inputField.attr('data-basicValue'))) {
event.stopPropagation();
window.clearTimeout(searchTimer);
searchTimer = window.setTimeout(function() {
if(searchTimerStatus) searchTimerStatus.abort();
searchTimerStatus = searchByTextInput(inputField)
}, 100);
}
if (event.type == 'focus') {
var formField = inputField.attr('data-formField');
var searchFormular = inputField.parents('form');
if (typeof(formField) != 'undefined') {
searchFormular.find('input[name="'+formField+'"]').val("");
}
}
});
});
};
;
// JavaScript Document
function openPopUp() {
centerMe($('#popupContentHolder'),true);
$('#responsivePopup').height($('#outer').height());
$('#responsivePopup').fadeIn();
makeBasicJQueryCalls('#responsivePopup');
doStuffOnLoadAndResize('#responsivePopup');
}
function setMaxHeightBySelector(selector,breakpoints) {
var maxHeight = 0;
elements = (typeof(selector) == 'string' || typeof(selector) == 'object') ? $(selector) : selector;
elements.removeAttr("style");
if (typeof(breakpoints) != 'undefined') {
setMaxHeightBySelectorAndBreakpoints(elements,breakpoints);
} else {
elements.each(function(index, element) {
var container = $(element);
var contheight = container.height();
if(contheight > maxHeight){
maxHeight = contheight;
}
});
elements.css('height',maxHeight);
}
}
function setMaxHeightBySelectorAndBreakpoints(elements,breakpoints) {
var container = new Object();
var ww = $(window).width();
var elementsInRow = 0;
var breakpointKeys = Object.keys(breakpoints);
breakpointKeys.forEach(function(key) {
if (parseInt(ww) <= parseInt(key)) {
elementsInRow = breakpoints[parseInt(key)];
breakpointKeys.length = 0;
return false;
}
});
/*Object.keys(breakpoints).forEach(function(key) {
if (ww <= key && elementsInRow == 0) {
elementsInRow = breakpoints[key];
return false;
}
});*/
var x = 0;
elements.each(function(index, element) {
var newIndex = index + 1;
if(typeof container[x] == 'undefined')
container[x] = new Array();
container[x].push(element);
if(newIndex % elementsInRow == 0){
x++;
}
});
$(container).each(function(index, containerRow){
for(i in containerRow){
setMaxHeightBySelector(containerRow[i]);
}
});
}
function isIE() {
var myNav = navigator.userAgent.toLowerCase();
return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
}
function IsSafari() {
var is_safari = navigator.userAgent.toLowerCase().indexOf('safari/') > -1;
return is_safari;
}
function adresse(name, domain, tld){
var email = ""+name+"@"+domain+"."+tld+"";
document.write(email);
}
function isPluginLoaded(plugin) {
return !!$.fn[plugin]
}
function toggleLink(aTag,toggleElement) {
$('#'+toggleElement).toggle();
$(aTag).toggleClass("opened");
}
function hideElement(element) {
$('#'+element).css('display','none');
}
function showElement(element) {
$('#'+element).css('display','block');
}
function changeClass(element, classString, clearClassString){
$(element).removeClass(clearClassString);
$(element).addClass(classString);
}
function pickBgColorAndSetToInput(element, inputElement){
var bgColor = $(element).css('background-color');
/*$(inputElement).val(rgb2hex(bgColor));*/
if(typeof document.getElementById(inputElement).color == 'undefined'){
$('#'+inputElement).val(rgb2hex(bgColor));
$('#'+inputElement).focus();
$('#'+inputElement).blur();
}else{
document.getElementById(inputElement).color.fromString(rgb2hex(bgColor));
document.getElementById(inputElement).blur();
}
}
function rgb2hex(rgb) {
if (/^#[0-9A-F]{6}$/i.test(rgb)) return rgb;
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
function hex(x) {
return ("0" + parseInt(x).toString(16)).slice(-2);
}
return hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
function scrollToSelector(selector) {
$('html,body').animate({
scrollTop: $(selector).offset().top
}, 1000);
}
/*
function calculateFooterHeightAndScroll(footer,content) {
footerHeight = $('#'+footer).height();
$('#'+content).css('padding-bottom', footerHeight+'px');
$('html,body').animate({
scrollTop: $('#footer').offset().top
}, 1000);
}
function toggleFooterSitemap(aTag,sitemap,footer,paddingBottomElement) {
$(aTag).toggleClass("open");
if ($('#'+sitemap).css('display') == 'block') $('#'+sitemap).hide();
else $('#'+sitemap).show();
//hideElement('seoContentTextHolder');
calculateFooterHeightAndScroll(footer,paddingBottomElement);
}
function calculateFooterHeightAndScroll(footer,content) {
footerHeight = $('#'+footer).height();
//alert(footerHeight);
$('#'+content).css('padding-bottom', footerHeight+'px');
window.scrollBy(0, footerHeight);
}
function toggleFooterSitemap(aTag,sitemap,footer,paddingBottomElement) {
$(aTag).toggleClass("opened");
if ($('#'+sitemap).css('display') == 'block') $('#'+sitemap).hide();
else $('#'+sitemap).show();
}
*/
function formatImageInOverflowBox(uid,imageElement,final_width,final_height) {
$.ajax({
type: "POST",
url: "/inc/modules/ajax.includes.php",
data: "uid="+uid+"&action=getImageSize&imagepath="+imageElement.src+"&width="+final_width+"&height="+final_height,
success: function(output){ ;
sizeArray = output.split('|');
$(imageElement).attr('width',sizeArray[3]);
$(imageElement).attr('height',sizeArray[4]);
$(imageElement).css({"margin-left" : sizeArray[1]+"px"});
$(imageElement).css({"margin-top" : sizeArray[2]+"px"});
}
});
}
function rerouteConfirm(target, question){
var where_to= confirm(question);
if (where_to== true)
{
window.location=target;
}
}
function callbackConfirm(question, callback, callbackParam){
var where_to = confirm(question);
if (where_to == true){
eval(callback+'('+callbackParam+')');
return true;
}else return false;
}
function displayShadowboxFrame(path,breite,hoehe,return_path) {
Shadowbox.open({
player: 'iframe',
content: path,
width: breite+'px',
height: hoehe+'px',
options:{
onClose: function(){
if (typeof(return_path) != 'undefined') {
parent.location.href=return_path;
}
}
}
});
}
function openShadowbox(contentVar, playerVar, titleVar, widthVar, heightVar){
Shadowbox.open({
content: contentVar,
player: playerVar,
title: titleVar,
width: widthVar,
height: heightVar
});
}
function openShadowboxImage(contentVar, playerVar, titleVar, gallery){
Shadowbox.open({
content: contentVar,
player: playerVar,
title: titleVar,
gallery: gallery
});
}
function openLayerIframe(url, width, height){
Shadowbox.open({
content: url,
type: "iframe",
player: "iframe",
height: height,
width: width,
options: {
modal: true,
enableKeys: false,
animate: false,
overlayOpacity: 0.3
}
});
}
function getParentId(element,spacer) {
id_row = $(element).parent().attr('id');
tmp = id_row.split(spacer);
number = tmp[tmp.length-1];
return number;
}
function calculateSquareMeter(preisElement,flaecheElement,target,hiddenField) {
preis = $.trim($('input[name='+preisElement+']').val());
flaeche = $.trim($('input[name='+flaecheElement+']').val());
preis = str_replace(' ','',preis);
preis = str_replace('.','',preis);
preis = str_replace(',','.',preis);
flaeche = str_replace(' ','',flaeche);
flaeche = str_replace('.','',flaeche);
flaeche = str_replace(',','.',flaeche);
if (isNumber(preis) && isNumber(flaeche)) {
var preis_pro_qm = parseFloat(preis) / parseFloat(flaeche);
result = extround(preis_pro_qm,2);
$('#'+target).html(result+' €');
$('#'+hiddenField).val(result+' €');
}
}
function refreshParentPage() {
window.location.reload();
}
function submitParentPage() {
$('#editpage').submit();
}
var openShadowboxAndRefreshParent = function(content, player, title, height, width, gallery){
if (typeof(player) == 'undefined') player = 'iframe';
if (typeof(title) == 'undefined') title = '';
if (typeof(height) == 'undefined') height = '';
if (typeof(width) == 'undefined') width = '';
if (typeof(gallery) == 'undefined') gallery = '';
Shadowbox.open({
content: content,
player: player,
title: title,
height: height,
width: width,
gallery: gallery,
options:{onClose: refreshParentPage} // no parentheses after function name - doesn't work with them.
});
}
var openShadowboxAndSubmitParent = function(content, player, title, height, width, gallery){
if (typeof(player) == 'undefined') player = 'iframe';
if (typeof(title) == 'undefined') title = '';
if (typeof(height) == 'undefined') height = '';
if (typeof(width) == 'undefined') width = '';
if (typeof(gallery) == 'undefined') gallery = '';
Shadowbox.open({
content: content,
player: player,
title: title,
height: height,
width: width,
gallery: gallery,
options:{onClose: submitParentPage} // no parentheses after function name - doesn't work with them.
});
}
function ajaxConfirm(question,ajaxAction,value,outputElement,callback)
{
var where_to = confirm(question);
if (where_to == true) {
showAjaxLoading();
$.ajax({
type: "POST",
url: "/inc/modules/ajax.includes.php",
data: "action="+ajaxAction+"&value="+value,
success: function(output){
$('#'+outputElement).html(output);
if (callback && typeof(callback) === "function") {
callback();
}
hideAjaxLoading();
}
});
}
}
function calculateDotTable(){
/*$('.dotTable tr').not('.noDotCalculation').each(function(index, element) {
var fullWi = $(element).width();
var childs = $(element).children('td');
var w1 = childs.eq(0).children(':first').outerWidth();
var w2 = childs.eq(1).children(':first').outerWidth();
var w3 = childs.eq(3).children(':first').outerWidth();
var fw = fullWi - w1 - w2 - w3 - 50;
childs.eq(2).width(fw);
});*/
}
function initKeyShortcuts(){
$(document).bind('keypress', function(event) {
// STRG + S
if( event.which === 115 && event.ctrlKey ) {
$('*[data-keycode="strg+s"]').trigger('click');
return false;
}
// STRG + O
if( event.which === 79 && event.ctrlKey ) {
$('*[data-keycode="strg+o"]').trigger('click');
return false;
}
});
}
/* Update a jqTransform Selectbox */
function updateJqSelect(selector) {
selectedVal = $(selector).children(':selected').val();
$(selector).children('option').removeAttr('selected');
$(selector).children('option[value="'+selectedVal+'"]').attr('selected','selected');
$(selector).removeClass('jqTransformHidden');
$(selector).css('display','block');
$(selector).prev('ul').remove();
/*$(selector).prev('div.selectWrapper').remove();*/
$(selector).prev('div.jqTransformElement').remove();
var selectElm = $(selector).closest('.jqTransformSelectWrapper').html();
$(selector).closest('.jqTransformSelectWrapper').after(selectElm);
$(selector).closest('.jqTransformSelectWrapper').remove();
$(selector).closest('form').removeClass('jqtransformdone');
$(selector).closest('form').jqTransform();
$(selector).removeAttr('style');
}
$.fn.jqTransSelectRefresh = function(){
return this.each(function(index){
var $select = $(this);
var i=$select.parent().find('div,ul').remove().css('zIndex');
$select.unwrap().removeClass('jqTransformHidden').jqTransSelect();
$select.parent().css('zIndex', i);
});
}
function copyEvents(source, destination) {
var events;
source = $(source).first();
destination = $(destination);
events = $(source).data('events');
if (!events) return;
destination.each(function() {
var t = $(this);
$.each(events, function(index, event) {
$.each(event, function(i, v) {
t.bind(v.type, v.handler);
});
});
});
}
function getLatLang(formSelector, latSelector, lngSelector){
$('input.noInput',formSelector).val('');
var data = $(formSelector).serializeObject();
if(data.strasse && data.plz && data.ort){
$.ajax({
type: "POST",
url: "/inc/modules/ajax.includes.php",
data: "action=getLatLng&strasse="+data.strasse+"&plz="+data.plz+"&ort="+data.ort,
success: function(output){
var splitter = output.split('|');
var lat = splitter[0];
var lng = splitter[1];
$(latSelector).val(lat);
$(lngSelector).val(lng);
}
});
}else{
alert('Bitte füllen Sie folgende Felder: Straße, PLZ / Ort');
}
}
$.fn.serializeObject = function(){
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name]) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
/**fix_select('select#my_updated_select_box');*/
function everyLastElementBold(selector, schnitt , transform , size ) {
/*
schnitt[ normal,
bold, <-- Basiswert | entspricht semibold
italic,
bolder, <-- entspricht bold
lighter]
transform[ uppercase,
lowercase,
capitalize]
size[größe zb. 18px o. 1em]
zum nutzen muss die changeBasicHtml.js im Projekt angepasst werden bsp. Mustermakler(Responsive2go)
*/
if (typeof(schnitt) == 'undefined') schnitt = false;
if (typeof(transform) == 'undefined') transform = false;
if (typeof(size) == 'undefined') size = false;
$(selector).each(function(index, element) {
var heading = $(element), word_array, last_word, first_part;
word_array = heading.html().split(/\s+/); /* Trennt alle worte anhand der Leerzeichen */
last_word = word_array.pop();
first_part = word_array.join(' ');
if (word_array.length >= 3){
heading.html([first_part, ' ', last_word, ''].join(''));
if (schnitt != false){
if (schnitt == "bold"){
$('.addLastElementProperties').css({"font-weight" : "bold"});
}else if (schnitt == "italic"){
$('.addLastElementProperties').css({"font-style" : "italic"});
}else if (schnitt == "bolder"){
$('.addLastElementProperties').css({"font-weight" : "bolder"});
}else if (schnitt == "lighter"){
$('.addLastElementProperties').css({"font-weight" : "lighter"});
}
}else{
$('.addLastElementProperties').css({"font-weight" : "bold"});
}
if (transform != false){
$('.addLastElementProperties').css({"text-transform" : transform});
}
if (size != false){
$('.addLastElementProperties').css({"font-size" : size});
}
}
});
homepageOnLoad();
}
function addCustomControlsToSlider(sliderInstance,selector,type) {
if (type == 'slick') {
$(selector+' .customArrow.prev').click(function(){
sliderInstance.$slider.slick('slickPrev');
});
$(selector+' .customArrow.next').click(function(){
sliderInstance.$slider.slick('slickNext');
});
$(selector+' .customBulletPoint').click(function(){
$(selector+' .customBulletPoint').not($(this)).removeClass('active');
$(this).removeClass('active');
index = $(this).attr("data-index");
sliderInstance.$slider.slick('slickGoTo', index);
});
}
if (type == 'bxslider') {
$(selector+' .customArrow.prev').click(function(){
sliderInstance.goToPrevSlide();
});
$(selector+' .customArrow.next').click(function(){
sliderInstance.goToNextSlide();
});
$(selector+' .customBulletPoint').click(function(){
$(selector+' .customBulletPoint').not($(this)).removeClass('active');
$(this).removeClass('active');
index = $(this).attr("data-index");
sliderInstance.goToSlide(index);
});
}
if (type == 'owl') {
$(selector+' .customArrow.prev').click(function(){
sliderInstance.prev();
});
$(selector+' .customArrow.next').click(function(){
sliderInstance.next();
});
$(selector+' .customBulletPoint').click(function(){
$(selector+' .customBulletPoint').not($(this)).removeClass('active');
$(this).removeClass('active');
index = $(this).attr("data-index");
sliderInstance.goTo(index);
});
}
}
function setCookiePermission() {
$('#cookieBar').slideUp(function(){
$(this).remove();
});
var data = $('#acceptCookies').serialize();
$.ajax({
type: "POST",
url: "/inc/modules/ajax.includes.php",
data: "set=cookiesettings&" + data,
success: function(output){
}
});
}
function deleteCookie(){
showAjaxLoading();
$.ajax({
type: "POST",
url: "/inc/modules/ajax.includes.php",
data: "delete=cookiesettings&",
success: function(output){
hideAjaxLoading();
alertErfolgMessage('Cookies für '+window.location.hostname+' wurden erfolgreich gelöscht.');
}
});
};
;
var error_content;
function submitAjaxForm(f,callback,outputDiv,adminSend,params) {
form_id = $(f).attr("id");
clearEmptyFormFields('#'+form_id);
if (adminSend == true) ajaxPath = "/modules/ajax.includes.php";
else ajaxPath = "/inc/modules/ajax.includes.php";
data_vars = $(f).serialize();
showAjaxLoading();
//Request abschicken
$.ajax({
url: ajaxPath,
type: "POST",
data: data_vars,
success: function (erfolgs_text) {
if (typeof(tinyMCE) != 'undefined' && typeof(clearAllTinyMCE) == 'function') {
clearAllTinyMCE(params);
}
if(typeof(outputDiv) == 'undefined' && (typeof(callback) == "undefined" || !callback)) {
alertErfolgMessage(erfolgs_text); /* Nicht auskommentieren */
} else {
/*console.log("OUTPUT", $(outputDiv));
console.log(erfolgs_text);*/
$(outputDiv).html(erfolgs_text);
makeBasicJQueryCalls(outputDiv);
}
if (callback && typeof(callback) === "function") {
window.setTimeout(callback, 300);
/*eval(callback+"('"+erfolgs_text+"')");*/
/*callback(erfolgs_text);*/
} else if (callback && typeof(callback) === "string") {
p = (typeof(params) !== 'undefined') ? params : erfolgs_text;
try {
var json = JSON.parse(p);
if (typeof(json.CODE) != 'undefined') eval(json.CODE);
} catch(e) {
eval(callback+"('"+p+"');");
}
}
hideAjaxLoading();
},
error: function(fehler_text) {
alertBasicErrorMessage(fehler_text);
}
});
}
function clearEmptyFormFields(formSelector) {
$(formSelector+' .noInput').each(function(e){
$(this).val('');
});
$(formSelector+' input, '+formSelector+' select, '+formSelector+' textarea').each(function(e){
value = $(this).val();
basicValue = $(this).attr('data-basicValue');
if (value == basicValue && basicValue != '') {
$(this).val('');
}
});
}
function showAjaxLoading(msg) {
if(typeof msg == 'undefined'){
msg = 'Bitte warten. Ihre Anfrage wird bearbeitet';
}
centerElement('ajax_loader');
$('#ajax_loader strong').html(msg);
$('#ajax_loader').show();
}
function hideAjaxLoading() {
$('#ajax_loader').hide();
}
// Formularanpassungen / Fehlerkorrekturen (ohne Formularprüfung)
function focusFormular(f, act1, act2){
var myForm=document.getElementById(f);
try{
myForm.action = act1+act2;
}catch(e){
myForm.setAttribute('action', act1+act2);
}
}
function setFormAndSubmit(formular,feld,wert) {
form = document.getElementById(formular);
form.elements[feld].value = wert;
$(form).find('input[type="submit"]').click();
}
function enterFormElement(element) {
if(element.hasClass("noInput")) {
element.removeClass('noInput');
element.val("");
}
}
function setBasicValues(jqElement) {
if (jqElement.attr("data-jquery") != 0) {
basicValue = jqElement.attr("data-basicValue");
realValue = jqElement.attr("data-realValue");
value = jqElement.val();
if (typeof(realValue) != 'undefined') {
jqElement.val(realValue);
jqElement.removeAttr("data-realValue");
}
if (true) {
if (!jqElement.hasClass('tinymce')) {
if (typeof(basicValue) != 'undefined' && basicValue != '' && jqElement.val() == '') {
if (basicValue.indexOf('*') == -1 && jqElement.hasClass("important")) {
basicValue += ' *';
}
jqElement.removeClass('error_input');
jqElement.addClass("noInput");
jqElement.val(basicValue);
}
}
}
/*
if (true) {
if (typeof(basicValue)!= 'undefined' && basicValue != '' && (jqElement.val() == '' || jqElement.hasClass("noInput")) && !jqElement.hasClass('tinymce')) {
if (basicValue.indexOf('*') == -1 && value.indexOf('*') == -1) {
if (jqElement.hasClass("important")) basicValue += ' *';
}
jqElement.removeClass('error_input');
jqElement.addClass("noInput");
jqElement.val(basicValue);
}
}
*/
}
}
function handleFormCallback(data,f,title) {
if (title != '') {
formTitle = title;
} else {
formTitle = f.attr("title");
if (typeof(formTitle) == 'undefined') formTitle = "Formular:";
}
if (data != '') {
try {
jsonObj = JSON.parse(data);
if (typeof(jsonObj) == 'object') {
if (jsonObj.MESSAGE != '' && typeof(jsonObj.MESSAGE) != 'undefined') {
alertMessage(formTitle,jsonObj.MESSAGE,jsonObj.TYPE);
}
if (jsonObj.CODE != '') eval(jsonObj.CODE);
} else {
if (erfolgs_text.indexOf("alertMessage") == 0) eval(data);
else alertMessage(formTitle,data, true);
}
} catch(err) {
alert(data);
}
}
}
function setErrorClassAndReturnMessage(element,customMessage){
$(element).parents().each(function(index,element){
if($(this).is('label') || $(this).is('tr') || $(this).hasClass('handleError')) {
$(this).addClass('error_input');
return false;
}
});
if (typeof(customMessage) != 'undefined' && customMessage != '') {
return customMessage+", ";
}
if (element.attr("title") != '' && typeof(element.attr("title")) != 'undefined') {
return element.attr("title")+", ";
}
return "";
}
function removeErrorClass(element) {
$(element).parents().each(function(index,e){
if($(this).hasClass('error_input')) {
$(this).removeClass('error_input');
return;
}
});
}
function checkRadioCheckboxButton(name) {
var checked = 0;
var checkElement = document.getElementsByName(name);
for (var x = 0; x < checkElement.length; x++) {
if (checkElement[x].checked) {
checked++;
}
}
if (checked == 0) {
for (var x = 0; x < checkElement.length; x++) {
$(checkElement[x]).parents().each(function(index,element){
if($(this).is('label') || $(this).is('tr') || $(this).hasClass('handleError') || $(this).hasClass('jqTransformCheckboxWrapper')) {
$(this).addClass('error_input');
return false;
}
});
}
return false;
} else {
return true;
}
}
function getElementsById(elementID){
var elementCollection = new Array();
var allElements = document.getElementsByTagName("*");
for(i = 0; i < allElements.length; i++){
if(allElements[i].id == elementID)
elementCollection.push(allElements[i]);
}
return elementCollection;
}
function checkFormContainerArea(selector){
formStatus = checkForm2014(selector,true,false,false,false,false,true);
return formStatus;
}
function checkFormAndGetStatus(f){
formStatus = checkForm(f,true,false,false,false,false,true);
return formStatus;
}
function checkForm2014(formElement,sendViaAjax,callback,outputDiv,adminSend,params,returnStatus){
if (sendViaAjax == '') sendViaAjax = false;
var alreadyChecked = new Array();
var error = 0;
var error_text = '';
var formContainer = $(formElement);
var formular = (formContainer.is('form')) ? formContainer : formContainer.parents('form');
$('input,select,textarea', formContainer).each(function(index, element){
value = $(this).val();
basicValue = $(this).attr('data-basicValue');
if ($(element).hasClass('noInput') || value == basicValue) $(element).val('');
});
error = 0;
$('input,select,textarea', formContainer).each(function(index, element){
var type = ($(element).is('textarea')) ? 'textarea' : $(element).attr('type');
var name = $(element).attr('name');
var title = $(element).attr('title');
var value = $(element).val();
if(type != 'hidden') {
if ($(element).hasClass('important')){
if ($(element).hasClass('noInput')) {
error_text += setErrorClassAndReturnMessage($(element));
error++;
alreadyChecked[alreadyChecked.length + 1] = name;
} else {
if (!$(element).hasClass('specialCheck') && (!in_array(name, alreadyChecked) || $(element).hasClass('notUnique'))) {
if ($(element).is('select')) type = 'select-one';
if (type == 'text' || type == 'select-one' || type == 'textarea') {
if (value == '') {
error_text += setErrorClassAndReturnMessage($(element));
error++;
}
alreadyChecked[alreadyChecked.length + 1] = name;
}
if (type == 'password') {
if (name == 'pw') {
var pw1 = value;
if (pw1 == '') {
error_text += setErrorClassAndReturnMessage($(element));
error++;
}
alreadyChecked[alreadyChecked.length + 1] = name;
var pw1Element = $(element);
var pw2Element = formContainer.find('input[name="pw2"]');
if (pw2Element.length > 0) {
var pw2 = pw2Element.val();
if (pw2 == '') {
error_text += setErrorClassAndReturnMessage($(pw2Element));
error++;
}
if (pw1 != pw2 && pw1 != '') {
setErrorClassAndReturnMessage($(pw1Element),"");
setErrorClassAndReturnMessage($(pw2Element),"");
error_text += "Beide Passwörter müssen übereinstimmen";
error++;
}
alreadyChecked[alreadyChecked.length + 1] = pw2Element.attr("name");
}
if (pw1Element.hasClass('strength') && (pw1Element.hasClass('weak') || pw1Element.hasClass('veryweak')) ) {
setErrorClassAndReturnMessage($(pw1Element),"");
error_text += "Das Passwort ist zu schwach";
error++;
}
}
}
if (type == 'radio' || type == 'checkbox') {
if (!checkRadioCheckboxButton(name)) {
error_text += title+", ";
error++;
}
alreadyChecked[alreadyChecked.length + 1] = name;
}
} else {
if ($(element).hasClass('specialCheck')) {
if ($(element).hasClass('typeEmail')) {
if (value == '' || strpos(value,'@') == false) {
setErrorClassAndReturnMessage($(element));
error++;
}
alreadyChecked[alreadyChecked.length + 1] = name;
}
if ($(element).hasClass('decimalNumber')) {
thisValue = valueString = value;
thisValue = thisValue.replace(",",".");
thisValue = parseFloat(thisValue);
if (valueString == '' || isNaN(thisValue)) {
setErrorClassAndReturnMessage($(element));
error++;
}
alreadyChecked[alreadyChecked.length + 1] = name;
}
if ($(element).hasClass('intNumber')) {
thisValue = valueString = value;
thisValue = parseInt(thisValue);
if (isNaN(thisValue) || (valueString.indexOf(",") >= 0 || valueString.indexOf(".") >= 0 || valueString == '')) {
setErrorClassAndReturnMessage($(element));
error++;
}
alreadyChecked[alreadyChecked.length + 1] = name;
}
if ($(element).hasClass('typeIBAN')) {
alert("check iban");
}
}
}
}
}
}
});
if (error > 0) {
basic_headline = 'Fehler im Formular';
basic_text = 'Bitte geben Sie alle Pflichtfelder an';
if (typeof(ERROR_MESSAGE_HEADLINE) != 'undefined') basic_headline = ERROR_MESSAGE_HEADLINE;
if (typeof(ERROR_MESSAGE_TEXT_REQUIRED) != 'undefined') basic_text = ERROR_MESSAGE_TEXT_REQUIRED;
error_text = error_text.substr(0,error_text.length-2);
error_text = "
"+basic_headline+"
"+basic_text+": "+error_text+"
";
alertBasicErrorMessage(error_text);
$('.noInput', formContainer).each(function(e){
setBasicValues($(this));
});
return false;
} else {
// Zweiter Paramter == true => Formular Mit AJAX abschicken
if (sendViaAjax == true) {
if (typeof(returnStatus) != 'undefined' && returnStatus == true) {
return (error > 0) ? false : true;
} else {
submitAjaxForm(formular,callback,outputDiv,adminSend,params);
return false;
}
} else
return true;
}
}
function checkForm(f,sendViaAjax,callback,outputDiv,adminSend,params,returnStatus){
var alreadyChecked = new Array();
var error = 0;
var error_text = '';
f = document.forms[$(f).attr("id")];
if(typeof(f) == "undefined") return true;
$('#'+$(f).attr("id")+' input, #'+$(f).attr("id")+' select, #'+$(f).attr("id")+' textarea').each(function(e){
value = $(this).val();
basicValue = $(this).attr('data-basicValue');
if (value == basicValue && basicValue != '') {
$(this).val('');
}
});
if(typeof f.elements != 'undefined') var anzahlElements = f.elements.length;
else var anzahlElements = 0;
if (sendViaAjax == '') sendViaAjax = false;
error_content = document.getElementById('message_content');
for(var i=0; i < anzahlElements; i++) {
name = f.elements[i].name;
type = f.elements[i].type;
if(type != 'hidden') {
if ($(f.elements[i]).hasClass('important')){
if ($(f.elements[i]).hasClass('noInput')) {
error_text +=setErrorClassAndReturnMessage($(f.elements[i]));
error++;
alreadyChecked[alreadyChecked.length + 1] = f.elements[i].name;
} else {
if (!$(f.elements[i]).hasClass('specialCheck') && (!in_array(f.elements[i].name, alreadyChecked) || $(f.elements[i]).hasClass('notUnique'))) {
if (type == 'text' || type == 'select-one' || type == 'select-multiple' || type == 'textarea') {
if (f.elements[i].value == '') {
error_text += setErrorClassAndReturnMessage($(f.elements[i]));
error++;
}
alreadyChecked[alreadyChecked.length + 1] = f.elements[i].name;
}
if (type == 'password') {
if (name == 'pw') {
var pw1 = f.elements[i].value;
if (pw1 == '') {
error_text += setErrorClassAndReturnMessage($(f.elements[i]));
error++;
} else if (typeof(f.elements['pw2']) != 'undefined') {
var pw2 = f.elements['pw2'].value;
if (pw2 == '') {
error_text += setErrorClassAndReturnMessage($(f.elements['pw2']));
error++;
}
if (pw1 != pw2 && pw1 != '') {
setErrorClassAndReturnMessage($(f.elements[i]),"");
setErrorClassAndReturnMessage($(f.elements["pw2"]),"");
error_text += "Beide Passwörter müssen übereinstimmen, ";
error++;
}
alreadyChecked[alreadyChecked.length + 1] = f.elements['pw2'].name;
}
if ($(f.elements['pw']).hasClass('strength') && ($(f.elements['pw']).hasClass('weak') || $(f.elements['pw']).hasClass('veryweak')) ) {
setErrorClassAndReturnMessage($(f.elements["pw"]),"");
error_text += "Das Passwort ist zu schwach, ";
error++;
}
alreadyChecked[alreadyChecked.length + 1] = f.elements[i].name;
}
}
if (type == 'radio' || type == 'checkbox') {
if (!checkRadioCheckboxButton(f.elements[i].name)) {
error_text += f.elements[i].title+", ";
error++;
}
alreadyChecked[alreadyChecked.length + 1] = f.elements[i].name;
}
} else {
if ($(f.elements[i]).hasClass('specialCheck')) {
if ($(f.elements[i]).hasClass('typeEmail')) {
if (f.elements[i].value == '' || strpos(f.elements[i].value,'@') == false) {
setErrorClassAndReturnMessage($(f.elements[i]));
error_text += "Gültige E-Mail, ";
error++;
}
alreadyChecked[alreadyChecked.length + 1] = f.elements[i].name;
}
if ($(f.elements[i]).hasClass('decimalNumber')) {
value = valueString = f.elements[i].value;
value = value.replace(",",".");
value = parseFloat(value);
if (valueString == '' || isNaN(value)) {
setErrorClassAndReturnMessage($(f.elements[i]));
error++;
}
alreadyChecked[alreadyChecked.length + 1] = f.elements[i].name;
}
if ($(f.elements[i]).hasClass('intNumber')) {
value = valueString = f.elements[i].value;
value = parseInt(value);
if (isNaN(value) || (valueString.indexOf(",") >= 0 || valueString.indexOf(".") >= 0 || valueString == '')) {
setErrorClassAndReturnMessage($(f.elements[i]));
error++;
}
alreadyChecked[alreadyChecked.length + 1] = f.elements[i].name;
}
if ($(f.elements[i]).hasClass('typeIBAN')) {
if (typeof(IBAN.isValid) !== 'undefined') {
value = valueString = f.elements[i].value;
status = IBAN.isValid(value);
if (status != true) {
setErrorClassAndReturnMessage($(f.elements[i]));
error_text += "Gültige IBAN, ";
error++;
}
alreadyChecked[alreadyChecked.length + 1] = f.elements[i].name;
}
}
if ($(f.elements[i]).hasClass('typeBIC')) {
value = valueString = f.elements[i].value;
regSWIFT = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/;
if(regSWIFT.test(value) == false) {
setErrorClassAndReturnMessage($(f.elements[i]));
error_text += "Gültige BIC, ";
error++;
}
}
}
}
}
}
}
}
if (error > 0) {
basic_headline = 'Fehler im Formular';
basic_text = 'Bitte geben Sie alle Pflichtfelder an';
if (typeof(ERROR_MESSAGE_HEADLINE) != 'undefined') basic_headline = ERROR_MESSAGE_HEADLINE;
if (typeof(ERROR_MESSAGE_TEXT_REQUIRED) != 'undefined') basic_text = ERROR_MESSAGE_TEXT_REQUIRED;
error_text = error_text.substr(0,error_text.length-2);
error_text = "
"+basic_headline+"
"+basic_text+": "+error_text+"
";
alertBasicErrorMessage(error_text);
$('#'+$(f).attr("id")+' .noInput').each(function(e){
setBasicValues($(this));
});
return false;
} else {
if (sendViaAjax == true) {
if (typeof(returnStatus) != 'undefined' && returnStatus == true) {
return (error > 0) ? false : true;
} else {
submitAjaxForm(f,callback,outputDiv,adminSend,params);
return false;
}
} else
return true;
}
}
function countLettersAndOutput(elem,output,textlen) {
text = elem.value;
anzLetter = text.length;
$('#'+output).html('Anzahl Zeichen: '+anzLetter);
if (anzLetter > textlen) {
$(elem).addClass('error_input');
} else {
$(elem).removeClass('error_input');
}
}
function countLettersAndWordsAndOutput(elem,output,spacer,textlen,wordlen) {
text = elem.value;
words = text.split(spacer);
anzLetter = text.length;
anzWords = words.length;
$('#'+output).html('Anzahl Wörter: '+anzWords+' Anzahl Zeichen: '+anzLetter);
if (anzLetter > textlen || anzWords > wordlen) {
$(elem).addClass('error_input');
} else {
$(elem).removeClass('error_input');
}
}
function add2SelectBoxAndRemove(formular, from_select, to_select) {
var x = 0;
var newArray = new Array();
var removeArray = new Array();
element_from = formular.elements[from_select];
element_to = formular.elements[to_select];
for (var i=0; i < element_from.options.length; i++){
if (element_from.options[i].selected) {
var newOption = document.createElement("option");
newOption.text = element_from.options[i].text;
newOption.value = element_from.options[i].value;
element_to.options.add(newOption);
element_from.remove(i);
--i;
}
}
}
function clearSelectBox(element) {
elem = document.getElementById(element);
elem.length = 0;
}
function selectAll(formular,selectBox) {
f = formular.name;
for (var i=0; i < formular.elements[selectBox].options.length; i++){
formular.elements[selectBox].options[i].selected = true;
}
}
function resetSelectBox(formular,selectBox) {
for (var i=0; i < formular.elements[selectBox].options.length; i++){
formular.elements[selectBox].options[i] = null
}
}
function add2SelectBox(formular, from_select, to_select) {
var x = 0;
var newArray = new Array();
var removeArray = new Array();
element_from = formular.elements[from_select];
element_to = formular.elements[to_select];
for (var i=0; i < element_from.options.length; i++){
if (element_from.options[i].selected) {
var newOption = document.createElement("option");
newOption.text = element_from.options[i].text;
newOption.value = element_from.options[i].value;
element_to.options.add(newOption);
element_from.options[i].selected = false;
}
}
}
function removeFromSelectBox(formular, form_select) {
var x = 0;
element_form = formular.elements[form_select];
for (var i=0; i < element_form.options.length; i++){
if (element_form.options[i].selected) {
element_form.remove(i);
--i;
}
}
}
/*========================[ Alte Funktionen die irgendwann ersetzt / abgelösst werden können ]=======================*/
function alertMessage(html,status) {
if (typeof(status) == 'undefined' || status == false) {
alertBasicErrorMessage(html);
} else {
alertErfolgMessage(html);
}
}
function alertBasicErrorMessage(error_text) {
if (error_text == '') {
error_text = '
Fehler im Formular
Bitte füllen Sie alle Pflichtfelder aus!
';
}
error_text = '
'+error_text+'
';
if (typeof(error_content) == 'undefined') {
error_content = document.getElementById('message_content');
}
error_content.innerHTML = error_text;
if(error_text) {
centerElement('form_message');
$('#form_message').removeClass('erfolg');
$('#form_message').addClass('fehler');
$('#form_message').fadeIn('slow');
}
}
function alertErfolgMessage(erfolg_text) {
if (erfolg_text) {
error_text = '
'+erfolg_text+'
';
if (typeof(error_content) == 'undefined') {
error_content = document.getElementById('message_content');
}
error_content.innerHTML = error_text;
centerElement('form_message');
$('#form_message').removeClass('fehler');
$('#form_message').addClass('erfolg');
$('#form_message').fadeIn('slow');
}
}
function centerElement(el) {
/*
var body = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ?
window.document.documentElement : window.document.body || null;
element = document.getElementById(el);
var win_h = (window.innerHeight || parseInt(body.clientHeight )) / 2;
var win_w = (window.innerWidth || parseInt(body.clientWidth)) / 2;
var height = ($('#'+el).height() / 2);
var width = ($('#'+el).width() / 2);
var t = win_h - height + parseInt(window.pageYOffset || body.scrollTop) ;
var l = win_w - width + parseInt(window.pageXOffset || body.scrollLeft);
element.style.top = t + 'px';
*/
box = $('#'+el);
boxWidth = box.width();
boxHeight = box.height();
box.css({
'left' : '50%',
'top' : '50%',
'margin-left': -(boxWidth / 2)+'px',
'margin-top': -(boxHeight / 2)+'px'
});
}
function hideMessageBox(message_box_id) {
$('#'+message_box_id).fadeOut('slow');
}
;
;
// JavaScript Document
function add2note(uid,objnr,text,buttonElement) {
showAjaxLoading();
if (typeof(text) == 'undefined') text = '';
if (typeof(buttonElement) == 'undefined') buttonElement = 'obj2note';
$.ajax({
type: "POST",
url: "/inc/modules/ajax.includes.php",
data: "uid="+uid+"&action=add2note&text="+text+"&objektnr_extern="+objnr,
success: function(output){
$('#'+buttonElement).addClass('added');
$('#'+buttonElement).attr('href','javascript:alert("Das Objekt ist bereits auf dem Merkzettel");');
$('#toMemorizedObjects').slideDown('fast');
$('#globalMerkzettelHolder').show('fast');
createIconElements();
hideAjaxLoading();
},
error: function(){
hideAjaxLoading();
}
});
}
function add2noteButton(buttonElement,uid,objnr) {
showAjaxLoading();
$.ajax({
type: "POST",
url: "/inc/modules/ajax.includes.php",
data: "uid="+uid+"&action=add2note&objektnr_extern="+objnr,
success: function(output){
$('#'+buttonElement).addClass('added');
$('#'+buttonElement).attr('href','javascript:alert("Das Objekt ist bereits auf dem Merkzettel");');
$('#toMemorizedObjects').slideDown('fast');
$('#globalMerkzettelHolder').show('fast');
createIconElements();
hideAjaxLoading();
},
error: function(){
hideAjaxLoading();
}
});
}
function removeFromNote(uid,objnr,target_id,effect) {
if (typeof(effect) == 'undefined') effect = "fadeOut";
showAjaxLoading();
$.ajax({
type: "POST",
url: "/inc/modules/ajax.includes.php",
data: "uid="+uid+"&action=removeFromNote&objektnr_extern="+objnr,
success: function(output){
eval("$('#obj_'+target_id)."+effect+"('slow')");
$('#memo_objektnr_extern_'+target_id).val('');
hideAjaxLoading();
},
error: function(){
hideAjaxLoading();
}
});
}
;
;
/*
* jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
* http://benalman.com/projects/jquery-dotimeout-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){var a={},c="doTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var f=d.call(arguments),e=b.apply(this,[c+f[0]].concat(f));return typeof f[0]==="number"||typeof f[1]==="number"?this:e};function b(l){var m=this,h,k={},g=l?$.fn:$,n=arguments,i=4,f=n[1],j=n[2],p=n[3];if(typeof f!=="string"){i--;f=l=0;j=n[1];p=n[2]}if(l){h=m.eq(0);h.data(l,k=h.data(l)||{})}else{if(f){k=a[f]||(a[f]={})}}k.id&&clearTimeout(k.id);delete k.id;function e(){if(l){h.removeData(l)}else{if(f){delete a[f]}}}function o(){k.id=setTimeout(function(){k.fn()},j)}if(p){k.fn=function(q){if(typeof p==="string"){p=g[p]}p.apply(m,d.call(n,i))===true&&!q?o():e()};o()}else{if(k.fn){j===undefined?e():k.fn(j===false);return true}else{e()}}}})(jQuery);;
;
/**
A jQuery version of window.resizeStop.
This creates a jQuery special event called "resizestop". This event fires after a certain number of milliseconds since the last resize event fired.
Additionally, as part of the event data that gets passed to the eventual handler function, the resizestop special event passes the size of the window in an object called "size".
For example:
$(window).bind('resizestop', function (e) {
console.log(e.data.size);
});
This is useful for performing actions that depend on the window size, but are expensive in one way or another - i.e. heavy DOM manipulation or asset loading that might be detrimental to performance if run as often as resize events can fire.
@name jQuery.event.special.resizestop
@requires jQuery 1.4.2
@namespace
*/
(function ($, setTimeout) {
var $window = $(window),
cache = $([]),
last = 0,
timer = 0,
size = {};
/**
Handles window resize events.
@private
@ignore
*/
function onWindowResize() {
last = $.now();
timer = timer || setTimeout(checkTime, 10);
}
/**
Checks if the last window resize was over the threshold. If so, executes all the functions in the cache.
@private
@ignore
*/
function checkTime() {
var now = $.now();
if (now - last < $.resizestop.threshold) {
timer = setTimeout(checkTime, 10);
} else {
clearTimeout(timer);
timer = last = 0;
size.width = $window.width();
size.height = $window.height();
cache.trigger('resizestop');
}
}
/**
Contains configuration settings for resizestop events.
@namespace
*/
$.resizestop = {
propagate: false,
threshold: 500
};
/**
Contains helper methods used by the jQuery special events API.
@namespace
@ignore
*/
$.event.special.resizestop = {
setup: function (data, namespaces) {
cache = cache.not(this); // Prevent duplicates.
cache = cache.add(this);
if (cache.length === 1) {
$window.bind('resize', onWindowResize);
}
},
teardown: function (namespaces) {
cache = cache.not(this);
if (!cache.length) {
$window.unbind('resize', onWindowResize);
}
},
add: function (handle) {
var oldHandler = handle.handler;
handle.handler = function (e) {
// Generally, we don't want this to propagate.
if (!$.resizestop.propagate) {
e.stopPropagation();
}
e.data = e.data || {};
e.data.size = e.data.size || {};
$.extend(e.data.size, size);
return oldHandler.apply(this, arguments);
};
}
};
})(jQuery, setTimeout);;
;
/*!
* jQuery resize event - v1.1 - 3/14/2010
* http://benalman.com/projects/jquery-resize-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// Script: jQuery resize event
//
// *Version: 1.1, Last updated: 3/14/2010*
//
// Project Home - http://benalman.com/projects/jquery-resize-plugin/
// GitHub - http://github.com/cowboy/jquery-resize/
// Source - http://github.com/cowboy/jquery-resize/raw/master/jquery.ba-resize.js
// (Minified) - http://github.com/cowboy/jquery-resize/raw/master/jquery.ba-resize.min.js (1.0kb)
//
// About: License
//
// Copyright (c) 2010 "Cowboy" Ben Alman,
// Dual licensed under the MIT and GPL licenses.
// http://benalman.com/about/license/
//
// About: Examples
//
// This working example, complete with fully commented code, illustrates a few
// ways in which this plugin can be used.
//
// resize event - http://benalman.com/code/projects/jquery-resize/examples/resize/
//
// About: Support and Testing
//
// Information about what version or versions of jQuery this plugin has been
// tested with, what browsers it has been tested in, and where the unit tests
// reside (so you can test it yourself).
//
// jQuery Versions - 1.3.2, 1.4.1, 1.4.2
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome, Opera 9.6-10.1.
// Unit Tests - http://benalman.com/code/projects/jquery-resize/unit/
//
// About: Release History
//
// 1.1 - (3/14/2010) Fixed a minor bug that was causing the event to trigger
// immediately after bind in some circumstances. Also changed $.fn.data
// to $.data to improve performance.
// 1.0 - (2/10/2010) Initial release
(function($,window,undefined){
'$:nomunge'; // Used by YUI compressor.
// A jQuery object containing all non-window elements to which the resize
// event is bound.
var elems = $([]),
// Extend $.resize if it already exists, otherwise create it.
jq_resize = $.resize = $.extend( $.resize, {} ),
timeout_id,
// Reused strings.
str_setTimeout = 'setTimeout',
str_resize = 'resize',
str_data = str_resize + '-special-event',
str_delay = 'delay',
str_throttle = 'throttleWindow';
// Property: jQuery.resize.delay
//
// The numeric interval (in milliseconds) at which the resize event polling
// loop executes. Defaults to 250.
jq_resize[ str_delay ] = 250;
// Property: jQuery.resize.throttleWindow
//
// Throttle the native window object resize event to fire no more than once
// every milliseconds. Defaults to true.
//
// Because the window object has its own resize event, it doesn't need to be
// provided by this plugin, and its execution can be left entirely up to the
// browser. However, since certain browsers fire the resize event continuously
// while others do not, enabling this will throttle the window resize event,
// making event behavior consistent across all elements in all browsers.
//
// While setting this property to false will disable window object resize
// event throttling, please note that this property must be changed before any
// window object resize event callbacks are bound.
jq_resize[ str_throttle ] = true;
// Event: resize event
//
// Fired when an element's width or height changes. Because browsers only
// provide this event for the window element, for other elements a polling
// loop is initialized, running every milliseconds
// to see if elements' dimensions have changed. You may bind with either
// .resize( fn ) or .bind( "resize", fn ), and unbind with .unbind( "resize" ).
//
// Usage:
//
// > jQuery('selector').bind( 'resize', function(e) {
// > // element's width or height has changed!
// > ...
// > });
//
// Additional Notes:
//
// * The polling loop is not created until at least one callback is actually
// bound to the 'resize' event, and this single polling loop is shared
// across all elements.
//
// Double firing issue in jQuery 1.3.2:
//
// While this plugin works in jQuery 1.3.2, if an element's event callbacks
// are manually triggered via .trigger( 'resize' ) or .resize() those
// callbacks may double-fire, due to limitations in the jQuery 1.3.2 special
// events system. This is not an issue when using jQuery 1.4+.
//
// > // While this works in jQuery 1.4+
// > $(elem).css({ width: new_w, height: new_h }).resize();
// >
// > // In jQuery 1.3.2, you need to do this:
// > var elem = $(elem);
// > elem.css({ width: new_w, height: new_h });
// > elem.data( 'resize-special-event', { width: elem.width(), height: elem.height() } );
// > elem.resize();
$.event.special[ str_resize ] = {
// Called only when the first 'resize' event callback is bound per element.
setup: function() {
// Since window has its own native 'resize' event, return false so that
// jQuery will bind the event using DOM methods. Since only 'window'
// objects have a .setTimeout method, this should be a sufficient test.
// Unless, of course, we're throttling the 'resize' event for window.
if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
var elem = $(this);
// Add this element to the list of internal elements to monitor.
elems = elems.add( elem );
// Initialize data store on the element.
$.data( this, str_data, { w: elem.width(), h: elem.height() } );
// If this is the first element added, start the polling loop.
if ( elems.length === 1 ) {
loopy();
}
},
// Called only when the last 'resize' event callback is unbound per element.
teardown: function() {
// Since window has its own native 'resize' event, return false so that
// jQuery will unbind the event using DOM methods. Since only 'window'
// objects have a .setTimeout method, this should be a sufficient test.
// Unless, of course, we're throttling the 'resize' event for window.
if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
var elem = $(this);
// Remove this element from the list of internal elements to monitor.
elems = elems.not( elem );
// Remove any data stored on the element.
elem.removeData( str_data );
// If this is the last element removed, stop the polling loop.
if ( !elems.length ) {
clearTimeout( timeout_id );
}
},
// Called every time a 'resize' event callback is bound per element (new in
// jQuery 1.4).
add: function( handleObj ) {
// Since window has its own native 'resize' event, return false so that
// jQuery doesn't modify the event object. Unless, of course, we're
// throttling the 'resize' event for window.
if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
var old_handler;
// The new_handler function is executed every time the event is triggered.
// This is used to update the internal element data store with the width
// and height when the event is triggered manually, to avoid double-firing
// of the event callback. See the "Double firing issue in jQuery 1.3.2"
// comments above for more information.
function new_handler( e, w, h ) {
var elem = $(this),
data = $.data( this, str_data );
// If called from the polling loop, w and h will be passed in as
// arguments. If called manually, via .trigger( 'resize' ) or .resize(),
// those values will need to be computed.
data.w = w !== undefined ? w : elem.width();
data.h = h !== undefined ? h : elem.height();
old_handler.apply( this, arguments );
};
// This may seem a little complicated, but it normalizes the special event
// .add method between jQuery 1.4/1.4.1 and 1.4.2+
if ( $.isFunction( handleObj ) ) {
// 1.4, 1.4.1
old_handler = handleObj;
return new_handler;
} else {
// 1.4.2+
old_handler = handleObj.handler;
handleObj.handler = new_handler;
}
}
};
function loopy() {
// Start the polling loop, asynchronously.
timeout_id = window[ str_setTimeout ](function(){
// Iterate over all elements to which the 'resize' event is bound.
elems.each(function(){
var elem = $(this),
width = elem.width(),
height = elem.height(),
data = $.data( this, str_data );
// If element size has changed since the last time, update the element
// data store and trigger the 'resize' event.
if ( width !== data.w || height !== data.h ) {
elem.trigger( str_resize, [ data.w = width, data.h = height ] );
}
});
// Loop.
loopy();
}, jq_resize[ str_delay ] );
};
})(jQuery,this);;
;
/* Copyright 2012, Ben Lin (http://dreamerslab.com/)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 1.0.15
*
* Requires: jQuery >= 1.2.3
*/
(function(a){a.fn.addBack=a.fn.addBack||a.fn.andSelf;a.fn.extend({actual:function(b,l){if(!this[b]){throw'$.actual => The jQuery method "'+b+'" you called does not exist';}var f={absolute:false,clone:false,includeMargin:false};var i=a.extend(f,l);var e=this.eq(0);var h,j;if(i.clone===true){h=function(){var m="position: absolute !important; top: -1000 !important; ";e=e.clone().attr("style",m).appendTo("body");};j=function(){e.remove();};}else{var g=[];var d="";var c;h=function(){c=e.parents().addBack().filter(":hidden");d+="visibility: hidden !important; display: block !important; ";if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);g.push(m.attr("style"));m.attr("style",d);});};j=function(){c.each(function(m){var o=a(this);var n=g[m];if(n===undefined){o.removeAttr("style");}else{o.attr("style",n);}});};}h();var k=/(outer)/.test(b)?e[b](i.includeMargin):e[b]();j();return k;}});})(jQuery);;
;
/*!
Autosize v1.18.4 - 2014-01-11
Automatically adjust textarea height based on user input.
(c) 2014 Jack Moore - http://www.jacklmoore.com/autosize
license: http://www.opensource.org/licenses/mit-license.php
*/
(function ($) {
var
defaults = {
className: 'autosizejs',
append: '',
callback: false,
resizeDelay: 10,
placeholder: true
},
// border:0 is unnecessary, but avoids a bug in Firefox on OSX
copy = '',
// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
typographyStyles = [
'fontFamily',
'fontSize',
'fontWeight',
'fontStyle',
'letterSpacing',
'textTransform',
'wordSpacing',
'textIndent'
],
// to keep track which textarea is being mirrored when adjust() is called.
mirrored,
// the mirror element, which is used to calculate what size the mirrored element should be.
mirror = $(copy).data('autosize', true)[0];
// test that line-height can be accurately copied.
mirror.style.lineHeight = '99px';
if ($(mirror).css('lineHeight') === '99px') {
typographyStyles.push('lineHeight');
}
mirror.style.lineHeight = '';
$.fn.autosize = function (options) {
if (!this.length) {
return this;
}
options = $.extend({}, defaults, options || {});
if (mirror.parentNode !== document.body) {
$(document.body).append(mirror);
}
return this.each(function () {
var
ta = this,
$ta = $(ta),
maxHeight,
minHeight,
boxOffset = 0,
callback = $.isFunction(options.callback),
originalStyles = {
height: ta.style.height,
overflow: ta.style.overflow,
overflowY: ta.style.overflowY,
wordWrap: ta.style.wordWrap,
resize: ta.style.resize
},
timeout,
width = $ta.width();
if ($ta.data('autosize')) {
// exit if autosize has already been applied, or if the textarea is the mirror element.
return;
}
$ta.data('autosize', true);
if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){
boxOffset = $ta.outerHeight() - $ta.height();
}
// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
$ta.css({
overflow: 'hidden',
overflowY: 'hidden',
wordWrap: 'break-word', // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
//resize: ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal'
});
// The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
// window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower.
function setWidth() {
var width;
var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;
if (style) {
width = ta.getBoundingClientRect().width;
if (width === 0) {
width = parseInt(style.width,10);
}
$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
width -= parseInt(style[val],10);
});
} else {
width = Math.max($ta.width(), 0);
}
//mirror.style.width = width + 'px';
}
function initMirror() {
var styles = {};
mirrored = ta;
mirror.className = options.className;
maxHeight = parseInt($ta.css('maxHeight'), 10);
// mirror is a duplicate textarea located off-screen that
// is automatically updated to contain the same text as the
// original textarea. mirror always has a height of 0.
// This gives a cross-browser supported way getting the actual
// height of the text, through the scrollTop property.
$.each(typographyStyles, function(i,val){
styles[val] = $ta.css(val);
});
$(mirror).css(styles);
setWidth();
// Chrome-specific fix:
// When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
// made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
if (window.chrome) {
var width = ta.style.width;
ta.style.width = '0px';
var ignore = ta.offsetWidth;
ta.style.width = width;
}
}
// Using mainly bare JS in this function because it is going
// to fire very often while typing, and needs to very efficient.
function adjust() {
var height, original;
if (mirrored !== ta) {
initMirror();
} else {
setWidth();
}
if (!ta.value && options.placeholder) {
// If the textarea is empty, copy the placeholder text into
// the mirror control and use that for sizing so that we
// don't end up with placeholder getting trimmed.
mirror.value = ($(ta).attr("placeholder") || '') + options.append;
} else {
mirror.value = ta.value + options.append;
}
mirror.style.overflowY = ta.style.overflowY;
original = parseInt(ta.style.height,10);
// Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
mirror.scrollTop = 0;
mirror.scrollTop = 9e4;
// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
height = mirror.scrollTop;
if (maxHeight && height > maxHeight) {
ta.style.overflowY = 'scroll';
height = maxHeight;
} else {
ta.style.overflowY = 'hidden';
if (height < minHeight) {
height = minHeight;
}
}
height += boxOffset;
if (original !== height) {
ta.style.height = height + 'px';
if (callback) {
options.callback.call(ta,ta);
}
}
}
function resize () {
clearTimeout(timeout);
timeout = setTimeout(function(){
var newWidth = $ta.width();
if (newWidth !== width) {
width = newWidth;
adjust();
}
}, parseInt(options.resizeDelay,10));
}
if ('onpropertychange' in ta) {
if ('oninput' in ta) {
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those occasions. There is no way that I
// know of to detect something like 'cut' in IE9.
$ta.on('input.autosize keyup.autosize', adjust);
} else {
// IE7 / IE8
$ta.on('propertychange.autosize', function(){
if(event.propertyName === 'value'){
adjust();
}
});
}
} else {
// Modern Browsers
$ta.on('input.autosize', adjust);
}
// Set options.resizeDelay to false if using fixed-width textarea elements.
// Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize.
if (options.resizeDelay !== false) {
$(window).on('resize.autosize', resize);
}
// Event for manual triggering if needed.
// Should only be needed when the value of the textarea is changed through JavaScript rather than user input.
$ta.on('autosize.resize', adjust);
// Event for manual triggering that also forces the styles to update as well.
// Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method.
$ta.on('autosize.resizeIncludeStyle', function() {
mirrored = null;
adjust();
});
$ta.on('autosize.destroy', function(){
mirrored = null;
clearTimeout(timeout);
$(window).off('resize', resize);
$ta
.off('autosize')
.off('.autosize')
.css(originalStyles)
.removeData('autosize');
});
// Call adjust in case the textarea already contains text.
adjust();
});
};
}(window.jQuery || window.$)); // jQuery or jQuery-like library, such as Zepto
;
;
/*
* VenoBox - jQuery Plugin
* version: 1.3.4
* @requires jQuery
*
* Examples at http://lab.veno.it/venobox/
* License: Creative Commons Attribution 3.0 License
* License URI: http://creativecommons.org/licenses/by/3.0/
* Copyright 2013-2014 Nicola Franchini - @nicolafranchini
*
*/
(function(D){var u,k,n,M,y,G,i,x,z,f,H,c,l,r,J,q,j,P,R,I,t,v,N,C,A,b,g,d,Q,e,O,w,a,o,B;D.fn.extend({venobox:function(S){var T={framewidth:"",frameheight:"",border:"0",bgcolor:"#fff",numeratio:false,infinigall:false};var S=D.extend(T,S);return this.each(function(){var U=D(this);U.addClass("vbox-item");U.data("framewidth",S.framewidth);U.data("frameheight",S.frameheight);U.data("border",S.border);U.data("bgcolor",S.bgcolor);U.data("numeratio",S.numeratio);U.data("infinigall",S.infinigall);u=(navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?true:false);k=((document.all&&!window.atob)?true:false);U.click(function(V){V.stopPropagation();V.preventDefault();U=D(this);n=U.data("overlay");J=U.data("framewidth");q=U.data("frameheight");j=U.data("border");P=U.data("bgcolor");A=false;b=false;g=false;z=U.attr("href");f=D(window).scrollTop();f=-f;D("body").wrapInner('');y=D(".vwrap");x='
');
var $wrapper = $input.parent().parent().parent();
$wrapper.css("width", inputSize+10);
$input
.focus(function(){$wrapper.addClass("jqTransformInputWrapper_focus");})
.blur(function(){$wrapper.removeClass("jqTransformInputWrapper_focus");})
.hover(function(){$wrapper.addClass("jqTransformInputWrapper_hover");},function(){$wrapper.removeClass("jqTransformInputWrapper_hover");})
;
/* If this is safari we need to add an extra class */
$.browser.safari && $wrapper.addClass('jqTransformSafari');
$.browser.safari && $input.css('width',$wrapper.width()+16);
this.wrapper = $wrapper;
});
};
/***************************
Check Boxes
***************************/
$.fn.jqTransCheckBox = function(){
return this.each(function(){
if($(this).hasClass('jqTransformHidden')) {return;}
var $input = $(this);
if($input.hasClass('jqtranformdone') || !$input.is('input') || $input.hasClass('nojq')) {return;}
$input.addClass('jqtranformdone');
var inputSelf = this;
//set the click on the label
var oLabel=jqTransformGetLabel($input);
/*oLabel && oLabel.click(function(){aLink.trigger('click');});*/
oLabel && oLabel.click(function(){
var forAttr = null;
if(forAttr = $(this).attr('for')) {
var element = $(this).siblings('#' + forAttr);
if(element.length) {
element.trigger('click');
}
}
else {
aLink.trigger('click');
}
});
var aLink = $('');
//wrap and add the link
$input.addClass('jqTransformHidden').wrap('').parent().prepend(aLink);
//on change, change the class of the link
$input.change(function(){
this.checked && aLink.addClass('jqTransformChecked') || aLink.removeClass('jqTransformChecked');
return true;
});
// Click Handler, trigger the click and change event on the input
aLink.click(function(){
//do nothing if the original input is disabled
if($input.attr('disabled')){return false;}
//trigger the envents on the input object
$input.trigger('click').trigger("change");
return false;
});
// set the default state
this.checked && aLink.addClass('jqTransformChecked');
});
};
/***************************
Radio Buttons
***************************/
$.fn.jqTransRadio = function(){
return this.each(function(){
if($(this).hasClass('jqTransformHidden') || $(this).hasClass('nojq')) {return;}
var $input = $(this);
var inputSelf = this;
oLabel = jqTransformGetLabel($input);
/*oLabel && oLabel.click(function(){aLink.trigger('click');});*/
oLabel && oLabel.click(function(){
var forAttr = null;
if(forAttr = $(this).attr('for')) {
/*var element = $(this).siblings('#' + forAttr);*/
var element = $('#' + forAttr).prev();
if(element.length) {
element.trigger('click');
}
}
else {
aLink.trigger('click');
}
});
var aLink = $('');
$input.addClass('jqTransformHidden').wrap('').parent().prepend(aLink);
$input.change(function(){
inputSelf.checked && aLink.addClass('jqTransformChecked') || aLink.removeClass('jqTransformChecked');
return true;
});
// Click Handler
aLink.click(function(){
if($input.attr('disabled')){return false;}
$input.trigger('click').trigger('change');
// uncheck all others of same name input radio elements
$('input[name="'+$input.attr('name')+'"]',inputSelf.form).not($input).each(function(){
$(this).attr('type')=='radio' && $(this).trigger('change');
});
return false;
});
// set the default state
inputSelf.checked && aLink.addClass('jqTransformChecked');
});
};
/***************************
TextArea
***************************/
$.fn.jqTransTextarea = function(){
return this.each(function(){
var textarea = $(this);
if(textarea.hasClass('jqtransformdone') || textarea.hasClass('nojq')) {return;}
textarea.addClass('jqtransformdone');
oLabel = jqTransformGetLabel(textarea);
oLabel && oLabel.click(function(){textarea.focus();});
textarea.addClass("jqTransformTextarea").wrap('
');
var $wrapper = textarea.parent().parent().parent();
if (textarea.hasClass("fullWidth")) {
$wrapper.css("width", "100%");
textarea.css("width",$wrapper.width() - 20);
}
else {
$wrapper.css("width", textarea.width()+10);
}
textarea
.focus(function(){$wrapper.addClass("jqTransformTextareaWrapper_focus");})
.blur(function(){$wrapper.removeClass("jqTransformTextareaWrapper_focus");})
.hover(function(){$wrapper.addClass("jqTransformTextareaWrapper_hover");},function(){$wrapper.removeClass("jqTransformTextareaWrapper_hover");})
;
/*
var strTable = '
';
strTable +='
';
strTable +='
';
strTable +='
';
strTable +='
';
var oTable = $(strTable)
.insertAfter(textarea)
.hover(function(){
!oTable.hasClass('jqTransformTextarea-focus') && oTable.addClass('jqTransformTextarea-hover');
},function(){
oTable.removeClass('jqTransformTextarea-hover');
})
;
textarea
.focus(function(){oTable.removeClass('jqTransformTextarea-hover').addClass('jqTransformTextarea-focus');})
.blur(function(){oTable.removeClass('jqTransformTextarea-focus');})
.appendTo($('#jqTransformTextarea-mm div',oTable))
;
this.oTable = oTable;
if($.browser.safari){
$('#jqTransformTextarea-mm',oTable)
.addClass('jqTransformSafariTextarea')
.find('div')
.css('height',textarea.height())
.css('width',textarea.width())
;
}
*/
});
};
/***************************
Select
***************************/
$.fn.jqTransSelect = function(){
return this.each(function(index){
var $select = $(this);
//$select.css('display','none');
//var parentWidth = $select.parent().width();
var parentWidth = $select.width();
//$select.css('display','');
if($select.hasClass('jqTransformHidden') || $select.hasClass('nojq')) {return;}
if($select.attr('multiple')) {return;}
var extraClass = ($select.hasClass('noSelectBody')) ? 'noSelectBody' : '';
var newZindex = (10-index > 0) ? 10-index : 1;
var oLabel = jqTransformGetLabel($select);
/* First thing we do is Wrap it */
var $wrapper = $select
.addClass('jqTransformHidden')
.wrap('')
.parent()
.css({zIndex: newZindex})
;
/* Now add the html for the select */
if(typeof formDropdownArrowClass != 'undefined'){
var dropDownIconClass = formDropdownArrowClass;
}else{
var dropDownIconClass = 'icon-angle-down';
}
$wrapper.prepend('
');
//var $ul = $('ul', $wrapper).css('width',parentWidth).hide();
var $ul = $('ul', $wrapper).hide();
/* Now we add the options */
$('option', this).each(function(i){
//var oLi = $('