function Del(Word) {
	
a = Word.indexOf("<");
b = Word.indexOf(">");
len = Word.length;
c = Word.substring(0, a);
if(b == -1)
b = a;
d = Word.substring((b + 1), len);
Word = c + d;
tagCheck = Word.indexOf("<");
if(tagCheck != -1)
Word = Del(Word);
return Word;
} 
function validate(){
		ToCheck = document.annonse.tittel.value;
		Checked = Del(ToCheck);
		document.annonse.tittel.value = Checked;
		
		ToCheck = document.annonse.tekst.value;
		Checked = Del(ToCheck);
		document.annonse.tekst.value = Checked;
		
		ToCheck = document.annonse.email.value;
		Checked = Del(ToCheck);
		document.annonse.email.value = Checked;

		ToCheck = document.annonse.tlf.value;
		Checked = Del(ToCheck);
		document.annonse.tlf.value = Checked;
	 
	 var flagg = 0;	
 	 document.annonse.email.value = document.annonse.preemail.value;
	 document.annonse.tlf.value = document.annonse.pretlf.value;

	 if(document.annonse.tittel.value==""){
		 alert("Du må ha en tittel på annonsen din");
		 flagg=1;

	 }
 

	 	
	 	
	 else if(document.annonse.preemail.value=="" && document.annonse.preemail.value==""){
		 if(confirm("Er det i orden at kontaktpersoner ikke oppgis i feltene for dette?")){
				flagg=0;
		 }
		  else
			  flagg=1;
	 }
	else{
		flagg=0;
	}
	 	
	 if (flagg==0) {
	 		//alert("Det er ingen feil");
		//alert(document.annonse.kategorier.value);
			document.annonse.submit();
	 }
	

}
 
function bekreftslett(id){
				annid = id; 				
				if(confirm("Er du sikker på at du vil slette annonsen?")){
					window.location.assign("/cgi-bin/dynracing/annonseform.cgi?annonseid=" + annid + "&state=slett");
				}
 }
 

//hører til annonser.cgi
function getart(tick){
	var variabl;
	variabl = tick;
 kategoriform.art.value= variabl;
 document.kategoriform.submit();
}

 function skaler(bilde){
	
	 if (bilde.height > 80){
			bilde.height = 80;
	 }
	 
	 else{
		 if (bilde.width > 100){
			bilde.width = 100;
		 }
	 }
	 
}
