siteUrl = '/';
$(document).ready(function() {

	if($(".student_occupation").attr("checked")){
		$('.student_occupation_detail').css('display', 'block');
	} else{
		$('.student_occupation_detail').css('display', 'none');
	}
	
	occDetail = $("#UserSchoolName option:selected").text();
	if(occDetail=='Others'){
	$("#UserOccupationStudentText").show();
	}else {
	$("#UserOccupationStudentText").hide();
	}
			
			

$('.resetFck').click(function(){
							  
	$resetmessage = $('#resetFckMessage').attr('value');
	var oEditor = FCKeditorAPI.GetInstance('description') ;
	oEditor.SetHTML($resetmessage );

});

$('.resetFckstyle').click(function(){
							  
	$resetguide = $('#resetStyleFck').attr('value');
	var oEditor = FCKeditorAPI.GetInstance('description') ;
	oEditor.SetHTML($resetguide );

});

$('.resetcontent').click(function(){
								  
	$resetContentMsg = $('#contentreset').attr('value');   
	var oEditor = FCKeditorAPI.GetInstance('description') ;
	oEditor.SetHTML($resetContentMsg );
});


/*$("#message").bind("change", function() {
	$("#message").css("display", "none");
})*/

	// start status change

	var selectFlag = 0;
	$(".select_checkbox").click( function() {
										
		if( !selectFlag  ) {
			$(".status_checkbox").each( function() {
				 	$(".select_checkbox").attr("checked", "true");										 													 
					$(this).attr("checked", "true");
				 });
				selectFlag = 1;
			} else {
				$(".status_checkbox").each( function() {
				 	$(".select_checkbox").removeAttr("checked");										 
					$(this).removeAttr("checked");
				 });
				selectFlag = 0;				
			}
	  });
	
	
	// end status change

$(".divon").bind("click", function() {
			$("#accReason").css('display', 'block');
});

/*$(".editsize").click(function(){

	$("#editsizevalue").css('display' , 'block');
	$(".productsize").attr('value', $(this).attr('alt'));
});*/


$('.file_type').click(function(){   
	if($(this).val()==FileType_Image){
		$('.target_url').css('display', 'block');
	} else{
		$('.target_url').css('display', 'none');
	}
});
//$('.file_type').trigger('click');
/*if($('.file_type').val()==FileType_Image){
	$('.target_url').css('display', 'block');
} else{
	$('.target_url').css('display', 'none');
}*/


$('.student_occupation').click(function(){
	
	if($(this).attr("checked")){
		$('.student_occupation_detail').css('display', 'block');
	} else{
		$('.student_occupation_detail').css('display', 'none');
	}
});
	
	
	$('.student_occupation_detail').change(function(){
		occDetail = $("#UserSchoolName option:selected").text();
			if(occDetail=='Others'){
			$("#UserOccupationStudentText").show();
			}else {
			$("#UserOccupationStudentText").val('');
			$("#UserOccupationStudentText").hide();
			}
												   
	});
	
	$("#btnSubmit").click(function(){
		occDetail = $("#UserSchoolName option:selected").text();
		schoolName = $("#UserOccupationStudentText").val();
		isStudent =  $("#radio_is_student").is(":checked");
		if((occDetail=='Others') && (schoolName=='') && isStudent){
			alert("Please enter the school name.");
			$("#UserOccupationStudentText").css({'background-color' : '#FFEEEE','border': '1px solid #AE0000'});
			$("#UserOccupationStudentText").focus();
			return false;
			}

			if(occDetail=='Select School' && isStudent){
				alert("Please select a school name.");
				$("#UserSchoolName").css({'background-color' : '#FFEEEE','border': '1px solid #AE0000'});
				$("#UserSchoolName").focus();
				return false;
			}	
		
	});
	
});


function defaultId(id) {

	
		window.location.href = siteUrl + 'admin/themes/default1/'+id;
	
}

function deletepoll(id){
	if(confirm('Are you sure you want to delete the Poll question?')) {
		window.location.href = siteUrl + 'admin/polls/delete_poll/'+id;
		
	}
}

function deletegalleryphoto(photoId, galleryName, galleryId){
	if(confirm('Are you sure you want to delete the Photo?')) {
		window.location.href = siteUrl + 'admin/gallery/delete_photo/'+ photoId + '/' +galleryName+'/'+galleryId;
		
	}
}

function deleteprogram(id){
	if(confirm('Are you sure you want to delete the program?')) {
		window.location.href = siteUrl + 'admin/programs/delete_program/'+id;
		
	}
}

function deletekindometer(id){
	if(confirm('Are you sure you want to delete the story?')) {
		window.location.href = siteUrl + 'admin/kindometers/delete_kindometer/'+id;
		
	}
}


function deletedonation(id) {
	if(confirm('Are you sure you want to delete the donation?')) {
		window.location.href = siteUrl + 'admin/donations/delete_donation/'+id;
		
	}
}

function deletegallery(id){
	if(confirm('Are you sure you want to delete the gallery?')) {
		window.location.href = siteUrl + 'admin/gallery/delete_gallery/'+id;
		
	}
}

function deletevideo(id){
	if(confirm('Are you sure you want to delete the video?')) {
		window.location.href = siteUrl + 'admin/villagereels/deletevideo/'+id;
		
	}
}

function deletenews(id){
	if(confirm('Are you sure you want to delete the news?')) {
		window.location.href = siteUrl + 'admin/recent_news/delete/'+id;
		
	}
}
function deleteevent(id){
	if(confirm('Are you sure you want to delete the event?')) {
		window.location.href = siteUrl + 'admin/events/delete/'+id;
		
	}
}

function deleteblog(id){
	if(confirm('Are you sure you want to delete the blog?')) {
		window.location.href = siteUrl + 'admin/blogs/delete/'+id;
		
	}
}

function becomevolunteer(id){
		if(confirm('Are you sure you want to become the Volunteer of this program?')){
			window.location.href = siteUrl + 'volunteers/become_volunteer/'+id;	
		}
	}


function deletethreads(id){
	if(confirm('Are you sure you want to delete the threads?')) {
		window.location.href = siteUrl + 'admin/threads/delete/'+id;
		
	}
}
function deletecomments(id) {
	if(confirm('Are you sure you want to delete the comment?')) {
			window.location.href = siteUrl + 'admin/comments/delete/'+id;
	}
}
function deletereplies(id) {
	if(confirm('Are you sure you want to delete the reply?')) {
			window.location.href = siteUrl + 'admin/replies/delete/'+id;
	}
}

function deletefeatured(id){
	if(confirm('Are you sure you want to delete the featured product?')){
			window.location.href = siteUrl + 'admin/products/delete_featuredproduct/'+id;
		}
}

function deletetheme(id) {
	if(confirm('Are you sure you want to delete the theme?')) {
		window.location.href = siteUrl + 'admin/themes/delete_theme/'+id;
		
	}	
}


