// JavaScript Document
function ajaxDelete(id) {
	if(confirm("Bạn muốn xóa bình luận này" )) 
	{
		var urlajax = "?m=mypage&a=deleteCo"; 	
	
	$.ajax({
		type: "POST",
		url: urlajax,
		data: "&id=" + id + "&suppressHeaders=1",
		success: function(msg) {
			if(msg.indexOf("failed") == -1) {
					$('#' + id).remove();
					$('div#statusMsg').html(msg);
			} else {
				$('div#statusMsg').html(msg);
			}
		}
	});
	}else{
		var urlajax = "?m=mypage&a=mypage"; 		
	}	
}

/*******************************************************/

function ajaxDeleteNews(id, user, status) {
	if(confirm("Bạn muốn xóa bài viết này")) 
	{
		var urlajax = "?m=mypage&a=deleteNews"; 	
	$.ajax({
		type: "POST",
		url: urlajax,
		data: "&id=" + id + "&status=" + status + "&suppressHeaders=1",		 
		success: function(msg) {
			alert('Bạn xóa thành công!'); 
			window.location = SANHDIEU + '/m/mypage/' + user + '/1/1';
		}
	});
	}else{
		var urlajax = "?m=mypage&a=mypage"; 		
	}	
}

<!--	
/**
 * load content by id 
 * id         
 */

function loadContent(a, id) 
{
	$("#").load("?m=export_box&a="+a+"&exp="+id);
	alert(id + ': Export complete!!');
	return false; 
}

<!--
/**
 * load content by element div anh url.
 *
 * element    div / span...
 * url      
 */
function loadContentTotal(a, id, str) 
{
	$("#").load("?m=export_box&a="+a+"&exp="+id+"&str="+str);
	alert(id + ': Export complete!!');
	return false; 
}


<!--
/**
 * load content by element div anh url.
 *
 * element    div / span...
 * url      
 */
function loadContentUrl(Element, url) 
{
	$("#"+Element+"").load(url);
	return false; 
}

<!--
/**
 * check value to return textbox 
 *
 * browser  
 */
function check(browser)
{
	document.getElementById("answer").value=browser;
}

<!--
/**
 * load content of by id .
 *
 * pollId 
 */
function loadContentPoller(Element, pollId) 
{
	setCookie('test_'+pollId, pollId, 1); 
	var id = document.getElementById('answer').value;
	$("#"+Element+"").load("?m=sanh_dieu&a=updatePoll&newsId="+pollId+"&pollId="+id+"&suppressHeaders=1");
	return false; 
}

<!--
/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure)
{
    expires = expires * 60*60*24*1000;
	var today = new Date();
	var expires_date = new Date( today.getTime() + (expires) );
    var cookieString = name + "=" +escape(value) + 
       ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + 
       ( (path) ? ";path=" + path : "") + 
       ( (domain) ? ";domain=" + domain : "") + 
       ( (secure) ? ";secure" : "");  
    document.cookie = cookieString;
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}