function ShowImage2(strImagePath,winWidth,winHeight)
{
	var ShowImageWin;
	var strName =  "ShowImages"
	var strFeatures;
	strImagePath ="ShowImage2.html?Image=" + strImagePath + "&Width=" + winWidth + "&Height=" + winHeight
	strFeatures = "dependent=yes,directories=no,location=no,menubar=no,resizable=yes,personalbar=no,scrollbars=no,titlebar=no,toolbar=no,top=50, left=50, width="+winWidth+",height="+winHeight+""
	ShowImageWin = window.open(strImagePath, null, strFeatures);
	ShowImageWin.focus();

	return false;
}


function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


var lists = new Array();

// First set of text and values
lists['day']    = new Array();
lists['day'][0] = new Array(
	'1',
	'2',
	'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
'18',
'19',
'20',
'21',
'22',
'23',
'24',
'25',
'26',
'27',
'28',
'29',
'30'
);
lists['day'][1] = new Array(
		'1',
	'2',
	'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
'18',
'19',
'20',
'21',
'22',
'23',
'24',
'25',
'26',
'27',
'28',
'29',
'30'
);
// Second set of text and values
lists['week']    = new Array();
lists['week'][0] = new Array(
			'1',
	'2',
	'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10'
);
lists['week'][1] = new Array(
		'1',
	'2',
	'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10'
);

// Third set of text and values
lists['month']    = new Array();
lists['month'][0] = new Array(
			'1',
	'2',
	'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12'
);
lists['month'][1] = new Array(
		'1',
	'2',
	'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12'
);
// Fourth set of text and values
lists['year']    = new Array();
lists['year'][0] = new Array(
			'1',
	'2',
	'3'
);
lists['year'][1] = new Array(
		'1',
	'2',
	'3'
);
function changeList( box ) {
	list = lists[box.options[box.selectedIndex].value];
	emptyList( box.form.slave );
	fillList( box.form.slave, list );
}
function emptyList( box ) {
	while ( box.options.length ) box.options[0] = null;
}
function fillList( box, arr ) {
	for ( i = 0; i < arr[0].length; i++ ) {
		option = new Option( arr[0][i], arr[1][i] );
		box.options[box.length] = option;
	}
	box.selectedIndex=0;
}

var months = new Array()
months[1] = "Jan"
months[2] = "Feb"
months[3] = "Mar"
months[4] = "Apr"
months[5] = "May"
months[6] = "Jun"
months[7] = "Jul"
months[8] = "Aug"
months[9] = "Sep"
months[10] = "Oct"
months[11] = "Nov"
months[12] = "Dec"

var today = new Date()
var month = today.getMonth()+1
var date = today.getDate()


function correctDate(form,menu1,nextmenu){

	
var formerlength=nextmenu.options.length

	if(menu1.options[1].selected){
	thelength=28
	}
	else if(menu1.options[3].selected || menu1.options[5].selected || menu1.options[8].selected || menu1.options[10].selected){
	thelength=30
	}
	else{
	thelength=31
	}
	nextmenu.options.length=thelength
	for(i=formerlength; i<thelength; i++){
	nextmenu.options[i].value=i+1
	nextmenu.options[i].text=i+1
	}
	nextmenu.selectedIndex=thelength-1
	
}

function chkEmail(sEmail){
var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid        

 if (!reg1.test(sEmail) && reg2.test(sEmail)) { // if syntax is valid
    return true;	     
  }
 else{
	return false;   	  	 
  }      
} 
 
function isBlank(checkval) {
	NotNullString = true;
	for (i=0;i<checkval.length;i++) {
		if (checkval.charAt(i) != " ") {
			NotNullString = false;
			break;
		}
	}
	return NotNullString;
}

function setfocus(l,v,s){
	if(l == 0){
		v.focus();
		if(s != 0)	
			v.select()
	}	
}



 function validateForm(){
 		var errormsg = "";
	 	theForm = document.form1;
	 	

		
		if(isBlank(theForm.firstName.value)){
			setfocus(errormsg.length,theForm.firstName)
			errormsg += "Please fill in your first name.\n"
		}
		
		if(isBlank(theForm.lastName.value)){
			setfocus(errormsg.length,theForm.lastName)
			errormsg += "Please fill in your last name.\n"
		}	
			
			
		if(! chkEmail(theForm.email.value)){
			setfocus(errormsg.length,theForm.email)
			errormsg += "Please fill valid email address.\n"
		}	
		
				if(theForm.confirmemail.value != theForm.email.value){
			setfocus(errormsg.length,theForm.confirmemail)
			errormsg += "Please fill confirm email. Confirm email does not match email. \n"
					}
		
			if(isBlank(theForm.areacode.value)){
			setfocus(errormsg.length,theForm.areacode)
			errormsg += "Please fill in your area code number.\n"
		}else if (isNaN(theForm.areacode.value)){
			setfocus(errormsg.length,theForm.areacode)
			errormsg += "Please fill in vaild area code number, number only.\n"

		}
	
	 		if(isBlank(theForm.phone.value)){
			setfocus(errormsg.length,theForm.phone)
			errormsg += "Please fill in your phone number.\n"
		}else if (isNaN(theForm.phone.value)){
			setfocus(errormsg.length,theForm.phone)
			errormsg += "Please fill in vaild phone number, number only.\n"

		}
		
			if (isBlank(theForm.extension.value) != true) {
		 if (isNaN(theForm.extension.value)){
			setfocus(errormsg.length,theForm.extension)
			errormsg += "Please fill in vaild extension number, number only.\n"

		}
		}
		
		
		
	

		
		if (errormsg.length > 0){
	     alert(errormsg);
		 return false;
		}
	 }
	 
function changeBox() {
if (document.form1.hear8.checked==true) {
	document.form1.specify.disabled=false;
	document.form1.specify.focus();
}else{
	document.form1.specify.value="";
	document.form1.specify.disabled=true;
}
}


