function setCookie(NameOfCookie, value, expiredays) 
{ var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());

}

function huskmeg(firma,bruker)
{
setCookie('cfirmanavn',document.loginn[firma].value,360);
setCookie('cbnavn',document.loginn[bruker].value,360);
}

function clearform(formname)
{
if ((document.loginn[formname].value=="[Login name]") || (document.loginn[formname].value=="[User name]"))
      document.loginn[formname].value="";
}

function cleardemoform(formname)
{
if ((document.demoaccount[formname].value=="[fornavn]") || (document.demoaccount[formname].value=="[etternavn]"))
      document.demoaccount[formname].value="";
}

function clearsearchform(formname)
{
if ((document.sok[formname].value=="[kvasir]") || (document.sok[formname].value=="[yahoo]") || (document.sok[formname].value=="[JM portalen]"))
      document.sok[formname].value="";
}

function clearwebmailform(formname)
{
if ((document.webmail[formname].value=="[epostadresse]") || (document.webmail[formname].value=="[passord]"))
      document.webmail[formname].value="";
}

function huskepost()
{
setCookie('cepostaddr',document.webmail.imapuser.value,360);
}

function insertintoform(elementname,formname,altelementname)
{
//	elementname is the formtagname
//	formname is the name of the form
//	altelementname is used if the text should be something else than the formtagname

	newtext = elementname;
	
	if (altelementname)
		newtext = altelementname;

	if (document[formname][elementname].value=="")
		document[formname][elementname].value="["+newtext+"]";

}
