			var aspectRatio;
			var screenSaver;
			
			$(document).ready(
				function(){
					
					setDims();
					getDims();
					startImgFade();
					setTimeout('setBg()',2000);
					$(window).resize(function(){
						getDims();
					});
					screenSaver=setTimeout('fadeOut()',45000);
					
					$(document).mousemove(function(e){
						fadeIn();
						clearTimeout(screenSaver);
						screenSaver=setTimeout('fadeOut()',45000);
					});
					
					$(document).click(function(){
						fadeIn();
						clearTimeout(screenSaver);						
					});
					

					
					
			});
			
			
			
			var imgObj;
			var imgScrollTotal=0;
			var imgScrollPointer=0;
			var imgScrollObj;
			var imgTimer;
				
			function startImgFade(){
			    imgScrollObj=$('.newsitem');
			    imgScrollTotal=imgScrollObj.size();
			    if(imgScrollTotal>0){
			      imgScrollTime();
			    }
			}
				

			function fadeOut(){
				obj=$('#text1');
				obj.slideUp('fast');
				$('#footerwrap').fadeTo('fast',0);				
			}
			
			function fadeIn(){
				obj=$('#text1');
				if(obj.css('display')!='block'){
					obj.slideDown('fast');
					$('#footerwrap').fadeTo('fast',1);
					
				}
			}

			
			
			function fadeMain(){
				obj=$('#text1');
				if(obj.css('display')=='block'){
					obj.slideUp('fast');
					$('#footerwrap').fadeTo('fast',0);
				}else{
					obj.slideDown('fast');
					$('#footerwrap').fadeTo('fast',1);
				}
				//$('#text1').fadeTo('fast',fader);
			}





			function imgScrollTime(){
			    thisImg=imgScrollObj.eq(imgScrollPointer);
			    $('.newsitem:visible').stop().fadeTo('slow',0); 
			     
			    thisImg.stop().fadeTo('slow',1);
			    imgScrollPointer++;
			    if(imgScrollPointer>=imgScrollTotal){
			      imgScrollPointer=0;
			    }
			    clearTimeout(imgTimer);
			    imgTimer=setTimeout('imgScrollTime()',4000);
			  
			}			
			
			
			
			
			
			
			
			function loadMap(){
				$('#map').load('../sections/_gmap.php');
			}
			
			var imgWidth=0;
			var imgHeight=0;
			
			function setDims(){
				imgWidth=1200;
				imgHeight=803;
				aspectRatio=imgWidth/imgHeight;
			}
			
			
			
			function getDims(){
					bgwidth=$(window).width();
					bgheight=$(window).height();
					menuTop=bgheight-60;
					//$('#menubar').stop().animate({top:menuTop},300)
					w1=imgWidth;
					h1=imgHeight;
					if(bgwidth>imgWidth){
						w1=bgwidth;
						h1=w1/aspectRatio;
					}
					if(h1<bgheight){
						h1=bgheight;
						w1=h1*aspectRatio;
					}
					opText=$(window).width()+'x'+$(window).height();
					$('.bgimage').css({width:w1,height:h1});
					toppos=h1-130;
					$('#footmenu').css({top:toppos});
					
			}
			

			
			function ajaxForm(){
				$('#contactajax').prepend('<div class="loading">Sending...</div>');
				var comlist = new Object();
				comlist['name']=$('#name').val();
				comlist['email']=$('#email').val();
				comlist['mobile']=$('#mobile').val();
				comlist['comment']=$('#comment').val();
				$('#contactajax').load('../sections/ajaxform.php',comlist);
				
			}
			
			
			var maxBg=2;
			var bgPos=2;
			var lastItem=1;
			
			function setBg(){
				$('#fullbg'+bgPos).fadeTo('slow',1);
				$('#fullbg'+lastItem).fadeTo('slow',0);
				lastItem=bgPos;
				bgPos++;
				if(bgPos>maxBg){
					bgPos=1;
				}
				setTimeout('setBg()',7000);
			}



