
//-----------------------------------------------------
//Admin Contact
//-----------------------------------------------------

//Contact Validation
function setAdminContent(title, url){

	var iframeExists;
	
    iframeExists = document.getElementById('admin_IFrame');

	if(iframeExists == null){
	
		var url = universalPostToServer('/post_data/post_data_overlays.php','getsiteurl', '');
		window.location = url + "index.php?page_id=member_account&member_page_id=admin_config";
		
	}else{
		
		document.getElementById('admin_IFrame_title').innerHTML = title;
		document.getElementById('admin_IFrame').setAttribute('src',url);
		
	}

}	


function updateBaseTableGiven(values){
	
	var response = universalPostToServer('/post_data/post_data_maintaintables.php','updatebasetablesingle',values);

	if(response=='1'){
		
		window.location = window.location+'?result='+response;
		
	}else{

	    alert(response);

	}

}

function archiveCurrentProducts(){
	
	try
    {
        
        ValidateInput('archiveProducts');

		var archive_date = document.getElementById('archive_date').value;

		if(archive_date != "") {

			var response = universalPostToServer('/post_data/post_data_admin.php','archiveexistingproducts','archive_date=' + archive_date);
	
			if(response=='1'){
	  
	    		window.location = window.location+'?result='+response;	
  
			}else{

				alert(response);
		
			}

		}else{

			alert('Please provide an archive date.');

		}
		
    
	}catch(err){


    }

	
}



function deleteArchiveDate(archive_date){
	
	if(confirm("Are you sure you want to delete this archive date and all records associated with it?")){

		var response = universalPostToServer('/post_data/post_data_admin.php','deletearchivedate','archive_date=' + archive_date);
	
		if(response=='1'){
  
	   		window.location = window.location+'?result='+response;	
  
		}else{

			alert(response);
		
		}

	}else{

		alert("Archive Cancelled");

	}
	
}






