var img_n = new Object(); // normal images
var img_o = new Object(); // rolled over images

function menu_img_precache() // precache images for rolling over
{
	menu_img_path = "/img/btns/";
	var aimg = ['overview_btn','signup_btn','help_btn','shop_btn','plan_btn'];
	if (document.images)
	{
		for(x=0; x<aimg.length; x++)
		{
			img_n[aimg[x]] = new Image();
			img_n[aimg[x]].src = menu_img_path + aimg[x] + '.gif';
			img_o[aimg[x]] = new Image();
			img_o[aimg[x]].src = menu_img_path + aimg[x] + '_o.gif';
		}
	}
}

function tabs_img_precache() // precache images for tabs rolling over
{
	menu_img_path = "/img/btns/";
	var aimg = ['tab_pat_log','tab_pat_reports','tab_pat_account','tab_pat_dialog','tab_pat_education','tab_doc_patients','tab_adm_doctors','tab_adm_patients','tab_adm_reports','tab_adm_reports','tab_adm_payments','tab_adm_site'];
	if (document.images)
	{
		for(x=0; x<aimg.length; x++)
		{
			img_n[aimg[x]] = new Image();
			img_n[aimg[x]].src = menu_img_path + aimg[x] + '.jpg';
			img_o[aimg[x]] = new Image();
			img_o[aimg[x]].src = menu_img_path + aimg[x] + '_o.jpg';
		}
	}
}


function rollmenu(where, what)
{
	what ? document.images[where].src = img_o[where].src: document.images[where].src = img_n[where].src;
	return true;
}

function changeCal()
{
	var varPostedValue=MM_SelectTab_New()+"?"+document.getElementById('selYear').options[document.getElementById('selYear').options.selectedIndex].value;
	window.document.calForm.action=varPostedValue;
	window.document.calForm.submit();
	return true;	
}

function MM_SelectTab_New() { //v3.0
  var sPath = window.location.pathname;
  var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
  return sPage;
}
function changeCal()
{
	var varPostedValue=MM_SelectTab_New()+"?"+document.getElementById('selYear').options[document.getElementById('selYear').options.selectedIndex].value;
	//alert(varPostedValue);
	window.document.calForm.action=varPostedValue;
	window.document.calForm.submit();
	return true;	
	//alert(document.calForm.selYear.value);
}

function confirmAction(text)
{
	if (confirm(text)) return true;
		else return false;
}

function checkRegForm()
{
	p1 = document.forms['regform'].elements['password'].value;
	p2 = document.forms['regform'].elements['password2'].value;
	if (p1 == ""){
		alert('Your password is empty!');
		return false;
	}
	else if (p1 != p2){
		alert('Your passwords doesn\'t match!');
		return false;
	}
	else if (!document.forms['regform'].elements['agree'].checked)
	{
		alert('Please agree with Terms & Conditions');
		return false;
	}
	else
	{
		return true;
	}
}

menu_img_precache();
