$(document).ready(function(){
		 
		function p(){
				var sc=$('#security_code').val();
                    $.ajax
                    ({
                        type: "POST",
                        url: "cc.php",
                        data: "security_code="+sc,
                        success: function(msg)
                        {
								if(msg==1){
									document.forms["join"].submit();
								}else if(msg==0){
									alert('Wrong Verify Code , please try again!');
									return false;
								}
                        }
                    });
				}
	
	
	
	
	
	
		 
		function se(){
				var sc=$('#security_code').val();
                    $.ajax
                    ({
                        type: "POST",
                        url: "cc.php",
                        data: "security_code="+sc,
                        success: function(msg)
                        {
								if(msg==1){
									document.forms["me"].submit();
								}else if(msg==0){
									alert('Wrong Verify Code , please try again!');
									return false;
								}
                        }
                    });
				}
	
	
	
	
	
		function ce() {
			
			$("#au").find(':input').each(function() {
				switch(this.type) {
					case 'password':
					case 'select-multiple':
					case 'select-one':
					case 'text':
					case 'textarea':
						$(this).val('');
						break;
					case 'checkbox':
					case 'radio':
						this.checked = false;
				}
			});
			
		}
	
	
	///////// ADMIN //////////////
	
	
	$('.ashit').live('hover',function(){
		$(this).css({'cursor' : 'pointer'});		
		$(this).css({'color' : '#FFFFFF'});						
	});
	
	
	$('.ashit').live('mouseleave',function(){
		$(this).css({'color' : '#000000'});			
	});
	
	
	$('.ashit').live('click',function(){	
		
         var pg = $(this).attr('page');
		 var cs = $("#cs").val();
		$("#cp").val(pg);

		$('#con').load("products.php?page="+pg+"&s="+cs);
		
		
	});
	
	///////// ADMIN //////////////
	
	
	
	
	///////// NEW //////////////
	
	
	$('.shit').live('hover',function(){
		$(this).css({'cursor' : 'pointer'});		
		$(this).css({'color' : '#FFFFFF'});						
	});
	
	
	$('.shit').live('mouseleave',function(){
		$(this).css({'color' : '#000000'});			
	});
	
	
	$('.shit').live('click',function(){	
		
         var pg = $(this).attr('page');
		// var cs = $("#cs").val();
		$("#cp").val(pg);

		window.location = "news.php?page="+pg;
		
		
	});
	
	///////// NEW //////////////
	
	
	
	
	
	
	
	
	
	
	
	
	

		   
				   
//	$(".submit").css("border", "3px double red");   
	
	$("#s_event").click(function() {
		
		var title = $("#title").val();
		var location = $("#location").val();
		var tp = $("#tp").val();
		var m = $("#m").val(); 
		var f = $("#f").val(); 
		var feem = $("#feem").val(); 
		var feenm = $("#feenm").val(); 
		var con = $("#con").val(); 
		
		
		if(title=='' || location=='' || tp=='' || m=='' || f=='' || feem=='' || feenm=='' || con=='')
		{ 
			alert('Please fill in all the fields');
		}else{
			
			 //add(model, pic, title, de);
			 
				return true;
		}
				return false;
	});
	
	
	
	
	
	
	
	
	
	
	$("#cf").click(function() {
							
		var surname = $("#surname").val();			
		var firstname = $("#firstname").val();
		var nickname = $("#nickname").val();
		var em = $("#em").val();
		var mobile = $("#mobile").val();
		
		
		if(surname=='' || firstname=='' || nickname=='' || em=='' || mobile=='')
		{ 
			alert('Please fill in the fields');
			
				return false;
		}else{
			se();
				return false;
		}
				return false;
	});
	
	
	
	
	
	$("#reg").click(function() {
		
		var surname = $("#surname").val();
		var firstname = $("#firstname").val();
		var nickname = $("#nickname").val();
		var em = $("#em").val();
		var m_pass = $("#m_pass").val();
		var m_passs = $("#m_passs").val();
		var mobile = $("#mobile").val();
		
		var gen = $("#gen").val();
		var month = $("#month").val();
		var day = $("#day").val();
		var age = $("#age").val();
		
		var education = $("#education").val();
		var jobNature = $("#jobNature").val();
		var jobtitle = $("#jobtitle").val();
		var religion = $("#religion").val();
		
		
		
		
		
		if(surname=='' || firstname=='' || nickname=='' || em=='' || m_pass=='' || m_passs=='' || mobile=='' || gen=='' || month=='' || day=='' || age=='' || education=='' || jobNature=='' || jobtitle=='' || religion=='')
		{ 
			alert('Please fill in the fields');
				return false;
			
		}else{
			
			if( m_pass !== m_passs){
				
				alert('Password do not match!');
				return false;
					
			}else{
				p();
				return false;
			}
				return false;
		
		}
	});
	
	
	
	
	
	
	
	
	$('#del').live('hover',function(){
		$(this).css({'cursor' : 'pointer'});
	});
	
	$('#del').live('click',function(){
									
		var id = $("#pid").val();
		var cs = $("#cs").val();
		//var did = $(this).attr('did');
		
		if(confirm('Delete this product?')){
						
						//delData(id,cs);
						
		window.location = "del.php?id="+id;
						
						
					}	
		
		 
	});
	
	
	
	
	
			   				   
});
