var browser = navigator.appName;
//alert(browser);
var b_version = navigator.appVersion;
var version = parseFloat(b_version);
function whatchemo() {
	if (browser == "Netscape") {
		 tb_open_new('what_chemoready.jsp?TB_iframe=true&height=489&width=707&modal=true');
    }
    else {		
		 tb_open_new('what_chemoready.jsp?TB_iframe=true&height=489&width=707&modal=true');
    }	
}
function sideeffect() {
	if (browser == "Netscape") {
		 tb_open_new('side_effects.jsp?TB_iframe=true&height=502&width=707&modal=true');
    }
    else {
		tb_open_new('side_effects.jsp?TB_iframe=true&height=509&width=707&modal=true');
    }	
}
function chemoprepare() {
	if (browser == "Netscape") {
		 tb_open_new('chemo_prepare.jsp?TB_iframe=true&height=478&width=707&modal=true');
    }
    else {
		 tb_open_new('chemo_prepare.jsp?TB_iframe=true&height=481&width=707&modal=true');
    }	
}
function askdoctor() {
	if (browser == "Netscape") {
		 tb_open_new('ask_doctor.jsp?TB_iframe=true&height=528&width=707&modal=true');
    }
    else {
		 tb_open_new('ask_doctor.jsp?TB_iframe=true&height=531&width=707&modal=true');
    }
}
function viewchemo() {
	if (browser == "Netscape") {
		 tb_open_new('viewchemoplan.jsp?TB_iframe=true&height=502&width=707&modal=true');
    }
    else {
		 tb_open_new('viewchemoplan.jsp?TB_iframe=true&height=502&width=707&modal=true');
    }	
}

function email(){    
	if (browser == "Netscape") {
		tb_open_new('emailplan.jsp?TB_iframe=true&height=287&width=472&modal=true');
    }
    else {
		tb_open_new('emailplan.jsp?TB_iframe=true&height=294&width=472&modal=true');
    }
}

function email1(msg) {
	if (browser == "Netscape") {
		tb_open_new('emailplan.jsp?msg='+msg+'&TB_iframe=true&height=287&width=472&modal=true');
    }
    else {
		tb_open_new('emailplan.jsp?msg='+msg+'&TB_iframe=true&height=294&width=472&modal=true');
    }
}
function emailStatus(msg) {
	if (browser == "Netscape") {
		tb_open_new('emailstatus.jsp?msg='+ msg+ '&TB_iframe=true&height=124&width=473&modal=true');
    }
    else {
		tb_open_new('emailstatus.jsp?msg='+ msg+ '&TB_iframe=true&height=124&width=473&modal=true');
    }
}
function exit(){    
	if (browser == "Netscape") {
		tb_open_new('exit.jsp?TB_iframe=true&height=206&width=473&modal=true');
    }
    else {
		tb_open_new('exit.jsp?TB_iframe=true&height=206&width=473&modal=true');
    }
}

function preview(){
    window.location = "previewplan.jsp";
}

function save(){    
	if (browser == "Netscape") {
		tb_open_new('save.jsp?TB_iframe=true&height=206&width=400&modal=true');
    }
    else {
		tb_open_new('save.jsp?TB_iframe=true&height=206&width=400&modal=true');
    }
}

function plansaved(){    
	if (browser == "Netscape") {
		tb_open_new('yourplansaved.jsp?TB_iframe=true&height=124&width=473&modal=true');
    }
    else {
		tb_open_new('yourplansaved.jsp?TB_iframe=true&height=124&width=473&modal=true');
    }
}
function forgot() {
	if (browser == "Netscape") {
		tb_open_new('forgot.jsp?TB_iframe=true&height=208&width=473&modal=true');
    }
    else {
		tb_open_new('forgot.jsp?TB_iframe=true&height=208&width=473&modal=true');
    }
}

function saveexit(){    
	if (browser == "Netscape") {
		tb_open_new('yourplansaved.jsp?exit=yes&TB_iframe=true&height=124&width=473&modal=true');
    }
    else {
		tb_open_new('yourplansaved.jsp?exit=yes&TB_iframe=true&height=124&width=473&modal=true');
    }
}

function printPage(){
    //alert("hi");
    window.print();
}

function startNew(){    
	if (browser == "Netscape") {
		
		tb_open_new('personalize_plan.jsp?TB_iframe=true&height=415&width=472&modal=true');
    } else if (browser == "Microsoft Internet Explorer"){
        
        tb_open_new('personalize_plan.jsp?TB_iframe=true&height=416&width=472&modal=true');  
  }
    else {
    		
		tb_open_new('personalize_plan.jsp?TB_iframe=true&height=416&width=472&modal=true');
    }
}
function eraseStart(){   
	window.location.hash = "chemo"; 
	if (browser == "Netscape") {
		tb_open_new('erace.jsp?TB_iframe=true&height=182&width=472&modal=true');
    }
    else {
		tb_open_new('erace.jsp?TB_iframe=true&height=185&width=472&modal=true');
    }
}
function login(){   
	if (browser == "Netscape") {
		tb_open_new('login.jsp?TB_iframe=true&height=254&width=425&modal=true');
    }
    else {
		tb_open_new('login.jsp?TB_iframe=true&height=256&width=425&modal=true');
    }
}

function register(){    
	if (browser == "Netscape") {
		tb_open_new('register.jsp?TB_iframe=true&height=299&width=472&modal=true');
    }
    else {
		tb_open_new('register.jsp?TB_iframe=true&height=304&width=472&modal=true');
    }
}

function updateorsave(){    
	if (browser == "Netscape") {
		tb_open_new('updateorsave.jsp?TB_iframe=true&height=177&width=472&modal=true');
    }
    else {
		tb_open_new('updateorsave.jsp?TB_iframe=true&height=176&width=472&modal=true');
    }
}
function quickdemo(URL){    
	day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=810,height=632');");
}
function sessionRemoved(){
    window.location = "index.jsp";
    tb_remove();
    //alert("called sessionRemoved")
}

function addAsk(){
	window.location.hash = "chemo";
    if (browser == "Netscape") {
		tb_open_new('additional-ask.jsp?TB_iframe=true&height=519&width=640&modal=true');
    }
    else {
		tb_open_new('additional-ask.jsp?TB_iframe=true&height=520&width=640&modal=true');
    }
}

function addTips(){
    window.location.hash = "chemo";    
	if (browser == "Netscape") {
		tb_open_new('additional-tips.jsp?TB_iframe=true&height=200&width=472&modal=true');
    }
    else {
		tb_open_new('additional-tips.jsp?TB_iframe=true&height=201&width=472&modal=true');
    }
}

function addTodo(){
    window.location.hash = "chemo";    
	if (browser == "Netscape") {
		tb_open_new('additional-todo.jsp?TB_iframe=true&height=170&width=472&modal=true');
    }
    else {
		tb_open_new('additional-todo.jsp?TB_iframe=true&height=170&width=472&modal=true');
    }
}
function referaFriend() {
    window.location.hash = "chemo";    
	if (browser == "Netscape") {
		tb_open_new('referafriend.jsp?TB_iframe=true&height=312&width=472&modal=true');
    }
    else {
		tb_open_new('referafriend.jsp?TB_iframe=true&height=324&width=472&modal=true');
    }
}
function referaFriend1(msg) {
    window.location.hash = "chemo";    
	if (browser == "Netscape") {
		tb_open_new('referafriend.jsp?msg='+msg+'&TB_iframe=true&height=312&width=472&modal=true');
    }
    else {
		tb_open_new('referafriend.jsp?msg='+msg+'&TB_iframe=true&height=324&width=472&modal=true');
    }
}
function heared() {
    window.location.hash = "chemo";    
	if (browser == "Netscape") {
		tb_open_new('heared.jsp?TB_iframe=true&height=324&width=472&modal=true');
    }
	if (browser == "Microsoft Internet Explorer"){
		//  alert("Hi, Explorer User!");
		  tb_open_new('heared.jsp?TB_iframe=true&height=324&width=472&modal=true');  
	 }	
	else {
		tb_open_new('heared.jsp?TB_iframe=true&height=349&width=472&modal=true');
    }
}
function heared1(msg) {
    window.location.hash = "chemo";    
	if (browser == "Netscape") {
		tb_open_new('heared.jsp?msg='+msg+'TB_iframe=true&height=324&width=472&modal=true');
    }
    else {
		tb_open_new('heared.jsp?msg='+msg+'TB_iframe=true&height=349&width=472&modal=true');
    }
}
var ajax;
var arr;
var result;
var add;
function MyObject(){
    if (window.XMLHttpRequest) {
        ajax = new XMLHttpRequest();
    }
    else {
        if (window.ActiveXObject) {
            ajax = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else {
            ajax = new ActiveXObject("MSXML2.XMLHTTP");
        }
    }
}

function Hello(u, res, a){
    //alert("hello***");
    result = res;
    add = a;
    MyObject();
    ajax.onreadystatechange = helloCallback;
    //alert("from hello  "+u+"\n\n"+result.innerHTML+"\n\n"+add);
    var m = Math.random();
    ajax.open("GET", "../common/" + u + "&" + m, true);
    ajax.send(null);
}

function helloCallback(){
    var serverData;
    if (ajax.readyState == 4) {
        if (ajax.status == 200) {
            serverData = ajax.responseText;
            arr = serverData.split(",");
            //alert(arr[0] + "  --" + arr[1] + "--");
            //alert("from Hellocallback: "+add + document.getElementById(add));
            //alert(arr[0]);
            if (arr[0].toString() == "fail") {
                document.location = "index.jsp";
            }
            else {
                document.getElementById(add).innerHTML = "Update Plan";
                result.innerHTML = arr[1];
            }
            //alert(add + "  " + result.innerHTML);			
            ajex = null;
        }
    }
    else {
        document.getElementById(add).innerHTML = "<img src='images/usercheck.gif' height=20 width=20 />";
    }
}
function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1) { 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);

			if (c_end==-1) c_end=document.cookie.length;
				return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}

