// <Script>

var Netscape6 = (navigator.appName == 'Netscape') && (navigator.appVersion.substr(0,1) > 4);
var Netscape4 = (navigator.appName == 'Netscape') && (navigator.appVersion.substr(0,1) == 4);

function SwitchImg()
{ //start

  if (Netscape6 == true)
     return;
  else {
  var rem, keep=0, store, obj, switcher=new Array, history=document.Data;
    for (rem=0; rem < (SwitchImg.arguments.length-2); rem+=3) {
    	store = SwitchImg.arguments[(navigator.appName == 'Netscape')?rem:rem+1];
    if ((store.indexOf('document.layers[')==0 && document.layers==null) ||
        (store.indexOf('document.all[')==0 && document.all==null))
         store = 'document'+store.substring(store.lastIndexOf('.'),store.length);
         obj = eval(store);
    if (obj != null) {
   	   switcher[keep++] = obj;
      switcher[keep++] = (history==null || history[keep-1]!=obj)?obj.src:history[keep];
      obj.src = SwitchImg.arguments[rem+2];
  } }
  document.Data = switcher;
  }
} //end

function RestoreImg()
{ //start
  if (Netscape6 == false)
    if (document.Data != null)
      for (var rem=0; rem<(document.Data.length-1); rem+=2)
        document.Data[rem].src=document.Data[rem+1];
} //end

function today()
{ //start
  var today = new Date();
  var retDate;
  var dayofweek =   new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY",
                              "SATURDAY");
  var monthofyear = new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG", "SEP","OCT",
                              "NOV","DEC");
  var dayofmonth = today.getDate();
  var suffix;

  switch (dayofmonth)
  {
  case 1:
  case 21:
  case 31:
    suffix = "st";
	break;
  case 2:
  case 22:
    suffix = "nd";
	break;
  case 3:
  case 23:
    suffix = "rd";
	break;
  default:
    suffix = "th";
	break
  }

  retDate = dayofweek[today.getDay()].substr(0,3) + " " + today.getDate() + suffix + " ";
  retDate = retDate + monthofyear[today.getMonth()] + " " + today.getFullYear();

return retDate;
}//end

function load_images() // Loads background Menu Images
{
  if (Netscape6 == false) {
    img1 = new Image(150,22);
    img1.src = "images/menu_a_on.gif";
    img2 = new Image(150,22);
    img2.src = "images/menu_emer_on.gif";
    img3 = new Image(150,22);
    img3.src = "images/menu_repprec_on.gif";
    img4 = new Image(150,22);
    img4.src = "images/menu_testres_on.gif";
    img5 = new Image(150,22);
    img5.src = "images/menu_serv_on.gif";
    img6 = new Image(150,22);
    img6.src = "images/menu_branch_on.gif";
    img7 = new Image(150,22);
    img7.src = "images/menu_teen_on.gif";
    img8 = new Image(150,22);
    img8.src = "images/menu_htfu_on.gif";
    img9 = new Image(150,22);
    img9.src = "images/menu_selfhelp_on.gif";
    img10 = new Image(150,22);
    img10.src = "images/menu_com_on.gif";
    img11 = new Image(150,22);
    img11.src = "images/menu_au_on.gif";
    img12 = new Image(150,22);
    img12.src = "images/menu_uc_on.gif";
    img13 = new Image(32,20);
    img13.src = "images/go_on.gif";
  }
}

function load_tsf_images() // Loads background Menu Images for Teen-Scene Forum
{
  if (Netscape6 == false) {
    img1 = new Image(150,22);
    img1.src = "images/menu_tsf_home_on.gif";
    img2 = new Image(150,22);
    img2.src = "images/menu_tsf_ask_on.gif";
    img3 = new Image(150,22);
    img3.src = "images/menu_tsf_reply_on.gif";
    img4 = new Image(150,22);
    img4.src = "images/menu_tsf_search_on.gif";
    img5 = new Image(150,22);
    img5.src = "images/menu_tsf_exit_on.gif";
  }
}

function get_yourhealth()
{
  // document.frm_yourhealth.sel_yourhealth.focus(); // Remove Focus from Go Button

  if (document.frm_yourhealth.sel_yourhealth.selectedIndex == -1) { // Abort if Nothing Selected
    return false;
  }

  var index_required = document.frm_yourhealth.sel_yourhealth[document.frm_yourhealth.sel_yourhealth.selectedIndex].value;
  var idx = document.frm_yourhealth.sel_yourhealth.selectedIndex;

  switch (index_required)
  {
  case "alcohol": window.location.href="your_health.php?cat=alc&title=Alcohol Abuse&id="+idx; break;
  case "allergy": window.location.href="your_health.php?cat=all&title=Allergies&id="+idx; break;
  case "alternative": window.location.href="your_health.php?cat=alt&title=Alternative Medicine&id="+idx; break;
  case "alzheimers": window.location.href="your_health.php?cat=alz&title=Alzheimers Disease&id="+idx; break;  
  case "arthritis": window.location.href="your_health.php?cat=arth&title=Arthritis / Rheumatology&id="+idx; break;  
  case "asthma": window.location.href="your_health.php?cat=asth&title=Asthma&id="+idx; break;
  case "autism": window.location.href="your_health.php?cat=aut&title=Autism&id="+idx; break;
  case "backpain": window.location.href="your_health.php?cat=back&title=Back Pain&id="+idx; break;
  case "blindness": window.location.href="your_health.php?cat=blind&title=Blind and Partially Sighted&id="+idx; break;
  case "bowel": window.location.href="your_health.php?cat=bowel&title=Bowel Disorders&id="+idx; break;      
  case "cancer": window.location.href="your_health.php?cat=can&title=Cancer&id="+idx; break;
  case "carers": window.location.href="your_health.php?cat=care&title=Carers&id="+idx; break;
  case "children": window.location.href="your_health.php?cat=child&title=Children and Families&id="+idx; break;
  case "cystic": window.location.href="your_health.php?cat=cys&title=Cystic Fibrosis&id="+idx; break;      
  case "contraception": window.location.href="your_health.php?cat=sh&title=Contraception / Sexual Health&id="+idx; break;
  case "counselling": window.location.href="your_health.php?cat=coun&title=Counselling&id="+idx; break;
  case "deafness": window.location.href="your_health.php?cat=deaf&title=Deafness&id="+idx; break;
  case "dental": window.location.href="your_health.php?cat=dent&title=Dental Health&id="+idx; break;  
  case "depression": window.location.href="your_health.php?cat=dep&title=Depression&id="+idx; break;    
  case "diabetes": window.location.href="your_health.php?cat=dia&title=Diabetes&id="+idx; break;
  case "diet": window.location.href="your_health.php?cat=diet&title=Diet and Nutrition&id="+idx; break;
  case "disability": window.location.href="your_health.php?cat=dis&title=Disability&id="+idx; break;
  case "drugs": window.location.href="your_health.php?cat=drug&title=Drug Abuse&id="+idx; break;
  case "dys": window.location.href="your_health.php?cat=dys&title=Dyslexia&id="+idx; break;
  case "eat": window.location.href="your_health.php?cat=eat&title=Eating Disorders&id="+idx; break;
  case "eczema": window.location.href="your_health.php?cat=ecz&title=Eczema&id="+idx; break;  
  case "elderly": window.location.href="your_health.php?cat=eld&title=Care for the Eldery&id="+idx; break;
  case "epilepsy": window.location.href="your_health.php?cat=epil&title=Epilepsy&id="+idx; break;
  case "famp": window.location.href="your_health.php?cat=sh&title=Family Planning / Sexual Health&id="+idx; break;    
  case "heart": window.location.href="your_health.php?cat=heart&title=Heart Disease&id="+idx; break;
  case "hiv": window.location.href="your_health.php?cat=hiv&title=HIV and Aids&id="+idx; break;
  case "loss": window.location.href="your_health.php?cat=loss&title=Loss and Bereavement&id="+idx; break;  
  case "me": window.location.href="your_health.php?cat=me&title=Myalgic Encephalomyelitis&id="+idx; break;
  case "mening": window.location.href="your_health.php?cat=men&title=Meningitis&id="+idx; break;  
  case "mental": window.location.href="your_health.php?cat=ment&title=Mental Health&id="+idx; break;
  case "migraine": window.location.href="your_health.php?cat=mig&title=Migraine&id="+idx; break;
  case "ms": window.location.href="your_health.php?cat=ms&title=Multiple Sclerosis&id="+idx; break;
  case "md": window.location.href="your_health.php?cat=md&title=Muscular Dystrophy&id="+idx; break;
  case "osteoporosis": window.location.href="your_health.php?cat=ost&title=Osteoporosis&id="+idx; break;    
  case "park": window.location.href="your_health.php?cat=park&title=Parkinson's Disease&id="+idx; break;
  case "phobia": window.location.href="your_health.php?cat=pho&title=Phobias&id="+idx; break;
  case "rheu": window.location.href="your_health.php?cat=arth&title=Rheumatology / Arthritis&id="+idx; break; 
  case "self": window.location.href="your_health.php?cat=self&title=Self Help / General Health&id="+idx; break;
  case "sexual": window.location.href="your_health.php?cat=sh&title=Family Planning / Sexual Health&id="+idx; break;
  case "smoking": window.location.href="your_health.php?cat=smoke&title=Giving up Smoking&id="+idx; break;
  case "stroke": window.location.href="your_health.php?cat=strok&title=Stroke&id="+idx; break;
  case "teenage": window.location.href="your_health.php?cat=teen&title=Teenage Health&id="+idx; break;    
  case "travel": window.location.href="your_health.php?cat=trav&title=Holiday and Travel Advice&id="+idx; break;
  case "vac": window.location.href="your_health.php?cat=vac&title=Vaccinations&id="+idx; break;
  default:
    // Do Nothing
	// alert("Nothing Selected");
	break;
  }
  document.frm_yourhealth.sel_yourhealth.focus;
  return false;
}

function linkwin(url) {
  var link_win;
  if (screen.width > 800) {
    link_win = window.open(url,"link_win","scrollbars,resizable,location,menubar,height=500,width=650,top=150,left=300");
  }
  else {
    link_win = window.open(url,"link_win","scrollbars,resizable,location,menubar,height=175,width=550,top=310,left=210");
  }
  link_win.focus();
  return false
}

function linkwin2(url) {
  var link_win;
  if (screen.width > 800) {
    link_win = window.open(url,"link_win","scrollbars,resizable,height=500,width=650,top=150,left=300");
  }
  else {
    link_win = window.open(url,"link_win","scrollbars,resizable,height=175,width=550,top=310,left=210");
  }
  link_win.focus();
  return false
}

function get_urlvalue(url,url_key,url_key_vallen) { // Get URL Key Value
  var url_value = "";
  var url = window.location.href;
  var counter = 0;

  counter = url.indexOf("?" + url_key + "=");
  if (counter != -1)
    url_value = url.substr(counter+url_key.length+2, url_key_vallen);
  else
    url_value = "";

  return url_value;
}

function linkwin_credits(url) {
  var link_win;
  if (screen.width > 800) {
    link_win = window.open(url,"link_win","scrollbars=no,resizable=no,location=no,menubar=no,height=290,width=500,top=239,left=262");
  }
  else {
    link_win = window.open(url,"link_win","scrollbars=no,resizable=no,location=no,menubar=no,height=290,width=500,top=155,left=150");
  }
  link_win.focus();
  return false
}



