var winRef = null;

function Bookmark()
{
	var title = 'DarynKagan.com';
	var url = 'http://www.darynkagan.com';
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "");
	else if (window.sidebar&&window.sidebar.addPanel)
		window.sidebar.addPanel(title,url,"");
	else
		alert( "Open DarynKagan.com in Safari, then choose 'Prefrences' from the 'Safari' menu and click 'General'. Click 'Set to Current Page'.  You can also type the address for the page you want to use in the 'Homepage' box.");
}

function PopWindow(file, width, height, showScroll)
{
	if ( typeof( showScroll ) == 'undefined' )
		showScroll = 'yes';

	if( winRef )
		winRef.close();
		
	winRef = window.open(file, "Popup", "height=" + height + ",width=" + width +
	",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=" + showScroll)
	return false;
}

function CreateMailToLink()
{
	var tempLink = window.location.href;

	if( tempLink.indexOf( "#" ) == tempLink.length-1 )
		tempLink = tempLink.slice( 0, tempLink.length-1);

	var linkText = 'mailto:?subject=Check out DarynKagan.Com!&body=I thought of you when I saw this story. It comes from DarynKagan.com, a website where all stories fit the theme, "Show The World What\'s Possible!" Check it out!  ';
	linkText += tempLink;
	
	var linkText2 = 'mailto:?subject=Check out DarynKagan.Com!&body=I thought of you when I saw this site, DarynKagan.com, a website where all stories fit the theme, "Show The World What\'s Possible!" Check it out!  http://www.darynkagan.com';

	var myObj = null;
	var linkColl = null;
	if( tempLink.indexOf( ".com/index.html" ) > -1 )
	{
		try
		{
			myObj = document.getElementById( "uLeft" );
			linkColl = myObj.getElementsByTagName( "A" );
		
			for( var i = 0; i < linkColl.length; i++ )
			{
				if( linkColl[i].innerText.toLowerCase().indexOf( 'send to a friend' ) > -1 )
					linkColl[i].href = linkText2;
			}
		}
		catch(e){}
	}
	else
	{
		try
		{
			myObj = document.getElementById( "InlineLinks" );
			linkColl = myObj.getElementsByTagName( "A" );

			for( var i = 0; i < linkColl.length; i++ )
			{
				if( linkColl[i].innerText.toLowerCase().indexOf( 'send to a friend' ) > -1 )
					linkColl[i].href = linkText;
			}
		}
		catch(e){}

		try
		{
			myObj = document.getElementById( "uNavSub" );
			linkColl = myObj.getElementsByTagName( "A" );
		
			for( var i = 0; i < linkColl.length; i++ )
			{
				if( linkColl[i].innerText.toLowerCase().indexOf( 'send to a friend' ) > -1 )
					linkColl[i].href = linkText2;
			}
		}
		catch(e){}
	}
}

var winRef2 = null;
function LinkToVideo()
{
	if( winRef2 )
		winRef2.close();

	var tempLink = window.location.href;

	if( tempLink.indexOf( "#" ) == tempLink.length-1 )
		tempLink = tempLink.slice( 0, tempLink.length-1);
	
	var linkTo = "/videolink.html?link=" + tempLink;

	winRef2 = window.open( linkTo, "VideoPopup", "height=100,width=250,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no");
	return false;
}