<!--

//-----------------------------------------------------------------------------------------------------------------------------------
	function checkEmail(txMail)
{
	var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
	var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";

	var reg1 = new RegExp(reg1str)
	var reg2 = new RegExp(reg2str)

	return ((!reg1.test(txMail)) && (reg2.test(txMail)))
	
	}
	
	
function valiReg1(){
     if (document.editaccount.txAnv.value==""){
        alert("Username can not be empty.");
     return false;
    }
}  
	
	function valiReg(){
     if (!checkEmail(document.reg.txMail.value)){
        alert("You must write a correct e-mail adress");
    return false;
   }
    }
	
//-----------------------------------------------------------------------------------------------------------------------------------



//-----------------------------------------------------------------------------------------------------------------------------------

//-----------------------------------------------------------------------------------------------------------------------------------

function externalLinks() { 
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "out") 
			anchor.target = "_blank"; 
		}
}
window.onload = externalLinks;

//-----------------------------------------------------------------------------------------------------------------------------------

function viewThis(PATH,WHAT,VALUE,SCROLL){
	var width = 600; var height = 580;
	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(PATH +"view_"+ WHAT +".asp?id="+ VALUE,"updatesystem"+ WHAT,"top=" + parseInt(y/2-height/2-16) + ",left=" + parseInt(x/2-width/2-5) + ",scrollbars="+ SCROLL +",width=" + width + ",height=" + height).focus();
}

//-----------------------------------------------------------------------------------------------------------------------------------

function validate(){
	if (document.f.txName.value=="") {
		alert("You must write your name...");
		document.f.txName.focus();
		return false;

	} else if (document.f.txMail.value.indexOf("@") == -1) {
		alert("You must fill in a correct e-mail adress...");
		document.f.txMail.focus();
		return false;

	} else if (document.f.txMsg.value=="") {
		alert("You can not save a emty message");
		document.f.txMsg.focus();
		return false;

	}
}

//-----------------------------------------------------------------------------------------------------------------------------------

function en(frm,price,size) {
	if(price>0){
		document[frm].txPrice.value=price;
		document[frm].txFinalSize.value=size;
	}
} 

//-----------------------------------------------------------------------------------------------------------------------------------

function valBuy(name, size, color) {

	intAntal = eval(document[name].txAnt.value);

	if ((size>0) && (document[name].txSize.value.length==0)) {
		alert("You must choose which Option you would like to order.");
		return;

	} else if ((color>0) && (document[name].txColor.value.length==0)) {
		alert("You must choose which Transmission you would like to order");
		return; 

	} else if (intAntal<1) {
		alert("You must choose how many items you would like to order.");
		return; 

	} else {
		document[name].submit();
	}

}

//-----------------------------------------------------------------------------------------------------------------------------------

function kollaforum() {

    topic = document.forum.txTopic.value.length;
    user = document.forum.txUser.value.length;
    post = document.forum.txPost.value.length;

	if (topic < 2) {
	    alert("You have not choosen a topic for your message.");
        document.forum.txTopic.focus(); 
	    return false; 
    }
    if (user < 3) {
        alert("Please enter your name."); 
        document.forum.txUser.focus(); 
        return false; 
    }
	if (post < 5) {
	    alert("You can not save an emty message."); 
        document.forum.txPost.focus(); 
	    return false; 
    }
}

//-----------------------------------------------------------------------------------------------------------------------------------

function smiley(){
	var width = 94; var height = 328;
	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("smileys.asp","smile","top=" + parseInt(y/2-height/2-16) + ",left=" + parseInt(x/2-width/2-5) + ",scrollbars=no,width=" + width + ",height=" + height).focus();
}

//-----------------------------------------------------------------------------------------------------------------------------------


function sendOrder() {

	var sendnamn = document.shop.txFnamn.value.length;
	var sendenamn = document.shop.txEnamn.value.length;
	var sendadress = document.shop.txAdress.value.length;
	var sendpost = document.shop.txPost.value.length;
	var sendort = document.shop.txOrt.value.length;
	var sendtele = document.shop.txTele.value.length;
	var sendmail = document.shop.txMail.value.length;

	if (sendnamn < 2) {
	    alert("Please enter your name.");
		document.shop.txFnamn.focus();
	    return false; 
    } 

	if (sendenamn < 2) {
	    alert("Please enter your last name.");
		document.shop.txEnamn.focus();
	    return false; 
    } 
	
		
	if (sendadress < 2) {
	    alert("Please enter your adress.");
		document.shop.txAdress.focus();
	    return false; 
    } 
	
	if ((sendpost < 2) && (sendort < 2)) {
	    alert("Please enter your postal code and city.");
		document.shop.txPost.focus();
	    return false; 
    } 
	
	if (sendpost < 2) {
	    alert("Please enter your postal code.");
		document.shop.txPost.focus();
	    return false; 
    } 
	
	if (sendort < 2) {
	    alert("Please enter your city.");
		document.shop.txOrt.focus();
	    return false; 
    } 
	
	if (sendtele < 2) {
	    alert("Please enter your phonenumber.");
		document.shop.txTele.focus();
	    return false; 
    } 
	
	if (sendmail < 2 && !confirm("You have not written yur e-mail adress, this means that we can not send you a confirmation for your order. Would you like to send the order anyway ?")) {
		document.shop.txMail.focus();
		return false;
	} else if (document.shop.txMail.value.indexOf("@") == -1){
		alert('Please enter your e-mail adress.');
		document.shop.txMail.focus();
		return false;
	}

}

function checkPrime(foo){
	var count,str
	for(count=0; count<document.forms[foo].elements.length; count++) {
		if (document.forms[foo].elements[count].name.substring(0,3) == 'ftx') {
			if (document.forms[foo].elements[count].value == "") {
				document.forms[foo].elements[count].style.background = "red";
				alert("Por favor, preencha corretamente os campos * (obrigatórios).");
				document.forms[foo].elements[count].style.background = "white";
				document.forms[foo].elements[count].focus();
				return false;
			}
		}
		if (document.forms[foo].elements[count].name.substring(0,3) == 'otx') {
			if (document.forms[foo].elements[count].value == "") {
				document.forms[foo].elements[count].style.background = "red";
				var choice=confirm("Du har inte fyllt i detta fält. \n\nVill du utelämna fältet, välj OK.\nVill du skriva ett värde, välj Avbryt.")
				document.forms[foo].elements[count].style.background = "white";
				if(choice == false) {
					document.forms[foo].elements[count].focus();
					return false;
				}
				else {
					document.forms[foo].elements[count].value = "-";
				}
			}
		}
		if (document.forms[foo].elements[count].name.substring(0,4) == 'fetx') {
			if (!checkEmail(document.forms[foo].elements[count].value)) {
				document.forms[foo].elements[count].style.background = "red";
    			alert("Por favor, preencha corretamente os campos * (obrigatórios).");
				document.forms[foo].elements[count].style.background = "white";
				document.forms[foo].elements[count].focus();
			    return false;
			}
		}
		if (document.forms[foo].elements[count].name.substring(0,4) == 'oetx') {
			if (document.forms[foo].elements[count].value == "") {
				document.forms[foo].elements[count].style.background = "red";
				var choice=confirm("Du har inte fyllt i detta fält. \n\nVill du utelämna fältet, välj OK.\nVill du skriva ett värde, välj Avbryt.")
				document.forms[foo].elements[count].style.background = "white";
				if(choice == false) {
					document.forms[foo].elements[count].focus();
					return false;
				}
				else {
					document.forms[foo].elements[count].value = "-";
				}
			}
			else {
				if (!checkEmail(document.forms[foo].elements[count].value) && document.forms[foo].elements[count].value != "-") {
				document.forms[foo].elements[count].style.background = "red";
    			alert("Por favor, preencha corretamente os campos * (obrigatórios).");
				document.forms[foo].elements[count].style.background = "white";
				document.forms[foo].elements[count].focus();
			    return false;
				}
			}
		}
	}
	for(count=0; count<document.forms[foo].elements.length; count++) {
		str = document.forms[foo].elements[count].value;
		str = replaceEt(str)
		str = replacePrime(str)
		document.forms[foo].elements[count].value = str;
		if (document.forms[foo].elements[count].value == "-") document.forms[foo].elements[count].value = "";
	}
}

function replacePrime(entry) {
var out,add,temp,pos
	out = '"';
	add = '&#34;';
	temp = "" + entry;
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}
	return temp;
}

function replaceEt(entry) {
var out,add,temp,pos
	out = "&";
	add = "[AND]";
	temp = "" + entry;
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}
	
	out = "[AND]";
	add = "&#38;";
	temp = "" + entry;
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}
	return temp;
}

//-----------------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------------
//-->