window.onload = function() {
}

function RoundCorners() {
    var cornerTop = RUZEE.ShadedBorder.create({ corner:5, edges:"tlr"});
    cornerTop.render($('.corner-top'));

//    var cornerBot = RUZEE.ShadedBorder.create({ corner:5, edges:"blr"});
//    cornerBot.render($('.corner-bot'));

//    var cornerAll = RUZEE.ShadedBorder.create({ corner:8, border:2});
//    cornerAll.render($('.corner-all'));

     var baseUrl = '/';
     if ($('#fckUrl').val() != null) {
         baseUrl = $('#fckUrl').val();
     }
	 if ($('#fck').val() != null) {
         var oFCKeditor = new FCKeditor('fck');
         oFCKeditor.BasePath = baseUrl + 'public/scripts/fckeditor/';
         oFCKeditor.Height = '400';
         oFCKeditor.Width = '750';
         oFCKeditor.ReplaceTextarea();
     }
	 if ($('#fck_sml').val() != null) {
         var oFCKeditor = new FCKeditor('fck_sml');
         oFCKeditor.BasePath = baseUrl + 'public/scripts/fckeditor/';
         oFCKeditor.Height = '200';
         oFCKeditor.Width = '500';
         oFCKeditor.ToolbarSet = 'Basic' ;
         oFCKeditor.ReplaceTextarea();
     }
	 if ($('#fck_sm1').val() != null) {
         var oFCKeditor = new FCKeditor('fck_sm1');
         oFCKeditor.BasePath = baseUrl + 'public/scripts/fckeditor/';
         oFCKeditor.Height = '200';
         oFCKeditor.Width = '500';
         oFCKeditor.ToolbarSet = 'Basic' ;
         oFCKeditor.ReplaceTextarea();
     }
	 if ($('#fck_sm2').val() != null) {
         var oFCKeditor = new FCKeditor('fck_sm2');
         oFCKeditor.BasePath = baseUrl + 'public/scripts/fckeditor/';
         oFCKeditor.Height = '300';
         oFCKeditor.Width = '300';
         oFCKeditor.ToolbarSet = 'Basic' ;
         oFCKeditor.ReplaceTextarea();
     }
}
	function check_browser() {
		var version = 0;
		if (navigator.userAgent.indexOf("MSIE 7.0") != -1)
			return "IE 7";
/*		else if (navigator.userAgent.indexOf ("MSIE 5") != -1)
			return "IE 5";
		else if (navigator.userAgent.indexOf("MSIE 4") != -1)
			document.write ("Internet Explorer 3.0!");
		else if (navigator.userAgent.indexOf ("MSIE 4.5") != -1)
			document.write ("Microsoft Internet Explorer 4.5 for Macintosh");
		else if (navigator.userAgent.indexOf ("Opera") != -1)
			document.write("Opera");
		else if (navigator.userAgent.indexOf ("Mozilla/5.0") != -1)
			document.write ("Navigator 5 или выше (в т.ч. 6.2+)");
		else if (navigator.userAgent.indexOf ("Mozilla/4.7") != -1)
			document.write ("Navigator 4.7");
		else if ………
		else version = 8;
			return true;
*/

	}

/* ??????????????
function HideHiddenInfo()
{
	$('#hiddenInfo').fadeOut();
	$('#hiddenInfo-text').html('');
}*/

function ShowMoreInfo(link,info,speed)
{
	if (speed == 'fast')
	{
		$('#'+link).hide();
		$('#'+info).show();
	}
	else
	{
		$('#'+link).fadeOut();
		$('#'+info).fadeIn();
	}
}

/* auth */
function ShowAuthForm(cmd)
{
	if (cmd == 'on')
	{
		$('.top_regster').hide();
		$('#auth_form').fadeIn();
	}
	else
	{
		$('#auth_form').hide();
		$('.top_regster').show();
	}


	return false;
}

function ChangeAuthType(type)
{
	var user = $('#auth_user'),
		employer = $('#auth_employer'),
		auth_type = $('#auth_type'),
		string_type = $('#string_type');

	if (type == 'user')
	{
		user.attr('src','/public/img/authuser.jpg');
		employer.attr('src','/public/img/authemployer_disabled.jpg');
		auth_type.val('users');
		string_type.html('Пользователь: ');
	}
	else if (type == 'employer')
	{
		user.attr('src','/public/img/authuser_disabled.jpg');
		employer.attr('src','/public/img/authemployer.jpg');
		auth_type.val('employers');
		string_type.html('Работодатель: ');
	}

}
/* auth end */

function prepareAjaxForm(formId, beforeSubmit, onSuccess, Target)  {
	$(formId).ajaxForm({
        beforeSubmit: beforeSubmit,
        success:      onSuccess,
        target:       Target
    });

}

function showAjaxFormResponse(data) {
     $("#output").append(data); unblockUI();
}

/* works actions*/

/* rspn */
function EditRspn(id) {
	Loader('message'+id,'show');
	$('#message'+id).load('/rspn/editrspn', {'rspn_id': id});
}

function EditRspnSave(id) {
	var textarea =  FCKeditorAPI.GetInstance('fck_sm1');
	var curvalue = textarea.GetHTML();
	$.post('/rspn/saveedit', {'id': id, 'comment' : curvalue}, function(data) {
	  $("#message"+id).html(data);
	});
}


function EditRspnHistory(id) {
	$('#edit_history'+id).load('/rspn/getedithistory', {'rspn_id': id});
}

function EditRspnForum(id) {
	Loader('message'+id,'show');
	$('#message'+id).load('/forum/editrspn', {'rspn_id': id});
}
function DelRspnForum(id) {
	if (confirm('Вы уверены. что хотие удалить это сообщение ?'))
	{
		$('#message'+id).load('/forum/delrspn', {'rspn_id': id});
	}
}

function EditRspnForumSave(id) {
	rspn_title = $("#rspn_title"+id).val();
	var textarea =  FCKeditorAPI.GetInstance('fck_sm1');
	var curvalue = textarea.GetHTML();
	$.post('/forum/saveedit', {'id': id,'rspn_title' : rspn_title, 'comment' : curvalue}, function(data) {
	  $("#message"+id).html(data);
	});
}


function EditRspnForumHistory(id) {
	$('#edit_history'+id).load('/forum/getedithistory', {'rspn_id': id});
}


function VoteForRspn(id,vote) {
	if (confirm('Вы уверены, что это стоящий комментарий?'))
	{
		blockUI();
		$('#div_vote_rspn'+id).load('/rspn/vote', {'rspn_id': id, 'vote' : vote}, unblockUI());		
	}
}

function DelComment(section,id) {
	blockUI();
	$('#comment'+id).load('/rspn/del', {'rspn_id': id, 'section' : section}, unblockUI());
}

function ReloadCaptcha(first,second) {
	blockUI();
	$('#captcha_fields').load('/'+first+'/'+second, '',unblockUI());
}


function VoteForWork(module,id,vote,multy) {
	blockUI();
	var str = 'section=' + module + '&workid=' + id + '&vote=' + vote;
	if (multy == 1)
	{
		var buttons = $("#vote_buttons_"+id);
		var result = $("#ajaxresult_"+id);
	}
	else
	{
		var buttons = $("#vote_buttons");
		var result = $("#ajaxresult");
	}

  	$.post('/' + module + '/vote', str, function(data) {buttons.hide(); result.html(data); unblockUI();});
	return false;
}

function voteForWorkCapacity(id,val) {
	blockUI();
	var str = 'workid=' + id + '&capacity=' + val;
  	$.post('/gallery/capacity', str, function(data) {$('#divWorkCapacity').hide(); $("#divWorkCapacity_result").html(data); unblockUI();});
	return false;
}

function voteForLeaveSandbox(id) {
	blockUI();
	var str = 'workid=' + id + '&category=' + $('#category').val();
  	$.post('/gallery/sandbox', str, function(data) {$('#divWorkCategory').hide(); $("#divWorkCategory_result").html(data); unblockUI();});
	return false;
}

function addWorkToCommunGal() {
  blockUI();
  var str = $("#WorkToCommunity").serialize();
  $.post('/gallery/tocommungal', str, function(data) {
    $("#divAddWorkToCommun").html(data); unblockUI();
  });
}


function addWorkToPortfolio() {
  blockUI();
  var str = $("#WorkToPortfolio").serialize();
  $.post('/gallery/toporfolio', str, function(data) {
    $("#divAddWorkToPortfolio").html(data); unblockUI();
  });
}

function FlashEnlarge() {
	var width = $('#smth').attr('width');
	if (width == '550') {
		$('#smth').attr('width','1000');
		$('#smth').attr('height','728');
	}
	else {
		$('#smth').attr('width','550');
		$('#smth').attr('height','400');
	}
}

function ChangeBgcolor(color)
{
	$('.photo_work').css("background-color",color);
}

function ImgManage(id, img, cmd, target)
{
	$('#'+cmd).hide();
	$('#'+target).show();

/*	if (cropObj == null)
	{
		var cropObj = $('img#img_target').imgAreaSelect({ instance: true });
	}
*/
	if (cmd == 'Back1' || cmd == 'Back2' || cmd == 'Back3' || cmd == 'Back4')
	{
		$('#work_img').html('<img src="/'+img+'">');

		if (cmd == "Back4")
		{
			$('#crop_panel').hide();
			$('#bgmanage_panel').show('slow');

			$('img#img_target').imgAreaSelect({ hide:true});

		    $('#x1').val(0);
		    $('#y1').val(0);
		    $('#x2').val(0);
		    $('#y2').val(0);
		    $('#w').val(0);
		    $('#h').val(0);
		}
	}
	else
	{
		if (cmd == 'Gray') {$('#Back2').hide();$('#Back3').hide();$('#Flip').show();$('#Flop').show();}
		if (cmd == 'Flip') {$('#Back1').hide();$('#Back3').hide();$('#Gray').show();$('#Flop').show();}
		if (cmd == 'Flop') {$('#Back1').hide();$('#Back2').hide();$('#Gray').show();$('#Flip').show();}

		if (cmd == 'Crop')
		{
			$('#bgmanage_panel').hide();
			$('#crop_panel').show('slow');

			$('img#img_target').imgAreaSelect({ handles: true, hide:true, onSelectEnd: CropPreview });
		}
		else
		{
			blockUI();
			$('#work_img').load('/gallery/manage', {'img': img, 'act' : cmd}, unblockUI());
		}
	}
}


function CropPreview(img, selection) {
    if (!selection.width || !selection.height)
       return;

	    $('#x1').val(selection.x1);
	    $('#y1').val(selection.y1);
	    $('#x2').val(selection.x2);
	    $('#y2').val(selection.y2);
	    $('#w').val(selection.width);
	    $('#h').val(selection.height);
}

function inserCrop(textarea_id)
{
	var textarea =  FCKeditorAPI.GetInstance(textarea_id);
	var curvalue = textarea.GetHTML();
	var preview = '[crop]' + $('#x1').val() + ':' + $('#y1').val() + ':' + $('#x2').val() + ':' + $('#y2').val() + '[/crop]';
	textarea.SetHTML(preview);
	$('#insert_btn').html('<span class="simple_success">Кадр вставлен</span>');
}

function DoCrop(x1,y1,x2,y2)
{
	$('#Back4').hide();
	$('#Crop').show();

	window.scrollTo(0,100);

	$('#bgmanage_panel').hide();
	$('#crop_panel').show('slow');

	$('img#img_target').imgAreaSelect({ x1: x1, y1: y1, x2: x2, y2: y2, onSelectEnd: CropPreview });

	var width = x2-x1;
	var height = y2-y1;

	    $('#x1').val(x1);
	    $('#y1').val(y1);
	    $('#x2').val(x2);
	    $('#y2').val(y2);
	    $('#w').val(width);
	    $('#h').val(height);
}

/* works actions end */

/* forum */
function forumReply(textarea_id,to,date,to_id)
{
	var textarea =  FCKeditorAPI.GetInstance(textarea_id);
	var curvalue = textarea.GetHTML();
	textarea.SetHTML(curvalue + '<span id="smthhere"><i>Ответ для '+to+' ('+date+'):</i></span>');
	$('#add_mess').fadeIn();
    window.location.href = "#addmes_anchor";

	var textarea2 =  FCKeditorAPI.GetInstance(textarea_id);
    textarea2.Focus();
    	var stroka = '<span id="rspn_to'+to_id+'">';
    	stroka += '<a href="javascript:void(0);" OnClick="$(\'#rspn_to'+to_id+'\').remove();" title="удалить ответ">X</a> ';
    	stroka += '<input name="rspn_to[]" type="hidden" value="'+to_id+'">';
    	stroka += 'ответ для '+to;
    	stroka += '<br/></span>';

    $('#personal_responses').append(stroka);
}

function checkLoadFck() {
	 var baseUrl = '/';
     if ($('#fckUrl').val() != null) {
         baseUrl = $('#fckUrl').val();
     }
	 if ($('#fck').val() != null) {
         var oFCKeditor = new FCKeditor('fck');
         oFCKeditor.BasePath = baseUrl + 'public/scripts/fckeditor/';
         oFCKeditor.Height = '400';
         oFCKeditor.Width = '800';
         oFCKeditor.ReplaceTextarea();
     }
	 if ($('#fck_sml').val() != null) {
         var oFCKeditor = new FCKeditor('fck_sml');
         oFCKeditor.BasePath = baseUrl + 'public/scripts/fckeditor/';
         oFCKeditor.Height = '200';
         oFCKeditor.Width = '500';
         oFCKeditor.ToolbarSet = 'Basic' ;
         oFCKeditor.ReplaceTextarea();
     }
	 if ($('#fck_sm1').val() != null) {
         var oFCKeditor = new FCKeditor('fck_sm1');
         oFCKeditor.BasePath = baseUrl + 'public/scripts/fckeditor/';
         oFCKeditor.Height = '200';
         oFCKeditor.Width = '500';
         oFCKeditor.ToolbarSet = 'Basic' ;
         oFCKeditor.ReplaceTextarea();
     }
}
/* forum end */

function fadeOutIn(buttonid,divid)
{
	$('#'+buttonid).fadeOut(300);
	setTimeout('$(\'#'+divid+'\').fadeIn(300)',300);
}

function blockUI(){
        $.blockUI({ css: {
            border: 'none',
            padding: '10px',
            backgroundColor: '#000000',
            opacity: '.5',
            color: '#fff'
        } });
}

function unblockUI(){
	$.unblockUI();
}

function MakeNoClicking(){
        $.blockUI({ css: {
            border: 'none',
            padding: '10px',
            backgroundColor: '#000000',
            opacity: '.5',
            color: '#fff'
        } });

        setTimeout($.unblockUI, 10000);
}

function AlertErrorMsg(obj,text)
{
	obj.addClass('errorMsg')
	obj.html("<span><strong>Ошибка:</strong> " + text+'</span>');
}

function AlertSuccessMsg(obj,text)
{
	obj.addClass('successMsg')
	obj.html("<span><strong>Внимание:</strong> " + text+'</span>');
}

function AlertSomeMsg(obj,text)
{
	obj.addClass('someMsg')
	obj.html("<span><strong>Внимание:</strong> " + text+'</span>');
}

/* community */
function JoinInCommunity(id) {
	blockUI();
	$('#join'+id).load('/community/join', {'id': id},unblockUI());
}

function LeaveCommunity(id) {
	if (confirm('Вы уверены, что выйти из данного сообщества ?'))
	{
		blockUI();
		$('#leave'+id).load('/community/leave', {'id': id},unblockUI());
	}
	return false;
}

function delBlogPost(id) {
	if (confirm('Вы уверены, что хотите удалить данный пост ?'))
	{
		blockUI();
		$('#post').load('/userblog/delpost', {'id': id},unblockUI());
	}
	return false;
}
/* albums */
function addWorkToAlbum() {
  blockUI();
  var str = $("#WorkToAlbum").serialize();
  $.post('/albums/addworktoalbum', str, function(data) {
    $("#divAddWorkToAlbum").html(data); unblockUI();
  });
}

function delWorkFromAlbum(id,album_id) {
	if (confirm('Вы уверены, что хотите удалить эту работу из альбома ?'))
	{
	  blockUI();
  	  $('#tdWithWork'+id).load('/albums/delworkfromalbum', {'id': id, 'album_id': album_id},unblockUI());
	}
	return false;
}

/* forum */
function trackTopic(id) {
	blockUI();
	$('#tracktopicButton').load('/forum/tracktopic', {'topicid': id},unblockUI());
}

function untrackTopic(id) {
	blockUI();
	$('#untracktopicButton').load('/forum/untracktopic', {'topicid': id},unblockUI());
}

function MakeTopicFav(id) {
	blockUI();
	$('#favtopicButton').load('/forum/favtopic', {'topicid': id},unblockUI());
}

function UnMakeTopicFav(id) {
	blockUI();
	$('#favtopicButton').load('/forum/unfavtopic', {'topicid': id},unblockUI());
}

function ForumVoteTopic(id,operation) {
	blockUI();
	$('#forum_vote_topic_div'+id).fadeOut();
	$('#ajaxresulttopic'+id).load('/forum/vote', {'act':'topic','value':operation,'workid':id},unblockUI());
}

function ForumVoteMessage(id,operation) {
	blockUI();
	$('#forum_vote_topic_div'+id).fadeOut();
	$('#ajaxresultmessage'+id).load('/forum/vote', {'act':'message','value':operation,'workid':id},unblockUI());
}

function ForumShowFilesMessage(id) {
	blockUI();
	$('#button_mess_files'+id).fadeOut();
	$('#forum_mess_files'+id).fadeIn();
	$('#forum_mess_files'+id).load('/forum/getmessfiles', {'messid':id},unblockUI());
}

function GetFirstMessage(id) {
	content = $('#first_mess'+id).html();
	div=document.getElementById('first_mess'+id);
	if (div.style.display == '') {
		if (content == '') {
			blockUI();
			$('#first_mess'+id).load('/forum/firstmess', {'topicid': id},function() {$('#first_mess'+id).show(100); unblockUI()} );
		}
		else
			$('#first_mess'+id).show(100);
	}
	else
		$('#first_mess'+id).css({'display':''});

}
/* forum end */

function OpacityChange(id,param) {
	if (param == 'on') {
		$('#'+id).removeClass("opacity70")
		 	 .addClass("opacity100");
	}
	else if (param == 'off') {
		$('#'+id).removeClass("opacity100")
		 	 .addClass("opacity70");
	}
}

function CarouselSlide(side,power,ctg,id,table) {
	last = $('#carousel_last').val();
	first = $('#carousel_first').val();
	if (table == null || table == "undefined") {
		Loader('carousel','show');
		$('#carousel').load('/gallery/slidecarousel', {'side':side,'power': power,'ctg':ctg,'id': id,'first':first,'last':last},$('#carousel').fadeIn(200));
	}
	else {
		Loader('carousel','show');
		$('#carousel').load('/'+table+'/slidecarousel', {'side':side,'power': power,'ctg':ctg,'id': id,'first':first,'last':last},$('#carousel').fadeIn(200));
	}
}


/* dviger search */
function DvigerSearch(command)
{
	blockUI();
	var form = $('#' + command + '_search'),
		result = $('#' + command + '_searchresult');

	var params = form.serialize();

	$.post('/search/'+command, params, function(data) {result.html(data); unblockUI(); });
}

/* reliability of employer and firm*/
function VoteReliability(mark,uid,utype)
{
	blockUI();
	$('#reliability_vote').load('/reliability/vote', {'mark':mark,'uid': uid,'utype':utype},unblockUI());
}

function DeleteRspnReliability(id,uid,utype)
{
	blockUI();
	$('#rel_com'+id).load('/reliability/delete', {'id':id,'uid': uid,'utype':utype},unblockUI());
}


function DoAjaxById(id,output,path,param,fade) {
	if (fade == null || fade == "undefined") {
		Loader(output+id,'show');
		$('#'+output+id).load(path, {'id':id,'param':param});
	}
	else {
		blockUI();
		Loader(output+id,'show');
		$('#'+output+id).load(path, {'id':id,'param':param},function() { unblockUI();});
	}
}

function DoAjaxByIdPopup(id,second_id,path,param,fade,div_id) {
	if (div_id == null || div_id == "undefined") div_id = '';

	if (fade == null || fade == "undefined") {
		Loader('wind'+div_id,'show');
		$('#wind'+div_id).load(path, {'id':id,'ctg':second_id},function() { $('#wind'+div_id).fadeIn(300); });
	}
	else {
		blockUI();
		Loader('wind'+div_id,'show');
		$('#wind'+div_id).load(path, {'id':id,'ctg':second_id},function() { unblockUI(); $('#wind'+div_id).fadeIn(300); } );
	}
}

function DoAjaxForm(id,output,path,form,fade) {
	if (fade == null || fade == "undefined") {
	  var str = $("#"+form+id).serialize();
	  $.post(path, str, function(data) { $("#"+output+id).html(data); });
	}
	else {
	  blockUI();
	  var str = $("#"+form).serialize();
	  $.post(path, str, function(data) { $("#"+output+id).html(data); unblockUI(); });
	}
}

/* отправка быстрого сообщения */
function SendFlashPagerAnswer(uid,utype) {
	var textarea =  FCKeditorAPI.GetInstance('fck_sml');
	var curvalue = textarea.GetHTML();

	$.post('/mail/flashmsg', {'uid': uid,'utype' : utype, 'text' : curvalue}, function(data) {
	  $("#flash_req_msg").html(data);textarea.SetHTML('');
	});
}

function CenterElement(div,size) {
	$('#'+div).css("width",size+"px");

    var msg = $('#'+div);
    var height = $(window).height();
    var width = $(document).width();

    msg.css({
        'left' : width/2 - (msg.width() / 2),
        'z-index' : 15
    });

    msg.fadeIn(200);
}

function FixFckIE(id) {
	var textarea = FCKeditorAPI.GetInstance(id);
	var curvalue = textarea.GetHTML();
	$('#'+id).val(curvalue);
}

function GalleryTextChangeWidth(param) {
	if (param == 'ON') {
		if (width > 0) {
			width = width-5;
		}
		$('#text').css("padding-left",width+"%");
		$('#text').css("padding-right",width+"%");
	}
	else {
		if (width < 30) {
			width = width+5;
		}
		$('#text').css("padding-left",width+"%");
		$('#text').css("padding-right",width+"%");
	}
}

function SubmitTesting(id) {
  blockUI();
  var str = $("#Test").serialize();
  $.post('/testing/check', str, function(data) {
    $("#mark").html(data); unblockUI();
  });
}

/* auction timer */

function TimerStyle(periods)
{
	/*за 3 часа - зелененький*/
	if (periods[0] == 0 && periods[1] == 0 && periods[2] == 0 && periods[3] == 0 && periods[4] < 3 && periods[4] > 0)
	$('#timer').addClass('simple_success');
	/*за 1 час - красный*/
	else if (periods[0] == 0 && periods[1] == 0 && periods[2] == 0 && periods[3] == 0 && periods[4] == 0)
	$('#timer').addClass('simple_errors');
}

function TimerSync() {
    var time = null;
    $.ajax({url: '/time.php',
        async: false, dataType: 'text',
        success: function(text) {
            time = new Date(text);
        }, error: function(http, message, exc) {
            time = new Date();
    }});
    return time;
}

/* auction timer end */

function Loader(id,action) {
	if (action == 'show') {
		$('#'+id).html('<img src="/public/img/loader.gif">');
	}
	else {
		$('#'+id).html('');
	}
}

function confirmOrderRequest(id) {
	if (confirm('Вы уверены, что хотите поручить/отозвать заказ ?')) {
	blockUI();
	$('#confirmReq'+id).load('/order/confirmrequest', {'request_id': id},unblockUI());
	}
	return false;
}

function confirmOrderComplete(id) {
	if (confirm('Вы уверены, что хотите сделать/убрать победителем данного исполнителя ?')) {
	blockUI();
	$('#confirmReq'+id).load('/order/completeorder', {'request_id': id},unblockUI());
	}
	return false;
}

/* mkr */
function addMkrContactMan() {
	var counter = parseInt($('#additional_counter').text()) + 1; $('#additional_counter').text(counter); 
	var html = '<ul id="'+counter+'">'; 
	html += '<strong class="big15">'+counter+')</strong> ФИО, должность * <input name="man_fio[]" value="" size="80"> <a href="javascript:void(0);" title="Убрать" onclick="DelMkrContactManFileds(' + counter + ');"><img src="/public/img/red_minus.gif" alt="" ></a>  <br><br>' +
			'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Телефон * <input name="man_phone[]" value=""> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; ' +
			'E-mail * <input name="man_email[]" value=""> ' + 
			'</ul>';
	
	$('#additional').append(html);	
}

function DelMkrContactManFileds(id)
{
	var counter = parseInt($('#additional_counter').text(counter)) - 1; 
	$('#additional_counter').text(counter);
	$('#'+id).hide();
	$('#'+id).text('');
}
/* mkr end */

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

