

if(jquery == 1) {
	
	var arrPageSizes;
	
	function showOverlay() {
		
		$('body').append('<div id="overlay"></div>');	
		
		var arrPageSizes = ___getPageSize();
		$('#overlay').css({
			backgroundColor:	"#000",
			opacity:			"0.8",
			width:				arrPageSizes[0]+30,
			height:				arrPageSizes[1]
		}).fadeIn();
		
		$('body').css( { overflow: "hidden" } );
	}
	
	function hideOverlay() {
		
		$("#overlay").remove();
		$("body").css( { overflow: "auto" } );
	}
	

	$(document).ready(function () {
		
		$(".fckLink").live("click", function() {
	    	rel = $(this).attr("rel");
	    	width = $("#content_"+rel).width();
	    	
	    	if(width<600)
	    		toolBar= "simple";
	    	else
	    		toolBar = "edit";
	    		
	    	loadPage("admin.php?page=content","content_"+rel,"textID="+rel+"&ajax=1&toolbar="+toolBar); 
	    });
	    
	    $("a").bind("click",function() {
	    	$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank");
	    });
	    	
	    
	    $('input[title], textarea[title]').each(function() {
			if($(this).val() === '') {
				$(this).val($(this).attr('title')).addClass("inline"); 
			}
		  
		  $(this).focus(function() {
			   if($(this).val() === $(this).attr('title')) {
			    	$(this).val('').addClass('focused').removeClass("inline"); 
			   }
		  });
		  
		  $(this).blur(function() {
			  if($(this).val() === '') {
					$(this).val($(this).attr('title')).removeClass('focused').addClass("inline"); 
			  }
		  });
	 	});
	 	
	 	fixMain();
	 	
	 	if(ieV.DocMode==7)
	 		setTimeout(function() { fixMain(); }, 500);
	 	
	 	

	});
	
	function fixMain() {
		
		arrPageSizes = ___getPageSize();

    	w = arrPageSizes[2];
    	
    	if(mobile) {
    		
    	}
    	else {
	    	if(w<932)
	    		w = 932;
	    	if(w>1600)
	    		w = 1600;
    	}
    		
    	w = w-40;	
    	
    	$("#main").css( { width : w+"px" } );
    	$("#flashWrap").css( { width : w+"px" } );
    	$("#rightNav").css( { marginLeft : (w-92)+"px" } );
    	$("#slogan").css( { width : (w-242)+"px" } );//364
    	$("#navigatie").css( { width : (w-184)+"px" } );
    	//$("#swf").css( { height : (arrPageSizes[3]-190)+"px" } );
    	$("#swf").css( { height : ((w/2)+54)+"px" } );
    	$("#flashWrap").css( { height : ((w/2))+70+"px" } );
    	
    	$("#carousel").css( { width : (w-120)+"px" } );
    	
    	if($("#flashWrap").length) {
    		$(".footer").css({ top: ((w/2)+130)+"px" , position:'absolute' , width : w+"px", paddingBottom : '20px' } );
    	}
    	
    	loadPage("index.php?page=AJAXlayout&width="+arrPageSizes[2]+"&height="+arrPageSizes[3],"ajaxC");
    	
    	
    	//$(".pageContent img").width(w).css({ height: '538px' } );
    };
    
    
     
    var resizeTimer = null;
    var langTimer = null;
    $(window).bind('resize', function() {
	    if (resizeTimer) clearTimeout(resizeTimer);
	    resizeTimer = setTimeout(fixMain, 100);
    });
	

	function equalHeight(group) {
		var tallest = 0;
		$(group).each(function() {
			thisHeight = $(this).height();
			if(thisHeight > tallest) {
				tallest = thisHeight;
			}
		});
		
		
		
		$(group).height(tallest); 
	}
	
	$.getDocHeight = function(){
	    return Math.max(
	        $(document).height(),
	        $(window).height(),
	        /* For opera: */
	        document.documentElement.clientHeight
	    );
	};

		
	    
	function checkHeight() {
	
		height = $.getDocHeight();
		ch = $(".leftSide").height();
		
		if(ch<height) {
			
			min = 180;
			$(".middleContent").height(height-200+"px");
			$(".leftSide").height((height)+"px");
			
		}
		
	}	


	function updateDiv(id,id2,id3) {
			
		$("#"+id).html($("#"+id2).html());
	}

	function ___getPageSize() {
		var xScroll, yScroll;
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		var windowWidth, windowHeight;
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
		return arrayPageSize;
	};
	
	function ArrayToGet(array,suffix) {
		var pars;
		for( var i = 0, n = array.length;  i < n;  ++i ) {
	        el = array[i];
	        pars += "&"+suffix+"_"+i+"="+el;
	    }
	    
	    return pars;
	}

	
	function sendToFlash(text) {
		var swf = document.getElementById("swf");
		if (swf != null) {
			
	  		swf.searchProj(text);
		}
	}
	
	function startSlide() {
		var swf = document.getElementById("swf");
		if (swf != null) {
			$("#ajaxC").attr('closed',1);
			swf.startSlideshow();
			
		}
		
	}
	
	function makeActive(k) {
		
		$(".sub li a").removeClass("active");
		$("#"+k).addClass("active");
		
		$("#work a").removeClass("active");
	}
	
	
	function intro(n) {
		setTimeout(function()  { 
		
			$("#logo").show("slide", { direction: "left" }, 1000, function() { 
				$("#slogan").show("slide", { direction: "left" }, 1000 );
				
				if(n) {
					setTimeout(function() { openNav(); },2500);
				}
				
			} );
		
		} , 1000);
		
		showFooter();
	}
	
	function openNav() {
		
		//setTimeout(function() {
		c = $("#ajaxC").attr('closed');
		if(!c || $("#slogan:visible")) {
			$("#slogan").fadeOut("normal",function() { $("#logo").animate( { marginLeft: '-188px' }, 1000 , 
				function() { 
					$("#navigatie").show("slide", { direction: "left" },1000, function() { 
						$("#rightNav").show("slide", { direction: "right" },1000);
					} );
				} ); 
			} );
		}
				
		
				
				//} , 2500);
	}
	
	function quick() {
		 $("#logo").show().animate( { marginLeft: '-188px' }, 0 , 
			function() { 
				$("#navigatie").show();
				$("#rightNav").show();

			} ); 
		showFooter();
	}
	
	function showFooter() {
		
		t = 200;
		$("#footerLine").fadeIn(3000,  function() { 
			$(".footerLogo a").each(function(e) { 
				e = $(this);
				setTimeout(function() { e.fadeIn(); } ,t );
				t = t +300;
			} );
		} );
		
	}
	
	function showLogin() {
		
		$("#lang").hide();
		$("#rightNavL").hide("slide", { direction : "down" } , 1000, function() { 
			$("#smallLogin").show("slide" , { direction : "down" } , 500);
		} );
		
	}
	
	function showLang() {
		$("#smallLogin").hide();
		$("#rightNavL").hide("slide", { direction : "down" } , 500, function() { 
			$("#lang").show("slide" , { direction : "down" } , 500);
		} );
		
	}
	
	function hideLang() {
	 	if (langTimer) clearTimeout(langTimer);
	    langTimer = setTimeout(hideLang2, 1000);
	}
	    
	function hideLang2() {
		$("#smallLogin").hide();
		$("#lang").hide("slide", { direction : "down" } , 800, function() { 
			$("#rightNavL").show("slide" , { direction : "down" } , 500);
		} );
		
	}
	
	function switchNav(c) {
	
		$(".sub:visible").hide("slide", { direction: "left" }, 400, function() { });
		
		$("."+c).show("slide", { direction: "left" }, 700);
		$("#"+c+" a").addClass("active");
		$(".sub li a").removeClass("active");
		
	}
	
	function quickNav(c) {
		$(".m").each(function(e) { 
			if($(this).is(":hidden")) {
				$(this).show();
			}
		} );
		//$("#"+c).hide();
		$("."+c).show();
	}
	
	function hideNav(c) {
		
		$("."+c).hide("slide", { direction: "left" }, 400, function() { });
		
	}
	
	
	$(function() {
	    $(window).bind('orientationchange', function(event) {
	    	
	    	setTimeout(function()  { 
	    	
	    		
	    		url = domain+"index.php?page=AJAXlayout&width="+$(window).width()+"&height="+$(window).height();
		    	target= "ajaxC";
		    	$.get(url, "", function(data) {
		    		//fixMain();
		    		
		    		//$("#mainPic").width($(window).height()-40);
		    		location.reload();
		    		
		  		});
	    	
	    	} , 500);

	    	
	    	
		    
	    });
	 
	    
	});	 
	

}
