﻿function share(site, id, title, msg) {
   var location = String(window.location.protocol + "//" + window.location.host);
/*
window.location.protocol + "//" + window.location.host
*/
	
	
	 msg = encodeURI(msg);
    shareUrl = location+"?newsid=" + id;
    shareUrl = encodeURI(shareUrl);

    title = encodeURI(title);
    time = new Date().getTime();

    switch (site) {
        case 'twitter':
            var url = "http://twitter.com/share?url=" + shareUrl + "&text=" + title;
            var width = "800";
            var height = "400";
            break;
        case 'facebook':
            var url = "http://www.facebook.com/sharer.php?u=" + shareUrl + "&timestamp=" + time; ;
            var width = "800";
            var height = "400";
            break;
        case 'linkedin':
            var url = "http://www.linkedin.com/shareArticle?mini=true&url=" + shareUrl + "&title=" + title + "&source=http://etc-staging.redsrv01.net" + "&timestamp=" + time; ;
            var width = "800";
            var height = "400";
            break;
        case 'hyves':
            var url = "http://www.hyves-share.nl/button/tip/?tipcategoryid=12&title=" + title + "&body=Klik [url=" + shareUrl + "]hier[/url] voor meer informatie";
            var width = "800";
            var height = "450";
            break;
    }

    popupLinkedIn = window.open(url, 'share', 'width=' + width + ',' +
                                                    'height=' + height + ',' +
                                                    'status=no,' +
                                                    'location=no,' +
                                                    'menubar=no,' +
                                                    'directories=no,' +
                                                    'toolbar=no,' +
                                                    'resizable=no,' +
                                                    'scrollbars=no');

    popupLinkedIn.focus();
}
