function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
};

function Set_Cookie(name,value,path,domain,expires,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
};

function Delete_Cookie(name,path,domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
};

function Display_Disclaimer(lang, ftype) {
	if (lang == "c") {
		if (ftype == "disclaimer_health_forum") {
			cookie_name = 'chealthforum';
			disclaimer_file = 'c_disclaimer_health_forum.html';
		} else if (ftype == "disclaimer_card") {
			cookie_name = 'ccard';
			disclaimer_file = 'c_disclaimer_card.html';
		} else if (ftype == "privacy") {
			cookie_name = 'cprivacy';
			disclaimer_file = 'c_privacy.html';
		} else if (ftype == "bone") {
			cookie_name = 'cbone';
			disclaimer_file = 'c_disclaimer_bonecare.html';
		} else {
			cookie_name = 'cterm';
			disclaimer_file = 'c_terms.html';
		}
	}
	else {
		if (ftype == "disclaimer_health_forum") {
			cookie_name = 'ehealthforum';
			disclaimer_file = 'e_disclaimer_health_forum.html';
		} else if (ftype == "disclaimer_card") {
			cookie_name = 'ecard';
			disclaimer_file = 'e_disclaimer_card.html';
		} else if (ftype == "privacy") {
			cookie_name = 'eprivacy';
			disclaimer_file = 'e_privacy.html';
		} else if (ftype == "bone") {
			cookie_name = 'ebone';
			disclaimer_file = 'e_disclaimer_bonecare.html';
		} else {
			cookie_name = 'eterm';
			disclaimer_file = 'e_terms.html';
		}
	}		

//	cookie_name = cookie_name + ftype;
			
//	if (!Get_Cookie(cookie_name) || Get_Cookie('session')!=cookie_name) {
	if (Get_Cookie(cookie_name) != "shown") {
		Set_Cookie(cookie_name,'shown','/');
//		Set_Cookie('session', cookie_name, '/');
		if (ftype == 'disclaimer_health_forum')
			fsize = 'width=600,height=400,left=100,top=100,scrollbars=yes';
		else if (ftype == 'disclaimer_card')
			fsize = 'width=600,height=400,left=100,top=100,scrollbars=yes';
		else if (ftype == 'privacy')
			fsize = 'width=600,height=400,left=50,top=50,scrollbars=yes';
		else 
			fsize = 'width=600,height=400,left=50,top=50,scrollbars=yes';
		a1 = window.open('/common/' + disclaimer_file ,'msdhkpopup',fsize);
		a1.focus();
	}


//	if (Get_Cookie('session')!=cookie_name){
//		Delete_Cookie(cookie_name,'/');
//	}
};