$(document).ready(function(){
		
		if($.browser.msie){
			browserHeight = 8;	
		}
		
		else if ($.browser.mozilla){
					 	
		 	if($.browser.version == "8.0"){
		 		browserHeight = 12;
		 	}
		 	
		 	else{
		 		browserHeight = 8;
		 	}
			
		}
		
		else if($.browser.webkit){
			browserHeight = 8;
		}
		
		else if($.browser.safari){
			browserHeight = 12;
		}
		
		else{
			browserHeight = 8;
		}
		
});




function initcontent(){
	var lHeight = $(window).height();
	var newLHeight = 0
	
	
	var lwidth = $(window).width();
	
	tp = $('.top').height();
	lg = $('.logo').height();
	fh = $('.footer').height();
	
	lnheight = (fh +  tp + lg)-browserHeight;
	
	if(lwidth < 1200) lwidth = 1200;
	$('.container').css({ 'width':lwidth });
	
	
	minContentHeight = lHeight-lnheight;
	

	if(minContentHeight < 450){
		minContentHeight = 450;
	}
	
	

	newInitHeight = lHeight;

	$('.content').fadeIn('fast', function() { 
	
			col0Height = $('.content > .contentholder > #col0').height();
			col1Height = $('.content > .contentholder > #col1').height();
			col2Height = $('.content > .contentholder > #col2').height();
			
			newColHeight = Math.max(col0Height,col1Height,col2Height);
			newColHeight = newColHeight * 1.1;

		
		if(newColHeight > minContentHeight){
			
			$('.content').height(newColHeight);	
			$('.main').height(newColHeight);
			$('#col0').height(newColHeight);	
			$('#col1').height(newColHeight);
			$('#col2').height(newColHeight);	
		}
		else{
			$('.content').height(minContentHeight);
			$('.main').height(minContentHeight);	
			$('#col0').height(minContentHeight);
			$('#col1').height(minContentHeight);
			$('#col2').height(minContentHeight);
		}
			
	 }).css({opacity:.99});
		
}

$(window).scroll(function () { 
	dwidth();
	resizecontent();
});


$(window).resize(function() {
 	dwidth();
	resizecontent();
});

function dwidth(){
	lw = 0;
	var lwidth = $(window).width();	
	if(lwidth < 1200) lwidth = 1200;

	$('.container').css({ 'width':lwidth });
		
	$('.chrismenu1').each(function(index) {
    	w = $(this).attr('id');
    	nw = '#'+w;
    	lw = lw + $(nw).width();
    	lw = lw + 22;
  	});
  		
    lscrollleft = $(window).scrollLeft();
  	

 	lw2 =  $(window).width()+lscrollleft;
 	lw3 = lw2 - lw;
 	 // Mozila Fix
 	lw4 = lw3 - 128; 
 	// lw4 = lw3 - 1000;
 	 	
 	 $('.topmenu4').width(lw4+'px');
}

function resizecontent(){
	var lHeight = $(window).height();
	
	tp = $('.top').height();
	lg = $('.logo').height();
	fh = $('.footer').height();
	lnheight = (fh +  tp + lg)-browserHeight;
	
	var minContentHeight = lHeight-lnheight;
	
	if(minContentHeight < 450){
		minContentHeight = 450;
	}

	col0Height = $('.content > .contentholder > #col0').height();
	col1Height = $('.content > .contentholder > #col1').height();
	col2Height = $('.content > .contentholder > #col2').height();
	
	newColHeight = Math.max(col0Height,col1Height,col2Height);
	
	
	if(newColHeight > minContentHeight){		
		$('#col0').height(newColHeight);	
		$('#col1').height(newColHeight);
		$('#col2').height(newColHeight);	
	}
	else{
		$('.content').height(minContentHeight);
		$('.main').height(minContentHeight);
			
	}
	
	
	if(minContentHeight > newColHeight){
		$('.content').height(minContentHeight);
		$('.main').height(minContentHeight);
		$('#col0').height(minContentHeight);	
		$('#col1').height(minContentHeight);
		$('#col2').height(minContentHeight);
		
	}
	
	
	//


}


$(document).ready(function(){
		

	 $('.contentbutton')
	   .click(function(){ 
		   	bg = $(this).css('background-image');
		    chkbg = bg.indexOf("minimise") != -1;
		    mh = $('.main').height()-5; 
		    
		 	    
		 	  
		   if(fxque()){
			    if(chkbg == true){
			    	$(this).animate({'margin-top': '+='+mh+'px'},'fast');
			    	$(this).css({ 'background-image':'url(/images/mini-buttons/maximise_up.jpg)' });  
			    }
			    
			    else{
			    	$(this).animate({'margin-top': '-='+mh+'px'},'slow');
			    	$(this).css({ 'background-image':'url(/images/mini-buttons/minimise_up.jpg)' });
			    }
			}  
		    
	  });
 });




function fxque(){
	
	var  rtn = true;
	
	if($('.content').queue("fx").length){		
		rtn = false;
	}
	if($('#dropmenu').length){
		if($('#dropmenu').queue("fx").length){		
			rtn = false;
		}
	}
	
	return rtn;
}

$(document).ready( function(){
	$('#alertnews').innerfade({ animationtype: 'fade', speed: 'slow', timeout: 8000, type: 'random', containerheight: '1em' });
})

function dropclick(str){
	window.location="index.cfm?seourl="+str;
}

	function changeStatus(theItem,status)
				{
				 displayval = status == 0 ? 'none' : ''; 
				 displayval2 = status == 0 ? '' : 'none'; 

				 $(theItem).find('.eachitemhoverover').css('display',displayval);
 				$(theItem).find('.eachitemnohover').css('display',displayval2);	
				}

