function open_crm_win(mode, w, h, lang)
{
    var window_name = 'maxim_crm_' + mode + '_win';
    var this_url = escape(document.URL);
    var base_url = '';
    var new_url = '';
    var hbe_pn = '';

    if (! lang) { lang = 'en'; }

    if (mode == 'link') {
	base_url = '/page_link_to_us.cfm';
	new_url = base_url + '?getlink=Request&loc=' + this_url;
	new_url += '&pn=' + hbe_pn;
    }
    else {
	base_url = 'https://support.maxim-ic.com/' + lang + '/website/';
	new_url = base_url + mode + '_page.mvp?loc=' + this_url;
    }

    var options = "width=" + w + ",height=" + h + ",";
    options += "resizable=yes,scrollbars=yes,status=yes,";
    options += "menubar=no,toolbar=no,location=no,directories=no,";
    options += "top=10,";
    options += "left=100";
    var new_win = window.open(new_url, window_name, options);
    new_win.focus();
}
function print_crm_link(mode, label, img_file, status, lang)
{
    var doc = top.document;
    var q_status = "'" + status + "'";
    var q_mode = "'" + mode + "'";

    if (! lang) { lang = 'en'; }
    var q_lang = "'" + lang + "'";

    var www_host = 'www.maxim-ic.com';
    if      (lang == 'cn') { www_host = 'china.maxim-ic.com'; }
    else if (lang == 'jp') { www_host = 'japan.maxim-ic.com'; }
    else if (lang == 'kr') { www_host = 'korea.maxim-ic.com'; }
    else if (lang == 'ru') { www_host = 'russia.maxim-ic.com'; }

    var a_tag = '<a'
	+ ' class="fcp" href="http://www.maxim-ic.com/misc/need_javascript.htm"'
	+ ' onMouseOver="status=' + q_status + '; return (true);"'
	+ ' onMouseOut="status=\'\'; return (true);"'
	+ ' onClick="open_crm_win('+q_mode + ', 700, 600, ' + q_lang + '); return(false);"'
	+ '>';
    // Override for comment.
    if (mode == 'comment') {
	//a_tag = '<a class="fcp" href="https://support.maxim-ic.com/' + lang + '/">';
	a_tag = '<a class="fcp" href="http://' + www_host + '/company/contact/">';
    }
    doc.writeln(a_tag + label + '</a>');
}

