		function check_iscanvas(domain, redirect){
			
			if(top.location.href.indexOf(domain)){
				top.location.href = redirect;
			}
			return false;
		}
			/*
			$(document).ready(function () {
                $("#tabs").tabs();
            });
*/
            function updateStatus(){
                var status  =   document.getElementById('status').value;
                
                $.ajax({
                    type: "POST",
                    url: "<?=$fbconfig['baseUrl']?>/ajax.php",
                    data: "status=" + status,
                    success: function(msg){
                        alert(msg);
                    },
                    error: function(msg){
                        alert(msg);
                    }
                });
            }
            function updateStatusViaJavascriptAPICalling(){
                var status  =   document.getElementById('status').value;
                    FB.api('/me/feed', 'post', { message: status }, function(response) {
                        if (!response || response.error) {
                             alert('Error occured');
                        } else {
                             alert('Status updated Successfully');
                        }
                   });
            }
            
            function streamPublish(caption, msg, name, description, imgsrc, hrefTitle, hrefLink, userPrompt){
                FB.ui(
                {
                    method: 'stream.publish',
                    message: msg,
                    attachment: {
                        'name': name,
						'media': [{
									'type': 'image',
									'src': imgsrc,
									'href': hrefLink
								  }],
                        'caption': caption,
                        'description': description,
                        'href': hrefLink,
						'target': '_blank'
						
                    },
                    action_links: [
                        { text: hrefTitle, href: hrefLink }
                    ],
                    user_prompt_message: userPrompt
                },
                function(response) {

                });
            }

            function increaseIframeSize(w,h){
                var obj =   new Object;
                obj.width=w;
                obj.height=h;
                FB.Canvas.setSize(obj);
            }


		function FB_login(){
			FB.login(function(response) {
			  if (response.session) {
				if (response.perms) {
				  // user is logged in and granted some permissions.
				  // perms is a comma separated list of granted permissions
					//FB.api('/me', function(response) {
					  //alert(response.name);
					//});
				  return "1";
				} else {
				  // user is logged in, but did not grant any permissions
				  return "0";
				}
			  } else {
				// user is not logged in
				return "0";
			  }
			}, {perms:'publish_stream,user_photos'});
		}

var login_status = 2;
var return_status = 0;
		function FB_checklogin(){

if(return_status == 1){
	return login_status;
}
			FB.getLoginStatus(function(response) {
			  if (response.session) {
				return_status = 1;
				login_status = 1;
			  } else {
				// no user session available, someone you dont know

				login_status = 0;
				//FB_login();
			  }
			});
return 0;
		}

		function showAccountInfo() {
		  FB.api(
			{
			  method: 'fql.query',
			  query: 'SELECT name, pic_square FROM user WHERE uid='+FB.getSession().uid
			},
			function(response) {
			  //Log.info('API Callback', response);
			  document.getElementById('account-info').innerHTML = (
				'<img src="' + response[0].pic_square + '"> ' +
				response[0].name +
				' <img onclick="FB.logout()" style="cursor: pointer;"' +
					'src="https://s-static.ak.fbcdn.net/rsrc.php/z2Y31/hash/cxrz4k7j.gif">'
			  );
			}
		  );
		}

