var c_field;

if (document.layers) {
	document.write('<link rel="stylesheet" type="text/css" href="clib/css/iga-ns.css">');
} else if (document.getElementById) {
	
	if (navigator.appName == "Netscape") {
		document.write('<link rel="stylesheet" type="text/css" href="clib/css/iga.css">');
 	} else {
		document.write('<link rel="stylesheet" type="text/css" href="clib/css/iga.css">');
	}
	
} else {
	document.write('<link rel="stylesheet" type="text/css" href="clib/css/iga.css">');
}
	
function todayIs() {
var days = new Array(8);
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday";
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";

var months = new Array(13);
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";

var dateObj = new Date()
var wday = days[dateObj.getDay() + 1]
var lmonth = months[dateObj.getMonth() + 1]
var date = dateObj.getDate()
var fyear = dateObj.getYear()

if (fyear < 1000) { fyear+=1900 }

document.write(wday + ", " + lmonth + " " + date + ", " + fyear);
}

function displayFooter() {
document.writeln('<img src="/images/onepixel.gif" width="100%" height="1"><p class="TSize8pt">&nbsp;');
document.writeln('<font color="#006030"><b>&nbsp;<br>&nbsp;&nbsp;');
todayIs();
document.writeln('</b></font><p><img src="/images/onepixel.gif" width="100%" height="1"><p>');
document.writeln('<center><table border="0" cellpadding="0" cellspacing="0">');
document.writeln('<tr valign="top"><td class="smalltext">International Golf Associates Inc.,<br>');
document.writeln('Tel / Fax: (41) (1) 274.2548 (Switzerland)<br>');
document.writeln('Tel / Fax: (44) (020) 7691.7993 (United Kingdom)<br>');
document.writeln('Email: <a href="/contact_form.asp" OnMouseOver="window.status='+"'Contact IGA directly with your comments and questions'; return true"+'"  OnMouseOut="self.status='+"' '; return true"+'">Contact Us</a></td>');
document.writeln('<td width=200 align=center><a href="/index.asp"><img src="/images/iga-logo-61.gif" border="0" width="51" height="61" alt="International Golf Associates - IGA"></a></td>');
document.writeln('<td class="smalltext">International Golf Associates Inc.,<br>');
document.writeln('4370 La Jolla Village Dr, 4th Floor<br>');
document.writeln('San Diego, 92122 CA - USA<br>');
document.writeln('Tel: (858) 546 4737<br>');
document.writeln('Fax: (858) 615 2083<br>');
document.writeln('Email: <a href="/contact_form.asp" OnMouseOver="window.status='+"'Contact IGA directly with your comments and questions'; return true"+'"  OnMouseOut="self.status='+"' '; return true"+'">Contact Us</a></td></tr>');
document.writeln('</table></center></font>');
document.writeln('<p>&nbsp;');
}

function displayHeader(Chapter,FS_Member, mHcp, mRenewal) {
document.writeln('<table border="0" cellpadding="2" cellspacing="2">');
document.writeln('<tr valign="top">');
document.writeln('<td rowspan="3"><a href="/index.asp"><img src="/images/iga-logo-61.gif" border="0" width="51" height="61" alt="International Golf Associates - IGA"></a></td>');
document.writeln('<td class="smalltext"><table border="0" cellpadding="1" cellspacing="0">')
document.writeln('<tr valign="top"><td align="right" class="ebtext">&nbsp;Club:&nbsp;</td><td class="smalltext">&nbsp;<b><font color="#005a2d">International Golf Associates '+Chapter+'</font></b></td>');
document.writeln('</tr></table></td></tr>');
document.writeln('<tr valign="top"><td class="smalltext" colspan="2"><table border="0" cellpadding="1" cellspacing="0">')
document.writeln('<tr valign="top"><td align="right" class="ebtext">&nbsp;User:&nbsp;</td><td class="smalltext">&nbsp;'+FS_Member+'&nbsp;</td>');
if (eval(mHcp) > 0) {
	document.write('<td class="ebtext" align="left" width="30">&nbsp;Hcp:&nbsp;</td><td class="smalltext" width="30">&nbsp;'+mHcp+'&nbsp;</td>');
}
if (mRenewal != "none") {
	document.write('<td class="ebtext" align="left" width="30">&nbsp;Renewal:&nbsp;</td><td class="smalltext" width="30">&nbsp;'+mRenewal+'&nbsp;</td>');
}
document.writeln('</tr></table></td></tr>');
document.writeln('<tr><td align="right">&nbsp;</td></tr>');
document.writeln('</table>');
document.writeln('<img src="/images/3color.gif" border="0" width="100%" height="5" alt=""><br>');
}

function tHeader() {
	
document.writeln('<table border=0 cellpadding=2 cellspacing=2>');
document.writeln('<tr valign="top">');
document.writeln('<td><img src="/images/iga-logo-61.gif" border="0" width="51" height="61" alt="IGA Franco-Suisse" align="left">');
document.writeln('<font color="#005a2d" style="font-size: 10pt"><b>International Golf Associates</b></font><br>');
document.writeln('<font style="font-size: 10pt"><b>Making a World of Golfing Difference</b></font></td></tr></table>');
document.writeln('<img src="/images/onepixel.gif" width=100% height=1><br>');
}


function isNumberString (InString)  {
if(InString.length==0) 
	return (false);
	RefString="1234567890";
	for (Count=0; Count < InString.length; Count++)  {
		TempChar= InString.substring (Count, Count+1);
		if (RefString.indexOf (TempChar, 0)==-1)  
			return (false);
	}
return (true);
}

function loginCheck(zLang) {

var zUserID = document.frmLogin.userid.value
var zPassword = document.frmLogin.password.value


if (! isNumberString(zUserID)) {
	alert("IGA N° must be numeric!")
	document.frmLogin.userid.focus();
	document.frmLogin.userid.select();
	return (false);
}

if (document.frmLogin.userid.value == "") { 
	alert("User ID is required!");
	document.frmLogin.userid.focus();
	document.frmLogin.userid.select();
	return false 
}

if (document.frmLogin.password.value == ""){ 
	alert("Password is required!");
	document.frmLogin.password.focus();
	document.frmLogin.password.select();
	return false 
}

}

function CourseBoxChange() {
var current_ctry = "document.frmCourse.z_country.selectedIndex";
var zChoice = eval(current_ctry);
current_ctry = eval("document.frmCourse.z_country.options[" + zChoice + "].value");

var current_region = "document.frmCourse.z_region.selectedIndex";
zChoice = eval(current_region);
current_region = eval("document.frmCourse.z_region.options[" + zChoice + "].value");

var current_dept = "document.frmCourse.z_department.selectedIndex";
var zChoice = eval(current_dept);
current_dept = eval("document.frmCourse.z_department.options[" + zChoice + "].value");

location.replace("where_we_play.asp?z_country="+current_ctry+"&z_region="+current_region+"&z_department="+current_dept);

}

function CheckCourse() {
var current_ctry = "document.frmCourse.z_country.selectedIndex";
var zChoice = eval(current_ctry);
current_ctry = eval("document.frmCourse.z_country.options[" + zChoice + "].value");
document.frmCourse.ctry_name.value = eval("document.frmCourse.z_country.options[" + zChoice + "].text");

var current_region = "document.frmCourse.z_region.selectedIndex";
zChoice = eval(current_region);
current_region = eval("document.frmCourse.z_region.options[" + zChoice + "].value");
document.frmCourse.region_name.value = eval("document.frmCourse.z_region.options[" + zChoice + "].text");

var current_dept = "document.frmCourse.z_department.selectedIndex";
var zChoice = eval(current_dept);
current_dept = eval("document.frmCourse.z_department.options[" + zChoice + "].value");
document.frmCourse.department_name.value = eval("document.frmCourse.z_department.options[" + zChoice + "].text");

document.frmCourse.submit()
}

function Login() {
document.frmLogin.submit()
}

function CheckName() {
var current_name = "document.frmCourse.CourseName.value";

if (document.frmCourse.CourseName.value  == "") {
	alert("Error:  Name can not be blank! Please try again!");
	document.frmCourse.CourseName.focus();
	document.frmCourse.CourseName.select();
	return false
}
else {
	current_name = document.frmCourse.CourseName.value;
	location="course_name_list.asp?z_pass=1&course_name="+current_name;
}
}

function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,4})\.(\d{1,4})\.(\d{1,4})\.(\d{1,4})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
 	alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("The email username doesn't seem to be valid.")
    return false
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination email IP address is invalid!")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The email domain name doesn't seem to be valid.")
    return false
}

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>4) {
   // the address must end in a two letter or three letter word.
   alert("The email address must end in a three or four letter domain, or two letter country.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This email address is missing a hostname!"
   alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}

function WhoGetsWhat()
{
var zRecipient, myChoice, zCC, zSubject, atsign;

if (document.contact.lastname.value == "") {
	alert("Your Last Name is required !")
	document.contact.lastname.focus();
	document.contact.lastname.select();
	return (false);
}

if (document.contact.firstname.value == "") {
	alert("Your First Name is required !")
	document.contact.firstname.focus();
	document.contact.firstname.select();
	return (false);
}

if (!emailCheck(document.contact.email.value)) {
	document.contact.email.focus();
	document.contact.email.select();
	return (false);
}	

if (document.contact.comments.value == "") {
	alert("Your Comments are required !")
	document.contact.comments.focus();
	document.contact.comments.select();
	return (false);
}

atsign="@"

myChoice = document.contact.subject.selectedIndex;
zSubject = document.contact.subject.options[myChoice].value;

if (zSubject == "Membership USA")
  {
   zRecipient = "phil.coller" + atsign + "iga-golf.com"
   zCC = "scott" + atsign + "iga-golf.com"
  }

if (zSubject == "Membership Europe")
  {
   zRecipient = "scott" + atsign + "iga-golf.com"
  }
  
  if (zSubject == "Membership Franco-Suisse")
  {
   zRecipient = "scott" + atsign + "iga-golf.com"
  }
  
  if (zSubject == "Membership United Kingdom")
  {
   zRecipient = "scott" + atsign + "iga-golf.com"
  }

if (zSubject == "Membership Worldwide")
  {
   zRecipient = "phil.coller" + atsign + "iga-golf.com"
   zCC = "scott" + atsign + "iga-golf.com"
  }

if (zSubject == "Local Club Creation")
  {
   zRecipient = "phil.coller" + atsign + "iga-golf.com"
   zCC = "scott" + atsign + "iga-golf.com"
  }

if (zSubject == "Site Administration")
  {
   zRecipient = "scott" + atsign + "iga-golf.com"
   zCC = ""
  }

if (zSubject == "Club Affiliation")
  {
   zRecipient = "phil.coller" + atsign + "iga-golf.com"
   zCC = "scott" + atsign + "iga-golf.com"
  }

if (zSubject == "Suggestions and Questions")
  {
   zRecipient = "phil.coller" + atsign + "iga-golf.com"
   zCC = "scott" + atsign + "iga-golf.com"
  }


document.contact.recipient.value = zRecipient;
document.contact.bcc.value = zCC;
return (true);
}

function isNumberString (InString)  {
	if(InString.length==0) 
		return (false);
	RefString="1234567890.";
	for (Count=0; Count < InString.length; Count++)  {
		TempChar= InString.substring (Count, Count+1);
		if (RefString.indexOf (TempChar, 0)==-1)  
			return (false);
	}
	return (true);
}