<!--

function decrypt(str, pwd) {
  if(str == null || str.length < 8) {
    //
    return;
  }
  if(pwd == null || pwd.length <= 0) {
    //
    return;
  }
  var prand = "";
  for(var i=0; i<pwd.length; i++) {
    prand += pwd.charCodeAt(i).toString();
  }
  var sPos = Math.floor(prand.length / 5);
  var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
  var incr = Math.round(pwd.length / 2);
  var modu = Math.pow(2, 31) - 1;
  var salt = parseInt(str.substring(str.length - 8, str.length), 16);
  str = str.substring(0, str.length - 8);
  prand += salt;
  while(prand.length > 10) {
    prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
  }
  prand = (mult * prand + incr) % modu;
  var enc_chr = "";
  var enc_str = "";
  for(var i=0; i<str.length; i+=2) {
    enc_chr = parseInt(parseInt(str.substring(i, i+2), 16) ^ Math.floor((prand / modu) * 255));
    enc_str += String.fromCharCode(enc_chr);
    prand = (mult * prand + incr) % modu;
  }
  return enc_str;
}


function emailCheck (emailStr) 
{

var emailPat= /^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\,\\[\\]áðéíóúýþæöÁÐÉÍÓÚÝÞÆÖ'"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)

if (matchArray==null) 
{
	   alert("Please type in a valid e-mail address");
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) 
{
    
    alert("Please type in a valid e-mail address");   
    return false
}
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) 
{
    // this is an IP address
	for (var i=1;i<=4;i++) 
	{
	    if (IPArray[i]>255) 
	    {
	   alert("Please type in a valid e-mail address");        
			return false
	    }
    }
    return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) 
{
	   alert("Please type in a valid e-mail address");
    return false
}

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("Please type in a valid e-mail address");   
   return false
}

if (len<2) 
{
   
   alert("Please type in a valid e-mail address");
   return false
}

return true;
}


function openWindow(url,name,attributes) 
{
    var windowHandle = '';
	windowHandle = window.open(url,name,attributes);
}

function OpenCloseFolder( nContentId, strImageName )
	{
		var oImage = document.getElementById( strImageName );
		var oDiv = document.getElementById( nContentId );
		var strImage = "";
		
		oDiv.style.display  = (oDiv.style.display == "block") ? "none" : "block" ;
		strImage = (oDiv.style.display == "block") ? "folder_open.gif" : "folder_closed.gif";
		oImage.src = "/files/" + strImage;
	}



var HelpWindow = null;
function openHelpWindow(strHelp)
{
	var strQuery = unescape(strHelp)
	
	if (HelpWindow == null)
	{	
			HelpWindow = window.open("/formHelp.asp?help=" +escape(strQuery) , "helpWindow", "width=350, height=250, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=yes");
	}
	else
	{
		HelpWindow.location.href = "/formHelp.asp?help=" +escape(strQuery )
		HelpWindow.focus();
	}
		
}
function confirmReset(strReset)
{
	return confirm(strReset) 
}

function validate() 
{
	if(document.form1.len.value == "")
  		{
    		//alert("Nauðsynlegt er að slá inn lén.");
   			 document.form1.len.focus();
   			 return (false);
 		 }
	return true;	 
}

// by Paul@YellowPencil.com and Scott@YellowPencil.com
// feel free to delete all comments except for the above credit

function setTall() {
	if (document.getElementById) {
		// the divs array contains references to each column's div element.  
		// Replace 'center' 'right' and 'left' with your own.  
		// Or remove the last one entirely if you've got 2 columns.  Or add another if you've got 4!
		var divs = new Array(document.getElementById('c1'), document.getElementById('c2'));
		
		// Let's determine the maximum height out of all columns specified
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++) {
			if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
		}
		
		// Let's set all columns to that maximum height
		for (var i = 0; i < divs.length; i++) {
			divs[i].style.height = maxHeight + 'px';

			// Now, if the browser's in standards-compliant mode, the height property
			// sets the height excluding padding, so we figure the padding out by subtracting the
			// old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
			if (divs[i].offsetHeight > maxHeight) {
				divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
			}
		}
	}
}

function resetTextBox(textBox, strValue)
{
	if(textBox.value == "")
	{
		textBox.value = strValue;
	}
	else if(textBox.value == strValue)
	{
		textBox.value = "";
	}
	/*else
	{
		textBox.value = "";
	}*/

}

//-->
