var $jq = jQuery.noConflict();
$jq(function(){
	//$('#consumerInquery').validate();
	//$('#retailerInquery').validate();
	//showContactForm('retailer');
	//showContactForm('consumerRelated');
	$jq('input[name=contactType]').each(function(){
		$jq(this).click(function(){
			changeContactForm($jq(this).attr('value'));
		});
	});
});

function hideContactForms(){
	//hideContactForm('default');
	hideContactForm('other');
	hideContactForm('retailer');
	hideContactForm('consumer');
	hideContactForm('consumerRelated');
}

function showContactForm(type){
	$jq('#' + type + 'Div').fadeIn(250);
	$jq('#formSelect').blur();
}

function hideContactForm(type){
	$jq('#' + type + 'Div:visible').fadeOut(250);
}

function changeContactForm(type) {
    switch(type){
		case 'consumer':
			hideContactForms();
			showContactForm(type);
			break;
		case 'retailer':
			hideContactForms();
			showContactForm(type);
			break;
		case 'other':
			hideContactForms();
			showContactForm(type);
			break;
		case 'consumerRelated':
		 //   showContactForm('consumerRelated');
		    showContactForm('ContentPlaceHolderMain_contactUs_consumerRelated');
			break;
		case 'notConsumerRelated':
		//    hideContactForm('consumerRelated');
		    hideContactForm('ContentPlaceHolderMain_contactUs_consumerRelated');
			break;
		default:
			// Do nothing
	}
}

function displayRelatedForm(show){
	show ? showContactForm('consumerRelated') : hideContactForm('consumerRelated');
	$jq('#ContentPlaceHolderMain_contactUs_consumerRelatedSelect').blur();
}


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){
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    return false
	}
	 if (str.indexOf(at,(lat+1))!=-1){
	    return false
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return false
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
	    return false
	 }
	 if (str.indexOf(" ")!=-1){
	    return false
	 }
	 return true
}
function GetDOB() {
    if ($jq('#ContentPlaceHolderMain_contactUs_divDOB')) {
        $jq('#ContentPlaceHolderMain_contactUs_divDOB').show();
         return true
    }

  
}
