function PreventViewSource()
{

//if (self == top) alert("nixen");
//location.href = "http://bamsehytten.adsl.dk";
//if (parent.frames.length <= 0) alert("du må ikke se koden");
alert("hejsa");
 




}
function ValidatePollForm(theForm)
{
  for (var counter = 0; counter < theForm.elements.length;counter++)
  {	
    if (theForm.elements[counter].name == "PollAnswer") 	
            if (RadioChecked(theForm.PollAnswer) == false)
              return showalertmes(counter,theForm,"Du skal vælge 1 felt !");
  }
}              



function ValidateForm(theForm)
{ 
 	
	for (var counter = 0; counter < theForm.elements.length;counter++)
  	 {	
		  if (theForm.elements[counter].value == "" &&
		  theForm.elements[counter].name != "feltet" &&
		  theForm.elements[counter].type != "hidden" ) 
		  return showalert(counter,theForm);
		  if (theForm.elements[counter].name == "Password") 
		  	if (theForm.elements[counter].value != theForm.elements[counter+1].value)
		      		return showpasswordalert(counter,theForm);
		  if (theForm.elements[counter].name == "Email") 	
		  {
			if (theForm.elements[counter].value.indexOf('@') < 0)
				return showmailalert(counter,theForm,1);
			if (theForm.elements[counter].value.indexOf('.') < 0)
				return showmailalert(counter,theForm,2);
		  }	
          //if (theForm.elements[counter].type == "radio")
          if (theForm.elements[counter].name == "q1") 	
            if (RadioChecked(theForm.q1) == false)
              return showalertmes(counter,theForm,"Du mangler at udfylde et eller flere felter");
		  if (theForm.elements[counter].name == "q2") 	
            if (RadioChecked(theForm.q2) == false)
              return showalertmes(counter,theForm,"Du mangler at udfylde et eller flere felter");
			if (theForm.elements[counter].name == "q3") 	
            if (RadioChecked(theForm.q3) == false)
              return showalertmes(counter,theForm,"Du mangler at udfylde et eller flere felter");
	      if (theForm.elements[counter].name == "Rulesok") 	
            if (theForm.elements[counter].checked == false)
              return showalertmes(counter,theForm,"Hov !! har du læst reglerne ?");
            
           
		
	}

 return true;  
}
function RadioChecked(radioset) {
  //alert(radioset.length);
  for (i=0; i<radioset.length; i++) {
    
    if (radioset[i].checked) {
      return true;
    }
  }
  return false;
}


function showalert(counter,theForm)
{
    	 	    alert("Feltet skal udfyldes !");
  	 	    theForm.elements[counter].focus();
  	 	    scrollBy(0,-30);
		  	 	    return false;	
	

}

function showalertmes(counter,theForm,Message)
{
    	 	    alert(Message);
    	 	    theForm.elements[counter].focus();
  	 	    scrollBy(0,-30);
  	 	        return false;	
	

}


function showpasswordalert(counter,theForm)
{
    	 	    alert("Password-felterne skal have samme værdi !");
  	 	    theForm.elements[counter].focus();
  	 	    scrollBy(0,-30);
		    return false;	
	

}
function showmailalert(counter,theForm,index)
{
    	 	if (index==1)
    	 		alert("Du mangler et @ i mailadressen f.eks navn@firmanavn.dk !");
    	 	if (index==2)
    	 		alert("Du mangler et . (punktum) i mailadressen f.eks navn@firmanavn.dk !");	
  	 	    theForm.elements[counter].focus();
  	 	    scrollBy(0,-30);
		    return false;	
	

}
