var x;
	var y;

	function mouser(event){
		x=event.clientX;
		y=event.clientY;
		document.getElementById('divMouseX').innerHTML = x+15;
		document.getElementById('divMouseY').innerHTML = y+10;
	}
	
	
	function mouseX(event){
		x=event.clientX;
		return x;
	}

	function showTip(sText) {
		document.getElementById('tooltip').style.visibility="visible";
		document.getElementById('tooltip').style.display="block";
		document.getElementById('tooltip').style.left = document.getElementById('divMouseX').innerHTML ;
		document.getElementById('tooltip').style.top = document.getElementById('divMouseY').innerHTML ;
		document.getElementById('tooltip_content').innerHTML = sText;
	}
	function hideTip() {
		document.getElementById('tooltip').style.visibility="hidden";
		document.getElementById('tooltip').style.display="none";
	}









	/************************************************************************************
	 parameters: 
			mobile = mobilenumber to verify
			country = countrycode/prefix
			
	 returnvalues:
			0 = OK
			1 = Not a mobilenumber
			x = The correct mobilenumber length for the given country.
	************************************************************************************/
	function isValidMobileNumber(mobile,country){
		var ret;
		if (isNaN(mobile))
			return 1;
		
		switch(country){
			case "31":	// Netherland
				if (mobile.length!=9)
					return 9
				else if (Left(mobile,1)!=6)
					return 1;
				else
					return 0;

			case "44":	// UK 
				if (mobile.length!=10)
					return 10
				else if (Left(mobile,1)!=7)
					return 1;
				else
					return 0;
			
			case "45":	// Denmark
				if (mobile.length!=8)
					return 8;
				
				else
					return 0;

			case "46":	// Sweden
				if (mobile.length!=9)
					return 9;
				else  if (Left(mobile,1)!=7)
					return 1;
				else
					return 0;
					
			case "47":	// Norway
				if (mobile.length!=8)
					return 8;
				else if (Left(mobile,1)!=4 && Left(mobile,1)!=9)
					return 1;
				else
					return 0;
					
			case "91":	// India
				if (mobile.length!=10)
					return 10
				else
					return 0;

			case "92":	// Pakistan
				if (mobile.length!=10)
					return 10
				else
					return 0;

			case "298":	// Færøyene
				if (mobile.lengt!=6)
					return 6;
				else
					return 1;

			case "358":	// Finland
				if (mobile.lengt!=9)
					return 9;
				else if (Left(mobile,1)!=4 && Left(mobile,1)!=5)
					return 1;
				else
					return 0;
		}
	}
	
	

	function HTTPpost(url){
		var xmlhttp=false;
		var returnValue=new String();
		/*@cc_on @*/
		/*@if (@_jscript_version >= 5)
		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				xmlhttp = false;
			}
		 }
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		if (!xmlhttp && window.createRequest) {
			try {
				xmlhttp = window.createRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		xmlhttp.open("GET", url,false);
		xmlhttp.send(null);
		returnValue=xmlhttp.responseText;
		return returnValue;
	}



	function getBrowser()	{
		var detect = navigator.userAgent.toLowerCase();
		var OS,browser,version,total,thestring;

		if (checkIt('konqueror'))
		{
			browser = "Konqueror";
			OS = "Linux";
		}
		else if (checkIt('safari')) browser = "Safari"
		else if (checkIt('omniweb')) browser = "OmniWeb"
		else if (checkIt('opera')) browser = "Opera"
		else if (checkIt('webtv')) browser = "WebTV";
		else if (checkIt('icab')) browser = "iCab"
		else if (checkIt('msie')) browser = "Internet Explorer"
		else if (!checkIt('compatible'))
		{
			browser = "Netscape Navigator"
			version = detect.charAt(8);
		}
		else browser = "An unknown browser";

		if (!version) version = detect.charAt(place + thestring.length);

		if (!OS)
		{
			if (checkIt('linux')) OS = "Linux";
			else if (checkIt('x11')) OS = "Unix";
			else if (checkIt('mac')) OS = "Mac"
			else if (checkIt('win')) OS = "Windows"
			else OS = "an unknown operating system";
		}
		
		return browser;

		function checkIt(string)
		{
			place = detect.indexOf(string) + 1;
			thestring = string;
			return place;
		}
	}

		
	function setValue(formName,fieldName,value)	
	{
		if (String(value)=="" || String(value)=="undefined")
			return;
		
		fieldType=document.forms[formName][fieldName]
		
		try	{
			switch (fieldType.type)	{
			case "hidden":
				document.forms[formName][fieldName].value = value;
				break;
			case "text":
				document.forms[formName][fieldName].value = value;
				break;
			case "textarea":
				document.forms[formName][fieldName].value = value;
				break;
			case "select-one":
				for (i=0;i<document.forms[formName][fieldName].length;i++)	{
					if (document.forms[formName][fieldName].item(i).value == value)	{
						document.forms[formName][fieldName].selectedIndex=i;
					}			
				}
				break;
			case "select-multiple":
				if (String(value).indexOf(","))	{
					aValue = String(value).split(",");
					for (a=0;a<aValue.length;a++)	{
						for (z=0;z<document.forms[formName][fieldName].length;z++)	{
							if (Number(document.forms[formName][fieldName].item(z).value) == Number(aValue[a]))		{
								document.forms[formName][fieldName].options[z].selected=true;
							}		
						}
					}	
					
				}
				else	{
					for (i=0;i<document.forms[formName][fieldName].length;i++)	{
						if (document.forms[formName][fieldName].item(i).value == value)	{
							document.forms[formName][fieldName].selectedIndex=i;
						}			
					}
				}
				break;
			case "checkbox":
				if (value=="True" || value=="on" || value=="1")
					document.forms[formName][fieldName].checked=true;
				break;
			default:
				aValue = new Array();
				if (String(value).length >1)
					aValue = String(value).split(",");
				else
					aValue[0]=value;
								
				for (a=0;a<aValue.length;a++)	{
					for (z=0;z<document.getElementsByName(fieldName).length;z++)	{
						if (Number(document.forms[formName][fieldName].item(z).value) == Number(aValue[a]))		{
							document.forms[formName][fieldName].item(z).checked = true;
						}		
					}
				}	
				
				break;
			}
	  }
	  catch(e)	{
			alert("Sorry!\nFormfield : ["+ fieldName +"] did not exists inside form : ["+ formName +"]");
	  }
	}
	// ----- setValue() Slutt --------------------------------------

	function verifyDatefield(formName,fieldName)	{
		// Function verify that all 3 select boxes have a value, and crate the correct datevalue for the given 
		// datefield. To use the funcion, the given fieldname, and select box have to use the same name. Example:
		// dateTime, dateTime_dd, dateTime_mm and dateTime_yy. Where the first field would have the formatted datetime
		// value returned from this form. The other tree fields would be the select boxes to build the correct date.
		
		if (document.forms[formName][fieldName+"_dd"].selectedIndex!="" && 
			document.forms[formName][fieldName+"_mm"].selectedIndex!="" &&	
			document.forms[formName][fieldName+"_yy"].selectedIndex!="")	{
			var day = new String(document.forms[formName][fieldName+"_dd"].item(document.forms[formName][fieldName+"_dd"].selectedIndex).value);
			var month = new String(document.forms[formName][fieldName+"_mm"].item(document.forms[formName][fieldName+"_mm"].selectedIndex).value);
			var year = new String(document.forms[formName][fieldName+"_yy"].item(document.forms[formName][fieldName+"_yy"].selectedIndex).value);

			if (day.length==1) day = "0"+ day;
			if (month.length==1) month = "0"+ month;				
			document.forms[formName][fieldName].value=day +"."+ month +"."+ year;

			b = checkDate(document.forms[formName][fieldName])
			return b;
		}
		else
			return true;
	}
	
	function checkDate(field){
		var checkstr = "0123456789";
		var DateField = field;
		var Datevalue = "";
		var DateTemp = "";
		var seperator = ".";
		var day;
		var month;
		var year;
		var leap = 0;
		var err = 0;
		var i;
		err = 0;
		DateValue = DateField.value;

		/* Delete all chars except 0..9 */
		for (i = 0; i < DateValue.length; i++) {
		   if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
		      DateTemp = DateTemp + DateValue.substr(i,1);
		   }
		}
		
		DateValue = DateTemp;
		/* Always change date to 8 digits - string*/
		/* if year is entered as 2-digit / always assume 20xx */
		
		if (DateValue.length == 6) {
		   DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
		if (DateValue.length != 8) {
		   err = 19;}
		
		/* year is wrong if year = 0000 */
		year = DateValue.substr(4,4);
		if (year == 0) {
		   err = 20;
		}
		
		/* Validation of month*/
		month = DateValue.substr(2,2);
		if ((month < 1) || (month > 12)) {
		   alert(month)
		   err = 21;
		}
		
		/* Validation of day*/
		day = DateValue.substr(0,2);
		if (day < 1) {
		  err = 22;
		}
		
		/* Validation leap-year / february / day */
		if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
		   leap = 1;
		}
		if ((month == 2) && (leap == 1) && (day > 29)) {
		   err = 23;
		}
		if ((month == 2) && (leap != 1) && (day > 28)) {
		   err = 24;
		}
		
		/* Validation of other months */
		if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
		   err = 25;
		}
		if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
		   err = 26;
		}
		
		/* if 00 ist entered, no error, deleting the entry */
		if ((day == 0) && (month == 0) && (year == 00)) {
		   err = 0; day = ""; month = ""; year = ""; seperator = "";
		}
		
		/* if no error */
		if (err == 0) {
		   return true;
		}
		
		/* Error-message if err != 0 */
		else {
		   return false;
		}
	}	
	
	/****************************************************************
	Navn :			Left()
	Beskrivelse :	Bare en javascript utgave av Left() funksjonen
					som man finner i VBSCript.
	****************************************************************/
    function Left(str, n)
    {
        if (n <= 0)
            return "";
        else if (n > String(str).length)
            return str;
        else 
			return String(str).substring(0,n);
    }
	// ---- Left() Slutt --------------------------------------------



	/****************************************************************
	Navn :			Right()
	Beskrivelse :	Bare en javascript utgave av Right() funksjonen
					som man finner i VBSCript.
	****************************************************************/
    function Right(str, n)
    {
        if (n <= 0)
           return "";
        else if (n > String(str).length)
           return str;
        else {
           var iLen = String(str).length;
           return String(str).substring(iLen, iLen - n);
        }
    }
	// ---- Right() Slutt --------------------------------------------	