function setCookie(name, value)
{
  document.cookie = name+"="+value;

}

function KeyPress( e, strBtnName ) 
{
    var code = e.charCode || e.keyCode;

    if (code!=13)
    {
        return true;
    }
    else
    {
        var objButtons = document.getElementsByName(strBtnName);

        if ( objButtons[0] != null )
            objButtons[0].click();

        return false;
    }
}
function SetFocusTb(element){
	var tb = document.getElementById(element);
	tb.focus();
	//tb.value = tb.value;
}
function setCursorAtEnd(sTextboxID) { 
	var oTextbox = document.all.item(sTextboxID); 
	if (oTextbox.createTextRange) { 
		var r = (oTextbox.createTextRange()); 
		r.moveStart('character', (oTextbox.value.length)); 
		r.collapse(); 
		r.select(); 
	}
}
function openSession(url)
{
	newwindow=window.open(url,'session');
	newwindow.focus(); 

}
function insertphotoCredit(sTextboxID){
	var oTextbox = document.all.item(sTextboxID); 
	if(oTextbox.value == "Type your text here")
	{
	oTextbox.value ="";
	}
	else
	{
	oTextbox.value+= "\n";  
	}
	oTextbox.value+="Photo credit: ";
	setCursorAtEnd(sTextboxID);
	SetFocusTb(element);
}
