function loadFlashObject(movie, width, height, bgcol, flashvars, tid, tclass) {
	if (bgcol=="") {
		if (document.body.bgColor)
			bgcol = document.body.bgColor;
		else if (document.body.style.backgroundColor)
			bgcol = document.body.style.backgroundColor;
	}
	document.write( 
		'<object ' + (tid?('id="' + tid + '" name="' + tid + '" '):'') + (tclass?('class="' + tclass + '" '):'') + 'type="application/x-shockwave-flash" data="' + movie + '" width="' + width + '" height="' + height + '">' +
			'<param name="quality" value="high" />' +
			'<param name="movie" value="' + movie + '" />' +
			'<param name="bgcolor" value="' + bgcol + '" />' +
			'<param name="base" value="" />' +
			'<param name="flashVars" value="' + flashvars + '" />' +
		'</object>'
	);
}

function isOpera()
{
	return navigator.appName.indexOf("Opera") != -1;
}

function popup(url, resizable)
{
	if (isOpera())
	{
		window.open(url);
	}
	else
	{
		window.open(url,'','width=500,height=500,left=0,top=0,toolbar=No,scrollbars=No,location=No,status=No,resizable=Yes,fullscreen=No');
	}
}

function sizedPopup(url, width, height, scrollbars)
{
	if (isOpera())
	{
		window.open(url);
	}
	else
	{
		window.open(url,'','width=' + width + ',height=' + height + ',left=0,top=0,toolbar=No,scrollbars=' + scrollbars + ',location=No,status=No,resizable=No,fullscreen=No');
	}
}

function newWindow(url)
{
	window.open(url,'','toolbar=Yes,location=Yes,directories=Yes,resizable=Yes,scrollbars=Yes,status=Yes,menubar=Yes');
}

function showCreditValueExamples(clicked_package){
	var i = 1;
	var packId = clicked_package * 1;
	for (i; i <= document.getElementsByName("package").length; i++){
		if (packId == i){
			document.getElementById("package" + i).style.display = "block";
		}else{
			document.getElementById("package" + i).style.display = "none";
		}
	}
}

function choosePaymentMethod(){
	document.getElementById("card").style.display = "none";
	document.getElementById("paypal").style.display = "none";
	checkPaymentMethod();
}

function checkPaymentMethod(){
	var chosen = "";
	var len = document.method.method_select.length;
	for (i = 0; i <len; i++) {
		if (document.method.method_select[i].checked) {
			chosen = document.method.method_select[i].value;
		}
	}
	if (chosen.length != 0){
		document.getElementById(chosen).style.display = "block";
		document.getElementById("temp_buttons").style.display = "none";
	}
}

function checkAccountFilter() {
	var checkedvalue = getFilterParam(document.myaccount);
	if (checkedvalue == "all"){
		disableFilter(true);
	}
	if (checkedvalue == "filtered"){
		disableFilter(false);	
	}
}

function disableFilter(val) {
	document.myaccount.monthfrom.disabled = val;
	document.myaccount.dayfrom.disabled = val;
	document.myaccount.yearfrom.disabled = val;
	document.myaccount.monthto.disabled = val;
	document.myaccount.dayto.disabled = val;
	document.myaccount.yearto.disabled = val;
}

function getFilterParam(form) {
	var filterradio = form.filter;
	var checked = "";
	for(var i = 0; i < filterradio.length; i++) {
		if(filterradio[i].checked) {
			checked = filterradio[i].value;
		}
	}
	return checked;
}

function checkFilterSelection(form) {
	if (getFilterParam(form) == "filtered"){
		if (form.monthfrom.selectedIndex == 0 ||
			form.dayfrom.selectedIndex == 0 ||
			form.yearfrom.selectedIndex == 0 ||
			form.monthto.selectedIndex == 0 ||
			form.dayto.selectedIndex == 0 ||
			form.yearto.selectedIndex == 0){
			alert("Please select all fields for the dates.");
			valid = false;
		}
		else{
			valid = true;
		}
	}
	else {
		valid = true;
	}
	return valid;
}