
function copystatus(){
    window.status="© 2010 International Association of Golf Administrators.   All Rights Reserved.";
};

  
function launch(url,name) {
  window.open(url, name);
};

function userConfirm() { 
	return window.confirm ("Are you sure you want to delete this record?") 
} ;

function userConfirmF() { 
	return window.confirm ("Are you sure you want to remove the this file?") 
} ;

function userConfirmVal(msg,val) { 
	var newmsg = msg + ": " + val
	return window.confirm(newmsg) 
} ;

function userConfirmMsg(msg) { 
	var newmsg = msg
	return window.confirm(newmsg);
}

function popup(url,name,h,w) {
  window.open(url, name, 'left=340,top=80,width=' + w + ',height=' + h + ',scrollbars,resizable');
}

function limitext(TheForm,TheFld,Val,len,max)	{
	var maxlength = max;
	var currlength = len;	
	if(maxlength < currlength) {
		TheForm[TheFld].value = TheForm[TheFld].value.substring(0, maxlength);
		alert("Maximum Character Limit Met - " + maxlength);		
	}
};

function replace(string,text,by) {
    // Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function showtip(current,e,text) {
   if (document.all)
   {
      thetitle=text.split('<br>')
      if (thetitle.length > 1) {
        thetitles=""
        for (i=0; i<thetitle.length; i++)
           thetitles += thetitle[i] + "\r\n"
        current.title = thetitles
      }
      else current.title = text
    }
   else if (document.layers) {
       document.tooltip.document.write( 
           '<layer bgColor="#FFFFE7" style="border:1px ' +
           'solid black; font-size:12px;color:#000000;">' + text + '</layer>')
       document.tooltip.document.close()
       document.tooltip.left=e.pageX+5
       document.tooltip.top=e.pageY+5
       document.tooltip.visibility="show"
    }
}

function hidetip() {
    if (document.layers)
        document.tooltip.visibility="hidden";
}


function submitform(form,url) {
   form.action= url;   
   form.submit();  
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function disableButton(theButton)
{
 theButton.value="Processing...";
 theButton.disabled = true; 
}

function sethiddenval() {
	form2.isok.value = 9873;
	//alert(form2.value.isok);
}

function ValidPayment(theForm)
{

	if (theForm.fname.value == "" || theForm.lname.value == "")	  {
		 alert("Please enter a value for the \"Name on Credit Card\" field.");
		 theForm.fname.focus();
		 return (false);	  }
		 
	if (theForm.baddr.value == "" || theForm.bcity.value == "" || theForm.bstate.value == "" || theForm.bzip.value == "" )	  {
		 alert("Please enter a complete \"Billing Address\" field.");
		 theForm.email.focus();
		 return (false);	  }
		 
	var myCardNo = theForm.x_card_num.value;			//document.getElementById('x_card_num').value;
	var myCardType = getCheckedValue(theForm.cctype);	//document.getElementById('cctype').value;
	if (!checkCreditCard (myCardNo,myCardType)) {
		alert(ccErrors[ccErrorNo])
		theForm.x_card_code.focus();
	return (false);	  }	
		 
	val = theForm.x_card_code.value 
	if (val == "" || val.length != 3)	  {
	 alert("Your 3-Digit Security Code is required.");
	 theForm.x_card_code.focus();
	 return (false);	  }
		 
	if (theForm.expmo.value.length == 0 || theForm.expyr.value.length == 0)	  {
		alert("Please enter your Credit Card Expiration Date.");
		theForm.expmo.focus();
		return (false);	 } 
		 
	if (theForm.phone.value == "")	  {
		alert("Please enter a value for the \"Daytime Phone\" field.");
		theForm.hphone.focus();
		return (false);	  }    
  
  return (true);
}
