var debugLevel=0;

            function ctip () {
            	if(debugLevel == 1)  {
		            alert('ctip');
            	}
            	
								    $('a.text-popup').cluetip({
										height: '250px',
										width: 'auto',
								        local: true,
								        sticky: true,
								        cursor: 'pointer',
								        dropShadow: true,
								        dropShadowSteps: 3,
								        leftOffset: 20,
								        positionBy: 'mouse',
								        arrows: true,
								        showTitle: false,
								        mouseOutClose: true,
									    closeText: closeText,
								        fx: {
								            open: 'fadeIn',
								            openSpeed: ''
								        },
								        hoverIntent: {
								            sensitivity: 3,
								            interval: 200,
								            timeout: 500
								        }
								     });
							    
								    $('a.text-popup-big').cluetip({
										height: 'auto',
								        width: 'auto',
								        local: true,
								        sticky: true,
								        cursor: 'pointer',
								        dropShadow: true,
								        dropShadowSteps: 3,
								        leftOffset: 20,
								        positionBy: 'mouse',
								        arrows: true,
								        showTitle: false,
								        mouseOutClose: true,
									    closeText: closeText,
								        fx: {
								            open: 'fadeIn',
								            openSpeed: ''
								        },
								        hoverIntent: {
								            sensitivity: 3,
								            interval: 200,
								            timeout: 500
								        }
								        
								    });
							    
            } 
            
            function loadProps () {
            	if(debugLevel == 1)  {
		            alert('loadProps');
            	}
			  	$("#tab-applications_content-properties").load("/finder/finder.do;jsessionid=" + jsessionid + "?act=load&forward=tabApplicationsContentProperties",
				  		function() {
				  			$("#tab-documents_content-documents").load("/finder/finder.do;jsessionid=" + jsessionid + "?act=loadDocumentList&forward=loadDocumentList",
						  		function() {
							  	$("#tab-properties_content-properties").load("/finder/finder.do;jsessionid=" + jsessionid + "?act=load&forward=tabPropertiesContentProperties", 
						  			function() {
							  			loadDocs();
					  					$(".tab-box-2 > ul").tabs('select', 0);
									  	$("#additionalCategories").load("/finder/finder.do;jsessionid=" + jsessionid + "?act=load&forward=loadAdditionalCategories", 
									  		function() {
									  			ctip();
								  			}
									  	);
						  			}
							  		);
								  }
				  			);
					  	}
				  	);

            }

            function loadDocs () {
            	if(debugLevel == 1)  {
	            	alert('loadDocs');
            	}
								    $('span[@title].document-info').cluetip({
								        splitTitle: '|',
								        sticky: true,
								        dropShadow: true,
								        dropShadowSteps: 3,
								        leftOffset: 20,
								        width: '200px',
								        positionBy: 'mouse',
								        arrows: true,
								        showTitle: false,
								        mouseOutClose: true,
									    closePosition: 'top',    // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title'
									    closeText: closeText,
								        fx: {
								            open: 'fadeIn',
								            openSpeed: ''
								        },
								        hoverIntent: {
								            sensitivity: 3,
								            interval: 200,
								            timeout: 500
								        }
								    });
								    
								    $('span[@title].bc').cluetip({
								        splitTitle: '|',
								        sticky: true,
								        dropShadow: true,
								        dropShadowSteps: 3,
								        leftOffset: 20,
								        width: 'auto',
								        positionBy: 'mouse',
								        arrows: true,
								        showTitle: false,
								        mouseOutClose: true,
									    closePosition: 'top',    // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title'
									    closeText: closeText,
								        fx: {
								            open: 'fadeIn',
								            openSpeed: ''
								        },
								        hoverIntent: {
								            sensitivity: 3,
								            interval: 200,
								            timeout: 500
								        }
								    });
								    
								    $('span.documents-thumb').cluetip({
								        splitTitle: '|',
								        sticky: true,
								        dropShadow: false,
								        dropShadowSteps: 3,
								        leftOffset: 20,
								        width: 'auto',
								        positionBy: 'mouse',
								        arrows: true,
								        showTitle: false,
								        mouseOutClose: true,
									    closePosition: 'top',    // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title'
									    closeText: closeText,
								        fx: {
								            open: 'fadeIn',
								            openSpeed: ''
								        },
								        hoverIntent: {
								            sensitivity: 3,
								            interval: 200,
								            timeout: 500
								        }
								    });
								    
								    
								    $(".filter,.filter-2,.filter-3").hoverIntent(function() {
								        $(this).addClass("f-on"),
								        $(this).children("ul").show(250);
								    },
								    function() {
								        $(this).removeClass("f-on"),
								        $(this).children("ul").hide(250);
								    });
							    
							    $(".lang-select").hover(
								    function() {
								        $(this).children("ul").show(250);
								    },
								    function() {
								        $(this).children("ul").hide(250);
								    }
							    );
            }

            function doSearch (data) {
            	if(debugLevel == 1)  {
	            	alert('doSearch');
            	}
            	$('#tab-documents_content-documents').load('/finder/finder.do', {act: 'loadDocumentList', forward: 'loadDocumentList', searchTerm: data}, function() {
            		loadDocs();  
					$(".tab-box-2 > ul").tabs('select', 0);
            		}
            	);
	  			$(".tab-box-2 > ul").tabs('select', 0);
            }

            function updateCartItem (amount, id) {
            	if(debugLevel == 1)  {
		            alert('updateCartItem');
            	}
            	$('#tab-letterShop_content-cart').load('/shop/letterShopCart.do;jsessionid=' + jsessionid + '?act=cartUpdate&itemIdList[]=' + id + '&amountList[]=' + amount, function() {updateCart();});
            	
            }

            function updateCart () {
            	if(debugLevel == 1)  {
		            alert('updateCart');
            	}
            	$('#letterShopItems').load('/shop/letterShopCart.do;jsessionid=' + jsessionid + '?act=cartRefreshItems');
            	$('#tab-letterShop_content-cart').load('/shop/letterShopCart.do;jsessionid=' + jsessionid + '?act=cartShow');
            }

            function reset (data) {
            	if(debugLevel == 1)  {
		            alert('reset');
            	}
					$("#global").load("/finder/finder.do;jsessionid=" + jsessionid + "?act=initSession&smzPrefix=FC_finder_",
					  function() {


						  	$("#tab-applications_content-properties").load("/finder/finder.do;jsessionid=" + jsessionid + "?act=load&forward=tabApplicationsContentProperties",
						  		function() {
						  			$("#tab-documents_content-documents").load("/finder/finder.do;jsessionid=" + jsessionid + "?act=loadDocumentList&forward=loadDocumentList",
								  		function() {
									  	$("#tab-properties_content-properties").load("/finder/finder.do;jsessionid=" + jsessionid + "?act=load&forward=tabPropertiesContentProperties", 
								  			function() {
									  			loadDocs();
							  					$(".tab-box-2 > ul").tabs('select', 0);
											  	$("#additionalCategories").load("/finder/finder.do;jsessionid=" + jsessionid + "?act=load&forward=loadAdditionalCategories", 
											  		function() {
											  			ctip();
										  			}
											  	);
								  			}
									  		);
										  }
						  			);
							  	}
						  	);

					  		updateCart();
					  	}
					);
            }

