<!--
//Cookies

function setCookie(name,value,days,path,domain,secure) 
{
  if(value >= 101)
	//alert(name +value +" " +days +" " +path  +" " + domain +" " +secure)
  var expires, date;
  if (typeof days == "number") {
    date = new Date();
    date.setTime( date.getTime() + (days*24*60*60*1000) );
		expires = date.toGMTString();
  }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}


function getCookie(name) 
{
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) 
  {
    //alert(c_ar[i]);
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) 
    {
		return unescape( c.substring(nameq.length, c.length) );
	}
	//else
	//	alert("");
  }
  return null;
}



function deleteCookie(name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

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("Athugaðu hvort rétt netfang hafi verið slegið inn");
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) 
{
    
    alert("Athugaðu hvort rétt netfang hafi verið slegið inn");   
    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("Athugaðu hvort rétt netfang hafi verið slegið inn");        
			return false
	    }
    }
    return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) 
{
	   alert("Athugaðu hvort rétt netfang hafi verið slegið inn");
    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("Athugaðu hvort rétt netfang hafi verið slegið inn");   
   return false
}

if (len<2) 
{
   
   alert("Athugaðu hvort rétt netfang hafi verið slegið inn");
   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;	 
}

function resetTextBox(textBox, strValue)
{
	if(textBox.value == "")
	{
		textBox.value = strValue;
	}
	else if(textBox.value == strValue)
	{
		textBox.value = "";
	}
}

function createCode(oForm)
{
	var temp="";
	var oForm = document.getElementById(oForm);
	if(oForm)
	{
		for(var i=0;i<5;i++)
		{
			temp+= Math.round(Math.random() * 8 );
		}
		oForm.theImg.src="/includes/TImage.aspx?code=" +temp;
		oForm.Hidden1.value=temp;
	}
}

function setTall() {
	if (document.getElementById) {
		var maxHeight = 0;
		for (var i = 0; i < setTall.arguments.length; i++) {
			var objDiv = document.getElementById(setTall.arguments[i])
			if (objDiv.offsetHeight > maxHeight) maxHeight = objDiv.offsetHeight;
		}
		for (var i = 0; i < setTall.arguments.length; i++) {
			var objDiv = document.getElementById(setTall.arguments[i]);
			objDiv.style.height = maxHeight + 'px';
			if (objDiv.offsetHeight > maxHeight) {
				objDiv.style.height = (maxHeight - (objDiv.offsetHeight - maxHeight)) + 'px';
			}
		}
	}
}


function writeFlash(p) {
	writeEmbed(
		'D27CDB6E-AE6D-11cf-96B8-444553540000',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'application/x-shockwave-flash',
		p
	);
}

function writeShockWave(p) {
	writeEmbed(
	'166B1BCA-3F9C-11CF-8075-444553540000',
	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
	'application/x-director',
		p
	);
}

function writeQuickTime(p) {
	writeEmbed(
		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
		'video/quicktime',
		p
	);
}

function writeRealMedia(p) {
	writeEmbed(
		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'audio/x-pn-realaudio-plugin',
		p
	);
}

function writeWindowsMedia(p) {
	p.url = p.src;
	writeEmbed(
		'22d6f312-b0f6-11d0-94ab-0080c74c7e95',
		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
		'application/x-mplayer2',
		p
	);
}

function writeEmbed(cls, cb, mt, p) {
	var h = '', n;

	h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
	h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
	h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
	h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
	h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
	h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
	h += '>';

	for (n in p)
		h += '<param name="' + n + '" value="' + p[n] + '">';

	h += '<embed type="' + mt + '"';

	for (n in p)
		h += n + '="' + p[n] + '" ';

	h += '></embed></object>';

	document.write(h);
}

/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$(".web-list a img").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$(".web-list a img").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(document).ready(
		function(){
		
	tooltip();
});





//-->
