﻿// JScript File
var SelectedStore
function ChangeBG(PageId){
    switch(PageId)
    {
    case "product_info":
        document.body.style.backgroundImage = "url(/images/products/background.gif)"
        break;
    case "product_labeling_info":
        document.body.style.backgroundImage = "url(/images/product_labeling/background.gif)"
        break;
    case "prescription_users":
        document.body.style.backgroundImage = "url(/images/prescription_users/background.gif)"
        break;
    case "faq":
        document.body.style.backgroundImage = "url(/images/faq/background.gif)"
        break;
    case "allergy_info":
        document.body.style.backgroundImage = "url(/images/allergy_info/background.gif)"
        break;
    default:
      //Do Nothing
    }
}
function ZipBlur(){
    if(document.getElementById("zip_code").value == ""){
        document.getElementById("zip_code").value = "Enter Zipcode"
        document.getElementById("zip_code").className = "tbBlur"
    }
}
function ZipFocus(){
    if(document.getElementById("zip_code").value == "Enter Zipcode"){
        document.getElementById("zip_code").value = ""
    }
    document.getElementById("zip_code").className = "tbFocus"
}
function MouseOver(LinkId){
    document.getElementById(LinkId).src="/images/navigation/" + LinkId + "_on.jpg"
}
function MouseOut(LinkId){
    document.getElementById(LinkId).src="/images/navigation/" + LinkId + "_off.jpg"
}
function SubMouseOver(LinkId){
    document.getElementById(LinkId + "Link").className = 'subnavItemOver'
}
function SubMouseOut(LinkId){
    document.getElementById(LinkId + "Link").className = 'subnavItem'
}
function StoreMouseOver(LinkId){
    document.getElementById(LinkId).className = 'td_compare_menu_item_over'
}
function StoreMouseOut(LinkId){
    document.getElementById(LinkId).className = 'td_compare_menu_item'
}
function SubNavLink(LinkId){
    var URL
    switch(LinkId)
    {
    case 1:
      URL = "/product_lineup.asp"
      break;    
    case 2:
      URL = "/products/quick_dissolving_tablets.asp"
      break;
    case 3:
      URL = "/products/allergy_sinus.asp"
      break;
    case 4:
      URL = "/products/kids.asp"
      break;
    case 5:
      URL = "/products/tablets.asp"
      break;
    default:
      //Do Nothing
    }
    window.location.href = URL;
}
function FooterLink(LinkId){
    var x, y, URL
    x = 960
    y = 475    
    switch(LinkId)
    {
    case 1:
      URL = "http://www.pfizer.com/general/privacy_policy_transitioned.jsp"
      break;    
    case 2:
      URL = "http://www.pfizer.com/general/privacy_faqs.jsp"
      break;
    case 3:
      break;
    case 4:
      URL = "http://www.wyethallbrands.com/special_offers.aspx"
      break;
    case 5:
      URL = "http://www.wyeth.com/countrynotice"
      x = 440
      y = 250
      break;
    case 6:
      URL = "http://www.pfizer.com/general/terms_transitioned.jsp"
      break;
      case 7:
      URL = "http://www.pfizer.com"
      break;
    default:
      //Do Nothing
    }
    OpenWindow(URL,x,y)
}
function ContactLink(){
    window.location.href = "/contact_us.asp"
}
function OpenWindow(URL,x,y){
    var NewWindow
    NewWindow = window.open(URL, "Alavert_Link", "left=" + (screen.width-x)/2 + ",top=" + (screen.height-y)/3 +",menubar=no,width=" + x + ",height=" + y +",toolbar=no,scrollbars=yes,resizable=yes")
    NewWindow.window.focus();
}
function LeaveWyeth(StoreId){
    SelectedStore = StoreId
    sm('box',350,175)
}
function ContinueBuyOnline(){
    var x, y, URL
    x = 960
    y = 475
    switch(SelectedStore) {
        case 1:
            URL = "http://www.cvs.com/CVSApp/search/shop_all_results.jsp?trail=SRCH%3Aalavert&addFacet=1016%3AAlavert"
            break;
        case 2:
            URL = "http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=dimetapp#/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=alavert&rh=i%3Aaps%2Ck%3Aalavert"
            break;
        case 3:
            URL = "http://www.drugstore.com/search/search_results.asp?N=0&Ntx=mode%2Bmatchallpartial&Ntk=All&srchtree=5&Ntt=alavert"
            break;
        case 4:
            URL = "http://www.kmart.com/shc/s/s_10151_10104_Health+%26+Wellness_Medicine+Cabinet_Allergy+%26+Sinus?keyword=alavert&viewItems=25&sLevel=1%7C2&sLevel=0&redirectType=SKIP_LEVEL&prop17=alavert"
            break;
        case 5:
            URL = "http://www.walmart.com/search/search-ng.do?search_query=alavert&ic=16_0&Find=Find&search_constraint=0"
            break;
        case 6:
            URL = "http://www.walgreens.com/search/results.jsp?Ntt=alavert"
            break;    
            
    }
    setTimeout("hm('box')", 500)
    OpenWindow(URL,x,y)
}
function AllergyTracker(){
    URL = "/allergy_tracker.asp?zip=" + XSSsanitize(document.getElementById("zip_code").value)
    x = 575
    y = 500
    OpenWindow(URL,x,y)
}

// XSSsanitize function used to sanitizing the Zip Code value by stripping off any junk characters
// Included on 04/28/2010 
function XSSsanitize(theString)
{
	theString = theString.replace(">", "");
	theString = theString.replace("<", "");
	theString = theString.replace(/"/g,"");
	theString = theString.replace("'", "");
	theString = theString.replace("%", "");
	theString = theString.replace(";", "");
	theString = theString.replace("(", "");
	theString = theString.replace(")", "");
	theString = theString.replace("&", "");
	theString = theString.replace("+", "");
	return theString; 
}

function CheckIsNumber(evt){
    var myCheck
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 47 && charCode < 58) {
        myCheck = true;
    } else {
        myCheck = false; 
    }
    if(document.getElementById("zip_code").value.length > 4){
        myCheck = false;
    }
    return myCheck
}
function AlignCompareMenu(){
    var top, height
    top = parseInt(document.getElementById("Compare_menu").offsetTop)
    height = parseInt(document.getElementById("Compare_menu").offsetHeight)
    top = top - height
    document.getElementById("Compare_menu").style.top = top + "px"
}
function ShowContent(ElementId) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(ElementId).style.visibility = "";
    } else {
        if (document.layers) { // Netscape 4
            document.ElementId.visibility= "";
        } else { // IE 4
            document.all.ElementId.style.visibility = "";
        }
    }
}
function HideContent(ElementId) {
    document.getElementById(ElementId).style.visibility = "hidden";
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(ElementId).style.visibility = "hidden";
    } else {
        if (document.layers) { // Netscape 4
            document.ElementId.visibility= "hidden";
        } else { // IE 4
            document.all.ElementId.style.visibility = "hidden";
        }
    }
}

HoverMenu = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" HoverMenu";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" HoverMenu\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", HoverMenu);

