﻿// JScript File
function PrinterFriendly(){
    var s = window.location;
    var f = s.href;
    //alert(f);
    var l = '';
    //var sloc = s;
    if(f.indexOf('?')>0){
        l = f+'&print=1';
    } else {
        l = f+'?print=1';
    }
    //alert(loc);
    window.open(l,'_Blank','width=700,height=500,menubar=yes,scrollbars=yes,status=yes,resizable=yes');
}

function EmailPage(){
    var s = window.location;
    var loc = '../emailpage.aspx?link=' + s;
    //alert(loc);
    window.open(loc,'_Blank','width=350,height=290,menubar=no,scrollbars=no,status=yes,resizable=no');
}

function ReferralPage(t){
    //var s = window.location;
    var loc = '../Referral.aspx?type=' + t;
    //alert(loc);
    window.open(loc,'_Blank','width=350,height=290,menubar=no,scrollbars=no,status=yes,resizable=no');
}

function CheckNewsletterFields(sName,sEmail,dLayer){
    var x = true;
    
    if(sName.value == ""){
        alert("Please make sure you've filled in the NAME field.");
        dLayer.style.display = 'block';
        x = false;
    } 
    
    if(sEmail.value == ""){
        alert("Please make sure you've filled in the E-MAIL field.");
        dLayer.style.display = 'block';
        x = false;
    }
    
    return x;
    
}

function CalculateFields(fa,fb,fc){

    var objA = document.getElementById(fa);
    var objB = document.getElementById(fb);
    var objC = document.getElementById(fc);
    var a = 0;
    var b = 0;
    var c = 0;
    
    if(objA.value=='') {
        a = 0;
    } else {
        a = parseInt(objA.value,10);
    }
    if(objB.value=='') {
        b = 0;
    } else {
        b = parseInt(objB.value,10);
    }
    c = a+b;
    
    objC.value = c;
    
}