function showhide()
{
//alert("MAxim4");

	var check=document.crons.what.value;
	document.getElementById('s1').style.display='none';
	document.getElementById('s2').style.display='none';
	//document.getElementById('s4').style.display='none';
	//document.getElementById('s5').style.display='none';
	//document.getElementById('s6').style.display='none';
	//document.form_add_fields.s1.style.display='none';
	//s1.style.display='none';
	//s2.style.display='none';
	//s3.style.display='none';
	//s4.style.display='none';
	switch(check)
        {
		/*
		case '1':   alert("MAxim1"); break
        case '2':   alert("MAxim2"); break
        case '3':   alert("MAxim3"); break
        default:    alert("MAxim4"); break
		 */
        //case 'CHECKBOX':   document.getElementById('s3').style.display=''; break
        //case 'RADIO':   document.getElementById('s4').style.display=''; break
        case 'day':   document.getElementById('s2').style.display=''; break
		case 'hour':   document.getElementById('s1').style.display=''; break
        //default:    s5.style.display=''; break    
        }

}

function checkSelect(obj,url)
{
    url+="&popup=yes";
    if(obj.selectedIndex==1)
    {
        obj.selectedIndex=0;
        window.open(url,'newWin','titlebar=yes,toolbar=no,menubar=yes');
    }

}

function check_submit(form_index,required_fields,numeric_fields,select_fields)
{
    var errors=0;
    var errmsg="";
    var item;
    var x;
    var numItems=0;
    numItems=required_fields.length;

        for(x=0;x < numItems; x++)
        {

            item=required_fields[x];

            if(document.forms[form_index].elements[item].value=="")
            {
                errors++;
                errmsg+='Required field ' + document.forms[form_index].elements[item].name + ' is blank!\n';
            }
        }
        numItems=numeric_fields.length;
        for(x=0;x<numItems;x++)
        {
            item=numeric_fields[x];
            if(isNaN(document.forms[form_index].elements[item].value))
            {
                errors++;
                errmsg+='Field ' + document.forms[form_index].elements[item].name + ' must be numeric!\n';
            }
        }
        numItems=select_fields.length;
        for(x=0;x<numItems;x++)
        {
            item=select_fields[x];
            if(document.forms[form_index].elements[item].selectedIndex<1)
            {
                errors++;
                errmsg+='Please select a value for ' + document.forms[form_index].elements[item].name + ' !\n';
            }
        }
        if(errors!=0)
        {
            alert(errmsg);
            return false;
        }
        else
        {
            return true;
        }

}

function reload_products()
 {
  var targ="parent";
  //var value=variable.options[variable.selectedIndex].value
  var value2=document.getElementById('category').value
  eval(targ+".location='../products.php?cat_id="+value2+"'");
 }
function reload(variable)
 {
  var targ="parent";
  var value=variable.options[variable.selectedIndex].value
  eval(targ+".location='search.php?country="+value+"'");
 }
function reload2(variable)
 {
  var targ="parent";
  var value=variable.options[variable.selectedIndex].value
  eval(targ+".location='search_golfers.php?country="+value+"'");
 }
 function reload4(variable)
 {
  var targ="parent";
  var value=document.getElementById('user_id').value
  var value2=document.getElementById('item_id').value
  var value3=document.getElementById('status_type').value
  eval(targ+".location='admin_form_results.php?user_id="+value+"&item_id="+value2+"&status_type="+value3+"'");
 }
 function reload_main(variable)
 {
  var targ="parent";
  var value=document.getElementById('member_id').value
  eval(targ+".location='admin_manage_members.php?m_id="+value+"&show=add_member'");
 }
 function reload_business(variable)
 {
  var targ="parent";
  var value=document.getElementById('member_id').value
  eval(targ+".location='admin_manage_members.php?m_id="+value+"&show=add_member_business'");
 }
 function reload_additional(variable)
 {
  var targ="parent";
  var value=document.getElementById('member_id').value
  eval(targ+".location='admin_manage_members.php?m_id="+value+"&show=add_member_additional'");
 }
 function reload_emergency(variable)
 {
  var targ="parent";
  var value=document.getElementById('member_id').value
  eval(targ+".location='admin_manage_members.php?m_id="+value+"&show=add_member_emergency'");
 }
 function reload_photo(variable)
 {
  var targ="parent";
  var value=document.getElementById('member_id').value
  eval(targ+".location='admin_manage_members.php?m_id="+value+"&show=add_member_photo'");
 }
 function reload_class(variable)
 {
  var targ="parent";
  var value=document.getElementById('member_id').value
  eval(targ+".location='admin_manage_members.php?m_id="+value+"&show=add_class'");
 }
 function reload_arrival(variable)
 {
  var targ="parent";
  var value=document.getElementById('member_id').value
  eval(targ+".location='admin_manage_members.php?m_id="+value+"&show=add_member_arrival'");
 }
 function reload_print(variable)
 {
  var targ="parent";
  var value=document.getElementById('class_id').value
  eval(targ+".location='admin_print.php?new[c_id]="+value+"'");
 }
 function reload_arrival_2(variable)
 {
  var targ="parent";
  var value=document.getElementById('m_id').value
  var value2=document.getElementById('room_id').value
  var value3=document.getElementById('meal_id').value
  eval(targ+".location='admin_manage_members.php?m_id="+value+"&new[r_id]="+value2+"&new[me_id]="+value3+"&show=add_member_arrival'");
 }
 function reload_attendance(variable)
 {
  var targ="parent";
  var value=document.getElementById('class_id').value
  var value2=document.getElementById('dc1').value
  var value3=document.getElementById('dc2').value
  eval(targ+".location='admin_attendance.php?new[c_id]="+value+"&dc1="+value2+"&dc2="+value3+"'");
 }
function myPopup2() {
window.open( "http://www.google.com/", "myWindow", 
"status = 1, height = 300, width = 300, resizable = 0" )
}

function popupWindow(pr_id) 
{
	//var myname = 'Enlarged Photo';
	var mypage = 'product_photo.php?pr_id='+pr_id;
	var w = '450';
	var h = '450';
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable=1'
	win = window.open(mypage, "", winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function popupWindow(pr_id) 
{
	//var myname = 'Enlarged Photo';
	var mypage = 'product_photo.php?pr_id='+pr_id;
	var w = '450';
	var h = '450';
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable=1'
	win = window.open(mypage, "", winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}