

var imageexists;
var tf_focused = 'false';
var curcss;

function csschange(newcss){
  newcss=newcss-1;
  if(document.styleSheets){
    var csscount = document.styleSheets.length;

    for(var i=0; i<csscount; i++){
      if(i != newcss){
        document.styleSheets[i].disabled=true;
      }else{
        document.styleSheets[i].disabled=false;
      }
    }
  }
}

function res_csschange(){
	if(screen.width >= 1024){
		csschange(3);
	}
	if(screen.width <= 800){
		csschange(2);
	}
}

function changer(dir, postval){
	var fullurl = dir;
	fullurl += document.getElementById(postval).options[document.getElementById(postval).selectedIndex].value;
	
	try{
		document.getElementById("imageholder").src = fullurl;
	}
	finally{
		document.getElementById("imageholder").style.display = 'inline';
		document.getElementById("imageholder").style.width = '150px';
		document.getElementById("imageholder").style.borderWidth = '1px';
	}

}

//this function is used to go to a certain url
function url(location, how){
	if(how == "default" || typeof(how) == "undefined"){
		top.location.href = location;
	}
	if(how == "window"){
		window.open(location);
	}
}


function changepassconfirm(returnurl){
	box = confirm('Als u doorgaat zal een nieuw wachtwoord aangemaakt worden. Deze zal gemaild worden naar het bovenstaande e-mail adres. Weet u zeker dat u dit wilt doen?');
	
	if(box == true){
		url(returnurl);
	}
}

function changepassreturn(returnurl){
	box = confirm('Uw wachtwoord is gewijzigd.');
	
	if(box == true || box == false){
		url(returnurl);
	}
}

function deletemenuitemconfirm(message, returnurl){
	box = confirm(message);
	
	if(box == true){
		url(returnurl);
	}
}

function deletecatconfirm(message, returnurl){
	box = confirm(message);
	
	if(box == true){
		url(returnurl);
	}
}

function deleteconfirm(message, returnurl){
	box = confirm(message);
	
	if(box == true){
		url(returnurl);
	}else{
		return false;
	}
}

function changestatussubmit(message, submitwhat){
	box = confirm(message);

	if(box == true){
		submitwhat.submit();
	}else{
		return false;
	}
}

function is_numeric(value){
	var allowed = "0123456789";
	var isnum=true;
	var charc;

	for (i = 0; i < value.length && isnum == true; i++){ 
		charc = value.charAt(i); 
		if (allowed.indexOf(charc) == -1){
			isnum = false;
		}
	}
	
return isnum;

}




function tocart(tf, form){
	if(is_numeric(tf)){
		if(tf <= 0 || tf > 999){
			alert('The quantity must be between 1-999.');
		}else{
			form.submit();
		}
	}else{
		alert('The quantity field can only contain numbers.');
		return false;
	}
}



function updatematch(formname){
	var boxone = document.eval(formname).team1.options[document.eval(formname).team1.selectedIndex].value;
	var boxtwo = document.eval(formname).team2.options[document.eval(formname).team2.selectedIndex].value;
	
	if( boxone == boxtwo ){
		alert('Fout\nEen team kan geen wedstrijd tegen zichzelf spelen.');
		return false;
	}else{
		document.eval(formname).submit();
	}
}



