function checkUncheckAll(theElement)
			{
    			var theForm = document.Eshop, z = 0;
				for(z=0; z<theForm.length;z++)
				{
					if(theForm[z].type == 'checkbox')
					{
						if (theForm[z].checked == true)
						{theForm[z].checked = false}
						else
						{theForm[z].checked = true}
					}
				}
			}
			
function onlyNumbers2(evt){
			var e = event || evt;
			// for trans-browser compatibility
			var charCode = e.which || e.keyCode;
			if (charCode > 31 && (charCode < 48 || charCode > 57)
			)
			return false;
			return true;
}
 						
function CalcCreditRequest(newcre, maxcre, usedcre)
			{
			//alert(newcre.id);
				var newcrev = Number(document.getElementById(newcre.id).value);
				var maxcrev = Number(document.getElementById('CreditMax').value);
				var usedcrev = Number(document.getElementById('CreditUsed').value);
				var total = (maxcrev - usedcrev);
				var totalf = (total + newcrev);
				document.getElementById('NewCreditLeft').value=totalf;
}
			
function onlyNumbers(evt){
			var e = event || evt;
			// for trans-browser compatibility
			var charCode = e.which || e.keyCode;
			if (charCode > 31 && (charCode < 48 || charCode > 57)
			)
			return false;
			return true;
}

		
function changeBox()
			{
				document.getElementById('pass_temp').style.display='none';
				document.getElementById('password').style.display='';
				document.getElementById('password').focus();
}
			
function restoreBox()
			{
			if(document.getElementById('password').value=='')
			{
				document.getElementById('pass_temp').style.display='';
				document.getElementById('password').style.display='none';
			}
}

function changeBox2()
			{
				document.getElementById('pass_temp2').style.display='none';
				document.getElementById('password2').style.display='';
				document.getElementById('password2').focus();
}
			
function restoreBox2()
			{
			if(document.getElementById('password2').value=='')
			{
				document.getElementById('pass_temp2').style.display='';
				document.getElementById('password2').style.display='none';
			}
}
			
function settextboxfocus(textboxname, defaultval)
			{
				if(document.getElementById(textboxname).value==defaultval)
				{
					document.getElementById(textboxname).value='';
}
				
			}
function settextboxblur(textboxname, defaultval)
			{
				if(document.getElementById(textboxname).value=='')
				{
					document.getElementById(textboxname).value=defaultval;
				}
}
			
			// SHOW/HIDE DIV 2
function ToggleDiv2(div) {
				if (document.all(div).style.display == "") {
					document.all(div).style.display = "none";
				}
				else
				{
					document.all(div).style.display = "";
				}; 
}
			// EMAIL CHECKER
function emailCheck (emailStr) {
				var checkTLD=1;
				var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
				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("Den indtastede e-mail adresse er ikke gyldig. prøv igen.");
					return false;
					}
				var user=matchArray[1];
				var domain=matchArray[2];
				for (i=0; i<user.length; i++) {
					if (user.charCodeAt(i)>127) {
						alert("Den indtastede e-mail adresse er ikke gyldig. prøv igen.");
						return false;
						}
						}
				for (i=0; i<domain.length; i++) {
					if (domain.charCodeAt(i)>127) {
						alert("Den indtastede e-mail adresse er ikke gyldig. prøv igen.");
						return false;
						}
				}
				if (user.match(userPat)==null) {
					alert("Den indtastede e-mail adresse er ikke gyldig. prøv igen.");
					return false;
				}
				var IPArray=domain.match(ipDomainPat);
				if (IPArray!=null) {
				for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					alert("Den indtastede e-mail adresse er ikke gyldig. prøv igen.");
					return false;
				   }
				}
				return true;
				}

				var atomPat=new RegExp("^" + atom + "$");
				var domArr=domain.split(".");
				var len=domArr.length;
				for (i=0;i<len;i++) {
				if (domArr[i].search(atomPat)==-1) {
				alert("Den indtastede e-mail adresse er ikke gyldig. prøv igen.");
				return false;
				   }
				}

				if (checkTLD && domArr[domArr.length-1].length!=2 && 
				domArr[domArr.length-1].search(knownDomsPat)==-1) {
				alert("Den indtastede e-mail adresse er ikke gyldig. prøv igen.");
				return false;
				}

				if (len<2) {
				alert("Den indtastede e-mail adresse er ikke gyldig. prøv igen.");
				return false;
				}
				return true;
			}

		
			// SHOW/HIDE DIV
			function ShowHide(pID) {
				if (document.getElementById(pID).style.display == "") {
					document.getElementById(pID).style.display = "none";
				}
				else
				{
					document.getElementById(pID).style.display = "";
				};
				}
				
				function ShowHideByName(pID) {
				if (document.getElementByName(pID).style.display == "") {
					document.getElementByName(pID).style.display = "none";
				}
				else
				{
					document.getElementByName(pID).style.display = "";
				};
				}
				
				
function validate_requiredx(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);
	return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_emailx(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}

//==========================================

function validate_required(field)
{
with (field)
  {
  if (value==null||value=="")
    {
	return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_email(field)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {
	return false;
	}
  else {
  return true;
  }
  }
}


function validate_form()
{
	thisform = document.probform
	allvalid=true;
	var alertmess ='';
	with (thisform)
	{
		if (validate_required(thisform.feedback_name)==false)
			{
				thisform.feedback_name.focus();
				allvalid=false;
				alertmess = alertmess + '- Navn er ikke korrekt udfyldt!\n';
			}
		if (validate_required(thisform.strCAPTCHA)==false)
			{
				allvalid=false;
				thisform.strCAPTCHA.focus();
				alertmess = alertmess + '- Sikkerhedsbillede er ikke udfyldt!\n';
			}
		if (validate_required(thisform.useros)==false)
			{
				allvalid=false;
				thisform.useros.focus();
				alertmess = alertmess + '- Operativ system er ikke korrekt udfyldt!\n';
			}
		if (validate_required(thisform.browserver)==false)
			{
				allvalid=false;
				thisform.browserver.focus();
				alertmess = alertmess + '- Browser er ikke korrekt udfyldt!\n';
			}
		if (validate_required(thisform.feedbackmessage)==false)
			{
				allvalid=false;
				thisform.feedbackmessage.focus();
				alertmess = alertmess + '- Beskrivelse af fejlen er ikke korrekt udfyldt!\n';
			}
		if (validate_email(thisform.email)==false)
			{
				allvalid=false;
				thisform.email.focus();
				alertmess = alertmess + '- E-mail er ikke en gyldig e-mail addresse!';
			}
	}

	if (allvalid==true)
		{
			thisform.submit();
		}
	else
	{
		alert('FEJL:\n'+alertmess);
		return false;
	}
}

/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="arrow2.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
	//move the horizontal position of the menu to the left by it's width
	tipobj.style.left=curX-tipobj.offsetWidth+"px"
	nondefaultpos=true
}
else if (curX<leftedge)
	tipobj.style.left="5px"
else{
	//position the horizontal position of the menu where the mouse is positioned
	tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
	pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
	tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
	nondefaultpos=true
}
else{
	tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
	pointerobj.style.top=curY+offsetfromcursorY+"px"
}
	tipobj.style.visibility="visible"
if (!nondefaultpos)
	pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip


function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}

function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}
var lsplayer = document.getElementById('lsplayer');
function playVideo() {
	lsplayer.Play();
}

function pauseVideo() { 
    lsplayer.Stop();
} 
	 
function stopVideo() {   
	lsplayer.Stop();  
	lsplayer.Rewind();
}

