//########################################################
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];}
function inter_admin(){		
		$(".wait").css('display','block');
		$.ajax({
				type: "POST",
				url: 'admin/core.php',
				data: 'task=main_menu_list',
				success: function(msg){
						$('#admin_layer').html( msg );
						$(".wait").css('display','none');
			$('#admin_layer').css('display','block');							
			$('.back_wait').fadeTo(400,0.6,function(){
													
					$('#admin_layer').animate({
							width : '96%' ,
							height: '10%',
							left  : '2%',
							top   :  0
						  	
						 
						  }, 300, function() {});		
					$('#admin_layer').animate({
							width : '96%' ,
							height: '96%',
							left  : '2%',
							top   :  0
						  	
						 
						  }, 400, function() {});	
													
			});									
						
			   }
			   });
		
		
													 				
 }
function exit_admin(){	
		$('#admin_layer').html('');
		$('#admin_layer').animate({
							width : '96%' ,
							height: '10%',
							left  : '2%',
							top   :  0
						  	
						 
		 }, 300, function() {});	
		$('#admin_layer').animate({
							width : '0' ,
							height: '0',
							left  : '50%',
							top   :  '50%'
							
						  	
						 
		 }, 300, function() {
			 $('.back_wait').fadeOut(400);
			 });
		}
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 47 || charCode > 57))
return false;
return true;}
function ajaxFileUpload(source , file_el_id ,msg_id , check_id ){
		
		$.ajaxFileUpload
		(
			{
				url:source,
				secureuri:false,
				fileElementId:file_el_id,
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							
							document.getElementById(msg_id).innerHTML = data.msg + '<input type="hidden" value="yes" id="'+ check_id +'" /><img src="./image/icon/ok.png" width="18" height="18" />';
							
						}else
						{
							
							document.getElementById(msg_id).innerHTML = data.error +  '<input type="hidden" value="no" id="'+ check_id +'" /><img src="./image/icon/no.png" width="18" height="18" />';
							
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)
		
		return false;

	}	
function ajax_overlayer(str) {	
		$('.back_wait').fadeTo(400,0.6);
		$('#aj_overlayer').delay(400).slideDown(400);
		core('ajax_overlayer_in_page' , str);			}
function close_aj_layer() {	$('#aj_overlayer').slideUp(400);
		$('#ajax_overlayer_in_page').html('');	
		$('.back_wait').delay(500).fadeOut(600);
					}
function admin_core(target_id,str){	$(".wait").css('display','block');
				$.ajax({
				type: "POST",
				url: 'admin/core.php',
				data: str,
				success: function(msg){
						$('#'+target_id).html( msg );
						$('#'+target_id).slideDown(300);
						$(".wait").css('display','none');
			   }
			   });	}
function cansel(target_id) {
	$('#'+target_id).html('');	}
function core(target_id,str){	
				$(".wait").css('display','block');
				$.ajax({
				type: "POST",
				url: 'core.php',
				data: str,
				success: function(msg){
					$('html, body').animate({ scrollTop: 0 }, 1000,function(){
						$('#'+target_id).fadeOut(450,function(){
						
						$('#slide_show').slideUp( 450 );
						$('#'+target_id).html( msg );
						
																		$('#'+target_id).slideDown(600);	   
																			   });
						
						$(".wait").css('display','none');
															  });
			   }
			   });	}
function show_hide_menu(target_id) {
	
	
	var old_t = $('#old_menu_id').val();
	if ( old_t == target_id ) {
		 $("."+target_id).slideToggle(480);	
	}
	else {
		$("."+target_id).slideDown(480);
		if ( old_t != "" ) {
		$("."+old_t).slideUp(600);
		}
		 $('#old_menu_id').val(target_id);	
	} }

