var $j=jQuery.noConflict();
var subscriptionErrors = false;
$j(document).ready(function(){
// Contact us Portion Starts
	$j(".text_box1").focus(function(){
			$j(this).next('span').attr('style','display:inline');
	});
	$j(".text_box1").blur(function(){
		$j(this).next('span').attr('style','display:none');
		if($j(this).isEmpty())
		{	
			$j(this).attr('style','border:1px solid #FF0000');
			$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).attr('style','border:1px solid #FF0000');
			$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).attr('id') == 'contact_mob')
		{
					var ph=document.frmcontactus.contact_mob.value;
					var phone2 =/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/; 
					if (ph.match(phone2)) 
					{
						//alert(ph);

						$j(this).attr('style','border:1px solid #347C17');
							$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');
							//return true;
					} 
					else 
					{
						//alert("Invalid");

							$j(this).attr('style','border:1px solid #FF0000');
							$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');
							//return false;
					}
		}
		else
		{
			$j(this).attr('style','border:1px solid #347C17');
			$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');
		}
	});
	$j(".reset").click(function(){
		$j(":input").next('span').attr('style','display:none;');
		$j(":input").attr('style','border:1px solid #C3C3C3;');
		$j(":input").removeClass('denied');
	});

//Contact us Portion Ends

});
// Contact us Portion Starts
function contactus(formID)
{

	$j(".text_box1").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('.contactinfo').html(jData.html);
						//$j('.innerpage-con p').hide();
						//$j('#thankyouDiv').slideDown();
						//$j('#thankyouDiv').show();
						//$j("#thankyouDiv").html(jData.msg);
					}
				},
				error: function(XMLHttpRequest, textStatus, errorThrown){
					$j(".contactus-block").html("Some server error occoured. Please report to system administrator.</div>");
				}
		});
	}
}
//Contact us Portion Ends
