// Function to change the style on mouse over for the left nav menu items
function changeMenuItem(tdID, tdClass, linkID, linkClass) {
	document.getElementById(tdID).className = tdClass;
	document.getElementById(linkID).className = linkClass;
}

// Function to create links for table cells
function gotoLink(linkURL) {
	document.URL = linkURL;
}


 function ltrim(str) { return str.replace(/(^\s*)/g, ""); }
  function rtrim(str) { return str.replace(/(\s*$)/g, ""); }
  function trim(str)  { return ltrim(rtrim(str));}

function validateCountry(ddbox, textField, statebox){
	
	//alert("in validateCountry", stateBox index="+statebox.selectedIndex);
	if(ddbox[ddbox.selectedIndex].value != "United States" && ddbox[ddbox.selectedIndex].value != "Canada")
	{		
		if(ddbox == document.orderForm.WEB_ORDER_BILLING_COUNTRY)
			document.getElementById('stateAsterisk').style.visibility = "hidden";
		else
			document.getElementById('stateAsterisk2').style.visibility = "hidden";
					
		if(statebox.selectedIndex != 0){
				 statebox.selectedIndex = 0; 
		}
	}	
	else{
	
  	if(ddbox == document.orderForm.WEB_ORDER_BILLING_COUNTRY)
			document.getElementById('stateAsterisk').style.visibility = "visible";
		else
			document.getElementById('stateAsterisk2').style.visibility = "visible";
	}
	//fill Country Name for Email purposes
	textField.value = ddbox[ddbox.selectedIndex].text;
	
	//calculate shipping charges if it's not shipped to the United States
	calculateShipping();	
	
}

function resetTax(){
	if(document.orderForm.WEB_ORDER_EXEMPT.checked)
		document.orderForm.WEB_ORDER_TAX.value = "0.00";
	else
		calculateTax();
	
	calculateTotal();	 	 

}
	
	function toggleblocks (postid) 
		{	
			
	//alert('hello');			
		//clear all the shipping fields.
	 document.orderForm.WEB_ORDER_SHIPPING_NAME.value = "" ;
	 document.orderForm.WEB_ORDER_SHIPPING_ADDRESS1.value = "";
	 document.orderForm.WEB_ORDER_SHIPPING_ADDRESS2.value = "";
	 document.orderForm.WEB_ORDER_SHIPPING_CITY.value = ""
	 //document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.selectedIndex = 0; 
	 document.orderForm.WEB_ORDER_SHIPPING_STATE.selectedIndex = 0;
	 document.orderForm.WEB_ORDER_SHIPPING_ZIP.value = "";
	
	
	 document.orderForm.WEB_ORDER_SUMMER_SHIPPING_NAME.value = "";
	 document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ADDRESS1.value= "";
	  document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ADDRESS2.value= "";
	 document.orderForm.WEB_ORDER_SUMMER_SHIPPING_CITY.value = "" ;
	 //document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.selectedIndex = 0 ;
	 document.orderForm.WEB_ORDER_SUMMER_SHIPPING_STATE.selectedIndex = 0 ;
	 document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ZIP.value = "";
			    
			    	
		var whichpost = document.getElementById(postid);
		var winterpost = document.getElementById('winterShippingDiv');
		var recepientpost = document.getElementById('recepientShippingDiv');
		var leftpost = document.getElementById('left');
	
			if (whichpost.className=="expandBlock")
			{
				whichpost.className="collapseBlock";
				winterpost.className="collapseBlock";
				recepientpost.className="expandBlock";
				leftpost.setAttribute("height","900");
				}	
			else {
				whichpost.className="expandBlock";
				winterpost.className="expandBlock";
				recepientpost.className="collapseBlock";
			  leftpost.setAttribute("height","1100");
			}
		

	}	
	
function resetShippingAddressBox(){
	 	 

}	
function fillShippingAddress(){
	
	if(document.orderForm.sameAddress.checked && trim(document.orderForm.WEB_ORDER_SHIPPING_ADDRESS1.value) == "")
	{
		document.orderForm.WEB_ORDER_SHIPPING_NAME.value = trim(document.orderForm.WEB_ORDER_FIRST_NAME.value) + " " + trim(document.orderForm.WEB_ORDER_LAST_NAME.value);
		document.orderForm.WEB_ORDER_SHIPPING_ADDRESS1.value = trim(document.orderForm.WEB_ORDER_BILLING_ADDRESS1.value);
		document.orderForm.WEB_ORDER_SHIPPING_ADDRESS2.value = trim(document.orderForm.WEB_ORDER_BILLING_ADDRESS2.value);
		document.orderForm.WEB_ORDER_SHIPPING_CITY.value = trim(document.orderForm.WEB_ORDER_BILLING_CITY.value);
		document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.selectedIndex = document.orderForm.WEB_ORDER_BILLING_COUNTRY.selectedIndex;
		document.orderForm.WEB_ORDER_SHIPPING_STATE.selectedIndex = document.orderForm.WEB_ORDER_BILLING_STATE.selectedIndex;	
		document.orderForm.WEB_ORDER_SHIPPING_ZIP.value = trim(document.orderForm.WEB_ORDER_BILLING_ZIP.value);
	}
  else if(!document.orderForm.sameAddress.checked)
  {
  	document.orderForm.WEB_ORDER_SHIPPING_NAME.value = "";
		document.orderForm.WEB_ORDER_SHIPPING_ADDRESS1.value = "";
		document.orderForm.WEB_ORDER_SHIPPING_ADDRESS2.value = "";
		document.orderForm.WEB_ORDER_SHIPPING_CITY.value = "";
		document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.selectedIndex = 0;
		document.orderForm.WEB_ORDER_SHIPPING_STATE.selectedIndex = 0;	
		document.orderForm.WEB_ORDER_SHIPPING_ZIP.value = "";
  }
  calculateShipping();  
}

function fillSummerShippingAddress(){
	
	if(document.orderForm.sameShippingAddress.checked && trim(document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ADDRESS1.value) == "")
	{
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_NAME.value = trim(document.orderForm.WEB_ORDER_SHIPPING_NAME.value);
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ADDRESS1.value = trim(document.orderForm.WEB_ORDER_SHIPPING_ADDRESS1.value);
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ADDRESS2.value = trim(document.orderForm.WEB_ORDER_SHIPPING_ADDRESS2.value);
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_CITY.value = trim(document.orderForm.WEB_ORDER_SHIPPING_CITY.value);
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.selectedIndex = document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.selectedIndex;
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_STATE.selectedIndex = document.orderForm.WEB_ORDER_SHIPPING_STATE.selectedIndex;	
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ZIP.value = trim(document.orderForm.WEB_ORDER_SHIPPING_ZIP.value);
	}
  else if(!document.orderForm.sameShippingAddress.checked)
  {
  	document.orderForm.WEB_ORDER_SUMMER_SHIPPING_NAME.value = "";
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ADDRESS1.value = "";
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ADDRESS2.value = "";
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_CITY.value = "";
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.selectedIndex = 0;
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_STATE.selectedIndex = 0;	
		document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ZIP.value = "";
  }		
}

function round (n) {
    
     n = Math.round(n * 100) / 100;
     n = (n + .001) + "";
     return n.substring(0, n.indexOf('.') + 3);
  }
   
function calculateShipping(){
 	
 	document.orderForm.WEB_ORDER_SHIPPING.value  = "0.00";
 	
 	if(document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.value != "United States" && document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.value != "")
 	{
 			document.orderForm.WEB_ORDER_SHIPPING.value = "24.00";
 			
 			if(document.orderForm.WEB_ORDER_BILLING_COUNTRY.value != "Canada" && document.orderForm.WEB_ORDER_SHIPPING_STATE.selectedIndex != 0){
 				document.orderForm.WEB_ORDER_SHIPPING_STATE.selectedIndex = 0;
 			}				
	 }	
	calculateTax();
}
	  
function calculateTax(){
	
	document.orderForm.WEB_ORDER_TAX.value = "0.00";
	var webOrderPriceJs = "0.0";
	if(document.orderForm.WEB_ORDER_PRICE)	
		webOrderPriceJs=document.orderForm.WEB_ORDER_PRICE.value;
	if(document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.value == "United States" && document.orderForm.WEB_ORDER_SHIPPING_STATE.value == "NY" && !document.orderForm.WEB_ORDER_EXEMPT.checked)
	{
		document.orderForm.WEB_ORDER_TAX.value = round(document.orderForm.WEB_ORDER_QUANTITY.value * webOrderPriceJs * 0.08375);		 
	}
  else
	{
		 document.orderForm.WEB_ORDER_TAX.value = "0.00";
		 document.orderForm.WEB_ORDER_EXEMPT.checked = false;
	}	
	calculateTotal();	 	 
}

function calculateTotal(){
	var webOrderPriceJs = "0.0";
	if(document.orderForm.WEB_ORDER_PRICE)	
		webOrderPriceJs=document.orderForm.WEB_ORDER_PRICE.value;
	var qnty = trim(document.orderForm.WEB_ORDER_QUANTITY.value);
		
	if(qnty != "" && qnty.substring(0,1) != "0")
		document.orderForm.WEB_ORDER_TOTAL.value = round((document.orderForm.WEB_ORDER_QUANTITY.value * webOrderPriceJs)+ 1*document.orderForm.WEB_ORDER_TAX.value + 1*document.orderForm.WEB_ORDER_SHIPPING.value);
	else
		{
			alert("Please enter valid Quantity.");
			document.orderForm.WEB_ORDER_QUANTITY.focus();
		}
}

function fixNumber(number) {
				tmpNumber = new NumberFormat(number);
				tmpNumber.setCommas(false);
				tmpNumber.setPlaces(2);
				tmpNumber.setCurrencyPrefix('');
				return(tmpNumber.toFormatted());
}


function fixNumericDataWithPeriod(field){
  if(field)
  {

  field.value = parseFloat(field.value);

 	if (isNaN(field.value))
	 {
	      while (isNaN(field.value))
	      {

	           field.value = field.value.substring(0,field.value.length-1);

	      }


	 }
 }
}


function fixNumericData(objField){
	
	/*Won't let user enter a non-numeric value into a given field*/	  	 
			 objField.value = trim(objField.value);
	  	 if(objField)
	  	 {
		  		if (isNaN(objField.value)) 
		      { 
		           while (isNaN(objField.value)) 
		           { 
		                objField.value = objField.value.substring(0,objField.value.length-1); 
		           }
		      }
		  } 
	 }

function applyOrder(){
	var err = false;
	var errMess = "";	
	var email = trim(document.orderForm.WEB_ORDER_EMAIL_ADDRESS.value);	
	var recepientpost = document.getElementById('recepientShippingDiv');	
	//do validation here
	if(trim(document.orderForm.WEB_ORDER_FIRST_NAME.value) == ""){err = true; errMess = "Please enter First Name\n"; document.orderForm.WEB_ORDER_FIRST_NAME.focus();} 
	if(trim(document.orderForm.WEB_ORDER_LAST_NAME.value) == "" && !err){err = true; errMess = "Please enter Last Name\n"; document.orderForm.WEB_ORDER_LAST_NAME.focus();} 
	if((email == "" || email == "" || email.indexOf("@") == -1 || email.indexOf("@") == 0 || email.indexOf("@") == (email.length - 1) || email.indexOf(".") == -1 || email.indexOf(".") == (email.length - 1) || email.indexOf("@") + 1 == email.indexOf(".") || email.indexOf(".") + 1 == email.indexOf("@") ) && !err){
	  errMess += "Please enter valid Email Address\n";
	  document.orderForm.WEB_ORDER_EMAIL_ADDRESS.focus();
	  err = true;
	}
	if(trim(document.orderForm.WEB_ORDER_HOME_PHONE.value) == "" && !err){err = true; errMess = "Please enter Home Phone\n"; document.orderForm.WEB_ORDER_HOME_PHONE.focus();} 
	if(trim(document.orderForm.WEB_ORDER_QUANTITY.value) == "" && !err){err = true; errMess = "Please enter Quantity\n"; document.orderForm.WEB_ORDER_QUANTITY.focus();} 
	if(trim(document.orderForm.WEB_ORDER_BILLING_ADDRESS1.value) == "" && !err){err = true; errMess = "Please enter Billing Address\n"; document.orderForm.WEB_ORDER_BILLING_ADDRESS1.focus();} 
	if(trim(document.orderForm.WEB_ORDER_BILLING_CITY.value) == "" && !err){err = true; errMess = "Please enter Billing City\n"; document.orderForm.WEB_ORDER_BILLING_CITY.focus();} 
	if(document.orderForm.WEB_ORDER_BILLING_COUNTRY.selectedIndex == 0 && !err){err = true; errMess = "Please select Billing Country\n"; document.orderForm.WEB_ORDER_BILLING_COUNTRY.focus();} 
	if(((document.orderForm.WEB_ORDER_BILLING_STATE.selectedIndex == 0 && (document.orderForm.WEB_ORDER_BILLING_COUNTRY.options[document.orderForm.WEB_ORDER_BILLING_COUNTRY.selectedIndex].value == "United States" || document.orderForm.WEB_ORDER_BILLING_COUNTRY.options[document.orderForm.WEB_ORDER_BILLING_COUNTRY.selectedIndex].value == "Canada")) || (document.orderForm.WEB_ORDER_BILLING_STATE.selectedIndex != 0 && document.orderForm.WEB_ORDER_BILLING_COUNTRY.options[document.orderForm.WEB_ORDER_BILLING_COUNTRY.selectedIndex].value != "United States" && document.orderForm.WEB_ORDER_BILLING_COUNTRY.options[document.orderForm.WEB_ORDER_BILLING_COUNTRY.selectedIndex].value != "Canada")) && !err){err = true; errMess = "Please select valid Billing State and/or Country\n"; document.orderForm.WEB_ORDER_BILLING_STATE.focus();} 	
	if(trim(document.orderForm.WEB_ORDER_BILLING_ZIP.value) == "" && !err){err = true; errMess = "Please enter Billing Postal Code\n"; document.orderForm.WEB_ORDER_BILLING_ZIP.focus();} 
	if (recepientpost.className=="collapseBlock")
	{
	 if(trim(document.orderForm.WEB_ORDER_SHIPPING_NAME.value) == "" && !err){err = true; errMess = "Please enter Name for Winter Address\n"; document.orderForm.WEB_ORDER_SHIPPING_NAME.focus();} 
	}else {
	if(trim(document.orderForm.WEB_ORDER_SHIPPING_NAME.value) == "" && !err){err = true; errMess = "Please enter Name for Recipient's  Address\n"; document.orderForm.WEB_ORDER_SHIPPING_NAME.focus();} 
	}
	if(trim(document.orderForm.WEB_ORDER_SHIPPING_ADDRESS1.value) == "" && !err){err = true; errMess = "Please enter Shipping Address\n"; document.orderForm.WEB_ORDER_SHIPPING_ADDRESS1.focus();}
	if(trim(document.orderForm.WEB_ORDER_SHIPPING_CITY.value) == "" && !err){err = true; errMess = "Please enter Shipping City\n"; document.orderForm.WEB_ORDER_SHIPPING_CITY.focus();} 
	if(document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.selectedIndex == 0 && !err){err = true; errMess = "Please select Shipping Country\n"; document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.focus();} 
	if(((document.orderForm.WEB_ORDER_SHIPPING_STATE.selectedIndex == 0 && (document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.options[document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.selectedIndex].value == "United States" || document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.options[document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.selectedIndex].value == "Canada")) || (document.orderForm.WEB_ORDER_SHIPPING_STATE.selectedIndex != 0 && document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.options[document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.selectedIndex].value != "United States" && document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.options[document.orderForm.WEB_ORDER_SHIPPING_COUNTRY.selectedIndex].value != "Canada")) && !err){err = true; errMess = "Please select valid Shipping State and/or Country\n"; document.orderForm.WEB_ORDER_SHIPPING_STATE.focus();} 	
	if(trim(document.orderForm.WEB_ORDER_SHIPPING_ZIP.value) == "" && !err){err = true; errMess = "Please enter Shipping Postal Code\n"; document.orderForm.WEB_ORDER_SHIPPING_ZIP.focus();} 
	
	//alert(recepientpost.className);
	if (recepientpost.className=="collapseBlock")
	{
	if(trim(document.orderForm.WEB_ORDER_SUMMER_SHIPPING_NAME.value) == "" && !err){err = true; errMess = "Please enter Name for Summer Address\n"; document.orderForm.WEB_ORDER_SUMMER_SHIPPING_NAME.focus();} 
	if(trim(document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ADDRESS1.value) == "" && !err){err = true; errMess = "Please enter Summer Shipping Address\n"; document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ADDRESS1.focus();}
	if(trim(document.orderForm.WEB_ORDER_SUMMER_SHIPPING_CITY.value) == "" && !err){err = true; errMess = "Please enter Summer Shipping City\n"; document.orderForm.WEB_ORDER_SUMMER_SHIPPING_CITY.focus();} 
	if(document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.selectedIndex == 0 && !err){err = true; errMess = "Please select Summer Shipping Country\n"; document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.focus();} 
	if(((document.orderForm.WEB_ORDER_SUMMER_SHIPPING_STATE.selectedIndex == 0 && (document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.options[document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.selectedIndex].value == "United States" || document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.options[document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.selectedIndex].value == "Canada")) || (document.orderForm.WEB_ORDER_SUMMER_SHIPPING_STATE.selectedIndex != 0 && document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.options[document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.selectedIndex].value != "United States" && document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.options[document.orderForm.WEB_ORDER_SUMMER_SHIPPING_COUNTRY.selectedIndex].value != "Canada")) && !err){err = true; errMess = "Please select valid Summer Shipping State and/or Country\n"; document.orderForm.WEB_ORDER_SUMMER_SHIPPING_STATE.focus();} 	
	if(trim(document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ZIP.value) == "" && !err){err = true; errMess = "Please enter Summer Shipping Postal Code\n"; document.orderForm.WEB_ORDER_SUMMER_SHIPPING_ZIP.focus();} 
  }
   		
	
	////reset Tax Exempt checkbox if Tax Amount is 0.00
	//if(document.orderForm.WEB_ORDER_TAX.value == "0.00"){
	//		document.orderForm.WEB_ORDER_EXEMPT.checked = false;
	//}
				
	if(!err)
	 {
	 		
	 		document.orderForm.admaction.value = "process_order";
	 		document.orderForm.submit();	
	 }
	else
		alert(errMess);
}


// **** Social Register Observer Validation Form  **** //

function validateEmail(str){	

	var chkEmail  = /((^[a-z]|\d)([a-z_\.\d]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
  return chkEmail.test(str);
}

function validateSRO(form){
	var bool = true;
	address = '';
	if(form)
	{
		address = (trim(form.SRO_BLANK_ADDRESS1.value) + trim(form.SRO_BLANK_ADDRESS2.value));
		
		if(trim(form.SRO_BLANK_NAME.value)=='')
		{
			alert("Please provide a name.");
			form.SRO_BLANK_NAME.focus();
			bool = false;
		}
		else if( address =='')
		{
			alert("Please provide an address.");
			form.SRO_BLANK_ADDRESS1.focus();
			bool = false;
		}
		else if(trim(form.SRO_BLANK_CITY.value)=='')
		{
			alert("Please provide a city.");
			form.SRO_BLANK_CITY.focus();
			bool = false;
		}		
		else if(trim(form.SRO_BLANK_STATE.value) == '')
		{				
				if( (trim(form.SRO_BLANK_COUNTRY.value)== 'United States' || trim(form.SRO_BLANK_COUNTRY.value)== 'Canada') )
				{
					err = "Please provide a state.\t";
					form.SRO_BLANK_STATE.focus();
					bool = false;			
					alert(err);
				}
		}
		else if(trim(form.SRO_BLANK_COUNTRY.value) == '')
		{			
				err = "Please select a country.\t";
				form.SRO_BLANK_COUNTRY.focus();
				bool = false;			
				alert(err);
		}
		else if(trim(form.SRO_BLANK_ZIP.value) == ''){
			if( (trim(form.SRO_BLANK_COUNTRY.value)== 'United States' || trim(form.SRO_BLANK_COUNTRY.value)== 'Canada') ){
				err = "Please provide a zip code.\t";
				bool = false;		
				form.SRO_BLANK_ZIP.focus();	
				alert(err);
			}
		}
		else if(trim(form.SRO_BLANK_EMAIL.value) == ''){
				err = "Please provide an email address.\t";
				form.SRO_BLANK_EMAIL.focus();
				bool = false;			
				alert(err);
		}
		
		else if( !validateEmail( trim(form.SRO_BLANK_EMAIL.value) ) ){
				err = "Please provide an valid email address.\t";
				form.SRO_BLANK_EMAIL.focus();
				bool = false;			
				alert(err);
		}		
		else if(trim(form.SRO_BLANK_PHOTO_FILE_1.value) != '' || trim(form.SRO_BLANK_PHOTO_FILE_2.value) != '' ||trim(form.SRO_BLANK_PHOTO_FILE_3.value) != '')
		{
			if( trim(form.SRO_BLANK_PHOTO_FILE_1.value) != ''){			
						if( trim(form.SRO_BLANK_PHOTO_1_CAPTION.value) == '' ){
							alert("Please provide photo caption");
							bool = false;
							form.SRO_BLANK_PHOTO_1_CAPTION.focus();		
							
						} else if( trim(form.SRO_BLANK_PHOTO_1_PHOTOGRAPHER.value) == '') {
							alert("Please provide photographer name");
							bool = false;
							form.SRO_BLANK_PHOTO_1_PHOTOGRAPHER.focus();					
						}					
			}
			
			if( trim(form.SRO_BLANK_PHOTO_FILE_2.value) != ''){
							if( trim(form.SRO_BLANK_PHOTO_2_CAPTION.value) == '' ){
								alert("Please provide photo caption");
								bool = false;
								form.SRO_BLANK_PHOTO_2_CAPTION.focus();		
							
							} 
							else if( trim(form.SRO_BLANK_PHOTO_2_PHOTOGRAPHER.value) == '') {
								alert("Please provide photographer name");
								bool = false;
								form.SRO_BLANK_PHOTO_2_PHOTOGRAPHER.focus();					
							}		
			 	}
			 	
				if( trim(form.SRO_BLANK_PHOTO_FILE_3.value) != '' ){
						if( trim(form.SRO_BLANK_PHOTO_3_CAPTION.value) == '' ){
							alert("Please provide photo caption");
							bool = false;
							form.SRO_BLANK_PHOTO_3_CAPTION.focus();		
						
						} 
						else if( trim(form.SRO_BLANK_PHOTO_3_PHOTOGRAPHER.value) == '') {
							alert("Please provide photographer name");
							bool = false;
							form.SRO_BLANK_PHOTO_3_PHOTOGRAPHER.focus();					
						}				
				}
			}
		
	}	else
			bool = false;
	
	return bool;	
}

//************ END OF Social Register Observer Validation Form **** //

/************************************************************************************************************************/

// **** Social Register Information Blank Form Validation **** //

function validateInfoblank(form)
{
	bool = true;
	if(form){
		var email = trim(form.INFOBLANK_EMAIL_ADDRESS.value);	
		
		if(trim(form.INFOBLANK_NAME.value) == ''){
				alert("Please provide husband's and wife's full name.");
				form.INFOBLANK_NAME.focus();
				bool = false;						
		}		
		
		else if( email =='')
		{
				alert("Please provide an email address.");
				form.INFOBLANK_EMAIL_ADDRESS.focus();
				bool = false;						
		}
		else if(!validateEmail( trim(form.INFOBLANK_EMAIL_ADDRESS.value) ))
		{
			alert("Please provide a valid email address.");
			form.INFOBLANK_EMAIL_ADDRESS.focus();
			bool = false;			
		}
	}
	else
		bool = false;		

	return bool;
}//END validateInfoblank
