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).addClass('denied');
			
		}
		else if(!$j(this).emailCheck() && $j(this).attr('id') == 'contactus_email')
		{   
			$j(this).attr('style','border:1px solid #FF0000');
			$j(this).addClass('denied');
		}
		else if($j(this).attr('id') == 'contact_phone' && !checkPhone($j('#'+$j(this).attr('id')).val()))
		{
			$j(this).attr('style','border:1px solid #FF0000');
			$j(this).addClass('denied');
		}
		
		else if($j(this).attr('id') == 'tot_p' && !numCheck($j('#'+$j(this).attr('id')).val()))
		{
			$j(this).attr('style','border:1px solid #FF0000');
			$j(this).addClass('denied');
		}
		
		else
		{
			$j(this).attr('style','border:1px solid #347C17');
			$j(this).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)
					{
						$j('#contactme').html(jData.html);
						$j('.innerpage-con p').hide();
					}
				},
				error: function(XMLHttpRequest, textStatus, errorThrown){
					$j(".contactus-block").html("Some server error occoured. Please report to system administrator.</div>");
				}
		});
	}
}
function checkPhone(elem)
{
var phoneRegExp =/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,13})(-| )?(\d{1})(( x| ext)\d{1,5}){0,1}$/; 
if (elem.match(phoneRegExp)) 
return true;
}

//Contact us Portion Ends



function bookTable(formID)
{
	if($j(".text_box2").isEmpty())
	{	
	$j(".text_box2").attr('style','border:1px solid #FF0000');
	$j(".text_box2").addClass('denied');
	}
	else
		{
			$j(".text_box2").attr('style','border:1px solid #347C17');
			$j(".text_box2").removeClass('denied');
		}
		
	
	$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:'bookatable-process.php',
				data: data,
				dataType:'json',
				success:function(jData){
					if(jData.flag)
					{	
						$j('#cont_block').html("<br/><br/>"+jData.message);
						$j('.innerpage-con p').hide();
					}
				},
				error: function(XMLHttpRequest, textStatus, errorThrown){
					$j(".cont_block").html("Some server error occoured. Please report to system administrator.</div>");
				}
		});
	}
}

/* this is for number only check starts */
function numCheck()
{
					var ph=document.book_table.tot_p.value;
					var phone2 =/^([0-9]|[1-9][0-9]|[1-9][0-9][0-9])$/; 
					if (ph.match(phone2)) 
					{
							return true;
					} 
					else 
					{
							return false;
					}
}
/* this is for number only check ends */











