<!-- 

function saveHumor(){
    window.location="bottom1.asp?action=saveHumor&humor="+document.humorForm.humor.value;
}

//-------------------------------------------------------------------------------

function NewCat(){
	if (document.cat.name.value==""){
		alert("You forgot the category name!");
		return false;
	}
}

//-------------------------------------------------------------------------------

function newFile(){
	if (document.frmUpload.upload.value==""){
		alert("You forgot to choose a file!");
		return false;
	}
}


//-----------------------------------------------------------------------------------------------

function Anmal(){
	if (document.form.subject.value==""){
		alert("You forgot to choose a report type!");
		return false;
	} else if (document.form.message.value==""){
		alert("You forgot to write more info about cause of this report!");
		return false;
	}
}

//-----------------------------------------------------------------------------------------------

function Toggle(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")
   key=document.getElementById("x" + item);
   if (visible) {
     obj.style.display="none";
   } else {
      obj.style.display="block";
   }
}

function Expand() {
   divs=document.getElementsByTagName("DIV");
   for (i=0;i<divs.length;i++) {
     divs[i].style.display="block";
     key=document.getElementById("x" + divs[i].id);
   }
}

function Collapse() {
   divs=document.getElementsByTagName("DIV");
   for (i=0;i<divs.length;i++) {
     divs[i].style.display="none";
     key=document.getElementById("x" + divs[i].id);
   }
}

function klistra(textEl) {
	if (textEl.createTextRange)
	textEl.caretPos = document.selection.createRange().duplicate();
	textE1 = (document.all) ? document.selection.createRange().text : document.getSelection();
}

//------------------------------------------------------------------------

function MaxLangd(obj,maxchars)
{
var labelname = obj.name + 'counter';

if (obj.value.length > maxchars)
obj.value = obj.value.substr(0, maxchars)

if (navigator.userAgent.indexOf('Gecko') >= 0)
document.getElementById(labelname).innerHTML = obj.value.length;
else
document.getElementById(labelname).innerText = obj.value.length;
}

//------------------------------------------------------------------------

function MemPoll(){
      if (document.poll.fraga.value.length < 2){
            alert("You forgot your question!");
            return false;
      }
}

//------------------------------------------------------------------------

var curmenu = 1

function showmenu(menuid){
  curmenu = menuid
  for (i = 1; i <= 10; i++){
    document.getElementById('sub'+i).style.visibility='hidden';
    if (i != curmenu){
      document.getElementById('menu'+i).style.backgroundImage='url(gfx/menu_orange.gif)';
    }
  }
  document.getElementById('sub'+menuid).style.visibility='visible';
}

//------------------------------------------------------------------------

function getNextElement (field) {
 var form = field.form;
 for (var e = 0; e < form.elements.length; e++)
   if (field == form.elements[e])
     break;
     return form.elements[++e % form.elements.length];
   }
 function tabOnEnter (field, evt) {
   var keyCode = document.layers ? evt.which : document.all ? 
   evt.keyCode : evt.keyCode;
   if (keyCode != 13)
     return true;
   else {
     getNextElement(field).focus();
   return false;
  }
}

//------------------------------------------------------------------------

function validateForm (form) {
  for (var e = 0; e < form.elements.length; e++) {
    var el = form.elements[e];
    if (el.type == 'text' || el.type == 'textarea' ||
        el.type == 'password' || el.type == 'file' ) { 
      if (el.value == '') {
        alert('Fill in the field ' + el.name);
        el.focus();
        return false;
      }
    }
    //else if (el.type.indexOf('select') != -1) {
    //  if (el.options[el.selectedIndex].value == "") {
    //    alert('Välj ett värde i ' + el.name);
    //    el.focus();
    //    return false;
    //  }
    //}
    else if (el.type == 'radio') {
      var group = form[el.name];
      var checked = false;
      if (!group.length)
        checked = el.checked;
      else
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
      if (!checked) {
        alert('Check one of the ' + el.name);
        el.focus();
        return false;
      }
    }
    else if (el.type == 'checkbox') {
      var group = form[el.name];
      if (group.length) {
        var checked = false;
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
        if (!checked) {
          alert('Check ' + el.name);
          el.focus();
          return false;
        }
      }
    }
  }
  return true;
}

//------------------------------------------------------------------------

function getAppVersion() {
	appname= navigator.appName;
	appversion = navigator.appVersion;
	majorver = appversion.substring(0, 1);
	if ( (appname == "Netscape") && ( majorver >= 3 ) ) return 1;
	if ( (appname == "Microsoft Internet Explorer") && (majorver >= 4) ) return 1;
	return 0;
} 

//------------------------------------------------------------------------

function swtch(num, imgname) {
	if (getAppVersion()) {
		document[imgname].src = img[num].src;
	}
}

//------------------------------------------------------------------------

imgsrc = new Array();
imgsrc[0] = "gfx/meny/start.gif";
imgsrc[1] = "gfx/meny/start2.gif";
imgsrc[2] = "gfx/meny/mitthellasn.gif";
imgsrc[3] = "gfx/meny/mitthellasn2.gif";
imgsrc[4] = "gfx/meny/hellasmail.gif";
imgsrc[5] = "gfx/meny/hellasmail2.gif";
imgsrc[6] = "gfx/meny/traffpunkt.gif";
imgsrc[7] = "gfx/meny/traffpunkt2.gif";
imgsrc[8] = "gfx/meny/hellassar.gif";
imgsrc[9] = "gfx/meny/hellassar2.gif";
imgsrc[10] = "gfx/meny/sokning.gif";
imgsrc[11] = "gfx/meny/sokning2.gif";
imgsrc[12] = "gfx/meny/noje.gif";
imgsrc[13] = "gfx/meny/noje2.gif";
imgsrc[14] = "gfx/meny/hjalpfaq.gif";
imgsrc[15] = "gfx/meny/hjalpfaq2.gif";
imgsrc[16] = "gfx/meny/vippis.gif";
imgsrc[17] = "gfx/meny/vippis2.gif";
imgsrc[18] = "gfx/meny/installningar.gif";
imgsrc[19] = "gfx/meny/installningar2.gif";
imgsrc[20] = "gfx/meny/loggaut.gif";
imgsrc[21] = "gfx/meny/loggaut2.gif";


if (getAppVersion()) {
	img = new Array();
	for (i = 0; i < imgsrc.length; i++) {
		img[i] = new Image();
		img[i].src = imgsrc[i];
	}
}

//------------------------------------------------------------------------

function CheckSize(ThisPic) {  
	if (ThisPic.width > 500) { 
		ThisPic.width = 500; 
	}
} 

//------------------------------------------------------------------------

function CheckSize550(ThisPic) {  
	if (ThisPic.width > 550) { 
		ThisPic.width = 550; 
	}
} 

//------------------------------------------------------------------------

function CheckSize1(ThisPic) {  
	if (ThisPic.width > 170) { 
		ThisPic.width = 170; 
	}
} 

//------------------------------------------------------------------------

function changepic(){ 
      document.frmUpload.MyPic.src=document.frmUpload.file.value; 
}

//------------------------------------------------------------------------

function changepic1(){ 
      document.ad1.MyPic1.src=document.ad1.bild1.value; 
}

//------------------------------------------------------------------------

function changepic2(){ 
      document.ad2.MyPic2.src=document.ad2.bild2.value; 
}

//------------------------------------------------------------------------

function changepic3(){ 
      document.ad3.MyPic3.src=document.ad3.bild3.value; 
}

//------------------------------------------------------------------------

function Answer(){
      if (document.login.meddelande.value==""){
            alert("You forgot to write a message!");
            return false;
      }
}

//------------------------------------------------------------------------

function AdIn(){
      if (document.ad.typ.value==""){
            alert("You forgot to choose advertise type!");
            return false;
      } else if (document.ad.kat.value==""){
            alert("You forgot to choose the category where the ads will be!");
            return false;
      } else if (document.ad.rubrik.value==""){
            alert("You must have a subject for the ads!");
            return false;
      } else if (document.ad.annonstext.value==""){
            alert("You forgot to write some info about the ads!");
            return false;
      }
}

//-----------------------------------------------------------------------------------------------

function Empty(mapp_ID,mapp){
	if(confirm('Do you want to empty the folder ' + mapp + '?')) {
		window.location = 'inkorg.asp?action=emptymapp&mappID=' + mapp_ID;
	}else{ 
		return false; 
	}
}

//-----------------------------------------------------------------------------------------------

function disclamerverify(){
	if(confirm('Do you accept the membership agreements?')) {
		window.location = 'blimedlem.asp?action=steg2';
	}
}

//-----------------------------------------------------------------------------------------------

function Lajv(){
	if (document.lajvmess.mess.value==""){
		alert('You forgot the LIVE mess!');
		return false;
	}
}

//-----------------------------------------------------------------------------------------------

function CheckSize(ThisPic) {  
	if (ThisPic.width > 500) { 
		ThisPic.width = 500; 
	}
} 

//------------------------------------------------------------------------

function changepic1(){ 
      document.frmUpload.MyPic1.src=document.frmUpload.fil.value; 
}

//---------------------------------------------------------------------------------

function xfocus() { 
    document.chat.mess.focus(); 
}

//---------------------------------------------------------------------------------

function Soka(){
	if (document.sok.sokord.value==""){
		alert("You forgot what you want to search for!");
		return false;
	}
}

//-----------------------------------------------------------------------------------------------

function ClearMessageField() {
    document.chat.mess.value = "";
}

//-----------------------------------------------------------------------------------------------

function deleteMail( ) {
	var anyChecked = false;
	for (var i=0;i<frm.elements.length;i++){
		var e = frm.elements[i];
		if (e.checked) anyChecked = true;
	}
	if ( anyChecked == false ) {
		alert( 'No messages are checked!' );		
	} else {
		if ( confirm( 'Are you sure you want to delete all checked messages?' ) ) {
			document.mess.delmail.value = 'true';
			document.mess.submit( );
 		}else{ 
			return false; 
 	 	}
	}
}

//-----------------------------------------------------------------------------------------------

function deleteMailUt( ) {
	var anyChecked = false;
	for (var i=0;i<frm.elements.length;i++){
		var e = frm.elements[i];
		if (e.checked) anyChecked = true;
	}
	if ( anyChecked == false ) {
		alert( 'No messages are checked!' );		
	} else {
		if ( confirm( 'Are you sure you want to delete all checked messages?' ) ) {
			document.mess.delmail.value = 'true';
			document.mess.submit( );
 		}else{ 
			return false; 
 	 	}
	}
}

//-----------------------------------------------------------------------------------------------

function ChatIn(){
	if (document.chatlogin.name.value==""){
		alert("You forgot the chat nickname!");
		return false;
	}
}

//-----------------------------------------------------------------------------------------------

function Hum(){
	if (document.humor.humor.value==""){
		alert("You forgot to choose what temper you have at the moment!");
		return false;
	}
}


//----------------------------------------------------------------------------------------------

function initChat(ch_to_usr_id,ch_from_usr_id) {
        window.open("chat.asp?chat=initiate&ch_to_usr_id=" + ch_to_usr_id, "chat_" + ch_from_usr_id, "width=450 height=300,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizeable=1,compyhistory=0");
}

function notifyChat(ch_id){
        window.open("chat.asp?chat=accept&ch_id=" + ch_id,"chat1_" + ch_id,"width=450 height=300,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizeable=1,compyhistory=0")
}

//-----------------------------------------------------------------------------------------------

function ClearMessageField() {
   document.chat.chatMess.value = "";}

//-----------------------------------------------------------------------------------------------

function ChatMessIn(){
	if (document.chat.mess.value==""){
		alert("You forgot a message!");
		return false;
	}
}

//-----------------------------------------------------------------------------------------------

function checkLength(obj,dispobj,mlength){
	if(obj.value.length>mlength){
		obj.value = obj.value.substr(0,mlength);
		alert('The presentation can maximum be '+mlength+' characters.');
		obj.focus();
	}
	dispobj.value=mlength-obj.value.length;
}

//-----------------------------------------------------------------------------------------------

function Mappar(){
	if (document.mapp.mapp.value==""){
		alert('You forgot to choose a folder name!');
		return false;
	}
}

//-----------------------------------------------------------------------------------------------

function SendTo(name) {
	document.maila.till.value = name;
	document.maila.rubrik.value = 'Hello!';
	document.maila.rubrik.focus();
}

//-----------------------------------------------------------------------------------------------

function Addvan(){
	if (document.van.relId.value==""){
		alert('You forgot to choose relation!');
		return false;
	}
}

//-----------------------------------------------------------------------------------------------

function ny(){
	if (document.nytt.fraga.value==""){
		alert("You forgot to write the question!");
		return false;
	} else if (document.nytt.antal.value==""){
		alert("You forgot to write the amount of answers for the question!");
		return false;
	}
}

//-----------------------------------------------------------------------------------------------

function ClearMessageFieldKlotter() {
    document.klotter1.klotter.value = "";
}

//-----------------------------------------------------------------------------------------------

function CheckSize(ThisPic) {  
	if (ThisPic.width > 500) { 
		ThisPic.width = 500; 
	}
}

//-----------------------------------------------------------------------------------------------

function Bilden(filename,winTitle) 
{
    var myImage = new Image();
    myImage.src=filename;
    properties='height=10,width=10';
    var imgWindow = window.open('','',properties);
    
    html = '<html>';
    html += '<head>';
    html += '<title>'+winTitle+'</title>';
    html += '</head>';
    html += '<body topmargin="0" marginheight="0" leftmargin="0" marginwidth="0">';
    html += '<img src="'+myImage.src+'" onLoad="resizeTo(document.bild.width+9,document.bild.height+57);" name="bild" OnClick="self.close();">';
    html += '</body>';
    html += '</html>';
    
    imgWindow.document.write(html);
}

//-----------------------------------------------------------------------------------------------

function Center(URL,width,height,namn){
	if (parseInt(navigator.appVersion) >= 3){
		if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)<5){
			var tools = new Packages.java.awt.Toolkit.getDefaultToolkit();
			screen=tools.getScreenSize();
		}
		x = screen.width;
		y = screen.height;
	}
	window.open(URL,namn,"top=" + parseInt(y/2-height/2-16) + ",left=" + parseInt(x/2-width/2-5) + ",width=" + width + ",height=" + height + ",scrollbars=1,status=yes");
}

//-----------------------------------------------------------------------------------------------

function CenterPopup(URL,width,height){
	if (parseInt(navigator.appVersion) >= 3){
		if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)<5){
			var tools = new Packages.java.awt.Toolkit.getDefaultToolkit();
			screen=tools.getScreenSize();
		}
		x = screen.width;
		y = screen.height;
	}
	window.open(URL,"dummyXX","top=" + parseInt(y/2-height/2-16) + ",left=" + parseInt(x/2-width/2-5) + ",width=" + width + ",height=" + height + ",scrollbars=1");
}

//-----------------------------------------------------------------------------------------------

function url() {
	var url=prompt("Type in the website URL:","http://");
	var namn=prompt("Write a subject for the website","");
        document.pres.content2.value=document.pres.content2.value+'[url='+url+']'+namn+'[/url]';
}

//-----------------------------------------------------------------------------------------------

function b() {
	var b=prompt("Write the text that will be bold:","");
        document.pres.content2.value=document.pres.content2.value+'[b]'+b+'[/b]';
}
function it() {
	var i=prompt("Write the text that will be italic:","");
        document.pres.content2.value=document.pres.content2.value+'[i]'+i+'[/i]';
}
function u() {
	var u=prompt("Write the text that will be underlined:","");
        document.pres.content2.value=document.pres.content2.value+'[u]'+u+'[/u]';
}

//-----------------------------------------------------------------------------------------------

function farg() {
	var farg=prompt("Write the colour you wish to use. Ex: #000000 or black","");
        document.pres.content2.value=document.pres.content2.value+'[color='+farg+']  [/color]';
}
function font() {
	var font=prompt("Write the font you wish to use. Ex: verdana, tahoma, arial etc.","");
        document.pres.content2.value=document.pres.content2.value+'[font='+font+']   [/font]';
}
function size() {
	var size=prompt("Write the size you wish to use. Ex: 1, 2 etc.","");
        document.pres.content2.value=document.pres.content2.value+'[size='+size+']   [/size]';
}

//-----------------------------------------------------------------------------------------------

function image() {
      var url=prompt("Type the image URL:","http://");
      document.pres.content2.value=document.pres.content2.value+'[img]'+url+'[/img]';
}

//---------------------------------------------------------------------------------

function Read(Id){
     window.opener.parent.frames["main"].document.location.href="mess.asp?messid="+Id+"#read";
     this.close();
};


//---------------------------------------------------------------------------------

function filupp(){
	if (document.frmUpload.upload.value==""){
		alert("You forgot to choose a file!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Tips(){
	if (document.tips.till.value==""){
		alert("You forgot to write your friends email address!");
		return false;
	}
}


//---------------------------------------------------------------------------------

function Read(Id) { 
	window.opener.parent.document.location.href='mess.asp?messid=' + Id + '#read'; 
	window.close(); 
} 

//---------------------------------------------------------------------------------

function UnRead(Id) { 
	window.opener.document.location.href='mess.asp?messid=' + Id; 
	window.close(); 
} 

//---------------------------------------------------------------------------------

function Fil(){
	if (document.frmUpload.fil.value==""){
		alert('You forgot to choose the file you wish to upload!');
		return false;
	}else if (document.frmUpload.info.value==""){
		alert('You forgot to write some info about the file!');
		return false;
	}
}

//---------------------------------------------------------------------------------

function FilAndra(){
	if (document.frmUpload.info.value==""){
		alert('You forgot to write some info about the file!');
		return false;
	}
}

//---------------------------------------------------------------------------------

function Artikel(){
	if (document.add.rubrik.value==""){
		alert('You forgot to write a subject!');
		return false;
	}else if (document.add.kat.value==""){
		alert('You forgot to choose a category!');
		return false;
	}else if (document.add.artikel.value==""){
		alert('You forgot to write the article!');
		return false;
	}
}

//---------------------------------------------------------------------------------

function News(){
	if (document.nyhet.namn.value==""){
		alert("You forgot to write the author!");
		return false;
	} else if (document.nyhet.rubrik.value==""){
		alert("You forgot to write a subject!");
		return false;
	} else if (document.nyhet.nyhet.value==""){
		alert("You forgot to write the news!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Sok(){
	if (document.search.ord.value==""){
		alert('You forgot to type what you want to search for!');
		return false;
	}
}

//---------------------------------------------------------------------------------

function Nybild(){
	if (document.frmUpload.fil.value==""){
		alert("You forgot to choose the file!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function NyForum(){
	if (document.ny.kategori.value==""){
		alert("You forgot to write the name of the Forum!");
		return false;
	} else if (document.ny.topkatID.value==""){
		alert("You forgot to choose under what Forum it should be!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Klottra(){
	if (document.klotter1.klotter.value== ''){
		alert("You forgot to write something!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Mempic(){
	if (document.frmUpload.file.value==""){
		alert('You forgot to choose what image you want to upload!');
		return false;
	}
}

//---------------------------------------------------------------------------------

function AdminIn(){
	if (document.admin.admin1.value==""){
		alert("You forgot to write your admin name!");
		return false;
	} else if (document.admin.admin2.value==""){
		alert("You forgot your admin password!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Upload(sida){
window.open(sida,"popup","scrollbars=1,resizable=0,width=245,height=150"); }

//---------------------------------------------------------------------------------

function numbersonly() {
if (event.keyCode < 48 || event.keyCode > 57) return false;
}

//---------------------------------------------------------------------------------

var ie = true;

function CA( )
{
	for ( var i=0; i < frm.elements.length; i++ )
	{
		var e = frm.elements[i];
		if ( ( e.name != 'allbox' ) && ( e.type=='checkbox' ) && ( e.disabled == false ) )
		{
			e.checked = frm.allbox.checked;
			if ( frm.allbox.checked ) hL(e);
			else dL(e);
		}
	}
}

//---------------------------------------------------------------------------------
// Select row...
//---------------------------------------------------------------------------------
function hL(E)
{
	while (E.tagName!="TR")	{
		E = E.parentNode;
		E.style.backgroundColor = '#BABFCA';
	}
	E.className = "H";
}

//---------------------------------------------------------------------------------
// Deselect row...
//---------------------------------------------------------------------------------
function dL(E)
{
	var anyChecked = false;
	for (var i=0;i<frm.elements.length;i++)
	{
		var e = frm.elements[i];
		if (e.checked) anyChecked = true;
	}

	// If no row is selected, disable buttons...
	if ( anyChecked == false ) {

	}

	while (E.tagName!="TR")
	{
		E = E.parentElement;
		E.style.backgroundColor = '';
	}

	E.className = "";
}

//---------------------------------------------------------------------------------

function CheckAll() {
	for (var i=0;i<document.mess.elements.length;i++) {
		var e = document.mess.elements[i];
		if ((e.name != 'allbox') && (e.type=='checkbox')) {
			e.checked = document.mess.allbox.checked;
		}
	}
}

//---------------------------------------------------------------------------------

function CheckCheckAll() {
	var TotalBoxes = 0;
	var TotalOn = 0;
	for (var i=0;i<document.mess.elements.length;i++) {
		var e = document.mess.elements[i];
		if ((e.name != 'allbox') && (e.type=='checkbox')) {
			TotalBoxes++;
			if (e.checked) {
				TotalOn++;
			}
		}
	}
	if (TotalBoxes==TotalOn) {
		document.mess.allbox.checked=true;
	} else {
		document.mess.allbox.checked=false;
	}
}

//---------------------------------------------------------------------------------

function CCA( CB )
{
	if (CB.checked) hL(CB);
	else dL(CB);
	
	var TB=TO=0;
	
	for (var i=0;i<frm.elements.length;i++)
	{
		var e = frm.elements[i];
		if ( ( e.name != 'allbox' ) )
		{
			TB++;
			if (e.checked) TO++;
		}
	}
}

//---------------------------------------------------------------------------------

function Registrera(){
	var tecken   = /[å\ä\ö\!\"\#\¤\%\&\/\(\)\=\?\´\`\+\}\{\$\£\,\;\:\'\*\¨\^\~\s]/gi;
	var kolla    = document.userinfo.email.value.search(tecken);
	var ar       = document.userinfo.ar.options[document.userinfo.ar.selectedIndex].value;
	var man      = document.userinfo.man.options[document.userinfo.man.selectedIndex].value;
	var dag      = document.userinfo.dag.options[document.userinfo.dag.selectedIndex].value;

	if(kolla != -1){
		alert("Either you forgot to write your email address or it is not valid!");
		return false;
	} else if (document.userinfo.email.value.indexOf ('@',0) == -1 || document.userinfo.email.value.indexOf ('.',0) == -1){
		alert('Either you forgot to write your email address or it is not valid!');
		return false;
	} else if (document.userinfo.anvnamn.value.search(/^[^0-9]{1}[0-9A-Za-z_-]+$/) == -1) {
		alert('A valid username can only contain a-z, A-Z, 0-9, - and _.\nThe username can not start with a number.');
		return false;
	} else if ((document.userinfo.anvnamn.value.length < 3) || (document.userinfo.anvnamn.value.length > 16)){
		alert('Your username can only be 3 - 15 characters!');
		return false;
	} else if (document.userinfo.pass.value.length < 4) {
		alert("Your password must be more that 3 characters!");
		return false;
	} else if (document.userinfo.pass.value != document.userinfo.pass2.value){
		alert("The passwords did not match, try agin!");
		return false;
//	} else if (document.userinfo.mobilenumber.value==""){
//		alert("You forgot to type your phone number!");
//		return false;
//	} else if (document.userinfo.mobilenumber.value.length < 10) {
//		alert("The mobile phone number is too short!");
//		return false;
//	} else if (document.userinfo.mobilenumber.value.length > 10) {
//		alert("The mobile phone number must be 10 figures long!");
//		return false;
	} else if (document.userinfo.kon.value==""){
		alert("You forgot to choose gender!");
		return false;
	} else if (document.userinfo.ar.value==""){
		alert("You forgot to choose year!");
		return false;
	} else if(new Date(ar,man-1,dag).getDate() != dag){
		document.userinfo.dag.options[0].selected=true;
		return false;
	} else if (document.userinfo.dag.value==""){
		alert("You forgot to choose day!");
		return false;
	} else if (document.userinfo.man.value==""){
		alert("You forgot to choose month!");
		return false;
        } else if (document.userinfo.sponsor.value=="") {
                if (confirm("Have you been told by someone to join Lebaneze.com?\nThen fill in your friends username at Lebaneze.com!\nDo you want to continue without filling in that info?")) { 
                        document.userinfo.submit(); 
                } 
                return false; 
	}
}

//---------------------------------------------------------------------------------

function ControlActivationForm(){
	if (document.activationform.anvnamn.value=="") {
		alert('You must type a username!');
		return false;
	} else if (document.activationform.activecode.value=="") {
		alert("You must type the activation code!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function validatePnr(){ 
	form.pnr.value = form.ar.value.substring(2,form.ar.value.length) + "" + form.man.value + "" + form.dag.value + "" + form.sista.value;
	var strPnr = form.pnr.value;
	var bool1 = null;
	var bool2 = null;
	var konet = null;

	// kontrollerar att rutan ej är tom 
	if (form.pnr.value == ""){ 
		alert("You have not typed a valid birthdate!");
		return false; 
	} 

	// kontrollerar att 10 heltal matats in 
	// detta skall ingå, dvs uttrycket skall bli true 
	bool1 = strPnr.match(/^\d{10}$/); 
	if (bool1 == null){ 
		alert("You have not typed a valid birthdate!"); 
		return false; 
	} 

	// kontrollerrar att de 6 första siffrorna har korrekta datum-värden 
	// detta skall ingå, dvs uttrycket skall bli true 
	bool2 = strPnr.match(/^\d{2,2}[01]{1,1}\d{1,1}[0123]{1,1}\d{1,1}\d{4,4}$/); 
	if (bool2 == null){ 
		alert("You typed the wrong date!"); 
		return false; 
	} else { 
		var siffra=0;
		var ental=0;
		var kNummer=0;
		var summa=0;
		var testSumma=0;
		var i=0;
		var tiotal=0;

		for(i=0; i<9; i++){ 
		siffra=parseInt(strPnr.charAt(i)); 
		if (i%2 == 0){ 
			siffra = siffra * 2; 
		} else { 
			siffra = siffra * 1; 
		} 

		if (siffra < 10) { 
			summa = summa + siffra; 
		} else { 
			ental = siffra - 10; 
			summa = summa + 1 + ental; 
		}
 
		if(i==8) {
			if(siffra%2==0){konet=2;}else{konet=1;}
		}
	}

	testSumma=summa; 
	while(testSumma > 9) { 
		testSumma = testSumma - 10; 
		tiotal++; 
	} 
	tiotal=tiotal+1;
	tiotal = tiotal * 10;
	kNummer = tiotal - summa;

	if (kNummer % 10 == 0) 
		kNummer=0; 

		if (kNummer == parseInt(strPnr.charAt(9)) && form.kon.value==konet) { 
			//numret är giltigt 
			return true;
		} else { 
			alert("You have not typed a valid birthdate!");
			return false;
		} 
	}
}

//---------------------------------------------------------------------------------

function kolla2(){
	if (document.losen.losenord.value.length < 4) {
		alert("Your password must be more that 3 characters long!");
		return false;
	} else if (document.losen.losenord.value != document.losen.losen.value){
		alert("The passwords did not match, try again!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Tipsa(){
	var tecken   = /[å\ä\ö\!\"\#\¤\%\&\/\(\)\=\?\´\`\+\}\{\$\£\,\;\:\'\*\¨\^\~\s]/gi;
	var kolla    = document.tips.email.value.search(tecken);

	if(kolla != -1){
		alert("Either you forgot to write your email address or it is not valid!");
		return false;
	} else if (document.tips.namn.value==""){
		alert("You forgot to type your friends name!");
		return false;
	} else if (document.tips.email.value.indexOf ('@',0) == -1 || document.tips.email.value.indexOf ('.',0) == -1){
		alert('Either you forgot to write your email address or it is not valid!');
		return false;
	}
}

//---------------------------------------------------------------------------------

function Andra(){
	var tecken   = /[å\ä\ö\!\"\#\¤\%\&\/\(\)\=\?\´\`\+\}\{\$\£\,\;\:\'\*\¨\^\~\s]/gi;
	var kolla    = document.userinfo.email.value.search(tecken);
	var ar       = document.userinfo.ar.options[document.userinfo.ar.selectedIndex].value;
	var man    = document.userinfo.man.options[document.userinfo.man.selectedIndex].value;
	var dag      = document.userinfo.dag.options[document.userinfo.dag.selectedIndex].value;

	if(kolla != -1){
		alert("Either you forgot to write your email address or it is not valid!");
		return false;
	} else if (document.userinfo.email.value.indexOf ('@',0) == -1 || document.userinfo.email.value.indexOf ('.',0) == -1){
		alert('Either you forgot to write your email address or it is not valid!');
		return false;
	} else if (document.userinfo.kon.value==""){
		alert("You forgot to choose gender!");
		return false;
	} else if(new Date(ar,man-1,dag).getDate() != dag){
		document.userinfo.dag.options[0].selected=true;
		return false;
	} else if (document.userinfo.man.value==""){
		alert("You forgot to choose month!");
		return false;
	} else if (document.userinfo.dag.value==""){
		alert("You forgot to choose day!");
		return false;
	} else if (document.userinfo.ar.value==""){
		alert("You forgot to choose year!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Forum(){
	if (document.add.rubrik.value==""){
		alert("You forgot to write a subject!");
		return false;
	} else if (document.add.inlagg.value==""){
		alert("You forgot to write the Forum post!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function MessageSend(){
	if (document.mess.subject.value==""){
		alert("You forgot to write a subject!");
		return false;
	} else if (document.mess.message.value==""){
		alert("You forgot to write the message!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Message(){
	if (document.maila.till.value==""){
		alert("You forgot to write who you want to send it to!");
		return false;
	} else if (document.maila.rubrik.value==""){
		alert("You forgot to write a subject!");
		return false;
	} else if (document.maila.mess.value==""){
		alert("You forgot to write the message!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Dagbok(){
	if (document.db.rubrik.value==""){
		alert("You forgot to write a subject!");
		return false;
	} else if (document.db.info.value==""){
		alert("You forgot to write the diary!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Recept(){
	if (document.rec.rubrik.value==""){
		alert("You forgot to write a subject for the recipe!");
		return false;
	} else if (document.rec.katID.value==""){
		alert("You forgot to choose a category!");
		return false;
	} else if (document.rec.recept.value==""){
		alert("You forgot the ingredients!");
		return false;
	} else if (document.rec.instruktioner.value==""){
		alert("You forgot to write the instructions!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function LoggaIn(){
	if (document.login.anvnamn.value==""){
		alert("You forgot to type your username!");
		return false;
	} else if (document.login.pass.value==""){
		alert("You forgot to type your password!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Gastbok(){
	if (document.gb.inlagg.value==""){
		alert("You forgot to write a post!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Popup(url,width,height){
	stuff = "toolbar=no,menubar=no,scrollbars=no,resizable=no,width= " +width + ", height = " +height
	window.open(url, "POPUP" , stuff );
}

//---------------------------------------------------------------------------------

function Glomt(){
	if (document.forgot.email.value==""){
		alert("You forgot to type your email address!");
		return false;
	}
}

//---------------------------------------------------------------------------------

function Quit(){
	if (document.del.pass.value==""){
		alert("You forgot to type your password!");
		return false;
	}
}

//---------------------------------------------------------------------------------

//-->
