/************************************************
DESCRIPTION:
*  if the user enters a username, check the box if the user has not already checked it
*  if the user checks the box but does not enter a username uncheck the box (i.e. do not save the check)

PARAMETERS:
    requestInfo - form to validate

RETURNS:
    True if valid, alert window with errors if false.
*************************************************/
function checkUser(fname) {
    var username = fname.username.value;
}

function doit(node)
{
    var theForm = document.getElementById('dataBean');
    var errMessage = "";
    var doLDAPRegistration=false;
    try
    {

        if (node.parentNode.id == 'page-2')
        {
            theForm.reqf.value="gender,firstname,lastname,birth_month,birth_day,birth_year,email,postalcode,question(diagnosed_type2),question(info_for_who)";

            if (theForm.formname.value == 'janumet_cns_special_offer_rmi')
            {
                theForm.action="/sitagliptin_metformin_HCl/submitSpecialOfferRMI_Step2.do";
            }
            else
            {
                theForm.action="/sitagliptin_metformin_HCl/submitCNSRMI_Step2.do";
            }

            var diagnosed_type2 = document.getElementsByName('question(diagnosed_type2)');

            if (!(diagnosed_type2[0].checked || diagnosed_type2[1].checked))
            {
                errMessage = errMessage + "Please indicate if you have been diagnosed with type 2 diabetes.\r\n";
            }

           var taking_januvia = document.getElementsByName('question(taking_janumet)');
            var divForMaine = document.getElementById('maine-exception-step2');
            if ((divForMaine != null) && (divForMaine.style.display != "none"))
            {
                theForm.reqf.value += ",question(taking_janumet)";
                if (!(taking_januvia[0].checked || taking_januvia[1].checked))
                {
                    errMessage = errMessage + "Please indicate if you are being treated for your type 2 diabetes with JANUMET.\r\n";
                }
            }
            else
            {
                taking_januvia[0].checked=false;
                taking_januvia[1].checked=false;
            }

            var info_for_who = document.getElementsByName('question(info_for_who)');
            if (!(info_for_who[0].checked || info_for_who[1].checked))
            {
                errMessage = errMessage + "Please indicate if you are requesting information for yourself or someone else.\r\n";
            }

            var username = document.getElementById('username');
            if ((username == null) || (username == 'undefined') || (0 == username.value.length))
            {
                theForm.registerUser.value="false";
            }

            var str = globalTrim(theForm.username.value);
            if (0 < str.length)
            {
                theForm.registerUser.value="true";
                doLDAPRegistration=true;
            }
        }
        else if (node.parentNode.id == 'page-3')
        {
            theForm.reqf.value="";

            if (theForm.formname.value == 'janumet_cns_special_offer_rmi')
            {
                theForm.action="/sitagliptin_metformin_HCl/submitSpecialOfferRMI_Step3.do";
            }
            else
            {
                theForm.action="/sitagliptin_metformin_HCl/submitCNSRMI_Step3.do";
            }

            var question1 = document.getElementsByName('question(state_of_residency)');
            if (question1[0].selectedIndex == 0)
            {
                errMessage = errMessage + "Please indicate which state you live.\r\n";
            }
            var question2 = document.getElementsByName('question(how_pay_for_prescriptions)');
            if (!((question2[0].checked) || (question2[1].checked) || (question2[2].checked)))
            {
                errMessage = errMessage + "Please indicate how you currently pay for your prescriptions.\r\n";
            }

            var question3 = document.getElementsByName('question(how_fill_prescriptions)');
            if (!((question3[0].checked) || (question3[1].checked)))
            {
                errMessage = errMessage + "Please indicate how you fill your prescriptions.\r\n";
            }
        }
        else if (node.parentNode.id == 'page-4')
        {
            theForm.reqf.value="";

            if (theForm.formname.value == 'janumet_cns_special_offer_rmi')
            {
                theForm.action="/sitagliptin_metformin_HCl/submitSpecialOfferRMI_Step4.do";
            }
            else
            {
                theForm.action="/sitagliptin_metformin_HCl/submitCNSRMI_Step4.do";
				
            }
        }

        var ok = globalValidateFields(theForm,errMessage);

        if (ok)
        {
            if (doLDAPRegistration)
            {
                if (theForm.formname.value == 'janumet_cns_special_offer_rmi')
                {
                    theForm.action="/sitagliptin_metformin_HCl/cnsSpecialOfferRegisterUser.do";
                }
                else
                {
                    theForm.action="/sitagliptin_metformin_HCl/cnsRegisterUser.do";
                }
            }
            theForm.submit();
        }
        return false;
    }
    catch (e)
    {
        alert(e);return false;
    }
}




function checkonSubmit(fname) {
    var username = fname.username.value;
    var errMessage = "";
    var errField = "";

    var diagnosed_type2 = document.getElementsByName('question(diagnosed_type2)');
    if (!(diagnosed_type2[0].checked || diagnosed_type2[1].checked))
    {
        isErr = true;
        errMessage = errMessage + "Please indicate if you have been diagnosed with type 2 diabetes.\r\n";
        if (errField.length <= 0) errField = "question(diagnosed_type2)";
    }

    var info_for_who = document.getElementsByName('question(info_for_who)');
    if (!(info_for_who[0].checked || info_for_who[1].checked))
    {
        isErr = true;
        errMessage = errMessage + "Please indicate if you are requesting information for yourself or someone else.\r\n";
        if (errField.length <= 0) errField = "question(info_for_who)";
    }

    if(validateIsEmpty(username)) {
        if(document.getElementById('access_flag').checked) {
            errMessage = errMessage + "Please enter Username or uncheck the checkbox above.\r\n";
            if (errField.length <= 0) errField = "access_flag";
            }
    } else {
        if(!document.getElementById('access_flag').checked) {
            errMessage = errMessage + "Please check the checkbox above.\r\n";
            if (errField.length <= 0) errField = "access_flag";
            }
    }

    return errMessage;
}


/************************************************
DESCRIPTION: Special Offers Thank you popup

RETURNS:
   Shows overlay popup after printing voucher
   or overlay=true in href
*************************************************/
function showThankYouPopup() {
    var object = document.getElementById('wrapper-body');
    object.style.opacity=".30";
    object.style.filter="alpha(opacity=30)";

    var object2 = document.getElementById('thankyou-popup');
    object2.style.visibility="visible";
    object2.style.display="block";

    var object3 = document.getElementById('merck-header-consumer');
    object3.style.opacity=".30";
    object3.style.filter="alpha(opacity=30)";

    var object4 = document.getElementById('januvia-button');
    object4.style.opacity=".30";
    object4.style.filter="alpha(opacity=30)";
    }

/************************************************
DESCRIPTION: Special Offers Thank you popup

RETURNS:
   Shows overlay popup after printing voucher
   or overlay=true in href
*************************************************/
function showThankYouCouponPopup() {
    var object = document.getElementById('wrapper-body');
    object.style.opacity=".30";
    object.style.filter="alpha(opacity=30)";

    var object2 = document.getElementById('thankyou-popup-coupon');
    object2.style.visibility="visible";
    object2.style.display="block";

    var object3 = document.getElementById('merck-header-consumer');
    object3.style.opacity=".30";
    object3.style.filter="alpha(opacity=30)";

    var object4 = document.getElementById('januvia-button');
    object4.style.opacity=".30";
    object4.style.filter="alpha(opacity=30)";
    }
/************************************************
DESCRIPTION: Validates required fields for RMI
        demographic info

PARAMETERS:
    requestInfo - form to validate

RETURNS:
    True if valid, alert window with errors if false.
*************************************************/
function validateRMI(requestInfo) {
    // Set variables
    var isErr = false; // for any type of error
    var errMessage = "";
    var errField = ""; // if there is an error, focus on the first required form field error

    // Get form values
    var firstname = requestInfo.firstname.value;
    var lastname = requestInfo.lastname.value;
    var email = requestInfo.email.value;
    var address1 = requestInfo.address1.value;
    var city = requestInfo.city.value;
    var state = requestInfo.state.selectedIndex;
    var postalcode = requestInfo.postalcode.value;
    var birth_month = requestInfo.birth_month.selectedIndex;
    var birth_day = requestInfo.birth_day.selectedIndex;
    var birth_year = requestInfo.birth_year.selectedIndex;

    var access = document.getElementById('access_flag');
    if (access.checked == true)
    {
        if(validateIsEmpty(requestInfo.username.value))
        {  // username field is empty
            isErr = true;
            errMessage = errMessage + "Please enter a username\r\n";
            if (errField.length <= 0) errField = "username";
        }
        if(validateIsEmpty(requestInfo.password.value))
        {  // password field is empty
            isErr = true;
            errMessage = errMessage + "Please enter a password\r\n";
            if (errField.length <= 0) errField = "password";
        }
        if(validateIsEmpty(requestInfo.secondpassword.value))
        {  // secondpassword field is empty
            isErr = true;
            errMessage = errMessage + "Please enter a confirmation password\r\n";
            if (errField.length <= 0) errField = "secondpassword";
        }
        if(requestInfo.securityquestion.selectedIndex == 0)
        {
            isErr = true;
            errMessage = errMessage + "Please select a security question\r\n";
            if (errField.length <= 0) errField = "securityquestion";
        }
        if(validateIsEmpty(requestInfo.securityanswer.value))
        {  // securityanswer field is empty
            isErr = true;
            errMessage = errMessage + "Please enter a security answer\r\n";
            if (errField.length <= 0) errField = "securityanswer";
        }
    }

    if (!(requestInfo.gender[0].checked  || requestInfo.gender[1].checked)) {
        isErr = true;
        errMessage = errMessage + "Please enter your Gender\r\n";
        if (errField.length <= 0) errField = "gender";
    }

    if(validateIsEmpty(firstname)) {  // firstname field is empty
        isErr = true;
        errMessage = errMessage + "Please enter your First Name\r\n";
        if (errField.length <= 0) errField = "firstname";
    }
    if(validateIsEmpty(lastname)) {  // lastname field is empty
        isErr = true;
        errMessage = errMessage + "Please enter your Last Name\r\n";
        if (errField.length <= 0) errField = "lastname";
    }
    if (!validateIsEmpty(email)) {  // email field contains a value
        email = email.trim();
        var x = email.search(/ /);
        var y = email.search(/,/);
        var z = email.search(/;/);

        if ((x != -1) || (y != -1) || (z != -1)) { // Check for more than one email address
            isErr = true;
            errMessage = errMessage + "You are only allowed to enter one e-mail address at a time.\r\n";
            if (errField.length <= 0) errField = "email";
        }
        if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.([A-Za-z0-9]{2,3})$/) == -1) { // Check for valid email address
            isErr = true;
            errMessage = errMessage + "Please enter your valid e-mail address\r\n";
            if (errField.length <= 0) errField = "email";
        }
    } else {  // email field is empty
        isErr = true;
        errMessage = errMessage + "Please enter your E-mail Address\r\n";
        if (errField.length <= 0) errField = "email";
    }
    if(validateIsEmpty(postalcode)) {  // postalcode field is empty
        isErr = true;
        errMessage = errMessage + "Please enter your ZIP Code\r\n";
        if (errField.length <= 0) errField = "postalcode";
    } else {
        postalcode = postalcode.trim(); // remove whitespace around value
        if (!validateUSZip(postalcode)) { // Check zip code is in valid format
            isErr = true;
            errMessage = errMessage + "Please enter a valid ZIP Code in 5 digit format.\r\n";
            if (errField.length <= 0) errField = "postalcode";
        }
    }
    if(birth_month == 0) {
        isErr = true;
        errMessage = errMessage + "Please enter your Date of Birth: Month\r\n";
        if (errField.length <= 0) errField = "birth_month";
    }
    if(birth_day == 0) {
        isErr = true;
        errMessage = errMessage + "Please enter your Date of Birth: Day\r\n";
        if (errField.length <= 0) errField = "birth_day";
    }
    if(birth_year == 0) {
        isErr = true;
        errMessage = errMessage + "Please enter your Date of Birth: Year\r\n";
        if (errField.length <= 0) errField = "birth_year";
    }

    var diagnosed_type2 = document.getElementsByName('question(diagnosed_type2)');
    if (!(diagnosed_type2[0].checked || diagnosed_type2[1].checked))
    {
        isErr = true;
        errMessage = errMessage + "Please indicate if you have been diagnosed with type 2 diabetes.\r\n";
        if (errField.length <= 0) errField = "question(diagnosed_type2)";
    }

    var info_for_who = document.getElementsByName('question(info_for_who)');
    if (!(info_for_who[0].checked || info_for_who[1].checked))
    {
        isErr = true;
        errMessage = errMessage + "Please indicate if you are requesting information for yourself or someone else.\r\n";
        if (errField.length <= 0) errField = "question(info_for_who)";
    }


    if (isErr)
    {
        alert(errMessage);

        var fieldFocus = document.getElementsByName(errField);
        fieldFocus[0].focus();

        return false;
    }

    return true;
}

/************************************************
DESCRIPTION: Validates required fields for
    Send to a Colleague

PARAMETERS:
    sendto - form to validate

RETURNS:
    True if valid, alert window with errors if false.
*************************************************/
function validateSend(sendto) {
    // Set variables
    var isErr = false; // for any type of error
    var errMessage = "";
    var errField = ""; // if there is an error, focus on the first required form field error

    // Get form values
    var toEmail = sendto.toEmail.value;
    var fromEmail = sendto.fromEmail.value;

    if (validateIsEmpty(toEmail)) {  // email field is empty
        isErr = true;
        errMessage = errMessage + "Please enter your friend's e-mail address\r\n";
        if (errField.length <= 0) errField = "toEmail";
    } else {
        toEmail = toEmail.trim();
        var x = toEmail.search(/ /);
        var y = toEmail.search(/,/);
        var z = toEmail.search(/;/);

        if ((x != -1) || (y != -1) || (z != -1)) { // Check for more than one email address
            isErr = true;
            errMessage = errMessage + "You are only allowed to enter one e-mail address at a time.\r\n";
            if (errField.length <= 0) errField = "toEmail";
        }
        if (toEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) { // Check for valid email address
            isErr = true;
            errMessage = errMessage + "Please enter a valid e-mail address\r\n";
            if (errField.length <= 0) errField = "toEmail";
        }
    }
    if (validateIsEmpty(fromEmail)) {  // email field is empty
        isErr = true;
        errMessage = errMessage + "Please enter your valid e-mail address\r\n";
        if (errField.length <= 0) errField = "toEmail";
    } else {
        fromEmail = fromEmail.trim();
        var x = fromEmail.search(/ /);
        var y = fromEmail.search(/,/);
        var z = fromEmail.search(/;/);

        if ((x != -1) || (y != -1) || (z != -1)) { // Check for more than one email address
            isErr = true;
            errMessage = errMessage + "You are only allowed to enter one e-mail address at a time.\r\n";
            if (errField.length <= 0) errField = "toEmail";
        }
        if (fromEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) { // Check for valid email address
            isErr = true;
            errMessage = errMessage + "Please enter your valid e-mail address\r\n";
            if (errField.length <= 0) errField = "fromEmail";
        }
    }

    if (isErr) {
        alert(errMessage);
        eval("sendto." + errField + ".focus()");

        return false;
    }

    return true;
}

/************************************************
DESCRIPTION: Validates that a string is a United
    States zip code in 5 digit format or zip+4
    format. The following are acceptable:
        12345
        12345-1234
        12345+1234
        12345 1234
        123451234

PARAMETERS:
    strValue - String to be tested for validity

RETURNS:
    True if valid, otherwise false.
*************************************************/
function validateUSZip(strValue) {
    if (strValue.search(/(^\d{5}$)|(^\d{5}-\d{4}$)|(^\d{5}\+\d{4}$)|(^\d{5}\W+\d{4}$)|(^\d{9}$)/) == -1) return false;
    return true;
}

/************************************************
DESCRIPTION: Checks if a string is empty

PARAMETERS:
   strValue - String to be tested for validity

RETURNS:
   True if valid (empty), otherwise false (not empty).
*************************************************/
function validateIsEmpty(strValue) {
    strValue = strValue.trim();
    if(strValue.length > 0) return false;
    return true;
}

/************************************************
DESCRIPTION: Removes leading and trailing spaces.

PARAMETERS: Source string from which spaces will
    be removed;

RETURNS: Source string with whitespaces removed.
*************************************************/
function trimString (str) {
    str = this != window? this : str;
    return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

// Added as a method to the String.prototype
String.prototype.trim = trimString;

// add bookmark
function addBookmark(title,url) {
if (window.sidebar) {
window.sidebar.addPanel(title, url,"");
} else if( document.all ) {
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true;
}
}

// popup windows
function showMoreQuestions()
{
    var theForm = document.getElementById('dataBean');
    theForm.dynamicPageFlow.value="false";
    theForm.realtime.value="false";
    theForm.submit();
}
function submitMoreQuestions()
{
    var theForm = document.getElementById('dataBean');
    theForm.realtime.value="false";
    theForm.submit();
}


//maine zip code check
function maineZipcode ()
{
    //All zipcodes in Maine - array will need to be modified if zipcode list for this state changes.
    var maineZipArray = new Array("03901", "03902", "03903", "03904", "03905", "03906", "03907", "03908", "03909", "03910", "03911", "04001", "04002", "04003", "04004", "04005", "04006", "04007", "04008", "04009", "04010", "04011", "04013", "04014", "04015", "04016", "04017", "04019", "04020", "04021", "04022", "04024", "04027", "04028", "04029", "04030", "04032", "04033", "04034", "04037", "04038", "04039", "04040", "04041", "04042", "04043", "04046", "04047", "04048", "04049", "04050", "04051", "04053", "04054", "04055", "04056", "04057", "04061", "04062", "04063", "04064", "04066", "04068", "04069", "04070", "04071", "04072", "04073", "04074", "04075", "04076", "04077", "04078", "04079", "04081", "04082", "04083", "04084", "04085", "04086", "04087", "04088", "04090", "04091", "04092", "04093", "04094", "04095", "04096", "04097", "04098", "04101", "04102", "04103", "04104", "04105", "04106", "04107", "04108", "04109", "04110", "04112", "04116", "04122", "04123", "04124", "04210", "04211", "04212", "04216", "04217", "04219", "04220", "04221", "04222", "04223", "04224", "04225", "04226", "04227", "04228", "04230", "04231", "04234", "04236", "04237", "04238", "04239", "04240", "04241", "04243", "04250", "04252", "04253", "04254", "04255", "04256", "04257", "04258", "04259", "04260", "04261", "04262", "04263", "04265", "04266", "04267", "04268", "04270", "04271", "04274", "04275", "04276", "04278", "04280", "04281", "04282", "04283", "04284", "04285", "04286", "04287", "04288", "04289", "04290", "04291", "04292", "04294", "04330", "04332", "04333", "04336", "04338", "04341", "04342", "04343", "04344", "04345", "04346", "04347", "04348", "04349", "04350", "04351", "04352", "04353", "04354", "04355", "04357", "04358", "04359", "04360", "04363", "04364", "04401", "04402", "04406", "04408", "04410", "04411", "04412", "04413", "04414", "04415", "04416", "04417", "04418", "04419", "04420", "04421", "04422", "04423", "04424", "04426", "04427", "04428", "04429", "04430", "04431", "04434", "04435", "04438", "04441", "04442", "04443", "04444", "04448", "04449", "04450", "04451", "04453", "04454", "04455", "04456", "04457", "04459", "04460", "04461", "04462", "04463", "04464", "04467", "04468", "04469", "04471", "04472", "04473", "04474", "04475", "04476", "04478", "04479", "04481", "04485", "04487", "04488", "04489", "04490", "04491", "04492", "04493", "04495", "04496", "04497", "04530", "04535", "04536", "04537", "04538", "04539", "04541", "04543", "04544", "04547", "04548", "04549", "04551", "04552", "04553", "04554", "04555", "04556", "04558", "04562", "04563", "04564", "04565", "04567", "04568", "04570", "04571", "04572", "04573", "04574", "04575", "04576", "04578", "04579", "04605", "04606", "04607", "04609", "04611", "04612", "04613", "04614", "04615", "04616", "04617", "04619", "04622", "04623", "04624", "04625", "04626", "04627", "04628", "04629", "04630", "04631", "04634", "04635", "04637", "04640", "04642", "04643", "04644", "04645", "04646", "04648", "04649", "04650", "04652", "04653", "04654", "04655", "04656", "04657", "04658", "04660", "04662", "04664", "04665", "04666", "04667", "04668", "04669", "04671", "04672", "04673", "04674", "04675", "04676", "04677", "04679", "04680", "04681", "04683", "04684", "04685", "04686", "04690", "04691", "04693", "04694", "04730", "04732", "04733", "04734", "04735", "04736", "04737", "04738", "04739", "04740", "04741", "04742", "04743", "04744", "04745", "04746", "04747", "04750", "04751", "04756", "04757", "04758", "04759", "04760", "04761", "04762", "04763", "04764", "04765", "04766", "04768", "04769", "04770", "04772", "04773", "04774", "04775", "04776", "04777", "04779", "04780", "04781", "04782", "04783", "04785", "04786", "04787", "04788", "04841", "04843", "04846", "04847", "04848", "04849", "04850", "04851", "04852", "04853", "04854", "04855", "04856", "04857", "04858", "04859", "04860", "04861", "04862", "04863", "04864", "04865", "04901", "04903", "04910", "04911", "04912", "04915", "04917", "04918", "04920", "04921", "04922", "04923", "04924", "04925", "04926", "04927", "04928", "04929", "04930", "04932", "04933", "04935", "04936", "04937", "04938", "04939", "04940", "04941", "04942", "04943", "04944", "04945", "04947", "04949", "04950", "04951", "04952", "04953", "04954", "04955", "04956", "04957", "04958", "04961", "04962", "04963", "04964", "04965", "04966", "04967", "04969", "04970", "04971", "04972", "04973", "04974", "04975", "04976", "04978", "04979", "04981", "04982", "04983", "04984", "04985", "04986", "04987", "04988", "04989", "04992");

    var maineException2=false;
    var maineException4=false;
    var xx = document.getElementById('maine-exception-step2');
    if (null != xx)
    {
        maineException2=true;
    }
    xx = document.getElementById('maine-exception-step4');
    if (null != xx)
    {
        maineException4=true;
    }

    if (maineException2) ShowDefaultContent('maine-exception-step2');
    if (maineException4) ShowDefaultContent('maine-exception-step4');


    i=0;
	flagSet = 'true';
    while (i < maineZipArray.length)
    {
        if (maineZipArray[i] == document.dataBean.postalcode.value)
        {
            if (maineException2){
				HideContent('maine-exception-step2');
				flagSet = 'false';
				//var taking_janumet = document.getElementById('taking_janumet_yes');
				//taking_janumet.checked = true; 
            }
			if (maineException4) HideContent('maine-exception-step4');
			
        } 
		
        i++;
    }
}

//IMPORTANT! carries the state from step 2 to step 3
function setMoneySavingState(str)
{
    if ((str == null) || (str == 'undefined') || (0 == str.length))
    {
        var theForm = document.getElementById('dataBean');
        var selIndex = theForm.state.selectedIndex;
        if (selIndex <= 0) return;

        str = theForm.state.options[selIndex].value;
    }
    var xx = document.getElementById('money_saving_state');
    if (null != xx)
    {
        xx.value=str;
    }
}



//Detect and Set IE6
var isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;

function ffScrollable(value){
	if (value == 'on'){
		$('html').css('overflow','auto');
		$('body').css('overflow','auto');
	} 
	else if (value == 'off'){
		$('html').css('overflow','hidden');
		$('body').css('overflow','hidden');
	}
}

//Scroll To Important Info
function scrollToImpInfo(id,offset){	
	if(isIE6){	
		var elemLocation = $('#'+id).offset().top+offset+50; //IE6 Needs a different Offset +50 pixels
		$('#contain-all').animate({scrollTop:elemLocation},'slow');
	} else {
		var elemLocation = $('#'+id).offset().top+offset;
		$('html,body').animate({scrollTop:elemLocation},'slow');
	}
}

//Back To Top
function backToTop(){
	var id = $('#outer');
	if(isIE6){	
		var elemLocation = $(id).offset().top;
		$('#contain-all').animate({scrollTop:elemLocation},'slow');
	} else {
		var elemLocation = $(id).offset().top;
		$('html,body').animate({scrollTop:elemLocation},'slow');
	}
	
}
//Toggle Floating Footer
function toggleFloatingFooter(){
	if($('#floating-footer').is(':visible')) {
		$("#floating-footer").hide();
	}
	if(!$('#bttTrigger').is(':visible')) {
		$("#bttTrigger").show();
	}
}



