jQuery.fn.vjustify=function() {
    var maxHeight=0;
    this.each(function(){
        if (this.offsetHeight>maxHeight) {maxHeight=this.offsetHeight;}
    });
    this.each(function(){
        $(this).height(maxHeight + "px");
        if (this.offsetHeight>maxHeight) {
            $(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px");
        }
    });
};

var allianz = {
	init: function() {
		if(typeof tb_init == "function"){
			tb_init('a.thickbox');
		}
		if(typeof $().tabs == "function"){
			var $tabs = $(".idTabs").tabs({
				remote: true,
				fx: {opacity: 'show', duration: 'fast' }
			});
			var tabId = $.getURLParam("tab");
			if(tabId){
				console.debug('Selected tab No: ',tabId);
				$tabs.tabs('select', tabId-1);
			}

		}
		if(typeof vjustify == "object"){
			$(".sameHeight").vjustify();
		}
		if(typeof $().example == "function"){
			$('.searchfield').example(function() {
				return $(this).attr('title');
			}, {class_name: 'notexample'});
		}
		if(typeof $().galleriffic == "function"){
			var sGalId = 1;
			if(typeof $().getUrlParam == "function"){
				sGalId = $(document).getUrlParam("showGallery"); }
			$('#jquerygallery'+sGalId).galleriffic('#gallery-data'+sGalId,{
				imageContainerSel:      '#slideshow-adv'+sGalId,
				controlsContainerSel:   '#controls-adv'+sGalId,
				captionContainerSel:    '#caption-adv'+sGalId,
				loadingContainerSel:    '#loading-adv'+sGalId
			});
			if($("div[@id^='jquerygallery']").length > 1){
				$("div[@id^='jquerygallery']").css("display","none");
				if($('#jquerygallery'+sGalId).length > 0)
					$('#jquerygallery'+sGalId).css("display","block");
				else
					$('#jquerygallery1').css("display","block");
			}
		}
	}
}

$(allianz.init);

function jscallTb(tbUrl,tbWidth,tbHeight,tbModal) {
	var qt = "?";
	if(tbUrl.indexOf("?")!=-1)
		qt = "&";
	var uri = tbUrl+qt+"TB_iframe=true&height="+tbHeight+"&width="+tbWidth;
	if(tbModal)
		uri+="&modal=true";
	setTimeout("wait", 150);	
	tb_show(null,uri,false);
}
function wait(){}