function makeHomePage(element) {
			if ( (document.all) && (element) )	{
				element.style.behavior='url(#default#homepage)';
				element.setHomePage('http://www.shutaf.com');
			} else {
				alert('הגלשן בו הינכם משתמשים אינו מאפשר לעדכן את עמוד הבית שלכם באופן אוטומטי מתוך האתר. השתמשו בתפריטי הגלשן בכדי לעדכן את האתר כעמוד הבית');
			}
		}

// sidebar
var href = '';
var https_url = '';
var clicked_posts = [];
function sub_handler(parent_id) {
//	var current_group_shown = $('#current_group_shown').val();
	$('#sub_container__'+current_group_shown).hide();
	$('#sub_container__'+parent_id).show();
	$('#param__parent_id').val(parent_id);
	$('#current_group_shown').val(parent_id);
	$('#search').attr('action',$('#search').attr('action')+parent_id);
}

function display_image(showcase_id) {
	$(showcase_id + ' .youtube').hide();
	$(showcase_id + ' .image').show();
}
function display_youtube(showcase_id,youtube_id) {
	$('#showcase_container__'+showcase_id + ' .image').hide();
	$('#showcase_container__'+showcase_id + ' .youtube').show();
	showcase('youtube_'+showcase_id , 'youtube',youtube_id,200,150,'','','0');
}
function sidebar_param_handler(group_id){
	$('#level_2').html("&nbsp;");
	$('#loader').show();
 	$.get(href,{'action' : 'get_post_param', 'group_id' : group_id , 'template' : 'sidebar' } ,function(data){
     	$('#level_2').html(data);
     	$('#loader').hide();
	},'html');
 }
function submit_form_sidebar(form_id) {
	$(form_id).attr('action',href + $('#level_1').val());
	$(form_id).submit();
}
//seach
// not_first_display 
function send_email(post_id,user_email,confirmation) {
	var current_form = '#form_container_'+post_id;
	
	if (user_email == 'spam') {
		if (!$(current_form).hasClass('not_first_display')) { 
			$(current_form).html($('#form_handler_spam .form_container').html());
			$(current_form).addClass('not_first_display');
		}	
		$(current_form + ' textarea').val("מודעה "+post_id+"היא \n");
		$('#to_email').val(" ");
	} else {
		if (confirmation == 1) { 
			if (!$(current_form).hasClass('not_first_display')) { 
				$(current_form).html($('#form_handler .form_container_succsess').html());
				$(current_form).addClass('not_first_display');
			}
		} else { 
			if (!$(current_form).hasClass('not_first_display')) { 
				$(current_form).html($('#form_handler .form_container').html());
				$(current_form).addClass('not_first_display');
			}
		}
		$(current_form + ' textarea').val(" ");
		$('#to_email').val(user_email);
		
	}
	$(current_form).show();
	$('#post_id').val(post_id);	
}

function post_form_submit(post_id,to_email) {
	$('#form_container_'+post_id+ ' .to_email').val(to_email);
	$('#form_container_'+post_id+ ' .post_id').val(post_id);
	if (validate(document.getElementById('form_container_'+post_id))) {
		$('#form_container_'+post_id+ ' form').submit();
	}
}
//posts
function delete_post(post_id) {
	$.post(https_url+'/my-account/post-edit', {action:'delete',post:post_id});
	window.location= href+'/my-account?delete_success=1';
}
function post_sort_by_group(group_id,doc_type,user_id){
	$('#post_container').hide();
	$('#post_container').html("&nbsp;");
	$('#search_loader').show();
	
 	$.get(href,{'action' : 'get_post_param', 'group_id' : group_id , 'template' : 'user' ,'doc_type': doc_type,'user_id':user_id} ,
 		function(data){
	     	$('#post_container').html(data);
	     	$('#search_loader').hide();
 		},'html');
 }
function show_group_post(group_id,doc_type,user_id){
	$('#post_container').hide()
	$(' .s_title').removeClass('selected');
	$('#'+group_id+ ' .s_title').addClass('selected');
		$.get(href,{'action' : 'get_post_param', 'group_id' : group_id , 'template' : 'user' ,'doc_type': doc_type,'user_id':user_id} ,
 		function(data){
	     	$('#post_container').html(data);
			$('#post_container').show();
 		}
	,'html');
	
}
function jump(post,timestamp) {
	$.get(href,{'action' : 'update-timestamp','post' : post,'timestamp' : timestamp},
		function (data) {
			if (data == 'success') {
				$('.notes').toggle('slow');
			} else {
				$('#client_side_errors').toggle('slow');
				$('#client_side_errors .jump').show();
			}
		},'html');
		
}

function add_click(post) {
	if (jQuery.inArray(post,clicked_posts) < 0) {
		$.get(href,{'action' : 'update-clicks','post' : post },	function (data) {},'html');
	}
}
 
 
 
 
 
 
 
 
 
 
 
 
 
