// JavaScript Document

//prescription-sleep-aids.aspx
var prescription1 = "<p>Looking for a solution to a good night's sleep can be, well, exhausting. That's why it is important to know that not all prescription sleep aids are the same.</p><p>Non-narcotic AMBIEN CR is different. And it could be the relief you need. It's the only 2-layer prescription sleep aid with a controlled-release formula. The first layer gets you to sleep, while the second layer helps you stay asleep, so you wake up less frequently and fall back to sleep faster.* Plus, AMBIEN CR can be taken for as long as your healthcare provider recommends.</p><br /><p>Getting good sleep is as important to good health as diet and exercise. And sleeping better starts with talking to your doctor about AMBIEN CR.</p><br /><p>*Proven effective for up to 7 hours in clinical studies.</p>";
var prescription2 = "<p>Why spend another sleepless night? Receive a 7-night free trial offer of prescription AMBIEN CR today. Plus, with Save on AMBIEN CR, you'll also get valuable savings of up to $100<sup>&dagger;</sup> on your next five AMBIEN CR refills.</p>";
var prescription3 = "<p>If your current prescription sleep aid isn't really helping, or you're experiencing undesirable side effects, it may be time to talk to your doctor about switching to<br/> AMBIEN CR. </p><br/><p>AMBIEN CR has the benefit of both helping you get to sleep quickly&ndash;within 15 to 30 minutes&ndash;and helping you stay asleep, because it has two layers.* The first layer dissolves quickly to help you fall asleep fast, while the second dissolves slowly to help you stay asleep, so you can wake up ready for your day.** Furthermore,<br/> AMBIEN CR is non-narcotic and can be taken for as long as your healthcare provider recommends. </p><br /><p>Having a discussion with your doctor is the first way to learn if AMBIEN CR is right for you.</p><br /><p>*Proven effective for up to 7 hours in clinical studies.</p><br /><p>**Individual results may vary.</p>";

//generic-ambien-zolpidem.aspx
var generic1 = "<p>If you're taking AMBIEN (zolpidem tartrate), or a generic form of AMBIEN, you've obviously taken the steps to see your doctor and discuss your sleeping problems. However, getting to sleep and staying asleep can be a bit of trial and error. </p><br /><p>One of the most important things you should know is that AMBIEN and its generic form work differently than AMBIEN CR. AMBIEN, and the generic form of AMBIEN, are designed to only help you with getting to sleep. AMBIEN CR is different. There is no generic form of AMBIEN CR and it is the only form of AMBIEN that is FDA approved to help you fall asleep and stay asleep so you can wake up less frequently and fall back to sleep faster. Only AMBIEN CR has two layers that address both problems. The first layer dissolves quickly to help you fall asleep fast, while the second dissolves slowly to help you stay asleep&ndash;so you wake up ready for your day.* In fact, in clinical studies, AMBIEN CR was proven effective for up to 7 hours. AMBIEN CR can also be taken for as long as your healthcare provider recommends.</p><br /><p>If your current sleep aid isn't letting you sleep through the night, it might be time to ask your doctor about<br/> AMBIEN CR.</p><br /><p>*Individual results may vary.</p>";
var generic2 = "<p>Have you considered AMBIEN CR, yet gone with generic AMBIEN due to cost or because your insurance company won't pay for it? If so, you should take advantage of Save on AMBIEN CR. Save on AMBIEN CR can save you up to $100<sup>&dagger;</sup> on your next five refills of AMBIEN CR, plus you may be eligible for a 7-night free trial.</p><br /><p><span style='font-size:12px'>*Maximum benefit is $240 off, up to $20 off each prescription (up to 12 prescriptions), depending on your co-pay amount. This offer is not valid for Medicare or Medicaid recipients or any other federal or state funded program and where prohibited by law.</span></p>";
var generic3 = "<p>Your insurance company may want you to try a generic medication instead of AMBIEN CR, because generics usually cost less.  However, there is no generic form of AMBIEN CR.</p><br /><p>FDA-approved AMBIEN (zolpidem tartrate or generic AMBIEN) has one layer to help you fall asleep, and is approved for short-term use. However, AMBIEN CR has two layers. The first layer dissolves quickly to help you fall asleep fast, while the second dissolves slowly to help you stay asleep.* So you wake up less frequently and fall back to sleep faster. AMBIEN CR can also be taken for as long as your healthcare provider recommends.</p><br /><p>*Proven effective for up to 7 hours in clinical studies.</p>";

//over-the-counter-sleep-aids.aspx
var otc1 = "<p>So you've come to the realization that you have trouble sleeping and you're doing something about it. Sure, over-the-counter (OTC) sleep aids can seem like a quick fix &ndash; but did you know that the more often you take them, the less effective they become? If you can't sleep through the night or are waking feeling tired and unable to concentrate during the day, maybe it's time to learn more about the AMBIEN CR difference.</p><br /><p>3.5 million people have talked to their healthcare providers about their trouble sleeping, and are taking non-narcotic AMBIEN CR. AMBIEN CR is safe and effective for treating insomnia, with a low risk of dependency, when used as directed.  And only AMBIEN CR has two layers so you can fall asleep and stay asleep. In fact, in clinical studies AMBIEN CR was proven effective for up to 7 hours. It's also non-narcotic and can be taken for as long as your healthcare provider recommends. And unlike AMBIEN CR, some OTC treatments contain extra medicines, like pain relievers and allergy medicines, neither of which were originally intended for sleep. These can have undesirable side effects, which may include leaving you feeling groggy the next day, and can even be deadly at high doses. Most OTC sleep aids are also only intended for short-term use.</p>";
var otc2 = "<p>If you're considering prescription AMBIEN CR, but the cost is standing in your way, you'll be pleased to learn about Save on AMBIEN CR. With Save on AMBIEN CR, you may be eligible to receive a 7-night free trial and savings of up to $100&dagger; on your next five AMBIEN CR refills. So, talk to your doctor about AMBIEN CR. It may just be that extra step you need to take towards achieving more productive days.** </p><br/><p>† Maximum benefit is $240 off, up to $20 off each prescription (up to 12 prescriptions), depending on your out-of-pocket costs. Not valid for patients participating in Medicare, Medicaid, government (public insurance) programs, or any private payor in the state of Massachusetts and where prohibited by law.</p><br/><p>** Among working population.</p>";
var otc3 = "<p>Sure, having the odd sleepless night can be common, but if you're having persistent trouble falling asleep, staying asleep, or waking up unrefreshed, you should talk to your doctor. Over-the-counter sleep aids may only help you fall asleep and may leave you feeling groggy the next day. And when your workday is affected by your night, AMBIEN CR can help you sleep better so you can get back on track. So talk to your doctor today.</p>";

//treating-sleep-problems.aspx
var treating1 = "Insomnia is a nighttime sleeping problem that may cause daytime problems, such as: <ul><li>Impaired work performance</li><li>Increased risk of injuries</li><li>Irritability and difficulty getting along with others</li></ul>Insomnia is a health issue, but the good news is it can be overcome. Since sleep problems may be a symptom of an underlying illness, it's important to discuss them with your healthcare provider.<br /><br />If you think insomnia is affecting your day, discuss your <a href='how-to-sleep-better/sleep-diary.aspx'>sleep patterns</a> with your doctor to see if a prescription sleep aid like AMBIEN CR is the right treatment for you.";
var treating2 = "<p>Getting a good night's sleep is just as important as eating right and exercising. If you're not treating your sleep problem, or you've been unsuccessful treating it, know that 3.5 million people have talked to their healthcare providers about their trouble sleeping, and are taking non-narcotic AMBIEN CR. AMBIEN CR is safe and effective for treating insomnia, with a low risk of dependency (1% or less)</p><br/><p>Unlike other prescription and over-the-counter sleep aids, AMBIEN CR is the only 2-layer sleep aid with a controlled-release formula. Its two layers help you fall asleep and stay asleep, so you wake up less frequently and fall back to sleep faster.*  AMBIEN CR can also be taken as long as your doctor recommends, and may work effectively the first night of use. Having a discussion with your doctor is the first way to learn if AMBIEN CR is right for you.</p><br/><p>* Proven effective for up to 7 hours in clinical studies</p>";
var treating3 = "<p>If you have trouble sleeping, take the first step and talk to your doctor. There is no reason to continue suffering. Insomnia is a treatable medical condition that affects about 60 million people a year. And everyone's symptoms are different. Your doctor will be able to evaluate your situation and determine whether AMBIEN CR is right for you.</p><br/><p>And to make the most of your next doctor visit, consider some of the questions you may want to ask, as well as prepare for the questions your doctor may ask you.</p>";

//taking-ambien.aspx
var taking1 = "<p>You already know how important it is to get a good night's sleep. That's why you chose AMBIEN CR&ndash;the sleep aid that has helped 3.5 million people like you. In a 24-week study, AMBIEN CR was proven effective when administered 3&ndash;7 days per week, so you can feel confident that it will help you get to sleep and stay asleep whenever you need it.</p><br /><p>Unlike other over-the-counter and prescription sleep aids, AMBIEN CR is the only 2-layer sleep aid with a controlled-release formula. The first layer dissolves quickly to help you fall asleep fast, while the second dissolves slowly to help you stay asleep, so you can wake up ready for your day.* And, AMBIEN CR can be safely taken for as long as your doctor recommends.</p><br /><p>*Individual results may vary.</p>";
var taking2 = "<p>Enjoying the benefits of a good night's sleep is very rewarding&ndash;and so is a little something extra, like Save on AMBIEN CR. Save on AMBIEN CR can help you with the cost of AMBIEN CR by saving you up to $100† on your next five AMBIEN CR refills.</p><br/><p>† Maximum benefit is $240 off, up to $20 off each prescription (up to 12 prescriptions), depending on your co-pay amount. This offer is not valid for Medicare or Medicaid recipients or any other federal or state funded program and where prohibited by law.</p>";


function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { document.getElementById(d).style.display = "block"; }

function textIn(txt) { document.getElementById('textswap').innerHTML = txt;}



function cellImg(idCell, imgName) { 
document.getElementById(idCell).style.background = "url(" + imgName + ")"; 
} 

function colorSwap(idCell, color)
{
document.getElementById(idCell).style.color = color;
}

 
 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

  
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}   


function BB_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.BB_p) d.BB_p=new Array();
    var i,j=d.BB_p.length,a=BB_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.BB_p[j]=new Image; d.BB_p[j++].src=a[i];}}
}

function BB_swapImgRestore() { //v3.0
  var i,x,a=document.BB_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function BB_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=BB_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function BB_swapImage() { //v3.0
  var i,j=0,x,a=BB_swapImage.arguments; document.BB_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=BB_findObj(a[i]))!=null){document.BB_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


var num = 27; // this is # of divs you have
function swap(what)
{
    var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for(var i = 0; i < num; i++)
    {
        if (what == 26){
                document.getElementById('swap'+i).style.display = 'block';
                document.getElementById('linkAll').style.opacity = 1;
            }else{                
                document.getElementById('swap'+i).style.display = 'none';                
            }        
    }    
    for (var i2 = 0; i2< num-1 ; i2++)
    {   
        if (document.getElementById('link'+alphabet.charAt(i2)) != undefined){
              document.getElementById('link'+alphabet.charAt(i2)).style.opacity = 0.6;
          }      
    } 
    document.getElementById('swap'+what).style.display = 'block';
    if (document.getElementById('link'+alphabet.charAt(what)) != undefined){
        document.getElementById('link'+alphabet.charAt(what)).style.opacity = 1;
     }
}
var createStyle = document.createElement('style');
createStyle.setAttribute("type", "text/css");
//var createStyleProp = document.createTextNode('.hidden { display:none; }');
var createStyleProp = '.hidden { display:none; }';

if(createStyle.styleSheet){// IE
createStyle.styleSheet.cssText = createStyleProp;
} else {// w3c
var cssText = document.createTextNode(createStyleProp);
createStyle.appendChild(cssText);
}
//createStyle.appendChild(createStyleProp);
document.getElementsByTagName('head')[0].appendChild(createStyle);

function trackCertificatePrint(){
        window.print();
        var axel = Math.random()+"";
		var a = axel * 10000000000000;
		document.getElementById("ctl00_ContentPlaceHolder1_printTrackImg").src = 'https://ad.doubleclick.net/activity;src=1504272;type=salem314;cat=saley282;ord=1;num='+ a + '?';				

		//urchinTracker('/CertificatePage/PrintFeature');
		dcsMultiTrack('DCS.dcssip', 'www.ambiencr.com', 'DCS.dcsuri', '/4nightsfree-print.aspx');
}

function submitSearchForm()
{
var searchTerm = "ctl00_top_SearchText";
if (validateSearchForm(searchTerm)) {
    window.location=window.root+'search_results.aspx?q='+document.getElementById(searchTerm).value;
    }
    return false;
}
function validateSearchForm(searchTerm)
{
    var valid = true;
    if (document.getElementById(searchTerm).value == "Search" || 
    document.getElementById(searchTerm).value.length == 0 ) {
 	    window.alert ("Please enter a search text.");
  		valid = false;
 	}
 	else
 	{
 	    var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
 		for (var i = 0; i < document.getElementById(searchTerm).value.length; i++) {
  		    if (iChars.indexOf(document.getElementById(searchTerm).value.charAt(i)) != -1) {
  			    window.alert ("Your search text has special characters. \nThese are not allowed.\nPlease remove them and try again.");
  			    valid = false;
  			    break;
  	        }
        }
     }
     return valid;
}

function openWin( windowURL, windowName, windowFeatures) {
     winhandle = window.open( windowURL, windowName, windowFeatures ) ;
	 try {
	 	winhandle.focus();
	}
	catch(err) {
		alert("To view this information, please disable your popup blocker or add www.lantus.com to your safe list");
	}
}

function elementCheck(testID, uState)
{
    tempRef = document.getElementById(testID);
    if (uState == 1) { tempRef.style.textDecoration = "underline"; }
    else { tempRef.style.textDecoration = "none"; }
}


function elementCheck(testID2, uState)
{
    tempRef = document.getElementById(testID2);
    if (uState == 1) { tempRef.style.textDecoration = "underline"; }
    else { tempRef.style.textDecoration = "none"; }
}

function elementCheck(testID3, uState)
{
    tempRef = document.getElementById(testID3);
    if (uState == 1) { tempRef.style.textDecoration = "underline"; }
    else { tempRef.style.textDecoration = "none"; }
}
