
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

}


/* number formatting */

function formatStringAsPrice(input) { return format(Number(input.replace(",", "."))); }
function format(num) { return formatNumber(num,2,'&nbsp;',',','kr ','','-',''); }

// number formatting function; http://javascript.about.com/library/blnumfmt.htm
// copyright Stephen Chapman 24th March 2006, 22nd August 2008
// permission to use this function is granted provided
// that this copyright notice is retained intact
function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');var z = y.length - dec; if (z<0) z--; for(var i = z; i < 0; i++) y.unshift('0'); if (z<0) z = 1; y.splice(z, 0, pnt); if(y[0] == pnt) y.unshift('0'); while (z > 3) {z-=3; y.splice(z,0,thou);}var r = curr1+n1+y.join('')+n2+curr2;return r;}

function removeSpaces(string) {
	var tmp = escape(string).replace('%A0', '');
	return unescape(tmp);
} 

/* 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);
}

