
function open_new_window(url)
{
	window.open(url);
}

String.prototype.replaceAll = function(
 strTarget, // The substring you want to replace
 strSubString // The string you want to replace in.
 ){
 var strText = this;

 var intIndexOfMatch = strText.indexOf( strTarget );

 // Keep looping while an instance of the target string
 // still exists in the string.
 while (intIndexOfMatch != -1){
 // Relace out the current instance.
 strText = strText.replace( strTarget, strSubString )

 // Get the index of any next matching substring.
 intIndexOfMatch = strText.indexOf( strTarget );
 }

 // Return the updated string with ALL the target strings
 // replaced out with the new substring.
 return( strText );
 }

function link_type(type)
{
	//press_detail
	//alert(share_url);
	var share_url = encodeURIComponent(share_url_main);
	//alert(share_url);
	var url ="";
	switch(type)
	{
		case 'yahoo':
		{
			url = "http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&u=" + share_url + "&t=" + share_title;

			break;
		}

		case 'facebook':
		{
			url = "http://www.facebook.com/sharer.php?u=" + share_url + "&t=" + share_title;
			break;
		}

		case 'delicious':
		{
			url = "http://delicious.com/save?url=" + share_url + "&title=" + share_title;
			break;
		}
		case 'linkedin':
		{
			url= "http://www.linkedin.com/shareArticle?mini=true&url=" + share_url + "&title=" + share_title + "&summary=" + share_title + "&source=" + share_url;
			break;
		}
		case 'windowslive':
		{
			url = "https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=" + share_url + "&title=" + share_title + "&top=1";
			break;
		}
		case 'google':
		{
			url = "http://www.google.com/bookmarks/mark?op=edit&bkmk=" + share_url + "&title=" + share_title;
			break;
		}
		case 'diigo':
		{
			url = "http://secure.diigo.com/post?url=" + share_url + "&title=" + share_title;
			break;
		}
		case 'stumbleupon':
		{
			var current_share_url = decodeURIComponent(share_url);
			current_share_url = current_share_url.replace("index.php","share_this.php").replaceAll("&",",");

			url = "http://www.stumbleupon.com/submit?url=" + current_share_url + "&title=" + share_title;
			break;
		}
		case 'digg':
		{
			url = "http://digg.com/submit?phase=2&url=" + share_url + "&title=" + share_title;
			break;
		}
		case 'twitter':
		{
			url = "http://twitter.com/home/?status=" + share_title + " " + share_url;
			break;
		}
		case 'myspace':
		{
			url = "http://www.myspace.com/Modules/PostTo/Pages/?u=" + share_url + "&t=" + share_title;
			break;
		}
		case 'tumblr':
		{
			url = "http://www.tumblr.com/login?s=&t=" + share_title + "&u=" + share_url + "&v=3";
			break;
		}
		case 'planyp':
		{
			var current_share_url = decodeURIComponent(share_url);
			current_share_url = current_share_url.replace("index.php","share_this.php").replaceAll("&",",");

			url ="http://planyp.us/plans/new/?url=" + share_url + "&title=" + share_title + "&description=" + current_share_url;
			break;
		}
		case 'blogger':
		{
			url = "http://www.blogger.com/blog_this.pyra?t=" + share_title + "&u=" + share_url + "&n=" + share_title + "&pli=1";
			break;
		}
		case 'posterious':
		{
			url = "http://posterous.com/share?linkto=" + share_url + "&title=" + share_title ;
			break;
		}
	}

	open_new_window(url);
}