﻿//global variables
var webhost = "http://www.teamasia.com/";

//document ready
$(document).ready(function() {
    CheckExternalLinks();
    $('head').append('<link rel="shortcut icon" type="image/x-icon" href="' + webhost + 'designer/favicon.ico">');
});


//
//functions
//


//CheckExternalLinks
function CheckExternalLinks() {
// Creating custom :external selector
    $.expr[':'].external = function(obj) {
        return !obj.href.match(/^mailto\:/)
        && (obj.hostname != location.hostname)
        && !obj.href.match(/^javascript\:/);
    };
    
    //Change URL
    var current_link = "";
    $('a:external').each(function() {
        current_link = $(this).attr("href");
        $(this).attr("href", webhost + "goto.aspx?loc=" + current_link);
    });
}

//Call Click on Enter Key
function doClick(e, buttonid) {
    var evt = e ? e : window.event;
    var bt = document.getElementById(buttonid);
    if (bt) {
        if (evt.keyCode == 13) {
            bt.click();
            return false;
        }
    }
}
