var imageList = new Array("/images/skittleAnimationBackward.gif","/images/skittleAnimationForward.gif");
var imageNum = 0;


// SelectAll() function definition
// Select enter field on click
function SelectAll(id)
{
	document.getElementById(id).focus();
	document.getElementById(id).select();
}

// ViewChange() function definition
// Select enter field on click
function ViewChange(id)
{

}

// SwitchPicBrochure() function definition
// Switches images after allotted time 
function SwitchPicBrochure() 
{
	if (document.images) 
	{
		if (imageNum==1) 
		{
			document.imgTickerBrochure.src = imageList[imageNum];
			setTimeout("SwitchPicBrochure()",2000);
			imageNum=0;
		}
		else 
		{
			document.imgTickerBrochure.src = imageList[imageNum];
			setTimeout("SwitchPicBrochure()",2000);
			imageNum++;
		}
	}
} // end SwitchPicBrochure()


// ShowSearchingProgress() function definition
// Show searching progress
function ShowSearchingProgress()
{

} // end ShowSearchingProgress()


// ShowTransmitBrochure() function definition
// Show transmit message and image
function ShowTransmitBrochure()
{
	SwitchPicBrochure();
// GetObj("btnFindBrochure").disabled = true;
	GetObj("trTransmitMsgBrochure").style.display = document.all ? "block" : "table-row";
	GetObj("trTransmitImageBrochure").style.display = document.all ? "block" : "table-row";
} // end ShowTransmitBrochure()

// ValidBrochureSubmit() function definition
// checks if all necessary fields were filled correctly before submission
function ValidBrochureSubmit(hForm)
{	
	if (isEmpty(hForm.lmQuantity, "Please choose the number of brochures you would like to order."))
	{
		return false;
	} // end if
	
	if (isEmpty(hForm.lmDimensions, "Please choose the dimensions of the piece."))
	{
		return false;
	} // end if

	if (isEmpty(hForm.lmPaperType, "Please choose the type of paper you would like to use."))
	{
		return false;
	} // end if
	
	if (isEmpty(hForm.lmFolding, "Please choose a folding option for your brochure."))
	{
		return false;
	} // end if
	
	if (!isValidZip(hForm.tfZipCode, "Please enter a valid 5-digit zip code for where your order will be sent."))
	{
		return false;
	} // end if
	
//	ShowTransmitBrochure();
	return true;

} // end ValidBrochureSubmit()


// SwitchPicFlyer() function definition
// Switches images after allotted time 
function SwitchPicFlyer() 
{
	if (document.images) 
	{
		if (imageNum==1) 
		{
			document.imgTickerFlyer.src = imageList[imageNum];
			setTimeout("SwitchPicFlyer()",2000);
			imageNum=0;
		}
		else 
		{
			document.imgTickerFlyer.src = imageList[imageNum];
			setTimeout("SwitchPicFlyer()",2000);
			imageNum++;
		}
	}
} // end SwitchPicFlyer()

// ShowTransmitFlyer() function definition
// Show transmit message and image
function ShowTransmitFlyer()
{
	SwitchPicFlyer();
//	GetObj("btnFindFlyer").disabled = true;
	GetObj("trTransmitMsgFlyer").style.display = document.all ? "block" : "table-row";
	GetObj("trTransmitImageFlyer").style.display = document.all ? "block" : "table-row";
} // end ShowTransmitFlyer()

// ValidFlyerSubmit() function definition
// checks if all necessary fields were filled correctly before submission
function ValidFlyerSubmit(hForm)
{
	
	if (isEmpty(hForm.lmQuantity, "Please choose the number of flyers you would like to order."))
	{
		return false;
	} // end if
	
	if (isEmpty(hForm.lmDimensions, "Please choose the dimensions of the piece."))
	{
		return false;
	} // end if

	if (isEmpty(hForm.lmPaperType, "Please choose the type of paper you would like to use."))
	{
		return false;
	} // end if
	
	if (isEmpty(hForm.lmColors, "Please choose the colors for your flyer."))
	{
		return false;
	} // end if
	
	if (!isValidZip(hForm.tfZipCode, "Please enter a valid 5-digit zip code for where your order will be sent."))
	{
		return false;
	} // end if
	
//	ShowTransmitFlyer();
	return true;

} // end ValidFlyerSubmit()


// SwitchPicPostcard() function definition
// Switches images after allotted time 
function SwitchPicPostcard() 
{
	if (document.images) 
	{
		if (imageNum==1) 
		{
			document.imgTickerPostcard.src = imageList[imageNum];
			setTimeout("SwitchPicPostcard()",2000);
			imageNum=0;
		}
		else 
		{
			document.imgTickerPostcard.src = imageList[imageNum];
			setTimeout("SwitchPicPostcard()",2000);
			imageNum++;
		}
	}
} // end SwitchPicPostcard()
	
// ShowTransmitPostcard() function definition
// Show transmit message and image
function ShowTransmitPostcard()
{
	SwitchPicPostcard();
// GetObj("btnFind").disabled = true;
	GetObj("trTransmitMsgPostcard").style.display = document.all ? "block" : "table-row";
	GetObj("trTransmitImagePostcard").style.display = document.all ? "block" : "table-row";
} // end ShowTransmitPostcard()

// ValidPostcardSubmit() function definition
// checks if all necessary fields were filled correctly before submission
function ValidPostcardSubmit(hForm)
{

	if (isEmpty(hForm.lmQuantity, "Please choose the number of postcards you would like to order."))
	{
		return false;
	} // end if
	
	if (isEmpty(hForm.lmDimensions, "Please choose the dimensions of the piece."))
	{
		return false;
	} // end if

	if (isEmpty(hForm.lmPaperType, "Please choose the type of paper you would like to use."))
	{
		return false;
	} // end if
	
	if (isEmpty(hForm.lmColors, "Please choose the colors for your postcard."))
	{
		return false;
	} // end if
	
	if (!isValidZip(hForm.tfZipCode, "Please enter a valid 5-digit zip code for where your order will be sent."))
	{
		return false;
	} // end if
	
//	ShowTransmitPostcard();
	return true;

} // end ValidPostcardSubmit()


// SwitchPicBusinessCard() function definition
// Switches images after allotted time 
function SwitchPicBusinessCard() 
{
	if (document.images) 
	{
		if (imageNum==1) 
		{
			document.imgTickerBusinessCard.src = imageList[imageNum];
			setTimeout("SwitchPicBusinessCard()",2000);
			imageNum=0;
		}
		else 
		{
			document.imgTickerBusinessCard.src = imageList[imageNum];
			setTimeout("SwitchPicBusinessCard()",2000);
			imageNum++;
		}
	}
} // end SwitchPicBusinessCard()

// ShowTransmitBusinessCard() function definition
// Show transmit message and image
function ShowTransmitBusinessCard()
{
	SwitchPicBusinessCard();
// GetObj("btnFind").disabled = true;
	GetObj("trTransmitMsgBusinessCard").style.display = document.all ? "block" : "table-row";
	GetObj("trTransmitImageBusinessCard").style.display = document.all ? "block" : "table-row";
} // end ShowTransmitBusinessCard()

// ValidBusinessCardSubmit() function definition
// checks if all necessary fields were filled correctly before submission
function ValidBusinessCardSubmit(hForm)
{
	
	if (isEmpty(hForm.lmQuantity, "Please choose the number of business cards you would like to order."))
	{
		return false;
	} // end if

	if (isEmpty(hForm.lmPaperType, "Please choose the type of paper you would like to use."))
	{
		return false;
	} // end if
	
	if (isEmpty(hForm.lmColors, "Please choose the colors for your business card."))
	{
		return false;
	} // end if
	
	if (!isValidZip(hForm.tfZipCode, "Please enter a valid 5-digit zip code for where your order will be sent."))
	{
		return false;
	} // end if
	
//	ShowTransmitBusinessCard();
	return true;

} // end ValidBusinessCardSubmit()

// ShowSelectedQueryType() function definition
// Displays the currently selected query type
function ShowSelectedQueryType(p_sType)
{
	if (p_sType == "Brochures") 
	{
		GetObj("createbrochures").style.display = document.all ? "block" : "table-cell";
		GetObj("createflyers").style.display = "none";
		GetObj("createpostcards").style.display = "none";			
		GetObj("createbusinesscards").style.display = "none";

		GetObj("brochurespromo").style.display = document.all ? "block" : "table-cell";
		GetObj("flyerspromo").style.display = "none";
		GetObj("postcardspromo").style.display = "none";			
		GetObj("businesscardspromo").style.display = "none";			

	}
	else if (p_sType == "Flyers")
	{
		GetObj("createbrochures").style.display = "none";
		GetObj("createflyers").style.display = document.all ? "block" : "table-cell";
		GetObj("createpostcards").style.display = "none";			
		GetObj("createbusinesscards").style.display = "none";

		GetObj("brochurespromo").style.display = "none";
		GetObj("flyerspromo").style.display= document.all ? "block" : "table-cell";
		GetObj("postcardspromo").style.display = "none";			
		GetObj("businesscardspromo").style.display = "none";		

	}
	else if (p_sType == "Postcards")
	{
		GetObj("createbrochures").style.display = "none";
		GetObj("createflyers").style.display = "none";
		GetObj("createpostcards").style.display = document.all ? "block" : "table-cell";
		GetObj("createbusinesscards").style.display = "none";	
		
		GetObj("brochurespromo").style.display = "none";
		GetObj("flyerspromo").style.display = "none";
		GetObj("postcardspromo").style.display= document.all ? "block" : "table-cell";
		GetObj("businesscardspromo").style.display = "none";					

	}
	else if (p_sType == "BusinessCards")
	{
		GetObj("createbrochures").style.display = "none";
		GetObj("createflyers").style.display = "none";
		GetObj("createpostcards").style.display = "none";			
		GetObj("createbusinesscards").style.display = document.all ? "block" : "table-cell";
		
		GetObj("brochurespromo").style.display = "none";
		GetObj("flyerspromo").style.display = "none";
		GetObj("postcardspromo").style.display = "none";			
		GetObj("businesscardspromo").style.display= document.all ? "block" : "table-cell";

	}	
}
