// JavaScript Document
<!--
var cX = 0; var cY = 0;
function UpdateCursorPosition(e){
	cX = e.pageX; cY = e.pageY;
}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
	if(document.all) {
		document.onmousemove = UpdateCursorPositionDocAll;
	} else {
		document.onmousemove = UpdateCursorPosition;
	}
function AssignPosition(d) {
	d.style.left = (cX+10) + "px";
	d.style.top = (cY+10) + "px";
}
function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block";
}
function ReverseContentDisplay(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	if(dd.style.display == "none") {
		dd.style.display = "block"; 
	} else {
		dd.style.display = "none";
	}
}
function settings(section){
	var elm = document.getElementById(section);
	if(elm.value == 'Customer' || elm.value == 'Vendor'){
		display('logoTitle');
		display('logo');
	}else{
		hide('logoTitle');
		hide('logo');
	}
}
function changeColor(){
	if(document.getElementById('mainNav').value == 1){
		document.getElementById('navSection').style.visibility = 'hidden';
		document.write(1);
	}
	document.write(document.getElementById('mainNav').value)
}
function mOver(){
	return "this.style.backgroundColor='#CCC'; this.style.cursor='pointer';";
}
function showMe (dID, num, elm) {
	for(i=0; i<=num; i++){
		obj = document.getElementById(elm+i);
		if (i == dID) {
			obj.style.display = "block";
		}else{
			obj.style.display = "none";
		}
		
		
	}
}
function toggleDisplayAll(section, number){
	for(i=1; i<=number; i++){
		var elm = document.getElementById(section+i);
		if (elm.style.display == 'block' || elm.style.display == '') {
			elm.style.display = 'none';
		}else{
			elm.style.display = 'block';
		}
	}
}
function toggleDisplay(section){
	var elm = document.getElementById(section);
	if (elm.style.display == 'block' || elm.style.display == '') {
		elm.style.display = 'none';
	}else{
		elm.style.display = 'block';
	}
}
function showAll(section, number){
	for(i=1; i<=number; i++){
		var elm = document.getElementById(section+i);
		elm.style.display = 'block';
	}
}
function hideAll(section, number){
	for(i=1; i<=number; i++){
		var elm = document.getElementById(section+i);
		elm.style.display = 'none';
	}
}
function display(section){
	document.getElementById(section).style.display = 'block';
}
function hide(section){
	document.getElementById(section).style.display = 'none';
}
function firstImage(){
	//Partner Logos
	document.getElementById('logos').src=images[0];
	document.getElementById('imageLink').href=links[0];
	//Customer Logos
	document.getElementById('custLogos').src=custImages[0];
	document.getElementById('custLink').href=custSites[0];
}
var timerID = 0;
var tStart  = null;
var play = 1;
var testCount = '';
var img = 1;
var imageCount = '';
var custimg = 1;
var custCount = '';
function UpdateTimer() {
   if(timerID) {
      clearTimeout(timerID);
      clockID  = 0;
   }
   if(!tStart)
      tStart   = new Date();
   var   tDate = new Date();
   var   tDiff = tDate.getTime() - tStart.getTime();
   tDate.setTime(tDiff);
   /*document.theTimer.theTime.value = "" 
                                   + tDate.getMinutes() + ":" 
                                   + tDate.getSeconds();*/
   if(tDate.getSeconds() > 4){
	   	if(imageCount == 0)
	   		img = 0;
		if(custCount == 0)
			custimg = 0;
	    document.getElementById('logos').src=images[img];
		document.getElementById('imageLink').href=links[img];
		document.getElementById('custLogos').src=custImages[custimg];
		document.getElementById('custLink').href=custSites[custimg];
		Reset();
		if(play == testCount){
			document.getElementById(last).style.visibility="hidden";
			play=0;
			document.getElementById('testimonial'+play).style.visibility="visible";
		}else{
			if(play != 0){
				document.getElementById('testimonial'+play).style.visibility="visible";
				last = 'testimonial'+(play);
				document.getElementById('testimonial'+(play-1)).style.visibility="hidden";
			}
			play++;	
		}
		if(img == imageCount){
			img=0;
		}else{
			img++;	
		}
		if(custimg == custCount){
			custimg=0;
		}else{
			custimg++;	
		}
   }
   timerID = setTimeout("UpdateTimer()", 1000);
}
function Start() {
   tStart   = new Date();
   //document.theTimer.theTime.value = "00:00";
   timerID  = setTimeout("UpdateTimer()", 1000);
}

function Stop() {
   if(timerID) {
      clearTimeout(timerID);
      timerID  = 0;
   }
   tStart = null;
}
function Reset() {
   tStart = null;
   //document.theTimer.theTime.value = "00:00";
}

function popUp(URL, wide) {
	day = new Date();
	eval("page" + 1 + " = window.open(URL, '" + 1 + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,addressbar=0;menubar=1,resizable=1,width="+wide+",height=600');");
}

function selectall(check){
	t=document.updateMasters.length;
	for(i=0; i<t; i++){
		if(check)
			document.updateMasters[i].checked=true;
		else
			document.updateMasters[i].checked=false;
	}
}

function sure(msg){
	return confirm(msg);
}

function hideColumn (colIndex) {
	var table = document.all ? document.all.aTable :
				document.getElementById('aTable');
	for (var r = 0; r < table.rows.length; r++){
		table.rows[r].cells[colIndex].style.display = 'none';
	}
}
function showColumn (colIndex) {
	var table = document.all ? document.all.aTable :
				document.getElementById('aTable');
	for (var r = 0; r < table.rows.length; r++){
		table.rows[r].cells[colIndex].style.display = '';
	}
}
function hideBtn (colIndex) {
	var table = document.all ? document.all.bTable :
				document.getElementById('bTable');
	for (var r = 0; r < table.rows.length; r++){
		table.rows[r].cells[colIndex].style.display = 'none';
	}
}
function showBtn (colIndex) {
	var table = document.all ? document.all.bTable :
				document.getElementById('bTable');
	for (var r = 0; r < table.rows.length; r++){
		table.rows[r].cells[colIndex].style.display = '';
	}
}

function createCookie(name, value, days){
	if (days){
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i<ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function check(name){
	alert('The value of the cookie is ' + readCookie(name));
}
function createForm(number) {
	data = "";    
	inter = "'";
	for (i=1; i <= number; i++) {
		if(i % 2){
			col='#EEEEEE';
		}else{
			col='#FFFFFF';
		}
		data = data + '<table width=1015 align="center" border=0 bgcolor="'+ col +'" width="100%"><tr>'+
						'<td><b>Member\'s Family: #'+ i +'</b></td><td></tr><tr>'+ 
						'<td>'+
						
							'<table border=0></tr>'+
								'<input type="hidden" name="childNum[]"></td>'+
								'<td width=75>First Name </td><td width=0><input type="text" name="firstName'+ i +'" size="25" value=""></td>'+
								'<td width=100>&nbsp;&nbsp; Middle Name </td><td width=0><input type="text" name="middleName'+ i +'" size="25" value=""></td>'+
								'<td width=85>&nbsp;&nbsp; Last Name </td><td width=0><input type="text" name="lastName'+ i +'" size="25" value=""></td>'+
							'</tr></table>'+
							
						'<td>'+
					'</tr><tr>'+
						'<td>'+
						
							'<table><tr>'+
								'<td width=75>Nick Name </td><td><input type="text" name="nickName'+ i +'" size="25" value=""></td>'+
								'<td>&nbsp;&nbsp; Family Position </td>'+
								'<td><select name="familyRank'+ i +'">'+
										'<option>Father</option><option>Mother</option><option value="Child">Scout</option></select></td>'+
								'<td>&nbsp;&nbsp; Troop Member Status </td><td><input type="checkbox" name="troopStatus'+ i +'" value="active" checked></td>'+
								'<td>&nbsp;&nbsp; Driver Status </td><td colspan="2"><input type="checkbox" name="driverStatus'+ i +'" value="active"></td>'+
							'</tr></table>'+
						'<td>'+
					'</tr><tr>'+
						'<td>'+
			
							'<table><tr>'+
								'<td>Troop Position </td>'+
								'<td>'+
									'<select name="patrolName'+ i +'">'+
										'<option></option>'+
										'<option>Advancement Chairman</option>'+
										'<option>Chaplain</option>'+
										'<option>Committee Chairman</option>'+
										'<option>Communications Coordinator</option>'+
										'<option>Court of Honor Banquet Coordinator</option>'+
										'<option>Historian</option>'+
										'<option>Merit Bade Clinic Coordinator</option>'+
										'<option>Merit Badge Counseling Coordinator</option>'+
										'<option>Membership Coordinator</option>'+
										'<option>Patrol Advisor</option>'+
										'<option>Program Coordinator</option>'+
										'<option>Scribe</option>'+
										'<option>Scout Master</option>'+
										'<option>Service Project Coordinator</option>'+
										'<option>Summer Camp Coordinator</option>'+
										'<option>Training Coordinator</option>'+
										'<option>Treasurer</option>'+
										'<option>Quarter Master</option>'+
									'</select>'+
								'<td>&nbsp;&nbsp; Scout Rank </td>'+
								'<td>'+
									'<select name="patrolName'+ i +'">'+
										'<option></option>'+
										'<option>Scout</option>'+
										'<option>Tenderfoot</option>'+
										'<option>Second Class</option>'+
										'<option>First Class</option>'+
										'<option>Star</option>'+
										'<option>Life</option>'+
										'<option>Eagle</option>'+
										'<option>Eagle Palms</option>'+
									'</select>'+
								'<td>&nbsp;&nbsp; Patrol Name </td>'+
								'<td>'+
									'<select name="patrolName'+ i +'">'+
										'<option></option>'+
										'<option>Bandit</option>'+
										'<option>King</option>'+
										'<option>Empire</option>'+
										'<option>Panther</option>'+
										'<option>Raven</option>'+
										'<option>Wolverine</option>'+
									'</select>'+
								'</td>'+
							'</tr></table>'+
								
						'</td>'+
					'</tr></table>';
	}
	if (document.layers) {
		document.layers.cust.document.write(data);
		document.layers.cust.document.close();
	}else{
		if (document.all) {
			cust.innerHTML = data;
		}
	}
}

function createMoto(motoNum) {
	data = "";    
	inter = "'";
	for (i=1; i <= motoNum; i++) {
		if(i % 2){
			col='#EEEEEE';
		}else{
			col='#FFFFFF';
		}
		data = data + '<table width="100%" align="center" border=0 cellspacing=0 cellpadding=0 bgcolor="'+ col +'" class="padding"><tr>'+
				'<td colspan="8"><b>Member\'s Vehicle Information for Vehicle #'+ i +': </b></td>'+
			'</tr><tr>'+
				'<td>Vehicle Type </td><td><select name="vehicleType'+ i +'" id="textFields">'+
											'<option>Car</option>'+
											'<option>Truck</option>'+
											'<option>SUV</option>'+
											'<option>Van</option>'+
											'</select></td>'+
				'<td>Maximum # of Passengers </td><td><input type="passengerNum" name="passNum'+ i +'" size="15" value="" id="textFields"></td>'+
				'<input type="hidden" name="motorNum[]"></td>'+
				'<td># of Safety Belts </td><td><input type="text" name="beltNum'+ i +'" size="15" value="" id="textFields"></td>'+
				'<td>License Plate # </td><td><input type="text" name="vehLicense'+ i +'" size="15" value="" id="textFields"></td>'+
			'</tr><tr>'+
				'<td>Vehicle Make</td><td><input type="text" name="make'+ i +'" size="15" value="" id="textFields"></td>'+
				'<td>Vehicle Model</td><td><input type="text" name="model'+ i +'" size="15" value="" id="textFields"></td>'+
				'<td>Vehicle Year</td><td><input type="text" name="year'+ i +'" size="15" value="" id="textFields"></td>'+
				'<td>Vehicle Owner</td><td><input type="text" name="owner'+ i +'" size="15" value="" id="textFields"></td>'+
			'</tr><tr>'+
				'<td>Insurance Company</td><td><input type="text" name="insComp'+ i +'" size="15" value="" id="textFields"></td>'+
				'<td>Coverage Amount: Person</td><td><input type="text" name="caPer'+ i +'" size="15" value="" id="textFields"></td>'+
				'<td>Coverage Amount: Property</td><td><input type="text" name="caProp'+ i +'" size="15" value="" id="textFields"></td>'+
				'<td>Coverage Amount: Accident</td><td><input type="text" name="caAcc'+ i +'" size="15" value="" id="textFields"></td>'+
			'</tr></table>';
				
	}
	if (document.layers) {
		document.layers.custmoto.document.write(data);
		document.layers.custmoto.document.close();
	}else{
		if (document.all) {
			custmoto.innerHTML = data;
		}
	}
}

function createComments(commentNum) {
	data = "";    
	inter = "'";
	for (i=1; i <= commentNum; i++) {
		if(i % 2){
			col='#EEEEEE';
		}else{
			col='#FFFFFF';
		}
		data = data + '<table width="100%" bgcolor="'+ col +'" class="padding"><tr>'+
				'<td align="center"><textarea name=commentAdd[] rows=10 cols=100></textarea></td>'+
			'</tr></table>';
				
	}
	if (document.layers) {
		document.layers.addComments.document.write(data);
		document.layers.addComments.document.close();
	}else{
		if (document.all) {
			addComments.innerHTML = data;
		}
	}
}
function createImage(number) {
	data = document.getElementById("morePhotos").innerHTML+'<input type="file" name="IMG'+number+'" style="font-size:10px; margin-bottom:2px;"> ';
	document.getElementById("morePhotos").innerHTML = data;
	document.getElementById("imgCount").value = number;
	//alert(number);
}
/*
function createImages(imageNum) {
	data = "";    
	inter = "'";
	for (i=1; i <= imageNum; i++) {
		if(i % 2){
			col='#EEEEEE';
		}else{
			col='#FFFFFF';
		}
		data = data + '<table width="100%" bgcolor="'+ col +'" class="padding"><tr>'+
				'<td align="left"><input type=file name=imageUp'+ i +' size=50>'+
				'<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000"></td>'+
			'</tr></table>';
				
	}
	if (document.layers) {
		document.layers.addImages.document.write(data);
		document.layers.addImages.document.close();
	}else{
		if (document.all) {
			addImages.innerHTML = data;
		}
	}
}
*/
//-->
