var g_safe_browser= true; //global variable for browser test

//redirect to update page is user's browser is not in compliance with website
if((navigator.appName && navigator.appName.indexOf("Netscape") >= 0 && parseInt(navigator.appVersion) < 4)||
  (navigator.appName && navigator.appName.indexOf("Microsoft") >= 0 && parseInt(navigator.appVersion) < 4))
  {
   var g_safe_browser= false;
   window.top.location.href= "www.kidneydirections.com/update/index.htm";
  }

//===========================================================
//-- begin rollover functions 
//===========================================================

//FUNCTION-- preload images
function preload_image(virtual_name, file_path, file_name)
{
 eval( virtual_name +' = new Image( )');//create a new image object
 eval( virtual_name +'.src = "' + file_path + file_name + '"' );
}

//FUNCTION-- dynamically swaps one image
function swap_image_single(image_name, image_state, image_layer)
{
 if(document.layers && image_layer!=null) eval('document.'+image_layer+'.document.images["'+ image_name +'"].src ='+image_name+image_state+".src");
 else document.images[image_name].src = eval(image_name + image_state + ".src");
}

//===========================================================
//-- end rollover functions 
//===========================================================

//===========================================================
//-- begin popup window functions 
//===========================================================

//FUNCTION-- creates a mini popup browser window for printing chart
function new_chart_window(url)
{ 
 chart_window = window.open(url,"chart",'directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,width=700,height=500');
}

//FUNCTION-- creates a mini popup browser window for printing directions
function new_directions_window(url)
{ 
 directions_window = window.open(url,"directions",'directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,width=375,height=375');
}

//FUNCTION-- creates a new 3/4 browser window for links throughout site
function new_site_win(url)
{ 
 site_window = window.open(url,"win_75",'directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,width=700,height=350');
}

//FUNCTION-- creates a mini popup browser window for meet your guide
function guide_win(url)
{ 
 guide_window = window.open(url,"meetguide",'directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no,width=380,height=420');
}

//FUNCTION-- creates a mini popup browser window for glossary
function glossary_win(url)
{ 
 glossary = window.open(url,"glossary",'directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no,width=370,height=230');
 glossary.focus( );
}

//FUNCTION-- creates a mini popup browser window for "A word from your Guide" links in the blue boxes throughout site
function gw(url)
{ 
 guide_word = window.open(url,"guideword",'directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no,width=370,height=200');
}

//FUNCTION-- creates a mini popup browser window for "Disclaimer info"
function dw(url)
{ 
 disclaim = window.open(url,"Disclaimer",'directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no,width=500,height=325');
}

//FUNCTION-- creates a mini popup browser window for Disclaimer info for support, resource and contact us sections
function dw_support(url)
{ 
 disclaim2 = window.open(url,"Disclaimersupport",'directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no,width=400,height=200');
}

//FUNCTION-- creates a mini popup browser window for "Privacy Policy info"
function ppw(url)
{ 
 ppolicy = window.open(url,"Policy",'directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no,width=500,height=325');
}

//===========================================================
//-- end popup window functions 
//===========================================================

//===========================================================
//-- begin cookie functions 
//===========================================================

//FUNCTION-- retrieves a cookie - jsv 1.0
function get_cookie(cookie_name)
{
 var cookie_name_equals = cookie_name + "=";               
 var dc = document.cookie;
 if( dc.length > 0 )
 {              
   begin = dc.indexOf(cookie_name_equals);       
   if( begin != -1 ) 
   {           
     begin += cookie_name_equals.length;       
     end = dc.indexOf(";", begin);
     if( end == -1 )
	   { 
	    end= dc.length;
	   }
     return unescape(dc.substring(begin, end));
   } 
 }
 return null;
}

//FUNCTION-- sets a cookie - jsv 1.0
function set_cookie(cookie_name, cookie_value, expiration_date) 
{ 
 if(expiration_date != null)
	{
	 //set expiration date for cookie
	 var expires = new Date( );                                   
	 expires.setTime(expires.getTime( ) + (1000 * 60 * 60 * 24 * expiration_date)); //days ahead
	}
	 document.cookie = cookie_name + "=" + escape(cookie_value) + "; path=/" +
	 ((expiration_date == null) ? ";" : "; expires=" + expires.toGMTString( ));
}

//FUNCTION-- deletes a cookie - jsv 1.0
function delete_cookie(cookie_name)
{
 document.cookie = cookie_name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}

//FUNCTION-- deletes user's track cookie info
function delete_track( )
{
 delete_cookie("home");
 delete_cookie("country");
}

//===========================================================
//-- end cookie functions 
//===========================================================

//===========================================================
//-- begin page redirect functions 
//===========================================================

//FUNCTION-- checks cookie for track
function check_track(des1, des2)
{
 var track= get_cookie("home");
 if(track)
	{
	 (des1!=null)? window.top.location.href= des1 + track + "/index.htm" : window.top.location.href= track + "/index.htm";
 }
	 else window.top.location.href= des2;
}

//FUNCTION-- loads a new page
function load_page(page)
{
 window.top.location.href= page;
}

//===========================================================
//-- end page redirect functions 
//===========================================================
