/* FLIPPA FUNCTIONS */

// FUCNTION TO SLIDE THE DIV
function slideDiv(id){
	$Jq("#"+id).slideToggle("slow");
}

function proceedListing(block){
	$Jq('#block').val(block);
	$Jq('#selListingFrm').submit();
}

function sendFaceBookFeed(name, desc, img, url, new_yipit_path, action, body, link_name, target_id){
  	var template_data = {
	    'name':name,
	    'href':url,
	    'description':desc,
	    'media':[{'type':'image', 'src':img, 'href':url}]
	};
  	if (new_yipit_path) {
    	var action_links = [{'text':link_name, 'href':new_yipit_path},
                      		{'text':'View Deal', 'href':url}];
  	}else{
    	var action_links = ''
  	};
  	function redirectTo(post_id, exception) {
    	if (post_id) {
      		if (action == 'send') {
        		window.location.reload();
      		};
      		if (action == 'created') {
				//        window.top.location = '/?act=' + action;
        		return;
      		};
      		if (action == 'updated') {
        		window.top.location = '/?act=' + action;
      		};
    	};
  	}
  	FB.Connect.requireSession(function() {
    	if (action == 'send') {
      		FB.Connect.streamPublish(body,template_data, action_links,target_id,'',redirectTo, false);
    	}else{
      		FB.Connect.streamPublish(body,template_data, action_links,target_id,'',redirectTo,true);
    	};
  	});
}
