function mainmenu(){
	$(".main-navigation li").hover(
		function(){
			if( $(this).find('ul').length > 0) {
				$(this).children('ul').fadeIn('slow');
				$(this).addClass('active');				
			}		
		},
		function() {
			if( $(this).find('ul').length > 0) {
				$(this).children('ul').hide();
				$(this).removeClass('active');
			}
		});	
}

function socials(){
	$(".social li").hover(
		function(){		
			if( $(this).find('ul').length > 0) {
				$(this).children('ul').fadeIn('slow');
				$(this).addClass('active');				
			}		
		},
		function() {
			if( $(this).find('ul').length > 0) {
				$(this).children('ul').hide();
				$(this).removeClass('active');
			}
		});	
}


function imghover(){
	$(".listing-block li a").hover(
	function() {
	$(this).stop().animate({"opacity": "0.3"}, "slow");
	$(this).addClass("one");
	},
	function() {
	$(this).stop().animate({"opacity": "1"}, "slow");
	$(this).removeClass("one");
	});
}

function readmore(){
	$(".read-more").hover(
	function() {
	$(this).stop().animate({"opacity": "0.5"}, "slow");
	},
	function() {
	$(this).stop().animate({"opacity": "1"}, "slow");
	});
}

function updateSize () {
	updateIt();
}

function updateIt () {	
	if ($("body").width() < 1024) {		
		$("body").addClass("container1024");
	} else{		
		$("body").addClass("containerfull");
	}
}
window.onresize = updateSize;
window.onload = updateSize;
	

$(document).ready(function(){

updateSize ();						   
mainmenu();	
imghover();
socials();
readmore();
Cufon.replace('h1,h2');


  $(".main-navigation li").each(function(i){
        $(this).find(" ul li:first").addClass("first");
        $(this).find("ul li:last").addClass("last");
    });

$('#slides').cycle({
	timeout: 5000,   
	fx:'fade',             
	prev:'#prevslide',   
	next:'#nextslide',  
	pager:'#pager',   
	pause:   0,	   
	cleartypeNoBg: true,   
	pauseOnPagerHover: 0  
});

$('.testimonial').cycle({
	timeout: 5000,   
	fx:      'fade',             
	prev: '#prevslide2',   
	next: '#nextslide2',  
	pager:'#pager2',   
	pause:   0,	   
	cleartypeNoBg: true,   
	pauseOnPagerHover: 0  
});


$('.slider-content').cycle({ 
    fx: 'scrollHorz', 
    prev: '#prevslide3', 
    next: '#nextslide3', 
    timeout: 0 ,
	cleartypeNoBg: true,   
    pauseOnPagerHover: 0,
	pager:'#pager3'   
});

// listing
$(".news li h3").not(':first').removeClass('open');
	$(".news li h3").not(':first').addClass('close');
	$(".news li div.news-details").not(':first').hide();
	$(".news li h3").click(function() {
		$(".news li h3").removeClass('open');
		$(".news li h3").addClass('close');
		if($(this).next('.news-details').is(':visible')) {
			$(this).next('.news-details ul').hide();
			$(this).next('.news-details').slideUp('slow');				
			$(this).removeClass('open');
			$(this).addClass('close');
			return false;
		} else {				
			$('.news li h3').next('.news-details').slideUp('slow');	
			$(this).next('.news-details ul').hide();
			$(this).next('div').slideDown('slow');				
			$(this).removeClass('close');
			$(this).addClass('open');
			return false;
		}			
	});	
});

var css_browser_selector = function() {var ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t) != -1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js'; h.className += h.className?' '+c:c;}();
