function addBookMark(siteURL,siteName) {
    if (window.external && window.external.AddFavorite) {
        // Internet Explorer
        window.external.AddFavorite(siteURL, siteName);
    } else if (window.sidebar && window.sidebar.addPanel) {
        // Mozilla, Firefox ...
        window.sidebar.addPanel(siteName, siteURL, '');
    } else if (window.opera && window.print) {
        // Opera
        alert("您需要手动添加到收藏?, 使用快捷键Ctrl+D.");
    } else {
        alert("您需要手动添加到收藏?.");
    }
    return false;
}

function openExternalLink(elementId) {
    if(!document.getElementById(elementId) && !document.getElementsByTagName) return;
    var links = document.getElementById(elementId).getElementsByTagName('a');
    var localURL = 'http://www.crsky.com';
    for(i=0; i<links.length; i++) {
        url = links[i].getAttribute('href');
        if(url.indexOf(localURL) == -1 && url.indexOf('http') == 0) {
            links[i].setAttribute('target','_blank');
        }
    }
}

/*hideText*/
function hideText(e, conLen, str1, str2)
{
	textBox = document.getElementById(e);
	if ("" == conText)
	{
		conText = textBox.innerHTML;
	}

	if(navigator.appName.indexOf("Explorer") > -1)
	{
		if (textBox.innerText.length < conLen)
		{
			return;
		}
		textBox.innerHTML = textBox.innerText.substr(0, conLen);    
	}
	else
	{
		if (textBox.textContent.length < conLen)
		{
			return;
		}
		textBox.innerHTML = textBox.textContent .substr(0, conLen);
	}
	textBox.innerHTML += '...&nbsp;&nbsp;</div><div style="float:right;margin-top:5px;"><a href="javascript:;" onclick="showText(\'' + e + '\',\'' + conLen + '\', \'' + str1 + '\', \'' + str2 + '\');return false" target="_self">' + str1 + '</a></div>';
}

function showText(e, conLen, str1, str2)
{
	textBox = document.getElementById(e);;
	textBox.innerHTML = conText + '&nbsp;&nbsp;</div><div style="float:right;margin-top:5px;"><a href="javascript:;" onclick="hideText(\'' + e + '\', \'' + conLen + '\', \'' + str1 + '\', \'' + str2 + '\');return false" target="_self">' + str2 + '</a></div>';
}



