var oldLoad = window.onload;

window.onload = function()
{
	oldLoad();
	f = document.getElementById('captcha');
	if (f) {
		if (navigator.userAgent.indexOf("Safari") > 0) {
			f.setAttribute("autocomplete","off");
		} else if (navigator.product == "Gecko") {
			f.setAttribute("autocomplete","off");
		} else {
			isIE = true;
			f.setAttribute("autocomplete","off");
		}
	}
}

function PrintPage(url)
{
	var x = window.open(url, "PrintQuestion", "toolbar=1, scrollbars=1");
}

function EmailToFriend(url)
{
	xPos = screen.availWidth / 2 - 250;
	yPos = screen.availHeight / 2 - 215;
	var y = window.open(url, "EmailQuestion", "width=500, height=430, toolbar=1, scrollbars=1, left=" + xPos + ", top=" + yPos);
}

function ToggleWhyTextbox(f)
{
	if (f.value == 0) {
		document.getElementById('why').style.display='block';
	} else {
		document.getElementById('why').style.display='none';
	}
}

function ResetWhy(f, v)
{
	if (f.value == '') {
		f.value = v;
		f.style.color = 'gray';
	}
}

function ClearWhy(f, v)
{
	if (f.value == v) {
		f.value = '';
		f.style.color = 'black';
	}
}

function CheckForm(f, v1, v2)
{
	if (f.rate[1].value == 0 && f.rate[1].checked) {
		if (f.why.value == '') {
			alert(v2);
			return false;
		}
		if (f.why.value == v1) {
			alert(v2);
			return false;
		}
	}
	return true;
}

function CheckFormComment(v)
{
	if (document.getElementById("comment").value == "") {
		alert(v);
		document.getElementById("comment").focus();
		return false;
	}
	return true;
}

function CheckAdvancedSearchForm(v)
{
	if (document.getElementById("AQuery").value == "") {
		alert(v);
		document.getElementById("AQuery").focus();
		return false;
	}
	return true;
}
