function CVN(id,state)
{
	switch(id){
		case 'd':
		time = state;
		break;
		case 's':
		if (state=='rec'){rec=1}else{rec=0} 
		stakes = state;
		break;
		case 'p':
		if (state=='rec'){recpri=1}else{recpri=0}
		price = state;
		break;
		case 'm':
		amount = state;
		break;
	}
	RedoCssClasses();
	if (typeof(document.images['tipstergraph']) != "undefined"){
		document.images.tipstergraph.src='graph.php'+'?id='+tipid+'&rec='+rec+'&recpri='+recpri+'&amount='+amount+'&time='+time;
	} else {
		if (rec==1){
			stakes = "rec";
		} else {
			stakes = "lev";
		}
		if (recpri==1){
			price = "rec";
		} else {
			price = "sta";
		}
		document.location.href='?action=compare&stakes='+stakes+'&price='+price+'&amount='+amount+'&time='+time;
	}
	if (typeof(frames['latesttips']) != "undefined"){
		frames['latesttips'].location.href='latesttips.php'+'?id='+tipid+'&stakes='+stakes+'&price='+price+'&amount='+amount+'&time='+time;
	}
}

function RedoCssClasses()
{
	var links = new Array('d30lnk','d90lnk','d360lnk','dclnk', 'dalllnk','sreclnk','slevlnk','preclnk','pstalnk','m10lnk','m50lnk','m100lnk');
	for (var loop=0; loop<links.length; loop++){
		document.getElementById(links[loop]).className = "nslnk";
	}
	
	if ((time != 30) && (time != 90) && (time != 360)){
		if (time == 5000){
			document.getElementById('dalllnk').className = 'slnk';
		} else {
			document.getElementById('dclnk').className = 'slnk';
		}
	}else{
		document.getElementById('d'+time+'lnk').className = 'slnk';
	}
	
	document.getElementById('s'+stakes+'lnk').className = 'slnk';
	document.getElementById('p'+price+'lnk').className = 'slnk';
	document.getElementById('m'+amount+'lnk').className = 'slnk';
}

function ChangeValues()
{
	//loading
	id=document.forms.switcher.tipsterid.value;
	time=getCheckedValue(document.forms.switcher.time);
	amount=getCheckedValue(document.forms.switcher.amount);
	if (getCheckedValue(document.forms.switcher.stakes)=='lev'){stakes='lev'}else{stakes='rec'}
	if (getCheckedValue(document.forms.switcher.price)=='sta'){price='sta'}else{price='rec'}
	if (stakes=='lev'){rec=0}else{rec=1}
	if (price=='sta'){recpri=0}else{recpri=1}
	document.images.tipstergraph.src='graph.php'+'?id='+id+'&rec='+rec+'&recpri='+recpri+'&amount='+amount+'&time='+time;
	if (typeof(frames['latesttips']) != "undefined"){
		frames['latesttips'].location.href='latesttips.php'+'?id='+id+'&stakes='+stakes+'&price='+price+'&amount='+amount+'&time='+time;
	}
	//endloading
}

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
// http://www.somacon.com/p143.php
// Javascript Get or Set Checked Radio Value
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked){return radioObj.value;}else{return "";}
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

