
/* 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 -
 */

/* - input-label.js - */
// http://www.energie-cluster.ch/portal_javascripts/input-label.js?original=1
var ploneInputLabel={focus: function(){var t=jQuery(this);if(t.hasClass('inputLabelActive')&&t.val()===t.attr('title')){t.val('').removeClass('inputLabelActive')}
if(t.hasClass('inputLabelPassword')){ploneInputLabel._setInputType(t.removeClass('inputLabelPassword'),'password').focus().bind('blur.ploneInputLabel',ploneInputLabel.blur)}},blur: function(e){var t=jQuery(this);if(t.is(':password[value=""]')){t=ploneInputLabel._setInputType(this,'text').addClass('inputLabelPassword').bind('focus.ploneInputLabel',ploneInputLabel.focus);if(e.originalEvent&&e.originalEvent.explicitOriginalTarget){jQuery(e.originalEvent.explicitOriginalTarget).trigger('focus!')}}
if(!t.val()){t.addClass('inputLabelActive').val(t.attr('title'))}},submit: function(){jQuery('input[title].inputLabelActive').trigger('focus.ploneInputLabel')},_setInputType: function(elem,ntype){var $=jQuery,otype,nelem;otype=new RegExp('type="?'+$(elem).attr('type')+'"?');nelem=$($('<div></div>').append($(elem).clone()).html().replace(otype,'').replace(/\/?>/,'type="'+ntype+'" />'));$(elem).replaceWith(nelem);return nelem}};jQuery(function($){$('form:has(input[title].inputLabel)').submit(ploneInputLabel.submit);$('input[title].inputLabel').bind('focus.ploneInputLabel',ploneInputLabel.focus).bind('blur.ploneInputLabel',ploneInputLabel.blur).trigger('blur.ploneInputLabel')});

/* - jquery.highlightsearchterms.js - */
// http://www.energie-cluster.ch/portal_javascripts/jquery.highlightsearchterms.js?original=1
(function($){var Highlighter,makeSearchKey,makeAddress,defaults;Highlighter=function(options){$.extend(this,options);this.terms=this.cleanTerms(this.terms.length?this.terms:this.getSearchTerms())};Highlighter.prototype={highlight: function(startnode){if(!this.terms.length||!startnode.length){return}
var self=this;$.each(this.terms, function(i,term){startnode.find('*:not(textarea)').andSelf().contents().each(function(){if(this.nodeType===3){self.highlightTermInNode(this,term)}})})},highlightTermInNode: function(node,word){var c=node.nodeValue,self=this,highlight,ci,index,next;if($(node).parent().hasClass(self.highlightClass)){return}
highlight=function(content){return $('<span class="'+self.highlightClass+'">'+content+'</span>')};ci=self.caseInsensitive;while(c&&(index=(ci?c.toLowerCase():c).indexOf(word))>-1){$(node).before(document.createTextNode(c.substr(0,index))).before(highlight(c.substr(index,word.length))).before(document.createTextNode(c.substr(index+word.length)));next=node.previousSibling;$(node).remove();node=next;c=node.nodeValue}},queryStringValue: function(uri,regexp){var match,pair;if(uri.indexOf('?')<0){return ''}
uri=uri.substr(uri.indexOf('?')+1);while(uri.indexOf('=')>=0){uri=uri.replace(/^\&*/,'');pair=uri.split('&',1)[0];uri=uri.substr(pair.length);match=pair.match(regexp);if(match){return decodeURIComponent(match[match.length-1].replace(/\+/g,' '))}}
return ''},termsFromReferrer: function(){var ref,i,se;ref=$.fn.highlightSearchTerms._test_referrer!==null?$.fn.highlightSearchTerms._test_referrer:document.referrer;if(!ref){return ''}
for(i=0;i<this.referrers.length;i+=1){se=this.referrers[i];if(ref.match(se.address)){return this.queryStringValue(ref,se.key)}}
return ''},cleanTerms: function(terms){var self=this;return $.unique($.map(terms, function(term){term=$.trim(self.caseInsensitive?term.toLowerCase():term);return(!term||self.filterTerms.test(term))?null:term}))},getSearchTerms: function(){var terms=[],uri=$.fn.highlightSearchTerms._test_location!==null?$.fn.highlightSearchTerms._test_location:location.href;if(this.useReferrer){$.merge(terms,this.termsFromReferrer().split(/\s+/))}
if(this.useLocation){$.merge(terms,this.queryStringValue(uri,this.searchKey).split(/\s+/))}
return terms}};makeSearchKey=function(key){return(typeof key==='string')?new RegExp('^'+key+'=(.*)$','i'):key};makeAddress=function(addr){return(typeof addr==='string')?new RegExp('^https?://(www\\.)?'+addr,'i'):addr};$.fn.highlightSearchTerms=function(options){options=$.extend({},defaults,options);options=$.extend(options,{searchKey:makeSearchKey(options.searchKey),referrers:$.map(options.referrers, function(se){return{address:makeAddress(se.address),key:makeSearchKey(se.key)}})});if(options.includeOwnDomain){var hostname=$.fn.highlightSearchTerms._test_location!==null?$.fn.highlightSearchTerms._test_location:location.hostname;options.referrers.push({address:makeAddress(hostname.replace(/\./g,'\\.')),key:options.searchKey})}
new Highlighter(options).highlight(this);return this};$.fn.highlightSearchTerms.referrers=[{address:'google\\.',key:'q'},{address:'search\\.yahoo\\.',key:'p'},{address:'search\\.msn\\.',key:'q'},{address:'search\\.live\\.',key:'query'},{address:'search\\.aol\\.',key:'userQuery'},{address:'ask\\.com',key:'q'},{address:'altavista\\.',key:'q'},{address:'feedster\\.',key:'q'}];defaults={terms:[],useLocation:true,searchKey:'(searchterm|SearchableText)',useReferrer:true,referrers:$.fn.highlightSearchTerms.referrers,includeOwnDomain:true,caseInsensitive:true,filterTerms:/(not|and|or)/i,highlightClass:'highlightedSearchTerm'};$.fn.highlightSearchTerms._test_location=null;$.fn.highlightSearchTerms._test_referrer=null;$.fn.highlightSearchTerms._highlighter=Highlighter}(jQuery));jQuery(function($){$('#region-content,#content').highlightSearchTerms({includeOwnDomain:$('dl.searchResults').length===0})});

/* - ec_methods.js - */
// http://www.energie-cluster.ch/portal_javascripts/ec_methods.js?original=1
function remove_input_val(form_name,field_name){document[form_name][field_name].value=''}
function inout_selectAllWords(theList){myList=document.getElementById(theList);for(var x=0;x<myList.length;x++){myList[x].selected="selected"}}
function inout_selectOneWords(theList,lindex){myList=document.getElementById(theList);myList[lindex].selected="selected"}
function inout_addNewKeyword(toList,newText,newValue){theToList=document.getElementById(toList);for(var x=0;x<theToList.length;x++){if(theToList[x].text==newText){return false}}
theLength=theToList.length;theToList[theLength]=new Option(newText);theToList[theLength].value=newValue}
function inout_moveKeywords(fromList,toList,selectThese){theFromList=document.getElementById(fromList);for(var x=0;x<theFromList.length;x++){if(theFromList[x].selected){inout_addNewKeyword(toList,theFromList[x].text,theFromList[x].value)}}
theToList=document.getElementById(fromList);for(var x=theToList.length-1;x>=0 ;x--){if(theToList[x].selected){theToList[x]=null}}}
function inout_moveKeywords_2(fromList,toList,selectThese){add='_and_or';if(document['search_edit_companies']['what_select_box'][1].checked){add='_not'};if(fromList=='flags_options'){toList='flags'+add,selectThese='flags'+add};if(fromList=='flags'){fromList='flags'+add,toList='flags_options',selectThese='flags'+add};theFromList=document.getElementById(fromList);for(var x=0;x<theFromList.length;x++){if(theFromList[x].selected){inout_addNewKeyword(toList,theFromList[x].text,theFromList[x].value)}}
theToList=document.getElementById(fromList);for(var x=theToList.length-1;x>=0 ;x--){if(theToList[x].selected){theToList[x]=null}}}
function markSelectedInOutValues(fields_names){if(typeof(fields_names)=="string"){fields_names=new Array(fields_names)}
for(var i=0;i<fields_names.length;i++){try{inout_selectAllWords(fields_names[i])}
catch(e){}}}
function markOneSelectedInOutValue(fields_names){if(typeof(fields_names)=="string"){fields_names=new Array(fields_names)}
for(var i=0;i<fields_names.length;i++){try{inout_selectOneWords(fields_names[i],fields_names[i].selected)}
catch(e){}}}
var agt=navigator.userAgent.toLowerCase();var is_ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));var eln=new Array(7,12,7);
function show_query(type){for(var i=1;i<=3;i++){document.getElementById('b_'+i).className='inputtab'}
document.getElementById('b_'+type).className='tab_selected';for(var j=1;j<=3;j++){if(j!=type){for(var k=1;k<=eln[j-1];k++){document.getElementById('el_'+j+'_'+k).style.display='none'}} else{for(var k=1;k<=eln[type-1];k++){if(is_ie){document.getElementById('el_'+j+'_'+k).style.display='inline'} else{document.getElementById('el_'+j+'_'+k).style.display='table-row'}}}}
document.forms['search_for_suppliers'].elements['type'].value=type;try{document.getElementById('display_result').style.visibility='hidden'}
catch(e){}}
function setFlagSelector(what,return_val){var is_used=0;var radio_to_set='result_company_and_person_both';var cp_array=['cp_name','cp_extraname','cp_address','cp_extraaddress','cp_zip','cp_city','cp_pob','cp_country','cp_language','cp_email','cp_collective_email','cp_url','cp_phone','cp_fax','cp_st','cp_isprivate'];var pe_array=['pe_lastname','pe_firstname','pe_plone_id','pe_pw','pe_address','pe_extraaddress','pe_gender:radio','pe_zip','pe_city','pe_pob','pe_country','pe_email','pe_collective_email','pe_phone','pe_mobile','pe_fax','pe_st','pe_job_title','pe_greeting'];if(what=='beide'){if(setFlagSelector('pe',1)){radio_to_set='result_company_and_person_pe'} else if(setFlagSelector('cp',1)){radio_to_set='result_company_and_person_cp'}
if(radio_to_set!='result_company_and_person_pe'){alert('in Firmen und Personen zusammen können flags nur gesucht werden, wenn weder Personen noch Firmenwerte gesetzt sind')}} else{if(what=='pe'){use_array=pe_array} else{use_array=cp_array}
for(i=0;i<5;i++){obj=document.getElementById(use_array[i])
if(obj.value){is_used=use_array[i]}}
if(return_val!=undefined){return is_used} else{if(is_used){if(what=='pe'){radio_to_set='result_company_and_person_pe'} else{radio_to_set='result_company_and_person_cp';if(setFlagSelector('pe',1)){radio_to_set='result_company_and_person_pe'}}} else{if(what=='pe'){if(setFlagSelector('cp',1)){radio_to_set='result_company_and_person_cp'}} else{if(setFlagSelector('pe',1)){radio_to_set='result_company_and_person_pe'}}}}}
document.getElementById(radio_to_set).checked='checked'}
var counter_persons=0;
function count_persons(i,len){if(len==0){document.getElementById('person_counter').value=0;counter_persons=0}
else if(counter_persons>-1||counter_persons<len){document.getElementById('person_counter').value=counter_persons+i;counter_persons+=i}}
function show_next_subform(te,n){try{nc=nc}
catch(err){nc=n}
if(document['events_creation']['DB-Feld'+nc].value==''){alert('first fullfill the previous fields')} else{nc+=1;if(is_ie){document.getElementById(te+'_'+nc).style.display='inline'} else{document.getElementById(te+'_'+nc).style.display='table-row'}}}


