var $j=jQuery.noConflict();
var subscriptionErrors = false;
$j(document).ready(function(){
// Contact us Portion Starts
	$j(".con-req").focus(function(){
			$j(this).next('span').attr('style','display:inline');
	});
	$j(".con-req").blur(function(){
		$j(this).next('span').attr('style','display:none');
		if($j(this).isEmpty())
		{
			$j(this).next('span').attr('style','display:inline');
			$j(this).next('span').css('background','#F8E48B url(images/bg-span-hint-kindagood.gif) no-repeat 0px 0px');
			$j(this).addClass('denied');
			
		}
		else if(!$j(this).emailCheck() && $j(this).attr('id') == 'contactus_email')
		{
			$j(this).next('span').attr('style','display:inline');
			$j(this).next('span').css('background','#F8E48B url(images/bg-span-hint-kindagood.gif) no-repeat 0px 0px');
			$j(this).addClass('denied');
		}
		else if($j(this).isEmpty() && $j(this).attr('id') == 'subject')
		{
			$j(this).next('span').attr('style','display:inline');
			$j(this).next('span').css('background','#F8E48B url(images/bg-span-hint-kindagood.gif) no-repeat 0px 0px');
			$j(this).addClass('denied');
		}
		/*Captcha validation start*/
		else if($j(this).attr('id') == 'txtCaptcha' && $j(this).attr('value') != $j('#txtcaptcha_correct').attr('value') )

		{   

			$j(this).next('span').attr('style','display:inline');
			$j(this).next('span').css('background','#F8E48B url(images/bg-span-hint-kindagood.gif) no-repeat 0px 0px');
			$j(this).addClass('denied');

		}
		/*Captcha validation End*/
		else
		{
			$j(this).next('span').attr('style','display:inline');
			$j(this).next('span').css('background','#9fd680 url(images/bg-span-hint-welldone.gif) no-repeat 0px 0px');
			$j(this).removeClass('denied');
		}
	});
//Contact us Portion Ends

});
// Contact us Portion Starts
function contactus(formID)
{
	$j(".con-req").blur();
	if($j(".denied").length == 0){
		var data=$j('#'+formID).serializeArray();
		$j(".contactus-block").css('height','100px');
		$j(".contactus-block").html('<div style="width:400px; margin-top:20px; text-align:center;"><img src="images/ajax-loader.gif" border="0"></div>');
		$j.ajax({
				type:'POST',
				url:'contact_mail_send.php',
				data: data,
				dataType:'json',
				success:function(jData){
					if(jData.flag == 1)
					{
						//alert(jData.html);
						$j("#cms").css('display','none');
						$j("#con-area").html('<div style="width:400px;height:100px; margin-top:20px; text-align:left;">'+jData.html+'</div>');
					}
				},
				error: function(XMLHttpRequest, textStatus, errorThrown){
					$j(".contactus-block").html("Some server error occoured. Please report to system administrator.</div>");
				}
		});
	}
}
//Contact us Portion Ends