﻿// JScript File
/*********************************************************************************************
Author:        Radhika Kasetty
Date:          09-Sept-2008
Description:   This javascript is used for few functionalities in the website.
Revision:      1.0
Last Modified: 
Modified by         Modified Date          Description
**********************************************************************************************
<DEVELOPER NAME>       <DATE>                  <Description of change>
**********************************************************************************************/

/* Used for Back button functionality in a E-mail to a friend page*/
function goBack()
{
        	window.history.back(-1);
}

 /* TRK Added for tell-a-friend.aspx rdoMessageSent */
 
function RadioMessageSentClick()
{
        document.getElementById('hdnMessageSent').value = "1";

}
/*To Swap the images */

function MM_findObj(n, d) { 
  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() { 
  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_swapImgRestore() { 
  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_preloadImages() { 
  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 pfizerBanner()
{
   var parts = new Array;
    var thisSite = new Array;
    var test;
   
    //check the current page
    test = location.href.substring(location.href.lastIndexOf("/"));
    parts = test.split('?');
    thisSite.thisPage = parts[0].replace("/","");

    var pageName = thisSite.thisPage;
 
     if(pageName == 'index.aspx'||pageName == '')
    {
        document.getElementById('indexImage').style.display = 'none';
    }
    
}

function writePE() 
{ 

    //Writing the licensee number based on the webpage displayed.

    var parts = new Array;
    var thisSite = new Array;
    var test;

    //check the current page
    test = location.href.substring(location.href.lastIndexOf("/"));
    parts = test.split('?');
    thisSite.thisPage = parts[0].replace("/","");

    var pageName = thisSite.thisPage;
           
    if (pageName.match('index.aspx')|| pageName.match('about-zmax.aspx')||
         pageName.match('is-zmax-right-for-you.aspx')|| pageName.match('helpful-tips.aspx')|| 
         pageName.match('zmax-for-your-child.aspx')||pageName.match('zmax-faqs.aspx')||
            pageName.match('printable-brochures.aspx')|| pageName.match('zmax-coupon.aspx'))
        { 
            document.write('ZMU00007C'); 
        } 
    else 
        { 
            document.write('ZMU00007C'); 
        } 
          
} 

