VenstreSite = {
	init: function() {
		// Facebook
		FB.init({
			appId  : Venstre.Config.fb_app_id,
			status : Venstre.Config.fb_status, // check login status
			cookie : Venstre.Config.fb_cookie, // enable cookies to allow the server to access the session
			xfbml  : Venstre.Config.fb_xfbml	 // parse XFBML
		});
		//FB.Canvas.setAutoResize();
		if(jQuery('#facebook_login').size() === 1) {
			FB.getLoginStatus(Venstre.FE.Facebook.login_status_callback);
		}
		if(typeof(initialize_google_map) !== 'undefined') {
			initialize_google_map();
		}
		// Download and links
		jQuery('div.downloadAndLinks').children('div.content').children('div.body').find('ul li').mouseenter(function() {
			jQuery(this).addClass('mouseover');
		}).mouseleave(function() {
			jQuery(this).removeClass('mouseover');
		});

	}
};
$(document).ready(function() {
	VenstreSite.init();
	// Add textshadow in ie (other browsers use css3)
	if ($.browser.msie) {
	  $('.candidate-name a').textShadow({
	  	x:2,
	  	y:1,
	  	radius: 3,
	  	color: '#444'
	  });
	}
	if (parseInt($.browser.version, 10) == 8) {
		$('.candidate-name a').css('top', 13);
	}
	// Add text gradient
	$('.candidate-name a').pxgradient({
		step: 10,
		colors: ["#ffffff","#d4d4d4"],
		dir: "y"
	});
	jQuery('.banner .content .bottom').each(function() {
		if(jQuery(this).hasClass('single')) {
			if(jQuery(this).find('span.cufon').height() > 19) {
				jQuery(this).removeClass('single');
			}
		}

		if(jQuery(this).hasClass('profile')) {

			var profile_changed = 0;
			jQuery(this).find('span.cufon').each(function() {
				var element = jQuery(this);
				if((element.width() > 258) || (profile_changed === 1) || (element.height() > 40)) {
					element.css('font-size', 13);
					profile_changed++;
				}
			});
			if(profile_changed === 2) {
				jQuery(this).children('a').css({'padding-top': 6, 'height': 55});
			}
		}

		if(jQuery(this).hasClass('map')) {
			jQuery(this).find('span.cufon').each(function() {
				var element = jQuery(this);
				if(element.height() > 40) {
					element.css('font-size', '13px');
					element.parent().css('line-height', '15px');
				}
			});
			jQuery(this).children('a').css({'padding': 0});
		}
	});
});

