//  customized functions for Google Analytics

/* Logo Homepage link
------------------------------*/
function logoHome() {
_gaq.push(['_trackEvent', 'event', 'click', 'homepage logo']);
}

/* Login link
------------------------------*/
function loginBtn() {
_gaq.push(['_trackEvent', 'event', 'click', 'login']);
}

/* Live Help Link - this is also applied to the Email Us Link when Customer Service is off
------------------------------*/
function liveHelp() {
_gaq.push(['_trackEvent', 'event', 'click', 'live help']);
}

/* Form - Blog Comment Started
------------------------------*/
function blogCommentStart() {
_gaq.push(['_trackEvent', 'commentForm', 'start', 'blog']);
}

/* Jobs Tab Tracker
------------------------------*/
function jobsTab(location){
_gaq.push(['_trackPageview', '/jobs.cfm/' + location]);
}

/* Jobs Indeed Layer Refine Search
------------------------------*/
function jobRefineSearch() {
    var keyword=$('#keyword').val();    
    var jobLocation=$('#jobLocation').val();    
    var distance=$('#distance option:selected').val();   

_gaq.push(['_trackEvent', 'jobSearch', 'search', keyword+', '+jobLocation+', '+distance]);
}

/* Cover Letter Preview Layer Tracker
------------------------------*/
function letterView(letterDesc, location){
_gaq.push(['_trackEvent', 'letterPreview', location, letterDesc]);

}

/* Delete a Resume
------------------------------*/
function resumeDelete() { 
_gaq.push(['_trackEvent', 'Document Delete', 'Delete', 'resume']);
} 

/* Delete a Letter
------------------------------*/
function letterDelete() { 
_gaq.push(['_trackEvent', 'Document Delete', 'Delete', 'letter']);
}

/* Download Tracking
------------------------------*/
function downloadPDF(article) {
_gaq.push(['_trackEvent', 'PDF', 'Download', article]);

} 

/* Trying this out to track the accounts.cfm page with omniture
 
---------------------------------- */
function accountEdit(title){
_gaq.push(['_trackPageview', '/accounts.cfm/' + title]);
}

/*onClick of 'cancel my membership' link in left column 
on main My Account page 
------------------------------------------------------- */
function accountCancel(title){

_gaq.push(['_trackPageview', '/accounts.cfm/maintenance-offer']);
}

/*onClick of 'save my stuff' - on cancel page with maintenance upsell
---------------------------------------------------------------------*/
function maintenanceSignup(){
_gaq.push(['_trackPageview', '/accounts.cfm/maintenance-sign-up']);
}

/*onClick the link at the bottom of page - Cancel Your Membership with maintenance upsell
------------------------------------------------------------------------------------------*/
function onlineCancellation(){
_gaq.push(['_trackPageview', '/accounts.cfm/cancellation-survey']);
}

/*onClick orange cancel my membership button - Cancel Your Membership Page with the questions
----------------------------------------------------------------------------------------------*/
function onlineCancelConfirm(){
  _gaq.push(['_trackPageview', '/accounts.cfm/cancellation-complete']);
}

/*Maintenance Confirmation - to fire when the payment confirmation page is displayed
------------------------------------------------------------------------------------*/
function maintenanceConfirmation(ordID,affProdID,city,state,country){
_gaq.push(['_trackPageview', '/accounts.cfm/maintenance-confirmation']);

  _gaq.push(['_addTrans',
    ordID,           // order ID - required
    '',  // affiliation or store name - not needed
    '9.95',          // total - required
    '0',           // tax - zero
    '0',              // shipping - zero
    city,       // city - if we can add, that would be great
    state,     // state or province - if we can add, that would be great
    country    // country - if we can add, that would be great
  ]);

   // add item might be called for every item in the shopping cart
   // where your ecommerce engine loops through each item in the cart and
   // prints out _addItem for each
  _gaq.push(['_addItem',
    ordID,           // order ID - required
    affProdID,           // SKU/code - required - affiliateProductID
    'Maintenance',        // product name - ProductName like Trial, Monthly, Annual, Maintenance
    '',   // category or variation - not needed
    '9.95',          // unit price - required - orderTotal
    '1'               // quantity - required - always 1
  ]);
  _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

}

/*onClick of 'View Ticket Details' - support requests page
----------------------------------------------------------*/
function accountSupport(){
_gaq.push(['_trackPageview', '/support.cfm/view-requests']);
}
