//SNS용 URL생성
function getShortUrl(param, url, title, aid)
{
var u = encodeURIComponent(url);
var aid = encodeURIComponent(aid);
var p = param;
if(navigator.appName == "Netscape")
{
var nt = encodeURIComponent(title);
}
else if(navigator.appName == "Microsoft Internet Explorer")
{
var nt = escape(title);
}
else
{
var nt = escape(title);
}
if(window.ActiveXObject){ // IE5.0, IE6.0
req = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){ //IE7.0, FireFox, Safari, Opera
req = new XMLHttpRequest();
}
if (req)
{
req.open("GET","http://missionlife.kukinews.com/article/shortUrl.asp?snsUrl=" + u +"&arcid=" + aid, false);
req.send(null);
if (req.readyState==4)
{
if (req.status==200)
{
var shortUrl = req.responseText;
var openUrl;
if (p=="t")
{
openUrl = "http://twitter.com/home?status="+nt+" "+shortUrl;
window.open(openUrl, "twitter_pop");
}
else if (p=="f")
{
openUrl = "http://www.facebook.com/sharer.php?t="+nt+"&u="+shortUrl;
window.open(openUrl, "facebook_pop");
}
}
}
}
}