
	
	function RegCheck(element) {
		switch(element.id) {
			
			case "epost":
				if (/^[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}$/.test($("input#epost").val())){
					$("#lblEpost").html("<img src='/gfx/icons/y.png' alt='' />");
				} else {
					$("#lblEpost").html("<img src='/gfx/icons/n.png' alt='' />");
				}
			break;
			
			case "epost2":
				var epost = $("input#epost2").val();
				var epost2 = $("input#epost").val();
				if (epost.toLowerCase() == epost2.toLowerCase()){
					$("#lblEpost2").html("<img src='/gfx/icons/y.png' alt='' />");
				} else {
					$("#lblEpost2").html("<img src='/gfx/icons/n.png' alt='' />");
				}
			break;
			
			case "password":
				if (/^[\w\W]{6,}$/.test($("input#password").val())){
					$("#lblPassword").html("<img src='/gfx/icons/y.png' alt='' />");
				} else {
					$("#lblPassword").html("<img src='/gfx/icons/n.png' alt='' />");
				}
			break;
			
			case "password2":
				if ($("input#password2").val() == $("input#password").val()){
					$("#lblPassword2").html("<img src='/gfx/icons/y.png' alt='' />");
				} else {
					$("#lblPassword2").html("<img src='/gfx/icons/n.png' alt='' />");
				}
			break;
			
			case "namn":
				if(element.value.length>=2){ 
					$("#lblNamn").html("<img src='/gfx/icons/y.png' alt='' />");
				} else {
					$("#lblNamn").html("<img src='/gfx/icons/n.png' alt='' />");
				}
			break;
			
			case "efternamn":
				if(element.value.length>=2){ 
					$("#lblEfternamn").html("<img src='/gfx/icons/y.png' alt='' />");
				} else {
					$("#lblEfternamn").html("<img src='/gfx/icons/n.png' alt='' />");
				}
			break;
				
		}
	}
	
function Join(form){
 jQuery.ajax({
  type: "POST",
  url: "/ajax.php?action=join",
  dataType: "html",
  data: $("form#joinForm").serialize(),
  success: function(response){
   eval(response)
  },
  error: function(){
   alert("Ett oväntat fel uppstod!");
  }
 });
}

function Login(form){
 $("#loginStatus").show();
 $("#loginStatus").html("<img src='/gfx/icons/loader.gif' alt='' align='left' />&nbsp;Loggar in..");
 jQuery.ajax({
  type: "POST",
  url: "/ajax.php?action=login",
  dataType: "html",
  data: $("form#loginForm").serialize(),
  success: function(response){
   eval(response)
  },
  error: function(){
   $("#loginStatus").html("Ett fel uppstod..");
  }
 });
}

function CheckDomains(form){
 jQuery.ajax({
  type: "POST",
  url: "/ajax.php?action=checkDomains",
  dataType: "html",
  data: $("form#domainForm").serialize(),
  success: function(response){
   eval(response)
  },
  error: function(){
   $("#domainStatus").html("Ett fel uppstod..");
  }
 });
}

 function addDomain(domain){
 jQuery.ajax({
  url: "/ajax.php?action=addDomain&domain=" + domain,
  success: function(response){
   eval(response)
  },
  error: function(){
   $("#domainStatus").html("Ett fel uppstod..");
  }
 });
 }
 
 
function changePw(form){
 jQuery.ajax({
  type: "POST",
  url: "/ajax.php?action=changepw",
  dataType: "html",
  data: $("form#cpwForm").serialize(),
  success: function(response){
   eval(response)
  },
  error: function(){
   alert("Ett fel uppstod..");
  }
 });
}

	function setInnerHtml(objID, txt){
		$("#" + objID + "").html("" +  txt + "");
	}

	function signout(){
		if(confirm('Är du säker på att du vill logga ut?')){
			location.href = '/signout';
		}
	}

	function removeDimmer(){
		 $("#dimmerBg").fadeOut("slow");
		 $("#dimmerTop").fadeOut("slow");
		 $("#dimmerDialog").fadeOut("slow");
	}
	 
	 function deleteDomain(domainID, tID, domainName, page, ext){
	 	var txt = "Är du säker på att du vill radera " + domainName + " från din domänlista? All data kommer att raderas!";
	 	if(confirm(txt)){
			
			$.get("/ajax.php?action=deleteDomain&domain=" + domainID + "&tID=" + tID, function(response){
				eval(response);
				domainList(page, ext);
			});
			
	 	}
	 }
	 
	 function updateDomain(id){
	 	$("#reload_" + id ).attr("src","/gfx/loadDomainInfo.gif");
	 	$.get("/ajax.php?action=updateDomain&id=" + id,
	 		function(response){
	 			eval(response);
	 		});
	 }
	 
	function Contact(form){
		jQuery.ajax({
			type: "POST",
			url: "/ajax.php?action=contact",
			dataType: "html",
			data: $("form").serialize(),
			success: function(response){
				eval(response);
			},
			error: function(){
				alert("Ett oväntat fel uppstod!");
			}
		});
	 }
	 
	function forgotPassword(form){
		jQuery.ajax({
			type: "POST",
			url: "/ajax.php?action=forgotPassword",
			dataType: "html",
			data: $("form").serialize(),
			success: function(response){
				eval(response);
			},
			error: function(){
				alert("Ett oväntat fel uppstod!");
			}
		});
	 }
	 
	 function pulsatingColors(objID, fromBgColor, toBgColor, fromTxtColor, toTxtColor, repeat){
	  $(document).ready(function(){
	  
	  	//for(i=0; i < repeat; i++){
	  	
    	  $("#" + objID).animate({ 
    	    backgroundColor: "#" + fromBgColor,
    	    color: "#" + fromTxtColor
    	  }, 1000 );
    	  
			
		  $("#" + objID).animate({ 
    	    backgroundColor: "#" + toBgColor,
    	    color: "#" + toTxtColor
    	  }, 1000 );
	  	
    	  $("#" + objID).animate({ 
    	    backgroundColor: "#" + fromBgColor,
    	    color: "#" + fromTxtColor
    	  }, 1000 );
    	  
			
		  $("#" + objID).animate({ 
    	    backgroundColor: "#" + toBgColor,
    	    color: "#" + toTxtColor
    	  }, 1000 );
	  	
    	  $("#" + objID).animate({ 
    	    backgroundColor: "#" + fromBgColor,
    	    color: "#" + fromTxtColor
    	  }, 1000 );
    	  
			
		  $("#" + objID).animate({ 
    	    backgroundColor: "#" + toBgColor,
    	    color: "#" + toTxtColor
    	  }, 1000 );
    	  
    	//}
			
	  });
	 }
	 
	 function domainList(page, ext){
	 	$("#domainList").load("/ajax.php?action=domainList&page=" + page + ext);
	 }
	 
	 function showAddDomain(){
	 	 $("#addDomins").load("/ajax.php?action=showAddDomains");		
	 }
	 
	 function showNotes(id){
	 	$("#notes").load("/ajax.php?action=showNotes&id=" + id);
	 }
	 
	 function showAgreement(){
	 	 $("#Agreement").load("/ajax.php?action=showAgreement");		
	 }
	 
	 function verifyGAaccount(domainID) {
		 $("#verifydomainholder"+domainID).load('/domain.php?action=verifydomain&gaid=' + $("#GAID").val() + '&id=' + domainID);
	 }
	 
	 
	 function search(val){
	 			
	 		domainList(1, '&search=' + val);
	 		$("#result").html('<strong>Sökning:</strong>&nbsp;' + val);
	 		
	 		if(val.length<1){
	 			$("#result").html('');
	 		}
	 			

	 }