IE7 = (navigator.appVersion.indexOf("MSIE 7.")==-1) ? false : true;
$(document).ready(function(){
	//$("input[type]:text").val('');
	
	$('.input').each(function(){
	$(this).focus(function(){ if($(this).css('color') == 'red'){
	$(this).val('');
}

})
})
})




function validateForm(objForm)
{	

	var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var error = false;
	
	$('.input').each(function(){
	
	
	
	if($(this).val() == '' || $(this).val() == ' - should not be blank')
	{
		$(this).addClass('alert');
		$(this).val(' - should not be blank')	;
		$(this).css('color', 'red');
		error=true;
		
	}
	else { 
		if($(this).attr('id') == 'email' && !regEmail.test($(this).val()) ){
	
			$(this).addClass('alert');
			
			$(this).css('color', 'red');
			vl = $(this).val();
			str = ' - invalid email ';
			//$(this).val(vl+str);
			$(this).val(str);
			error = true;
		}

	}


	});

	if(error)
		return false;
	else
		return true;
	}



/*function validateContact(objForm)
{	
	
	var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var error = false;

	$('.input').each(function(){
	if($(this).attr('id') =='security_code' && $(this).val() == '' )
	{
		
		$(this).parent('div').removeClass('text_box01');
		$(this).parent('div').addClass('text_box01_alert');
		$(this).val(' - should not be blank')	;
		$(this).css('color', 'red');
		error=true;
	
	}

	
	if($(this).val() == '' || $(this).val() == ' - should not be blank')
	{
		if($(this).attr('id') != 'security_code'){
		$(this).parent('div').removeClass('text_box');
		$(this).parent('div').addClass('text_box_alert');
		$(this).val(' - should not be blank')	;
		$(this).css('color', 'red');
		error=true;
	}
	
}
	else 
	{
		if($(this).attr('id') == 'email' && !regEmail.test($(this).val()) )
		{
			$(this).parent('div').removeClass('text_box');
			$(this).parent('div').addClass('text_box_alert');
			$(this).css('color', 'red');
			vl = $(this).val();
			$(this).val('');
			str = ' - invalid email ';
			$(this).val(str);
			error = true;
		}
	}


});


	if(error)	
		return false;
	else
		return true;
	
}
*/


function validateContact(objForm)
{	
	
	var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var error = false;

	if($('#security_code').val() =='' || $('#security_code').val() ==' - should not be blank')
	{
		
		$('#security_code').parent('div').removeClass('text_box01');
		$('#security_code').parent('div').addClass('text_box01_alert');
		$('#security_code').val(' - should not be blank')	;
		$('#security_code').css('color', 'red');
		error=true;
	
	}
	
	if($('#email').val() =='' || $('#email').val() ==' - should not be blank')
	{
		
		$('#email').parent('div').removeClass('text_box01');
		$('#email').parent('div').addClass('text_box_alert');
		$('#email').val(' - should not be blank')	;
		$('#email').css('color', 'red');
		error=true;
	
	}
	else if(!regEmail.test($('#email').val()))
	{	
		$('#email').parent('div').removeClass('text_box');
		$('#email').parent('div').addClass('text_box_alert');
		$('#email').css('color', 'red');
		vl = $('#email').val();
		$('#email').val('');
		str = ' - invalid email ';
		$('#email').val(str);
		error = true;
	}



	if(error)	
		return false;
	else
		return true;
	
}






function validateOrderNow(objForm)
{	
	
	var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var error = false;

	$('.input').each(function(){
	if($(this).attr('id') =='security_code' && $(this).val() == '' )
	{
		
		$(this).parent('div').removeClass('text_box01');
		$(this).parent('div').addClass('text_box01_alert');
		$(this).val(' - should not be blank')	;
		$(this).css('color', 'red');
		error=true;
	
	}

	if($(this).val() == '' || $(this).val() == ' - should not be blank' || alltrim($(this).val()) == '')
	{
		if($(this).attr('id') != 'security_code'){
		$(this).parent('div').removeClass('text_box');
		$(this).parent('div').addClass('text_box_alert');
		$(this).val(' - should not be blank')	;
		$(this).css('color', 'red');
		error=true;
	}
	
}
	else 
	{
		if($(this).attr('id') == 'email' && !regEmail.test($(this).val()) )
		{
			$(this).parent('div').removeClass('text_box');
			$(this).parent('div').addClass('text_box_alert');
			$(this).css('color', 'red');
			vl = $(this).val();
			$(this).val('');
			str = ' - invalid email ';
			$(this).val(str);
			error = true;
		}
	}


});


	if(error)	
		return false;
	else
		return true;
	
}
function alltrim(str) {
 return str.replace(/^\s+|\s+$/g, '');
}
