 $(document).ready(function()

{	
	$('#add').hide();
	
	
	$('#sharek').submit(function(eve)
	{
	    eve.preventDefault();	
    	var  name=	$('#name').val();
    	var  country=	$('#country').val();
	    var  title=	$('#title').val();
	    var  topic=	$('#topic').val();
 
		$.post(link+'/sharek/save',{name:name,country:country,title:title,topic:topic},function(html)
	     {	
			if(parseFloat(html))
				{
				document.location="";	
				$('#error').html('insert success').show('slow');		
				}
			else
				{
				$('#error').html(html).show('slow');	
				}	
         })		})

	$('#showbrowse').live('click',function(eve){
	
	eve.preventDefault();
		$('#add').hide();
		$('#browse').show();
	})	
	
		$('#showadd').live('click',function(eve){
	
	eve.preventDefault();
		$('#add').show();
		$('#browse').hide();

	})
	
	
	
	$('#need').submit(function(eve)
{
	eve.preventDefault();	
	
	var  name=	$('#name').val();
	var  email=	$('#email').val();
	var  phone=	$('#phone').val();
	var	 mobile =$('#mobile').val(); 
	var	 blood_type =$('#blood').val();  
	var	 number =$('#number').val();
	var  country=$('#country').val();
	var  town =	$('#town').val();
	var  topic=	$('#topic').val();
	$.post(link+'/need/save',{name:name,email:email,phone:phone,mobile:mobile,  	blood_type:blood_type,number:number,country:country,town:town,other:other},function(html){	
			if(parseFloat(html))
				{
				$('#error').html('insert success').show('slow');		
				}
			else
			{
			$('#error').html(html).show('slow');	
			}	
			
     })	 	}) 	
	

	
	
	$('#contactus').submit(function(eve)
	{
	    eve.preventDefault();	
    	var  name=	$('#name').val();
    	var  email=	$('#email').val();
	    var  title=	$('#title').val();
	    var  message=$('#message').val();
 
		$.post(link+'/contactus/save',{name:name,email:email,title:title,message:message},function(html)
	     {	
			if(parseFloat(html))
				{
				
				document.location="";
					alert("insert success");
				//$('#error').html('insert success').show('slow');		
				}
			else
				{
				$('#error').html(html).show('slow');	
				}	
         })	 		})
	
	
	
		$('#registerss').submit(function(eve)
	{
	    eve.preventDefault();	
    	var  name=	$('#name').val();
    	var  birthdate=	$('#birthdate').val();
    	var  phone=	$('#phone').val();
    	var  mobile=	$('#mobile').val();
    	var  blood_type=	$('#blood_type').val();
    	var  last_tabro=	$('#last_tabro').val();
      	var  country=	$('#country').val();
	    var  town=	$('#town').val();
	    var  user_name=	$('#user_name').val();
	    var  password=	$('#password').val();
 
		$.post(link+'/register/save',{name:name,birthdate:birthdate,phone:phone,mobile:mobile,blood_type:blood_type,last_tabro:last_tabro,country:country,town:town,user_name:user_name,password:password},function(html)
	     {	
			if(parseFloat(html))
				{
					document.location=link+"/register/register2";	
				//$('#error').html('insert success').show('slow');		
				}
			else
				{
				$('#error').html(html).show('slow');	
				}	
         })               })
	
	
	
	
	
	
		$('#articles').submit(function(eve)
	{
	    eve.preventDefault();	
    	var  maqal_title=	$('#maqal_title').val();
    	var  maqal_body=	$('#maqal_body').val();
    	var  maqal_image =	$('#userfile').val();
    	
		$.post(link+'/articles/save',{maqal_title:maqal_title,maqal_body:maqal_body,userfile:maqal_image},function(html)
	     {	
			if(parseFloat(html))
				{
				//	document.location="";	
				$('#error').html('insert success').show('slow');		
				}
			else
				{
				$('#error').html(html).show('slow');	
				}	
         })               })
	
 

		$('#maqal_reply').submit(function(eve)
	{
	    eve.preventDefault();	
    	var  maqal_id=	$('#maqal_id').val();
    	var  reply_body =$('#reply_body').val();
    	//var  user_id =	$('#userfile').val();
    	
		$.post(link+'/articles/save_reply',{maqal_id:maqal_id,reply_body :reply_body},function(html)
	     {	
			if(parseFloat(html))
				{
					document.location="";	
				//$('#error').html('insert success').show('slow');		
				}
				else
				{
				$('#error').html(html).show('slow');	
				}
         })               })
	
	
/*
	$('#show').live('click',function(eve){
	
	eve.preventDefault();
		var  id=$(this).attr('title');
		

	
	document.getElementById(id).style.visibility='visible';
		//$(".test").hide();
//	console.log();

	
	})	
*/
	//console.log(fname);







})


 
 
 
  
 
  		
 
  
 
  
  	
