﻿$(document).ready(function () {
    
    var original_imageTop = "url('images/Menu/TopMenuButton_Blue.png')";
    var second_imageTop = "url('images/Menu/TopMenuButton_Yellow.png')";
    var original_imageMid = "url('images/Menu/MidMenuButton_Blue.png')";
    var second_imageMid = "url('images/Menu/MidMenuButton_Yellow.png')";
    var original_imageBtm = "url('images/Menu/BottomMenuButton_Blue.png')";
    var second_imageBtm = "url('images/Menu/BottomMenuButton_Yellow.png')";
    
    $('[id$=main]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageTop);
    }).mouseout(function () {
        $(this).css('background-image', original_imageTop);
    });

    $('[id$=news]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageMid);
    }).mouseout(function () {
        $(this).css('background-image', original_imageMid);
    });
    
    $('[id$=depts]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageMid);
    }).mouseout(function () {
        $(this).css('background-image', original_imageMid);
    });

    $('[id$=history]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageMid);
    }).mouseout(function () {
        $(this).css('background-image', original_imageMid);
    });    
    
    $('[id$=specs]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageMid);
    }).mouseout(function () {
        $(this).css('background-image', original_imageMid);
    });

    $('[id$=tact]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageMid);
    }).mouseout(function () {
        $(this).css('background-image', original_imageMid);
    });

    $('[id$=media]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageMid);
    }).mouseout(function () {
        $(this).css('background-image', original_imageMid);
    });

    $('[id$=links]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageMid);
    }).mouseout(function () {
        $(this).css('background-image', original_imageMid);
    });

    $('[id$=marines]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageMid);
    }).mouseout(function () {
        $(this).css('background-image', original_imageMid);
    });

    $('[id$=join]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageMid);
    }).mouseout(function () {
        $(this).css('background-image', original_imageMid);
    });
    
    $('[id$=contact]').click(function () {
        jumpto2($(this).attr('id'));
    }).mouseover(function () {
        $(this).css('background-image', second_imageBtm);
    }).mouseout(function () {
        $(this).css('background-image', original_imageBtm);
    });
});

function jumpto2(divId) {
    switch(divId)
    {
    case 'main':
        window.location = 'index.aspx';
        break;
    case 'news':
        window.location = 'news.aspx';
        break;
    case 'depts':
        window.location = 'departments.aspx';
        break;
    case 'history':
        window.location = 'history.aspx';
        break;
    case 'specs':
        window.location = 'specifications.aspx';
        break;
    case 'tact':
        window.location = 'tactical.aspx';
        break;
    case 'media':
        window.location = 'media.aspx';
        break;
    case 'links':
        window.location = 'transporter.aspx';
        break;
    case 'marines':
        window.location = 'f3msg.aspx';
        break;
    case 'join':
         window.location = 'join.aspx';
        break;
   case 'contact':
        window.location = 'ContactUs.aspx';
        break;      
    } 
}

function mailMe(sDom, sUser) {
    return ("mail" + "to:" + sUser + "@" + sDom.replace(/%23/g, "."));
}

function SendMail() {
    var subj = "?subject=" + $('#Subject').val();
    var emailId = $('#ToAddress option:selected').val();
    var bod = "&body=" + $('#Bodytext').val();

    var emailAddr;
    switch (emailId) {
        case "1":
            emailAddr = "sc@ssfreedom3.org";
            break;
//        case "2":
//            emailAddr = "xo@ssfreedom3.org";
//            break;
//        case "3":
//            emailAddr = "ops@ssfreedom3.org";
//            break;
        case "4":
            emailAddr = "webmaster@ssfreedom3.org";
            break;
//        case "5":
//            emailAddr = "oic@ssfreedom3.org";
//            break;
        default:
            alert("You Must Choose a Contact!");
            break;
    }

    var mailToLink = 'mailto:' + emailAddr + subj + bod;
    win = window.open(mailToLink, "emailWindow");
}
