function ChangeHome(title, url) {
	title = title == undefined ? "B2BAomen.com" : title;
	url = url == undefined ? "http://www.b2baomen.com" : url;

	document.body.style.behavior='url(#default#homepage)';  
	document.body.setHomePage(window.location.href);  

}

function CreateBookmarkLink(title, url) {
	title = title == undefined ? "B2BAomen.com" : title;
	url = url == undefined ? "http://www.b2baomen.com" : url;
	if (window.sidebar) {
  // Mozilla Firefox Bookmark  
		window.sidebar.addPanel(title, url, ""); 
	}else if( window.external ) {
  // IE Favorite  
		window.external.AddFavorite( url, title);
	}else if(window.opera && window.print) {
  // Opera Hotlist  
		return true;
	}
}

function AddToBriefcase(contentid) {
	var url = 'ajax_controller/addtobriefcase.php';
    var html = $.ajax({
			type:'POST',	
			url: url,
			data: {contentid:contentid},
			error: function(xhr) {
				alert('没有权限加入到公事包.');
    		},
	        success: function(response) {
				alert('已成功加入到公事包.');
				//$(document.body).setStyle('cursor', 'auto');
				//$(resultdiv).innerHTML = "";
				//$(resultdiv).html(response);
			}
    }).responseText;
}

function CheckLogin() {
	var url = 'ajax_controller/checklogin.php';
    var data = $.ajax({
			type:'POST',	
			url: url,
			data: {rnd:'rnd'},
			error: function(xhr) {
    		},
	        success: function(response) {
    			if(response=='ok')
    			{
    				try {
    					url = document.getElementById('after_login_url').value;
    					if(url != '')
    					{
    						location.href = url;
    					}
    					else
    						location.href = 'index.php';
    				}
    				catch(e) {
    					location.href = 'index.php';
    				}
    			}
			}
    });
}
