function doShowHideSecondProfile( sShow, eForm ) {
	if( sShow == 'yes' )
		$( '.form_second_col', eForm ).css( 'display', '' );
	else
		$( '.form_second_col', eForm ).css( 'display', 'none' );
}

function validateJoinForm( eForm ) {
	if( !eForm )
		return false;
	
	hideJoinFormErrors( eForm );
	
	$(eForm).ajaxSubmit(function(sResponce) {
		//alert( sResponce );
		try {
			var aErrors = eval(sResponce);
		} catch(e) {
			return false;
		}
		
		doShowJoinErrors( aErrors, eForm );
	} );
	
	return false;
}
function checkout(str)
{
	var count=str.options.length;
	var index = str.selectedIndex;
	if (index < 0){ return null; }
	var a = new Array(), ops = str.options;
	var max = ops.length;
	
	for(var i=0; i < max; i++)
	{
		 var op = ops[i];
		 if (op.selected) {
			 
			  var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
				a.push(v);
		 }
		
	}

	for (y=0; y<a.length; y++)
	{
		
				   if(a[y]=="canine (Dogs)"){
						document.getElementById("Canine (Dog)1").style.display='';	
						break;
					}else{
						document.getElementById("Canine (Dog)1").style.display='none';	
					}
	} 
	for (y=0; y<a.length; y++)
	{
		
					if(a[y]=="Feline (Cats)")
					{
						document.getElementById("Feline Cat1").style.display='';
						break;
					}else{
						
						document.getElementById("Feline Cat1").style.display='none';
					}
	}
	
	for (y=0; y<a.length; y++)
	{
		
					if(a[y]=="Equine (Horses)")
					{
						document.getElementById("Equine (Dog)1").style.display='';
						break;
					}else
					{
						document.getElementById("Equine (Dog)1").style.display='none';
						
					}
	}
	for (y=0; y<a.length; y++)
	{
		if(a[y]!="Equine (Horses)" && a[y]!="Feline (Cats)" && a[y]!="canine (Dogs)")
		{
			document.getElementById("Others1").style.display='';
		}else{
			document.getElementById("Others1").style.display='none';
		}
		
	}
	
}
function showanotherblock(anotherblog)
{
	var newstring;
	newstring=anotherblog.replace ("kumar", " ");
	newstring=newstring.replace ("lal", "(");
	newstring=newstring.replace ("jain", ")");
	document.getElementById(newstring).style.display='';
}
function grayid()
{

	//document.getElementById("PET_SPECIESdis").disabled="disabled";
/*	
	document.getElementById("AddAnotherpet").disabled="disabled";
	document.getElementById("nomoresubscription").disabled="disabled";*/
	
	 for (var n=0; n < document.join_form.elements.length; n++) {
		      if(document.join_form.elements[n].type=="button")
				{
					document.join_form.elements[n].disabled="disabled";
				}
		  }
}



function hideJoinFormErrors( eForm ) {
	$( 'img.form_warn_icon', eForm ).css( 'display', 'none' );
	$( '.input_erroneus', eForm ).removeClass( 'input_erroneus' );
}

function doShowJoinErrors( aErrors, eForm ) {
	if( !aErrors || !eForm )
		return false;
	
	var bHaveErrors = false;
	
	for( var iInd = 0; iInd < aErrors.length; iInd ++ ) {
		var aErrorsInd = aErrors[iInd];
		for( var sField in aErrorsInd ) {
			var sError = aErrorsInd[ sField ];
			bHaveErrors = true;
			
			doShowError( eForm, sField, iInd, sError );
		}
	}
	
	if( !bHaveErrors )
		eForm.submit();
}

function doShowError( eForm, sField, iInd, sError ) {
	var $Field = $( "[name='" + sField + "']", eForm ); // single (system) field
	if( !$Field.length ) // couple field
		$Field = $( "[name='" + sField + '[' + iInd + ']' + "']", eForm );
	if( !$Field.length ) // couple multi-select
		$Field = $( "[name='" + sField + '[' + iInd + '][]' + "']", eForm );
	if( !$Field.length ) // couple range (two fields)
		$Field = $( "[name='" + sField + '[' + iInd + '][0]' + "'],[name='" + sField + '[' + iInd + '][1]' + "']", eForm );
	
	//alert( sField + ' ' + $Field.length );
	
	$Field.addClass( 'input_erroneus' );
	
	$Icon = $Field.siblings( 'img.form_warn_icon' );
	$Icon.css( 'display', '' );
	$Icon.mouseover( function(){ showFloatDesc(sError) } );
}

