function setFocus(aForm){
	if( aForm.elements[0]!=null) {
	 var i;
	 var max = aForm.length;
	 for( i = 0; i < max; i++ ) {
		if( aForm.elements[ i ].type != "hidden"
		 && !aForm.elements[ i ].disabled
		 && !aForm.elements[ i ].readOnly ) {
			aForm.elements[ i ].focus();
			break;
		 }
	 }
	}
}

function deleteItem(msg) {
	var check = confirm("Are you sure you want to "+msg+"?");
	if(check == true) {
		return true;
	} else {
		return false;
	}
}

function disableBoxes(boxVal) {
	
	url = document.getElementById("url");
	affiliate = document.getElementById("affiliate");
	stars = document.getElementById("stars");
	//alert("ok");
	if(boxVal.value == "basic") {
		url.disabled = false;
		affiliate.disabled = true;
		stars.disabled = true;
		affiliate.value = "";
		stars.value = "";
	} else if(boxVal.value == "review") {
		url.disabled = true;
		url.value = "";
		affiliate.disabled = false;
		stars.disabled = false;
	}
	
}
function ratingDiv(ratingId,selection){
	if (document.getElementById){
		rating = document.getElementById(ratingId);
		if (selection == "mpg" || selection == "gpkm"){
			rating.style.display = "";
		} else {
			rating.style.display = "none";
		}
	}
}
function popupWin(theURL,winName,winW,winH) {
	var x_coord = (screen.width - winW) / 2;
	var y_coord = (screen.height - winH) / 2;
	var winProps = "height="+winH+",width="+winW+",scrollbars=auto,resizable=yes,status=yes";
  Win = window.open(theURL,winName,winProps);
	Win.window.moveTo(x_coord, y_coord);
	if (parseInt(navigator.appVersion) >= 4) { 
		Win.window.focus(); 
	}
}
function confirmButton(msg) {
	var check = confirm("Are you sure you want to "+msg+"?");
	if(check == true) {
		return true;
	} else {
		return false;
	}
}