$(function(){
	/******************************************/
	/**  Custom drop down action             **/
	/******************************************/
	$(".dropdownStyle").bind('change',
		function()
		{
			var selectedText = $('option:selected', $(this)).text();
			$('.dropdownSelectText', $(this).parent()).html(selectedText);
		}
	)
	$(".dropdownStyle").trigger('change');
	
	/******************************************/
	/**         Accordion action             **/
	/******************************************/
	$('#head1 a,#head2 a').click(function(){					
		if($("#accordionContentMask1").is(":visible")) {	
			$('#accordionContentMask1').animate({width: 0}, 1000, function(){$('#accordionContentMask1, #howWork').hide();})
			$('#accordionContentMask2').animate({width: 467}, 1000)
			$('#accordionContentMask2, #welcome').show();
			 $('#head2 a').addClass('selected')
			$('#head1 a').removeClass('selected')
				
			
		} else  { 
			$('#head1 a').addClass('selected')
			$('#head2 a').removeClass('selected')
			$('#accordionContentMask2').animate({width: 0}, 1000, function(){$('#accordionContentMask2, #welcome').hide();})
			$('#accordionContentMask1').animate({width: 467}, 1000)
			$('#accordionContentMask1, #howWork').show();
	
			}			
	})
	$('#zip').click(function(){
		if($(this).val()== 'Zip Code')
			$(this).val('');
	}).blur(function(){
		if($(this).val()== '')
			$(this).val('Zip Code');
	});
	$('img').live('myCustomEvent',function(){
		var imgTag = '<div class="loaderArea"><span class="loaderImg"><img src="images/preLoader1.gif"/></span><span class="loaderText">Just a moment..</span></div>';
		$('.blockMsg').css({"width":"220px","height":"61px"});
		$('.blockMsg').html(imgTag);		
	});
	$('#imageSubmit').click(function () {
		$("img").trigger("myCustomEvent");
	});
})
function populateUserMainCategory()
{
	mainCat = document.getElementById('User_MainCategory');
	subCat = document.getElementById('User_SubCategory');
	allSubj = document.getElementById('AllSubjects');

	subjValue = allSubj.options[allSubj.selectedIndex].value;

	splitValue = subjValue.split('|');
	mainCat.value = splitValue[0];
	subCat.value = splitValue[1];
}
function validate()
{
	var respValue = '';
	if ($('option:selected', $('#AllSubjects')).val() == '')
	{
		respValue = 'Select Your Subject of Interest <br/>';
	}
	if($('#zip').val() == '' || $('#zip').val() == 'Zip Code')
	{
		respValue += 'Enter your zipcode';
	}
	if(respValue != '')
	{
		scroll(0,0);
		$('#errorDisplayText').html(respValue);
		$('#errorDisplayText').append("<div id='sliderClose'></div>");
		$("#errorDisplayText").slideDown("slow");
		$("#sliderClose").click(function(){
			$("#errorDisplayText").slideUp("slow");
		});
		return false;
	}
	return true;
}

