//font size functions
//function must be on top
menuFlag = false;
function getQuery(name) 
{
	var strQuery = window.location.search;
	var startOfSource = strQuery.indexOf(name + "=");
	//var endOfSource = strQuery.indexOf("&", startOfSource + 2);
	var endOfSource = strQuery.length;
	return strQuery.substring(startOfSource + 3, endOfSource);
		
}
	
function getURL()
{
	theUrl = document.URL;
	return theUrl.substring(0, theUrl.indexOf("?"));
}

	
function fontLarger()
{
	var fSize = getQuery('fs');
	if (fSize.length == 0)
	{
		if (getCookie("fontSize"))
		{
			fSize = parseInt(getCookie("fontSize"));
			if(eval(fSize < 16)) window.location = document.URL + "?fs=" + (fSize + 2);
			setCookie("fontSize", fSize);
		}
		else
		{
		window.location = document.URL + "?fs=14";
		setCookie("fontSize", "14")
		}
	}
	else
	{
		if (eval(fSize < 16)) 
		{
			window.location = getURL() + "?fs=" + (parseInt(fSize) + 2);
			setCookie('fontSize', (parseInt(fSize) + 2));
		}
		else
		{
			return;
		}
	}
}


function fontSmaller()
{
	var fSize = getQuery("fs");
	if (fSize.length == 0)
	{
		if (getCookie("fontSize"))
		{
			fSize = parseInt(getCookie("fontSize"));
			if(eval(fSize > 10)) window.location = getURL() + "?fs=" + (fSize - 2);
			setCookie("fontSize", fSize);
		}
		else
		{
		window.location = document.URL + "?fs=10";
		setCookie("fontSize", "10")
		}
	}
	else
	{
		if (eval(fSize > 10)) 
		{
			window.location = getURL() + "?fs=" + (parseInt(fSize) - 2);
			setCookie('fontSize', (parseInt(fSize) - 2));
		}
		else
		{
			return;
		}
	}
}


//rollover functions
if (document.images) {

function imgAct(imgName) {
        if (document.images) {
                document[imgName].src = eval(imgName + "on.src");
               
                }
        }

function imgInact(imgName) {
        if (document.images) {
                document[imgName].src = eval(imgName + "off.src");
               
                }
        }

}	

//cookie functions
function setCookie(name, value, expires) {
	document.cookie = name + "=" + escape(value) + "; path=/" +
	((expires ==null) ? "" : "; expires=" +
	expires.toGMTString());
}

function getCookie(name){
        var cname = name + "=";
        var dc = document.cookie; 
        if (dc.length > 0) {         
                begin = dc.indexOf(cname); 
                if (begin != -1) { 
                     begin += cname.length; 
                     end = dc.indexOf(";", begin);
                     if (end == -1) end = dc.length; 
                           return unescape(dc.substring(begin, end));
                }
        }
	return null;
}

function deleteCookie(name)
{
	var threeDays = 3 * 24 * 60 * 60 * 1000;
	var expDate = new Date();
	expDate.setTime(expDate.getTime() - threeDays);
	document.cookie = name + "=clearMe; expires=" + expDate.toGMTString();
}

//tmtC_cssOnBrowser
tmt_css_NN = "/lifescan_ns.css";
tmt_css_IE = "/lifescan.css";
if(document.layers){
   document.write("<link rel='stylesheet' href='" + tmt_css_NN + "' type='text/css'>");
}
else{
   document.write("<link rel='stylesheet' href='" + tmt_css_IE + "' type='text/css'>");
}//tmtC_cssOnBrowserEnd

function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


function atomz(){
if (document.form2['sp-q'].value==""){
alert("Please enter a search term")
document.form2['sp-q'].focus();
return false
			}
return true
		}
		
var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printSpecial()
{
	var isNS = (navigator.appName=="Netscape")?1:0;
	
	if (isNS) {
		//alert('For Netscape browsers please use File->Print from browser menu.');
		printWindow();
		return false;
	}
	
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n</HE' + 'AD>\n<BODY class=normal>\n';
		html += '\n<img src=/images/header_onetouch_logo.gif alt=OneTouch>\n';
		
		var printHeaderElem = document.getElementById("printHeader");
		var printReadyElem = document.getElementById("printReady");
		
		if (printHeaderElem != null)
		{
				html += printHeaderElem.innerHTML;
		}
		else
		{
			alert("Could not find the printHeader section in the HTML");
			return;
		}
		
		if (printReadyElem != null)
				{
						html += printReadyElem.innerHTML;
				}
				else
				{
					alert("Could not find the printReady section in the HTML");
					return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Please use File->Print from browser menu");
	}
}
	
function CheckAtomz(form){
   if (form['sp-q'].value == ""){
      alert("Please enter a search term")
      form['sp-q'].focus();
      return false
   } else {
      return true
   }
}

function CheckAtomzEsp(form){
   if (form['sp-q'].value == ""){
      alert("Por favor introduzca una palabra para su búsqueda")
      form['sp-q'].focus();
      return false
   } else {
      return true
   }
}