function DraugiemSay( title, url, titlePrefix ){
 window.open(
  'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent( title ) +
  '&link=' + encodeURIComponent( url ) +
  ( titlePrefix ? '&titlePrefix=' + encodeURIComponent( titlePrefix ) : '' ),
  '',
  'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400'
 );
 return false;
}

var isIE 	= false;
var isIE6 	= false;
var isIE7 	= false;
var isIE8 	= false;
var isFF 	= false;
var isOpera = false;
var browserVersion = jQuery.browser.version;
isIE = jQuery.browser.msie;
if (isIE) {
	if (browserVersion.substr(0, 1) == "8")
	{
		isIE8 = true;
	}
	else if (browserVersion.substr(0, 1) == "7")
	{
		isIE7 = true;
	}
	else if (browserVersion.substr(0, 1) == "6")
	{
		isIE6 = true;
	}
}
isOpera = jQuery.browser.opera;
isFF = jQuery.browser.mozilla;
//Cufon('.cufon, #topMenu ul li, .round, .petListItem h1', {
//	hover: true
//});
//if ($('.spiffy').spiffySelect != undefined) {
//  $('.spiffy').spiffySelect(settings);
// }
var setMenu = function() {
	if (isOpera || isIE) {
		$(".largeTooltip").css({'backgroundImage':'none'});
	}
	if (isIE) {
		if (isIE7) {
			menuWidth = 0;
			fromTop = 0;
		}
		if (isIE6) {
			$('.subMenu ul li').css({
				'marginTop':'40px'
			});
			$('div.side:last').css({
				'width':'216px',
				'overflow':'hidden'
			});
		}
	}
	 $('.round:not(.fixedWidth):not(.nopad)').each(function () {
		  if(isIE || isOpera) {
		   $(this).css("width",$(this).find('a, span').width() + 16 + "px");
		  } else {
		   $(this).css("width",$(this).find('a, span').width() + 18 + "px");
		  }
		 });
	$('.round.nopad').each(function () {
		   $(this).css("width",$(this).find('a, span').width() + 2 + "px");
		 });
	/*$('.round.nopad').each(function () {
		if(isIE || isOpera) {
			$(this).css("width",$(this).find('a, span').width() + 4 + "px");
		}
		else {
			$(this).css("width",$(this).find('a, span').width() + 5 + "px");
		}
	});*/
	tooltipCall = 0;
	$(".showtooltip").mouseenter(function (e) {
		tooltipCall = 1;
		$("#" + $(this).attr("rel")).css({'position':'absolute', 'z-index':2000,'top':200, 'left':400});
		$("#" + $(this).attr("rel")).fadeIn(400);
	});
	if(!(isIE6 || isFF || jQuery.browser.safari)) {
		$(".round").css("position","relative");
		$('#topMenu, .round, .footer').each(function () {
			$(this).append('<div class="corner tl"></div><div class="corner tr"></div><div class="corner bl"></div><div class="corner br"></div>');
		});
		$('.largeTooltip, .tooltip').each(function () {
			$(this).append('<div class="corner_l tl"></div><div class="corner_l tr"></div><div class="corner_l bl"></div><div class="corner_l br"></div>');
		});
	}
	$(".hide").hide();
	$('.box .split h3').each(function () {
		$(this).css({'display':'block', 'position':'relative', 'height': $(this).height()+'px'});
		$(this).find("a").css({'position':'absolute', 'bottom':'0px'});
	});
	currLargestHeight = 0;
	$('.box .split h3').each(function () {
		if (currLargestHeight < $(this).height())
		{
			currLargestHeight = $(this).height();
		}
	});
	$('.box .split h3').css("height",currLargestHeight+"px");

/*
	c = 0;
	$('#topMenu ul:first li').each(function () {
		$(this).attr('count',c);
		c++;
	});
	ofs1 = $('#topMenu ul:first li.active').attr('count');
	if (!isIE6)
	{
		m = 30;
	}
	else
	{
		m = 33.3;
	}
	offsetX1 = $('#topMenu ul:first li:eq('+ofs1+')').offset().left - $('#topMenu').offset().left - ($('#topMenu ul:first li').size() - ofs1*4) - m;
	if ($('#topMenu ul').size() == 2) $('#topMenu ul:last').css({'left': offsetX1-4+'px'});
	offsetX2 = $('#topMenu ul:first').offset().left - $('#topMenu').offset().left;
	$('.topLeftMenu').css({'width': offsetX2-53+'px'});
*/
	$('#topMenu ul li').each(function () {
		$(this).css('position', 'relative');
		$(this).append('<div class="corner tl grayCorner"></div><div class="corner tr grayCorner"></div><div class="corner bl grayCorner"></div><div class="corner br grayCorner"></div>');
	});

	$('.home').find('div').each(function () {$(this).addClass('grayCorner')});
}
$(window).resize(function(){
  if ($(window).width() <= 1008) {
	$(".wrapper").css("overflow","visible");
  } else {
	$(".wrapper").css("overflow","auto");
  }
});

$(document).ready(function () {
	$('.loginReminder').find('*').unbind('click').end().bind('click', function (e) {

			$('#loginbanner').css('display', 'inline').fadeIn(400);
			/*
			$('#balloonDropzone').css('display', 'none').html('<div class="balloon large">' + html + '</div>')
				.find('.balloonContent').height(35).end().fadeIn(400);
			*/
			$('.loginReminder').unbind();
	});

	var settings = {
			'bgImage' : '/images/arrow-down.gif',
			'bgPosition' : '365px 8px'
		};
	if ($('.spiffy').spiffySelect != undefined) {
	  $('.spiffy').spiffySelect(settings);
	 }
if (isIE) { $('.exit img').css('margin-top', '0'); }
});