function openPIPopup(whichURL) {
    window.open(whichURL, 'xeloda', 'width=700,height=500,top=0,left=0,resizable=1,scrollbars=1');
    window.open('http://www.gene.com/gene/products/information/xeloda/pdf/pi.pdf', 'pi', 'width=700,height=500,top=0,left=16,resizable=1,scrollbars=1');
}

function openPIPopupEs(whichURL) {
    window.open(whichURL, 'xeloda', 'width=700,height=500,top=0,left=0,resizable=1,scrollbars=1');
    window.open('/pdf/XELODA_Spanish_PI.pdf', 'pi', 'width=700,height=500,top=0,left=16,resizable=1,scrollbars=1');
}

//*************Omniture Changes************************

function OmnitureTrackPrint() {
    s.linkTrackVars = 'events';
    s.linkTrackEvents = 'event10';
    s.events = 'event10';
    s.tl(this, 'o', s.pageName + '|printpage');
    s.linkTrackVars = 'prop35,prop36,prop37,prop38,eVar35,eVar36,eVar37,eVar38';
    s.linkTrackEvents = 'None';
    clearOmniVar()

}

function OmnitureTrackFontSize(size) {
    s.linkTrackVars = 'events,eVar21';
    s.linkTrackEvents = 'event13';
    s.eVar21 = size;
    s.events = 'event13';
    s.tl(this, 'o', s.pageName + '|changefontsize');
    s.linkTrackVars = 'prop35,prop36,prop37,prop38,eVar35,eVar36,eVar37,eVar38';
    s.linkTrackEvents = 'None';
    clearOmniVar()

}

/* Track Update Profile - Used to update the information on a previously enrolled user */
function OmnitureTrackupdates(URL, form, info) {
    var s_linkTrackVarsTemp = s.linkTrackVars;
    var s_linkTrackEventsTemp = s.linkTrackEvents;
    s.linkTrackVars = 'events,prop11,eVar11,prop13,eVar13,prop22,eVar22,prop23,eVar23,prop24,eVar24,prop25,eVar25,prop26,eVar26,prop27,eVar27';
    s.linkTrackEvents = 'event3,event5,event12';
    s.channel = s.siteName + ':' + s.indication + ':' + s.siteAudience;
    getValuesFromInfo(info);
    s.events = 'event5,event12';
    s.tl(this, 'o', s.pageName + '|update_' + form);
    s.linkTrackVars = s_linkTrackVarsTemp;
    s.linkTrackEvents = s_linkTrackEventsTemp;
    pausecomp(1500);
    clearOmniVar();
    window.location.href = URL;

}

/**Old update code***
 function OmnitureTrackupdates(password,email,personalinfoflag,URL) { 

 var s = s_gi(s_account);
 s_doPlugins(s);
 if (email == 'yes')
 {
 s.linkTrackVars='events,prop12,eVar12';
 s.linkTrackEvents='event5';
 s.events='event5';
 s.prop12=s.eVar12=s.channel+':'+'update email';
 s.tl(this,'o',s.pageName+'|updateemail');
 }
 if (password == 'yes')
 {
 s.linkTrackVars='events,prop12,eVar12';
 s.linkTrackEvents='event5';
 s.events='event5';
 s.prop12=s.eVar12=s.channel+':'+'change password';
 s.tl(this,'o',s.pageName+'|changepassword');
 }
 if (personalinfoflag == 'yes')
 {
 s.linkTrackVars='events,prop12,eVar12';
 s.linkTrackEvents='event5';
 s.events='event5';
 s.prop12=s.eVar12=s.channel+':'+'update_profile';
 s.tl(this,'o',s.pageName+'|update_profile');
 }
 pausecomp(1500);
 window.location.href = URL;
 clearOmniVar()

 }
 */
function OmnitureTrackDownload(filename) {
    s.linkTrackVars = 'events,prop15,eVar15';
    s.linkTrackEvents = 'event7';
    if (filename.indexOf('ctivity.aspx?pdf=') == -1)
        s.prop15 = s.eVar15 = s.channel + ':' + filename;
    else {
        filename = filename.substring(17);
        s.prop15 = s.eVar15 = s.channel + ':' + filename;
    }
    s.events = 'event7';
    s.tl(this, 'd', s.pageName + '|' + s.prop15);
    s.linkTrackVars = 'prop35,prop36,prop37,prop38,eVar35,eVar36,eVar37,eVar38';
    s.linkTrackEvents = 'None';
    clearOmniVar()

}

function OmnitureShare(message) {

    s.linkTrackVars = 'events,prop17,eVar17';
    s.linkTrackEvents = 'event9';
    //s.prop17=s.eVar17=message;
    s.events = 'event9';
    s.tl(this, 'o', s.pageName + '|send_message_to_friend');
    s.linkTrackVars = 'prop35,prop36,prop37,prop38,eVar35,eVar36,eVar37,eVar38';
    s.linkTrackEvents = 'None';
    clearOmniVar()

}

function OmnitureTrackLogin(URL) {
    var s = s_gi(s_account);
    s.linkTrackVars = 'events';
    s.linkTrackEvents = 'event4';
    s_doPlugins(s);
    s.events = 'event4';
    s.tl(this, 'o', s.pageName + '|login');
    //setTimeout("redirect('"+URL+"')",1000);
    clearOmniVar()
    pausecomp(1500);
    if (URL != null && URL != '') {
        window.location.href = URL;
    }
}
function OmnitureTrackChangePref(URL) {
    var s = s_gi(s_account);
    s.linkTrackVars = 'events,prop14,eVar14';
    s.linkTrackEvents = 'event6';
    s_doPlugins(s);
    s.prop14 = s.eVar14 = s.channel + ':email_updates';
    s.events = 'event6';
    s.tl(this, 'o', s.pageName + '|unsubscribe');
    s.linkTrackVars = 'prop35,prop36,prop37,prop38,eVar35,eVar36,eVar37,eVar38';
    s.linkTrackEvents = 'None';
    //setTimeout("redirect('"+URL+"')",1000);
    clearOmniVar()
    pausecomp(1500);
    window.location.href = URL;

}

function trackEnrollFormError(count,msg,form){
    var s_linkTrackVarsTemp = s.linkTrackVars;
    var s_linkTrackEventsTemp = s.linkTrackEvents;
    s.linkTrackVars='events,prop19,eVar19,prop11,eVar11';
    s.linkTrackEvents='event14';
    if (count==1) { s.prop19=s.eVar19=msg; }
    else { s.prop19=s.eVar19='there_are_multiple_errors'; }
    s.channel = s.siteName + ':' + s.indication + ':' + s.siteAudience;
    s.prop11=s.eVar11=s.channel+':'+form;
    s.events='event14';
    s.tl(this,'o',s.pageName + '|error_'+form);
    s.linkTrackVars = s_linkTrackVarsTemp;
    s.linkTrackEvents = s_linkTrackEventsTemp;
    clearOmniVar();
}

function trackEmail() {
    var s_linkTrackVarsTemp = s.linkTrackVars;
    var s_linkTrackEventsTemp = s.linkTrackEvents;
    s.linkTrackVars = 'events';
    s.linkTrackEvents = 'event11';
    s.events = 'event11';
    s.tl(this, 'o', s.prop35 + '|emailpage');
    s.linkTrackVars = s_linkTrackVarsTemp;
    s.linkTrackEvents = s_linkTrackEventsTemp;
    clearOmniVar();
}


function OmnitureTrackLinks(linktext, linkpos) {
    externalWindowLink = 'false';
    s.linkTrackVars = 'prop35,eVar35,prop36,eVar36,prop37,eVar37,prop38,eVar38';
    s.prop35 = s.eVar35 = s.pageName;
    s.prop36 = s.eVar36 = linktext;
    s.prop37 = s.eVar37 = s.prop35 + ' | ' + s.prop36;
    s.prop38 = s.eVar38 = linkpos;
    s.tl(this, 'o', s.pageName + '|' + linktext);
    externalWindowLink = '';
    clearOmniVar()

}


function redirect(redirection) {
    window.location.href = redirection;
}

function pausecomp(millis) {
    var date = new Date();
    var curDate = null;

    do {
        curDate = new Date();
    }
    while (curDate - date < millis);
}
function getValuesFromInfo(info) {
    if (info.indexOf('I have cancer') !== -1)s.prop22 = s.eVar22 = 'I have cancer';
    if (info.indexOf('A loved one has cancer') !== -1)s.prop22 = s.eVar22 = 'A loved one has cancer';

    if (info.indexOf('Metastatic breast cancer') !== -1)s.prop23 = s.eVar23 = 'Metastatic breast cancer';
    if (info.indexOf('Stage III') !== -1)s.prop23 = s.eVar23 = 'colon cancer';
    if (info.indexOf('Metastatic colorectal cancer') !== -1)s.prop23 = s.eVar23 = 'Metastatic colorectal cancer';
    if (info.indexOf('Other') !== -1)s.prop23 = s.eVar23 = 'Other';

    if (info.indexOf('Yes') !== -1)s.prop23 = s.eVar23 = 'yes';
    if (info.indexOf('No') !== -1)s.prop23 = s.eVar23 = 'no';


    if (s.prop23 == 'yes') {
        if (info.indexOf('Within 1-15 days') !== -1)s.prop24 = s.eVar24 = 'Within 1-15 days';
        if (info.indexOf('Within 16-30 days') !== -1)s.prop24 = s.eVar24 = 'Within 16-30 days';
        if (info.indexOf('Within 31-45 days') !== -1)s.prop24 = s.eVar24 = 'Within 31-45 days';
        if (info.indexOf('Within 46-60 days') !== -1)s.prop24 = s.eVar24 = 'Within 46-60 days';
        if (info.indexOf('Over 60 days') !== -1)s.prop24 = s.eVar24 = 'Over 60 days';
        if (info.indexOf('Do not know') !== -1)s.prop24 = s.eVar24 = 'Do not know';
    }

    if (s.prop23 == 'no') {

        if (info.indexOf('cancer is progressing') !== -1)s.prop25 = s.eVar25 = 'cancer is progressing';
        if (info.indexOf('cancer for first time') !== -1)s.prop25 = s.eVar25 = 'cancer for first time';
        if (info.indexOf('cancer recurring') !== -1)s.prop25 = s.eVar25 = 'cancer recurring';
    }

    if (info.indexOf('2') !== -1)s.prop26 = s.eVar26 = 'CuraScript Specialty Pharmacy';
    if (info.indexOf('9') !== -1)s.prop26 = s.eVar26 = 'Diplomat Specialty Pharmacy';
    if (info.indexOf('12') !== -1)s.prop26 = s.eVar26 = 'Axium Healthcare';
    if (info.indexOf('14') !== -1)s.prop26 = s.eVar26 = 'Bioscrip';
    if (info.indexOf('15') !== -1)s.prop26 = s.eVar26 = 'OTN Specialty Services';
    if (info.indexOf('18') !== -1)s.prop26 = s.eVar26 = 'Advanced Care Scripts';
    if (info.indexOf('22') !== -1)s.prop26 = s.eVar26 = 'The Apothecary Shops';
    if (info.indexOf('23') !== -1)s.prop26 = s.eVar26 = 'BioPlus';
    if (info.indexOf('24') !== -1)s.prop26 = s.eVar26 = 'Commcare Pharmacy';
    if (info.indexOf('27') !== -1)s.prop26 = s.eVar26 = 'ITSRx';
    if (info.indexOf('34') !== -1)s.prop26 = s.eVar26 = 'Skyemed Pharmacy';
    if (info.indexOf('37') !== -1)s.prop26 = s.eVar26 = 'Ascend Specialty Rx';
    if (info.indexOf('42') !== -1)s.prop26 = s.eVar26 = 'Other Specialty Pharmacy';
    if (info.indexOf('43') !== -1)s.prop26 = s.eVar26 = 'No Specialty Pharmacy';

    //addition for new fields (only doing no phone) - 27 was not in use, so reused
    if (info.indexOf('No Phone') !== -1)s.prop27 = s.eVar27 = 'No Phone';
}

function OmnitureTrackRegisterLightbox() {
    var s = s_gi(s_account);

}

function OmnitureTrackRegistration(info) {

    var s = s_gi(s_account);
    s.linkTrackVars='events,prop11,eVar11,prop13,eVar13,prop22,eVar22,prop23,eVar23,prop24,eVar24,prop25,eVar25,prop26,eVar26,prop27,eVar27';
    s.linkTrackEvents='event2,event3,event12';
    s_doPlugins(s);

    s.prop11=s.eVar11=s.channel+':registrationform';
    s.prop13=s.eVar13=s.channel+':'+'email_updates';

    // Which best describes you? (optional)
    if(info.indexOf("ABXEUA0190") !== -1)s.prop22=s.eVar22="I have cancer";
    if(info.indexOf("ABXEUA0191") !== -1)s.prop22=s.eVar22="I am a caregiver for someone who has cancer";

    // Which type of cancer do you or the person you care for have?
    if(info.indexOf("ABXEUA0192") !== -1)s.prop23=s.eVar23="Metastatic breast cancer";
    if(info.indexOf("ABXEUA0194")!== -1)s.prop23=s.eVar23="Stage III (Dukes' C) colon cancer";
    if(info.indexOf("ABXEUA0193") !== -1)s.prop23=s.eVar23='Metastatic colorectal cancer';
    if(info.indexOf("ABXEUA0195") !== -1)s.prop23=s.eVar23="Unknown";

    // When did you start treatment with Xeloda?
    if(info.indexOf("ABXEUA0260") !== -1)s.prop24=s.eVar24="Haven't Started Treatment";
    if(info.indexOf("ABXEUA0198") !== -1)s.prop24=s.eVar24="1-15 Days";
    if(info.indexOf("ABXEUA0199") !== -1)s.prop24=s.eVar24="16-30 Days";
    if(info.indexOf("ABXEUA0200") !== -1)s.prop24=s.eVar24="31-45 Days";
    if(info.indexOf("ABXEUA0202") !== -1)s.prop24=s.eVar24="Over 60 Days";
    if(info.indexOf("ABXEUA0203") !== -1)s.prop24=s.eVar24="Don't Know";

    s.events=s.events+',event2,event3,event12';
    s.tl(this,'o',s.pageName+'|registrationform');

    clearOmniVar();
}
 
/*********************************************************************************************************/
/* Track Enroll - Should be used when enrollment does not involve answering assessment questions.
 If user opts-out of joining an email mailing list, pass an empty string to mailinglist. */

function trackEnrollEvent(form,mailinglist){
//    var s_linkTrackVarsTemp = s.linkTrackVars;
//    var s_linkTrackEventsTemp = s.linkTrackEvents;

    var s = s_gi(s_account);
    s.linkTrackVars='events,prop11,eVar11,prop13,eVar13';
    s.linkTrackEvents='event2,event3,event12'
    s_doPlugins(s);

    s.prop11=s.eVar11=s.channel+':'+form;
    s.events='event2,event12';
    if(mailinglist!='') {
        s.prop13=s.eVar13=s.channel + ':'+mailinglist;
        s.events=s.events+',event3';
    }

    s.tl(this,'o',s.pageName + '|enroll_'+form);
//    s.linkTrackVars = s_linkTrackVarsTemp;
//    s.linkTrackEvents = s_linkTrackEventsTemp;
    clearOmniVar();
}

/*********************************************************************************************************/
/*Track Tool use - Should be inserted in the onclick when a visitor begins using a tool.
 Note: not every interaction with the tool should be tagged. This is used to determin when a vistor begins
 using a tool (versus simply viewing the page where the tool is located).*/

function OmnitureTrackTool(toolName){
    var s_linkTrackVarsTemp = s.linkTrackVars;
    var s_linkTrackEventsTemp = s.linkTrackEvents;
    s.linkTrackVars='events,prop16,eVar16';
    s.linkTrackEvents='event8';
    s.events='event8';
    s.prop16=s.eVar16= s.channel + ":" + toolName;
    s.tl(this,'o',s.pageName+'|'+toolName);
    s.linkTrackVars = s_linkTrackVarsTemp;
    s.linkTrackEvents = s_linkTrackEventsTemp;
    clearOmniVar();
}


function OmnitureBreastCancerQuestionnaireTool() {
    s.linkTrackVars = 'events,prop16,eVar16';
    s.linkTrackEvents = 'event8';
    s.prop16 = s.eVar16 = s.channel + ':' + 'BreastCancerQuestionnaire';
    s.events = 'event8';
    s.tl(this, 'o', s.pageName + '|BreastCancerQuestionnaire');
    clearOmniVar()

}

function OmnitureColorectalCancerQuestionnaireTool() {
    s.linkTrackVars = 'events,prop16,eVar16';
    s.linkTrackEvents = 'event8';
    s.prop16 = s.eVar16 = s.channel + ':' + 'ColorectalCancerQuestionnaire';
    s.events = 'event8';
    s.tl(this, 'o', s.pageName + '|ColorectalCancerQuestionnaire');
    clearOmniVar()

}

function OmnitureBreastCancerQuestionnaireSpanishTool() {
    s.linkTrackVars = 'events,prop16,eVar16';
    s.linkTrackEvents = 'event8';
    s.prop16 = s.eVar16 = s.channel + ':' + 'BreastCancerQuestionnaireSpanish';
    s.events = 'event8';
    s.tl(this, 'o', s.pageName + '|BreastCancerQuestionnaireSpanish');
    clearOmniVar()

}

function OmnitureColorectalCancerQuestionnaireSpanishTool() {
    s.linkTrackVars = 'events,prop16,eVar16';
    s.linkTrackEvents = 'event8';
    s.prop16 = s.eVar16 = s.channel + ':' + 'ColorectalCancerQuestionnaireSpanish';
    s.events = 'event8';
    s.tl(this, 'o', s.pageName + '|ColorectalCancerQuestionnaireSpanish');
    clearOmniVar()
}

function OmnitureFormErrTrack(formName,ErrMsg) {
    var s = s_gi(s_account);
    s.linkTrackVars = 'events,prop11,eVar11,prop19,eVar19';
    s.linkTrackEvents = 'event14';
    s_doPlugins(s);
    s.prop11 = s.eVar11 = s.channel + ':' + formName;
    s.prop19 = s.eVar19 = ErrMsg;
    s.events = 'event14';
    s.tl(this, 'o', s.pageName + '|form_error');
    s.linkTrackVars = 'prop35,prop36,prop37,prop38,eVar35,eVar36,eVar37,eVar38';
    s.linkTrackEvents = 'None';
    clearOmniVar()
}

function OmnitureTrackExitLinks(linktext, linkURL) {
    externalWindowLink = 'false';
    s.linkTrackVars = 'prop35,eVar35,prop36,eVar36,prop37,eVar37';
    s.prop35 = s.eVar35 = s.pageName;
    s.prop36 = s.eVar36 = linktext;
    s.prop37 = s.eVar37 = s.prop35 + ' | ' + s.prop36;
    s.tl(this, 'e', linkURL);
    externalWindowLink = '';
    clearOmniVar()
}
//**********************************************************************

