function openPopup( URL, width, height ){ 
leftPos= ( screen.width - 780 )/2 
topPos = ( screen.height - 500 )/2 
newWin = window.open(URL,'popup','toolbars=no, resizeable=no,scrollbars=yes,status=yes,left='+leftPos+',top='+topPos+',width='+width+',height='+height) 
}

function setCookie( param, value ) {
	if ( param.length > 0 && value.length > 0 ) {
		$.cookie( param, value );
	}
}

function stopBubbles() {
	$('#bubbls').hide();
}

function pauseBubbles() {
//	$('#bubbls').hide();
    document.getElementById('bubbleMovie').stabdytiBurbulus();
//    window.bubbles.stabdytiBurbulus();
//alert( window.bubbles );
//    $("#bubbls>embed").stabdytiBurbulus();
}

function resumeBubbles() {
    window.document.bubbleMovie.paleistiBurbulus();
//    $('#bubbls').show().flash({ src: 'flash/bubble_background.swf', wmode: 'opaque', width : '100%', height : content_height, allowscriptaccess:'always'  });
}

function triggerLoginForm() { 
    $('#TB_overlay').remove();
    $('.popup_layer').remove();
		$('#bubbls').hide();			
    $('body').append('<div id="TB_overlay" class="TB_overlayBG" onclick="remove_popups()"></div><div class="popup_layer" style="z-index: 9999;"></div>');
    $('.popup_layer').load('load_popup.php?type=login&lang='+language, function(){
													                                         $('.popup_layer').css("margin-left", (-$('.popup_content').width())/2+"px").css("margin-top", (-$('.popup_content').height())/2+"px")
													                                     });
};

function triggerForgotPasswordForm() { 
    $('#TB_overlay').remove();
    $('.popup_layer').remove();
		$('#bubbls').hide();			
    $('body').append('<div id="TB_overlay" class="TB_overlayBG" onclick="remove_popups()"></div><div class="popup_layer"  style="z-index: 9999;"></div>');
    $('.popup_layer').load('load_popup.php?type=forgot_password&lang='+language, function(){
													                                         $('.popup_layer').css("margin-left", (-$('.popup_content').width())/2+"px").css("margin-top", (-$('.popup_content').height())/2+"px")
													                                     });
};

function triggerRegistrationForm() { 
    $('#bubbls').hide();			
    $('#TB_overlay').remove();
    $('.popup_layer').remove();
		//$('#bubbls').pauseBubbles();
    $('body').append('<div id="TB_overlay" class="TB_overlayBG" onclick="remove_popups()"></div><div class="popup_layer"  style="z-index: 9999;"></div>');
    $('.popup_layer').load('load_popup.php?type=registration&lang='+language, function(){
                                                          			   $('.popup_layer').css("margin-left", (-$('.popup_content').width())/2+"px").css("margin-top", (-$('.popup_content').height())/2+"px")
                                                        		   });
};

function triggerFashionPhotoForm() { 
	  $('#bubbls').hide();			
    $('#TB_overlay').remove();
    $('.popup_layer').remove();
	  $('body').append('<div id="TB_overlay" class="TB_overlayBG" onclick="remove_popups()"></div><div class="popup_layer"></div>');
	  $('.popup_layer').load('load_popup.php?type=add_photo&lang='+language,function(){
															   
															   $('.popup_layer').css("margin-left", (-$('.popup_content').width())/2+"px").css("margin-top", (-$('.popup_content').height())/2+"px")
															   });
}

function triggerEventForm() { 
	  $('#bubbls').hide();			
    $('#TB_overlay').remove();
    $('.popup_layer').remove();
	  $('body').append('<div id="TB_overlay" class="TB_overlayBG" onclick="remove_popups()"></div><div class="popup_layer"></div>');
	  $('.popup_layer').load('load_popup.php?type=add_event&lang='+language,function(){
															   $('.popup_layer').css('position','absolute').css('top','200px');
															   $('.popup_layer').css("margin-left", (-$('.popup_content').width())/2+"px")
															   $('.styled_select_event').sSelect({ddMaxHeight: '250px'});
															   });
}
function triggerEventEditForm( event_id ) { 
	  $('#bubbls').hide();			
    $('#TB_overlay').remove();
    $('.popup_layer').remove();
	  $('body').append('<div id="TB_overlay" class="TB_overlayBG" onclick="remove_popups()"></div><div class="popup_layer"></div>');
	  $('.popup_layer').load('load_popup.php?type=edit_event&lang='+language+"&e_id="+event_id,function(){
															   $('.popup_layer').css('position','absolute').css('top','200px');
															   $('.popup_layer').css("margin-left", (-$('.popup_content').width())/2+"px")
															   $('.styled_select_event').sSelect({ddMaxHeight: '250px'});
															   });
}

function triggerFashionEditForm( item_id ) { 
	  $('#bubbls').hide();			
    $('#TB_overlay').remove();
    $('.popup_layer').remove();
	  $('body').append('<div id="TB_overlay" class="TB_overlayBG" onclick="remove_popups()"></div><div class="popup_layer"></div>');
	  $('.popup_layer').load('load_popup.php?type=edit_fashion&id='+item_id+'&lang='+language,function(){
															   $('.popup_layer').css("margin-left", (-$('.popup_content').width())/2+"px").css("margin-top", (-$('.popup_content').height())/2+"px")
															   });
}



function toggleProfileBasicInfo() { 
		$('.profile_basic_info_content').toggle();
		$('.profile_basic_info').toggleClass('profile_basic_info_hide');
	};
	
function toggleProfilePersonalInfo() { 
		$('.profile_pers_info_content').toggle();
		$('.profile_pers_info').toggleClass('profile_pers_info_hide');
	};
	



function remove_popups()
{
	  $('#bubbls').show();
    $('#TB_overlay').remove();
    $('.popup_layer').remove();
}

function switchGender( gid )
{
  if ( gid == 1 )
	{
      $("#reg_gender").val( 'M' );
			$("#gender_male").addClass( "male_active" );
			$("#gender_female").removeClass( "female_active" );
	}
	else
	{
      $("#reg_gender").val( 'F' );
			$("#gender_female").addClass( "female_active" );
			$("#gender_male").removeClass( "male_active" );
	}
}

function attemptToRegister( lang )
{
   	$("#title_uemail").removeClass("error");
   	$("#title_upassword").removeClass("error");
   	$("#title_repassword").removeClass("error");
  	$("#title_uname").removeClass("error");
  	$("#title_country").removeClass("error");
  	$("#title_gender").removeClass("error");
  	$("#title_birthday").removeClass("error");

    if ( !$('#reg_uemail').val() || 
		     !$('#reg_upassword').val() || 
				 !$('#reg_repassword').val() || 
				 !$('#reg_uname').val() || 
				 !$('#reg_country').val() || 
				 !$('#reg_birthday').val() || 
				 !$('#reg_gender').val() )
  	{
        if ( !$('#reg_uemail').val() )
      	{
        	$("#title_uemail").addClass("error");
      	}
        if ( !$('#reg_upassword').val() )
      	{
        	$("#title_upassword").addClass("error");
      	}
        if ( !$('#reg_repassword').val() )
      	{
        	$("#title_repassword").addClass("error");
      	}
        if ( !$('#reg_uname').val() )
      	{
        	$("#title_uname").addClass("error");
      	}
        if ( !$('#reg_country').val() )
      	{
        	$("#title_country").addClass("error");
      	}
        if ( !$('#reg_gender').val() )
      	{
        	$("#title_gender").addClass("error");
      	}
        if ( !$('#reg_birthday').val() )
      	{
        	$("#title_birthday").addClass("error");
      	}
  			return;
  	}
		$.post("actions/users/register.php", 
		       { lang:       lang,
					   uemail:     $('#reg_uemail').val(), 
						 upassword:  $('#reg_upassword').val(), 
						 repassword: $('#reg_repassword').val(),
						 uname:      $('#reg_uname').val(),
						 ulastname:  $('#reg_ulastname').val(),
						 birthday:   $('#reg_birthday').val(),
						 gender:     $('#reg_gender').val(),
						 country:    $('#reg_country').val(),
						 phone:      $('#reg_phone').val(),
						 subscribe:  $('#reg_subscribe').val()
					 },
    		function( answer ){
				    
						if ( errorMessage[answer] != undefined )
						{
						    alert( errorMessage[answer] );
								
								if ( answer == 'too_short_email'|| answer == 'not_unique_email' || answer == 'wrong_email_pattern')
                  	$("#title_uemail").addClass("error");
								if ( answer == 'too_short_password'|| answer == 'passwords_dont_match')
								{
                  	$("#title_upassword").addClass("error");
                  	$("#title_repassword").addClass("error");
								}
								if ( answer == 'not_old_enough')
                  	$("#title_birthday").addClass("error");
								
						}
						else if ( answer != undefined && answer.substring(0, 3) == 'id=')
						{
    				    var userId = answer.substring(3);
								
                $.ajaxFileUpload
                (
                    {
                        url:'actions/users/upload_profile_photo.php?id=' + userId + "&lang=" + lang,
                        secureuri:false,
                        fileElementId:'photo',
                        dataType: 'text',
                        success: function (data, status)
                        {
												    window.location.reload();
                        }
                    }
                )
               
                return false;
						}
						
    		}, 'text'	
    	); 
}

function attemptToLogin( lang )
{
   	$("#title_uemail").removeClass("error");
   	$("#title_upassword").removeClass("error");

    if ( !$('#log_uemail').val() || 
		     !$('#log_upassword').val()  )
  	{
        if ( !$('#log_uemail').val() )
      	{
        	$("#title_uemail").addClass("error");
      	}
        if ( !$('#log_upassword').val() )
      	{
        	$("#title_upassword").addClass("error");
      	}
  			return;
  	}
		$.post("actions/users/login.php", 
		       { lang:       lang,
					   uemail:     $('#log_uemail').val(), 
						 upassword:  $('#log_upassword').val() 
					 },
    		function( answer ){
				    
						if ( errorMessage[answer] != undefined )
						{
						    alert( errorMessage[answer] );
						}
						else
						    window.location.reload();
						
    		}, 'text'	
    	); 
}

function attemptToResetPassword( lang )
{
   	$("#title_uemail").removeClass("error");

    if ( !$('#r_uemail').val() )
  	{
        if ( !$('#r_uemail').val() )
      	{
        	$("#title_uemail").addClass("error");
      	}
  			return;
  	}
		$.post("actions/users/reset_password.php", 
		       { lang:       lang,
					   uemail:     $('#r_uemail').val() 
					 },
    		function( answer ){
						if ( errorMessage[answer] != undefined )
						{
						    alert( errorMessage[answer] );
						}
						else
						    window.location.reload();
						
    		}, 'text'	
    	); 
}

function attemptToUpdateProfile( lang )
{
   	$("#title_uname").removeClass("error");
   	$("#title_country").removeClass("error");

    if ( !$('#prof_uname').val() || 
		     !$('#prof_country').val()  )
  	{
        if ( !$('#prof_uname').val() )
      	{
        	$("#title_uname").addClass("error");
      	}
        if ( !$('#prof_country').val() )
      	{
        	$("#title_country").addClass("error");
      	}
  			return;
  	}
		$("#editProfile").submit();
}

function attemptToUpdateLogin( lang )
{
   	$("#title_uemail").removeClass("error");
   	$("#title_upassword").removeClass("error");
   	$("#title_repassword").removeClass("error");

    if ( !$('#log_uemail').val() || 
		     ( $('#log_upassword').val() && !$('#log_repassword').val() ) ||
		     ( !$('#log_upassword').val() && $('#log_repassword').val() )
				  )
  	{
        if ( !$('#log_uemail').val() )
      	{
        	$("#title_uemail").addClass("error");
      	}
        if ( ( !$('#log_upassword').val() && $('#log_repassword').val() ) ||  ( $('#log_upassword').val() && !$('#log_repassword').val() ))
      	{
        	$("#title_upassword").addClass("error");
        	$("#title_repassword").addClass("error");
      	}
  			return;
  	}
//		$("#editProfile").submit();
		$.post("actions/users/check_login_update.php", 
		       { lang:       lang,
					   uemail:     $('#log_uemail').val(), 
						 upassword:  $('#log_upassword').val(), 
						 repassword: $('#log_repassword').val()
					 },
    		function( answer ){
						if ( errorMessage[answer] != undefined )
						{
						    alert( errorMessage[answer] );
								
								if ( answer == 'too_short_email'|| answer == 'not_unique_email' || answer == 'wrong_email_pattern')
                  	$("#title_uemail").addClass("error");
								if ( answer == 'too_short_password'|| answer == 'passwords_dont_match')
								{
                  	$("#title_upassword").addClass("error");
                  	$("#title_repassword").addClass("error");
								}
						}
						else
						  $("#editLogin").submit();
    		}, 'text'	
    	); 
}

function toggleCheckbox( element, elementId, checked )
{
		var current_val = $("#" + elementId).val();
		
		var classToAdd = current_val == '1' ? 'checkbox' : "checkbox_checked";
		var classToRemove = current_val == '1' ? 'checkbox_checked' : "checkbox";
		
		$(element).removeClass( classToRemove);
		$(element).addClass( classToAdd);
	
		current_val = Math.abs( current_val - 1 );
		
		$("#" + elementId).val( current_val );
}
 
function resortFashionGuide( url )
{
//  var selected = $("#resort_select :selected").getSetSSValue();
  var selected = $("#resort_select :selected");
	
	window.location.href = url + "&sort_by=" + selected.val();
}

function attemptToAddPhoto( lang )
{
   	$("#title_descriptions").removeClass("error");
   	$("#title_photo").removeClass("error");

    if ( $("#fg_descriptions").val() == "" || $("#fg_descriptions").val().length < 3  )
  	{
       	$("#title_descriptions").addClass("error");
				return;
  	}

    $.ajaxFileUpload
    (
        {
            url:'actions/fashion-guide/check_fashion_photo.php?lang=' + lang,
            secureuri:false,
            fileElementId:'photo',
            dataType: 'text',
            success: function (answer, status)
            {
    						if ( errorMessage[answer] != undefined )
    						{
    						    alert( errorMessage[answer] );
    								
                   	$("#title_photo").addClass("error");
    						}
								else
								$("#addPhotoForm").submit();
            }
        }
    )
}

function ratingOn( starID )
{
  for ( var i = 1; i <= starID; i++ )
	{
    $("#star"+i).attr( 'src', "images/icons/ico_34.gif" );
	}
	
	for( var j = starID + 1; j <=5 ; j++ )
	{
    $("#star"+j).attr( 'src', "images/icons/ico_35.gif" );
	}
}

function redrawRating( fullStars, halfStars)
{
  var wholeCount = 5;
	
	for( var i = 1; i <= fullStars; i++ )
	{
    $("#star"+i).attr ( 'src', "images/icons/ico_34.gif" );
	}
	
	if (halfStars != 0)
	{
	  var halfId = fullStars+1;
    $("#star"+halfId).attr ( 'src', "images/icons/ico_36.gif" );
		fullStars++;
	}
	
	for( var j = fullStars + 1; j <= wholeCount; j++ )
	{
    $("#star"+j).attr( 'src', "images/icons/ico_35.gif" );
	}
	
	
}

function fashionVote( photo_id, vote )
{
		$.post("actions/fashion-guide/add_vote.php", 
		       { lang:    language,
					   id:      photo_id,
						 vote:    vote 
					 },
    		function( answer ){
//				alert( answer );
				  var stars = answer.split("|");
          setCookie("fashion_vote" + photo_id, photo_id);
					redrawRating( parseInt(stars[0]), parseInt(stars[1]) )
//					alert( stars[0] + " " + stars[1] );
        	$("#voting_stars").attr( 'onmouseout', "")
					
					for( var i=1; i<=5; i++ )
					{
            	$("#voteLink"+i).attr( 'onmouseover', "" );
            	$("#voteLink"+i).attr( 'onclick', "" );
							$("#star"+i).css('cursor', 'auto');
					}
							
					$("#current_rating").html(stars[2]);
					$("#current_vote_count").html("("+stars[3]+")");
    		}, 'text'	
    	);   
}

function triggerCommentBlock ( elementId ) {
    var display = $("#"+elementId).css('display');

		if ( display == "block" ) {
    		$("#"+elementId).css('display', 'none');
				selectedSpot = "";
		}
		else {
    		$("#"+elementId).css('display', 'block');
				if ( selectedSpot != "" )
        		$("#"+selectedSpot).css('display', 'none');
				selectedSpot = elementId;
		}
	}

function attemptSaveFashionComment( elementId, spot_id )
{
    if ( $("#"+elementId).val() == "" || $("#"+elementId).val().length < 3  )
  	{
  	  alert( errorMessage['no_comment'] );
  		return;
  	}
		$.post("actions/fashion-guide/add_comment.php?lang="+language, 
		       { spot_id:    spot_id,
						 comment:    $('#'+elementId).val() 
					 },
    		function( answer ){
				    var comment_count = parseInt( answer );
    				if ( answer > 0 )
						{
						    $("#"+elementId).val("");
                $('#comment_list'+spot_id).load('modules/fashion-guide/get_spot_comments.php?spot_id='+spot_id+"&lang="+language, function(){ });
								$("#comment_link"+spot_id).html( answer );
       			}
    		}, 'text'	
    	);   
	
}

function switchOffFashionComments()
{
    $("#commentsOn").removeClass( "selected" );
    $("#commentsOff").addClass( "selected" );
		$("#spot_holder").css( "display", "none" );
		$.cookie( "fashion_comments_off", 1, { expires: 1, path: '/'  } );
}

function switchOnFashionComments()
{
    $("#commentsOn").addClass( "selected" );
    $("#commentsOff").removeClass( "selected" );
		$("#spot_holder").css( "display", "block" );
		$.cookie( "fashion_comments_off", null, {path: "/"} );
}

function allowNewSpot( event, photo_id )
{
		$("#photo_view").click( function( event ) { addNewSpot(event, photo_id); } );
//		$('body').css( 'cursor', 'crosshair' );
		
		$("#target").show();
		document.onmousemove = moveTarget;

		switchOnFashionComments();
}

	function moveTarget(ev){ 
	    ev           = ev || window.event; 
	    var mousePos = mouseCoords(ev);
			
			var targ = document.getElementById( 'target' );
			targ.style.left = mousePos.x + 1 + "px";
			targ.style.top  = mousePos.y + 1 + "px"; 
	} 
	 
	function mouseCoords(ev){ 
	    if(ev.pageX || ev.pageY){ 
	        return {x:ev.pageX, y:ev.pageY}; 
	    } 
	    return { 
	        x:ev.clientX + document.documentElement.scrollLeft - document.body.clientLeft, 
	        y:ev.clientY + document.documentElement.scrollTop  - document.body.clientTop 
	    }; 
	} 

function addNewSpot(event, photo_id){
		$("#photo_view").unbind("click");
		document.onmousemove = null;
		$("#target").hide();
		
    pos_x = event.offsetX ? (event.offsetX) : event.pageX - document.getElementById("photo_view").offsetLeft;
    pos_y = event.offsetY ? (event.offsetY) : event.pageY - document.getElementById("photo_view").offsetTop;
		
		pos_x -= 2;
		pos_y -= 1;
		
		//cia reikia sukurti nauja taska, ji atvaizduoti ir leisti jam prideti komentarus
		$.post("actions/fashion-guide/add_spot.php", 
		       { photo_id:    photo_id,
						 x: pos_x,
						 y: pos_y,
						 lang: language 
					 },
    		function( answer ){
				   var parts = answer.split("=");
					 
					 if ( parts[0] == "id" )
					 {
					     var spot_id = parts[1];
               $('#spot_holder').append('<div class="bubble" style="left:'+pos_x+'px; top:'+pos_y+'px" id="spot'+spot_id+'">');
               $('#spot'+spot_id).load('modules/fashion-guide/get_spot.php?spot_id='+spot_id+"&lang="+language, 
							     function(){ 
                      triggerCommentBlock ( "comments"+spot_id )
									 });
					 }
					 
    		}, 'text'	
    	);    
}

function reloadThumbs( direction, first_photo_id, user_id, active_photo_id, item_link )
{
     $('#thumb_list').load('modules/fashion-guide/get_thumb_list.php?first_photo_id='+first_photo_id+"&direction="+direction+"&lang="+language+"&user_id="+user_id+"&active_photo_id=" + active_photo_id + "&item_link=" + item_link, 
        function(){ 
        });
}

function reloadCalendar( year, month, user_id, events_mode )
{
     $('#event_calendar').load('modules/events/get_calendar.php?year='+year+"&month="+month+"&lang="+language+"&user_id="+user_id+"&events_mode="+events_mode, 
        function(){ 
        });
}

function triggerEventBlock( elementId )
{
//  alert( $('#'+elementId).css('display') );
  var display = $('#'+elementId).css( 'display' );
	
	if ( display == "none" )
	{
      $('#'+elementId).parent().addClass('relative_block');
      $('#'+elementId).css( 'display', 'block' );
			
			if ( calendarDaySelected != "" )
			{
          $('#'+calendarDaySelected).css( 'display', 'none' );
          $('#'+calendarDaySelected).removeClass( 'relative_block' );
			}
			    
			calendarDaySelected = elementId;
	}
	else
	{
      $('#'+elementId).css( 'display', 'none' );
      $('#'+elementId).removeClass( 'relative_block' );
			
			calendarDaySelected = "";
	}
}

function addEventParticipant( event_id )
{
  $("#addParticipantLink").html( '<br /><br />');
	
  $.post("actions/events/add_participant.php?lang="+language, 
         { event_id:    event_id
  			 },
    		function( answer ){
				    var participantNumber = parseInt( answer );
						
						$("#participantCountHolder").css( "display", "block"  );
						$("#participantCount").html( participantNumber );
    		}, 'text'  	
    	);   
	
}

function validateEventForm( formId  )
{
   	$("#title_title").removeClass("error");
   	$("#title_place").removeClass("error");
   	$("#title_descriptions").removeClass("error");
		
		var is_error = false;

    if ( $("#e_title").val() == "" || $("#e_title").val().length < 3  )
  	{
       	$("#title_title").addClass("error");
				is_error = true;
  	}
    if ( $("#e_place").val() == "" || $("#e_place").val().length < 3  )
  	{
       	$("#title_place").addClass("error");
				is_error = true;
  	}
    if ( $("#e_descriptions").val() == "" || $("#e_descriptions").val().length < 10  )
  	{
       	$("#title_descriptions").addClass("error");
				is_error = true;
  	}
		
		if ( is_error ) return;
		
    $.ajaxFileUpload
    (
        {
            url:'actions/events/validate_photo.php?lang=' + language,
            secureuri:false,
            fileElementId:'photo',
            dataType: 'text',
            success: function (answer, status)
            {
    						if ( errorMessage[answer] != undefined )
    						{
    						    alert( errorMessage[answer] );
    								
                   	$("#title_photo").addClass("error");
    						}
								else
								$("#"+formId).submit();
            }
        }
    )
	
}

function validateCommentForm( )
{
    if ( $("#e_comment").val() == "" || $("#e_comment").val().length < 3  )
       	alert( errorMessage['no_comment'] );
		else
		    $("#commentForm").submit();
}

function validateSearchForm( )
{
    if ( $("#search_q").val() == "" || $("#search_q").val().length < 3  )
       	alert( errorMessage['no_search_query'] );
		else
		{
//		  alert( $("#searchForm") );
//		    $("#searchForm").submit();
        document.forms.searchForm.submit();
		}
}

function reloadEventThumbs( direction, first_photo_id, user_id, event_id, active_photo_id, item_link )
{
     $('#thumb_list').load('modules/events/get_thumb_list.php?first_photo_id='+first_photo_id+"&direction="+direction+"&lang="+language+"&user_id="+user_id+"&active_photo_id=" + active_photo_id + "&event_id=" + event_id + "&item_link=" + item_link, 
        function(){ 
        });
}

function validatePhotoDescription( )
{
   	$("#title_descriptions").removeClass("error");
		
    if ( $("#fg_descriptions").val() == "" || $("#fg_descriptions").val().length < 3  )
       	$("#title_descriptions").addClass("error");
		else
		{
        document.forms.editPhotoForm.submit();
		}
}

function attemptDeleteFashionComment( spot_id, comment_id )
{
		$.post("actions/fashion-guide/delete_comment.php?lang="+language, 
		       { spot_id:    spot_id,
						 comment_id: comment_id 
					 },
    		function( answer ){
				    var comment_count = parseInt( answer );
//    				if ( answer > 0 )
//						{
                $('#comment_list'+spot_id).load('modules/fashion-guide/get_spot_comments.php?spot_id='+spot_id+"&lang="+language, function(){ });
								$("#comment_link"+spot_id).html( answer );
//       			}
    		}, 'text'	
    	);   
	
}

function acceptDisclaimer( lang )
{
		$.cookie( "disclaimer_accepted", 1, { expires: 1, path: '/'  } );
		
		var linkLocation = $('#requested_link').val();
		if ( linkLocation == '' )
		  linkLocation = $('#index_'+lang).val();
	
		window.location = linkLocation;
}

function addFriend( friend_id )
{
    $("#addFriendLink").hide();
    $("#addFriendExplanation").show();
		$.post("actions/users/add_friend.php", 
		       { lang:      language,
					   friend_id: friend_id
					 },
    		function( answer ){
    		}, 'text'	
    	);   
}



