		//********************************************************************
		// SHOW/HIDE DIV AREA :  START
		//********************************************************************

		function toggle(mySelection){ 
			if (document.getElementById(mySelection).style.display == "none")
				document.getElementById(mySelection).style.display="block"; 
			else
				document.getElementById(mySelection).style.display="none"; 
		}
		function toggleValue(mySelection,thisValue){ 
			document.getElementById(mySelection).style.display=thisValue; 
		}

		//********************************************************************
		// SHOW/HIDE DIV AREA :  END
		//********************************************************************

		function showMessage(msg){
			alert(msg);
		}
		
		function relocateMe(thisUrl){
			location.replace(thisUrl);
		}

		function checkIfVoted(){
			retval = false;
			for (i=0;i<dovote.rank.length;i++)
			{
				if (dovote.rank[i].checked)
					retval = true;
			}
			
			if (!retval)
				alert('You must select your vote');
				
			return retval;
		}
		
		function checkIfVotedonBattle(thisVote,wouldBuy1,wouldBuy2,buySize1,buySize2){
			voted = false;
			msg = "";
			
			for (var i=0;i<thisVote.length;i++){
				if (thisVote[i].checked)
					voted = true;
			}
			if (!voted)
				msg = 'Must Check a vote';

			if (wouldBuy1.checked){
				if (buySize1.value == "none"){
					msg = msg + ' You must indicate size for design # 1 you indicated you would buy';
					voted = false;
				}
			}
			
			if (wouldBuy2.checked){
				if (buySize2.value == "none"){
					msg = msg + ' You must indicate size for design # 2 you indicated you would buy';
					voted = false;
				}
			}
				
			if (!voted)
				alert(msg);

			return voted;
		}


		function checkEntrySize(entryName,thisValue,maxLength)
		{
			if (thisValue.length > maxLength)
			{
				alert(entryName + " is longer than " + maxLength)
				return false; 	
			}
			else
				return true;
		}
		function textCounter(field,cntfield,maxlimit) {
			if (field.value.length > maxlimit) // if too long...trim it!
				field.value = field.value.substring(0, maxlimit);
				// otherwise, update 'characters left' counter
			else
				cntfield.value = maxlimit - field.value.length;
		}		
		function checkSearchString(thisField){
			retval = true;
			thisValue = thisField.value.rtrim();
			if (thisValue.length == 0){
				alert("Please enter a search string"); 
				retval = false;
			}
			return retval;
		}

		String.prototype.trim = function() {
			return this.replace(/^\s+|\s+$/g,"");
		}
		String.prototype.ltrim = function() {
			return this.replace(/^\s+/,"");
		}
		String.prototype.rtrim = function() {
			return this.replace(/\s+$/,"");
		}
		//********************************************************************
		// BILLING INFORMATION COPY :  START
		//********************************************************************

	function copyBilling()
	{
		if (checkout.same.checked)
		{
			checkout.ship_firstname.value = checkout.firstname.value;
			checkout.ship_lastname.value = checkout.Lastname.value;
			checkout.ship_add1.value = checkout.bill_add1.value;
			checkout.ship_add2.value = checkout.bill_add2.value;
			checkout.ship_add3.value = checkout.bill_add3.value;
			checkout.ship_city.value= checkout.bill_city.value;
			
			for (ii=0;ii<checkout.bill_state.options.length;ii++)
			{
				if (checkout.ship_state.options[ii].value == checkout.bill_state.value)
					checkout.ship_state.selectedIndex = ii;
			}
			//checkout.typedState.value = checkout.typedccState.value;
			checkout.ship_zip.value = checkout.bill_zip.value;
			for (ii=0;ii<checkout.bill_country.options.length;ii++)
			{
				if (checkout.ship_country.options[ii].value == checkout.bill_country.value)
					checkout.ship_country.selectedIndex = ii;
			}
			// country selected
		}
	}
	function check_checkout_info()
		{
			var dis_msg = "";
			var blank_name = true; blank_email = true; blank_zip = true;var read_terms = false;
			var msg_name="Name Field is REQUIRED \n";
			var msg_email="Email Address or Phone Number is REQUIRED \n";
			var msg_zip="Billing OR Shipping zip is REQUIRED \n";
			var msg_read_terms ="\nYou Must check the Purchase Terms to signify\n you have read and/or agree to the Purchase Terms\n"
			for (var row=0;row<checkout.name.value.length;row++)
				{
					if (checkout.name.value.charAt(row)!=' ')
						{
							blank_name=false;							
							break;
						}
				}	
			if (blank_name)
				dis_msg = msg_name;
				
			for (var row=0;row<checkout.email_address.value.length;row++)
				{
					if (checkout.email_address.value.charAt(row)!=' ')
						{
							blank_email=false;							
							break;
						}
				}	
			if (blank_email)
				{
					for (var row=0;row<checkout.phone.value.length;row++)
						{
							if (checkout.phone.value.charAt(row)!=' ')
								{
									blank_email=false;							
									break;
								}
						}	
				}
			if (blank_email)
				dis_msg = dis_msg + msg_email;
			for (var row=0;row<checkout.bill_zip.value.length;row++)
				{
					if (checkout.bill_zip.value.charAt(row)!=' ')
						{
							blank_zip=false;							
							break;
						}
				}	
			if (blank_zip)   ///check shipping zip if billing zip is blank
				{
					for (var row=0;row<checkout.ship_zip.value.length;row++)
						{
							if (checkout.ship_zip.value.charAt(row)!=' ')
								{
									blank_zip=false;							
									break;
								}
						}	
				}
			if (blank_zip)
				dis_msg = dis_msg + msg_zip;

			if (checkout.purchase_terms.checked == true)
				read_terms = true;				
			else
				dis_msg = dis_msg + msg_read_terms;
				
			if (blank_name || blank_email || blank_zip || !read_terms)
				{
					alert(dis_msg);
					return false;
				}
			else
				{
					return true;
				}

		}
		function setCardType()
		{
			payMethod.cctype_name.value = payMethod.CCType.options[payMethod.CCType.selectedIndex].text;
		}
		
		 var termsWindow;
		function open_terms(page)
			{
				termsWindow = window.open(page, "newWin", "height=450,width=680,height=450,width=680,titlebar=no,left=10,top=10,scrollbars=yes,resizable=yes");
			}		
		function close_terms()
			{
				if (termsWindow && termsWindow.open && !termsWindow.closed) termsWindow.close();			
			}

		//********************************************************************
		// BILLING INFORMATION COPY :  END
		//********************************************************************

	
		
		//********************************************************************
		// MOVING FRIEND EMAIL ADDRESSES FROM BOX TO BOX :  START
		//********************************************************************
		

	function ClearList(OptionList, TitleName) 
	{
		OptionList.length = 0;
	}
		
	function move(side,fromLocation,toLocation)
	{   
		var temp1 = new Array();
		var temp2 = new Array();
		var tempa = new Array();
		var tempb = new Array();
		var current1 = 0;
		var current2 = 0;
		var y=0;
		var attribute;
		
		//assign what select attribute treat as attribute1 and attribute2
		if (side == "right")
		{  
			attribute1 = fromLocation; 
			attribute2 = toLocation; 
		}
		else
		{  
			attribute1 = toLocation; 
			attribute2 = fromLocation; 
		}
	
		//fill an array with old values
		for (var i = 0; i < attribute2.length; i++)
		{  
			y=current1++
			temp1[y] = attribute2.options[i].value;
			tempa[y] = attribute2.options[i].text;
		}
	
		//assign new values to arrays
		for (var i = 0; i < attribute1.length; i++)
		{   
			if ( attribute1.options[i].selected )
			{  
				y=current1++
				temp1[y] = attribute1.options[i].value;
				tempa[y] = attribute1.options[i].text;
			}
			else
			{  
				y=current2++
				temp2[y] = attribute1.options[i].value; 
				tempb[y] = attribute1.options[i].text;
			}
		}
	
		//generating new options 
		for (var i = 0; i < temp1.length; i++)
		{  
			attribute2.options[i] = new Option();
			attribute2.options[i].value = temp1[i];
			attribute2.options[i].text =  tempa[i];
		}
	
		//generating new options
		ClearList(attribute1,attribute1);
		if (temp2.length>0)
		{	
			for (var i = 0; i < temp2.length; i++)
			{   
				attribute1.options[i] = new Option();
				attribute1.options[i].value = temp2[i];
				attribute1.options[i].text =  tempb[i];
			}
		}
	}
	
	function addNewAttr(){
		new_option = document.forwardFriend.selectedFriends.length;
		document.forwardFriend.selectedFriends.options[new_option] = new Option();
		document.forwardFriend.selectedFriends.options[new_option].value = document.forwardFriend.new_friend_email.value;
		document.forwardFriend.selectedFriends.options[new_option].text =  document.forwardFriend.new_friend_email.value;
		document.forwardFriend.new_friend_email.value = "";
		
	
	}
	
	function submit_this(thisBox,submitForm,showMessage){
		//thisBox = document.getElementById(thisBoxId); 
			if (thisBox.length > 0){
				for (i = 0; i<thisBox.length; i++){
					thisBox.options[i].selected = true;
				}
				sub_this=true;
			}
			else{
				if (showMessage)
					alert('You must choose or enter at least one email address');

				sub_this = false;
				
			}
			
		if (submitForm)
		{
			if (sub_this){
				forwardFriend.submit();
			}
		}
	
	}
		//********************************************************************
		// MOVING FRIEND EMAIL ADDRESSES FROM BOX TO BOX :  END
		//********************************************************************
		



		//********************************************************************
		// EMAIL VALIDATION : START
		//********************************************************************
		
			function echeck(str) {
	
			var at="@";
			var dot=".";
			var lat=str.indexOf(at);
			var lstr=str.length;
			var ldot=str.indexOf(dot);
			if (str.indexOf(at)==-1){
			   alert("Invalid E-mail Address");
			   return false;
			}
	
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			   alert("Invalid E-mail Address");
			   return false;
			}
	
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			    alert("Invalid E-mail Address");
			    return false;
			}
	
			 if (str.indexOf(at,(lat+1))!=-1){
			    alert("Invalid E-mail Address");
			    return false;
			 }
	
			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			    alert("Invalid E-mail Address");
			    return false;
			 }
	
			 if (str.indexOf(dot,(lat+2))==-1){
			    alert("Invalid E-mail Address");
			    return false;
			 }
			
			 if (str.indexOf(" ")!=-1){
			    alert("Invalid E-mail Address");
			    return false;
			 }
	 		 return true;					
		}

		function ValidateForm(){
			var emailID=document.forwardFriend.new_friend_email;
			var returnVal = true;
			if ((emailID.value==null)||(emailID.value=="")){
				alert("Please Enter your Email Address")
				emailID.focus();
				returnVal = false;
			}
			else
			{
				if (echeck(emailID.value)==false){
				emailID.value="";
				emailID.focus();
				returnVal = false;
				}
			}
			if (returnVal)
				addNewAttr();
		 }
		 function ValidateEmailString(thisEmail){
			var returnVal = true;
			if ((thisEmail==null)||(thisEmail=="")){
				alert("Please Enter your Email Address")
				returnVal = false;
			}
			else
			{
				if (echeck(thisEmail)==false){
				returnVal = false;
				}
			}
			return returnVal;
		 }
 		//********************************************************************
		// EMAIL VALIDATION : END
		//********************************************************************
		
		function setupContestDates(endDateLength, endSubmissionDateLength)
		{
			Contests.ContestEndDate.value = dateFormat(DateAdd('d',endDateLength,Contests.ContestStartDate.value),"!mm/!dd/!yyyy");
			Contests.ContestSubmission_end_dt.value = dateFormat(DateAdd('d',endSubmissionDateLength,Contests.ContestStartDate.value),"!mm/!dd/!yyyy");
		}