// JavaScript Document
function openWindow(homeUrl,returnUrl,type,title,w,h)
{
	var url="";

	switch(type)
	{
		case "facebook":
				url = homeUrl + encodeURIComponent(returnUrl) + "&t="+encodeURIComponent(document.title);
				var $nwin = window.open('', title, 'height=' + h + ',width=' + w + ',status=no,toolbar=no,menubar=no,location=0,scrollbars=0');
				//window.open(url, title, 'height=' + h + ',width=' + w + ',status=no,toolbar=no,menubar=no,location=0,scrollbars=0');
				break;
		case "digg":
				url = homeUrl + encodeURIComponent(returnUrl);
				var $nwin = window.open('', title);
				//window.open(url, title);
				break;
		case "delicious":
				url = homeUrl + encodeURIComponent(returnUrl);
				var $nwin = window.open('', title);
				//window.open(url, title);
				break;
		case "stumble":
				url = homeUrl + encodeURIComponent(returnUrl);
				var $nwin = window.open('', title);
				//window.open(url, title);
				break;
		case "Twitter":
				url = homeUrl + encodeURIComponent(returnUrl);
				var $nwin = window.open('', title, 'height=' + h + ',width=' + w + ',status=no,toolbar=no,menubar=no,location=0,scrollbars=0');
				//window.open(url, title);
				break;
				
		case "relatedlink":
				url = homeUrl;
				var $nwin = window.open('', title);
				//window.open(url, title);
				break;
		case "download":
				url = homeUrl;
				//var $nwin = window.open('', title);
				window.open(url, title);
				break;
				
		case "mobileLink":
				url = homeUrl;
				//var $nwin = window.open('', title);
				window.open(url, title);
				break;
		case "mobileLinkclickthru":
				url = homeUrl;
				//var $nwin = window.open('', title);
				window.open(url, title);
				break;
		case "downloadLink":
				url = homeUrl;
				//var $nwin = window.open('', title);
				window.open(url, title);
				break;
		case "infoLink":
				url = homeUrl;
				var $nwin = window.open('', title);
				//window.open(url, title);
				break;
		case "sponsorLink":
				url = homeUrl;
				//var $nwin = window.open('', title);
				window.open(url, title);
				break;
	}
	
	if (navigator.userAgent.indexOf('MSIE') !=-1)
	{
		$nwin.document.body.onbeforeunload = $nwin.opener.myOnunload;
	}
	else
	{
		$nwin.onbeforeunload = $nwin.opener.myOnunload;
	}
	
	$nwin.document.title = "Share on " + type;
	//$nwin.document.style.margin = '0px';
	var el = $nwin.document.createElement("iframe");
	el.setAttribute('id', 'ifrm');
	el.setAttribute('frameborder', '0');
	el.style.height = '100%';
	el.style.width = '100%';

	$nwin.document.body.appendChild(el);

	el.setAttribute('src', url);

}

function myOnunload()
{
  vxGetPlayer().dispatchEvent('eCloseSHare', null);
}