
function ShowImg(ID)
{
	window.open('/admin/common/ShowImage.asp?FileID=' + ID + '&NoProps=True','Bilde' + ID,'height=150,width=150,resizable=no,menubar=no,location=no,scrollbars=no,status=no,toolbar=no')
}

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if ( 
aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
} 

function getPrint(){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
	strReturn = strQueryString;	
  }
return "pages/print.aspx" + strReturn

}

function getTpf(){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
	strReturn = strQueryString;	
  }
return "pages/tipafriend.aspx" + strReturn

}

/* some general cookie functions */

function GetCookie(sName)
{
	// cookies are separated by semicolons
	var aCookie = document.cookie.split("; ");
	for (var i=0; i < aCookie.length; i++)
	{
		// a name/value pair (a crumb) is separated by an equal sign
		var aCrumb = aCookie[i].split("=");
		if (sName == aCrumb[0]) 
			return unescape(aCrumb[1]);
	}
	return null;   // a cookie with the requested name does not exist
}

function SetTempCookie(sName, sValue)
{
	document.cookie = sName + "=" + escape(sValue) + "; path=/";
}

function SetPermanentCookie(sName, sValue, expireDays)
{
	var expireDate = new Date ();
	expireDate.setTime(expireDate.getTime() + (expireDays * 24 * 3600 * 1000));
	
	document.cookie = sName + "=" + escape(sValue) + "; path=/" + ((expireDays == null) ? "" : "; expires=" + expireDate.toGMTString());
}

function DeleteCookie(sName) 
{
	if (GetCookie(sName))
	{
		document.cookie = sName + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function ToggleCookie(sName)
{ 
	var currentValue = GetCookie(sName);
	if (currentValue == null)   // cookie not found, assume false
		currentValue = "false";

	// toggle and set the cookie
	var newValue = (currentValue == "true" ? "false" : "true");
	SetCookie(sName, newValue);
}


