
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - helbling.js - */
// http://www.helbling-group.com/portal_javascripts/helbling.js?original=1
function randint(max){return Math.floor(Math.random()*max)}
function animateVisual(t1,t2){jq("#viewlet-above-content").animate({"height":77},t1,"linear", function(){jq(this).find("img").fadeOut(t2)})}
function getUrlVars(){var vars=[],hash;var hashes=window.location.href.slice(window.location.href.indexOf('?')+1).split('&');for(var i=0;i<hashes.length;i++){hash=hashes[i].split('=');vars.push(hash[0]);vars[hash[0]]=hash[1]}
return vars}
jq(document).ready(function(){var t1=1000;var t2=4000;var t3=1400;jq(".navTreeLevel0>li").prepend("<span class='expand'>&nbsp;</span>");jq(".navTreeItem span.expand").live("click", function(){var subtree=jq(this).parent().children("ul.navTree");if(subtree.length>0){jq(this).removeClass("expand").addClass("collapse");subtree.slideDown()}});jq(".navTreeItem span.collapse").live("click", function(){var subtree=jq(this).parent().children("ul.navTree");if(subtree.length>0){jq(this).removeClass("collapse").addClass("expand");subtree.slideUp()}});jq("li.navTreeItemInPath>ul").show();jq("li.navTreeItemInPath>span.expand").removeClass("expand").addClass("collapse");jq("li.navTreeCurrentNode>ul").show();jq("li.navTreeCurrentNode>span.expand").removeClass("expand").addClass("collapse");jq(".section-htk .navTreeLevel2").closest("li").prepend("<span class='expand'>&nbsp;</span>");jq(".section-htk .navTreeLevel0>li:first-child>.expand").click();jq(".section-htk .navTreeLevel0>li:first-child .navTreeLevel1>li>.expand").click();jq(".section-htk .navTreeLevel0>li:first-child .navTreeLevel1>li>div>a").removeAttr("href");jq(".section-htk .navTreeLevel0>li:first-child .navTreeLevel1>li>span").remove();jq(".section-htk .navTreeLevel0>li:first-child .navTreeLevel1>li>div>a").addClass("navtitle");jq(".section-hbp .navTreeLevel2").closest("li").prepend("<span class='expand'>&nbsp;</span>");jq(".section-hbp .navTreeLevel2").closest("li").addClass("nohover");jq(".section-hbp .navTreeItem ul").closest("li").find("div>a.navTreeFolderish").click(function(e){e.preventDefault();jq(this).parent().prev("span").click()});if(jq("body").hasClass("section-htk")){var a=[];jq(".projectItem").each(function(i){a[i]=jq(this).html();jq(this).html("")});jq(".projectItem").each(function(i){var r=randint(a.length);jq(this).html(a.splice(r,1)[0])})}
if(jq(".section-htk.section-unsere-leistungen.section-leistungen.template-document_view").length){var i=document.createElement("img");i.src="HTK_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
if(jq(".section-hmc.section-management-consulting.section-dienstleistungen.template-document_view").length){var i=document.createElement("img");i.src="HMC_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
if(jq(".section-hcf.section-helbling-corporate-finance.template-document_view").length){var i=document.createElement("img");i.src="HCF_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
if(jq(".section-his.section-dienstleistungen.section-helbling-it-solutions.template-document_view").length){var i=document.createElement("img");i.src="HIS_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
if(jq(".section-hbp.section-helbling-beratung-bauplanung.template-document_view").length){var i=document.createElement("img");i.src="HBP_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
if(jq(".section-htk.section-services.section--1.template-document_view").length){var i=document.createElement("img");i.src="HTK_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
if(jq(".section-hmc.section-services.section-dienstleistungen.template-document_view").length){var i=document.createElement("img");i.src="HMC_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
if(jq(".section-hcf.section-helbling-corporate-finance-1.template-document_view").length){var i=document.createElement("img");i.src="HCF_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
if(jq(".section-his.section-services.section-helbling-it-solutions.template-document_view").length){var i=document.createElement("img");i.src="HIS_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
if(jq(".section-hbp.section-helbling-beratung-bauplanung-en.template-document_view").length){var i=document.createElement("img");i.src="HBP_large.jpg";jq("#viewlet-above-content").html(i);jq("#viewlet-above-content").css({"padding":0,"overflow":"hidden"});window.setTimeout("animateVisual("+t1+","+t2+")",t3)}
jq("a[href*=/alumni]").attr('target','_blank');jq("#portal-breadcrumbs a[href*=projektbeispiele]").removeAttr("href");jq(".navTreeItem a[href*=projektbeispiele]").parent().parent().hide();jq("#portal-breadcrumbs a[href*=project-examples]").removeAttr("href");jq(".navTreeItem a[href*=project-examples]").parent().parent().hide();jq(".section-hbp .portletNavigationTree ul.navTreeLevel0>li:first-child>span.expand").click();jq(".section-hbp .portletNavigationTree ul.navTreeLevel0>li:first-child>div>a").click(function(){window.location="http://www.helbling.ch/hbp"})});

/* - ++resource++pipbox.js - */
/*****************

   PIPbox tools for attaching JQuery Tools bling to CSS with option
   parameter strings.
   
   This uses overlayhelpers.js in plone.app.jquerytools for most of
   the real work.

*****************/


/******
    pb.doSetup
    parameter: an options object(p)
    options vary by type and subtype of bling.
******/
pb.doSetup = function(p) {
    switch (p.type) {
    case 'overlay':
        jQuery(function() {
            jQuery(p.selector).prepOverlay(p);
        });
        break;
    case 'tabs':
        jQuery(function() {
            var config = p.config || {};
            config.tabs = p.tabs || config.tabs || 'a';
            jQuery(p.tabcontainer).addClass('pbactive').tabs(p.panes, config);
            jQuery(p.panes).addClass('pbactive');
        });
        break;
    }
};


/******
    pb.doConfig
    parameter: a config object(s)
    for JQ Tools global configuration
******/
pb.doConfig = function(p) {
    var tools = jQuery.tools;
    var tool = p.tool;

    if (tool) {
        for (var key in p) {
            if (key != 'tool') {
                tools[tool].conf[key] = p[key];
            }
        }
    }
};


/* - popupforms.js - */
/*jslint browser: true, laxbreak: true */
/*global jQuery */

/******
    Standard popups
******/

var common_content_filter = '#content>*:not(div.configlet),dl.portalMessage.error,dl.portalMessage.info';
var common_jqt_config = {fixed:false,speed:'fast',mask:{color:'#000',opacity: 0.4,loadSpeed:0,closeSpeed:0}};
jQuery.extend(jQuery.tools.overlay.conf, common_jqt_config);


jQuery(function($){

    if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7) {
        // it's not realistic to think we can deal with all the bugs
        // of IE 6 and lower. Fortunately, all this is just progressive
        // enhancement.
        return;
    }
    
    // method to show error message in a noform
    // situation.
    function noformerrorshow(el, noform) {
        var o = $(el);
        var emsg = o.find('dl.portalMessage.error');
        if (emsg.length) {
            o.children().replaceWith(emsg);
            return false;
        } else {
            return noform;
        }
    }

    // After deletes we need to redirect to the target page.
    function redirectbasehref(el, responseText) {
        var mo = responseText.match(/<base href="(.+?)"/i);
        if (mo.length === 2) {
            return mo[1];
        }
        return location;
    }



});



