﻿var hideback;
$(document).ready(function(){
			   
$('#language_select').click(function(){
if ($('#dropdown_language').is(':visible')) {
$('#dropdown_language').hide();	
} else {
$('#dropdown_language').show();		
}
return false;									 

});

$('#dropdown_language').mouseover(function(){
$('#dropdown_language').show();									   
});

$('#dropdown_language').mouseout(function(){
$('#dropdown_language').hide();									   
});

$('.service_link').mouseover(function(){
clearTimeout(hideback);
obj = $(this);
service_delay = setTimeout(function(){
if (!obj.parent().parent().parent().next().is(':visible')) {
$('.service_description:visible').fadeOut(400);
obj.parent().parent().parent().next().fadeIn(300);
}
},100);
});

$('.service_link').mouseout(function(){
clearTimeout(service_delay);
hideback = setTimeout(function(){$('.service_description:visible').fadeOut(400);},1000);									  
});

$('.service_description').mouseover(function(){
	clearTimeout(hideback);
});

$('.service_description').each(function(){
$(this).css({'width' : (630-($(this).prev().width()))+'px'});

});

$('.service_description_shown').each(function(){
$(this).css({'width' : (630-($(this).prev().width()))+'px'});	
});

$('#wrapper a.lightbox').mouseout(function(){
$('#big_image').attr('src',$('#returnimage').val());											  
});



$('#tminus').click(function(){
newsize = parseInt($('#content_left').css('fontSize').replace('px',''))-1; 
if (newsize < 12) newsize = 12; 
newsize += 'px'; 
$('#content_left').css({'fontSize':newsize}); 
return false;						
});

$('#tplus').click(function(){
newsize = parseInt($('#content_left').css('fontSize').replace('px',''))+1; 
if (newsize > 22) newsize = 22; 
newsize += 'px'; 
$('#content_left').css({'fontSize':newsize}); 
return false;						
});

$('#tfont').click(function(){
$('#content_left').css({'fontSize':'15px'}); 
return false;						
});
$('.chosen_option1').each(function(){								  
$(this).html($('#'+$(this).next().attr('id')+' option:selected').text());								  
});
$('.chosen_option2').each(function(){								  
$(this).html($('#'+$(this).next().attr('id')+' option:selected').text());								  
});

$('.module_title').click(function(){
if ($(this).next().attr('id') != 'active_module') {
$('.module_desc:visible').attr('id','');
$('.module_desc:visible').hide();
if ($(this).next().height() <= 100) $(this).next().slideDown(400);
if ($(this).next().height() > 100 && $(this).next().height() <= 500) $(this).next().slideDown(1000);
if ($(this).next().height() > 500 && $(this).next().height() <= 1000) $(this).next().slideDown(1600);
if ($(this).next().height() > 1000) $(this).next().slideDown(2000);
$(this).next().attr('id','active_module');
}
});
$('.content_right_news_item').eq(0).show();
if ($('.content_right_news_item').length == 1) $('#news_down_arrow').hide();
});

function refreshSelected(obj) {
$(obj).prev().html($("#"+$(obj).attr('id')+" option:selected").text());
}

function changeNews(direction) {
if (direction == 'up') {
news--;
} else {
news++;	
}
$('.content_right_news_item:visible').fadeOut(300,function(){
$('.content_right_news_item').eq(news).fadeIn(300);
});
if (news > 0) {
$('#news_up_arrow').show();	
} else {
$('#news_up_arrow').hide();	
}
if (news < ($('.content_right_news_item').length - 1)) {
$('#news_down_arrow').show();
} else {
$('#news_down_arrow').hide();	
}
}

function sendTo(website,obj) {
	switch (website) {
		case 'facebook':
			obj.href = 'http://www.facebook.com/share.php?u='+document.location;
			break;
		case 'myspace':
			obj.href = 'http://www.myspace.com/Modules/PostTo/Pages/default.aspx?u='+document.location;
			break;
		case 'digg':
			obj.href = 'http://www.addthis.com/bookmark.php?v=200&winname=addthis&source=men-200&lng=bg&s=digg&url='+document.location;
			break;
		case 'ping':
			obj.href = 'http://ping.bg/buzz/savit_popup/?url='+document.location;
			break;
		case 'svejo':
			obj.href = 'http://svejo.net/story/submit_by_url?url='+document.location;
			break;
	}
}

function switchAddress(website,obj) {
	obj.href = website;
}

