function hover()
{
	className = 'diary_link diary_linkH';
}
function hoverOUT()
{
	className = 'diary_link';
}

function changeStyle (itemId)
{
	element = document.getElementById(itemId);
	if (element.style.display == "none")
	{
		element.style.display = "inline";
		element.style.top	=	document.body.scrollTop;
		/*window.pageYOffset;*/
	}
	else 
		element.style.display = "none";
}

function changeStyleToInline (itemId)
{
	emailFormControl.style.display = "inline";
	emailFormControl.style.top	=	document.body.scrollTop;
}

function setLinkTextAndShow (itemId, text)
{
	
	element = document.getElementById('txtLink');
	element.value = text;
	changeStyle(itemId);
	if(!window.clipboardData)
	{
		element = document.getElementById('copyLink');
		element.style.display = "none";
		element = document.getElementById('txtLink');
		
		var length = element.value.length;
	    element.focus();
		element.setSelectionRange(0, length);
	}
}

function setClipboard()
{
	element = document.getElementById('txtLink');
	var value = element.value;
	
	if(window.clipboardData)
	{
		window.clipboardData.setData("Text", value);
	}
	
	changeStyle('linkForm');
}

function ShowEmail (headline, link, storyId)
{
	//changeStyle ('emailFormControl');
	
	emailFormControl.style.display = "inline";
	
	emailFormControl.style.top = document.body.scrollTop;
	
	elementTxt = document.getElementById ('emailFormCtrl_diaryUrl');
	elementTxt.value = link;
	
	elementTitle = document.getElementById ('emailFormCtrl_titleControl');
	elementTitle.value = headline;
	
	elementStoryId = document.getElementById ('emailFormCtrl_storyId');
	elementStoryId.value = storyId;
	
	elementSpan = document.getElementById ('emailFormCtrl_lblTitle');
		
	var browser=navigator.appName;
	if (browser.indexOf("Microsoft") >= 0)
	{
		//alert("ie");
		elementSpan.innerText = headline;
		
	}
	else
	{
		//alert("ff");
		elementSpan.textContent = headline;
	}
}

function ShowEmailAfterErrors (headline, link, storyId)
{
	element1 = document.getElementById('PageX');
	element2 = document.getElementById('PageY');
	window.scrollTo(element1.value, element2.value);
	ShowEmail (headline, link, storyId);
}

function ScrollIt()
{
    window.scrollTo(document.formMain.PageX.value, document.formMain.PageY.value);
}

function setcoords()
{
    var myPageX;
    var myPageY;
    if (document.all)
    {
        myPageX = document.body.scrollLeft;
        myPageY = document.body.scrollTop;
    }
    else
    {
        myPageX = window.pageXOffset;
        myPageY = window.pageYOffset;
    }
    document.formMain.PageX.value = myPageX;
    document.formMain.PageY.value = myPageY;
    
    var browser=navigator.appName;
	if (browser.indexOf("Microsoft") >= 0)
	{
		setTimeout("ScrollIt();",100);
	}
    return true;
}